Implement NonSemantic.Shader.DebugInfo.100

See https://github.com/KhronosGroup/SPIRV-Registry.
This commit is contained in:
Jeremy Hayes 2021-12-09 16:26:48 -07:00
parent 9e78bc8108
commit 7a914ce926
55 changed files with 11275 additions and 96 deletions

View File

@ -146,6 +146,7 @@ genrule(
"SPIRV/GLSL.ext.NV.h",
"SPIRV/GLSL.std.450.h",
"SPIRV/NonSemanticDebugPrintf.h",
"SPIRV/NonSemanticShaderDebugInfo100.h",
"SPIRV/spirv.hpp",
],
outs = [
@ -155,6 +156,7 @@ genrule(
"include/SPIRV/GLSL.ext.NV.h",
"include/SPIRV/GLSL.std.450.h",
"include/SPIRV/NonSemanticDebugPrintf.h",
"include/SPIRV/NonSemanticShaderDebugInfo100.h",
"include/SPIRV/spirv.hpp",
],
cmd_bash = "mkdir -p $(@D)/include/SPIRV && cp $(SRCS) $(@D)/include/SPIRV/",

View File

@ -133,6 +133,7 @@ template("glslang_sources_common") {
"SPIRV/Logger.cpp",
"SPIRV/Logger.h",
"SPIRV/NonSemanticDebugPrintf.h",
"SPIRV/NonSemanticShaderDebugInfo100.h",
"SPIRV/SPVRemapper.cpp",
"SPIRV/SPVRemapper.h",
"SPIRV/SpvBuilder.cpp",

View File

@ -86,6 +86,8 @@ GLSLANG_EXPORT void glslang_program_SPIRV_generate(glslang_program_t* program, g
glslang_spv_options_t spv_options;
spv_options.generate_debug_info = false;
spv_options.strip_debug_info = false;
spv_options.emit_nonsemantic_shader_debug_info = false;
spv_options.emit_nonsemantic_shader_debug_source = false;
spv_options.disable_optimizer = true;
spv_options.optimize_size = false;
spv_options.disassemble = false;

View File

@ -62,7 +62,8 @@ set(HEADERS
disassemble.h
GLSL.ext.AMD.h
GLSL.ext.NV.h
NonSemanticDebugPrintf.h)
NonSemanticDebugPrintf.h
NonSemanticShaderDebugInfo100.h)
set(SPVREMAP_HEADERS
SPVRemapper.h

View File

@ -1557,6 +1557,10 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
for (auto iItr = include_txt.begin(); iItr != include_txt.end(); ++iItr)
builder.addInclude(iItr->first, iItr->second);
}
builder.setEmitNonSemanticShaderDebugInfo(options.emitNonSemanticShaderDebugInfo);
builder.setEmitNonSemanticShaderDebugSource(options.emitNonSemanticShaderDebugSource);
stdBuiltins = builder.import("GLSL.std.450");
spv::AddressingModel addressingModel = spv::AddressingModelLogical;
@ -2498,6 +2502,14 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
return false;
}
// Force variable declaration - Debug Mode Only
if (node->getOp() == glslang::EOpDeclare) {
builder.clearAccessChain();
node->getOperand()->traverse(this);
builder.clearAccessChain();
return false;
}
// Start by evaluating the operand
// Does it need a swizzle inversion? If so, evaluation is inverted;
@ -2758,32 +2770,38 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
spv::Decoration precision = TranslatePrecisionDecoration(node->getOperationPrecision());
switch (node->getOp()) {
case glslang::EOpScope:
case glslang::EOpSequence:
{
if (preVisit)
if (visit == glslang::EvPreVisit) {
++sequenceDepth;
else
if (sequenceDepth == 1) {
// If this is the parent node of all the functions, we want to see them
// early, so all call points have actual SPIR-V functions to reference.
// In all cases, still let the traverser visit the children for us.
makeFunctions(node->getAsAggregate()->getSequence());
// Also, we want all globals initializers to go into the beginning of the entry point, before
// anything else gets there, so visit out of order, doing them all now.
makeGlobalInitializers(node->getAsAggregate()->getSequence());
//Pre process linker objects for ray tracing stages
if (glslangIntermediate->isRayTracingStage())
collectRayTracingLinkerObjects();
// Initializers are done, don't want to visit again, but functions and link objects need to be processed,
// so do them manually.
visitFunctions(node->getAsAggregate()->getSequence());
return false;
} else {
if (node->getOp() == glslang::EOpScope)
builder.enterScope(0);
}
} else {
if (sequenceDepth > 1 && node->getOp() == glslang::EOpScope)
builder.leaveScope();
--sequenceDepth;
if (sequenceDepth == 1) {
// If this is the parent node of all the functions, we want to see them
// early, so all call points have actual SPIR-V functions to reference.
// In all cases, still let the traverser visit the children for us.
makeFunctions(node->getAsAggregate()->getSequence());
// Also, we want all globals initializers to go into the beginning of the entry point, before
// anything else gets there, so visit out of order, doing them all now.
makeGlobalInitializers(node->getAsAggregate()->getSequence());
//Pre process linker objects for ray tracing stages
if (glslangIntermediate->isRayTracingStage())
collectRayTracingLinkerObjects();
// Initializers are done, don't want to visit again, but functions and link objects need to be processed,
// so do them manually.
visitFunctions(node->getAsAggregate()->getSequence());
return false;
}
return true;
@ -2812,6 +2830,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
if (isShaderEntryPoint(node)) {
inEntryPoint = true;
builder.setBuildPoint(shaderEntry->getLastBlock());
builder.enterFunction(shaderEntry);
currentFunction = shaderEntry;
} else {
handleFunctionEntry(node);
@ -3796,8 +3815,8 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn
// by a block-ending branch. But we don't want to put any other body/test
// instructions in it, since the body/test may have arbitrary instructions,
// including merges of its own.
builder.setLine(node->getLoc().line, node->getLoc().getFilename());
builder.setBuildPoint(&blocks.head);
builder.setLine(node->getLoc().line, node->getLoc().getFilename());
builder.createLoopMerge(&blocks.merge, &blocks.continue_target, control, operands);
if (node->testFirst() && node->getTest()) {
spv::Block& test = builder.makeNewBlock();
@ -4016,7 +4035,7 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol*
initializer = builder.makeNullConstant(spvType);
}
return builder.createVariable(spv::NoPrecision, storageClass, spvType, name, initializer);
return builder.createVariable(spv::NoPrecision, storageClass, spvType, name, initializer, false);
}
// Return type Id of the sampled type.
@ -4104,7 +4123,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
if (explicitLayout != glslang::ElpNone)
spvType = builder.makeUintType(32);
else
spvType = builder.makeBoolType();
spvType = builder.makeBoolType(false);
break;
case glslang::EbtInt:
spvType = builder.makeIntType(32);
@ -4422,14 +4441,14 @@ spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TTy
// except sometimes for blocks
std::vector<std::pair<glslang::TType*, glslang::TQualifier> > deferredForwardPointers;
for (int i = 0; i < (int)glslangMembers->size(); i++) {
glslang::TType& glslangMember = *(*glslangMembers)[i].type;
if (glslangMember.hiddenMember()) {
auto& glslangMember = (*glslangMembers)[i];
if (glslangMember.type->hiddenMember()) {
++memberDelta;
if (type.getBasicType() == glslang::EbtBlock)
memberRemapper[glslangTypeToIdMap[glslangMembers]][i] = -1;
} else {
if (type.getBasicType() == glslang::EbtBlock) {
if (filterMember(glslangMember)) {
if (filterMember(*glslangMember.type)) {
memberDelta++;
memberRemapper[glslangTypeToIdMap[glslangMembers]][i] = -1;
continue;
@ -4437,7 +4456,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TTy
memberRemapper[glslangTypeToIdMap[glslangMembers]][i] = i - memberDelta;
}
// modify just this child's view of the qualifier
glslang::TQualifier memberQualifier = glslangMember.getQualifier();
glslang::TQualifier memberQualifier = glslangMember.type->getQualifier();
InheritQualifiers(memberQualifier, qualifier);
// manually inherit location
@ -4448,25 +4467,38 @@ spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TTy
bool lastBufferBlockMember = qualifier.storage == glslang::EvqBuffer &&
i == (int)glslangMembers->size() - 1;
// Make forward pointers for any pointer members, and create a list of members to
// convert to spirv types after creating the struct.
if (glslangMember.isReference()) {
if (forwardPointers.find(glslangMember.getReferentType()) == forwardPointers.end()) {
deferredForwardPointers.push_back(std::make_pair(&glslangMember, memberQualifier));
}
spvMembers.push_back(
convertGlslangToSpvType(glslangMember, explicitLayout, memberQualifier, lastBufferBlockMember,
true));
} else {
spvMembers.push_back(
convertGlslangToSpvType(glslangMember, explicitLayout, memberQualifier, lastBufferBlockMember,
false));
// Make forward pointers for any pointer members.
if (glslangMember.type->isReference() &&
forwardPointers.find(glslangMember.type->getReferentType()) == forwardPointers.end()) {
deferredForwardPointers.push_back(std::make_pair(glslangMember.type, memberQualifier));
}
// Create the member type.
auto const spvMember = convertGlslangToSpvType(*glslangMember.type, explicitLayout, memberQualifier, lastBufferBlockMember,
glslangMember.type->isReference());
spvMembers.push_back(spvMember);
// Update the builder with the type's location so that we can create debug types for the structure members.
// There doesn't exist a "clean" entry point for this information to be passed along to the builder so, for now,
// it is stored in the builder and consumed during the construction of composite debug types.
// TODO: This probably warrants further investigation. This approach was decided to be the least ugly of the
// quick and dirty approaches that were tried.
// Advantages of this approach:
// + Relatively clean. No direct calls into debug type system.
// + Handles nested recursive structures.
// Disadvantages of this approach:
// + Not as clean as desired. Traverser queries/sets persistent state. This is fragile.
// + Table lookup during creation of composite debug types. This really shouldn't be necessary.
if(options.emitNonSemanticShaderDebugInfo) {
builder.debugTypeLocs[spvMember].name = glslangMember.type->getFieldName().c_str();
builder.debugTypeLocs[spvMember].line = glslangMember.loc.line;
builder.debugTypeLocs[spvMember].column = glslangMember.loc.column;
}
}
}
// Make the SPIR-V type
spv::Id spvType = builder.makeStructType(spvMembers, type.getTypeName().c_str());
spv::Id spvType = builder.makeStructType(spvMembers, type.getTypeName().c_str(), false);
if (! HasNonLayoutQualifiers(type, qualifier))
structMap[explicitLayout][qualifier.layoutMatrix][glslangMembers] = spvType;
@ -5060,6 +5092,7 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF
// GLSL has copy-in/copy-out semantics. They can be handled though with a pointer to a copy.
std::vector<spv::Id> paramTypes;
std::vector<char const*> paramNames;
std::vector<std::vector<spv::Decoration>> paramDecorations; // list of decorations per parameter
glslang::TIntermSequence& parameters = glslFunction->getSequence()[0]->getAsAggregate()->getSequence();
@ -5084,10 +5117,14 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF
paramTypes.push_back(typeId);
}
for (auto const parameter:parameters) {
paramNames.push_back(parameter->getAsSymbolNode()->getName().c_str());
}
spv::Block* functionBlock;
spv::Function *function = builder.makeFunctionEntry(TranslatePrecisionDecoration(glslFunction->getType()),
convertGlslangToSpvType(glslFunction->getType()),
glslFunction->getName().c_str(), paramTypes,
glslFunction->getName().c_str(), paramTypes, paramNames,
paramDecorations, &functionBlock);
if (implicitThis)
function->setImplicitThis();
@ -5177,6 +5214,7 @@ void TGlslangToSpvTraverser::handleFunctionEntry(const glslang::TIntermAggregate
currentFunction = functionMap[node->getName().c_str()];
spv::Block* functionBlock = currentFunction->getEntryBlock();
builder.setBuildPoint(functionBlock);
builder.enterFunction(currentFunction);
}
void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& node, std::vector<spv::Id>& arguments,

View File

@ -0,0 +1,171 @@
// Copyright (c) 2018 The Khronos Group Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and/or associated documentation files (the "Materials"),
// to deal in the Materials without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Materials, and to permit persons to whom the
// Materials are furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Materials.
//
// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
//
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
// IN THE MATERIALS.
#ifndef SPIRV_UNIFIED1_NonSemanticShaderDebugInfo100_H_
#define SPIRV_UNIFIED1_NonSemanticShaderDebugInfo100_H_
#ifdef __cplusplus
extern "C" {
#endif
enum {
NonSemanticShaderDebugInfo100Version = 100,
NonSemanticShaderDebugInfo100Version_BitWidthPadding = 0x7fffffff
};
enum {
NonSemanticShaderDebugInfo100Revision = 6,
NonSemanticShaderDebugInfo100Revision_BitWidthPadding = 0x7fffffff
};
enum NonSemanticShaderDebugInfo100Instructions {
NonSemanticShaderDebugInfo100DebugInfoNone = 0,
NonSemanticShaderDebugInfo100DebugCompilationUnit = 1,
NonSemanticShaderDebugInfo100DebugTypeBasic = 2,
NonSemanticShaderDebugInfo100DebugTypePointer = 3,
NonSemanticShaderDebugInfo100DebugTypeQualifier = 4,
NonSemanticShaderDebugInfo100DebugTypeArray = 5,
NonSemanticShaderDebugInfo100DebugTypeVector = 6,
NonSemanticShaderDebugInfo100DebugTypedef = 7,
NonSemanticShaderDebugInfo100DebugTypeFunction = 8,
NonSemanticShaderDebugInfo100DebugTypeEnum = 9,
NonSemanticShaderDebugInfo100DebugTypeComposite = 10,
NonSemanticShaderDebugInfo100DebugTypeMember = 11,
NonSemanticShaderDebugInfo100DebugTypeInheritance = 12,
NonSemanticShaderDebugInfo100DebugTypePtrToMember = 13,
NonSemanticShaderDebugInfo100DebugTypeTemplate = 14,
NonSemanticShaderDebugInfo100DebugTypeTemplateParameter = 15,
NonSemanticShaderDebugInfo100DebugTypeTemplateTemplateParameter = 16,
NonSemanticShaderDebugInfo100DebugTypeTemplateParameterPack = 17,
NonSemanticShaderDebugInfo100DebugGlobalVariable = 18,
NonSemanticShaderDebugInfo100DebugFunctionDeclaration = 19,
NonSemanticShaderDebugInfo100DebugFunction = 20,
NonSemanticShaderDebugInfo100DebugLexicalBlock = 21,
NonSemanticShaderDebugInfo100DebugLexicalBlockDiscriminator = 22,
NonSemanticShaderDebugInfo100DebugScope = 23,
NonSemanticShaderDebugInfo100DebugNoScope = 24,
NonSemanticShaderDebugInfo100DebugInlinedAt = 25,
NonSemanticShaderDebugInfo100DebugLocalVariable = 26,
NonSemanticShaderDebugInfo100DebugInlinedVariable = 27,
NonSemanticShaderDebugInfo100DebugDeclare = 28,
NonSemanticShaderDebugInfo100DebugValue = 29,
NonSemanticShaderDebugInfo100DebugOperation = 30,
NonSemanticShaderDebugInfo100DebugExpression = 31,
NonSemanticShaderDebugInfo100DebugMacroDef = 32,
NonSemanticShaderDebugInfo100DebugMacroUndef = 33,
NonSemanticShaderDebugInfo100DebugImportedEntity = 34,
NonSemanticShaderDebugInfo100DebugSource = 35,
NonSemanticShaderDebugInfo100DebugFunctionDefinition = 101,
NonSemanticShaderDebugInfo100DebugSourceContinued = 102,
NonSemanticShaderDebugInfo100DebugLine = 103,
NonSemanticShaderDebugInfo100DebugNoLine = 104,
NonSemanticShaderDebugInfo100DebugBuildIdentifier = 105,
NonSemanticShaderDebugInfo100DebugStoragePath = 106,
NonSemanticShaderDebugInfo100DebugEntryPoint = 107,
NonSemanticShaderDebugInfo100DebugTypeMatrix = 108,
NonSemanticShaderDebugInfo100InstructionsMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfo100DebugInfoFlags {
NonSemanticShaderDebugInfo100None = 0x0000,
NonSemanticShaderDebugInfo100FlagIsProtected = 0x01,
NonSemanticShaderDebugInfo100FlagIsPrivate = 0x02,
NonSemanticShaderDebugInfo100FlagIsPublic = 0x03,
NonSemanticShaderDebugInfo100FlagIsLocal = 0x04,
NonSemanticShaderDebugInfo100FlagIsDefinition = 0x08,
NonSemanticShaderDebugInfo100FlagFwdDecl = 0x10,
NonSemanticShaderDebugInfo100FlagArtificial = 0x20,
NonSemanticShaderDebugInfo100FlagExplicit = 0x40,
NonSemanticShaderDebugInfo100FlagPrototyped = 0x80,
NonSemanticShaderDebugInfo100FlagObjectPointer = 0x100,
NonSemanticShaderDebugInfo100FlagStaticMember = 0x200,
NonSemanticShaderDebugInfo100FlagIndirectVariable = 0x400,
NonSemanticShaderDebugInfo100FlagLValueReference = 0x800,
NonSemanticShaderDebugInfo100FlagRValueReference = 0x1000,
NonSemanticShaderDebugInfo100FlagIsOptimized = 0x2000,
NonSemanticShaderDebugInfo100FlagIsEnumClass = 0x4000,
NonSemanticShaderDebugInfo100FlagTypePassByValue = 0x8000,
NonSemanticShaderDebugInfo100FlagTypePassByReference = 0x10000,
NonSemanticShaderDebugInfo100FlagUnknownPhysicalLayout = 0x20000,
NonSemanticShaderDebugInfo100DebugInfoFlagsMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfo100BuildIdentifierFlags {
NonSemanticShaderDebugInfo100IdentifierPossibleDuplicates = 0x01,
NonSemanticShaderDebugInfo100BuildIdentifierFlagsMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfo100DebugBaseTypeAttributeEncoding {
NonSemanticShaderDebugInfo100Unspecified = 0,
NonSemanticShaderDebugInfo100Address = 1,
NonSemanticShaderDebugInfo100Boolean = 2,
NonSemanticShaderDebugInfo100Float = 3,
NonSemanticShaderDebugInfo100Signed = 4,
NonSemanticShaderDebugInfo100SignedChar = 5,
NonSemanticShaderDebugInfo100Unsigned = 6,
NonSemanticShaderDebugInfo100UnsignedChar = 7,
NonSemanticShaderDebugInfo100DebugBaseTypeAttributeEncodingMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfo100DebugCompositeType {
NonSemanticShaderDebugInfo100Class = 0,
NonSemanticShaderDebugInfo100Structure = 1,
NonSemanticShaderDebugInfo100Union = 2,
NonSemanticShaderDebugInfo100DebugCompositeTypeMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfo100DebugTypeQualifier {
NonSemanticShaderDebugInfo100ConstType = 0,
NonSemanticShaderDebugInfo100VolatileType = 1,
NonSemanticShaderDebugInfo100RestrictType = 2,
NonSemanticShaderDebugInfo100AtomicType = 3,
NonSemanticShaderDebugInfo100DebugTypeQualifierMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfo100DebugOperation {
NonSemanticShaderDebugInfo100Deref = 0,
NonSemanticShaderDebugInfo100Plus = 1,
NonSemanticShaderDebugInfo100Minus = 2,
NonSemanticShaderDebugInfo100PlusUconst = 3,
NonSemanticShaderDebugInfo100BitPiece = 4,
NonSemanticShaderDebugInfo100Swap = 5,
NonSemanticShaderDebugInfo100Xderef = 6,
NonSemanticShaderDebugInfo100StackValue = 7,
NonSemanticShaderDebugInfo100Constu = 8,
NonSemanticShaderDebugInfo100Fragment = 9,
NonSemanticShaderDebugInfo100DebugOperationMax = 0x7fffffff
};
enum NonSemanticShaderDebugInfo100DebugImportedEntity {
NonSemanticShaderDebugInfo100ImportedModule = 0,
NonSemanticShaderDebugInfo100ImportedDeclaration = 1,
NonSemanticShaderDebugInfo100DebugImportedEntityMax = 0x7fffffff
};
#ifdef __cplusplus
}
#endif
#endif // SPIRV_UNIFIED1_NonSemanticShaderDebugInfo100_H_

View File

@ -59,12 +59,15 @@ namespace spv {
Builder::Builder(unsigned int spvVersion, unsigned int magicNumber, SpvBuildLogger* buildLogger) :
spvVersion(spvVersion),
source(SourceLanguageUnknown),
sourceLang(SourceLanguageUnknown),
sourceVersion(0),
sourceFileStringId(NoResult),
currentLine(0),
currentFile(nullptr),
currentFileId(NoResult),
lastDebugScopeId(NoResult),
emitOpLines(false),
emitNonSemanticShaderDebugInfo(false),
addressModel(AddressingModelLogical),
memoryModel(MemoryModelGLSL450),
builderNumber(magicNumber),
@ -98,8 +101,12 @@ void Builder::setLine(int lineNum)
{
if (lineNum != 0 && lineNum != currentLine) {
currentLine = lineNum;
if (emitOpLines)
addLine(sourceFileStringId, currentLine, 0);
if (emitOpLines) {
if (emitNonSemanticShaderDebugInfo)
addDebugScopeAndLine(currentFileId, currentLine, 0);
else
addLine(sourceFileStringId, currentLine, 0);
}
}
}
@ -118,7 +125,10 @@ void Builder::setLine(int lineNum, const char* filename)
currentFile = filename;
if (emitOpLines) {
spv::Id strId = getStringId(filename);
addLine(strId, currentLine, 0);
if (emitNonSemanticShaderDebugInfo)
addDebugScopeAndLine(strId, currentLine, 0);
else
addLine(strId, currentLine, 0);
}
}
}
@ -132,22 +142,49 @@ void Builder::addLine(Id fileName, int lineNum, int column)
buildPoint->addInstruction(std::unique_ptr<Instruction>(line));
}
void Builder::addDebugScopeAndLine(Id fileName, int lineNum, int column)
{
if (currentDebugScopeId.top() != lastDebugScopeId) {
spv::Id resultId = getUniqueId();
Instruction* scopeInst = new Instruction(resultId, makeVoidType(), OpExtInst);
scopeInst->addIdOperand(nonSemanticShaderDebugInfo);
scopeInst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugScope);
scopeInst->addIdOperand(currentDebugScopeId.top());
buildPoint->addInstruction(std::unique_ptr<Instruction>(scopeInst));
lastDebugScopeId = currentDebugScopeId.top();
}
spv::Id resultId = getUniqueId();
Instruction* lineInst = new Instruction(resultId, makeVoidType(), OpExtInst);
lineInst->addIdOperand(nonSemanticShaderDebugInfo);
lineInst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugLine);
lineInst->addIdOperand(makeDebugSource(fileName));
lineInst->addIdOperand(makeUintConstant(lineNum));
lineInst->addIdOperand(makeUintConstant(lineNum));
lineInst->addIdOperand(makeUintConstant(column));
lineInst->addIdOperand(makeUintConstant(column));
buildPoint->addInstruction(std::unique_ptr<Instruction>(lineInst));
}
// For creating new groupedTypes (will return old type if the requested one was already made).
Id Builder::makeVoidType()
{
Instruction* type;
if (groupedTypes[OpTypeVoid].size() == 0) {
type = new Instruction(getUniqueId(), NoType, OpTypeVoid);
Id typeId = getUniqueId();
type = new Instruction(typeId, NoType, OpTypeVoid);
groupedTypes[OpTypeVoid].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
// Core OpTypeVoid used for debug void type
if (emitNonSemanticShaderDebugInfo)
debugId[typeId] = typeId;
} else
type = groupedTypes[OpTypeVoid].back();
return type->getResultId();
}
Id Builder::makeBoolType()
Id Builder::makeBoolType(bool const compilerGenerated)
{
Instruction* type;
if (groupedTypes[OpTypeBool].size() == 0) {
@ -158,6 +195,12 @@ Id Builder::makeBoolType()
} else
type = groupedTypes[OpTypeBool].back();
if (emitNonSemanticShaderDebugInfo && !compilerGenerated)
{
auto const debugResultId = makeBoolDebugType(32);
debugId[type->getResultId()] = debugResultId;
}
return type->getResultId();
}
@ -172,6 +215,12 @@ Id Builder::makeSamplerType()
} else
type = groupedTypes[OpTypeSampler].back();
if (emitNonSemanticShaderDebugInfo)
{
auto const debugResultId = makeCompositeDebugType({}, "type.sampler", NonSemanticShaderDebugInfo100Structure, true);
debugId[type->getResultId()] = debugResultId;
}
return type->getResultId();
}
@ -268,6 +317,12 @@ Id Builder::makeIntegerType(int width, bool hasSign)
break;
}
if (emitNonSemanticShaderDebugInfo)
{
auto const debugResultId = makeIntegerDebugType(width, hasSign);
debugId[type->getResultId()] = debugResultId;
}
return type->getResultId();
}
@ -305,6 +360,12 @@ Id Builder::makeFloatType(int width)
break;
}
if (emitNonSemanticShaderDebugInfo)
{
auto const debugResultId = makeFloatDebugType(width);
debugId[type->getResultId()] = debugResultId;
}
return type->getResultId();
}
@ -312,7 +373,7 @@ Id Builder::makeFloatType(int width)
// See makeStructResultType() for non-decorated structs
// needed as the result of some instructions, which does
// check for duplicates.
Id Builder::makeStructType(const std::vector<Id>& members, const char* name)
Id Builder::makeStructType(const std::vector<Id>& members, const char* name, bool const compilerGenerated)
{
// Don't look for previous one, because in the general case,
// structs can be duplicated except for decorations.
@ -326,6 +387,12 @@ Id Builder::makeStructType(const std::vector<Id>& members, const char* name)
module.mapInstruction(type);
addName(type->getResultId(), name);
if (emitNonSemanticShaderDebugInfo && !compilerGenerated)
{
auto const debugResultId = makeCompositeDebugType(members, name, NonSemanticShaderDebugInfo100Structure);
debugId[type->getResultId()] = debugResultId;
}
return type->getResultId();
}
@ -372,6 +439,12 @@ Id Builder::makeVectorType(Id component, int size)
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
if (emitNonSemanticShaderDebugInfo)
{
auto const debugResultId = makeVectorDebugType(component, size);
debugId[type->getResultId()] = debugResultId;
}
return type->getResultId();
}
@ -398,6 +471,12 @@ Id Builder::makeMatrixType(Id component, int cols, int rows)
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
if (emitNonSemanticShaderDebugInfo)
{
auto const debugResultId = makeMatrixDebugType(column, cols);
debugId[type->getResultId()] = debugResultId;
}
return type->getResultId();
}
@ -484,6 +563,12 @@ Id Builder::makeArrayType(Id element, Id sizeId, int stride)
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
if (emitNonSemanticShaderDebugInfo)
{
auto const debugResultId = makeArrayDebugType(element, sizeId);
debugId[type->getResultId()] = debugResultId;
}
return type->getResultId();
}
@ -494,6 +579,12 @@ Id Builder::makeRuntimeArray(Id element)
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
if (emitNonSemanticShaderDebugInfo)
{
auto const debugResultId = makeArrayDebugType(element, makeUintConstant(0));
debugId[type->getResultId()] = debugResultId;
}
return type->getResultId();
}
@ -513,11 +604,25 @@ Id Builder::makeFunctionType(Id returnType, const std::vector<Id>& paramTypes)
}
}
if (! mismatch)
{
// If compiling HLSL, glslang will create a wrapper function around the entrypoint. Accordingly, a void(void)
// function type is created for the wrapper function. However, nonsemantic shader debug information is disabled
// while creating the HLSL wrapper. Consequently, if we encounter another void(void) function, we need to create
// the associated debug function type if it hasn't been created yet.
if(emitNonSemanticShaderDebugInfo && debugId[type->getResultId()] == 0) {
assert(sourceLang == spv::SourceLanguageHLSL);
assert(getTypeClass(returnType) == OpTypeVoid && paramTypes.size() == 0);
Id debugTypeId = makeDebugFunctionType(returnType, {});
debugId[type->getResultId()] = debugTypeId;
}
return type->getResultId();
}
}
// not found, make it
type = new Instruction(getUniqueId(), NoType, OpTypeFunction);
Id typeId = getUniqueId();
type = new Instruction(typeId, NoType, OpTypeFunction);
type->addIdOperand(returnType);
for (int p = 0; p < (int)paramTypes.size(); ++p)
type->addIdOperand(paramTypes[p]);
@ -525,9 +630,34 @@ Id Builder::makeFunctionType(Id returnType, const std::vector<Id>& paramTypes)
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
// make debug type and map it
if (emitNonSemanticShaderDebugInfo) {
Id debugTypeId = makeDebugFunctionType(returnType, paramTypes);
debugId[typeId] = debugTypeId;
}
return type->getResultId();
}
Id Builder::makeDebugFunctionType(Id returnType, const std::vector<Id>& paramTypes)
{
assert(debugId[returnType] != 0);
Id typeId = getUniqueId();
auto type = new Instruction(typeId, makeVoidType(), OpExtInst);
type->addIdOperand(nonSemanticShaderDebugInfo);
type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugTypeFunction);
type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsPublic));
type->addIdOperand(debugId[returnType]);
for (auto const paramType : paramTypes) {
assert(isPointerType(paramType) || isArrayType(paramType));
type->addIdOperand(debugId[getContainedTypeId(paramType)]);
}
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
return typeId;
}
Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, bool ms, unsigned sampled,
ImageFormat format)
{
@ -609,6 +739,22 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
}
#endif
if (emitNonSemanticShaderDebugInfo)
{
auto TypeName = [&dim]() -> char const* {
switch (dim) {
case Dim1D: return "type.1d.image";
case Dim2D: return "type.2d.image";
case Dim3D: return "type.3d.image";
case DimCube: return "type.cube.image";
default: return "type.image";
}
};
auto const debugResultId = makeCompositeDebugType({}, TypeName(), NonSemanticShaderDebugInfo100Class, true);
debugId[type->getResultId()] = debugResultId;
}
return type->getResultId();
}
@ -630,9 +776,389 @@ Id Builder::makeSampledImageType(Id imageType)
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
if (emitNonSemanticShaderDebugInfo)
{
auto const debugResultId = makeCompositeDebugType({}, "type.sampled.image", NonSemanticShaderDebugInfo100Class, true);
debugId[type->getResultId()] = debugResultId;
}
return type->getResultId();
}
Id Builder::makeDebugInfoNone()
{
if (debugInfoNone != 0)
return debugInfoNone;
Instruction* inst = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
inst->addIdOperand(nonSemanticShaderDebugInfo);
inst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugInfoNone);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(inst));
module.mapInstruction(inst);
debugInfoNone = inst->getResultId();
return debugInfoNone;
}
Id Builder::makeBoolDebugType(int const size)
{
// try to find it
Instruction* type;
for (int t = 0; t < (int)groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic].size(); ++t) {
type = groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic][t];
if (type->getIdOperand(0) == getStringId("bool") &&
type->getIdOperand(1) == static_cast<unsigned int>(size) &&
type->getIdOperand(2) == NonSemanticShaderDebugInfo100Boolean)
return type->getResultId();
}
type = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
type->addIdOperand(nonSemanticShaderDebugInfo);
type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugTypeBasic);
type->addIdOperand(getStringId("bool")); // name id
type->addIdOperand(makeUintConstant(size)); // size id
type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100Boolean)); // encoding id
type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100None)); // flags id
groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
return type->getResultId();
}
Id Builder::makeIntegerDebugType(int const width, bool const hasSign)
{
// try to find it
Instruction* type;
for (int t = 0; t < (int)groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic].size(); ++t) {
type = groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic][t];
if (type->getIdOperand(0) == (hasSign ? getStringId("int") : getStringId("uint")) &&
type->getIdOperand(1) == static_cast<unsigned int>(width) &&
type->getIdOperand(2) == (hasSign ? NonSemanticShaderDebugInfo100Signed : NonSemanticShaderDebugInfo100Unsigned))
return type->getResultId();
}
// not found, make it
type = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
type->addIdOperand(nonSemanticShaderDebugInfo);
type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugTypeBasic);
if(hasSign == true) {
type->addIdOperand(getStringId("int")); // name id
} else {
type->addIdOperand(getStringId("uint")); // name id
}
type->addIdOperand(makeUintConstant(width)); // size id
if(hasSign == true) {
type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100Signed)); // encoding id
} else {
type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100Unsigned)); // encoding id
}
type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100None)); // flags id
groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
return type->getResultId();
}
Id Builder::makeFloatDebugType(int const width)
{
// try to find it
Instruction* type;
for (int t = 0; t < (int)groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic].size(); ++t) {
type = groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic][t];
if (type->getIdOperand(0) == getStringId("float") &&
type->getIdOperand(1) == static_cast<unsigned int>(width) &&
type->getIdOperand(2) == NonSemanticShaderDebugInfo100Float)
return type->getResultId();
}
// not found, make it
type = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
type->addIdOperand(nonSemanticShaderDebugInfo);
type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugTypeBasic);
type->addIdOperand(getStringId("float")); // name id
type->addIdOperand(makeUintConstant(width)); // size id
type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100Float)); // encoding id
type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100None)); // flags id
groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
return type->getResultId();
}
Id Builder::makeSequentialDebugType(Id const baseType, Id const componentCount, NonSemanticShaderDebugInfo100Instructions const sequenceType)
{
assert(sequenceType == NonSemanticShaderDebugInfo100DebugTypeArray ||
sequenceType == NonSemanticShaderDebugInfo100DebugTypeVector);
// try to find it
Instruction* type;
for (int t = 0; t < (int)groupedDebugTypes[sequenceType].size(); ++t) {
type = groupedDebugTypes[sequenceType][t];
if (type->getIdOperand(0) == baseType &&
type->getIdOperand(1) == makeUintConstant(componentCount))
return type->getResultId();
}
// not found, make it
type = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
type->addIdOperand(nonSemanticShaderDebugInfo);
type->addImmediateOperand(sequenceType);
type->addIdOperand(debugId[baseType]); // base type
type->addIdOperand(componentCount); // component count
groupedDebugTypes[sequenceType].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
return type->getResultId();
}
Id Builder::makeArrayDebugType(Id const baseType, Id const componentCount)
{
return makeSequentialDebugType(baseType, componentCount, NonSemanticShaderDebugInfo100DebugTypeArray);
}
Id Builder::makeVectorDebugType(Id const baseType, int const componentCount)
{
return makeSequentialDebugType(baseType, makeUintConstant(componentCount), NonSemanticShaderDebugInfo100DebugTypeVector);;
}
Id Builder::makeMatrixDebugType(Id const vectorType, int const vectorCount, bool columnMajor)
{
// try to find it
Instruction* type;
for (int t = 0; t < (int)groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeMatrix].size(); ++t) {
type = groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeMatrix][t];
if (type->getIdOperand(0) == vectorType &&
type->getIdOperand(1) == makeUintConstant(vectorCount))
return type->getResultId();
}
// not found, make it
type = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
type->addIdOperand(nonSemanticShaderDebugInfo);
type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugTypeMatrix);
type->addIdOperand(debugId[vectorType]); // vector type id
type->addIdOperand(makeUintConstant(vectorCount)); // component count id
type->addIdOperand(makeBoolConstant(columnMajor)); // column-major id
groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeMatrix].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
return type->getResultId();
}
Id Builder::makeMemberDebugType(Id const memberType, DebugTypeLoc const& debugTypeLoc)
{
assert(debugId[memberType] != 0);
Instruction* type = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
type->addIdOperand(nonSemanticShaderDebugInfo);
type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugTypeMember);
type->addIdOperand(getStringId(debugTypeLoc.name)); // name id
type->addIdOperand(debugId[memberType]); // type id
type->addIdOperand(makeDebugSource(sourceFileStringId)); // source id TODO: verify this works across include directives
type->addIdOperand(makeUintConstant(debugTypeLoc.line)); // line id TODO: currentLine is always zero
type->addIdOperand(makeUintConstant(debugTypeLoc.column)); // TODO: column id
type->addIdOperand(makeUintConstant(0)); // TODO: offset id
type->addIdOperand(makeUintConstant(0)); // TODO: size id
type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsPublic)); // flags id
groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeMember].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
return type->getResultId();
}
// Note: To represent a source language opaque type, this instruction must have no Members operands, Size operand must be
// DebugInfoNone, and Name must start with @ to avoid clashes with user defined names.
Id Builder::makeCompositeDebugType(std::vector<Id> const& memberTypes, char const*const name,
NonSemanticShaderDebugInfo100DebugCompositeType const tag, bool const isOpaqueType)
{
// Create the debug member types.
std::vector<Id> memberDebugTypes;
for(auto const memberType : memberTypes) {
assert(debugTypeLocs.find(memberType) != debugTypeLocs.end());
memberDebugTypes.emplace_back(makeMemberDebugType(memberType, debugTypeLocs[memberType]));
// TODO: Need to rethink this method of passing location information.
// debugTypeLocs.erase(memberType);
}
// Create The structure debug type.
Instruction* type = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
type->addIdOperand(nonSemanticShaderDebugInfo);
type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugTypeComposite);
type->addIdOperand(getStringId(name)); // name id
type->addIdOperand(makeUintConstant(tag)); // tag id
type->addIdOperand(makeDebugSource(sourceFileStringId)); // source id TODO: verify this works across include directives
type->addIdOperand(makeUintConstant(currentLine)); // line id TODO: currentLine always zero?
type->addIdOperand(makeUintConstant(0)); // TODO: column id
type->addIdOperand(makeDebugCompilationUnit()); // scope id
if(isOpaqueType == true) {
// Prepend '@' to opaque types.
type->addIdOperand(getStringId('@' + std::string(name))); // linkage name id
type->addIdOperand(makeDebugInfoNone()); // size id
} else {
type->addIdOperand(getStringId(name)); // linkage name id
type->addIdOperand(makeUintConstant(0)); // TODO: size id
}
type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsPublic)); // flags id
assert(isOpaqueType == false || (isOpaqueType == true && memberDebugTypes.empty()));
for(auto const memberDebugType : memberDebugTypes) {
type->addIdOperand(memberDebugType);
}
groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeComposite].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
return type->getResultId();
}
Id Builder::makeDebugSource(const Id fileName) {
if (debugSourceId.find(fileName) != debugSourceId.end())
return debugSourceId[fileName];
spv::Id resultId = getUniqueId();
Instruction* sourceInst = new Instruction(resultId, makeVoidType(), OpExtInst);
sourceInst->addIdOperand(nonSemanticShaderDebugInfo);
sourceInst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugSource);
sourceInst->addIdOperand(fileName);
if (emitNonSemanticShaderDebugSource) {
spv::Id sourceId = 0;
if (fileName == sourceFileStringId) {
sourceId = getStringId(sourceText);
} else {
auto incItr = includeFiles.find(fileName);
assert(incItr != includeFiles.end());
sourceId = getStringId(*incItr->second);
}
sourceInst->addIdOperand(sourceId);
}
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(sourceInst));
module.mapInstruction(sourceInst);
debugSourceId[fileName] = resultId;
return resultId;
}
Id Builder::makeDebugCompilationUnit() {
if (nonSemanticShaderCompilationUnitId != 0)
return nonSemanticShaderCompilationUnitId;
spv::Id resultId = getUniqueId();
Instruction* sourceInst = new Instruction(resultId, makeVoidType(), OpExtInst);
sourceInst->addIdOperand(nonSemanticShaderDebugInfo);
sourceInst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugCompilationUnit);
sourceInst->addIdOperand(makeUintConstant(1)); // TODO(greg-lunarg): Get rid of magic number
sourceInst->addIdOperand(makeUintConstant(4)); // TODO(greg-lunarg): Get rid of magic number
sourceInst->addIdOperand(makeDebugSource(sourceFileStringId));
sourceInst->addIdOperand(makeUintConstant(sourceLang));
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(sourceInst));
module.mapInstruction(sourceInst);
nonSemanticShaderCompilationUnitId = resultId;
return resultId;
}
Id Builder::createDebugGlobalVariable(Id const type, char const*const name, Id const variable)
{
assert(type != 0);
Instruction* inst = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
inst->addIdOperand(nonSemanticShaderDebugInfo);
inst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugGlobalVariable);
inst->addIdOperand(getStringId(name)); // name id
inst->addIdOperand(type); // type id
inst->addIdOperand(makeDebugSource(sourceFileStringId)); // source id
inst->addIdOperand(makeUintConstant(currentLine)); // line id TODO: currentLine always zero?
inst->addIdOperand(makeUintConstant(0)); // TODO: column id
inst->addIdOperand(makeDebugCompilationUnit()); // scope id
inst->addIdOperand(getStringId(name)); // linkage name id
inst->addIdOperand(variable); // variable id
inst->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsDefinition)); // flags id
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(inst));
module.mapInstruction(inst);
return inst->getResultId();
}
Id Builder::createDebugLocalVariable(Id type, char const*const name, size_t const argNumber)
{
assert(name != nullptr);
Instruction* inst = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
inst->addIdOperand(nonSemanticShaderDebugInfo);
inst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugLocalVariable);
inst->addIdOperand(getStringId(name)); // name id
inst->addIdOperand(type); // type id
inst->addIdOperand(makeDebugSource(sourceFileStringId)); // source id
inst->addIdOperand(makeUintConstant(currentLine)); // line id
inst->addIdOperand(makeUintConstant(0)); // TODO: column id
inst->addIdOperand(currentDebugScopeId.top()); // scope id
inst->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsLocal)); // flags id
if(argNumber != 0) {
inst->addIdOperand(makeUintConstant(argNumber));
}
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(inst));
module.mapInstruction(inst);
return inst->getResultId();
}
Id Builder::makeDebugExpression()
{
if (debugExpression != 0)
return debugExpression;
Instruction* inst = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
inst->addIdOperand(nonSemanticShaderDebugInfo);
inst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugExpression);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(inst));
module.mapInstruction(inst);
debugExpression = inst->getResultId();
return debugExpression;
}
Id Builder::makeDebugDeclare(Id const debugLocalVariable, Id const localVariable)
{
Instruction* inst = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
inst->addIdOperand(nonSemanticShaderDebugInfo);
inst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugDeclare);
inst->addIdOperand(debugLocalVariable); // debug local variable id
inst->addIdOperand(localVariable); // local variable id
inst->addIdOperand(makeDebugExpression()); // expression id
buildPoint->addInstruction(std::unique_ptr<Instruction>(inst));
return inst->getResultId();
}
Id Builder::makeDebugValue(Id const debugLocalVariable, Id const value)
{
Instruction* inst = new Instruction(getUniqueId(), makeVoidType(), OpExtInst);
inst->addIdOperand(nonSemanticShaderDebugInfo);
inst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugValue);
inst->addIdOperand(debugLocalVariable); // debug local variable id
inst->addIdOperand(value); // value id
inst->addIdOperand(makeDebugExpression()); // expression id
buildPoint->addInstruction(std::unique_ptr<Instruction>(inst));
return inst->getResultId();
}
#ifndef GLSLANG_WEB
Id Builder::makeAccelerationStructureType()
{
@ -920,6 +1446,17 @@ bool Builder::isSpecConstantOpCode(Op opcode) const
}
}
bool Builder::isRayTracingOpCode(Op opcode) const
{
switch (opcode) {
case OpTypeAccelerationStructureKHR:
case OpTypeRayQueryKHR:
return true;
default:
return false;
}
}
Id Builder::makeNullConstant(Id typeId)
{
Instruction* constant;
@ -1136,6 +1673,19 @@ Id Builder::makeFpConstant(Id type, double d, bool specConstant)
return NoResult;
}
Id Builder::importNonSemanticShaderDebugInfoInstructions()
{
assert(emitNonSemanticShaderDebugInfo == true);
if(nonSemanticShaderDebugInfo == 0)
{
this->addExtension(spv::E_SPV_KHR_non_semantic_info);
nonSemanticShaderDebugInfo = this->import("NonSemantic.Shader.DebugInfo.100");
}
return nonSemanticShaderDebugInfo;
}
Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps)
{
Instruction* constant = 0;
@ -1447,23 +1997,34 @@ Function* Builder::makeEntryPoint(const char* entryPoint)
assert(! entryPointFunction);
Block* entry;
std::vector<Id> params;
std::vector<Id> paramsTypes;
std::vector<char const*> paramNames;
std::vector<std::vector<Decoration>> decorations;
entryPointFunction = makeFunctionEntry(NoPrecision, makeVoidType(), entryPoint, params, decorations, &entry);
auto const returnType = makeVoidType();
restoreNonSemanticShaderDebugInfo = emitNonSemanticShaderDebugInfo;
if(sourceLang == spv::SourceLanguageHLSL) {
emitNonSemanticShaderDebugInfo = false;
}
entryPointFunction = makeFunctionEntry(NoPrecision, returnType, entryPoint, paramsTypes, paramNames, decorations, &entry);
emitNonSemanticShaderDebugInfo = restoreNonSemanticShaderDebugInfo;
return entryPointFunction;
}
// Comments in header
Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const char* name,
const std::vector<Id>& paramTypes,
const std::vector<Id>& paramTypes, const std::vector<char const*>& paramNames,
const std::vector<std::vector<Decoration>>& decorations, Block **entry)
{
// Make the function and initial instructions in it
Id typeId = makeFunctionType(returnType, paramTypes);
Id firstParamId = paramTypes.size() == 0 ? 0 : getUniqueIds((int)paramTypes.size());
Function* function = new Function(getUniqueId(), returnType, typeId, firstParamId, module);
Id funcId = getUniqueId();
Function* function = new Function(funcId, returnType, typeId, firstParamId, module);
// Set up the precisions
setPrecision(function->getId(), precision);
@ -1475,11 +2036,39 @@ Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const
}
}
// Make the debug function instruction
if (emitNonSemanticShaderDebugInfo) {
Id nameId = getStringId(unmangleFunctionName(name));
Id debugFuncId = makeDebugFunction(function, nameId, typeId);
debugId[funcId] = debugFuncId;
currentDebugScopeId.push(debugFuncId);
lastDebugScopeId = NoResult;
}
// CFG
if (entry) {
*entry = new Block(getUniqueId(), *function);
function->addBlock(*entry);
setBuildPoint(*entry);
assert(entry != nullptr);
*entry = new Block(getUniqueId(), *function);
function->addBlock(*entry);
setBuildPoint(*entry);
// DebugScope and DebugLine for parameter DebugDeclares
if (emitNonSemanticShaderDebugInfo && (int)paramTypes.size() > 0) {
addDebugScopeAndLine(currentFileId, currentLine, 0);
}
if (emitNonSemanticShaderDebugInfo) {
assert(paramTypes.size() == paramNames.size());
for(size_t p = 0; p < paramTypes.size(); ++p)
{
auto const& paramType = paramTypes[p];
assert(isPointerType(paramType) || isArrayType(paramType));
assert(debugId[getContainedTypeId(paramType)] != 0);
auto const& paramName = paramNames[p];
auto const debugLocalVariableId = createDebugLocalVariable(debugId[getContainedTypeId(paramType)], paramName, p+1);
debugId[firstParamId + p] = debugLocalVariableId;
makeDebugDeclare(debugLocalVariableId, firstParamId + p);
}
}
if (name)
@ -1487,9 +2076,62 @@ Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const
functions.push_back(std::unique_ptr<Function>(function));
// Clear debug scope stack
if (emitNonSemanticShaderDebugInfo)
currentDebugScopeId.pop();
return function;
}
Id Builder::makeDebugFunction(Function* function, Id nameId, Id funcTypeId) {
assert(function != nullptr);
assert(nameId != 0);
assert(funcTypeId != 0);
assert(debugId[funcTypeId] != 0);
Id funcId = getUniqueId();
auto type = new Instruction(funcId, makeVoidType(), OpExtInst);
type->addIdOperand(nonSemanticShaderDebugInfo);
type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugFunction);
type->addIdOperand(nameId);
type->addIdOperand(debugId[funcTypeId]);
type->addIdOperand(makeDebugSource(currentFileId)); // Will be fixed later when true filename available
type->addIdOperand(makeUintConstant(currentLine)); // Will be fixed later when true line available
type->addIdOperand(makeUintConstant(0)); // column
type->addIdOperand(makeDebugCompilationUnit()); // scope
type->addIdOperand(nameId); // linkage name
type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsPublic));
type->addIdOperand(makeUintConstant(currentLine)); // TODO(greg-lunarg): correct scope line
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
return funcId;
}
Id Builder::makeDebugLexicalBlock(uint32_t line) {
Id lexId = getUniqueId();
auto lex = new Instruction(lexId, makeVoidType(), OpExtInst);
lex->addIdOperand(nonSemanticShaderDebugInfo);
lex->addImmediateOperand(NonSemanticShaderDebugInfo100DebugLexicalBlock);
lex->addIdOperand(makeDebugSource(currentFileId));
lex->addIdOperand(makeUintConstant(line));
lex->addIdOperand(makeUintConstant(0)); // column
lex->addIdOperand(currentDebugScopeId.top()); // scope
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(lex));
module.mapInstruction(lex);
return lexId;
}
std::string Builder::unmangleFunctionName(std::string const& name) const
{
assert(name.length() > 0);
if(name.rfind('(') != std::string::npos) {
return name.substr(0, name.rfind('('));
} else {
return name;
}
}
// Comments in header
void Builder::makeReturn(bool implicit, Id retVal)
{
@ -1504,6 +2146,48 @@ void Builder::makeReturn(bool implicit, Id retVal)
createAndSetNoPredecessorBlock("post-return");
}
// Comments in header
void Builder::enterScope(uint32_t line)
{
// Generate new lexical scope debug instruction
Id lexId = makeDebugLexicalBlock(line);
currentDebugScopeId.push(lexId);
lastDebugScopeId = NoResult;
}
// Comments in header
void Builder::leaveScope()
{
// Pop current scope from stack and clear current scope
currentDebugScopeId.pop();
lastDebugScopeId = NoResult;
}
// Comments in header
void Builder::enterFunction(Function const* function)
{
// Save and disable debugInfo for HLSL entry point function. It is a wrapper
// function with no user code in it.
restoreNonSemanticShaderDebugInfo = emitNonSemanticShaderDebugInfo;
if (sourceLang == spv::SourceLanguageHLSL && function == entryPointFunction) {
emitNonSemanticShaderDebugInfo = false;
}
if (emitNonSemanticShaderDebugInfo) {
// Initialize scope state
Id funcId = function->getFuncId();
currentDebugScopeId.push(debugId[funcId]);
// Create DebugFunctionDefinition
spv::Id resultId = getUniqueId();
Instruction* defInst = new Instruction(resultId, makeVoidType(), OpExtInst);
defInst->addIdOperand(nonSemanticShaderDebugInfo);
defInst->addImmediateOperand(NonSemanticShaderDebugInfo100DebugFunctionDefinition);
defInst->addIdOperand(debugId[funcId]);
defInst->addIdOperand(funcId);
buildPoint->addInstruction(std::unique_ptr<Instruction>(defInst));
}
}
// Comments in header
void Builder::leaveFunction()
{
@ -1519,6 +2203,12 @@ void Builder::leaveFunction()
makeReturn(true, createUndefined(function.getReturnType()));
}
}
// Clear function scope from debug scope stack
if (emitNonSemanticShaderDebugInfo)
currentDebugScopeId.pop();
emitNonSemanticShaderDebugInfo = restoreNonSemanticShaderDebugInfo;
}
// Comments in header
@ -1529,7 +2219,8 @@ void Builder::makeStatementTerminator(spv::Op opcode, const char *name)
}
// Comments in header
Id Builder::createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name, Id initializer)
Id Builder::createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name, Id initializer,
bool const compilerGenerated)
{
Id pointerType = makePointer(storageClass, type);
Instruction* inst = new Instruction(getUniqueId(), pointerType, OpVariable);
@ -1541,11 +2232,27 @@ Id Builder::createVariable(Decoration precision, StorageClass storageClass, Id t
case StorageClassFunction:
// Validation rules require the declaration in the entry block
buildPoint->getParent().addLocalVariable(std::unique_ptr<Instruction>(inst));
if (emitNonSemanticShaderDebugInfo && !compilerGenerated)
{
auto const debugLocalVariableId = createDebugLocalVariable(debugId[type], name);
debugId[inst->getResultId()] = debugLocalVariableId;
// TODO: Remove?
// makeDebugDeclare(debugLocalVariableId, inst->getResultId());
}
break;
default:
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(inst));
module.mapInstruction(inst);
if (emitNonSemanticShaderDebugInfo && !isRayTracingOpCode(getOpCode(type)))
{
auto const debugResultId = createDebugGlobalVariable(debugId[type], name, inst->getResultId());
debugId[inst->getResultId()] = debugResultId;
}
break;
}
@ -1605,6 +2312,15 @@ void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAcce
}
buildPoint->addInstruction(std::unique_ptr<Instruction>(store));
if (emitNonSemanticShaderDebugInfo && !isGlobalVariable(lValue))
{
if(debugId.find(lValue) != debugId.end())
{
auto const debugLocalVariableId = debugId[lValue];
makeDebugValue(debugLocalVariableId, rValue);
}
}
}
// Comments in header
@ -3271,10 +3987,10 @@ void Builder::dumpSourceInstructions(const spv::Id fileId, const std::string& te
const int opSourceWordCount = 4;
const int nonNullBytesPerInstruction = 4 * (maxWordCount - opSourceWordCount) - 1;
if (source != SourceLanguageUnknown) {
if (sourceLang != SourceLanguageUnknown) {
// OpSource Language Version File Source
Instruction sourceInst(NoResult, NoType, OpSource);
sourceInst.addImmediateOperand(source);
sourceInst.addImmediateOperand(sourceLang);
sourceInst.addImmediateOperand(sourceVersion);
// File operand
if (fileId != NoResult) {
@ -3307,6 +4023,7 @@ void Builder::dumpSourceInstructions(const spv::Id fileId, const std::string& te
// Dump an OpSource[Continued] sequence for the source and every include file
void Builder::dumpSourceInstructions(std::vector<unsigned int>& out) const
{
if (emitNonSemanticShaderDebugInfo) return;
dumpSourceInstructions(sourceFileStringId, sourceText, out);
for (auto iItr = includeFiles.begin(); iItr != includeFiles.end(); ++iItr)
dumpSourceInstructions(iItr->first, *iItr->second, out);

View File

@ -50,6 +50,10 @@
#include "Logger.h"
#include "spirv.hpp"
#include "spvIR.h"
namespace spv {
#include "GLSL.ext.KHR.h"
#include "NonSemanticShaderDebugInfo100.h"
}
#include <algorithm>
#include <map>
@ -82,7 +86,7 @@ public:
void setSource(spv::SourceLanguage lang, int version)
{
source = lang;
sourceLang = lang;
sourceVersion = version;
}
spv::Id getStringId(const std::string& str)
@ -106,11 +110,25 @@ public:
void setSourceFile(const std::string& file)
{
sourceFileStringId = getStringId(file);
currentFileId = sourceFileStringId;
}
void setSourceText(const std::string& text) { sourceText = text; }
void addSourceExtension(const char* ext) { sourceExtensions.push_back(ext); }
void addModuleProcessed(const std::string& p) { moduleProcesses.push_back(p.c_str()); }
void setEmitOpLines() { emitOpLines = true; }
void setEmitNonSemanticShaderDebugInfo(bool const emit)
{
emitNonSemanticShaderDebugInfo = emit;
if(emit)
{
importNonSemanticShaderDebugInfoInstructions();
}
}
void setEmitNonSemanticShaderDebugSource(bool const src)
{
emitNonSemanticShaderDebugSource = src;
}
void addExtension(const char* ext) { extensions.insert(ext); }
void removeExtension(const char* ext)
{
@ -163,10 +181,11 @@ public:
void setLine(int line, const char* filename);
// Low-level OpLine. See setLine() for a layered helper.
void addLine(Id fileName, int line, int column);
void addDebugScopeAndLine(Id fileName, int line, int column);
// For creating new types (will return old type if the requested one was already made).
Id makeVoidType();
Id makeBoolType();
Id makeBoolType(bool const compilerGenerated = true);
Id makePointer(StorageClass, Id pointee);
Id makeForwardPointer(StorageClass);
Id makePointerFromForwardPointer(StorageClass, Id forwardPointerType, Id pointee);
@ -174,7 +193,7 @@ public:
Id makeIntType(int width) { return makeIntegerType(width, true); }
Id makeUintType(int width) { return makeIntegerType(width, false); }
Id makeFloatType(int width);
Id makeStructType(const std::vector<Id>& members, const char*);
Id makeStructType(const std::vector<Id>& members, const char* name, bool const compilerGenerated = true);
Id makeStructResultType(Id type0, Id type1);
Id makeVectorType(Id component, int size);
Id makeMatrixType(Id component, int cols, int rows);
@ -187,6 +206,36 @@ public:
Id makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols);
Id makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& operands);
// SPIR-V NonSemantic Shader DebugInfo Instructions
struct DebugTypeLoc {
std::string name {};
int line {0};
int column {0};
};
std::unordered_map<Id, DebugTypeLoc> debugTypeLocs;
Id makeDebugInfoNone();
Id makeBoolDebugType(int const size);
Id makeIntegerDebugType(int const width, bool const hasSign);
Id makeFloatDebugType(int const width);
Id makeSequentialDebugType(Id const baseType, Id const componentCount, NonSemanticShaderDebugInfo100Instructions const sequenceType);
Id makeArrayDebugType(Id const baseType, Id const componentCount);
Id makeVectorDebugType(Id const baseType, int const componentCount);
Id makeMatrixDebugType(Id const vectorType, int const vectorCount, bool columnMajor = true);
Id makeMemberDebugType(Id const memberType, DebugTypeLoc const& debugTypeLoc);
Id makeCompositeDebugType(std::vector<Id> const& memberTypes, char const*const name,
NonSemanticShaderDebugInfo100DebugCompositeType const tag, bool const isOpaqueType = false);
Id makeDebugSource(const Id fileName);
Id makeDebugCompilationUnit();
Id createDebugGlobalVariable(Id const type, char const*const name, Id const variable);
Id createDebugLocalVariable(Id type, char const*const name, size_t const argNumber = 0);
Id makeDebugExpression();
Id makeDebugDeclare(Id const debugLocalVariable, Id const localVariable);
Id makeDebugValue(Id const debugLocalVariable, Id const value);
Id makeDebugFunctionType(Id returnType, const std::vector<Id>& paramTypes);
Id makeDebugFunction(Function* function, Id nameId, Id funcTypeId);
Id makeDebugLexicalBlock(uint32_t line);
std::string unmangleFunctionName(std::string const& name) const;
// accelerationStructureNV type
Id makeAccelerationStructureType();
// rayQueryEXT type
@ -261,6 +310,8 @@ public:
// See if a resultId is valid for use as an initializer.
bool isValidInitializer(Id resultId) const { return isConstant(resultId) || isGlobalVariable(resultId); }
bool isRayTracingOpCode(Op opcode) const;
int getScalarTypeWidth(Id typeId) const
{
Id scalarTypeId = getScalarTypeId(typeId);
@ -322,6 +373,8 @@ public:
Id makeFloat16Constant(float f16, bool specConstant = false);
Id makeFpConstant(Id type, double d, bool specConstant = false);
Id importNonSemanticShaderDebugInfoInstructions();
// Turn the array of constants into a proper spv constant of the requested type.
Id makeCompositeConstant(Id type, const std::vector<Id>& comps, bool specConst = false);
@ -344,7 +397,12 @@ public:
void addMemberDecoration(Id, unsigned int member, Decoration, const std::vector<const char*>& strings);
// At the end of what block do the next create*() instructions go?
void setBuildPoint(Block* bp) { buildPoint = bp; }
// Also reset current last DebugScope and current source line to unknown
void setBuildPoint(Block* bp) {
buildPoint = bp;
lastDebugScopeId = NoResult;
currentLine = 0;
}
Block* getBuildPoint() const { return buildPoint; }
// Make the entry-point function. The returned pointer is only valid
@ -355,12 +413,22 @@ public:
// Return the function, pass back the entry.
// The returned pointer is only valid for the lifetime of this builder.
Function* makeFunctionEntry(Decoration precision, Id returnType, const char* name,
const std::vector<Id>& paramTypes, const std::vector<std::vector<Decoration>>& precisions, Block **entry = 0);
const std::vector<Id>& paramTypes, const std::vector<char const*>& paramNames,
const std::vector<std::vector<Decoration>>& precisions, Block **entry = 0);
// Create a return. An 'implicit' return is one not appearing in the source
// code. In the case of an implicit return, no post-return block is inserted.
void makeReturn(bool implicit, Id retVal = 0);
// Initialize state and generate instructions for new lexical scope
void enterScope(uint32_t line);
// Set state and generate instructions to exit current lexical scope
void leaveScope();
// Prepare builder for generation of instructions for a function.
void enterFunction(Function const* function);
// Generate all the code needed to finish up a function.
void leaveFunction();
@ -369,8 +437,8 @@ public:
void makeStatementTerminator(spv::Op opcode, const char *name);
// Create a global or function local or IO variable.
Id createVariable(Decoration precision, StorageClass, Id type, const char* name = nullptr,
Id initializer = NoResult);
Id createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name = nullptr,
Id initializer = NoResult, bool const compilerGenerated = true);
// Create an intermediate with an undefined value.
Id createUndefined(Id type);
@ -805,13 +873,23 @@ public:
const;
unsigned int spvVersion; // the version of SPIR-V to emit in the header
SourceLanguage source;
SourceLanguage sourceLang;
int sourceVersion;
spv::Id sourceFileStringId;
spv::Id nonSemanticShaderCompilationUnitId {0};
spv::Id nonSemanticShaderDebugInfo {0};
spv::Id debugInfoNone {0};
spv::Id debugExpression {0}; // Debug expression with zero operations.
std::string sourceText;
int currentLine;
const char* currentFile;
spv::Id currentFileId;
std::stack<spv::Id> currentDebugScopeId;
spv::Id lastDebugScopeId;
bool emitOpLines;
bool emitNonSemanticShaderDebugInfo;
bool restoreNonSemanticShaderDebugInfo;
bool emitNonSemanticShaderDebugSource;
std::set<std::string> extensions;
std::vector<const char*> sourceExtensions;
std::vector<const char*> moduleProcesses;
@ -845,6 +923,8 @@ public:
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedStructConstants;
// map type opcodes to type instructions
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedTypes;
// map type opcodes to debug type instructions
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedDebugTypes;
// list of OpConstantNull instructions
std::vector<Instruction*> nullConstants;
@ -860,6 +940,12 @@ public:
// map from include file name ids to their contents
std::map<spv::Id, const std::string*> includeFiles;
// map from core id to debug id
std::map <spv::Id, spv::Id> debugId;
// map from file name string id to DebugSource id
std::unordered_map<spv::Id, spv::Id> debugSourceId;
// The stream for outputting warnings and errors.
SpvBuildLogger* logger;
}; // end Builder class

View File

@ -53,14 +53,14 @@
namespace glslang {
struct SpvOptions {
SpvOptions() : generateDebugInfo(false), stripDebugInfo(false), disableOptimizer(true),
optimizeSize(false), disassemble(false), validate(false) { }
bool generateDebugInfo;
bool stripDebugInfo;
bool disableOptimizer;
bool optimizeSize;
bool disassemble;
bool validate;
bool generateDebugInfo {false};
bool stripDebugInfo {false};
bool disableOptimizer {true};
bool optimizeSize {false};
bool disassemble {false};
bool validate {false};
bool emitNonSemanticShaderDebugInfo {false};
bool emitNonSemanticShaderDebugSource{ false };
};
#if ENABLE_OPT

View File

@ -349,6 +349,7 @@ public:
const std::vector<Block*>& getBlocks() const { return blocks; }
void addLocalVariable(std::unique_ptr<Instruction> inst);
Id getReturnType() const { return functionInstruction.getTypeId(); }
Id getFuncId() const { return functionInstruction.getResultId(); }
void setReturnPrecision(Decoration precision)
{
if (precision == DecorationRelaxedPrecision)

View File

@ -113,6 +113,8 @@ bool SpvToolsDisassembler = false;
bool SpvToolsValidate = false;
bool NaNClamp = false;
bool stripDebugInfo = false;
bool emitNonSemanticShaderDebugInfo = false;
bool emitNonSemanticShaderDebugSource = false;
bool beQuiet = false;
bool VulkanRulesRelaxed = false;
bool autoSampledTextures = false;
@ -969,11 +971,21 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
case 'g':
// Override previous -g or -g0 argument
stripDebugInfo = false;
emitNonSemanticShaderDebugInfo = false;
Options &= ~EOptionDebug;
if (argv[0][2] == '0')
stripDebugInfo = true;
else
else {
Options |= EOptionDebug;
if (argv[0][2] == 'V') {
emitNonSemanticShaderDebugInfo = true;
if (argv[0][3] == 'S') {
emitNonSemanticShaderDebugSource = true;
} else {
emitNonSemanticShaderDebugSource = false;
}
}
}
break;
case 'h':
usage();
@ -1379,6 +1391,9 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
if (EnhancedMsgs)
shader->setEnhancedMsgs();
if (emitNonSemanticShaderDebugInfo)
shader->setDebugInfo(true);
// Set up the environment, some subsettings take precedence over earlier
// ways of setting things.
if (Options & EOptionSpv) {
@ -1470,9 +1485,15 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
std::vector<unsigned int> spirv;
spv::SpvBuildLogger logger;
glslang::SpvOptions spvOptions;
if (Options & EOptionDebug)
if (Options & EOptionDebug) {
spvOptions.generateDebugInfo = true;
else if (stripDebugInfo)
if (emitNonSemanticShaderDebugInfo) {
spvOptions.emitNonSemanticShaderDebugInfo = true;
if (emitNonSemanticShaderDebugSource) {
spvOptions.emitNonSemanticShaderDebugSource = true;
}
}
} else if (stripDebugInfo)
spvOptions.stripDebugInfo = true;
spvOptions.disableOptimizer = (Options & EOptionOptimizeDisable) != 0;
spvOptions.optimizeSize = (Options & EOptionOptimizeSize) != 0;
@ -1906,6 +1927,8 @@ void usage()
" SPV_GOOGLE_hlsl_functionality1 extension\n"
" -g generate debug information\n"
" -g0 strip debug information\n"
" -gV generate nonsemantic shader debug information\n"
" -gVS generate nonsemantic shader debug information with source\n"
" -h print this usage message\n"
" -i intermediate tree (glslang AST) is printed out\n"
" -l link all input files together to form a single module\n"

View File

@ -196,9 +196,11 @@ void main()
Store 97(i) 18
Branch 98
98: Label
Line 1 46 0
LoopMerge 100 101 None
Branch 102
102: Label
Line 1 46 0
103: 7(int) Load 97(i)
105: 37(bool) SLessThan 103 104
BranchConditional 105 99 100

View File

@ -197,9 +197,11 @@ void main()
Store 97(i) 18
Branch 98
98: Label
Line 1 46 0
LoopMerge 100 101 None
Branch 102
102: Label
Line 1 46 0
103: 7(int) Load 97(i)
105: 37(bool) SLessThan 103 104
BranchConditional 105 99 100

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,949 @@
spv.debuginfo.glsl.frag
Validation failed
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 716
Capability Shader
Capability ImageQuery
Extension "SPV_KHR_non_semantic_info"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
2: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 13 "main" 406 452
ExecutionMode 13 OriginUpperLeft
8: String "uint"
14: String "main"
17: String ""
24: String "float"
39: String "textureProj"
45: String "P"
49: String "layer"
52: String "offset"
59: String "filterPCF"
65: String "sc"
77: String "shadow"
83: String "fragcolor"
86: String "fragpos"
96: String "shadowCoord"
118: String "bool"
132: String "dist"
136: String "type.2d.image"
137: String "@type.2d.image"
141: String "type.sampled.image"
142: String "@type.sampled.image"
146: String "samplerShadowMap"
182: String "int"
189: String "texDim"
201: String "scale"
207: String "dx"
219: String "dy"
230: String "shadowFactor"
235: String "count"
240: String "range"
246: String "x"
262: String "y"
312: String "i"
326: String "shadowClip"
333: String "color"
339: String "viewMatrix"
342: String "Light"
348: String "lights"
351: String "debugDisplayTarget"
355: String "UBO"
359: String "ubo"
394: String "fragPos"
403: String "samplerposition"
408: String "inUV"
415: String "normal"
419: String "samplerNormal"
427: String "albedo"
431: String "samplerAlbedo"
454: String "outFragColor"
516: String "N"
535: String "L"
556: String "V"
569: String "lightCosInnerAngle"
575: String "lightCosOuterAngle"
581: String "lightRange"
587: String "dir"
602: String "cosDir"
610: String "spotEffect"
619: String "heightAttenuation"
627: String "NdotL"
636: String "diff"
643: String "R"
652: String "NdotR"
661: String "spec"
Name 13 "main"
Name 38 "textureProj(vf4;f1;vf2;"
Name 35 "P"
Name 36 "layer"
Name 37 "offset"
Name 58 "filterPCF(vf4;f1;"
Name 56 "sc"
Name 57 "layer"
Name 76 "shadow(vf3;vf3;"
Name 74 "fragcolor"
Name 75 "fragpos"
Name 89 "shadow"
Name 94 "shadowCoord"
Name 130 "dist"
Name 144 "samplerShadowMap"
Name 187 "texDim"
Name 199 "scale"
Name 205 "dx"
Name 217 "dy"
Name 228 "shadowFactor"
Name 233 "count"
Name 238 "range"
Name 244 "x"
Name 260 "y"
Name 285 "param"
Name 287 "param"
Name 289 "param"
Name 310 "i"
Name 324 "shadowClip"
Name 331 "Light"
MemberName 331(Light) 0 "position"
MemberName 331(Light) 1 "target"
MemberName 331(Light) 2 "color"
MemberName 331(Light) 3 "viewMatrix"
Name 345 "UBO"
MemberName 345(UBO) 0 "viewPos"
MemberName 345(UBO) 1 "lights"
MemberName 345(UBO) 2 "useShadows"
MemberName 345(UBO) 3 "debugDisplayTarget"
Name 357 "ubo"
Name 371 "shadowFactor"
Name 376 "param"
Name 378 "param"
Name 392 "fragPos"
Name 401 "samplerposition"
Name 406 "inUV"
Name 413 "normal"
Name 417 "samplerNormal"
Name 425 "albedo"
Name 429 "samplerAlbedo"
Name 452 "outFragColor"
Name 457 "param"
Name 458 "param"
Name 506 "fragcolor"
Name 514 "N"
Name 521 "i"
Name 533 "L"
Name 545 "dist"
Name 554 "V"
Name 567 "lightCosInnerAngle"
Name 573 "lightCosOuterAngle"
Name 579 "lightRange"
Name 585 "dir"
Name 600 "cosDir"
Name 608 "spotEffect"
Name 617 "heightAttenuation"
Name 625 "NdotL"
Name 634 "diff"
Name 641 "R"
Name 650 "NdotR"
Name 659 "spec"
Name 705 "param"
Name 707 "param"
Decorate 144(samplerShadowMap) DescriptorSet 0
Decorate 144(samplerShadowMap) Binding 5
MemberDecorate 331(Light) 0 Offset 0
MemberDecorate 331(Light) 1 Offset 16
MemberDecorate 331(Light) 2 Offset 32
MemberDecorate 331(Light) 3 ColMajor
MemberDecorate 331(Light) 3 Offset 48
MemberDecorate 331(Light) 3 MatrixStride 16
Decorate 343 ArrayStride 112
MemberDecorate 345(UBO) 0 Offset 0
MemberDecorate 345(UBO) 1 Offset 16
MemberDecorate 345(UBO) 2 Offset 352
MemberDecorate 345(UBO) 3 Offset 356
Decorate 345(UBO) Block
Decorate 357(ubo) DescriptorSet 0
Decorate 357(ubo) Binding 4
Decorate 401(samplerposition) DescriptorSet 0
Decorate 401(samplerposition) Binding 1
Decorate 406(inUV) Location 0
Decorate 417(samplerNormal) DescriptorSet 0
Decorate 417(samplerNormal) Binding 2
Decorate 429(samplerAlbedo) DescriptorSet 0
Decorate 429(samplerAlbedo) Binding 3
Decorate 452(outFragColor) Location 0
3: TypeVoid
4: TypeFunction 3
6: TypeInt 32 0
9: 6(int) Constant 32
10: 6(int) Constant 6
11: 6(int) Constant 0
7: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 8 9 10 11
12: 6(int) Constant 3
5: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 12 3
16: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(Modf) 0 17
19: 6(int) Constant 1
20: 6(int) Constant 4
21: 6(int) Constant 2
18: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(Round) 19 20 16 21
15: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 14 5 16 11 11 18 14 12 11
23: TypeFloat 32
25: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 24 9 12 11
26: TypeVector 23(float) 4
27: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 25 20
28: TypePointer Function 26(fvec4)
29: TypePointer Function 23(float)
30: TypeVector 23(float) 2
31: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 25 21
32: TypePointer Function 30(fvec2)
33: TypeFunction 23(float) 28(ptr) 29(ptr) 32(ptr)
34: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 12 25 27 25 31
40: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 39 34 16 11 11 18 39 12 11
44: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 45 27 16 11 11 40 20 19
47: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(Sqrt)
48: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 49 25 16 11 11 40 20 21
51: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 52 31 16 11 11 40 20 12
54: TypeFunction 23(float) 28(ptr) 29(ptr)
55: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 12 25 27 25
60: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 59 55 16 11 11 18 59 12 11
64: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 65 27 16 11 11 60 20 19
67: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 49 25 16 11 11 60 20 21
69: TypeVector 23(float) 3
70: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 25 12
71: TypePointer Function 69(fvec3)
72: TypeFunction 69(fvec3) 71(ptr) 71(ptr)
73: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 12 70 70 70
78: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 77 73 16 11 11 18 77 12 11
82: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 83 70 16 11 11 78 20 19
85: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 86 70 16 11 11 78 20 21
91: 6(int) Constant 59
90: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 77 25 16 91 11 40 20
92: 23(float) Constant 1065353216
97: 6(int) Constant 60
95: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 96 27 16 97 11 40 20
106: 23(float) Constant 1056964608
114: TypeBool
117: 23(float) Constant 3212836864
119: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 118 9 21 11
125: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 118 9 21 11
133: 6(int) Constant 65
131: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 132 25 16 133 11 40 20
134: TypeImage 23(float) 2D array sampled format:Unknown
138: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(Unknown)
135: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 136 11 16 133 11 18 137 138 12
139: TypeSampledImage 134
140: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 141 11 16 133 11 18 142 138 12
143: TypePointer UniformConstant 139
144(samplerShadowMap): 143(ptr) Variable UniformConstant
147: 6(int) Constant 8
145: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 146 140 16 133 11 18 146 144(samplerShadowMap) 147
162: 23(float) Constant 0
163: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 118 9 21 11
170: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 118 9 21 11
175: 23(float) Constant 1048576000
181: TypeInt 32 1
183: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 182 9 20 11
184: TypeVector 181(int) 2
185: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 183 21
186: TypePointer Function 184(ivec2)
190: 6(int) Constant 76
188: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 189 185 16 190 11 60 20
192: 181(int) Constant 0
194: TypeVector 181(int) 3
195: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 183 12
202: 6(int) Constant 77
200: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 201 25 16 202 11 60 20
203: 23(float) Constant 1069547520
208: 6(int) Constant 78
206: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 207 25 16 208 11 60 20
211: TypePointer Function 181(int)
220: 6(int) Constant 79
218: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 219 25 16 220 11 60 20
231: 6(int) Constant 81
229: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 230 25 16 231 11 60 20
236: 6(int) Constant 82
234: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 235 183 16 236 11 60 20
241: 6(int) Constant 83
239: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 240 183 16 241 11 60 20
242: 181(int) Constant 1
247: 6(int) Constant 85
245: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 246 183 16 247 11 60 20
258: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 118 9 21 11
263: 6(int) Constant 87
261: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 262 183 16 263 11 60 20
274: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 118 9 21 11
313: 6(int) Constant 98
311: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 312 183 16 313 11 78 20
321: 181(int) Constant 3
322: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 118 9 21 11
327: 6(int) Constant 100
325: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 326 27 16 327 11 78 20
328: TypeMatrix 26(fvec4) 4
330: 114(bool) ConstantTrue
329: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 27 20 330
331(Light): TypeStruct 26(fvec4) 26(fvec4) 26(fvec4) 328
334: 6(int) Constant 45
335: 6(int) Constant 7
332: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 333 27 16 334 335 11 11 12
336: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 333 27 16 334 335 11 11 12
337: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 333 27 16 334 335 11 11 12
340: 6(int) Constant 46
338: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 339 329 16 340 335 11 11 12
341: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 342 19 16 327 11 18 342 11 12 332 336 337 338
343: TypeArray 331(Light) 12
344: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 341 12
345(UBO): TypeStruct 26(fvec4) 343 181(int) 181(int)
346: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 333 27 16 334 335 11 11 12
349: 6(int) Constant 52
347: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 348 344 16 349 147 11 11 12
352: 6(int) Constant 54
350: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 351 183 16 352 10 11 11 12
353: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 351 183 16 352 10 11 11 12
354: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 355 19 16 327 11 18 355 11 12 346 347 350 353
356: TypePointer Uniform 345(UBO)
357(ubo): 356(ptr) Variable Uniform
358: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 359 354 16 327 11 18 359 357(ubo) 147
361: TypePointer Uniform 328
373: 6(int) Constant 104
372: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 230 25 16 373 11 78 20
395: 6(int) Constant 117
393: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 394 70 16 395 11 15 20
396: TypeImage 23(float) 2D sampled format:Unknown
397: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 136 11 16 395 11 18 137 138 12
398: TypeSampledImage 396
399: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 141 11 16 395 11 18 142 138 12
400: TypePointer UniformConstant 398
401(samplerposition): 400(ptr) Variable UniformConstant
402: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 403 399 16 395 11 18 403 401(samplerposition) 147
405: TypePointer Input 30(fvec2)
406(inUV): 405(ptr) Variable Input
407: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 408 31 16 395 11 18 408 406(inUV) 147
416: 6(int) Constant 118
414: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 415 70 16 416 11 15 20
417(samplerNormal): 400(ptr) Variable UniformConstant
418: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 419 399 16 416 11 18 419 417(samplerNormal) 147
428: 6(int) Constant 119
426: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 427 27 16 428 11 15 20
429(samplerAlbedo): 400(ptr) Variable UniformConstant
430: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 431 399 16 428 11 18 431 429(samplerAlbedo) 147
436: TypePointer Uniform 181(int)
439: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 118 9 21 11
451: TypePointer Output 26(fvec4)
452(outFragColor): 451(ptr) Variable Output
455: 6(int) Constant 125
453: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 454 27 16 455 11 18 454 452(outFragColor) 147
456: 69(fvec3) ConstantComposite 92 92 92
461: TypePointer Output 23(float)
508: 6(int) Constant 145
507: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 83 70 16 508 11 15 20
511: 23(float) Constant 1036831949
517: 6(int) Constant 147
515: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 516 70 16 517 11 15 20
523: 6(int) Constant 149
522: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 312 183 16 523 11 15 20
531: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 118 9 21 11
536: 6(int) Constant 152
534: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 535 70 16 536 11 15 20
538: TypePointer Uniform 26(fvec4)
547: 6(int) Constant 154
546: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 132 25 16 547 11 15 20
557: 6(int) Constant 158
555: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 556 70 16 557 11 15 20
570: 6(int) Constant 161
568: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 569 25 16 570 11 15 20
571: 23(float) Constant 1064781546
576: 6(int) Constant 162
574: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 575 25 16 576 11 15 20
577: 23(float) Constant 1063781322
582: 6(int) Constant 163
580: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 581 25 16 582 11 15 20
583: 23(float) Constant 1120403456
588: 6(int) Constant 166
586: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 587 70 16 588 11 15 20
603: 6(int) Constant 169
601: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 602 25 16 603 11 15 20
611: 6(int) Constant 170
609: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 610 25 16 611 11 15 20
620: 6(int) Constant 171
618: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 619 25 16 620 11 15 20
628: 6(int) Constant 174
626: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 627 25 16 628 11 15 20
637: 6(int) Constant 175
635: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 636 70 16 637 11 15 20
644: 6(int) Constant 178
642: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 643 70 16 644 11 15 20
653: 6(int) Constant 179
651: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 652 25 16 653 11 15 20
662: 6(int) Constant 180
660: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 661 70 16 662 11 15 20
664: 23(float) Constant 1098907648
669: 23(float) Constant 1075838976
685: 181(int) Constant 2
701: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 118 9 21 11
13(main): 3 Function None 4
22: Label
392(fragPos): 71(ptr) Variable Function
413(normal): 71(ptr) Variable Function
425(albedo): 28(ptr) Variable Function
457(param): 71(ptr) Variable Function
458(param): 71(ptr) Variable Function
506(fragcolor): 71(ptr) Variable Function
514(N): 71(ptr) Variable Function
521(i): 211(ptr) Variable Function
533(L): 71(ptr) Variable Function
545(dist): 29(ptr) Variable Function
554(V): 71(ptr) Variable Function
567(lightCosInnerAngle): 29(ptr) Variable Function
573(lightCosOuterAngle): 29(ptr) Variable Function
579(lightRange): 29(ptr) Variable Function
585(dir): 71(ptr) Variable Function
600(cosDir): 29(ptr) Variable Function
608(spotEffect): 29(ptr) Variable Function
617(heightAttenuation): 29(ptr) Variable Function
625(NdotL): 29(ptr) Variable Function
634(diff): 71(ptr) Variable Function
641(R): 71(ptr) Variable Function
650(NdotR): 29(ptr) Variable Function
659(spec): 71(ptr) Variable Function
705(param): 71(ptr) Variable Function
707(param): 71(ptr) Variable Function
391: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 15 13(main)
404: 398 Load 401(samplerposition)
409: 30(fvec2) Load 406(inUV)
410: 26(fvec4) ImageSampleImplicitLod 404 409
411: 69(fvec3) VectorShuffle 410 410 0 1 2
Store 392(fragPos) 411
412: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 393 411 47
420: 398 Load 417(samplerNormal)
421: 30(fvec2) Load 406(inUV)
422: 26(fvec4) ImageSampleImplicitLod 420 421
423: 69(fvec3) VectorShuffle 422 422 0 1 2
Store 413(normal) 423
424: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 414 423 47
432: 398 Load 429(samplerAlbedo)
433: 30(fvec2) Load 406(inUV)
434: 26(fvec4) ImageSampleImplicitLod 432 433
Store 425(albedo) 434
435: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 426 434 47
437: 436(ptr) AccessChain 357(ubo) 321
438: 181(int) Load 437
440: 114(bool) SGreaterThan 438 192
SelectionMerge 442 None
BranchConditional 440 441 442
441: Label
443: 436(ptr) AccessChain 357(ubo) 321
444: 181(int) Load 443
SelectionMerge 450 None
Switch 444 450
case 1: 445
case 2: 446
case 3: 447
case 4: 448
case 5: 449
445: Label
Store 457(param) 456
459: 69(fvec3) Load 392(fragPos)
Store 458(param) 459
460: 69(fvec3) FunctionCall 76(shadow(vf3;vf3;) 457(param) 458(param)
462: 461(ptr) AccessChain 452(outFragColor) 11
463: 23(float) CompositeExtract 460 0
Store 462 463
464: 461(ptr) AccessChain 452(outFragColor) 19
465: 23(float) CompositeExtract 460 1
Store 464 465
466: 461(ptr) AccessChain 452(outFragColor) 21
467: 23(float) CompositeExtract 460 2
Store 466 467
Branch 450
446: Label
469: 69(fvec3) Load 392(fragPos)
470: 461(ptr) AccessChain 452(outFragColor) 11
471: 23(float) CompositeExtract 469 0
Store 470 471
472: 461(ptr) AccessChain 452(outFragColor) 19
473: 23(float) CompositeExtract 469 1
Store 472 473
474: 461(ptr) AccessChain 452(outFragColor) 21
475: 23(float) CompositeExtract 469 2
Store 474 475
Branch 450
447: Label
477: 69(fvec3) Load 413(normal)
478: 461(ptr) AccessChain 452(outFragColor) 11
479: 23(float) CompositeExtract 477 0
Store 478 479
480: 461(ptr) AccessChain 452(outFragColor) 19
481: 23(float) CompositeExtract 477 1
Store 480 481
482: 461(ptr) AccessChain 452(outFragColor) 21
483: 23(float) CompositeExtract 477 2
Store 482 483
Branch 450
448: Label
485: 26(fvec4) Load 425(albedo)
486: 69(fvec3) VectorShuffle 485 485 0 1 2
487: 461(ptr) AccessChain 452(outFragColor) 11
488: 23(float) CompositeExtract 486 0
Store 487 488
489: 461(ptr) AccessChain 452(outFragColor) 19
490: 23(float) CompositeExtract 486 1
Store 489 490
491: 461(ptr) AccessChain 452(outFragColor) 21
492: 23(float) CompositeExtract 486 2
Store 491 492
Branch 450
449: Label
494: 26(fvec4) Load 425(albedo)
495: 69(fvec3) VectorShuffle 494 494 3 3 3
496: 461(ptr) AccessChain 452(outFragColor) 11
497: 23(float) CompositeExtract 495 0
Store 496 497
498: 461(ptr) AccessChain 452(outFragColor) 19
499: 23(float) CompositeExtract 495 1
Store 498 499
500: 461(ptr) AccessChain 452(outFragColor) 21
501: 23(float) CompositeExtract 495 2
Store 500 501
Branch 450
450: Label
504: 461(ptr) AccessChain 452(outFragColor) 12
Store 504 92
Return
442: Label
509: 26(fvec4) Load 425(albedo)
510: 69(fvec3) VectorShuffle 509 509 0 1 2
512: 69(fvec3) VectorTimesScalar 510 511
Store 506(fragcolor) 512
513: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 507 512 47
518: 69(fvec3) Load 413(normal)
519: 69(fvec3) ExtInst 2(GLSL.std.450) 69(Normalize) 518
Store 514(N) 519
520: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 515 519 47
Store 521(i) 192
524: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 522 192 47
Branch 525
525: Label
LoopMerge 527 528 None
Branch 529
529: Label
530: 181(int) Load 521(i)
532: 114(bool) SLessThan 530 321
BranchConditional 532 526 527
526: Label
537: 181(int) Load 521(i)
539: 538(ptr) AccessChain 357(ubo) 242 537 192
540: 26(fvec4) Load 539
541: 69(fvec3) VectorShuffle 540 540 0 1 2
542: 69(fvec3) Load 392(fragPos)
543: 69(fvec3) FSub 541 542
Store 533(L) 543
544: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 534 543 47
548: 69(fvec3) Load 533(L)
549: 23(float) ExtInst 2(GLSL.std.450) 66(Length) 548
Store 545(dist) 549
550: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 546 549 47
551: 69(fvec3) Load 533(L)
552: 69(fvec3) ExtInst 2(GLSL.std.450) 69(Normalize) 551
Store 533(L) 552
553: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 534 552 47
558: 538(ptr) AccessChain 357(ubo) 192
559: 26(fvec4) Load 558
560: 69(fvec3) VectorShuffle 559 559 0 1 2
561: 69(fvec3) Load 392(fragPos)
562: 69(fvec3) FSub 560 561
Store 554(V) 562
563: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 555 562 47
564: 69(fvec3) Load 554(V)
565: 69(fvec3) ExtInst 2(GLSL.std.450) 69(Normalize) 564
Store 554(V) 565
566: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 555 565 47
Store 567(lightCosInnerAngle) 571
572: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 568 571 47
Store 573(lightCosOuterAngle) 577
578: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 574 577 47
Store 579(lightRange) 583
584: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 580 583 47
589: 181(int) Load 521(i)
590: 538(ptr) AccessChain 357(ubo) 242 589 192
591: 26(fvec4) Load 590
592: 69(fvec3) VectorShuffle 591 591 0 1 2
593: 181(int) Load 521(i)
594: 538(ptr) AccessChain 357(ubo) 242 593 242
595: 26(fvec4) Load 594
596: 69(fvec3) VectorShuffle 595 595 0 1 2
597: 69(fvec3) FSub 592 596
598: 69(fvec3) ExtInst 2(GLSL.std.450) 69(Normalize) 597
Store 585(dir) 598
599: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 586 598 47
604: 69(fvec3) Load 533(L)
605: 69(fvec3) Load 585(dir)
606: 23(float) Dot 604 605
Store 600(cosDir) 606
607: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 601 606 47
612: 23(float) Load 573(lightCosOuterAngle)
613: 23(float) Load 567(lightCosInnerAngle)
614: 23(float) Load 600(cosDir)
615: 23(float) ExtInst 2(GLSL.std.450) 49(SmoothStep) 612 613 614
Store 608(spotEffect) 615
616: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 609 615 47
621: 23(float) Load 579(lightRange)
622: 23(float) Load 545(dist)
623: 23(float) ExtInst 2(GLSL.std.450) 49(SmoothStep) 621 162 622
Store 617(heightAttenuation) 623
624: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 618 623 47
629: 69(fvec3) Load 514(N)
630: 69(fvec3) Load 533(L)
631: 23(float) Dot 629 630
632: 23(float) ExtInst 2(GLSL.std.450) 40(FMax) 162 631
Store 625(NdotL) 632
633: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 626 632 47
638: 23(float) Load 625(NdotL)
639: 69(fvec3) CompositeConstruct 638 638 638
Store 634(diff) 639
640: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 635 639 47
645: 69(fvec3) Load 533(L)
646: 69(fvec3) FNegate 645
647: 69(fvec3) Load 514(N)
648: 69(fvec3) ExtInst 2(GLSL.std.450) 71(Reflect) 646 647
Store 641(R) 648
649: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 642 648 47
654: 69(fvec3) Load 641(R)
655: 69(fvec3) Load 554(V)
656: 23(float) Dot 654 655
657: 23(float) ExtInst 2(GLSL.std.450) 40(FMax) 162 656
Store 650(NdotR) 657
658: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 651 657 47
663: 23(float) Load 650(NdotR)
665: 23(float) ExtInst 2(GLSL.std.450) 26(Pow) 663 664
666: 29(ptr) AccessChain 425(albedo) 12
667: 23(float) Load 666
668: 23(float) FMul 665 667
670: 23(float) FMul 668 669
671: 69(fvec3) CompositeConstruct 670 670 670
Store 659(spec) 671
672: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 660 671 47
673: 69(fvec3) Load 634(diff)
674: 69(fvec3) Load 659(spec)
675: 69(fvec3) FAdd 673 674
676: 23(float) Load 608(spotEffect)
677: 69(fvec3) VectorTimesScalar 675 676
678: 23(float) Load 617(heightAttenuation)
679: 69(fvec3) VectorTimesScalar 677 678
680: 23(float) CompositeExtract 679 0
681: 23(float) CompositeExtract 679 1
682: 23(float) CompositeExtract 679 2
683: 69(fvec3) CompositeConstruct 680 681 682
684: 181(int) Load 521(i)
686: 538(ptr) AccessChain 357(ubo) 242 684 685
687: 26(fvec4) Load 686
688: 69(fvec3) VectorShuffle 687 687 0 1 2
689: 69(fvec3) FMul 683 688
690: 26(fvec4) Load 425(albedo)
691: 69(fvec3) VectorShuffle 690 690 0 1 2
692: 69(fvec3) FMul 689 691
693: 69(fvec3) Load 506(fragcolor)
694: 69(fvec3) FAdd 693 692
Store 506(fragcolor) 694
695: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 507 694 47
Branch 528
528: Label
696: 181(int) Load 521(i)
697: 181(int) IAdd 696 242
Store 521(i) 697
698: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 522 697 47
Branch 525
527: Label
699: 436(ptr) AccessChain 357(ubo) 685
700: 181(int) Load 699
702: 114(bool) SGreaterThan 700 192
SelectionMerge 704 None
BranchConditional 702 703 704
703: Label
706: 69(fvec3) Load 506(fragcolor)
Store 705(param) 706
708: 69(fvec3) Load 392(fragPos)
Store 707(param) 708
709: 69(fvec3) FunctionCall 76(shadow(vf3;vf3;) 705(param) 707(param)
Store 506(fragcolor) 709
710: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 507 709 47
Branch 704
704: Label
711: 69(fvec3) Load 506(fragcolor)
712: 23(float) CompositeExtract 711 0
713: 23(float) CompositeExtract 711 1
714: 23(float) CompositeExtract 711 2
715: 26(fvec4) CompositeConstruct 712 713 714 92
Store 452(outFragColor) 715
Return
FunctionEnd
38(textureProj(vf4;f1;vf2;): 23(float) Function None 33
35(P): 28(ptr) FunctionParameter
36(layer): 29(ptr) FunctionParameter
37(offset): 32(ptr) FunctionParameter
41: Label
89(shadow): 29(ptr) Variable Function
94(shadowCoord): 28(ptr) Variable Function
130(dist): 29(ptr) Variable Function
42: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(Acosh) 40
43: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103 16 11 11 11 11
46: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 44 35(P) 47
50: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 48 36(layer) 47
53: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 51 37(offset) 47
88: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 40 38(textureProj(vf4;f1;vf2;)
Store 89(shadow) 92
93: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 90 92 47
98: 26(fvec4) Load 35(P)
99: 29(ptr) AccessChain 35(P) 12
100: 23(float) Load 99
101: 26(fvec4) CompositeConstruct 100 100 100 100
102: 26(fvec4) FDiv 98 101
Store 94(shadowCoord) 102
103: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 95 102 47
104: 26(fvec4) Load 94(shadowCoord)
105: 30(fvec2) VectorShuffle 104 104 0 1
107: 30(fvec2) VectorTimesScalar 105 106
108: 30(fvec2) CompositeConstruct 106 106
109: 30(fvec2) FAdd 107 108
110: 29(ptr) AccessChain 94(shadowCoord) 11
111: 23(float) CompositeExtract 109 0
Store 110 111
112: 29(ptr) AccessChain 94(shadowCoord) 19
113: 23(float) CompositeExtract 109 1
Store 112 113
115: 29(ptr) AccessChain 94(shadowCoord) 21
116: 23(float) Load 115
120: 114(bool) FOrdGreaterThan 116 117
SelectionMerge 122 None
BranchConditional 120 121 122
121: Label
123: 29(ptr) AccessChain 94(shadowCoord) 21
124: 23(float) Load 123
126: 114(bool) FOrdLessThan 124 92
Branch 122
122: Label
127: 114(bool) Phi 120 41 126 121
SelectionMerge 129 None
BranchConditional 127 128 129
128: Label
148: 139 Load 144(samplerShadowMap)
149: 26(fvec4) Load 94(shadowCoord)
150: 30(fvec2) VectorShuffle 149 149 0 1
151: 30(fvec2) Load 37(offset)
152: 30(fvec2) FAdd 150 151
153: 23(float) Load 36(layer)
154: 23(float) CompositeExtract 152 0
155: 23(float) CompositeExtract 152 1
156: 69(fvec3) CompositeConstruct 154 155 153
157: 26(fvec4) ImageSampleImplicitLod 148 156
158: 23(float) CompositeExtract 157 0
Store 130(dist) 158
159: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 131 158 47
160: 29(ptr) AccessChain 94(shadowCoord) 12
161: 23(float) Load 160
164: 114(bool) FOrdGreaterThan 161 162
SelectionMerge 166 None
BranchConditional 164 165 166
165: Label
167: 23(float) Load 130(dist)
168: 29(ptr) AccessChain 94(shadowCoord) 21
169: 23(float) Load 168
171: 114(bool) FOrdLessThan 167 169
Branch 166
166: Label
172: 114(bool) Phi 164 128 171 165
SelectionMerge 174 None
BranchConditional 172 173 174
173: Label
Store 89(shadow) 175
176: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 90 175 47
Branch 174
174: Label
Branch 129
129: Label
177: 23(float) Load 89(shadow)
ReturnValue 177
FunctionEnd
58(filterPCF(vf4;f1;): 23(float) Function None 54
56(sc): 28(ptr) FunctionParameter
57(layer): 29(ptr) FunctionParameter
61: Label
187(texDim): 186(ptr) Variable Function
199(scale): 29(ptr) Variable Function
205(dx): 29(ptr) Variable Function
217(dy): 29(ptr) Variable Function
228(shadowFactor): 29(ptr) Variable Function
233(count): 211(ptr) Variable Function
238(range): 211(ptr) Variable Function
244(x): 211(ptr) Variable Function
260(y): 211(ptr) Variable Function
285(param): 28(ptr) Variable Function
287(param): 29(ptr) Variable Function
289(param): 32(ptr) Variable Function
62: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(Acosh) 60
63: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103 16 11 11 11 11
66: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 64 56(sc) 47
68: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 67 57(layer) 47
180: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 60 58(filterPCF(vf4;f1;)
191: 139 Load 144(samplerShadowMap)
193: 134 Image 191
196: 194(ivec3) ImageQuerySizeLod 193 192
197: 184(ivec2) VectorShuffle 196 196 0 1
Store 187(texDim) 197
198: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 188 197 47
Store 199(scale) 203
204: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 200 203 47
209: 23(float) Load 199(scale)
210: 23(float) FMul 209 92
212: 211(ptr) AccessChain 187(texDim) 11
213: 181(int) Load 212
214: 23(float) ConvertSToF 213
215: 23(float) FDiv 210 214
Store 205(dx) 215
216: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 206 215 47
221: 23(float) Load 199(scale)
222: 23(float) FMul 221 92
223: 211(ptr) AccessChain 187(texDim) 19
224: 181(int) Load 223
225: 23(float) ConvertSToF 224
226: 23(float) FDiv 222 225
Store 217(dy) 226
227: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 218 226 47
Store 228(shadowFactor) 162
232: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 229 162 47
Store 233(count) 192
237: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 234 192 47
Store 238(range) 242
243: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 239 242 47
248: 181(int) Load 238(range)
249: 181(int) SNegate 248
Store 244(x) 249
250: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 245 249 47
Branch 251
251: Label
LoopMerge 253 254 None
Branch 255
255: Label
256: 181(int) Load 244(x)
257: 181(int) Load 238(range)
259: 114(bool) SLessThanEqual 256 257
BranchConditional 259 252 253
252: Label
264: 181(int) Load 238(range)
265: 181(int) SNegate 264
Store 260(y) 265
266: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 261 265 47
Branch 267
267: Label
LoopMerge 269 270 None
Branch 271
271: Label
272: 181(int) Load 260(y)
273: 181(int) Load 238(range)
275: 114(bool) SLessThanEqual 272 273
BranchConditional 275 268 269
268: Label
276: 23(float) Load 205(dx)
277: 181(int) Load 244(x)
278: 23(float) ConvertSToF 277
279: 23(float) FMul 276 278
280: 23(float) Load 217(dy)
281: 181(int) Load 260(y)
282: 23(float) ConvertSToF 281
283: 23(float) FMul 280 282
284: 30(fvec2) CompositeConstruct 279 283
286: 26(fvec4) Load 56(sc)
Store 285(param) 286
288: 23(float) Load 57(layer)
Store 287(param) 288
Store 289(param) 284
290: 23(float) FunctionCall 38(textureProj(vf4;f1;vf2;) 285(param) 287(param) 289(param)
291: 23(float) Load 228(shadowFactor)
292: 23(float) FAdd 291 290
Store 228(shadowFactor) 292
293: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 229 292 47
294: 181(int) Load 233(count)
295: 181(int) IAdd 294 242
Store 233(count) 295
296: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 234 295 47
Branch 270
270: Label
297: 181(int) Load 260(y)
298: 181(int) IAdd 297 242
Store 260(y) 298
299: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 261 298 47
Branch 267
269: Label
Branch 254
254: Label
300: 181(int) Load 244(x)
301: 181(int) IAdd 300 242
Store 244(x) 301
302: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 245 301 47
Branch 251
253: Label
303: 23(float) Load 228(shadowFactor)
304: 181(int) Load 233(count)
305: 23(float) ConvertSToF 304
306: 23(float) FDiv 303 305
ReturnValue 306
FunctionEnd
76(shadow(vf3;vf3;): 69(fvec3) Function None 72
74(fragcolor): 71(ptr) FunctionParameter
75(fragpos): 71(ptr) FunctionParameter
79: Label
310(i): 211(ptr) Variable Function
324(shadowClip): 28(ptr) Variable Function
371(shadowFactor): 29(ptr) Variable Function
376(param): 28(ptr) Variable Function
378(param): 29(ptr) Variable Function
80: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(Acosh) 78
81: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103 16 11 11 11 11
84: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 82 74(fragcolor) 47
87: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 85 75(fragpos) 47
309: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 78 76(shadow(vf3;vf3;)
Store 310(i) 192
314: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 311 192 47
Branch 315
315: Label
LoopMerge 317 318 None
Branch 319
319: Label
320: 181(int) Load 310(i)
323: 114(bool) SLessThan 320 321
BranchConditional 323 316 317
316: Label
360: 181(int) Load 310(i)
362: 361(ptr) AccessChain 357(ubo) 242 360 321
363: 328 Load 362
364: 69(fvec3) Load 75(fragpos)
365: 23(float) CompositeExtract 364 0
366: 23(float) CompositeExtract 364 1
367: 23(float) CompositeExtract 364 2
368: 26(fvec4) CompositeConstruct 365 366 367 92
369: 26(fvec4) MatrixTimesVector 363 368
Store 324(shadowClip) 369
370: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 325 369 47
374: 181(int) Load 310(i)
375: 23(float) ConvertSToF 374
377: 26(fvec4) Load 324(shadowClip)
Store 376(param) 377
Store 378(param) 375
379: 23(float) FunctionCall 58(filterPCF(vf4;f1;) 376(param) 378(param)
Store 371(shadowFactor) 379
380: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 372 379 47
381: 23(float) Load 371(shadowFactor)
382: 69(fvec3) Load 74(fragcolor)
383: 69(fvec3) VectorTimesScalar 382 381
Store 74(fragcolor) 383
384: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 82 383 47
Branch 318
318: Label
385: 181(int) Load 310(i)
386: 181(int) IAdd 385 242
Store 310(i) 386
387: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 311 386 47
Branch 315
317: Label
388: 69(fvec3) Load 74(fragcolor)
ReturnValue 388
FunctionEnd

View File

@ -0,0 +1,333 @@
spv.debuginfo.glsl.geom
Validation failed
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 232
Capability Geometry
Capability MultiViewport
Extension "SPV_KHR_non_semantic_info"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
2: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Geometry 13 "main" 52 85 104 112 116 145 181 189 206 216 221 225
ExecutionMode 13 Triangles
ExecutionMode 13 Invocations 2
ExecutionMode 13 OutputTriangleStrip
ExecutionMode 13 OutputVertices 3
8: String "uint"
14: String "main"
17: String ""
25: String "int"
30: String "i"
43: String "bool"
47: String "float"
54: String "outNormal"
68: String "projection"
72: String "modelview"
75: String "lightPos"
78: String "UBO"
82: String "ubo"
87: String "gl_InvocationID"
106: String "inNormal"
114: String "outColor"
118: String "inColor"
125: String "pos"
131: String "gl_Position"
134: String "gl_PointSize"
137: String "gl_CullDistance"
141: String "gl_PerVertex"
147: String "gl_in"
155: String "worldPos"
166: String "lPos"
183: String "outLightVec"
191: String "outViewVec"
218: String "gl_ViewportIndex"
223: String "gl_PrimitiveID"
227: String "gl_PrimitiveIDIn"
SourceExtension "GL_ARB_viewport_array"
Name 13 "main"
Name 28 "i"
Name 52 "outNormal"
Name 66 "UBO"
MemberName 66(UBO) 0 "projection"
MemberName 66(UBO) 1 "modelview"
MemberName 66(UBO) 2 "lightPos"
Name 80 "ubo"
Name 85 "gl_InvocationID"
Name 104 "inNormal"
Name 112 "outColor"
Name 116 "inColor"
Name 123 "pos"
Name 129 "gl_PerVertex"
MemberName 129(gl_PerVertex) 0 "gl_Position"
MemberName 129(gl_PerVertex) 1 "gl_PointSize"
MemberName 129(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 129(gl_PerVertex) 3 "gl_CullDistance"
Name 145 "gl_in"
Name 153 "worldPos"
Name 164 "lPos"
Name 181 "outLightVec"
Name 189 "outViewVec"
Name 196 "gl_PerVertex"
MemberName 196(gl_PerVertex) 0 "gl_Position"
MemberName 196(gl_PerVertex) 1 "gl_PointSize"
MemberName 196(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 196(gl_PerVertex) 3 "gl_CullDistance"
Name 206 ""
Name 216 "gl_ViewportIndex"
Name 221 "gl_PrimitiveID"
Name 225 "gl_PrimitiveIDIn"
Decorate 52(outNormal) Location 0
Decorate 62 ArrayStride 64
Decorate 64 ArrayStride 64
MemberDecorate 66(UBO) 0 ColMajor
MemberDecorate 66(UBO) 0 Offset 0
MemberDecorate 66(UBO) 0 MatrixStride 16
MemberDecorate 66(UBO) 1 ColMajor
MemberDecorate 66(UBO) 1 Offset 128
MemberDecorate 66(UBO) 1 MatrixStride 16
MemberDecorate 66(UBO) 2 Offset 256
Decorate 66(UBO) Block
Decorate 80(ubo) DescriptorSet 0
Decorate 80(ubo) Binding 0
Decorate 85(gl_InvocationID) BuiltIn InvocationId
Decorate 104(inNormal) Location 0
Decorate 112(outColor) Location 1
Decorate 116(inColor) Location 1
MemberDecorate 129(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 129(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 129(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 129(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 129(gl_PerVertex) Block
Decorate 181(outLightVec) Location 3
Decorate 189(outViewVec) Location 2
MemberDecorate 196(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 196(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 196(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 196(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 196(gl_PerVertex) Block
Decorate 216(gl_ViewportIndex) BuiltIn ViewportIndex
Decorate 221(gl_PrimitiveID) BuiltIn PrimitiveId
Decorate 225(gl_PrimitiveIDIn) BuiltIn PrimitiveId
3: TypeVoid
4: TypeFunction 3
6: TypeInt 32 0
9: 6(int) Constant 32
10: 6(int) Constant 6
11: 6(int) Constant 0
7: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 8 9 10 11
12: 6(int) Constant 3
5: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 12 3
16: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(Modf) 0 17
19: 6(int) Constant 1
20: 6(int) Constant 4
21: 6(int) Constant 2
18: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(Round) 19 20 16 21
15: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 14 5 16 11 11 18 14 12 11
24: TypeInt 32 1
26: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 25 9 20 11
27: TypePointer Function 24(int)
31: 6(int) Constant 49
29: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 30 26 16 31 11 15 20
32: 24(int) Constant 0
34: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(Sqrt)
41: 24(int) Constant 3
42: TypeBool
44: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 43 9 21 11
46: TypeFloat 32
48: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 47 9 12 11
49: TypeVector 46(float) 3
50: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 48 12
51: TypePointer Output 49(fvec3)
52(outNormal): 51(ptr) Variable Output
55: 6(int) Constant 51
56: 6(int) Constant 8
53: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 54 50 16 55 11 18 54 52(outNormal) 56
57: TypeVector 46(float) 4
58: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 48 20
59: TypeMatrix 57(fvec4) 4
61: 42(bool) ConstantTrue
60: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 58 20 61
62: TypeArray 59 21
63: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 60 21
64: TypeArray 59 21
65: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 60 21
66(UBO): TypeStruct 62 64 57(fvec4)
69: 6(int) Constant 34
70: 6(int) Constant 7
67: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 68 63 16 69 70 11 11 12
73: 6(int) Constant 35
71: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 72 65 16 73 70 11 11 12
76: 6(int) Constant 36
74: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 75 58 16 76 70 11 11 12
77: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 78 19 16 55 11 18 78 11 12 67 71 74
79: TypePointer Uniform 66(UBO)
80(ubo): 79(ptr) Variable Uniform
81: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 82 77 16 55 11 18 82 80(ubo) 56
83: 24(int) Constant 1
84: TypePointer Input 24(int)
85(gl_InvocationID): 84(ptr) Variable Input
86: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 87 26 16 55 11 18 87 85(gl_InvocationID) 56
89: TypePointer Uniform 59
92: TypeMatrix 49(fvec3) 3
93: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 50 12 61
101: TypeArray 49(fvec3) 12
102: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 50 12
103: TypePointer Input 101
104(inNormal): 103(ptr) Variable Input
105: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 106 102 16 55 11 18 106 104(inNormal) 56
108: TypePointer Input 49(fvec3)
112(outColor): 51(ptr) Variable Output
115: 6(int) Constant 52
113: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 114 50 16 115 11 18 114 112(outColor) 56
116(inColor): 103(ptr) Variable Input
117: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 118 102 16 115 11 18 118 116(inColor) 56
122: TypePointer Function 57(fvec4)
126: 6(int) Constant 54
124: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 125 58 16 126 11 15 20
127: TypeArray 46(float) 19
128: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 48 19
129(gl_PerVertex): TypeStruct 57(fvec4) 46(float) 127 127
132: 6(int) Constant 23
130: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 131 58 16 21 132 11 11 12
135: 6(int) Constant 41
133: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 134 48 16 21 135 11 11 12
138: 6(int) Constant 84
136: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 137 128 16 21 138 11 11 12
139: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 137 128 16 21 138 11 11 12
140: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 141 19 16 126 11 18 141 11 12 130 133 136 139
142: TypeArray 129(gl_PerVertex) 12
143: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 140 12
144: TypePointer Input 142
145(gl_in): 144(ptr) Variable Input
146: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 147 143 16 126 11 18 147 145(gl_in) 56
149: TypePointer Input 57(fvec4)
156: 6(int) Constant 55
154: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 155 58 16 156 11 15 20
163: TypePointer Function 49(fvec3)
167: 6(int) Constant 57
165: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 166 50 16 167 11 15 20
171: 24(int) Constant 2
172: TypePointer Uniform 57(fvec4)
181(outLightVec): 51(ptr) Variable Output
184: 6(int) Constant 58
182: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 183 50 16 184 11 18 183 181(outLightVec) 56
189(outViewVec): 51(ptr) Variable Output
192: 6(int) Constant 59
190: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 191 50 16 192 11 18 191 189(outViewVec) 56
196(gl_PerVertex): TypeStruct 57(fvec4) 46(float) 127 127
198: 6(int) Constant 215
197: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 131 58 16 21 198 11 11 12
200: 6(int) Constant 233
199: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 134 48 16 21 200 11 11 12
201: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 137 128 16 12 70 11 11 12
202: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 137 128 16 12 70 11 11 12
204: 6(int) Constant 61
203: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 141 19 16 204 11 18 141 11 12 197 199 201 202
205: TypePointer Output 196(gl_PerVertex)
206: 205(ptr) Variable Output
207: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 17 203 16 204 11 18 17 206 56
213: TypePointer Output 57(fvec4)
215: TypePointer Output 24(int)
216(gl_ViewportIndex): 215(ptr) Variable Output
219: 6(int) Constant 64
217: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 218 26 16 219 11 18 218 216(gl_ViewportIndex) 56
221(gl_PrimitiveID): 215(ptr) Variable Output
224: 6(int) Constant 65
222: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 223 26 16 224 11 18 223 221(gl_PrimitiveID) 56
225(gl_PrimitiveIDIn): 84(ptr) Variable Input
226: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 227 26 16 224 11 18 227 225(gl_PrimitiveIDIn) 56
13(main): 3 Function None 4
22: Label
28(i): 27(ptr) Variable Function
123(pos): 122(ptr) Variable Function
153(worldPos): 122(ptr) Variable Function
164(lPos): 163(ptr) Variable Function
23: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 15 13(main)
Store 28(i) 32
33: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 29 32 34
Branch 35
35: Label
LoopMerge 37 38 None
Branch 39
39: Label
40: 24(int) Load 28(i)
45: 42(bool) SLessThan 40 41
BranchConditional 45 36 37
36: Label
88: 24(int) Load 85(gl_InvocationID)
90: 89(ptr) AccessChain 80(ubo) 83 88
91: 59 Load 90
94: 57(fvec4) CompositeExtract 91 0
95: 49(fvec3) VectorShuffle 94 94 0 1 2
96: 57(fvec4) CompositeExtract 91 1
97: 49(fvec3) VectorShuffle 96 96 0 1 2
98: 57(fvec4) CompositeExtract 91 2
99: 49(fvec3) VectorShuffle 98 98 0 1 2
100: 92 CompositeConstruct 95 97 99
107: 24(int) Load 28(i)
109: 108(ptr) AccessChain 104(inNormal) 107
110: 49(fvec3) Load 109
111: 49(fvec3) MatrixTimesVector 100 110
Store 52(outNormal) 111
119: 24(int) Load 28(i)
120: 108(ptr) AccessChain 116(inColor) 119
121: 49(fvec3) Load 120
Store 112(outColor) 121
148: 24(int) Load 28(i)
150: 149(ptr) AccessChain 145(gl_in) 148 32
151: 57(fvec4) Load 150
Store 123(pos) 151
152: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 124 151 34
157: 24(int) Load 85(gl_InvocationID)
158: 89(ptr) AccessChain 80(ubo) 83 157
159: 59 Load 158
160: 57(fvec4) Load 123(pos)
161: 57(fvec4) MatrixTimesVector 159 160
Store 153(worldPos) 161
162: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 154 161 34
168: 24(int) Load 85(gl_InvocationID)
169: 89(ptr) AccessChain 80(ubo) 83 168
170: 59 Load 169
173: 172(ptr) AccessChain 80(ubo) 171
174: 57(fvec4) Load 173
175: 57(fvec4) MatrixTimesVector 170 174
176: 46(float) CompositeExtract 175 0
177: 46(float) CompositeExtract 175 1
178: 46(float) CompositeExtract 175 2
179: 49(fvec3) CompositeConstruct 176 177 178
Store 164(lPos) 179
180: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 165 179 34
185: 49(fvec3) Load 164(lPos)
186: 57(fvec4) Load 153(worldPos)
187: 49(fvec3) VectorShuffle 186 186 0 1 2
188: 49(fvec3) FSub 185 187
Store 181(outLightVec) 188
193: 57(fvec4) Load 153(worldPos)
194: 49(fvec3) VectorShuffle 193 193 0 1 2
195: 49(fvec3) FNegate 194
Store 189(outViewVec) 195
208: 24(int) Load 85(gl_InvocationID)
209: 89(ptr) AccessChain 80(ubo) 32 208
210: 59 Load 209
211: 57(fvec4) Load 153(worldPos)
212: 57(fvec4) MatrixTimesVector 210 211
214: 213(ptr) AccessChain 206 32
Store 214 212
220: 24(int) Load 85(gl_InvocationID)
Store 216(gl_ViewportIndex) 220
228: 24(int) Load 225(gl_PrimitiveIDIn)
Store 221(gl_PrimitiveID) 228
EmitVertex
Branch 38
38: Label
229: 24(int) Load 28(i)
230: 24(int) IAdd 229 83
Store 28(i) 230
231: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 29 230 34
Branch 35
37: Label
EndPrimitive
Return
FunctionEnd

View File

@ -0,0 +1,622 @@
spv.debuginfo.glsl.tesc
Validation failed
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 460
Capability Tessellation
Extension "SPV_KHR_non_semantic_info"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
2: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationControl 13 "main" 231 235 261 328 338 418 430 438 450
ExecutionMode 13 OutputVertices 4
8: String "uint"
14: String "main"
17: String ""
24: String "float"
34: String "screenSpaceTessFactor"
40: String "p0"
44: String "p1"
47: String "bool"
52: String "frustumCheck"
58: String "midPoint"
69: String "radius"
79: String "v0"
90: String "modelview"
95: String "lightPos"
98: String "frustumPlanes"
100: String "tessellatedEdgeSize"
105: String "viewportDim"
109: String "UBO"
113: String "ubo"
115: String "int"
126: String "clip0"
146: String "clip1"
211: String "pos"
217: String "gl_Position"
220: String "gl_PointSize"
223: String "gl_CullDistance"
227: String "gl_PerVertex"
233: String "gl_in"
237: String "gl_InvocationID"
245: String "type.2d.image"
247: String "@type.2d.image"
251: String "type.sampled.image"
252: String "@type.sampled.image"
256: String "samplerHeight"
263: String "inUV"
280: String "i"
330: String "gl_TessLevelInner"
340: String "gl_TessLevelOuter"
420: String "gl_out"
432: String "outNormal"
440: String "inNormal"
452: String "outUV"
Name 13 "main"
Name 33 "screenSpaceTessFactor(vf4;vf4;"
Name 31 "p0"
Name 32 "p1"
Name 51 "frustumCheck("
Name 56 "midPoint"
Name 67 "radius"
Name 77 "v0"
Name 88 "UBO"
MemberName 88(UBO) 0 "projection"
MemberName 88(UBO) 1 "modelview"
MemberName 88(UBO) 2 "lightPos"
MemberName 88(UBO) 3 "frustumPlanes"
MemberName 88(UBO) 4 "displacementFactor"
MemberName 88(UBO) 5 "tessellationFactor"
MemberName 88(UBO) 6 "viewportDim"
MemberName 88(UBO) 7 "tessellatedEdgeSize"
Name 111 "ubo"
Name 124 "clip0"
Name 144 "clip1"
Name 209 "pos"
Name 215 "gl_PerVertex"
MemberName 215(gl_PerVertex) 0 "gl_Position"
MemberName 215(gl_PerVertex) 1 "gl_PointSize"
MemberName 215(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 215(gl_PerVertex) 3 "gl_CullDistance"
Name 231 "gl_in"
Name 235 "gl_InvocationID"
Name 254 "samplerHeight"
Name 261 "inUV"
Name 278 "i"
Name 328 "gl_TessLevelInner"
Name 338 "gl_TessLevelOuter"
Name 354 "param"
Name 357 "param"
Name 362 "param"
Name 365 "param"
Name 370 "param"
Name 373 "param"
Name 378 "param"
Name 381 "param"
Name 405 "gl_PerVertex"
MemberName 405(gl_PerVertex) 0 "gl_Position"
MemberName 405(gl_PerVertex) 1 "gl_PointSize"
MemberName 405(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 405(gl_PerVertex) 3 "gl_CullDistance"
Name 418 "gl_out"
Name 430 "outNormal"
Name 438 "inNormal"
Name 450 "outUV"
Decorate 84 ArrayStride 16
MemberDecorate 88(UBO) 0 ColMajor
MemberDecorate 88(UBO) 0 Offset 0
MemberDecorate 88(UBO) 0 MatrixStride 16
MemberDecorate 88(UBO) 1 ColMajor
MemberDecorate 88(UBO) 1 Offset 64
MemberDecorate 88(UBO) 1 MatrixStride 16
MemberDecorate 88(UBO) 2 Offset 128
MemberDecorate 88(UBO) 3 Offset 144
MemberDecorate 88(UBO) 4 Offset 240
MemberDecorate 88(UBO) 5 Offset 244
MemberDecorate 88(UBO) 6 Offset 248
MemberDecorate 88(UBO) 7 Offset 256
Decorate 88(UBO) Block
Decorate 111(ubo) DescriptorSet 0
Decorate 111(ubo) Binding 0
MemberDecorate 215(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 215(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 215(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 215(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 215(gl_PerVertex) Block
Decorate 235(gl_InvocationID) BuiltIn InvocationId
Decorate 254(samplerHeight) DescriptorSet 0
Decorate 254(samplerHeight) Binding 1
Decorate 261(inUV) Location 1
Decorate 328(gl_TessLevelInner) Patch
Decorate 328(gl_TessLevelInner) BuiltIn TessLevelInner
Decorate 338(gl_TessLevelOuter) Patch
Decorate 338(gl_TessLevelOuter) BuiltIn TessLevelOuter
MemberDecorate 405(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 405(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 405(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 405(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 405(gl_PerVertex) Block
Decorate 430(outNormal) Location 0
Decorate 438(inNormal) Location 0
Decorate 450(outUV) Location 1
3: TypeVoid
4: TypeFunction 3
6: TypeInt 32 0
9: 6(int) Constant 32
10: 6(int) Constant 6
11: 6(int) Constant 0
7: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 8 9 10 11
12: 6(int) Constant 3
5: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 12 3
16: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(Modf) 0 17
19: 6(int) Constant 1
20: 6(int) Constant 4
21: 6(int) Constant 2
18: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(Round) 19 20 16 21
15: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 14 5 16 11 11 18 14 12 11
23: TypeFloat 32
25: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 24 9 12 11
26: TypeVector 23(float) 4
27: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 25 20
28: TypePointer Function 26(fvec4)
29: TypeFunction 23(float) 28(ptr) 28(ptr)
30: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 12 25 27 27
35: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 34 30 16 11 11 18 34 12 11
39: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 40 27 16 11 11 35 20 19
42: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(Sqrt)
43: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 44 27 16 11 11 35 20 21
46: TypeBool
48: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 47 9 21 11
49: TypeFunction 46(bool)
50: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 12 48
53: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 52 50 16 11 11 18 52 12 11
59: 6(int) Constant 54
57: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 58 27 16 59 11 35 20
60: 23(float) Constant 1056964608
66: TypePointer Function 23(float)
70: 6(int) Constant 56
68: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 69 25 16 70 11 35 20
74: 23(float) Constant 1073741824
80: 6(int) Constant 59
78: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 79 27 16 80 11 35 20
81: TypeMatrix 26(fvec4) 4
83: 46(bool) ConstantTrue
82: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 27 20 83
84: TypeArray 26(fvec4) 10
85: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 27 10
86: TypeVector 23(float) 2
87: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 25 21
88(UBO): TypeStruct 81 81 26(fvec4) 84 23(float) 23(float) 86(fvec2) 23(float)
91: 6(int) Constant 30
92: 6(int) Constant 7
89: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 90 82 16 91 92 11 11 12
93: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 90 82 16 91 92 11 11 12
96: 6(int) Constant 31
94: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 95 27 16 96 92 11 11 12
97: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 98 85 16 9 92 11 11 12
101: 6(int) Constant 36
102: 6(int) Constant 8
99: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 100 25 16 101 102 11 11 12
103: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 100 25 16 101 102 11 11 12
106: 6(int) Constant 35
104: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 105 87 16 106 92 11 11 12
107: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 100 25 16 101 102 11 11 12
108: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 109 19 16 80 11 18 109 11 12 89 93 94 97 99 103 104 107
110: TypePointer Uniform 88(UBO)
111(ubo): 110(ptr) Variable Uniform
112: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 113 108 16 80 11 18 113 111(ubo) 102
114: TypeInt 32 1
116: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 115 9 20 11
117: 114(int) Constant 1
118: TypePointer Uniform 81
127: 6(int) Constant 62
125: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 126 27 16 127 11 35 20
128: 114(int) Constant 0
133: TypeVector 23(float) 3
134: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 25 12
135: 23(float) Constant 0
136: 133(fvec3) ConstantComposite 135 135 135
147: 6(int) Constant 63
145: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 146 27 16 147 11 35 20
171: 114(int) Constant 6
172: TypePointer Uniform 86(fvec2)
194: 114(int) Constant 7
195: TypePointer Uniform 23(float)
199: 114(int) Constant 5
203: 23(float) Constant 1065353216
204: 23(float) Constant 1115684864
212: 6(int) Constant 85
210: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 211 27 16 212 11 53 20
213: TypeArray 23(float) 19
214: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 25 19
215(gl_PerVertex): TypeStruct 26(fvec4) 23(float) 213 213
218: 6(int) Constant 1756
216: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 217 27 16 19 218 11 11 12
221: 6(int) Constant 1774
219: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 220 25 16 19 221 11 11 12
224: 6(int) Constant 1817
222: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 223 214 16 19 224 11 11 12
225: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 223 214 16 19 224 11 11 12
226: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 227 19 16 212 11 18 227 11 12 216 219 222 225
228: TypeArray 215(gl_PerVertex) 9
229: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 226 9
230: TypePointer Input 228
231(gl_in): 230(ptr) Variable Input
232: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 233 229 16 212 11 18 233 231(gl_in) 102
234: TypePointer Input 114(int)
235(gl_InvocationID): 234(ptr) Variable Input
236: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 237 116 16 212 11 18 237 235(gl_InvocationID) 102
239: TypePointer Input 26(fvec4)
243: TypeImage 23(float) 2D sampled format:Unknown
246: 6(int) Constant 86
248: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(Unknown)
244: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 245 11 16 246 11 18 247 248 12
249: TypeSampledImage 243
250: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 251 11 16 246 11 18 252 248 12
253: TypePointer UniformConstant 249
254(samplerHeight): 253(ptr) Variable UniformConstant
255: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 256 250 16 246 11 18 256 254(samplerHeight) 102
258: TypeArray 86(fvec2) 9
259: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 87 9
260: TypePointer Input 258
261(inUV): 260(ptr) Variable Input
262: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 263 259 16 246 11 18 263 261(inUV) 102
264: TypePointer Input 86(fvec2)
269: 114(int) Constant 4
277: TypePointer Function 114(int)
281: 6(int) Constant 89
279: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 280 116 16 281 11 53 20
289: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 47 9 21 11
292: 114(int) Constant 3
294: TypePointer Uniform 26(fvec4)
298: 23(float) Constant 1090519040
300: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 47 9 21 11
304: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 47 9 21 11
305: 46(bool) ConstantFalse
310: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 47 9 21 11
315: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 47 9 21 11
320: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 47 9 21 11
321: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 47 9 21 11
325: TypeArray 23(float) 21
326: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 25 21
327: TypePointer Output 325
328(gl_TessLevelInner): 327(ptr) Variable Output
331: 6(int) Constant 104
329: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 330 326 16 331 11 18 330 328(gl_TessLevelInner) 102
332: TypePointer Output 23(float)
335: TypeArray 23(float) 20
336: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 25 20
337: TypePointer Output 335
338(gl_TessLevelOuter): 337(ptr) Variable Output
341: 6(int) Constant 106
339: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 340 336 16 341 11 18 340 338(gl_TessLevelOuter) 102
344: 114(int) Constant 2
350: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 47 9 21 11
405(gl_PerVertex): TypeStruct 26(fvec4) 23(float) 213 213
407: 6(int) Constant 110
406: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 217 27 16 19 407 11 11 12
409: 6(int) Constant 128
408: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 220 25 16 19 409 11 11 12
411: 6(int) Constant 171
410: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 223 214 16 19 411 11 11 12
412: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 223 214 16 19 411 11 11 12
414: 6(int) Constant 137
413: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 227 19 16 414 11 18 227 11 12 406 408 410 412
415: TypeArray 405(gl_PerVertex) 20
416: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 413 20
417: TypePointer Output 415
418(gl_out): 417(ptr) Variable Output
419: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 420 416 16 414 11 18 420 418(gl_out) 102
425: TypePointer Output 26(fvec4)
427: TypeArray 133(fvec3) 20
428: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 134 20
429: TypePointer Output 427
430(outNormal): 429(ptr) Variable Output
433: 6(int) Constant 138
431: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 432 428 16 433 11 18 432 430(outNormal) 102
435: TypeArray 133(fvec3) 9
436: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 134 9
437: TypePointer Input 435
438(inNormal): 437(ptr) Variable Input
439: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 440 436 16 433 11 18 440 438(inNormal) 102
442: TypePointer Input 133(fvec3)
445: TypePointer Output 133(fvec3)
447: TypeArray 86(fvec2) 20
448: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 87 20
449: TypePointer Output 447
450(outUV): 449(ptr) Variable Output
453: 6(int) Constant 139
451: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 452 448 16 453 11 18 452 450(outUV) 102
458: TypePointer Output 86(fvec2)
13(main): 3 Function None 4
22: Label
354(param): 28(ptr) Variable Function
357(param): 28(ptr) Variable Function
362(param): 28(ptr) Variable Function
365(param): 28(ptr) Variable Function
370(param): 28(ptr) Variable Function
373(param): 28(ptr) Variable Function
378(param): 28(ptr) Variable Function
381(param): 28(ptr) Variable Function
313: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 15 13(main)
314: 114(int) Load 235(gl_InvocationID)
316: 46(bool) IEqual 314 128
SelectionMerge 318 None
BranchConditional 316 317 318
317: Label
319: 46(bool) FunctionCall 51(frustumCheck()
322: 46(bool) LogicalNot 319
SelectionMerge 324 None
BranchConditional 322 323 347
323: Label
333: 332(ptr) AccessChain 328(gl_TessLevelInner) 128
Store 333 135
334: 332(ptr) AccessChain 328(gl_TessLevelInner) 117
Store 334 135
342: 332(ptr) AccessChain 338(gl_TessLevelOuter) 128
Store 342 135
343: 332(ptr) AccessChain 338(gl_TessLevelOuter) 117
Store 343 135
345: 332(ptr) AccessChain 338(gl_TessLevelOuter) 344
Store 345 135
346: 332(ptr) AccessChain 338(gl_TessLevelOuter) 292
Store 346 135
Branch 324
347: Label
348: 195(ptr) AccessChain 111(ubo) 199
349: 23(float) Load 348
351: 46(bool) FOrdGreaterThan 349 135
SelectionMerge 353 None
BranchConditional 351 352 398
352: Label
355: 239(ptr) AccessChain 231(gl_in) 292 128
356: 26(fvec4) Load 355
Store 354(param) 356
358: 239(ptr) AccessChain 231(gl_in) 128 128
359: 26(fvec4) Load 358
Store 357(param) 359
360: 23(float) FunctionCall 33(screenSpaceTessFactor(vf4;vf4;) 354(param) 357(param)
361: 332(ptr) AccessChain 338(gl_TessLevelOuter) 128
Store 361 360
363: 239(ptr) AccessChain 231(gl_in) 128 128
364: 26(fvec4) Load 363
Store 362(param) 364
366: 239(ptr) AccessChain 231(gl_in) 117 128
367: 26(fvec4) Load 366
Store 365(param) 367
368: 23(float) FunctionCall 33(screenSpaceTessFactor(vf4;vf4;) 362(param) 365(param)
369: 332(ptr) AccessChain 338(gl_TessLevelOuter) 117
Store 369 368
371: 239(ptr) AccessChain 231(gl_in) 117 128
372: 26(fvec4) Load 371
Store 370(param) 372
374: 239(ptr) AccessChain 231(gl_in) 344 128
375: 26(fvec4) Load 374
Store 373(param) 375
376: 23(float) FunctionCall 33(screenSpaceTessFactor(vf4;vf4;) 370(param) 373(param)
377: 332(ptr) AccessChain 338(gl_TessLevelOuter) 344
Store 377 376
379: 239(ptr) AccessChain 231(gl_in) 344 128
380: 26(fvec4) Load 379
Store 378(param) 380
382: 239(ptr) AccessChain 231(gl_in) 292 128
383: 26(fvec4) Load 382
Store 381(param) 383
384: 23(float) FunctionCall 33(screenSpaceTessFactor(vf4;vf4;) 378(param) 381(param)
385: 332(ptr) AccessChain 338(gl_TessLevelOuter) 292
Store 385 384
386: 332(ptr) AccessChain 338(gl_TessLevelOuter) 128
387: 23(float) Load 386
388: 332(ptr) AccessChain 338(gl_TessLevelOuter) 292
389: 23(float) Load 388
390: 23(float) ExtInst 2(GLSL.std.450) 46(FMix) 387 389 60
391: 332(ptr) AccessChain 328(gl_TessLevelInner) 128
Store 391 390
392: 332(ptr) AccessChain 338(gl_TessLevelOuter) 344
393: 23(float) Load 392
394: 332(ptr) AccessChain 338(gl_TessLevelOuter) 117
395: 23(float) Load 394
396: 23(float) ExtInst 2(GLSL.std.450) 46(FMix) 393 395 60
397: 332(ptr) AccessChain 328(gl_TessLevelInner) 117
Store 397 396
Branch 353
398: Label
399: 332(ptr) AccessChain 328(gl_TessLevelInner) 128
Store 399 203
400: 332(ptr) AccessChain 328(gl_TessLevelInner) 117
Store 400 203
401: 332(ptr) AccessChain 338(gl_TessLevelOuter) 128
Store 401 203
402: 332(ptr) AccessChain 338(gl_TessLevelOuter) 117
Store 402 203
403: 332(ptr) AccessChain 338(gl_TessLevelOuter) 344
Store 403 203
404: 332(ptr) AccessChain 338(gl_TessLevelOuter) 292
Store 404 203
Branch 353
353: Label
Branch 324
324: Label
Branch 318
318: Label
421: 114(int) Load 235(gl_InvocationID)
422: 114(int) Load 235(gl_InvocationID)
423: 239(ptr) AccessChain 231(gl_in) 422 128
424: 26(fvec4) Load 423
426: 425(ptr) AccessChain 418(gl_out) 421 128
Store 426 424
434: 114(int) Load 235(gl_InvocationID)
441: 114(int) Load 235(gl_InvocationID)
443: 442(ptr) AccessChain 438(inNormal) 441
444: 133(fvec3) Load 443
446: 445(ptr) AccessChain 430(outNormal) 434
Store 446 444
454: 114(int) Load 235(gl_InvocationID)
455: 114(int) Load 235(gl_InvocationID)
456: 264(ptr) AccessChain 261(inUV) 455
457: 86(fvec2) Load 456
459: 458(ptr) AccessChain 450(outUV) 454
Store 459 457
Return
FunctionEnd
33(screenSpaceTessFactor(vf4;vf4;): 23(float) Function None 29
31(p0): 28(ptr) FunctionParameter
32(p1): 28(ptr) FunctionParameter
36: Label
56(midPoint): 28(ptr) Variable Function
67(radius): 66(ptr) Variable Function
77(v0): 28(ptr) Variable Function
124(clip0): 28(ptr) Variable Function
144(clip1): 28(ptr) Variable Function
37: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(Acosh) 35
38: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103 16 11 11 11 11
41: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 39 31(p0) 42
45: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 43 32(p1) 42
55: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 35 33(screenSpaceTessFactor(vf4;vf4;)
61: 26(fvec4) Load 31(p0)
62: 26(fvec4) Load 32(p1)
63: 26(fvec4) FAdd 61 62
64: 26(fvec4) VectorTimesScalar 63 60
Store 56(midPoint) 64
65: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 57 64 42
71: 26(fvec4) Load 31(p0)
72: 26(fvec4) Load 32(p1)
73: 23(float) ExtInst 2(GLSL.std.450) 67(Distance) 71 72
75: 23(float) FDiv 73 74
Store 67(radius) 75
76: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 68 75 42
119: 118(ptr) AccessChain 111(ubo) 117
120: 81 Load 119
121: 26(fvec4) Load 56(midPoint)
122: 26(fvec4) MatrixTimesVector 120 121
Store 77(v0) 122
123: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 78 122 42
129: 118(ptr) AccessChain 111(ubo) 128
130: 81 Load 129
131: 26(fvec4) Load 77(v0)
132: 23(float) Load 67(radius)
137: 23(float) CompositeExtract 136 0
138: 23(float) CompositeExtract 136 1
139: 23(float) CompositeExtract 136 2
140: 26(fvec4) CompositeConstruct 132 137 138 139
141: 26(fvec4) FSub 131 140
142: 26(fvec4) MatrixTimesVector 130 141
Store 124(clip0) 142
143: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 125 142 42
148: 118(ptr) AccessChain 111(ubo) 128
149: 81 Load 148
150: 26(fvec4) Load 77(v0)
151: 23(float) Load 67(radius)
152: 23(float) CompositeExtract 136 0
153: 23(float) CompositeExtract 136 1
154: 23(float) CompositeExtract 136 2
155: 26(fvec4) CompositeConstruct 151 152 153 154
156: 26(fvec4) FAdd 150 155
157: 26(fvec4) MatrixTimesVector 149 156
Store 144(clip1) 157
158: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 145 157 42
159: 66(ptr) AccessChain 124(clip0) 12
160: 23(float) Load 159
161: 26(fvec4) Load 124(clip0)
162: 26(fvec4) CompositeConstruct 160 160 160 160
163: 26(fvec4) FDiv 161 162
Store 124(clip0) 163
164: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 125 163 42
165: 66(ptr) AccessChain 144(clip1) 12
166: 23(float) Load 165
167: 26(fvec4) Load 144(clip1)
168: 26(fvec4) CompositeConstruct 166 166 166 166
169: 26(fvec4) FDiv 167 168
Store 144(clip1) 169
170: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 145 169 42
173: 172(ptr) AccessChain 111(ubo) 171
174: 86(fvec2) Load 173
175: 26(fvec4) Load 124(clip0)
176: 86(fvec2) VectorShuffle 175 175 0 1
177: 86(fvec2) FMul 176 174
178: 66(ptr) AccessChain 124(clip0) 11
179: 23(float) CompositeExtract 177 0
Store 178 179
180: 66(ptr) AccessChain 124(clip0) 19
181: 23(float) CompositeExtract 177 1
Store 180 181
182: 172(ptr) AccessChain 111(ubo) 171
183: 86(fvec2) Load 182
184: 26(fvec4) Load 144(clip1)
185: 86(fvec2) VectorShuffle 184 184 0 1
186: 86(fvec2) FMul 185 183
187: 66(ptr) AccessChain 144(clip1) 11
188: 23(float) CompositeExtract 186 0
Store 187 188
189: 66(ptr) AccessChain 144(clip1) 19
190: 23(float) CompositeExtract 186 1
Store 189 190
191: 26(fvec4) Load 124(clip0)
192: 26(fvec4) Load 144(clip1)
193: 23(float) ExtInst 2(GLSL.std.450) 67(Distance) 191 192
196: 195(ptr) AccessChain 111(ubo) 194
197: 23(float) Load 196
198: 23(float) FDiv 193 197
200: 195(ptr) AccessChain 111(ubo) 199
201: 23(float) Load 200
202: 23(float) FMul 198 201
205: 23(float) ExtInst 2(GLSL.std.450) 43(FClamp) 202 203 204
ReturnValue 205
FunctionEnd
51(frustumCheck(): 46(bool) Function None 49
54: Label
209(pos): 28(ptr) Variable Function
278(i): 277(ptr) Variable Function
208: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 53 51(frustumCheck()
238: 114(int) Load 235(gl_InvocationID)
240: 239(ptr) AccessChain 231(gl_in) 238 128
241: 26(fvec4) Load 240
Store 209(pos) 241
242: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 210 241 42
257: 249 Load 254(samplerHeight)
265: 264(ptr) AccessChain 261(inUV) 128
266: 86(fvec2) Load 265
267: 26(fvec4) ImageSampleExplicitLod 257 266 Lod 135
268: 23(float) CompositeExtract 267 0
270: 195(ptr) AccessChain 111(ubo) 269
271: 23(float) Load 270
272: 23(float) FMul 268 271
273: 66(ptr) AccessChain 209(pos) 19
274: 23(float) Load 273
275: 23(float) FSub 274 272
276: 66(ptr) AccessChain 209(pos) 19
Store 276 275
Store 278(i) 128
282: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 279 128 42
Branch 283
283: Label
LoopMerge 285 286 None
Branch 287
287: Label
288: 114(int) Load 278(i)
290: 46(bool) SLessThan 288 171
BranchConditional 290 284 285
284: Label
291: 26(fvec4) Load 209(pos)
293: 114(int) Load 278(i)
295: 294(ptr) AccessChain 111(ubo) 292 293
296: 26(fvec4) Load 295
297: 23(float) Dot 291 296
299: 23(float) FAdd 297 298
301: 46(bool) FOrdLessThan 299 135
SelectionMerge 303 None
BranchConditional 301 302 303
302: Label
ReturnValue 305
303: Label
Branch 286
286: Label
307: 114(int) Load 278(i)
308: 114(int) IAdd 307 117
Store 278(i) 308
309: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 279 308 42
Branch 283
285: Label
ReturnValue 83
FunctionEnd

View File

@ -0,0 +1,421 @@
spv.debuginfo.glsl.tese
Validation failed
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 315
Capability Tessellation
Extension "SPV_KHR_non_semantic_info"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
2: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationEvaluation 13 "main" 37 54 80 98 124 159 267 279 286 297 303
ExecutionMode 13 Quads
ExecutionMode 13 SpacingEqual
ExecutionMode 13 VertexOrderCw
8: String "uint"
14: String "main"
17: String ""
25: String "float"
32: String "uv1"
39: String "inUV"
42: String "int"
56: String "gl_TessCoord"
66: String "uv2"
82: String "outUV"
93: String "n1"
100: String "inNormal"
112: String "n2"
126: String "outNormal"
139: String "pos1"
145: String "gl_Position"
148: String "gl_PointSize"
151: String "gl_CullDistance"
155: String "gl_PerVertex"
161: String "gl_in"
174: String "pos2"
187: String "pos"
198: String "type.2d.image"
200: String "@type.2d.image"
204: String "type.sampled.image"
205: String "@type.sampled.image"
209: String "displacementMap"
223: String "modelview"
228: String "lightPos"
231: String "frustumPlanes"
233: String "tessellatedEdgeSize"
237: String "viewportDim"
241: String "UBO"
245: String "ubo"
281: String "outViewVec"
288: String "outLightVec"
299: String "outWorldPos"
305: String "outEyePos"
Name 13 "main"
Name 30 "uv1"
Name 37 "inUV"
Name 54 "gl_TessCoord"
Name 64 "uv2"
Name 80 "outUV"
Name 91 "n1"
Name 98 "inNormal"
Name 110 "n2"
Name 124 "outNormal"
Name 137 "pos1"
Name 143 "gl_PerVertex"
MemberName 143(gl_PerVertex) 0 "gl_Position"
MemberName 143(gl_PerVertex) 1 "gl_PointSize"
MemberName 143(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 143(gl_PerVertex) 3 "gl_CullDistance"
Name 159 "gl_in"
Name 172 "pos2"
Name 185 "pos"
Name 207 "displacementMap"
Name 221 "UBO"
MemberName 221(UBO) 0 "projection"
MemberName 221(UBO) 1 "modelview"
MemberName 221(UBO) 2 "lightPos"
MemberName 221(UBO) 3 "frustumPlanes"
MemberName 221(UBO) 4 "displacementFactor"
MemberName 221(UBO) 5 "tessellationFactor"
MemberName 221(UBO) 6 "viewportDim"
MemberName 221(UBO) 7 "tessellatedEdgeSize"
Name 243 "ubo"
Name 256 "gl_PerVertex"
MemberName 256(gl_PerVertex) 0 "gl_Position"
MemberName 256(gl_PerVertex) 1 "gl_PointSize"
MemberName 256(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 256(gl_PerVertex) 3 "gl_CullDistance"
Name 267 ""
Name 279 "outViewVec"
Name 286 "outLightVec"
Name 297 "outWorldPos"
Name 303 "outEyePos"
Decorate 37(inUV) Location 1
Decorate 54(gl_TessCoord) BuiltIn TessCoord
Decorate 80(outUV) Location 1
Decorate 98(inNormal) Location 0
Decorate 124(outNormal) Location 0
MemberDecorate 143(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 143(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 143(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 143(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 143(gl_PerVertex) Block
Decorate 207(displacementMap) DescriptorSet 0
Decorate 207(displacementMap) Binding 1
Decorate 219 ArrayStride 16
MemberDecorate 221(UBO) 0 ColMajor
MemberDecorate 221(UBO) 0 Offset 0
MemberDecorate 221(UBO) 0 MatrixStride 16
MemberDecorate 221(UBO) 1 ColMajor
MemberDecorate 221(UBO) 1 Offset 64
MemberDecorate 221(UBO) 1 MatrixStride 16
MemberDecorate 221(UBO) 2 Offset 128
MemberDecorate 221(UBO) 3 Offset 144
MemberDecorate 221(UBO) 4 Offset 240
MemberDecorate 221(UBO) 5 Offset 244
MemberDecorate 221(UBO) 6 Offset 248
MemberDecorate 221(UBO) 7 Offset 256
Decorate 221(UBO) Block
Decorate 243(ubo) DescriptorSet 0
Decorate 243(ubo) Binding 0
MemberDecorate 256(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 256(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 256(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 256(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 256(gl_PerVertex) Block
Decorate 279(outViewVec) Location 2
Decorate 286(outLightVec) Location 3
Decorate 297(outWorldPos) Location 5
Decorate 303(outEyePos) Location 4
3: TypeVoid
4: TypeFunction 3
6: TypeInt 32 0
9: 6(int) Constant 32
10: 6(int) Constant 6
11: 6(int) Constant 0
7: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 8 9 10 11
12: 6(int) Constant 3
5: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 12 3
16: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(Modf) 0 17
19: 6(int) Constant 1
20: 6(int) Constant 4
21: 6(int) Constant 2
18: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(Round) 19 20 16 21
15: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 14 5 16 11 11 18 14 12 11
24: TypeFloat 32
26: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 25 9 12 11
27: TypeVector 24(float) 2
28: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 26 21
29: TypePointer Function 27(fvec2)
33: 6(int) Constant 56
31: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 32 28 16 33 11 15 20
34: TypeArray 27(fvec2) 9
35: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 28 9
36: TypePointer Input 34
37(inUV): 36(ptr) Variable Input
40: 6(int) Constant 8
38: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 39 35 16 33 11 18 39 37(inUV) 40
41: TypeInt 32 1
43: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 42 9 20 11
44: 41(int) Constant 0
45: TypePointer Input 27(fvec2)
48: 41(int) Constant 1
51: TypeVector 24(float) 3
52: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 26 12
53: TypePointer Input 51(fvec3)
54(gl_TessCoord): 53(ptr) Variable Input
55: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 56 52 16 33 11 18 56 54(gl_TessCoord) 40
57: TypePointer Input 24(float)
63: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(Sqrt)
67: 6(int) Constant 57
65: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 66 28 16 67 11 15 20
68: 41(int) Constant 3
71: 41(int) Constant 2
79: TypePointer Output 27(fvec2)
80(outUV): 79(ptr) Variable Output
83: 6(int) Constant 58
81: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 82 28 16 83 11 18 82 80(outUV) 40
90: TypePointer Function 51(fvec3)
94: 6(int) Constant 60
92: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 93 52 16 94 11 15 20
95: TypeArray 51(fvec3) 9
96: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 52 9
97: TypePointer Input 95
98(inNormal): 97(ptr) Variable Input
99: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 100 96 16 94 11 18 100 98(inNormal) 40
113: 6(int) Constant 61
111: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 112 52 16 113 11 15 20
123: TypePointer Output 51(fvec3)
124(outNormal): 123(ptr) Variable Output
127: 6(int) Constant 62
125: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 126 52 16 127 11 18 126 124(outNormal) 40
134: TypeVector 24(float) 4
135: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 26 20
136: TypePointer Function 134(fvec4)
140: 6(int) Constant 65
138: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 139 135 16 140 11 15 20
141: TypeArray 24(float) 19
142: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 26 19
143(gl_PerVertex): TypeStruct 134(fvec4) 24(float) 141 141
146: 6(int) Constant 1756
144: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 145 135 16 19 146 11 11 12
149: 6(int) Constant 1774
147: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 148 26 16 19 149 11 11 12
152: 6(int) Constant 1817
150: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 151 142 16 19 152 11 11 12
153: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 151 142 16 19 152 11 11 12
154: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 155 19 16 140 11 18 155 11 12 144 147 150 153
156: TypeArray 143(gl_PerVertex) 9
157: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 154 9
158: TypePointer Input 156
159(gl_in): 158(ptr) Variable Input
160: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 161 157 16 140 11 18 161 159(gl_in) 40
162: TypePointer Input 134(fvec4)
175: 6(int) Constant 66
173: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 174 135 16 175 11 15 20
188: 6(int) Constant 67
186: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 187 135 16 188 11 15 20
196: TypeImage 24(float) 2D sampled format:Unknown
199: 6(int) Constant 69
201: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(Unknown)
197: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 198 11 16 199 11 18 200 201 12
202: TypeSampledImage 196
203: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 204 11 16 199 11 18 205 201 12
206: TypePointer UniformConstant 202
207(displacementMap): 206(ptr) Variable UniformConstant
208: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 209 203 16 199 11 18 209 207(displacementMap) 40
212: 24(float) Constant 0
215: TypeMatrix 134(fvec4) 4
217: TypeBool
218: 217(bool) ConstantTrue
216: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 135 20 218
219: TypeArray 134(fvec4) 10
220: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 135 10
221(UBO): TypeStruct 215 215 134(fvec4) 219 24(float) 24(float) 27(fvec2) 24(float)
224: 6(int) Constant 30
225: 6(int) Constant 7
222: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 223 216 16 224 225 11 11 12
226: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 223 216 16 224 225 11 11 12
229: 6(int) Constant 31
227: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 228 135 16 229 225 11 11 12
230: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 231 220 16 9 225 11 11 12
234: 6(int) Constant 36
232: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 233 26 16 234 40 11 11 12
235: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 233 26 16 234 40 11 11 12
238: 6(int) Constant 35
236: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 237 28 16 238 225 11 11 12
239: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 233 26 16 234 40 11 11 12
240: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 241 19 16 199 11 18 241 11 12 222 226 227 230 232 235 236 239
242: TypePointer Uniform 221(UBO)
243(ubo): 242(ptr) Variable Uniform
244: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 245 240 16 199 11 18 245 243(ubo) 40
246: 41(int) Constant 4
247: TypePointer Uniform 24(float)
251: TypePointer Function 24(float)
256(gl_PerVertex): TypeStruct 134(fvec4) 24(float) 141 141
258: 6(int) Constant 165
257: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 145 135 16 19 258 11 11 12
260: 6(int) Constant 183
259: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 148 26 16 19 260 11 11 12
262: 6(int) Constant 226
261: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 151 142 16 19 262 11 11 12
263: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 151 142 16 19 262 11 11 12
265: 6(int) Constant 71
264: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 155 19 16 265 11 18 155 11 12 257 259 261 263
266: TypePointer Output 256(gl_PerVertex)
267: 266(ptr) Variable Output
268: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 17 264 16 265 11 18 17 267 40
269: TypePointer Uniform 215
277: TypePointer Output 134(fvec4)
279(outViewVec): 123(ptr) Variable Output
282: 6(int) Constant 74
280: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 281 52 16 282 11 18 281 279(outViewVec) 40
286(outLightVec): 123(ptr) Variable Output
289: 6(int) Constant 75
287: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 288 52 16 289 11 18 288 286(outLightVec) 40
290: TypePointer Uniform 134(fvec4)
297(outWorldPos): 123(ptr) Variable Output
300: 6(int) Constant 76
298: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 299 52 16 300 11 18 299 297(outWorldPos) 40
303(outEyePos): 123(ptr) Variable Output
306: 6(int) Constant 77
304: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 305 52 16 306 11 18 305 303(outEyePos) 40
13(main): 3 Function None 4
22: Label
30(uv1): 29(ptr) Variable Function
64(uv2): 29(ptr) Variable Function
91(n1): 90(ptr) Variable Function
110(n2): 90(ptr) Variable Function
137(pos1): 136(ptr) Variable Function
172(pos2): 136(ptr) Variable Function
185(pos): 136(ptr) Variable Function
23: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 15 13(main)
46: 45(ptr) AccessChain 37(inUV) 44
47: 27(fvec2) Load 46
49: 45(ptr) AccessChain 37(inUV) 48
50: 27(fvec2) Load 49
58: 57(ptr) AccessChain 54(gl_TessCoord) 11
59: 24(float) Load 58
60: 27(fvec2) CompositeConstruct 59 59
61: 27(fvec2) ExtInst 2(GLSL.std.450) 46(FMix) 47 50 60
Store 30(uv1) 61
62: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 31 61 63
69: 45(ptr) AccessChain 37(inUV) 68
70: 27(fvec2) Load 69
72: 45(ptr) AccessChain 37(inUV) 71
73: 27(fvec2) Load 72
74: 57(ptr) AccessChain 54(gl_TessCoord) 11
75: 24(float) Load 74
76: 27(fvec2) CompositeConstruct 75 75
77: 27(fvec2) ExtInst 2(GLSL.std.450) 46(FMix) 70 73 76
Store 64(uv2) 77
78: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 65 77 63
84: 27(fvec2) Load 30(uv1)
85: 27(fvec2) Load 64(uv2)
86: 57(ptr) AccessChain 54(gl_TessCoord) 19
87: 24(float) Load 86
88: 27(fvec2) CompositeConstruct 87 87
89: 27(fvec2) ExtInst 2(GLSL.std.450) 46(FMix) 84 85 88
Store 80(outUV) 89
101: 53(ptr) AccessChain 98(inNormal) 44
102: 51(fvec3) Load 101
103: 53(ptr) AccessChain 98(inNormal) 48
104: 51(fvec3) Load 103
105: 57(ptr) AccessChain 54(gl_TessCoord) 11
106: 24(float) Load 105
107: 51(fvec3) CompositeConstruct 106 106 106
108: 51(fvec3) ExtInst 2(GLSL.std.450) 46(FMix) 102 104 107
Store 91(n1) 108
109: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 92 108 63
114: 53(ptr) AccessChain 98(inNormal) 68
115: 51(fvec3) Load 114
116: 53(ptr) AccessChain 98(inNormal) 71
117: 51(fvec3) Load 116
118: 57(ptr) AccessChain 54(gl_TessCoord) 11
119: 24(float) Load 118
120: 51(fvec3) CompositeConstruct 119 119 119
121: 51(fvec3) ExtInst 2(GLSL.std.450) 46(FMix) 115 117 120
Store 110(n2) 121
122: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 111 121 63
128: 51(fvec3) Load 91(n1)
129: 51(fvec3) Load 110(n2)
130: 57(ptr) AccessChain 54(gl_TessCoord) 19
131: 24(float) Load 130
132: 51(fvec3) CompositeConstruct 131 131 131
133: 51(fvec3) ExtInst 2(GLSL.std.450) 46(FMix) 128 129 132
Store 124(outNormal) 133
163: 162(ptr) AccessChain 159(gl_in) 44 44
164: 134(fvec4) Load 163
165: 162(ptr) AccessChain 159(gl_in) 48 44
166: 134(fvec4) Load 165
167: 57(ptr) AccessChain 54(gl_TessCoord) 11
168: 24(float) Load 167
169: 134(fvec4) CompositeConstruct 168 168 168 168
170: 134(fvec4) ExtInst 2(GLSL.std.450) 46(FMix) 164 166 169
Store 137(pos1) 170
171: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 138 170 63
176: 162(ptr) AccessChain 159(gl_in) 68 44
177: 134(fvec4) Load 176
178: 162(ptr) AccessChain 159(gl_in) 71 44
179: 134(fvec4) Load 178
180: 57(ptr) AccessChain 54(gl_TessCoord) 11
181: 24(float) Load 180
182: 134(fvec4) CompositeConstruct 181 181 181 181
183: 134(fvec4) ExtInst 2(GLSL.std.450) 46(FMix) 177 179 182
Store 172(pos2) 183
184: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 173 183 63
189: 134(fvec4) Load 137(pos1)
190: 134(fvec4) Load 172(pos2)
191: 57(ptr) AccessChain 54(gl_TessCoord) 19
192: 24(float) Load 191
193: 134(fvec4) CompositeConstruct 192 192 192 192
194: 134(fvec4) ExtInst 2(GLSL.std.450) 46(FMix) 189 190 193
Store 185(pos) 194
195: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 186 194 63
210: 202 Load 207(displacementMap)
211: 27(fvec2) Load 80(outUV)
213: 134(fvec4) ImageSampleExplicitLod 210 211 Lod 212
214: 24(float) CompositeExtract 213 0
248: 247(ptr) AccessChain 243(ubo) 246
249: 24(float) Load 248
250: 24(float) FMul 214 249
252: 251(ptr) AccessChain 185(pos) 19
253: 24(float) Load 252
254: 24(float) FSub 253 250
255: 251(ptr) AccessChain 185(pos) 19
Store 255 254
270: 269(ptr) AccessChain 243(ubo) 44
271: 215 Load 270
272: 269(ptr) AccessChain 243(ubo) 48
273: 215 Load 272
274: 215 MatrixTimesMatrix 271 273
275: 134(fvec4) Load 185(pos)
276: 134(fvec4) MatrixTimesVector 274 275
278: 277(ptr) AccessChain 267 44
Store 278 276
283: 134(fvec4) Load 185(pos)
284: 51(fvec3) VectorShuffle 283 283 0 1 2
285: 51(fvec3) FNegate 284
Store 279(outViewVec) 285
291: 290(ptr) AccessChain 243(ubo) 71
292: 134(fvec4) Load 291
293: 51(fvec3) VectorShuffle 292 292 0 1 2
294: 51(fvec3) Load 279(outViewVec)
295: 51(fvec3) FAdd 293 294
296: 51(fvec3) ExtInst 2(GLSL.std.450) 69(Normalize) 295
Store 286(outLightVec) 296
301: 134(fvec4) Load 185(pos)
302: 51(fvec3) VectorShuffle 301 301 0 1 2
Store 297(outWorldPos) 302
307: 269(ptr) AccessChain 243(ubo) 48
308: 215 Load 307
309: 134(fvec4) Load 185(pos)
310: 134(fvec4) MatrixTimesVector 308 309
311: 24(float) CompositeExtract 310 0
312: 24(float) CompositeExtract 310 1
313: 24(float) CompositeExtract 310 2
314: 51(fvec3) CompositeConstruct 311 312 313
Store 303(outEyePos) 314
Return
FunctionEnd

View File

@ -0,0 +1,487 @@
spv.debuginfo.glsl.vert
Validation failed
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 377
Capability Shader
Extension "SPV_KHR_non_semantic_info"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
2: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 13 "main" 30 36 40 47 55 68 248 265 270 295 309 327 362 370
8: String "uint"
14: String "main"
17: String ""
25: String "float"
32: String "outColor"
38: String "inColor"
42: String "outUV"
49: String "inUV"
52: String "int"
57: String "instanceTexIndex"
66: String "s"
70: String "instanceRot"
82: String "modelview"
87: String "lightPos"
90: String "globSpeed"
94: String "UBO"
98: String "ubo"
109: String "c"
123: String "mx"
158: String "my"
187: String "mz"
202: String "rotMat"
228: String "gRotMat"
246: String "locPos"
250: String "inPos"
261: String "pos"
267: String "instanceScale"
272: String "instancePos"
284: String "gl_Position"
287: String "gl_PointSize"
289: String "gl_CullDistance"
292: String "gl_PerVertex"
311: String "outNormal"
329: String "inNormal"
345: String "lPos"
364: String "outLightVec"
372: String "outViewVec"
Name 13 "main"
Name 30 "outColor"
Name 36 "inColor"
Name 40 "outUV"
Name 47 "inUV"
Name 55 "instanceTexIndex"
Name 64 "s"
Name 68 "instanceRot"
Name 80 "UBO"
MemberName 80(UBO) 0 "projection"
MemberName 80(UBO) 1 "modelview"
MemberName 80(UBO) 2 "lightPos"
MemberName 80(UBO) 3 "locSpeed"
MemberName 80(UBO) 4 "globSpeed"
Name 96 "ubo"
Name 107 "c"
Name 121 "mx"
Name 156 "my"
Name 185 "mz"
Name 200 "rotMat"
Name 226 "gRotMat"
Name 244 "locPos"
Name 248 "inPos"
Name 259 "pos"
Name 265 "instanceScale"
Name 270 "instancePos"
Name 282 "gl_PerVertex"
MemberName 282(gl_PerVertex) 0 "gl_Position"
MemberName 282(gl_PerVertex) 1 "gl_PointSize"
MemberName 282(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 282(gl_PerVertex) 3 "gl_CullDistance"
Name 295 ""
Name 309 "outNormal"
Name 327 "inNormal"
Name 343 "lPos"
Name 362 "outLightVec"
Name 370 "outViewVec"
Decorate 30(outColor) Location 1
Decorate 36(inColor) Location 3
Decorate 40(outUV) Location 2
Decorate 47(inUV) Location 2
Decorate 55(instanceTexIndex) Location 7
Decorate 68(instanceRot) Location 5
MemberDecorate 80(UBO) 0 ColMajor
MemberDecorate 80(UBO) 0 Offset 0
MemberDecorate 80(UBO) 0 MatrixStride 16
MemberDecorate 80(UBO) 1 ColMajor
MemberDecorate 80(UBO) 1 Offset 64
MemberDecorate 80(UBO) 1 MatrixStride 16
MemberDecorate 80(UBO) 2 Offset 128
MemberDecorate 80(UBO) 3 Offset 144
MemberDecorate 80(UBO) 4 Offset 148
Decorate 80(UBO) Block
Decorate 96(ubo) DescriptorSet 0
Decorate 96(ubo) Binding 0
Decorate 248(inPos) Location 0
Decorate 265(instanceScale) Location 6
Decorate 270(instancePos) Location 4
MemberDecorate 282(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 282(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 282(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 282(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 282(gl_PerVertex) Block
Decorate 309(outNormal) Location 0
Decorate 327(inNormal) Location 1
Decorate 362(outLightVec) Location 4
Decorate 370(outViewVec) Location 3
3: TypeVoid
4: TypeFunction 3
6: TypeInt 32 0
9: 6(int) Constant 32
10: 6(int) Constant 6
11: 6(int) Constant 0
7: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 8 9 10 11
12: 6(int) Constant 3
5: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 12 3
16: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(Modf) 0 17
19: 6(int) Constant 1
20: 6(int) Constant 4
21: 6(int) Constant 2
18: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(Round) 19 20 16 21
15: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 14 5 16 11 11 18 14 12 11
24: TypeFloat 32
26: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 25 9 12 11
27: TypeVector 24(float) 3
28: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 26 12
29: TypePointer Output 27(fvec3)
30(outColor): 29(ptr) Variable Output
33: 6(int) Constant 56
34: 6(int) Constant 8
31: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 32 28 16 33 11 18 32 30(outColor) 34
35: TypePointer Input 27(fvec3)
36(inColor): 35(ptr) Variable Input
37: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 38 28 16 33 11 18 38 36(inColor) 34
40(outUV): 29(ptr) Variable Output
43: 6(int) Constant 57
41: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 42 28 16 43 11 18 42 40(outUV) 34
44: TypeVector 24(float) 2
45: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 26 21
46: TypePointer Input 44(fvec2)
47(inUV): 46(ptr) Variable Input
48: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 49 45 16 43 11 18 49 47(inUV) 34
51: TypeInt 32 1
53: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 52 9 20 11
54: TypePointer Input 51(int)
55(instanceTexIndex): 54(ptr) Variable Input
56: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 57 53 16 43 11 18 57 55(instanceTexIndex) 34
63: TypePointer Function 24(float)
67: 6(int) Constant 62
65: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 66 26 16 67 11 15 20
68(instanceRot): 35(ptr) Variable Input
69: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 70 28 16 67 11 18 70 68(instanceRot) 34
71: TypePointer Input 24(float)
74: TypeVector 24(float) 4
75: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 26 20
76: TypeMatrix 74(fvec4) 4
78: TypeBool
79: 78(bool) ConstantTrue
77: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 75 20 79
80(UBO): TypeStruct 76 76 74(fvec4) 24(float) 24(float)
83: 6(int) Constant 42
84: 6(int) Constant 7
81: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 82 77 16 83 84 11 11 12
85: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 82 77 16 83 84 11 11 12
88: 6(int) Constant 43
86: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 87 75 16 88 84 11 11 12
91: 6(int) Constant 45
89: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 90 26 16 91 34 11 11 12
92: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 90 26 16 91 34 11 11 12
93: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 94 19 16 67 11 18 94 11 12 81 85 86 89 92
95: TypePointer Uniform 80(UBO)
96(ubo): 95(ptr) Variable Uniform
97: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 98 93 16 67 11 18 98 96(ubo) 34
99: 51(int) Constant 3
100: TypePointer Uniform 24(float)
106: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(Sqrt)
110: 6(int) Constant 63
108: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 109 26 16 110 11 15 20
118: TypeMatrix 27(fvec3) 3
119: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 28 12 79
120: TypePointer Function 118
124: 6(int) Constant 65
122: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 123 119 16 124 11 15 20
125: 51(int) Constant 0
128: 24(float) Constant 0
130: TypePointer Function 27(fvec3)
132: 51(int) Constant 1
138: 51(int) Constant 2
139: 24(float) Constant 1065353216
140: 27(fvec3) ConstantComposite 128 128 139
159: 6(int) Constant 73
157: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 158 119 16 159 11 15 20
164: 27(fvec3) ConstantComposite 128 139 128
188: 6(int) Constant 81
186: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 187 119 16 188 11 15 20
189: 27(fvec3) ConstantComposite 139 128 128
203: 6(int) Constant 85
201: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 202 119 16 203 11 15 20
212: 51(int) Constant 4
225: TypePointer Function 76
229: 6(int) Constant 90
227: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 228 77 16 229 11 15 20
233: TypePointer Function 74(fvec4)
235: 74(fvec4) ConstantComposite 128 139 128 128
242: 74(fvec4) ConstantComposite 128 128 128 139
247: 6(int) Constant 95
245: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 246 75 16 247 11 15 20
248(inPos): 35(ptr) Variable Input
249: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 250 28 16 247 11 18 250 248(inPos) 34
262: 6(int) Constant 96
260: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 261 75 16 262 11 15 20
265(instanceScale): 71(ptr) Variable Input
266: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 267 26 16 262 11 18 267 265(instanceScale) 34
270(instancePos): 35(ptr) Variable Input
271: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 272 28 16 262 11 18 272 270(instancePos) 34
280: TypeArray 24(float) 19
281: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 26 19
282(gl_PerVertex): TypeStruct 74(fvec4) 24(float) 280 280
285: 6(int) Constant 24
283: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 284 75 16 19 285 11 11 12
286: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 287 26 16 19 83 11 11 12
288: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 289 281 16 19 203 11 11 12
290: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 289 281 16 19 203 11 11 12
293: 6(int) Constant 98
291: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 292 19 16 293 11 18 292 11 12 283 286 288 290
294: TypePointer Output 282(gl_PerVertex)
295: 294(ptr) Variable Output
296: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 17 291 16 293 11 18 17 295 34
297: TypePointer Uniform 76
307: TypePointer Output 74(fvec4)
309(outNormal): 29(ptr) Variable Output
312: 6(int) Constant 99
310: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 311 28 16 312 11 18 311 309(outNormal) 34
327(inNormal): 35(ptr) Variable Input
328: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 329 28 16 312 11 18 329 327(inNormal) 34
346: 6(int) Constant 102
344: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 345 28 16 346 11 15 20
356: TypePointer Uniform 74(fvec4)
362(outLightVec): 29(ptr) Variable Output
365: 6(int) Constant 103
363: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 364 28 16 365 11 18 364 362(outLightVec) 34
370(outViewVec): 29(ptr) Variable Output
373: 6(int) Constant 104
371: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 372 28 16 373 11 18 372 370(outViewVec) 34
13(main): 3 Function None 4
22: Label
64(s): 63(ptr) Variable Function
107(c): 63(ptr) Variable Function
121(mx): 120(ptr) Variable Function
156(my): 120(ptr) Variable Function
185(mz): 120(ptr) Variable Function
200(rotMat): 120(ptr) Variable Function
226(gRotMat): 225(ptr) Variable Function
244(locPos): 233(ptr) Variable Function
259(pos): 233(ptr) Variable Function
343(lPos): 130(ptr) Variable Function
23: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 15 13(main)
39: 27(fvec3) Load 36(inColor)
Store 30(outColor) 39
50: 44(fvec2) Load 47(inUV)
58: 51(int) Load 55(instanceTexIndex)
59: 24(float) ConvertSToF 58
60: 24(float) CompositeExtract 50 0
61: 24(float) CompositeExtract 50 1
62: 27(fvec3) CompositeConstruct 60 61 59
Store 40(outUV) 62
72: 71(ptr) AccessChain 68(instanceRot) 11
73: 24(float) Load 72
101: 100(ptr) AccessChain 96(ubo) 99
102: 24(float) Load 101
103: 24(float) FAdd 73 102
104: 24(float) ExtInst 2(GLSL.std.450) 13(Sin) 103
Store 64(s) 104
105: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 65 104 106
111: 71(ptr) AccessChain 68(instanceRot) 11
112: 24(float) Load 111
113: 100(ptr) AccessChain 96(ubo) 99
114: 24(float) Load 113
115: 24(float) FAdd 112 114
116: 24(float) ExtInst 2(GLSL.std.450) 14(Cos) 115
Store 107(c) 116
117: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 108 116 106
126: 24(float) Load 107(c)
127: 24(float) Load 64(s)
129: 27(fvec3) CompositeConstruct 126 127 128
131: 130(ptr) AccessChain 121(mx) 125
Store 131 129
133: 24(float) Load 64(s)
134: 24(float) FNegate 133
135: 24(float) Load 107(c)
136: 27(fvec3) CompositeConstruct 134 135 128
137: 130(ptr) AccessChain 121(mx) 132
Store 137 136
141: 130(ptr) AccessChain 121(mx) 138
Store 141 140
142: 71(ptr) AccessChain 68(instanceRot) 19
143: 24(float) Load 142
144: 100(ptr) AccessChain 96(ubo) 99
145: 24(float) Load 144
146: 24(float) FAdd 143 145
147: 24(float) ExtInst 2(GLSL.std.450) 13(Sin) 146
Store 64(s) 147
148: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 65 147 106
149: 71(ptr) AccessChain 68(instanceRot) 19
150: 24(float) Load 149
151: 100(ptr) AccessChain 96(ubo) 99
152: 24(float) Load 151
153: 24(float) FAdd 150 152
154: 24(float) ExtInst 2(GLSL.std.450) 14(Cos) 153
Store 107(c) 154
155: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 108 154 106
160: 24(float) Load 107(c)
161: 24(float) Load 64(s)
162: 27(fvec3) CompositeConstruct 160 128 161
163: 130(ptr) AccessChain 156(my) 125
Store 163 162
165: 130(ptr) AccessChain 156(my) 132
Store 165 164
166: 24(float) Load 64(s)
167: 24(float) FNegate 166
168: 24(float) Load 107(c)
169: 27(fvec3) CompositeConstruct 167 128 168
170: 130(ptr) AccessChain 156(my) 138
Store 170 169
171: 71(ptr) AccessChain 68(instanceRot) 21
172: 24(float) Load 171
173: 100(ptr) AccessChain 96(ubo) 99
174: 24(float) Load 173
175: 24(float) FAdd 172 174
176: 24(float) ExtInst 2(GLSL.std.450) 13(Sin) 175
Store 64(s) 176
177: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 65 176 106
178: 71(ptr) AccessChain 68(instanceRot) 21
179: 24(float) Load 178
180: 100(ptr) AccessChain 96(ubo) 99
181: 24(float) Load 180
182: 24(float) FAdd 179 181
183: 24(float) ExtInst 2(GLSL.std.450) 14(Cos) 182
Store 107(c) 183
184: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 108 183 106
190: 130(ptr) AccessChain 185(mz) 125
Store 190 189
191: 24(float) Load 107(c)
192: 24(float) Load 64(s)
193: 27(fvec3) CompositeConstruct 128 191 192
194: 130(ptr) AccessChain 185(mz) 132
Store 194 193
195: 24(float) Load 64(s)
196: 24(float) FNegate 195
197: 24(float) Load 107(c)
198: 27(fvec3) CompositeConstruct 128 196 197
199: 130(ptr) AccessChain 185(mz) 138
Store 199 198
204: 118 Load 185(mz)
205: 118 Load 156(my)
206: 118 MatrixTimesMatrix 204 205
207: 118 Load 121(mx)
208: 118 MatrixTimesMatrix 206 207
Store 200(rotMat) 208
209: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 201 208 106
210: 71(ptr) AccessChain 68(instanceRot) 19
211: 24(float) Load 210
213: 100(ptr) AccessChain 96(ubo) 212
214: 24(float) Load 213
215: 24(float) FAdd 211 214
216: 24(float) ExtInst 2(GLSL.std.450) 13(Sin) 215
Store 64(s) 216
217: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 65 216 106
218: 71(ptr) AccessChain 68(instanceRot) 19
219: 24(float) Load 218
220: 100(ptr) AccessChain 96(ubo) 212
221: 24(float) Load 220
222: 24(float) FAdd 219 221
223: 24(float) ExtInst 2(GLSL.std.450) 14(Cos) 222
Store 107(c) 223
224: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 108 223 106
230: 24(float) Load 107(c)
231: 24(float) Load 64(s)
232: 74(fvec4) CompositeConstruct 230 128 231 128
234: 233(ptr) AccessChain 226(gRotMat) 125
Store 234 232
236: 233(ptr) AccessChain 226(gRotMat) 132
Store 236 235
237: 24(float) Load 64(s)
238: 24(float) FNegate 237
239: 24(float) Load 107(c)
240: 74(fvec4) CompositeConstruct 238 128 239 128
241: 233(ptr) AccessChain 226(gRotMat) 138
Store 241 240
243: 233(ptr) AccessChain 226(gRotMat) 99
Store 243 242
251: 27(fvec3) Load 248(inPos)
252: 118 Load 200(rotMat)
253: 27(fvec3) VectorTimesMatrix 251 252
254: 24(float) CompositeExtract 253 0
255: 24(float) CompositeExtract 253 1
256: 24(float) CompositeExtract 253 2
257: 74(fvec4) CompositeConstruct 254 255 256 139
Store 244(locPos) 257
258: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 245 257 106
263: 74(fvec4) Load 244(locPos)
264: 27(fvec3) VectorShuffle 263 263 0 1 2
268: 24(float) Load 265(instanceScale)
269: 27(fvec3) VectorTimesScalar 264 268
273: 27(fvec3) Load 270(instancePos)
274: 27(fvec3) FAdd 269 273
275: 24(float) CompositeExtract 274 0
276: 24(float) CompositeExtract 274 1
277: 24(float) CompositeExtract 274 2
278: 74(fvec4) CompositeConstruct 275 276 277 139
Store 259(pos) 278
279: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 260 278 106
298: 297(ptr) AccessChain 96(ubo) 125
299: 76 Load 298
300: 297(ptr) AccessChain 96(ubo) 132
301: 76 Load 300
302: 76 MatrixTimesMatrix 299 301
303: 76 Load 226(gRotMat)
304: 76 MatrixTimesMatrix 302 303
305: 74(fvec4) Load 259(pos)
306: 74(fvec4) MatrixTimesVector 304 305
308: 307(ptr) AccessChain 295 125
Store 308 306
313: 297(ptr) AccessChain 96(ubo) 132
314: 76 Load 313
315: 76 Load 226(gRotMat)
316: 76 MatrixTimesMatrix 314 315
317: 74(fvec4) CompositeExtract 316 0
318: 27(fvec3) VectorShuffle 317 317 0 1 2
319: 74(fvec4) CompositeExtract 316 1
320: 27(fvec3) VectorShuffle 319 319 0 1 2
321: 74(fvec4) CompositeExtract 316 2
322: 27(fvec3) VectorShuffle 321 321 0 1 2
323: 118 CompositeConstruct 318 320 322
324: 118 Load 200(rotMat)
325: 118 ExtInst 2(GLSL.std.450) 34(MatrixInverse) 324
326: 118 MatrixTimesMatrix 323 325
330: 27(fvec3) Load 327(inNormal)
331: 27(fvec3) MatrixTimesVector 326 330
Store 309(outNormal) 331
332: 297(ptr) AccessChain 96(ubo) 132
333: 76 Load 332
334: 27(fvec3) Load 248(inPos)
335: 27(fvec3) Load 270(instancePos)
336: 27(fvec3) FAdd 334 335
337: 24(float) CompositeExtract 336 0
338: 24(float) CompositeExtract 336 1
339: 24(float) CompositeExtract 336 2
340: 74(fvec4) CompositeConstruct 337 338 339 139
341: 74(fvec4) MatrixTimesVector 333 340
Store 259(pos) 341
342: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 260 341 106
347: 297(ptr) AccessChain 96(ubo) 132
348: 76 Load 347
349: 74(fvec4) CompositeExtract 348 0
350: 27(fvec3) VectorShuffle 349 349 0 1 2
351: 74(fvec4) CompositeExtract 348 1
352: 27(fvec3) VectorShuffle 351 351 0 1 2
353: 74(fvec4) CompositeExtract 348 2
354: 27(fvec3) VectorShuffle 353 353 0 1 2
355: 118 CompositeConstruct 350 352 354
357: 356(ptr) AccessChain 96(ubo) 138
358: 74(fvec4) Load 357
359: 27(fvec3) VectorShuffle 358 358 0 1 2
360: 27(fvec3) MatrixTimesVector 355 359
Store 343(lPos) 360
361: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 344 360 106
366: 27(fvec3) Load 343(lPos)
367: 74(fvec4) Load 259(pos)
368: 27(fvec3) VectorShuffle 367 367 0 1 2
369: 27(fvec3) FSub 366 368
Store 362(outLightVec) 369
374: 74(fvec4) Load 259(pos)
375: 27(fvec3) VectorShuffle 374 374 0 1 2
376: 27(fvec3) FNegate 375
Store 370(outViewVec) 376
Return
FunctionEnd

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,459 @@
spv.debuginfo.hlsl.geom
Validation failed
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 323
Capability Geometry
Capability MultiViewport
Extension "SPV_KHR_non_semantic_info"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
2: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Geometry 5 "main" 228 235 240 246 251 256 261 272 279 284 308 311
ExecutionMode 5 Triangles
ExecutionMode 5 Invocations 2
ExecutionMode 5 OutputTriangleStrip
ExecutionMode 5 OutputVertices 3
9: String "float"
12: String "uint"
24: String "Pos"
26: String ""
30: String "Color"
35: String "VSOutput"
46: String "PrimitiveID"
51: String "LightVec"
57: String "GSOutput"
67: String "@main"
73: String "input"
77: String "outStream"
81: String "InvocationID"
87: String "int"
92: String "i"
104: String "bool"
109: String "output"
130: String "projection"
134: String "modelview"
138: String "lightPos"
142: String "UBO"
146: String "ubo"
177: String "pos"
185: String "worldPos"
195: String "lPos"
230: String "outStream.Pos"
237: String "outStream.ViewportIndex"
242: String "outStream.PrimitiveID"
248: String "outStream.Normal"
253: String "outStream.Color"
258: String "outStream.ViewVec"
263: String "outStream.LightVec"
Name 5 "main"
Name 22 "VSOutput"
MemberName 22(VSOutput) 0 "Pos"
MemberName 22(VSOutput) 1 "Normal"
MemberName 22(VSOutput) 2 "Color"
Name 42 "GSOutput"
MemberName 42(GSOutput) 0 "Pos"
MemberName 42(GSOutput) 1 "ViewportIndex"
MemberName 42(GSOutput) 2 "PrimitiveID"
MemberName 42(GSOutput) 3 "Normal"
MemberName 42(GSOutput) 4 "Color"
MemberName 42(GSOutput) 5 "ViewVec"
MemberName 42(GSOutput) 6 "LightVec"
Name 66 "@main(struct-VSOutput-vf4-vf3-vf31[3];struct-GSOutput-vf4-u1-u1-vf3-vf3-vf3-vf31;u1;u1;"
Name 62 "input"
Name 63 "outStream"
Name 64 "InvocationID"
Name 65 "PrimitiveID"
Name 90 "i"
Name 107 "output"
Name 128 "UBO"
MemberName 128(UBO) 0 "projection"
MemberName 128(UBO) 1 "modelview"
MemberName 128(UBO) 2 "lightPos"
Name 144 "ubo"
MemberName 144(ubo) 0 "ubo"
Name 150 ""
Name 175 "pos"
Name 183 "worldPos"
Name 193 "lPos"
Name 228 "outStream.Pos"
Name 235 "outStream.ViewportIndex"
Name 240 "outStream.PrimitiveID"
Name 246 "outStream.Normal"
Name 251 "outStream.Color"
Name 256 "outStream.ViewVec"
Name 261 "outStream.LightVec"
Name 269 "input"
Name 272 "input.Pos"
Name 279 "input.Normal"
Name 284 "input.Color"
Name 306 "InvocationID"
Name 308 "InvocationID"
Name 310 "PrimitiveID"
Name 311 "PrimitiveID"
Name 313 "outStream"
Name 314 "param"
Name 316 "param"
Name 317 "param"
Name 319 "param"
Decorate 124 ArrayStride 64
Decorate 126 ArrayStride 64
MemberDecorate 128(UBO) 0 RowMajor
MemberDecorate 128(UBO) 0 Offset 0
MemberDecorate 128(UBO) 0 MatrixStride 16
MemberDecorate 128(UBO) 1 RowMajor
MemberDecorate 128(UBO) 1 Offset 128
MemberDecorate 128(UBO) 1 MatrixStride 16
MemberDecorate 128(UBO) 2 Offset 256
MemberDecorate 144(ubo) 0 Offset 0
Decorate 144(ubo) Block
Decorate 150 DescriptorSet 0
Decorate 150 Binding 0
Decorate 228(outStream.Pos) BuiltIn Position
Decorate 235(outStream.ViewportIndex) BuiltIn ViewportIndex
Decorate 240(outStream.PrimitiveID) BuiltIn PrimitiveId
Decorate 246(outStream.Normal) Location 0
Decorate 251(outStream.Color) Location 1
Decorate 256(outStream.ViewVec) Location 2
Decorate 261(outStream.LightVec) Location 3
Decorate 272(input.Pos) BuiltIn Position
Decorate 279(input.Normal) Location 0
Decorate 284(input.Color) Location 1
Decorate 308(InvocationID) BuiltIn InvocationId
Decorate 311(PrimitiveID) BuiltIn PrimitiveId
3: TypeVoid
4: TypeFunction 3
7: TypeFloat 32
10: TypeInt 32 0
13: 10(int) Constant 32
14: 10(int) Constant 6
15: 10(int) Constant 0
11: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 12 13 14 15
16: 10(int) Constant 3
8: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 9 13 16 15
17: TypeVector 7(float) 4
18: 10(int) Constant 4
19: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 8 18
20: TypeVector 7(float) 3
21: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 8 16
22(VSOutput): TypeStruct 17(fvec4) 20(fvec3) 20(fvec3)
25: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(Modf) 0 26
27: 10(int) Constant 37
28: 10(int) Constant 13
23: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 24 19 25 27 28 15 15 16
31: 10(int) Constant 39
32: 10(int) Constant 34
29: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 30 21 25 31 32 15 15 16
33: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 30 21 25 31 32 15 15 16
36: 10(int) Constant 1
38: 10(int) Constant 5
37: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(Round) 36 18 25 38
34: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 35 36 25 15 15 37 35 15 16 23 29 33
39: TypeArray 22(VSOutput) 16
40: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 34 16
41: TypePointer Function 39
42(GSOutput): TypeStruct 17(fvec4) 10(int) 10(int) 20(fvec3) 20(fvec3) 20(fvec3) 20(fvec3)
44: 10(int) Constant 44
43: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 24 19 25 44 28 15 15 16
47: 10(int) Constant 46
48: 10(int) Constant 19
45: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 46 11 25 47 48 15 15 16
49: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 46 11 25 47 48 15 15 16
52: 10(int) Constant 50
50: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 51 21 25 52 27 15 15 16
53: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 51 21 25 52 27 15 15 16
54: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 51 21 25 52 27 15 15 16
55: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 51 21 25 52 27 15 15 16
56: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 57 36 25 15 15 37 57 15 16 43 45 49 50 53 54 55
58: TypePointer Function 42(GSOutput)
59: TypePointer Function 10(int)
60: TypeFunction 3 41(ptr) 58(ptr) 59(ptr) 59(ptr)
61: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 16 3 40 56 11 11
68: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 67 61 25 15 15 37 67 16 15
72: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 73 40 25 15 15 68 18 36
75: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(Sqrt)
78: 10(int) Constant 2
76: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 77 56 25 15 15 68 18 78
80: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 81 11 25 15 15 68 18 16
83: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 46 11 25 15 15 68 18 18
86: TypeInt 32 1
88: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 87 13 18 15
89: TypePointer Function 86(int)
93: 10(int) Constant 57
91: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 92 88 25 93 15 68 18
94: 86(int) Constant 0
102: 86(int) Constant 3
103: TypeBool
105: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 104 13 78 15
110: 10(int) Constant 59
108: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 109 56 25 110 15 68 18
111: 7(float) Constant 0
112: 17(fvec4) ConstantComposite 111 111 111 111
113: 20(fvec3) ConstantComposite 111 111 111
114:42(GSOutput) ConstantComposite 112 15 15 113 113 113 113
117: 86(int) Constant 1
118: TypePointer Function 20(fvec3)
121: TypeMatrix 17(fvec4) 4
123: 103(bool) ConstantTrue
122: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 19 18 123
124: TypeArray 121 78
125: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 122 78
126: TypeArray 121 78
127: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 122 78
128(UBO): TypeStruct 124 126 17(fvec4)
131: 10(int) Constant 28
132: 10(int) Constant 21
129: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 130 125 25 131 132 15 15 16
135: 10(int) Constant 29
136: 10(int) Constant 20
133: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 134 127 25 135 136 15 15 16
139: 10(int) Constant 30
140: 10(int) Constant 17
137: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 138 19 25 139 140 15 15 16
143: 10(int) Constant 60
141: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 142 36 25 143 15 37 142 15 16 129 133 137
144(ubo): TypeStruct 128(UBO)
147: 10(int) Constant 33
145: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 146 141 25 147 27 15 15 16
148: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 146 36 25 143 15 37 146 15 16 145
149: TypePointer Uniform 144(ubo)
150: 149(ptr) Variable Uniform
152: 10(int) Constant 8
151: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 26 148 25 143 15 37 26 150 152
154: TypePointer Uniform 121
157: TypeMatrix 20(fvec3) 3
158: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 21 16 123
168: 86(int) Constant 4
170: 86(int) Constant 2
174: TypePointer Function 17(fvec4)
178: 10(int) Constant 63
176: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 177 19 25 178 15 68 18
186: 10(int) Constant 64
184: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 185 19 25 186 15 68 18
196: 10(int) Constant 66
194: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 195 21 25 196 15 68 18
197: TypePointer Uniform 17(fvec4)
206: 86(int) Constant 6
212: 86(int) Constant 5
227: TypePointer Output 17(fvec4)
228(outStream.Pos): 227(ptr) Variable Output
231: 10(int) Constant 75
229: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 230 19 25 231 15 37 230 228(outStream.Pos) 152
234: TypePointer Output 10(int)
235(outStream.ViewportIndex): 234(ptr) Variable Output
236: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 237 11 25 231 15 37 237 235(outStream.ViewportIndex) 152
240(outStream.PrimitiveID): 234(ptr) Variable Output
241: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 242 11 25 231 15 37 242 240(outStream.PrimitiveID) 152
245: TypePointer Output 20(fvec3)
246(outStream.Normal): 245(ptr) Variable Output
247: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 248 21 25 231 15 37 248 246(outStream.Normal) 152
251(outStream.Color): 245(ptr) Variable Output
252: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 253 21 25 231 15 37 253 251(outStream.Color) 152
256(outStream.ViewVec): 245(ptr) Variable Output
257: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 258 21 25 231 15 37 258 256(outStream.ViewVec) 152
261(outStream.LightVec): 245(ptr) Variable Output
262: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 263 21 25 231 15 37 263 261(outStream.LightVec) 152
270: TypeArray 17(fvec4) 16
271: TypePointer Input 270
272(input.Pos): 271(ptr) Variable Input
273: TypePointer Input 17(fvec4)
277: TypeArray 20(fvec3) 16
278: TypePointer Input 277
279(input.Normal): 278(ptr) Variable Input
280: TypePointer Input 20(fvec3)
284(input.Color): 278(ptr) Variable Input
307: TypePointer Input 10(int)
308(InvocationID): 307(ptr) Variable Input
311(PrimitiveID): 307(ptr) Variable Input
5(main): 3 Function None 4
6: Label
269(input): 41(ptr) Variable Function
306(InvocationID): 59(ptr) Variable Function
310(PrimitiveID): 59(ptr) Variable Function
313(outStream): 58(ptr) Variable Function
314(param): 41(ptr) Variable Function
316(param): 58(ptr) Variable Function
317(param): 59(ptr) Variable Function
319(param): 59(ptr) Variable Function
274: 273(ptr) AccessChain 272(input.Pos) 94
275: 17(fvec4) Load 274
276: 174(ptr) AccessChain 269(input) 94 94
Store 276 275
281: 280(ptr) AccessChain 279(input.Normal) 94
282: 20(fvec3) Load 281
283: 118(ptr) AccessChain 269(input) 94 117
Store 283 282
285: 280(ptr) AccessChain 284(input.Color) 94
286: 20(fvec3) Load 285
287: 118(ptr) AccessChain 269(input) 94 170
Store 287 286
288: 273(ptr) AccessChain 272(input.Pos) 117
289: 17(fvec4) Load 288
290: 174(ptr) AccessChain 269(input) 117 94
Store 290 289
291: 280(ptr) AccessChain 279(input.Normal) 117
292: 20(fvec3) Load 291
293: 118(ptr) AccessChain 269(input) 117 117
Store 293 292
294: 280(ptr) AccessChain 284(input.Color) 117
295: 20(fvec3) Load 294
296: 118(ptr) AccessChain 269(input) 117 170
Store 296 295
297: 273(ptr) AccessChain 272(input.Pos) 170
298: 17(fvec4) Load 297
299: 174(ptr) AccessChain 269(input) 170 94
Store 299 298
300: 280(ptr) AccessChain 279(input.Normal) 170
301: 20(fvec3) Load 300
302: 118(ptr) AccessChain 269(input) 170 117
Store 302 301
303: 280(ptr) AccessChain 284(input.Color) 170
304: 20(fvec3) Load 303
305: 118(ptr) AccessChain 269(input) 170 170
Store 305 304
309: 10(int) Load 308(InvocationID)
Store 306(InvocationID) 309
312: 10(int) Load 311(PrimitiveID)
Store 310(PrimitiveID) 312
315: 39 Load 269(input)
Store 314(param) 315
318: 10(int) Load 306(InvocationID)
Store 317(param) 318
320: 10(int) Load 310(PrimitiveID)
Store 319(param) 320
321: 3 FunctionCall 66(@main(struct-VSOutput-vf4-vf3-vf31[3];struct-GSOutput-vf4-u1-u1-vf3-vf3-vf3-vf31;u1;u1;) 314(param) 316(param) 317(param) 319(param)
322:42(GSOutput) Load 316(param)
Store 313(outStream) 322
Return
FunctionEnd
66(@main(struct-VSOutput-vf4-vf3-vf31[3];struct-GSOutput-vf4-u1-u1-vf3-vf3-vf3-vf31;u1;u1;): 3 Function None 60
62(input): 41(ptr) FunctionParameter
63(outStream): 58(ptr) FunctionParameter
64(InvocationID): 59(ptr) FunctionParameter
65(PrimitiveID): 59(ptr) FunctionParameter
69: Label
90(i): 89(ptr) Variable Function
107(output): 58(ptr) Variable Function
175(pos): 174(ptr) Variable Function
183(worldPos): 174(ptr) Variable Function
193(lPos): 118(ptr) Variable Function
70: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(Acosh) 68
71: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103 25 15 15 15 15
74: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 72 62(input) 75
79: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 76 63(outStream) 75
82: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 80 64(InvocationID) 75
84: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 83 65(PrimitiveID) 75
85: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 68 66(@main(struct-VSOutput-vf4-vf3-vf31[3];struct-GSOutput-vf4-u1-u1-vf3-vf3-vf3-vf31;u1;u1;)
Store 90(i) 94
95: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 91 94 75
Branch 96
96: Label
LoopMerge 98 99 None
Branch 100
100: Label
101: 86(int) Load 90(i)
106: 103(bool) SLessThan 101 102
BranchConditional 106 97 98
97: Label
Store 107(output) 114
115: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 108 114 75
116: 86(int) Load 90(i)
119: 118(ptr) AccessChain 62(input) 116 117
120: 20(fvec3) Load 119
153: 10(int) Load 64(InvocationID)
155: 154(ptr) AccessChain 150 94 117 153
156: 121 Load 155
159: 17(fvec4) CompositeExtract 156 0
160: 20(fvec3) VectorShuffle 159 159 0 1 2
161: 17(fvec4) CompositeExtract 156 1
162: 20(fvec3) VectorShuffle 161 161 0 1 2
163: 17(fvec4) CompositeExtract 156 2
164: 20(fvec3) VectorShuffle 163 163 0 1 2
165: 157 CompositeConstruct 160 162 164
166: 20(fvec3) VectorTimesMatrix 120 165
167: 118(ptr) AccessChain 107(output) 102
Store 167 166
169: 86(int) Load 90(i)
171: 118(ptr) AccessChain 62(input) 169 170
172: 20(fvec3) Load 171
173: 118(ptr) AccessChain 107(output) 168
Store 173 172
179: 86(int) Load 90(i)
180: 174(ptr) AccessChain 62(input) 179 94
181: 17(fvec4) Load 180
Store 175(pos) 181
182: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 176 181 75
187: 17(fvec4) Load 175(pos)
188: 10(int) Load 64(InvocationID)
189: 154(ptr) AccessChain 150 94 117 188
190: 121 Load 189
191: 17(fvec4) VectorTimesMatrix 187 190
Store 183(worldPos) 191
192: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 184 191 75
198: 197(ptr) AccessChain 150 94 170
199: 17(fvec4) Load 198
200: 10(int) Load 64(InvocationID)
201: 154(ptr) AccessChain 150 94 117 200
202: 121 Load 201
203: 17(fvec4) VectorTimesMatrix 199 202
204: 20(fvec3) VectorShuffle 203 203 0 1 2
Store 193(lPos) 204
205: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 194 204 75
207: 20(fvec3) Load 193(lPos)
208: 17(fvec4) Load 183(worldPos)
209: 20(fvec3) VectorShuffle 208 208 0 1 2
210: 20(fvec3) FSub 207 209
211: 118(ptr) AccessChain 107(output) 206
Store 211 210
213: 17(fvec4) Load 183(worldPos)
214: 20(fvec3) VectorShuffle 213 213 0 1 2
215: 20(fvec3) FNegate 214
216: 118(ptr) AccessChain 107(output) 212
Store 216 215
217: 17(fvec4) Load 183(worldPos)
218: 10(int) Load 64(InvocationID)
219: 154(ptr) AccessChain 150 94 94 218
220: 121 Load 219
221: 17(fvec4) VectorTimesMatrix 217 220
222: 174(ptr) AccessChain 107(output) 94
Store 222 221
223: 10(int) Load 64(InvocationID)
224: 59(ptr) AccessChain 107(output) 117
Store 224 223
225: 10(int) Load 65(PrimitiveID)
226: 59(ptr) AccessChain 107(output) 170
Store 226 225
232: 174(ptr) AccessChain 107(output) 94
233: 17(fvec4) Load 232
Store 228(outStream.Pos) 233
238: 59(ptr) AccessChain 107(output) 117
239: 10(int) Load 238
Store 235(outStream.ViewportIndex) 239
243: 59(ptr) AccessChain 107(output) 170
244: 10(int) Load 243
Store 240(outStream.PrimitiveID) 244
249: 118(ptr) AccessChain 107(output) 102
250: 20(fvec3) Load 249
Store 246(outStream.Normal) 250
254: 118(ptr) AccessChain 107(output) 168
255: 20(fvec3) Load 254
Store 251(outStream.Color) 255
259: 118(ptr) AccessChain 107(output) 212
260: 20(fvec3) Load 259
Store 256(outStream.ViewVec) 260
264: 118(ptr) AccessChain 107(output) 206
265: 20(fvec3) Load 264
Store 261(outStream.LightVec) 265
EmitVertex
Branch 99
99: Label
266: 86(int) Load 90(i)
267: 86(int) IAdd 266 117
Store 90(i) 267
268: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 91 267 75
Branch 96
98: Label
EndPrimitive
Return
FunctionEnd

View File

@ -0,0 +1,812 @@
spv.debuginfo.hlsl.tesc
WARNING: 0:158: '' : attribute does not apply to entry point
Validation failed
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 596
Capability Tessellation
Extension "SPV_KHR_non_semantic_info"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
2: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationControl 5 "main" 488 495 502 536 545 552 559 574 589
ExecutionMode 5 OutputVertices 4
ExecutionMode 5 Quads
ExecutionMode 5 SpacingEqual
ExecutionMode 5 VertexOrderCw
9: String "float"
12: String "uint"
26: String "screenSpaceTessFactor"
29: String ""
37: String "p0"
41: String "p1"
48: String "bool"
55: String "frustumCheck"
61: String "Pos"
64: String "inUV"
73: String "Normal"
77: String "UV"
81: String "VSOutput"
91: String "TessLevelOuter"
95: String "TessLevelInner"
98: String "ConstantsHSOutput"
103: String "ConstantsHS"
109: String "patch"
120: String "HSOutput"
126: String "@main"
134: String "InvocationID"
139: String "midPoint"
150: String "radius"
160: String "v0"
170: String "modelview"
175: String "lightPos"
179: String "frustumPlanes"
182: String "tessellatedEdgeSize"
186: String "viewportDim"
190: String "UBO"
193: String "ubo"
201: String "int"
212: String "clip0"
229: String "clip1"
294: String "pos"
300: String "type.2d.image"
302: String "@type.2d.image"
307: String "textureHeight"
311: String "type.sampler"
312: String "@type.sampler"
316: String "samplerHeight"
320: String "type.sampled.image"
321: String "@type.sampled.image"
337: String "i"
374: String "output"
Name 5 "main"
Name 25 "screenSpaceTessFactor(vf4;vf4;"
Name 23 "p0"
Name 24 "p1"
Name 54 "frustumCheck(vf4;vf2;"
Name 52 "Pos"
Name 53 "inUV"
Name 68 "VSOutput"
MemberName 68(VSOutput) 0 "Pos"
MemberName 68(VSOutput) 1 "Normal"
MemberName 68(VSOutput) 2 "UV"
Name 89 "ConstantsHSOutput"
MemberName 89(ConstantsHSOutput) 0 "TessLevelOuter"
MemberName 89(ConstantsHSOutput) 1 "TessLevelInner"
Name 102 "ConstantsHS(struct-VSOutput-vf4-vf3-vf21[4];"
Name 101 "patch"
Name 112 "HSOutput"
MemberName 112(HSOutput) 0 "Pos"
MemberName 112(HSOutput) 1 "Normal"
MemberName 112(HSOutput) 2 "UV"
Name 125 "@main(struct-VSOutput-vf4-vf3-vf21[4];u1;"
Name 123 "patch"
Name 124 "InvocationID"
Name 137 "midPoint"
Name 148 "radius"
Name 158 "v0"
Name 168 "UBO"
MemberName 168(UBO) 0 "projection"
MemberName 168(UBO) 1 "modelview"
MemberName 168(UBO) 2 "lightPos"
MemberName 168(UBO) 3 "frustumPlanes"
MemberName 168(UBO) 4 "displacementFactor"
MemberName 168(UBO) 5 "tessellationFactor"
MemberName 168(UBO) 6 "viewportDim"
MemberName 168(UBO) 7 "tessellatedEdgeSize"
Name 191 "ubo"
MemberName 191(ubo) 0 "ubo"
Name 197 ""
Name 210 "clip0"
Name 227 "clip1"
Name 292 "pos"
Name 305 "textureHeight"
Name 314 "samplerHeight"
Name 335 "i"
Name 372 "output"
Name 381 "param"
Name 384 "param"
Name 406 "param"
Name 409 "param"
Name 414 "param"
Name 417 "param"
Name 422 "param"
Name 425 "param"
Name 430 "param"
Name 433 "param"
Name 462 "output"
Name 485 "patch"
Name 488 "patch.Pos"
Name 495 "patch.Normal"
Name 502 "patch.UV"
Name 534 "InvocationID"
Name 536 "InvocationID"
Name 538 "flattenTemp"
Name 539 "param"
Name 541 "param"
Name 545 "@entryPointOutput.Pos"
Name 552 "@entryPointOutput.Normal"
Name 559 "@entryPointOutput.UV"
Name 569 "@patchConstantResult"
Name 570 "param"
Name 574 "@patchConstantOutput.TessLevelOuter"
Name 589 "@patchConstantOutput.TessLevelInner"
Decorate 166 ArrayStride 16
MemberDecorate 168(UBO) 0 RowMajor
MemberDecorate 168(UBO) 0 Offset 0
MemberDecorate 168(UBO) 0 MatrixStride 16
MemberDecorate 168(UBO) 1 RowMajor
MemberDecorate 168(UBO) 1 Offset 64
MemberDecorate 168(UBO) 1 MatrixStride 16
MemberDecorate 168(UBO) 2 Offset 128
MemberDecorate 168(UBO) 3 Offset 144
MemberDecorate 168(UBO) 4 Offset 240
MemberDecorate 168(UBO) 5 Offset 244
MemberDecorate 168(UBO) 6 Offset 248
MemberDecorate 168(UBO) 7 Offset 256
MemberDecorate 191(ubo) 0 Offset 0
Decorate 191(ubo) Block
Decorate 197 DescriptorSet 0
Decorate 197 Binding 0
Decorate 305(textureHeight) DescriptorSet 0
Decorate 305(textureHeight) Binding 1
Decorate 314(samplerHeight) DescriptorSet 0
Decorate 314(samplerHeight) Binding 1
Decorate 488(patch.Pos) BuiltIn Position
Decorate 495(patch.Normal) Location 0
Decorate 502(patch.UV) Location 1
Decorate 536(InvocationID) BuiltIn InvocationId
Decorate 545(@entryPointOutput.Pos) BuiltIn Position
Decorate 552(@entryPointOutput.Normal) Location 0
Decorate 559(@entryPointOutput.UV) Location 1
Decorate 574(@patchConstantOutput.TessLevelOuter) Patch
Decorate 574(@patchConstantOutput.TessLevelOuter) BuiltIn TessLevelOuter
Decorate 589(@patchConstantOutput.TessLevelInner) Patch
Decorate 589(@patchConstantOutput.TessLevelInner) BuiltIn TessLevelInner
3: TypeVoid
4: TypeFunction 3
7: TypeFloat 32
10: TypeInt 32 0
13: 10(int) Constant 32
14: 10(int) Constant 6
15: 10(int) Constant 0
11: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 12 13 14 15
16: 10(int) Constant 3
8: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 9 13 16 15
17: TypeVector 7(float) 4
18: 10(int) Constant 4
19: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 8 18
20: TypePointer Function 17(fvec4)
21: TypeFunction 7(float) 20(ptr) 20(ptr)
22: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 16 8 19 19
28: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(Modf) 0 29
31: 10(int) Constant 1
32: 10(int) Constant 5
30: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(Round) 31 18 28 32
27: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 26 22 28 15 15 30 26 16 15
36: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 37 19 28 15 15 27 18 31
39: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(Sqrt)
42: 10(int) Constant 2
40: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 41 19 28 15 15 27 18 42
44: TypeVector 7(float) 2
45: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 8 42
46: TypePointer Function 44(fvec2)
47: TypeBool
49: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 48 13 42 15
50: TypeFunction 47(bool) 20(ptr) 46(ptr)
51: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 16 49 19 45
56: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 55 51 28 15 15 30 55 16 15
60: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 61 19 28 15 15 56 18 31
63: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 64 45 28 15 15 56 18 42
66: TypeVector 7(float) 3
67: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 8 16
68(VSOutput): TypeStruct 17(fvec4) 66(fvec3) 44(fvec2)
70: 10(int) Constant 44
71: 10(int) Constant 13
69: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 61 19 28 70 71 15 15 16
74: 10(int) Constant 45
75: 10(int) Constant 35
72: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 73 67 28 74 75 15 15 16
78: 10(int) Constant 46
79: 10(int) Constant 31
76: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 77 45 28 78 79 15 15 16
80: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 81 31 28 15 15 30 81 15 16 69 72 76
82: TypeArray 68(VSOutput) 18
83: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 80 18
84: TypePointer Function 82
85: TypeArray 7(float) 18
86: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 8 18
87: TypeArray 7(float) 42
88: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 8 42
89(ConstantsHSOutput): TypeStruct 85 87
92: 10(int) Constant 58
93: 10(int) Constant 25
90: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 91 86 28 92 93 15 15 16
96: 10(int) Constant 59
94: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 95 88 28 96 93 15 15 16
97: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 98 31 28 15 15 30 98 15 16 90 94
99: TypeFunction 89(ConstantsHSOutput) 84(ptr)
100: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 16 97 83
104: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 103 100 28 15 15 30 103 16 15
108: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 109 83 28 15 15 104 18 31
111: TypePointer Function 10(int)
112(HSOutput): TypeStruct 17(fvec4) 66(fvec3) 44(fvec2)
114: 10(int) Constant 51
113: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 61 19 28 114 13 15 15 16
116: 10(int) Constant 52
115: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 73 67 28 116 75 15 15 16
118: 10(int) Constant 53
117: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 77 45 28 118 79 15 15 16
119: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 120 31 28 15 15 30 120 15 16 113 115 117
121: TypeFunction 112(HSOutput) 84(ptr) 111(ptr)
122: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 16 119 83 11
127: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 126 122 28 15 15 30 126 16 15
131: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 109 83 28 15 15 127 18 31
133: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 134 11 28 15 15 127 18 42
140: 10(int) Constant 67
138: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 139 19 28 140 15 27 18
141: 7(float) Constant 1056964608
147: TypePointer Function 7(float)
151: 10(int) Constant 69
149: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 150 8 28 151 15 27 18
155: 7(float) Constant 1073741824
161: 10(int) Constant 72
159: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 160 19 28 161 15 27 18
163: TypeMatrix 17(fvec4) 4
165: 47(bool) ConstantTrue
164: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 19 18 165
166: TypeArray 17(fvec4) 14
167: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 19 14
168(UBO): TypeStruct 163 163 17(fvec4) 166 7(float) 7(float) 44(fvec2) 7(float)
171: 10(int) Constant 29
172: 10(int) Constant 20
169: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 170 164 28 171 172 15 15 16
173: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 170 164 28 171 172 15 15 16
176: 10(int) Constant 30
177: 10(int) Constant 17
174: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 175 19 28 176 177 15 15 16
180: 10(int) Constant 22
178: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 179 167 28 79 180 15 15 16
183: 10(int) Constant 27
181: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 182 8 28 75 183 15 15 16
184: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 182 8 28 75 183 15 15 16
187: 10(int) Constant 34
185: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 186 45 28 187 172 15 15 16
188: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 182 8 28 75 183 15 15 16
189: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 190 31 28 161 15 30 190 15 16 169 173 174 178 181 184 185 188
191(ubo): TypeStruct 168(UBO)
194: 10(int) Constant 37
192: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 193 189 28 194 194 15 15 16
195: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 193 31 28 161 15 30 193 15 16 192
196: TypePointer Uniform 191(ubo)
197: 196(ptr) Variable Uniform
199: 10(int) Constant 8
198: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 29 195 28 161 15 30 29 197 199
200: TypeInt 32 1
202: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 201 13 18 15
203: 200(int) Constant 0
204: 200(int) Constant 1
205: TypePointer Uniform 163
213: 10(int) Constant 75
211: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 212 19 28 213 15 27 18
216: 7(float) Constant 0
217: 66(fvec3) ConstantComposite 216 216 216
230: 10(int) Constant 76
228: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 229 19 28 230 15 27 18
254: 200(int) Constant 6
255: TypePointer Uniform 44(fvec2)
277: 200(int) Constant 7
278: TypePointer Uniform 7(float)
282: 200(int) Constant 5
286: 7(float) Constant 1065353216
287: 7(float) Constant 1115684864
295: 10(int) Constant 98
293: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 294 19 28 295 15 56 18
298: TypeImage 7(float) 2D sampled format:Unknown
301: 10(int) Constant 99
303: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(Unknown)
299: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 300 15 28 301 15 30 302 303 16
304: TypePointer UniformConstant 298
305(textureHeight): 304(ptr) Variable UniformConstant
306: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 307 299 28 301 15 30 307 305(textureHeight) 199
309: TypeSampler
310: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 311 31 28 301 15 30 312 303 16
313: TypePointer UniformConstant 309
314(samplerHeight): 313(ptr) Variable UniformConstant
315: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 316 310 28 301 15 30 316 314(samplerHeight) 199
318: TypeSampledImage 298
319: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 320 15 28 301 15 30 321 303 16
326: 200(int) Constant 4
334: TypePointer Function 200(int)
338: 10(int) Constant 102
336: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 337 202 28 338 15 56 18
346: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 48 13 42 15
349: 200(int) Constant 3
351: TypePointer Uniform 17(fvec4)
355: 7(float) Constant 1090519040
357: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 48 13 42 15
361: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 48 13 42 15
362: 47(bool) ConstantFalse
367: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 48 13 42 15
371: TypePointer Function 89(ConstantsHSOutput)
375: 10(int) Constant 113
373: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 374 97 28 375 15 104 18
376: 85 ConstantComposite 216 216 216 216
377: 87 ConstantComposite 216 216
378:89(ConstantsHSOutput) ConstantComposite 376 377
380: 200(int) Constant 2
388: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 48 13 42 15
389: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 48 13 42 15
402: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 48 13 42 15
461: TypePointer Function 112(HSOutput)
464: 10(int) Constant 159
463: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 374 119 28 464 15 127 18
465: 17(fvec4) ConstantComposite 216 216 216 216
466: 44(fvec2) ConstantComposite 216 216
467:112(HSOutput) ConstantComposite 465 217 466
474: TypePointer Function 66(fvec3)
486: TypeArray 17(fvec4) 18
487: TypePointer Input 486
488(patch.Pos): 487(ptr) Variable Input
489: TypePointer Input 17(fvec4)
493: TypeArray 66(fvec3) 18
494: TypePointer Input 493
495(patch.Normal): 494(ptr) Variable Input
496: TypePointer Input 66(fvec3)
500: TypeArray 44(fvec2) 18
501: TypePointer Input 500
502(patch.UV): 501(ptr) Variable Input
503: TypePointer Input 44(fvec2)
535: TypePointer Input 10(int)
536(InvocationID): 535(ptr) Variable Input
544: TypePointer Output 486
545(@entryPointOutput.Pos): 544(ptr) Variable Output
549: TypePointer Output 17(fvec4)
551: TypePointer Output 493
552(@entryPointOutput.Normal): 551(ptr) Variable Output
556: TypePointer Output 66(fvec3)
558: TypePointer Output 500
559(@entryPointOutput.UV): 558(ptr) Variable Output
563: TypePointer Output 44(fvec2)
573: TypePointer Output 85
574(@patchConstantOutput.TessLevelOuter): 573(ptr) Variable Output
577: TypePointer Output 7(float)
588: TypePointer Output 87
589(@patchConstantOutput.TessLevelInner): 588(ptr) Variable Output
5(main): 3 Function None 4
6: Label
485(patch): 84(ptr) Variable Function
534(InvocationID): 111(ptr) Variable Function
538(flattenTemp): 461(ptr) Variable Function
539(param): 84(ptr) Variable Function
541(param): 111(ptr) Variable Function
569(@patchConstantResult): 371(ptr) Variable Function
570(param): 84(ptr) Variable Function
490: 489(ptr) AccessChain 488(patch.Pos) 203
491: 17(fvec4) Load 490
492: 20(ptr) AccessChain 485(patch) 203 203
Store 492 491
497: 496(ptr) AccessChain 495(patch.Normal) 203
498: 66(fvec3) Load 497
499: 474(ptr) AccessChain 485(patch) 203 204
Store 499 498
504: 503(ptr) AccessChain 502(patch.UV) 203
505: 44(fvec2) Load 504
506: 46(ptr) AccessChain 485(patch) 203 380
Store 506 505
507: 489(ptr) AccessChain 488(patch.Pos) 204
508: 17(fvec4) Load 507
509: 20(ptr) AccessChain 485(patch) 204 203
Store 509 508
510: 496(ptr) AccessChain 495(patch.Normal) 204
511: 66(fvec3) Load 510
512: 474(ptr) AccessChain 485(patch) 204 204
Store 512 511
513: 503(ptr) AccessChain 502(patch.UV) 204
514: 44(fvec2) Load 513
515: 46(ptr) AccessChain 485(patch) 204 380
Store 515 514
516: 489(ptr) AccessChain 488(patch.Pos) 380
517: 17(fvec4) Load 516
518: 20(ptr) AccessChain 485(patch) 380 203
Store 518 517
519: 496(ptr) AccessChain 495(patch.Normal) 380
520: 66(fvec3) Load 519
521: 474(ptr) AccessChain 485(patch) 380 204
Store 521 520
522: 503(ptr) AccessChain 502(patch.UV) 380
523: 44(fvec2) Load 522
524: 46(ptr) AccessChain 485(patch) 380 380
Store 524 523
525: 489(ptr) AccessChain 488(patch.Pos) 349
526: 17(fvec4) Load 525
527: 20(ptr) AccessChain 485(patch) 349 203
Store 527 526
528: 496(ptr) AccessChain 495(patch.Normal) 349
529: 66(fvec3) Load 528
530: 474(ptr) AccessChain 485(patch) 349 204
Store 530 529
531: 503(ptr) AccessChain 502(patch.UV) 349
532: 44(fvec2) Load 531
533: 46(ptr) AccessChain 485(patch) 349 380
Store 533 532
537: 10(int) Load 536(InvocationID)
Store 534(InvocationID) 537
540: 82 Load 485(patch)
Store 539(param) 540
542: 10(int) Load 534(InvocationID)
Store 541(param) 542
543:112(HSOutput) FunctionCall 125(@main(struct-VSOutput-vf4-vf3-vf21[4];u1;) 539(param) 541(param)
Store 538(flattenTemp) 543
546: 10(int) Load 536(InvocationID)
547: 20(ptr) AccessChain 538(flattenTemp) 203
548: 17(fvec4) Load 547
550: 549(ptr) AccessChain 545(@entryPointOutput.Pos) 546
Store 550 548
553: 10(int) Load 536(InvocationID)
554: 474(ptr) AccessChain 538(flattenTemp) 204
555: 66(fvec3) Load 554
557: 556(ptr) AccessChain 552(@entryPointOutput.Normal) 553
Store 557 555
560: 10(int) Load 536(InvocationID)
561: 46(ptr) AccessChain 538(flattenTemp) 380
562: 44(fvec2) Load 561
564: 563(ptr) AccessChain 559(@entryPointOutput.UV) 560
Store 564 562
ControlBarrier 42 18 15
565: 10(int) Load 536(InvocationID)
566: 47(bool) IEqual 565 203
SelectionMerge 568 None
BranchConditional 566 567 568
567: Label
571: 82 Load 485(patch)
Store 570(param) 571
572:89(ConstantsHSOutput) FunctionCall 102(ConstantsHS(struct-VSOutput-vf4-vf3-vf21[4];) 570(param)
Store 569(@patchConstantResult) 572
575: 147(ptr) AccessChain 569(@patchConstantResult) 203 203
576: 7(float) Load 575
578: 577(ptr) AccessChain 574(@patchConstantOutput.TessLevelOuter) 203
Store 578 576
579: 147(ptr) AccessChain 569(@patchConstantResult) 203 204
580: 7(float) Load 579
581: 577(ptr) AccessChain 574(@patchConstantOutput.TessLevelOuter) 204
Store 581 580
582: 147(ptr) AccessChain 569(@patchConstantResult) 203 380
583: 7(float) Load 582
584: 577(ptr) AccessChain 574(@patchConstantOutput.TessLevelOuter) 380
Store 584 583
585: 147(ptr) AccessChain 569(@patchConstantResult) 203 349
586: 7(float) Load 585
587: 577(ptr) AccessChain 574(@patchConstantOutput.TessLevelOuter) 349
Store 587 586
590: 147(ptr) AccessChain 569(@patchConstantResult) 204 203
591: 7(float) Load 590
592: 577(ptr) AccessChain 589(@patchConstantOutput.TessLevelInner) 203
Store 592 591
593: 147(ptr) AccessChain 569(@patchConstantResult) 204 204
594: 7(float) Load 593
595: 577(ptr) AccessChain 589(@patchConstantOutput.TessLevelInner) 204
Store 595 594
Branch 568
568: Label
Return
FunctionEnd
25(screenSpaceTessFactor(vf4;vf4;): 7(float) Function None 21
23(p0): 20(ptr) FunctionParameter
24(p1): 20(ptr) FunctionParameter
33: Label
137(midPoint): 20(ptr) Variable Function
148(radius): 147(ptr) Variable Function
158(v0): 20(ptr) Variable Function
210(clip0): 20(ptr) Variable Function
227(clip1): 20(ptr) Variable Function
34: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(Acosh) 27
35: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103 28 15 15 15 15
38: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 36 23(p0) 39
43: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 40 24(p1) 39
136: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 27 25(screenSpaceTessFactor(vf4;vf4;)
142: 17(fvec4) Load 23(p0)
143: 17(fvec4) Load 24(p1)
144: 17(fvec4) FAdd 142 143
145: 17(fvec4) VectorTimesScalar 144 141
Store 137(midPoint) 145
146: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 138 145 39
152: 17(fvec4) Load 23(p0)
153: 17(fvec4) Load 24(p1)
154: 7(float) ExtInst 2(GLSL.std.450) 67(Distance) 152 153
156: 7(float) FDiv 154 155
Store 148(radius) 156
157: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 149 156 39
162: 17(fvec4) Load 137(midPoint)
206: 205(ptr) AccessChain 197 203 204
207: 163 Load 206
208: 17(fvec4) VectorTimesMatrix 162 207
Store 158(v0) 208
209: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 159 208 39
214: 17(fvec4) Load 158(v0)
215: 7(float) Load 148(radius)
218: 7(float) CompositeExtract 217 0
219: 7(float) CompositeExtract 217 1
220: 7(float) CompositeExtract 217 2
221: 17(fvec4) CompositeConstruct 215 218 219 220
222: 17(fvec4) FSub 214 221
223: 205(ptr) AccessChain 197 203 203
224: 163 Load 223
225: 17(fvec4) VectorTimesMatrix 222 224
Store 210(clip0) 225
226: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 211 225 39
231: 17(fvec4) Load 158(v0)
232: 7(float) Load 148(radius)
233: 7(float) CompositeExtract 217 0
234: 7(float) CompositeExtract 217 1
235: 7(float) CompositeExtract 217 2
236: 17(fvec4) CompositeConstruct 232 233 234 235
237: 17(fvec4) FAdd 231 236
238: 205(ptr) AccessChain 197 203 203
239: 163 Load 238
240: 17(fvec4) VectorTimesMatrix 237 239
Store 227(clip1) 240
241: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 228 240 39
242: 147(ptr) AccessChain 210(clip0) 16
243: 7(float) Load 242
244: 17(fvec4) Load 210(clip0)
245: 17(fvec4) CompositeConstruct 243 243 243 243
246: 17(fvec4) FDiv 244 245
Store 210(clip0) 246
247: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 211 246 39
248: 147(ptr) AccessChain 227(clip1) 16
249: 7(float) Load 248
250: 17(fvec4) Load 227(clip1)
251: 17(fvec4) CompositeConstruct 249 249 249 249
252: 17(fvec4) FDiv 250 251
Store 227(clip1) 252
253: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 228 252 39
256: 255(ptr) AccessChain 197 203 254
257: 44(fvec2) Load 256
258: 17(fvec4) Load 210(clip0)
259: 44(fvec2) VectorShuffle 258 258 0 1
260: 44(fvec2) FMul 259 257
261: 147(ptr) AccessChain 210(clip0) 15
262: 7(float) CompositeExtract 260 0
Store 261 262
263: 147(ptr) AccessChain 210(clip0) 31
264: 7(float) CompositeExtract 260 1
Store 263 264
265: 255(ptr) AccessChain 197 203 254
266: 44(fvec2) Load 265
267: 17(fvec4) Load 227(clip1)
268: 44(fvec2) VectorShuffle 267 267 0 1
269: 44(fvec2) FMul 268 266
270: 147(ptr) AccessChain 227(clip1) 15
271: 7(float) CompositeExtract 269 0
Store 270 271
272: 147(ptr) AccessChain 227(clip1) 31
273: 7(float) CompositeExtract 269 1
Store 272 273
274: 17(fvec4) Load 210(clip0)
275: 17(fvec4) Load 227(clip1)
276: 7(float) ExtInst 2(GLSL.std.450) 67(Distance) 274 275
279: 278(ptr) AccessChain 197 203 277
280: 7(float) Load 279
281: 7(float) FDiv 276 280
283: 278(ptr) AccessChain 197 203 282
284: 7(float) Load 283
285: 7(float) FMul 281 284
288: 7(float) ExtInst 2(GLSL.std.450) 43(FClamp) 285 286 287
ReturnValue 288
FunctionEnd
54(frustumCheck(vf4;vf2;): 47(bool) Function None 50
52(Pos): 20(ptr) FunctionParameter
53(inUV): 46(ptr) FunctionParameter
57: Label
292(pos): 20(ptr) Variable Function
335(i): 334(ptr) Variable Function
58: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(Acosh) 56
59: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103 28 15 15 15 15
62: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 60 52(Pos) 39
65: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 63 53(inUV) 39
291: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 56 54(frustumCheck(vf4;vf2;)
296: 17(fvec4) Load 52(Pos)
Store 292(pos) 296
297: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 293 296 39
308: 298 Load 305(textureHeight)
317: 309 Load 314(samplerHeight)
322: 318 SampledImage 308 317
323: 44(fvec2) Load 53(inUV)
324: 17(fvec4) ImageSampleExplicitLod 322 323 Lod 216
325: 7(float) CompositeExtract 324 0
327: 278(ptr) AccessChain 197 203 326
328: 7(float) Load 327
329: 7(float) FMul 325 328
330: 147(ptr) AccessChain 292(pos) 31
331: 7(float) Load 330
332: 7(float) FSub 331 329
333: 147(ptr) AccessChain 292(pos) 31
Store 333 332
Store 335(i) 203
339: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 336 203 39
Branch 340
340: Label
LoopMerge 342 343 None
Branch 344
344: Label
345: 200(int) Load 335(i)
347: 47(bool) SLessThan 345 254
BranchConditional 347 341 342
341: Label
348: 17(fvec4) Load 292(pos)
350: 200(int) Load 335(i)
352: 351(ptr) AccessChain 197 203 349 350
353: 17(fvec4) Load 352
354: 7(float) Dot 348 353
356: 7(float) FAdd 354 355
358: 47(bool) FOrdLessThan 356 216
SelectionMerge 360 None
BranchConditional 358 359 360
359: Label
ReturnValue 362
360: Label
Branch 343
343: Label
364: 200(int) Load 335(i)
365: 200(int) IAdd 364 204
Store 335(i) 365
366: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 336 365 39
Branch 340
342: Label
ReturnValue 165
FunctionEnd
102(ConstantsHS(struct-VSOutput-vf4-vf3-vf21[4];):89(ConstantsHSOutput) Function None 99
101(patch): 84(ptr) FunctionParameter
105: Label
372(output): 371(ptr) Variable Function
381(param): 20(ptr) Variable Function
384(param): 46(ptr) Variable Function
406(param): 20(ptr) Variable Function
409(param): 20(ptr) Variable Function
414(param): 20(ptr) Variable Function
417(param): 20(ptr) Variable Function
422(param): 20(ptr) Variable Function
425(param): 20(ptr) Variable Function
430(param): 20(ptr) Variable Function
433(param): 20(ptr) Variable Function
106: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(Acosh) 104
107: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103 28 15 15 15 15
110: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 108 101(patch) 39
370: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 104 102(ConstantsHS(struct-VSOutput-vf4-vf3-vf21[4];)
Store 372(output) 378
379: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 373 378 39
382: 20(ptr) AccessChain 101(patch) 203 203
383: 17(fvec4) Load 382
Store 381(param) 383
385: 46(ptr) AccessChain 101(patch) 203 380
386: 44(fvec2) Load 385
Store 384(param) 386
387: 47(bool) FunctionCall 54(frustumCheck(vf4;vf2;) 381(param) 384(param)
390: 47(bool) LogicalNot 387
SelectionMerge 392 None
BranchConditional 390 391 399
391: Label
393: 147(ptr) AccessChain 372(output) 204 203
Store 393 216
394: 147(ptr) AccessChain 372(output) 204 204
Store 394 216
395: 147(ptr) AccessChain 372(output) 203 203
Store 395 216
396: 147(ptr) AccessChain 372(output) 203 204
Store 396 216
397: 147(ptr) AccessChain 372(output) 203 380
Store 397 216
398: 147(ptr) AccessChain 372(output) 203 349
Store 398 216
Branch 392
399: Label
400: 278(ptr) AccessChain 197 203 282
401: 7(float) Load 400
403: 47(bool) FOrdGreaterThan 401 216
SelectionMerge 405 None
BranchConditional 403 404 450
404: Label
407: 20(ptr) AccessChain 101(patch) 349 203
408: 17(fvec4) Load 407
Store 406(param) 408
410: 20(ptr) AccessChain 101(patch) 203 203
411: 17(fvec4) Load 410
Store 409(param) 411
412: 7(float) FunctionCall 25(screenSpaceTessFactor(vf4;vf4;) 406(param) 409(param)
413: 147(ptr) AccessChain 372(output) 203 203
Store 413 412
415: 20(ptr) AccessChain 101(patch) 203 203
416: 17(fvec4) Load 415
Store 414(param) 416
418: 20(ptr) AccessChain 101(patch) 204 203
419: 17(fvec4) Load 418
Store 417(param) 419
420: 7(float) FunctionCall 25(screenSpaceTessFactor(vf4;vf4;) 414(param) 417(param)
421: 147(ptr) AccessChain 372(output) 203 204
Store 421 420
423: 20(ptr) AccessChain 101(patch) 204 203
424: 17(fvec4) Load 423
Store 422(param) 424
426: 20(ptr) AccessChain 101(patch) 380 203
427: 17(fvec4) Load 426
Store 425(param) 427
428: 7(float) FunctionCall 25(screenSpaceTessFactor(vf4;vf4;) 422(param) 425(param)
429: 147(ptr) AccessChain 372(output) 203 380
Store 429 428
431: 20(ptr) AccessChain 101(patch) 380 203
432: 17(fvec4) Load 431
Store 430(param) 432
434: 20(ptr) AccessChain 101(patch) 349 203
435: 17(fvec4) Load 434
Store 433(param) 435
436: 7(float) FunctionCall 25(screenSpaceTessFactor(vf4;vf4;) 430(param) 433(param)
437: 147(ptr) AccessChain 372(output) 203 349
Store 437 436
438: 147(ptr) AccessChain 372(output) 203 203
439: 7(float) Load 438
440: 147(ptr) AccessChain 372(output) 203 349
441: 7(float) Load 440
442: 7(float) ExtInst 2(GLSL.std.450) 46(FMix) 439 441 141
443: 147(ptr) AccessChain 372(output) 204 203
Store 443 442
444: 147(ptr) AccessChain 372(output) 203 380
445: 7(float) Load 444
446: 147(ptr) AccessChain 372(output) 203 204
447: 7(float) Load 446
448: 7(float) ExtInst 2(GLSL.std.450) 46(FMix) 445 447 141
449: 147(ptr) AccessChain 372(output) 204 204
Store 449 448
Branch 405
450: Label
451: 147(ptr) AccessChain 372(output) 204 203
Store 451 286
452: 147(ptr) AccessChain 372(output) 204 204
Store 452 286
453: 147(ptr) AccessChain 372(output) 203 203
Store 453 286
454: 147(ptr) AccessChain 372(output) 203 204
Store 454 286
455: 147(ptr) AccessChain 372(output) 203 380
Store 455 286
456: 147(ptr) AccessChain 372(output) 203 349
Store 456 286
Branch 405
405: Label
Branch 392
392: Label
457:89(ConstantsHSOutput) Load 372(output)
ReturnValue 457
FunctionEnd
125(@main(struct-VSOutput-vf4-vf3-vf21[4];u1;):112(HSOutput) Function None 121
123(patch): 84(ptr) FunctionParameter
124(InvocationID): 111(ptr) FunctionParameter
128: Label
462(output): 461(ptr) Variable Function
129: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(Acosh) 127
130: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103 28 15 15 15 15
132: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 131 123(patch) 39
135: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 133 124(InvocationID) 39
460: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 127 125(@main(struct-VSOutput-vf4-vf3-vf21[4];u1;)
Store 462(output) 467
468: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 463 467 39
469: 10(int) Load 124(InvocationID)
470: 20(ptr) AccessChain 123(patch) 469 203
471: 17(fvec4) Load 470
472: 20(ptr) AccessChain 462(output) 203
Store 472 471
473: 10(int) Load 124(InvocationID)
475: 474(ptr) AccessChain 123(patch) 473 204
476: 66(fvec3) Load 475
477: 474(ptr) AccessChain 462(output) 204
Store 477 476
478: 10(int) Load 124(InvocationID)
479: 46(ptr) AccessChain 123(patch) 478 380
480: 44(fvec2) Load 479
481: 46(ptr) AccessChain 462(output) 380
Store 481 480
482:112(HSOutput) Load 462(output)
ReturnValue 482
FunctionEnd

View File

@ -0,0 +1,589 @@
spv.debuginfo.hlsl.tese
Validation failed
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 434
Capability Tessellation
Extension "SPV_KHR_non_semantic_info"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
2: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationEvaluation 5 "main" 325 340 349 358 365 371 411 415 419 422 425 428 431
ExecutionMode 5 Quads
9: String "float"
12: String "uint"
25: String "TessLevelOuter"
27: String ""
31: String "TessLevelInner"
34: String "ConstantsHSOutput"
48: String "Pos"
51: String "Normal"
55: String "UV"
59: String "HSOutput"
67: String "WorldPos"
77: String "DSOutput"
84: String "@main"
90: String "input"
94: String "TessCoord"
97: String "patch"
103: String "output"
113: String "uv1"
116: String "int"
131: String "uv2"
151: String "n1"
162: String "n2"
181: String "pos1"
192: String "pos2"
203: String "pos"
214: String "type.2d.image"
216: String "@type.2d.image"
221: String "displacementMapTexture"
226: String "type.sampler"
227: String "@type.sampler"
231: String "displacementMapSampler"
235: String "type.sampled.image"
236: String "@type.sampled.image"
250: String "modelview"
255: String "lightPos"
259: String "frustumPlanes"
262: String "tessellatedEdgeSize"
266: String "viewportDim"
270: String "UBO"
273: String "ubo"
Name 5 "main"
Name 23 "ConstantsHSOutput"
MemberName 23(ConstantsHSOutput) 0 "TessLevelOuter"
MemberName 23(ConstantsHSOutput) 1 "TessLevelInner"
Name 46 "HSOutput"
MemberName 46(HSOutput) 0 "Pos"
MemberName 46(HSOutput) 1 "Normal"
MemberName 46(HSOutput) 2 "UV"
Name 62 "DSOutput"
MemberName 62(DSOutput) 0 "Pos"
MemberName 62(DSOutput) 1 "Normal"
MemberName 62(DSOutput) 2 "UV"
MemberName 62(DSOutput) 3 "ViewVec"
MemberName 62(DSOutput) 4 "LightVec"
MemberName 62(DSOutput) 5 "EyePos"
MemberName 62(DSOutput) 6 "WorldPos"
Name 83 "@main(struct-ConstantsHSOutput-f1[4]-f1[2]1;vf2;struct-HSOutput-vf4-vf3-vf21[4];"
Name 80 "input"
Name 81 "TessCoord"
Name 82 "patch"
Name 101 "output"
Name 111 "uv1"
Name 129 "uv2"
Name 149 "n1"
Name 160 "n2"
Name 179 "pos1"
Name 190 "pos2"
Name 201 "pos"
Name 219 "displacementMapTexture"
Name 229 "displacementMapSampler"
Name 248 "UBO"
MemberName 248(UBO) 0 "projection"
MemberName 248(UBO) 1 "modelview"
MemberName 248(UBO) 2 "lightPos"
MemberName 248(UBO) 3 "frustumPlanes"
MemberName 248(UBO) 4 "displacementFactor"
MemberName 248(UBO) 5 "tessellationFactor"
MemberName 248(UBO) 6 "viewportDim"
MemberName 248(UBO) 7 "tessellatedEdgeSize"
Name 271 "ubo"
MemberName 271(ubo) 0 "ubo"
Name 276 ""
Name 323 "input"
Name 325 "input.TessLevelOuter"
Name 340 "input.TessLevelInner"
Name 347 "TessCoord"
Name 349 "TessCoord"
Name 355 "patch"
Name 358 "patch.Pos"
Name 365 "patch.Normal"
Name 371 "patch.UV"
Name 403 "flattenTemp"
Name 405 "param"
Name 407 "param"
Name 411 "@entryPointOutput.Pos"
Name 415 "@entryPointOutput.Normal"
Name 419 "@entryPointOutput.UV"
Name 422 "@entryPointOutput.ViewVec"
Name 425 "@entryPointOutput.LightVec"
Name 428 "@entryPointOutput.EyePos"
Name 431 "@entryPointOutput.WorldPos"
Decorate 219(displacementMapTexture) DescriptorSet 0
Decorate 219(displacementMapTexture) Binding 1
Decorate 229(displacementMapSampler) DescriptorSet 0
Decorate 229(displacementMapSampler) Binding 1
Decorate 246 ArrayStride 16
MemberDecorate 248(UBO) 0 RowMajor
MemberDecorate 248(UBO) 0 Offset 0
MemberDecorate 248(UBO) 0 MatrixStride 16
MemberDecorate 248(UBO) 1 RowMajor
MemberDecorate 248(UBO) 1 Offset 64
MemberDecorate 248(UBO) 1 MatrixStride 16
MemberDecorate 248(UBO) 2 Offset 128
MemberDecorate 248(UBO) 3 Offset 144
MemberDecorate 248(UBO) 4 Offset 240
MemberDecorate 248(UBO) 5 Offset 244
MemberDecorate 248(UBO) 6 Offset 248
MemberDecorate 248(UBO) 7 Offset 256
MemberDecorate 271(ubo) 0 Offset 0
Decorate 271(ubo) Block
Decorate 276 DescriptorSet 0
Decorate 276 Binding 0
Decorate 325(input.TessLevelOuter) Patch
Decorate 325(input.TessLevelOuter) BuiltIn TessLevelOuter
Decorate 340(input.TessLevelInner) Patch
Decorate 340(input.TessLevelInner) BuiltIn TessLevelInner
Decorate 349(TessCoord) Patch
Decorate 349(TessCoord) BuiltIn TessCoord
Decorate 358(patch.Pos) BuiltIn Position
Decorate 365(patch.Normal) Location 0
Decorate 371(patch.UV) Location 1
Decorate 411(@entryPointOutput.Pos) BuiltIn Position
Decorate 415(@entryPointOutput.Normal) Location 0
Decorate 419(@entryPointOutput.UV) Location 1
Decorate 422(@entryPointOutput.ViewVec) Location 2
Decorate 425(@entryPointOutput.LightVec) Location 3
Decorate 428(@entryPointOutput.EyePos) Location 4
Decorate 431(@entryPointOutput.WorldPos) Location 5
3: TypeVoid
4: TypeFunction 3
7: TypeFloat 32
10: TypeInt 32 0
13: 10(int) Constant 32
14: 10(int) Constant 6
15: 10(int) Constant 0
11: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 12 13 14 15
16: 10(int) Constant 3
8: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 9 13 16 15
17: 10(int) Constant 4
18: TypeArray 7(float) 17
19: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 8 17
20: 10(int) Constant 2
21: TypeArray 7(float) 20
22: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 8 20
23(ConstantsHSOutput): TypeStruct 18 21
26: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(Modf) 0 27
28: 10(int) Constant 51
29: 10(int) Constant 25
24: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 25 19 26 28 29 15 15 16
32: 10(int) Constant 52
30: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 31 22 26 32 29 15 15 16
35: 10(int) Constant 1
37: 10(int) Constant 5
36: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(Round) 35 17 26 37
33: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 34 35 26 15 15 36 34 15 16 24 30
38: TypePointer Function 23(ConstantsHSOutput)
39: TypeVector 7(float) 2
40: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 8 20
41: TypePointer Function 39(fvec2)
42: TypeVector 7(float) 4
43: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 8 17
44: TypeVector 7(float) 3
45: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 8 16
46(HSOutput): TypeStruct 42(fvec4) 44(fvec3) 39(fvec2)
49: 10(int) Constant 44
47: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 48 43 26 49 13 15 15 16
52: 10(int) Constant 45
53: 10(int) Constant 35
50: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 51 45 26 52 53 15 15 16
56: 10(int) Constant 46
57: 10(int) Constant 31
54: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 55 40 26 56 57 15 15 16
58: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 59 35 26 15 15 36 59 15 16 47 50 54
60: TypeArray 46(HSOutput) 17
61: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 58 17
62(DSOutput): TypeStruct 42(fvec4) 44(fvec3) 39(fvec2) 44(fvec3) 44(fvec3) 44(fvec3) 44(fvec3)
64: 10(int) Constant 57
65: 10(int) Constant 13
63: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 48 43 26 64 65 15 15 16
68: 10(int) Constant 63
69: 10(int) Constant 37
66: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 67 45 26 68 69 15 15 16
71: 10(int) Constant 59
70: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 55 40 26 71 57 15 15 16
72: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 67 45 26 68 69 15 15 16
73: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 67 45 26 68 69 15 15 16
74: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 67 45 26 68 69 15 15 16
75: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 67 45 26 68 69 15 15 16
76: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 77 35 26 15 15 36 77 15 16 63 66 70 72 73 74 75
78: TypeFunction 62(DSOutput) 38(ptr) 41(ptr) 60
79: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 16 76 33 40 58
85: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 84 79 26 15 15 36 84 16 15
89: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 90 33 26 15 15 85 17 35
92: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(Sqrt)
93: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 94 40 26 15 15 85 17 20
96: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 97 58 26 15 15 85 17 16
100: TypePointer Function 62(DSOutput)
104: 10(int) Constant 70
102: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 103 76 26 104 15 85 17
105: 7(float) Constant 0
106: 42(fvec4) ConstantComposite 105 105 105 105
107: 44(fvec3) ConstantComposite 105 105 105
108: 39(fvec2) ConstantComposite 105 105
109:62(DSOutput) ConstantComposite 106 107 108 107 107 107 107
114: 10(int) Constant 71
112: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 113 40 26 114 15 85 17
115: TypeInt 32 1
117: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 116 13 17 15
118: 115(int) Constant 0
119: 115(int) Constant 2
121: 115(int) Constant 1
123: TypePointer Function 7(float)
132: 10(int) Constant 72
130: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 131 40 26 132 15 85 17
133: 115(int) Constant 3
148: TypePointer Function 44(fvec3)
152: 10(int) Constant 75
150: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 151 45 26 152 15 85 17
163: 10(int) Constant 76
161: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 162 45 26 163 15 85 17
178: TypePointer Function 42(fvec4)
182: 10(int) Constant 80
180: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 181 43 26 182 15 85 17
193: 10(int) Constant 81
191: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 192 43 26 193 15 85 17
204: 10(int) Constant 82
202: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 203 43 26 204 15 85 17
212: TypeImage 7(float) 2D sampled format:Unknown
215: 10(int) Constant 84
217: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 0(Unknown)
213: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 214 15 26 215 15 36 216 217 16
218: TypePointer UniformConstant 212
219(displacementMapTexture): 218(ptr) Variable UniformConstant
222: 10(int) Constant 8
220: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 221 213 26 215 15 36 221 219(displacementMapTexture) 222
224: TypeSampler
225: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 226 35 26 215 15 36 227 217 16
228: TypePointer UniformConstant 224
229(displacementMapSampler): 228(ptr) Variable UniformConstant
230: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 231 225 26 215 15 36 231 229(displacementMapSampler) 222
233: TypeSampledImage 212
234: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 235 15 26 215 15 36 236 217 16
242: TypeMatrix 42(fvec4) 4
244: TypeBool
245: 244(bool) ConstantTrue
243: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 43 17 245
246: TypeArray 42(fvec4) 14
247: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(SAbs) 43 14
248(UBO): TypeStruct 242 242 42(fvec4) 246 7(float) 7(float) 39(fvec2) 7(float)
251: 10(int) Constant 29
252: 10(int) Constant 20
249: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 250 243 26 251 252 15 15 16
253: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 250 243 26 251 252 15 15 16
256: 10(int) Constant 30
257: 10(int) Constant 17
254: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 255 43 26 256 257 15 15 16
260: 10(int) Constant 22
258: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 259 247 26 57 260 15 15 16
263: 10(int) Constant 27
261: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 262 8 26 53 263 15 15 16
264: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 262 8 26 53 263 15 15 16
267: 10(int) Constant 34
265: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 266 40 26 267 252 15 15 16
268: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 262 8 26 53 263 15 15 16
269: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 270 35 26 215 15 36 270 15 16 249 253 254 258 261 264 265 268
271(ubo): TypeStruct 248(UBO)
272: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 273 269 26 69 69 15 15 16
274: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 273 35 26 215 15 36 273 15 16 272
275: TypePointer Uniform 271(ubo)
276: 275(ptr) Variable Uniform
277: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 27 274 26 215 15 36 27 276 222
278: 115(int) Constant 4
279: TypePointer Uniform 7(float)
288: TypePointer Uniform 242
300: TypePointer Uniform 42(fvec4)
309: 115(int) Constant 6
313: 115(int) Constant 5
324: TypePointer Input 18
325(input.TessLevelOuter): 324(ptr) Variable Input
326: TypePointer Input 7(float)
339: TypePointer Input 21
340(input.TessLevelInner): 339(ptr) Variable Input
348: TypePointer Input 44(fvec3)
349(TessCoord): 348(ptr) Variable Input
354: TypePointer Function 60
356: TypeArray 42(fvec4) 17
357: TypePointer Input 356
358(patch.Pos): 357(ptr) Variable Input
359: TypePointer Input 42(fvec4)
363: TypeArray 44(fvec3) 17
364: TypePointer Input 363
365(patch.Normal): 364(ptr) Variable Input
369: TypeArray 39(fvec2) 17
370: TypePointer Input 369
371(patch.UV): 370(ptr) Variable Input
372: TypePointer Input 39(fvec2)
410: TypePointer Output 42(fvec4)
411(@entryPointOutput.Pos): 410(ptr) Variable Output
414: TypePointer Output 44(fvec3)
415(@entryPointOutput.Normal): 414(ptr) Variable Output
418: TypePointer Output 39(fvec2)
419(@entryPointOutput.UV): 418(ptr) Variable Output
422(@entryPointOutput.ViewVec): 414(ptr) Variable Output
425(@entryPointOutput.LightVec): 414(ptr) Variable Output
428(@entryPointOutput.EyePos): 414(ptr) Variable Output
431(@entryPointOutput.WorldPos): 414(ptr) Variable Output
5(main): 3 Function None 4
6: Label
323(input): 38(ptr) Variable Function
347(TessCoord): 41(ptr) Variable Function
355(patch): 354(ptr) Variable Function
403(flattenTemp): 100(ptr) Variable Function
405(param): 38(ptr) Variable Function
407(param): 41(ptr) Variable Function
327: 326(ptr) AccessChain 325(input.TessLevelOuter) 118
328: 7(float) Load 327
329: 123(ptr) AccessChain 323(input) 118 118
Store 329 328
330: 326(ptr) AccessChain 325(input.TessLevelOuter) 121
331: 7(float) Load 330
332: 123(ptr) AccessChain 323(input) 118 121
Store 332 331
333: 326(ptr) AccessChain 325(input.TessLevelOuter) 119
334: 7(float) Load 333
335: 123(ptr) AccessChain 323(input) 118 119
Store 335 334
336: 326(ptr) AccessChain 325(input.TessLevelOuter) 133
337: 7(float) Load 336
338: 123(ptr) AccessChain 323(input) 118 133
Store 338 337
341: 326(ptr) AccessChain 340(input.TessLevelInner) 118
342: 7(float) Load 341
343: 123(ptr) AccessChain 323(input) 121 118
Store 343 342
344: 326(ptr) AccessChain 340(input.TessLevelInner) 121
345: 7(float) Load 344
346: 123(ptr) AccessChain 323(input) 121 121
Store 346 345
350: 44(fvec3) Load 349(TessCoord)
351: 7(float) CompositeExtract 350 0
352: 7(float) CompositeExtract 350 1
353: 39(fvec2) CompositeConstruct 351 352
Store 347(TessCoord) 353
360: 359(ptr) AccessChain 358(patch.Pos) 118
361: 42(fvec4) Load 360
362: 178(ptr) AccessChain 355(patch) 118 118
Store 362 361
366: 348(ptr) AccessChain 365(patch.Normal) 118
367: 44(fvec3) Load 366
368: 148(ptr) AccessChain 355(patch) 118 121
Store 368 367
373: 372(ptr) AccessChain 371(patch.UV) 118
374: 39(fvec2) Load 373
375: 41(ptr) AccessChain 355(patch) 118 119
Store 375 374
376: 359(ptr) AccessChain 358(patch.Pos) 121
377: 42(fvec4) Load 376
378: 178(ptr) AccessChain 355(patch) 121 118
Store 378 377
379: 348(ptr) AccessChain 365(patch.Normal) 121
380: 44(fvec3) Load 379
381: 148(ptr) AccessChain 355(patch) 121 121
Store 381 380
382: 372(ptr) AccessChain 371(patch.UV) 121
383: 39(fvec2) Load 382
384: 41(ptr) AccessChain 355(patch) 121 119
Store 384 383
385: 359(ptr) AccessChain 358(patch.Pos) 119
386: 42(fvec4) Load 385
387: 178(ptr) AccessChain 355(patch) 119 118
Store 387 386
388: 348(ptr) AccessChain 365(patch.Normal) 119
389: 44(fvec3) Load 388
390: 148(ptr) AccessChain 355(patch) 119 121
Store 390 389
391: 372(ptr) AccessChain 371(patch.UV) 119
392: 39(fvec2) Load 391
393: 41(ptr) AccessChain 355(patch) 119 119
Store 393 392
394: 359(ptr) AccessChain 358(patch.Pos) 133
395: 42(fvec4) Load 394
396: 178(ptr) AccessChain 355(patch) 133 118
Store 396 395
397: 348(ptr) AccessChain 365(patch.Normal) 133
398: 44(fvec3) Load 397
399: 148(ptr) AccessChain 355(patch) 133 121
Store 399 398
400: 372(ptr) AccessChain 371(patch.UV) 133
401: 39(fvec2) Load 400
402: 41(ptr) AccessChain 355(patch) 133 119
Store 402 401
404: 60 Load 355(patch)
406:23(ConstantsHSOutput) Load 323(input)
Store 405(param) 406
408: 39(fvec2) Load 347(TessCoord)
Store 407(param) 408
409:62(DSOutput) FunctionCall 83(@main(struct-ConstantsHSOutput-f1[4]-f1[2]1;vf2;struct-HSOutput-vf4-vf3-vf21[4];) 405(param) 407(param) 404
Store 403(flattenTemp) 409
412: 178(ptr) AccessChain 403(flattenTemp) 118
413: 42(fvec4) Load 412
Store 411(@entryPointOutput.Pos) 413
416: 148(ptr) AccessChain 403(flattenTemp) 121
417: 44(fvec3) Load 416
Store 415(@entryPointOutput.Normal) 417
420: 41(ptr) AccessChain 403(flattenTemp) 119
421: 39(fvec2) Load 420
Store 419(@entryPointOutput.UV) 421
423: 148(ptr) AccessChain 403(flattenTemp) 133
424: 44(fvec3) Load 423
Store 422(@entryPointOutput.ViewVec) 424
426: 148(ptr) AccessChain 403(flattenTemp) 278
427: 44(fvec3) Load 426
Store 425(@entryPointOutput.LightVec) 427
429: 148(ptr) AccessChain 403(flattenTemp) 313
430: 44(fvec3) Load 429
Store 428(@entryPointOutput.EyePos) 430
432: 148(ptr) AccessChain 403(flattenTemp) 309
433: 44(fvec3) Load 432
Store 431(@entryPointOutput.WorldPos) 433
Return
FunctionEnd
83(@main(struct-ConstantsHSOutput-f1[4]-f1[2]1;vf2;struct-HSOutput-vf4-vf3-vf21[4];):62(DSOutput) Function None 78
80(input): 38(ptr) FunctionParameter
81(TessCoord): 41(ptr) FunctionParameter
82(patch): 60 FunctionParameter
86: Label
101(output): 100(ptr) Variable Function
111(uv1): 41(ptr) Variable Function
129(uv2): 41(ptr) Variable Function
149(n1): 148(ptr) Variable Function
160(n2): 148(ptr) Variable Function
179(pos1): 178(ptr) Variable Function
190(pos2): 178(ptr) Variable Function
201(pos): 178(ptr) Variable Function
87: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(Acosh) 85
88: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103 26 15 15 15 15
91: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 89 80(input) 92
95: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 93 81(TessCoord) 92
98: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 96 82(patch) 92
99: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 85 83(@main(struct-ConstantsHSOutput-f1[4]-f1[2]1;vf2;struct-HSOutput-vf4-vf3-vf21[4];)
Store 101(output) 109
110: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 102 109 92
120: 39(fvec2) CompositeExtract 82(patch) 0 2
122: 39(fvec2) CompositeExtract 82(patch) 1 2
124: 123(ptr) AccessChain 81(TessCoord) 15
125: 7(float) Load 124
126: 39(fvec2) CompositeConstruct 125 125
127: 39(fvec2) ExtInst 2(GLSL.std.450) 46(FMix) 120 122 126
Store 111(uv1) 127
128: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 112 127 92
134: 39(fvec2) CompositeExtract 82(patch) 3 2
135: 39(fvec2) CompositeExtract 82(patch) 2 2
136: 123(ptr) AccessChain 81(TessCoord) 15
137: 7(float) Load 136
138: 39(fvec2) CompositeConstruct 137 137
139: 39(fvec2) ExtInst 2(GLSL.std.450) 46(FMix) 134 135 138
Store 129(uv2) 139
140: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 130 139 92
141: 39(fvec2) Load 111(uv1)
142: 39(fvec2) Load 129(uv2)
143: 123(ptr) AccessChain 81(TessCoord) 35
144: 7(float) Load 143
145: 39(fvec2) CompositeConstruct 144 144
146: 39(fvec2) ExtInst 2(GLSL.std.450) 46(FMix) 141 142 145
147: 41(ptr) AccessChain 101(output) 119
Store 147 146
153: 44(fvec3) CompositeExtract 82(patch) 0 1
154: 44(fvec3) CompositeExtract 82(patch) 1 1
155: 123(ptr) AccessChain 81(TessCoord) 15
156: 7(float) Load 155
157: 44(fvec3) CompositeConstruct 156 156 156
158: 44(fvec3) ExtInst 2(GLSL.std.450) 46(FMix) 153 154 157
Store 149(n1) 158
159: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 150 158 92
164: 44(fvec3) CompositeExtract 82(patch) 3 1
165: 44(fvec3) CompositeExtract 82(patch) 2 1
166: 123(ptr) AccessChain 81(TessCoord) 15
167: 7(float) Load 166
168: 44(fvec3) CompositeConstruct 167 167 167
169: 44(fvec3) ExtInst 2(GLSL.std.450) 46(FMix) 164 165 168
Store 160(n2) 169
170: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 161 169 92
171: 44(fvec3) Load 149(n1)
172: 44(fvec3) Load 160(n2)
173: 123(ptr) AccessChain 81(TessCoord) 35
174: 7(float) Load 173
175: 44(fvec3) CompositeConstruct 174 174 174
176: 44(fvec3) ExtInst 2(GLSL.std.450) 46(FMix) 171 172 175
177: 148(ptr) AccessChain 101(output) 121
Store 177 176
183: 42(fvec4) CompositeExtract 82(patch) 0 0
184: 42(fvec4) CompositeExtract 82(patch) 1 0
185: 123(ptr) AccessChain 81(TessCoord) 15
186: 7(float) Load 185
187: 42(fvec4) CompositeConstruct 186 186 186 186
188: 42(fvec4) ExtInst 2(GLSL.std.450) 46(FMix) 183 184 187
Store 179(pos1) 188
189: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 180 188 92
194: 42(fvec4) CompositeExtract 82(patch) 3 0
195: 42(fvec4) CompositeExtract 82(patch) 2 0
196: 123(ptr) AccessChain 81(TessCoord) 15
197: 7(float) Load 196
198: 42(fvec4) CompositeConstruct 197 197 197 197
199: 42(fvec4) ExtInst 2(GLSL.std.450) 46(FMix) 194 195 198
Store 190(pos2) 199
200: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 191 199 92
205: 42(fvec4) Load 179(pos1)
206: 42(fvec4) Load 190(pos2)
207: 123(ptr) AccessChain 81(TessCoord) 35
208: 7(float) Load 207
209: 42(fvec4) CompositeConstruct 208 208 208 208
210: 42(fvec4) ExtInst 2(GLSL.std.450) 46(FMix) 205 206 209
Store 201(pos) 210
211: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 202 210 92
223: 212 Load 219(displacementMapTexture)
232: 224 Load 229(displacementMapSampler)
237: 233 SampledImage 223 232
238: 41(ptr) AccessChain 101(output) 119
239: 39(fvec2) Load 238
240: 42(fvec4) ImageSampleExplicitLod 237 239 Lod 105
241: 7(float) CompositeExtract 240 0
280: 279(ptr) AccessChain 276 118 278
281: 7(float) Load 280
282: 7(float) FMul 241 281
283: 123(ptr) AccessChain 201(pos) 35
284: 7(float) Load 283
285: 7(float) FSub 284 282
286: 123(ptr) AccessChain 201(pos) 35
Store 286 285
287: 42(fvec4) Load 201(pos)
289: 288(ptr) AccessChain 276 118 121
290: 242 Load 289
291: 42(fvec4) VectorTimesMatrix 287 290
292: 288(ptr) AccessChain 276 118 118
293: 242 Load 292
294: 42(fvec4) VectorTimesMatrix 291 293
295: 178(ptr) AccessChain 101(output) 118
Store 295 294
296: 42(fvec4) Load 201(pos)
297: 44(fvec3) VectorShuffle 296 296 0 1 2
298: 44(fvec3) FNegate 297
299: 148(ptr) AccessChain 101(output) 133
Store 299 298
301: 300(ptr) AccessChain 276 118 119
302: 42(fvec4) Load 301
303: 44(fvec3) VectorShuffle 302 302 0 1 2
304: 148(ptr) AccessChain 101(output) 133
305: 44(fvec3) Load 304
306: 44(fvec3) FAdd 303 305
307: 44(fvec3) ExtInst 2(GLSL.std.450) 69(Normalize) 306
308: 148(ptr) AccessChain 101(output) 278
Store 308 307
310: 42(fvec4) Load 201(pos)
311: 44(fvec3) VectorShuffle 310 310 0 1 2
312: 148(ptr) AccessChain 101(output) 309
Store 312 311
314: 42(fvec4) Load 201(pos)
315: 288(ptr) AccessChain 276 118 121
316: 242 Load 315
317: 42(fvec4) VectorTimesMatrix 314 316
318: 44(fvec3) VectorShuffle 317 317 0 1 2
319: 148(ptr) AccessChain 101(output) 313
Store 319 318
320:62(DSOutput) Load 101(output)
ReturnValue 320
FunctionEnd

View File

@ -0,0 +1,580 @@
spv.debuginfo.hlsl.vert
Validation failed
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 443
Capability Shader
Extension "SPV_KHR_non_semantic_info"
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
2: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 5 "main" 392 395 399 402 405 408 412 416 424 428 431 434 437 440
9: String "float"
12: String "uint"
23: String "int"
28: String "instanceRot"
30: String ""
35: String "UV"
42: String "instanceScale"
46: String "instanceTexIndex"
50: String "VSInput"
59: String "Pos"
63: String "LightVec"
70: String "VSOutput"
75: String "@main"
81: String "input"
88: String "output"
116: String "s"
127: String "modelview"
132: String "lightPos"
136: String "globSpeed"
140: String "UBO"
143: String "ubo"
159: String "c"
173: String "mx"
202: String "my"
230: String "mz"
244: String "rotMat"
270: String "gRotMat"
289: String "locPos"
302: String "pos"
361: String "lPos"
Name 5 "main"
Name 26 "VSInput"
MemberName 26(VSInput) 0 "Pos"
MemberName 26(VSInput) 1 "Normal"
MemberName 26(VSInput) 2 "UV"
MemberName 26(VSInput) 3 "Color"
MemberName 26(VSInput) 4 "instancePos"
MemberName 26(VSInput) 5 "instanceRot"
MemberName 26(VSInput) 6 "instanceScale"
MemberName 26(VSInput) 7 "instanceTexIndex"
Name 57 "VSOutput"
MemberName 57(VSOutput) 0 "Pos"
MemberName 57(VSOutput) 1 "Normal"
MemberName 57(VSOutput) 2 "Color"
MemberName 57(VSOutput) 3 "UV"
MemberName 57(VSOutput) 4 "ViewVec"
MemberName 57(VSOutput) 5 "LightVec"
Name 74 "@main(struct-VSInput-vf3-vf3-vf2-vf3-vf3-vf3-f1-i11;"
Name 73 "input"
Name 86 "output"
Name 114 "s"
Name 125 "UBO"
MemberName 125(UBO) 0 "projection"
MemberName 125(UBO) 1 "modelview"
MemberName 125(UBO) 2 "lightPos"
MemberName 125(UBO) 3 "locSpeed"
MemberName 125(UBO) 4 "globSpeed"
Name 141 "ubo"
MemberName 141(ubo) 0 "ubo"
Name 147 ""
Name 157 "c"
Name 171 "mx"
Name 200 "my"
Name 228 "mz"
Name 242 "rotMat"
Name 268 "gRotMat"
Name 287 "locPos"
Name 300 "pos"
Name 359 "lPos"
Name 390 "input"
Name 392 "input.Pos"
Name 395 "input.Normal"
Name 399 "input.UV"
Name 402 "input.Color"
Name 405 "input.instancePos"
Name 408 "input.instanceRot"
Name 412 "input.instanceScale"
Name 416 "input.instanceTexIndex"
Name 419 "flattenTemp"
Name 420 "param"
Name 424 "@entryPointOutput.Pos"
Name 428 "@entryPointOutput.Normal"
Name 431 "@entryPointOutput.Color"
Name 434 "@entryPointOutput.UV"
Name 437 "@entryPointOutput.ViewVec"
Name 440 "@entryPointOutput.LightVec"
MemberDecorate 125(UBO) 0 RowMajor
MemberDecorate 125(UBO) 0 Offset 0
MemberDecorate 125(UBO) 0 MatrixStride 16
MemberDecorate 125(UBO) 1 RowMajor
MemberDecorate 125(UBO) 1 Offset 64
MemberDecorate 125(UBO) 1 MatrixStride 16
MemberDecorate 125(UBO) 2 Offset 128
MemberDecorate 125(UBO) 3 Offset 144
MemberDecorate 125(UBO) 4 Offset 148
MemberDecorate 141(ubo) 0 Offset 0
Decorate 141(ubo) Block
Decorate 147 DescriptorSet 0
Decorate 147 Binding 0
Decorate 392(input.Pos) Location 0
Decorate 395(input.Normal) Location 1
Decorate 399(input.UV) Location 2
Decorate 402(input.Color) Location 3
Decorate 405(input.instancePos) Location 4
Decorate 408(input.instanceRot) Location 5
Decorate 412(input.instanceScale) Location 6
Decorate 416(input.instanceTexIndex) Location 7
Decorate 424(@entryPointOutput.Pos) BuiltIn Position
Decorate 428(@entryPointOutput.Normal) Location 0
Decorate 431(@entryPointOutput.Color) Location 1
Decorate 434(@entryPointOutput.UV) Location 2
Decorate 437(@entryPointOutput.ViewVec) Location 3
Decorate 440(@entryPointOutput.LightVec) Location 4
3: TypeVoid
4: TypeFunction 3
7: TypeFloat 32
10: TypeInt 32 0
13: 10(int) Constant 32
14: 10(int) Constant 6
15: 10(int) Constant 0
11: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 12 13 14 15
16: 10(int) Constant 3
8: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 9 13 16 15
17: TypeVector 7(float) 3
18: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 8 16
19: TypeVector 7(float) 2
20: 10(int) Constant 2
21: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 8 20
22: TypeInt 32 1
25: 10(int) Constant 4
24: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(RoundEven) 23 13 25 15
26(VSInput): TypeStruct 17(fvec3) 17(fvec3) 19(fvec2) 17(fvec3) 17(fvec3) 17(fvec3) 7(float) 22(int)
29: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 35(Modf) 0 30
31: 10(int) Constant 35
32: 10(int) Constant 40
27: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 28 18 29 31 32 15 15 16
33: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 28 18 29 31 32 15 15 16
36: 10(int) Constant 30
37: 10(int) Constant 31
34: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 35 21 29 36 37 15 15 16
38: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 28 18 29 31 32 15 15 16
39: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 28 18 29 31 32 15 15 16
40: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 28 18 29 31 32 15 15 16
43: 10(int) Constant 36
44: 10(int) Constant 41
41: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 42 8 29 43 44 15 15 16
47: 10(int) Constant 37
48: 10(int) Constant 42
45: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 46 24 29 47 48 15 15 16
51: 10(int) Constant 1
53: 10(int) Constant 5
52: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 1(Round) 51 25 29 53
49: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 50 51 29 15 15 52 50 15 16 27 33 34 38 39 40 41 45
54: TypePointer Function 26(VSInput)
55: TypeVector 7(float) 4
56: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 6(FSign) 8 25
57(VSOutput): TypeStruct 55(fvec4) 17(fvec3) 17(fvec3) 17(fvec3) 17(fvec3) 17(fvec3)
60: 10(int) Constant 53
61: 10(int) Constant 13
58: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 59 56 29 60 61 15 15 16
64: 10(int) Constant 58
62: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 63 18 29 64 47 15 15 16
65: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 63 18 29 64 47 15 15 16
66: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 63 18 29 64 47 15 15 16
67: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 63 18 29 64 47 15 15 16
68: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 63 18 29 64 47 15 15 16
69: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 70 51 29 15 15 52 70 15 16 58 62 65 66 67 68
71: TypeFunction 57(VSOutput) 54(ptr)
72: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 8(Floor) 16 69 49
76: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 20(Cosh) 75 72 29 15 15 52 75 16 15
80: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 81 49 29 15 15 76 25 51
83: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 31(Sqrt)
85: TypePointer Function 57(VSOutput)
89: 10(int) Constant 63
87: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 88 69 29 89 15 76 25
90: 7(float) Constant 0
91: 55(fvec4) ConstantComposite 90 90 90 90
92: 17(fvec3) ConstantComposite 90 90 90
93:57(VSOutput) ConstantComposite 91 92 92 92 92 92
95: 22(int) Constant 2
96: 22(int) Constant 3
97: TypePointer Function 17(fvec3)
101: TypePointer Function 19(fvec2)
104: 22(int) Constant 7
105: TypePointer Function 22(int)
113: TypePointer Function 7(float)
117: 10(int) Constant 68
115: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 116 8 29 117 15 76 25
118: 22(int) Constant 5
121: TypeMatrix 55(fvec4) 4
123: TypeBool
124: 123(bool) ConstantTrue
122: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 56 25 124
125(UBO): TypeStruct 121 121 55(fvec4) 7(float) 7(float)
128: 10(int) Constant 43
129: 10(int) Constant 20
126: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 127 122 29 128 129 15 15 16
130: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 127 122 29 128 129 15 15 16
133: 10(int) Constant 44
134: 10(int) Constant 17
131: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 132 56 29 133 134 15 15 16
137: 10(int) Constant 46
135: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 136 8 29 137 134 15 15 16
138: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 136 8 29 137 134 15 15 16
139: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 140 51 29 117 15 52 140 15 16 126 130 131 135 138
141(ubo): TypeStruct 125(UBO)
144: 10(int) Constant 49
142: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(Radians) 143 139 29 144 47 15 15 16
145: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(Fract) 143 51 29 117 15 52 143 15 16 142
146: TypePointer Uniform 141(ubo)
147: 146(ptr) Variable Uniform
149: 10(int) Constant 8
148: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(Atan) 30 145 29 117 15 52 30 147 149
150: 22(int) Constant 0
151: TypePointer Uniform 7(float)
160: 10(int) Constant 69
158: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 159 8 29 160 15 76 25
168: TypeMatrix 17(fvec3) 3
169: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 108 18 16 124
170: TypePointer Function 168
174: 10(int) Constant 71
172: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 173 169 29 174 15 76 25
180: 7(float) Constant 1065353216
203: 10(int) Constant 79
201: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 202 169 29 203 15 76 25
231: 10(int) Constant 87
229: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 230 169 29 231 15 76 25
245: 10(int) Constant 91
243: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 244 169 29 245 15 76 25
254: 22(int) Constant 4
267: TypePointer Function 121
271: 10(int) Constant 96
269: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 270 122 29 271 15 76 25
276: TypePointer Function 55(fvec4)
278: 22(int) Constant 1
279: 55(fvec4) ConstantComposite 90 180 90 90
285: 55(fvec4) ConstantComposite 90 90 90 180
290: 10(int) Constant 101
288: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 289 56 29 290 15 76 25
303: 10(int) Constant 102
301: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 302 56 29 303 15 76 25
306: 22(int) Constant 6
321: TypePointer Uniform 121
362: 10(int) Constant 108
360: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(Pow) 361 18 29 362 15 76 25
363: TypePointer Uniform 55(fvec4)
391: TypePointer Input 17(fvec3)
392(input.Pos): 391(ptr) Variable Input
395(input.Normal): 391(ptr) Variable Input
398: TypePointer Input 19(fvec2)
399(input.UV): 398(ptr) Variable Input
402(input.Color): 391(ptr) Variable Input
405(input.instancePos): 391(ptr) Variable Input
408(input.instanceRot): 391(ptr) Variable Input
411: TypePointer Input 7(float)
412(input.instanceScale): 411(ptr) Variable Input
415: TypePointer Input 22(int)
416(input.instanceTexIndex): 415(ptr) Variable Input
423: TypePointer Output 55(fvec4)
424(@entryPointOutput.Pos): 423(ptr) Variable Output
427: TypePointer Output 17(fvec3)
428(@entryPointOutput.Normal): 427(ptr) Variable Output
431(@entryPointOutput.Color): 427(ptr) Variable Output
434(@entryPointOutput.UV): 427(ptr) Variable Output
437(@entryPointOutput.ViewVec): 427(ptr) Variable Output
440(@entryPointOutput.LightVec): 427(ptr) Variable Output
5(main): 3 Function None 4
6: Label
390(input): 54(ptr) Variable Function
419(flattenTemp): 85(ptr) Variable Function
420(param): 54(ptr) Variable Function
393: 17(fvec3) Load 392(input.Pos)
394: 97(ptr) AccessChain 390(input) 150
Store 394 393
396: 17(fvec3) Load 395(input.Normal)
397: 97(ptr) AccessChain 390(input) 278
Store 397 396
400: 19(fvec2) Load 399(input.UV)
401: 101(ptr) AccessChain 390(input) 95
Store 401 400
403: 17(fvec3) Load 402(input.Color)
404: 97(ptr) AccessChain 390(input) 96
Store 404 403
406: 17(fvec3) Load 405(input.instancePos)
407: 97(ptr) AccessChain 390(input) 254
Store 407 406
409: 17(fvec3) Load 408(input.instanceRot)
410: 97(ptr) AccessChain 390(input) 118
Store 410 409
413: 7(float) Load 412(input.instanceScale)
414: 113(ptr) AccessChain 390(input) 306
Store 414 413
417: 22(int) Load 416(input.instanceTexIndex)
418: 105(ptr) AccessChain 390(input) 104
Store 418 417
421: 26(VSInput) Load 390(input)
Store 420(param) 421
422:57(VSOutput) FunctionCall 74(@main(struct-VSInput-vf3-vf3-vf2-vf3-vf3-vf3-f1-i11;) 420(param)
Store 419(flattenTemp) 422
425: 276(ptr) AccessChain 419(flattenTemp) 150
426: 55(fvec4) Load 425
Store 424(@entryPointOutput.Pos) 426
429: 97(ptr) AccessChain 419(flattenTemp) 278
430: 17(fvec3) Load 429
Store 428(@entryPointOutput.Normal) 430
432: 97(ptr) AccessChain 419(flattenTemp) 95
433: 17(fvec3) Load 432
Store 431(@entryPointOutput.Color) 433
435: 97(ptr) AccessChain 419(flattenTemp) 96
436: 17(fvec3) Load 435
Store 434(@entryPointOutput.UV) 436
438: 97(ptr) AccessChain 419(flattenTemp) 254
439: 17(fvec3) Load 438
Store 437(@entryPointOutput.ViewVec) 439
441: 97(ptr) AccessChain 419(flattenTemp) 118
442: 17(fvec3) Load 441
Store 440(@entryPointOutput.LightVec) 442
Return
FunctionEnd
74(@main(struct-VSInput-vf3-vf3-vf2-vf3-vf3-vf3-f1-i11;):57(VSOutput) Function None 71
73(input): 54(ptr) FunctionParameter
77: Label
86(output): 85(ptr) Variable Function
114(s): 113(ptr) Variable Function
157(c): 113(ptr) Variable Function
171(mx): 170(ptr) Variable Function
200(my): 170(ptr) Variable Function
228(mz): 170(ptr) Variable Function
242(rotMat): 170(ptr) Variable Function
268(gRotMat): 267(ptr) Variable Function
287(locPos): 276(ptr) Variable Function
300(pos): 276(ptr) Variable Function
359(lPos): 97(ptr) Variable Function
78: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(Acosh) 76
79: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103 29 15 15 15 15
82: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(Log) 80 73(input) 83
84: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101 76 74(@main(struct-VSInput-vf3-vf3-vf2-vf3-vf3-vf3-f1-i11;)
Store 86(output) 93
94: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 87 93 83
98: 97(ptr) AccessChain 73(input) 96
99: 17(fvec3) Load 98
100: 97(ptr) AccessChain 86(output) 95
Store 100 99
102: 101(ptr) AccessChain 73(input) 95
103: 19(fvec2) Load 102
106: 105(ptr) AccessChain 73(input) 104
107: 22(int) Load 106
108: 7(float) ConvertSToF 107
109: 7(float) CompositeExtract 103 0
110: 7(float) CompositeExtract 103 1
111: 17(fvec3) CompositeConstruct 109 110 108
112: 97(ptr) AccessChain 86(output) 96
Store 112 111
119: 113(ptr) AccessChain 73(input) 118 15
120: 7(float) Load 119
152: 151(ptr) AccessChain 147 150 96
153: 7(float) Load 152
154: 7(float) FAdd 120 153
155: 7(float) ExtInst 2(GLSL.std.450) 13(Sin) 154
Store 114(s) 155
156: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 115 155 83
161: 113(ptr) AccessChain 73(input) 118 15
162: 7(float) Load 161
163: 151(ptr) AccessChain 147 150 96
164: 7(float) Load 163
165: 7(float) FAdd 162 164
166: 7(float) ExtInst 2(GLSL.std.450) 14(Cos) 165
Store 157(c) 166
167: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 158 166 83
175: 7(float) Load 157(c)
176: 7(float) Load 114(s)
177: 7(float) FNegate 176
178: 7(float) Load 114(s)
179: 7(float) Load 157(c)
181: 17(fvec3) CompositeConstruct 175 177 90
182: 17(fvec3) CompositeConstruct 178 179 90
183: 17(fvec3) CompositeConstruct 90 90 180
184: 168 CompositeConstruct 181 182 183
Store 171(mx) 184
185: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 172 184 83
186: 113(ptr) AccessChain 73(input) 118 51
187: 7(float) Load 186
188: 151(ptr) AccessChain 147 150 96
189: 7(float) Load 188
190: 7(float) FAdd 187 189
191: 7(float) ExtInst 2(GLSL.std.450) 13(Sin) 190
Store 114(s) 191
192: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 115 191 83
193: 113(ptr) AccessChain 73(input) 118 51
194: 7(float) Load 193
195: 151(ptr) AccessChain 147 150 96
196: 7(float) Load 195
197: 7(float) FAdd 194 196
198: 7(float) ExtInst 2(GLSL.std.450) 14(Cos) 197
Store 157(c) 198
199: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 158 198 83
204: 7(float) Load 157(c)
205: 7(float) Load 114(s)
206: 7(float) FNegate 205
207: 7(float) Load 114(s)
208: 7(float) Load 157(c)
209: 17(fvec3) CompositeConstruct 204 90 206
210: 17(fvec3) CompositeConstruct 90 180 90
211: 17(fvec3) CompositeConstruct 207 90 208
212: 168 CompositeConstruct 209 210 211
Store 200(my) 212
213: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 201 212 83
214: 113(ptr) AccessChain 73(input) 118 20
215: 7(float) Load 214
216: 151(ptr) AccessChain 147 150 96
217: 7(float) Load 216
218: 7(float) FAdd 215 217
219: 7(float) ExtInst 2(GLSL.std.450) 13(Sin) 218
Store 114(s) 219
220: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 115 219 83
221: 113(ptr) AccessChain 73(input) 118 20
222: 7(float) Load 221
223: 151(ptr) AccessChain 147 150 96
224: 7(float) Load 223
225: 7(float) FAdd 222 224
226: 7(float) ExtInst 2(GLSL.std.450) 14(Cos) 225
Store 157(c) 226
227: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 158 226 83
232: 7(float) Load 157(c)
233: 7(float) Load 114(s)
234: 7(float) FNegate 233
235: 7(float) Load 114(s)
236: 7(float) Load 157(c)
237: 17(fvec3) CompositeConstruct 180 90 90
238: 17(fvec3) CompositeConstruct 90 232 234
239: 17(fvec3) CompositeConstruct 90 235 236
240: 168 CompositeConstruct 237 238 239
Store 228(mz) 240
241: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 229 240 83
246: 168 Load 171(mx)
247: 168 Load 200(my)
248: 168 MatrixTimesMatrix 246 247
249: 168 Load 228(mz)
250: 168 MatrixTimesMatrix 248 249
Store 242(rotMat) 250
251: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 243 250 83
252: 113(ptr) AccessChain 73(input) 118 51
253: 7(float) Load 252
255: 151(ptr) AccessChain 147 150 254
256: 7(float) Load 255
257: 7(float) FAdd 253 256
258: 7(float) ExtInst 2(GLSL.std.450) 13(Sin) 257
Store 114(s) 258
259: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 115 258 83
260: 113(ptr) AccessChain 73(input) 118 51
261: 7(float) Load 260
262: 151(ptr) AccessChain 147 150 254
263: 7(float) Load 262
264: 7(float) FAdd 261 263
265: 7(float) ExtInst 2(GLSL.std.450) 14(Cos) 264
Store 157(c) 265
266: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 158 265 83
272: 7(float) Load 157(c)
273: 7(float) Load 114(s)
274: 7(float) FNegate 273
275: 55(fvec4) CompositeConstruct 272 90 274 90
277: 276(ptr) AccessChain 268(gRotMat) 150
Store 277 275
280: 276(ptr) AccessChain 268(gRotMat) 278
Store 280 279
281: 7(float) Load 114(s)
282: 7(float) Load 157(c)
283: 55(fvec4) CompositeConstruct 281 90 282 90
284: 276(ptr) AccessChain 268(gRotMat) 95
Store 284 283
286: 276(ptr) AccessChain 268(gRotMat) 96
Store 286 285
291: 97(ptr) AccessChain 73(input) 150
292: 17(fvec3) Load 291
293: 168 Load 242(rotMat)
294: 17(fvec3) VectorTimesMatrix 292 293
295: 7(float) CompositeExtract 294 0
296: 7(float) CompositeExtract 294 1
297: 7(float) CompositeExtract 294 2
298: 55(fvec4) CompositeConstruct 295 296 297 180
Store 287(locPos) 298
299: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 288 298 83
304: 55(fvec4) Load 287(locPos)
305: 17(fvec3) VectorShuffle 304 304 0 1 2
307: 113(ptr) AccessChain 73(input) 306
308: 7(float) Load 307
309: 17(fvec3) VectorTimesScalar 305 308
310: 97(ptr) AccessChain 73(input) 254
311: 17(fvec3) Load 310
312: 17(fvec3) FAdd 309 311
313: 7(float) CompositeExtract 312 0
314: 7(float) CompositeExtract 312 1
315: 7(float) CompositeExtract 312 2
316: 55(fvec4) CompositeConstruct 313 314 315 180
Store 300(pos) 316
317: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 301 316 83
318: 55(fvec4) Load 300(pos)
319: 121 Load 268(gRotMat)
320: 55(fvec4) VectorTimesMatrix 318 319
322: 321(ptr) AccessChain 147 150 278
323: 121 Load 322
324: 55(fvec4) VectorTimesMatrix 320 323
325: 321(ptr) AccessChain 147 150 150
326: 121 Load 325
327: 55(fvec4) VectorTimesMatrix 324 326
328: 276(ptr) AccessChain 86(output) 150
Store 328 327
329: 97(ptr) AccessChain 73(input) 278
330: 17(fvec3) Load 329
331: 168 Load 242(rotMat)
332: 17(fvec3) VectorTimesMatrix 330 331
333: 121 Load 268(gRotMat)
334: 321(ptr) AccessChain 147 150 278
335: 121 Load 334
336: 121 MatrixTimesMatrix 333 335
337: 55(fvec4) CompositeExtract 336 0
338: 17(fvec3) VectorShuffle 337 337 0 1 2
339: 55(fvec4) CompositeExtract 336 1
340: 17(fvec3) VectorShuffle 339 339 0 1 2
341: 55(fvec4) CompositeExtract 336 2
342: 17(fvec3) VectorShuffle 341 341 0 1 2
343: 168 CompositeConstruct 338 340 342
344: 17(fvec3) VectorTimesMatrix 332 343
345: 97(ptr) AccessChain 86(output) 278
Store 345 344
346: 97(ptr) AccessChain 73(input) 150
347: 17(fvec3) Load 346
348: 97(ptr) AccessChain 73(input) 254
349: 17(fvec3) Load 348
350: 17(fvec3) FAdd 347 349
351: 7(float) CompositeExtract 350 0
352: 7(float) CompositeExtract 350 1
353: 7(float) CompositeExtract 350 2
354: 55(fvec4) CompositeConstruct 351 352 353 180
355: 321(ptr) AccessChain 147 150 278
356: 121 Load 355
357: 55(fvec4) VectorTimesMatrix 354 356
Store 300(pos) 357
358: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 301 357 83
364: 363(ptr) AccessChain 147 150 95
365: 55(fvec4) Load 364
366: 17(fvec3) VectorShuffle 365 365 0 1 2
367: 321(ptr) AccessChain 147 150 278
368: 121 Load 367
369: 55(fvec4) CompositeExtract 368 0
370: 17(fvec3) VectorShuffle 369 369 0 1 2
371: 55(fvec4) CompositeExtract 368 1
372: 17(fvec3) VectorShuffle 371 371 0 1 2
373: 55(fvec4) CompositeExtract 368 2
374: 17(fvec3) VectorShuffle 373 373 0 1 2
375: 168 CompositeConstruct 370 372 374
376: 17(fvec3) VectorTimesMatrix 366 375
Store 359(lPos) 376
377: 3 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 29(Exp2) 360 376 83
378: 17(fvec3) Load 359(lPos)
379: 55(fvec4) Load 300(pos)
380: 17(fvec3) VectorShuffle 379 379 0 1 2
381: 17(fvec3) FSub 378 380
382: 97(ptr) AccessChain 86(output) 118
Store 382 381
383: 55(fvec4) Load 300(pos)
384: 17(fvec3) VectorShuffle 383 383 0 1 2
385: 17(fvec3) FNegate 384
386: 97(ptr) AccessChain 86(output) 254
Store 386 385
387:57(VSOutput) Load 86(output)
ReturnValue 387
FunctionEnd

View File

@ -0,0 +1,177 @@
/*
The MIT License (MIT)
Copyright (c) 2022 Sascha Willems
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#version 450
struct Particle {
vec4 pos;
vec4 vel;
vec4 uv;
vec4 normal;
float pinned;
};
layout(std430, binding = 0) buffer ParticleIn {
Particle particleIn[ ];
};
layout(std430, binding = 1) buffer ParticleOut {
Particle particleOut[ ];
};
// todo: use shared memory to speed up calculation
layout (local_size_x = 10, local_size_y = 10) in;
layout (binding = 2) uniform UBO
{
float deltaT;
float particleMass;
float springStiffness;
float damping;
float restDistH;
float restDistV;
float restDistD;
float sphereRadius;
vec4 spherePos;
vec4 gravity;
ivec2 particleCount;
} params;
layout (push_constant) uniform PushConsts {
uint calculateNormals;
} pushConsts;
vec3 springForce(vec3 p0, vec3 p1, float restDist)
{
vec3 dist = p0 - p1;
return normalize(dist) * params.springStiffness * (length(dist) - restDist);
}
void main()
{
uvec3 id = gl_GlobalInvocationID;
uint index = id.y * params.particleCount.x + id.x;
if (index > params.particleCount.x * params.particleCount.y)
return;
// Pinned?
if (particleIn[index].pinned == 1.0) {
particleOut[index].pos = particleOut[index].pos;
particleOut[index].vel = vec4(0.0);
return;
}
// Initial force from gravity
vec3 force = params.gravity.xyz * params.particleMass;
vec3 pos = particleIn[index].pos.xyz;
vec3 vel = particleIn[index].vel.xyz;
// Spring forces from neighboring particles
// left
if (id.x > 0) {
force += springForce(particleIn[index-1].pos.xyz, pos, params.restDistH);
}
// right
if (id.x < params.particleCount.x - 1) {
force += springForce(particleIn[index + 1].pos.xyz, pos, params.restDistH);
}
// upper
if (id.y < params.particleCount.y - 1) {
force += springForce(particleIn[index + params.particleCount.x].pos.xyz, pos, params.restDistV);
}
// lower
if (id.y > 0) {
force += springForce(particleIn[index - params.particleCount.x].pos.xyz, pos, params.restDistV);
}
// upper-left
if ((id.x > 0) && (id.y < params.particleCount.y - 1)) {
force += springForce(particleIn[index + params.particleCount.x - 1].pos.xyz, pos, params.restDistD);
}
// lower-left
if ((id.x > 0) && (id.y > 0)) {
force += springForce(particleIn[index - params.particleCount.x - 1].pos.xyz, pos, params.restDistD);
}
// upper-right
if ((id.x < params.particleCount.x - 1) && (id.y < params.particleCount.y - 1)) {
force += springForce(particleIn[index + params.particleCount.x + 1].pos.xyz, pos, params.restDistD);
}
// lower-right
if ((id.x < params.particleCount.x - 1) && (id.y > 0)) {
force += springForce(particleIn[index - params.particleCount.x + 1].pos.xyz, pos, params.restDistD);
}
force += (-params.damping * vel);
// Integrate
vec3 f = force * (1.0 / params.particleMass);
particleOut[index].pos = vec4(pos + vel * params.deltaT + 0.5 * f * params.deltaT * params.deltaT, 1.0);
particleOut[index].vel = vec4(vel + f * params.deltaT, 0.0);
// Sphere collision
vec3 sphereDist = particleOut[index].pos.xyz - params.spherePos.xyz;
if (length(sphereDist) < params.sphereRadius + 0.01) {
// If the particle is inside the sphere, push it to the outer radius
particleOut[index].pos.xyz = params.spherePos.xyz + normalize(sphereDist) * (params.sphereRadius + 0.01);
// Cancel out velocity
particleOut[index].vel = vec4(0.0);
}
// Normals
if (pushConsts.calculateNormals == 1) {
vec3 normal = vec3(0.0);
vec3 a, b, c;
if (id.y > 0) {
if (id.x > 0) {
a = particleIn[index - 1].pos.xyz - pos;
b = particleIn[index - params.particleCount.x - 1].pos.xyz - pos;
c = particleIn[index - params.particleCount.x].pos.xyz - pos;
normal += cross(a,b) + cross(b,c);
}
if (id.x < params.particleCount.x - 1) {
a = particleIn[index - params.particleCount.x].pos.xyz - pos;
b = particleIn[index - params.particleCount.x + 1].pos.xyz - pos;
c = particleIn[index + 1].pos.xyz - pos;
normal += cross(a,b) + cross(b,c);
}
}
if (id.y < params.particleCount.y - 1) {
if (id.x > 0) {
a = particleIn[index + params.particleCount.x].pos.xyz - pos;
b = particleIn[index + params.particleCount.x - 1].pos.xyz - pos;
c = particleIn[index - 1].pos.xyz - pos;
normal += cross(a,b) + cross(b,c);
}
if (id.x < params.particleCount.x - 1) {
a = particleIn[index + 1].pos.xyz - pos;
b = particleIn[index + params.particleCount.x + 1].pos.xyz - pos;
c = particleIn[index + params.particleCount.x].pos.xyz - pos;
normal += cross(a,b) + cross(b,c);
}
}
particleOut[index].normal = vec4(normalize(normal), 0.0f);
}
}

View File

@ -0,0 +1,192 @@
/*
The MIT License (MIT)
Copyright (c) 2022 Sascha Willems
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#version 450
layout (binding = 1) uniform sampler2D samplerposition;
layout (binding = 2) uniform sampler2D samplerNormal;
layout (binding = 3) uniform sampler2D samplerAlbedo;
layout (binding = 5) uniform sampler2DArray samplerShadowMap;
layout (location = 0) in vec2 inUV;
layout (location = 0) out vec4 outFragColor;
#define LIGHT_COUNT 3
#define SHADOW_FACTOR 0.25
#define AMBIENT_LIGHT 0.1
#define USE_PCF
struct Light
{
vec4 position;
vec4 target;
vec4 color;
mat4 viewMatrix;
};
layout (binding = 4) uniform UBO
{
vec4 viewPos;
Light lights[LIGHT_COUNT];
int useShadows;
int debugDisplayTarget;
} ubo;
float textureProj(vec4 P, float layer, vec2 offset)
{
float shadow = 1.0;
vec4 shadowCoord = P / P.w;
shadowCoord.st = shadowCoord.st * 0.5 + 0.5;
if (shadowCoord.z > -1.0 && shadowCoord.z < 1.0)
{
float dist = texture(samplerShadowMap, vec3(shadowCoord.st + offset, layer)).r;
if (shadowCoord.w > 0.0 && dist < shadowCoord.z)
{
shadow = SHADOW_FACTOR;
}
}
return shadow;
}
float filterPCF(vec4 sc, float layer)
{
ivec2 texDim = textureSize(samplerShadowMap, 0).xy;
float scale = 1.5;
float dx = scale * 1.0 / float(texDim.x);
float dy = scale * 1.0 / float(texDim.y);
float shadowFactor = 0.0;
int count = 0;
int range = 1;
for (int x = -range; x <= range; x++)
{
for (int y = -range; y <= range; y++)
{
shadowFactor += textureProj(sc, layer, vec2(dx*x, dy*y));
count++;
}
}
return shadowFactor / count;
}
vec3 shadow(vec3 fragcolor, vec3 fragpos) {
for(int i = 0; i < LIGHT_COUNT; ++i)
{
vec4 shadowClip = ubo.lights[i].viewMatrix * vec4(fragpos, 1.0);
float shadowFactor;
#ifdef USE_PCF
shadowFactor= filterPCF(shadowClip, i);
#else
shadowFactor = textureProj(shadowClip, i, vec2(0.0));
#endif
fragcolor *= shadowFactor;
}
return fragcolor;
}
void main()
{
// Get G-Buffer values
vec3 fragPos = texture(samplerposition, inUV).rgb;
vec3 normal = texture(samplerNormal, inUV).rgb;
vec4 albedo = texture(samplerAlbedo, inUV);
// Debug display
if (ubo.debugDisplayTarget > 0) {
switch (ubo.debugDisplayTarget) {
case 1:
outFragColor.rgb = shadow(vec3(1.0), fragPos).rgb;
break;
case 2:
outFragColor.rgb = fragPos;
break;
case 3:
outFragColor.rgb = normal;
break;
case 4:
outFragColor.rgb = albedo.rgb;
break;
case 5:
outFragColor.rgb = albedo.aaa;
break;
}
outFragColor.a = 1.0;
return;
}
// Ambient part
vec3 fragcolor = albedo.rgb * AMBIENT_LIGHT;
vec3 N = normalize(normal);
for(int i = 0; i < LIGHT_COUNT; ++i)
{
// Vector to light
vec3 L = ubo.lights[i].position.xyz - fragPos;
// Distance from light to fragment position
float dist = length(L);
L = normalize(L);
// Viewer to fragment
vec3 V = ubo.viewPos.xyz - fragPos;
V = normalize(V);
float lightCosInnerAngle = cos(radians(15.0));
float lightCosOuterAngle = cos(radians(25.0));
float lightRange = 100.0;
// Direction vector from source to target
vec3 dir = normalize(ubo.lights[i].position.xyz - ubo.lights[i].target.xyz);
// Dual cone spot light with smooth transition between inner and outer angle
float cosDir = dot(L, dir);
float spotEffect = smoothstep(lightCosOuterAngle, lightCosInnerAngle, cosDir);
float heightAttenuation = smoothstep(lightRange, 0.0f, dist);
// Diffuse lighting
float NdotL = max(0.0, dot(N, L));
vec3 diff = vec3(NdotL);
// Specular lighting
vec3 R = reflect(-L, N);
float NdotR = max(0.0, dot(R, V));
vec3 spec = vec3(pow(NdotR, 16.0) * albedo.a * 2.5);
fragcolor += vec3((diff + spec) * spotEffect * heightAttenuation) * ubo.lights[i].color.rgb * albedo.rgb;
}
// Shadow calculations in a separate pass
if (ubo.useShadows > 0)
{
fragcolor = shadow(fragcolor, fragPos);
}
outFragColor = vec4(fragcolor, 1.0);
}

View File

@ -0,0 +1,69 @@
/*
The MIT License (MIT)
Copyright (c) 2022 Sascha Willems
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#version 450
#extension GL_ARB_viewport_array : enable
layout (triangles, invocations = 2) in;
layout (triangle_strip, max_vertices = 3) out;
layout (binding = 0) uniform UBO
{
mat4 projection[2];
mat4 modelview[2];
vec4 lightPos;
} ubo;
layout (location = 0) in vec3 inNormal[];
layout (location = 1) in vec3 inColor[];
layout (location = 0) out vec3 outNormal;
layout (location = 1) out vec3 outColor;
layout (location = 2) out vec3 outViewVec;
layout (location = 3) out vec3 outLightVec;
void main(void)
{
for(int i = 0; i < gl_in.length(); i++)
{
outNormal = mat3(ubo.modelview[gl_InvocationID]) * inNormal[i];
outColor = inColor[i];
vec4 pos = gl_in[i].gl_Position;
vec4 worldPos = (ubo.modelview[gl_InvocationID] * pos);
vec3 lPos = vec3(ubo.modelview[gl_InvocationID] * ubo.lightPos);
outLightVec = lPos - worldPos.xyz;
outViewVec = -worldPos.xyz;
gl_Position = ubo.projection[gl_InvocationID] * worldPos;
// Set the viewport index that the vertex will be emitted to
gl_ViewportIndex = gl_InvocationID;
gl_PrimitiveID = gl_PrimitiveIDIn;
EmitVertex();
}
EndPrimitive();
}

View File

@ -0,0 +1,140 @@
/*
The MIT License (MIT)
Copyright (c) 2022 Sascha Willems
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#version 450
layout(set = 0, binding = 0) uniform UBO
{
mat4 projection;
mat4 modelview;
vec4 lightPos;
vec4 frustumPlanes[6];
float displacementFactor;
float tessellationFactor;
vec2 viewportDim;
float tessellatedEdgeSize;
} ubo;
layout(set = 0, binding = 1) uniform sampler2D samplerHeight;
layout (vertices = 4) out;
layout (location = 0) in vec3 inNormal[];
layout (location = 1) in vec2 inUV[];
layout (location = 0) out vec3 outNormal[4];
layout (location = 1) out vec2 outUV[4];
// Calculate the tessellation factor based on screen space
// dimensions of the edge
float screenSpaceTessFactor(vec4 p0, vec4 p1)
{
// Calculate edge mid point
vec4 midPoint = 0.5 * (p0 + p1);
// Sphere radius as distance between the control points
float radius = distance(p0, p1) / 2.0;
// View space
vec4 v0 = ubo.modelview * midPoint;
// Project into clip space
vec4 clip0 = (ubo.projection * (v0 - vec4(radius, vec3(0.0))));
vec4 clip1 = (ubo.projection * (v0 + vec4(radius, vec3(0.0))));
// Get normalized device coordinates
clip0 /= clip0.w;
clip1 /= clip1.w;
// Convert to viewport coordinates
clip0.xy *= ubo.viewportDim;
clip1.xy *= ubo.viewportDim;
// Return the tessellation factor based on the screen size
// given by the distance of the two edge control points in screen space
// and a reference (min.) tessellation size for the edge set by the application
return clamp(distance(clip0, clip1) / ubo.tessellatedEdgeSize * ubo.tessellationFactor, 1.0, 64.0);
}
// Checks the current's patch visibility against the frustum using a sphere check
// Sphere radius is given by the patch size
bool frustumCheck()
{
// Fixed radius (increase if patch size is increased in example)
const float radius = 8.0f;
vec4 pos = gl_in[gl_InvocationID].gl_Position;
pos.y -= textureLod(samplerHeight, inUV[0], 0.0).r * ubo.displacementFactor;
// Check sphere against frustum planes
for (int i = 0; i < 6; i++) {
if (dot(pos, ubo.frustumPlanes[i]) + radius < 0.0)
{
return false;
}
}
return true;
}
void main()
{
if (gl_InvocationID == 0)
{
if (!frustumCheck())
{
gl_TessLevelInner[0] = 0.0;
gl_TessLevelInner[1] = 0.0;
gl_TessLevelOuter[0] = 0.0;
gl_TessLevelOuter[1] = 0.0;
gl_TessLevelOuter[2] = 0.0;
gl_TessLevelOuter[3] = 0.0;
}
else
{
if (ubo.tessellationFactor > 0.0)
{
gl_TessLevelOuter[0] = screenSpaceTessFactor(gl_in[3].gl_Position, gl_in[0].gl_Position);
gl_TessLevelOuter[1] = screenSpaceTessFactor(gl_in[0].gl_Position, gl_in[1].gl_Position);
gl_TessLevelOuter[2] = screenSpaceTessFactor(gl_in[1].gl_Position, gl_in[2].gl_Position);
gl_TessLevelOuter[3] = screenSpaceTessFactor(gl_in[2].gl_Position, gl_in[3].gl_Position);
gl_TessLevelInner[0] = mix(gl_TessLevelOuter[0], gl_TessLevelOuter[3], 0.5);
gl_TessLevelInner[1] = mix(gl_TessLevelOuter[2], gl_TessLevelOuter[1], 0.5);
}
else
{
// Tessellation factor can be set to zero by example
// to demonstrate a simple passthrough
gl_TessLevelInner[0] = 1.0;
gl_TessLevelInner[1] = 1.0;
gl_TessLevelOuter[0] = 1.0;
gl_TessLevelOuter[1] = 1.0;
gl_TessLevelOuter[2] = 1.0;
gl_TessLevelOuter[3] = 1.0;
}
}
}
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
outNormal[gl_InvocationID] = inNormal[gl_InvocationID];
outUV[gl_InvocationID] = inUV[gl_InvocationID];
}

View File

@ -0,0 +1,78 @@
/*
The MIT License (MIT)
Copyright (c) 2022 Sascha Willems
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#version 450
layout (set = 0, binding = 0) uniform UBO
{
mat4 projection;
mat4 modelview;
vec4 lightPos;
vec4 frustumPlanes[6];
float displacementFactor;
float tessellationFactor;
vec2 viewportDim;
float tessellatedEdgeSize;
} ubo;
layout (set = 0, binding = 1) uniform sampler2D displacementMap;
layout(quads, equal_spacing, cw) in;
layout (location = 0) in vec3 inNormal[];
layout (location = 1) in vec2 inUV[];
layout (location = 0) out vec3 outNormal;
layout (location = 1) out vec2 outUV;
layout (location = 2) out vec3 outViewVec;
layout (location = 3) out vec3 outLightVec;
layout (location = 4) out vec3 outEyePos;
layout (location = 5) out vec3 outWorldPos;
void main()
{
// Interpolate UV coordinates
vec2 uv1 = mix(inUV[0], inUV[1], gl_TessCoord.x);
vec2 uv2 = mix(inUV[3], inUV[2], gl_TessCoord.x);
outUV = mix(uv1, uv2, gl_TessCoord.y);
vec3 n1 = mix(inNormal[0], inNormal[1], gl_TessCoord.x);
vec3 n2 = mix(inNormal[3], inNormal[2], gl_TessCoord.x);
outNormal = mix(n1, n2, gl_TessCoord.y);
// Interpolate positions
vec4 pos1 = mix(gl_in[0].gl_Position, gl_in[1].gl_Position, gl_TessCoord.x);
vec4 pos2 = mix(gl_in[3].gl_Position, gl_in[2].gl_Position, gl_TessCoord.x);
vec4 pos = mix(pos1, pos2, gl_TessCoord.y);
// Displace
pos.y -= textureLod(displacementMap, outUV, 0.0).r * ubo.displacementFactor;
// Perspective projection
gl_Position = ubo.projection * ubo.modelview * pos;
// Calculate vectors for lighting based on tessellated position
outViewVec = -pos.xyz;
outLightVec = normalize(ubo.lightPos.xyz + outViewVec);
outWorldPos = pos.xyz;
outEyePos = vec3(ubo.modelview * pos);
}

View File

@ -0,0 +1,105 @@
/*
The MIT License (MIT)
Copyright (c) 2022 Sascha Willems
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#version 450
// Vertex attributes
layout (location = 0) in vec3 inPos;
layout (location = 1) in vec3 inNormal;
layout (location = 2) in vec2 inUV;
layout (location = 3) in vec3 inColor;
// Instanced attributes
layout (location = 4) in vec3 instancePos;
layout (location = 5) in vec3 instanceRot;
layout (location = 6) in float instanceScale;
layout (location = 7) in int instanceTexIndex;
layout (binding = 0) uniform UBO
{
mat4 projection;
mat4 modelview;
vec4 lightPos;
float locSpeed;
float globSpeed;
} ubo;
layout (location = 0) out vec3 outNormal;
layout (location = 1) out vec3 outColor;
layout (location = 2) out vec3 outUV;
layout (location = 3) out vec3 outViewVec;
layout (location = 4) out vec3 outLightVec;
void main()
{
outColor = inColor;
outUV = vec3(inUV, instanceTexIndex);
mat3 mx, my, mz;
// rotate around x
float s = sin(instanceRot.x + ubo.locSpeed);
float c = cos(instanceRot.x + ubo.locSpeed);
mx[0] = vec3(c, s, 0.0);
mx[1] = vec3(-s, c, 0.0);
mx[2] = vec3(0.0, 0.0, 1.0);
// rotate around y
s = sin(instanceRot.y + ubo.locSpeed);
c = cos(instanceRot.y + ubo.locSpeed);
my[0] = vec3(c, 0.0, s);
my[1] = vec3(0.0, 1.0, 0.0);
my[2] = vec3(-s, 0.0, c);
// rot around z
s = sin(instanceRot.z + ubo.locSpeed);
c = cos(instanceRot.z + ubo.locSpeed);
mz[0] = vec3(1.0, 0.0, 0.0);
mz[1] = vec3(0.0, c, s);
mz[2] = vec3(0.0, -s, c);
mat3 rotMat = mz * my * mx;
mat4 gRotMat;
s = sin(instanceRot.y + ubo.globSpeed);
c = cos(instanceRot.y + ubo.globSpeed);
gRotMat[0] = vec4(c, 0.0, s, 0.0);
gRotMat[1] = vec4(0.0, 1.0, 0.0, 0.0);
gRotMat[2] = vec4(-s, 0.0, c, 0.0);
gRotMat[3] = vec4(0.0, 0.0, 0.0, 1.0);
vec4 locPos = vec4(inPos.xyz * rotMat, 1.0);
vec4 pos = vec4((locPos.xyz * instanceScale) + instancePos, 1.0);
gl_Position = ubo.projection * ubo.modelview * gRotMat * pos;
outNormal = mat3(ubo.modelview * gRotMat) * inverse(rotMat) * inNormal;
pos = ubo.modelview * vec4(inPos.xyz + instancePos, 1.0);
vec3 lPos = mat3(ubo.modelview) * ubo.lightPos.xyz;
outLightVec = lPos - pos.xyz;
outViewVec = -pos.xyz;
}

View File

@ -0,0 +1,184 @@
/*
The MIT License (MIT)
Copyright (c) 2022 Google LLC
Copyright (c) 2022 Sascha Willems
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
struct Particle {
float4 pos;
float4 vel;
float4 uv;
float4 normal;
float pinned;
};
[[vk::binding(0)]]
StructuredBuffer<Particle> particleIn;
[[vk::binding(1)]]
RWStructuredBuffer<Particle> particleOut;
struct UBO
{
float deltaT;
float particleMass;
float springStiffness;
float damping;
float restDistH;
float restDistV;
float restDistD;
float sphereRadius;
float4 spherePos;
float4 gravity;
int2 particleCount;
};
cbuffer ubo : register(b2)
{
UBO params;
};
#ifdef GLSLANG
layout ( push_constant ) cbuffer PushConstants
{
uint calculateNormals;
} pushConstants;
#else
struct PushConstants
{
uint calculateNormals;
};
[[vk::push_constant]]
PushConstants pushConstants;
#endif
float3 springForce(float3 p0, float3 p1, float restDist)
{
float3 dist = p0 - p1;
return normalize(dist) * params.springStiffness * (length(dist) - restDist);
}
[numthreads(10, 10, 1)]
void main(uint3 id : SV_DispatchThreadID)
{
uint index = id.y * params.particleCount.x + id.x;
if (index > params.particleCount.x * params.particleCount.y)
return;
// Pinned?
if (particleIn[index].pinned == 1.0) {
particleOut[index].pos = particleOut[index].pos;
particleOut[index].vel = float4(0, 0, 0, 0);
return;
}
// Initial force from gravity
float3 force = params.gravity.xyz * params.particleMass;
float3 pos = particleIn[index].pos.xyz;
float3 vel = particleIn[index].vel.xyz;
// Spring forces from neighboring particles
// left
if (id.x > 0) {
force += springForce(particleIn[index-1].pos.xyz, pos, params.restDistH);
}
// right
if (id.x < params.particleCount.x - 1) {
force += springForce(particleIn[index + 1].pos.xyz, pos, params.restDistH);
}
// upper
if (id.y < params.particleCount.y - 1) {
force += springForce(particleIn[index + params.particleCount.x].pos.xyz, pos, params.restDistV);
}
// lower
if (id.y > 0) {
force += springForce(particleIn[index - params.particleCount.x].pos.xyz, pos, params.restDistV);
}
// upper-left
if ((id.x > 0) && (id.y < params.particleCount.y - 1)) {
force += springForce(particleIn[index + params.particleCount.x - 1].pos.xyz, pos, params.restDistD);
}
// lower-left
if ((id.x > 0) && (id.y > 0)) {
force += springForce(particleIn[index - params.particleCount.x - 1].pos.xyz, pos, params.restDistD);
}
// upper-right
if ((id.x < params.particleCount.x - 1) && (id.y < params.particleCount.y - 1)) {
force += springForce(particleIn[index + params.particleCount.x + 1].pos.xyz, pos, params.restDistD);
}
// lower-right
if ((id.x < params.particleCount.x - 1) && (id.y > 0)) {
force += springForce(particleIn[index - params.particleCount.x + 1].pos.xyz, pos, params.restDistD);
}
force += (-params.damping * vel);
// Integrate
float3 f = force * (1.0 / params.particleMass);
particleOut[index].pos = float4(pos + vel * params.deltaT + 0.5 * f * params.deltaT * params.deltaT, 1.0);
particleOut[index].vel = float4(vel + f * params.deltaT, 0.0);
// Sphere collision
float3 sphereDist = particleOut[index].pos.xyz - params.spherePos.xyz;
if (length(sphereDist) < params.sphereRadius + 0.01) {
// If the particle is inside the sphere, push it to the outer radius
particleOut[index].pos.xyz = params.spherePos.xyz + normalize(sphereDist) * (params.sphereRadius + 0.01);
// Cancel out velocity
particleOut[index].vel = float4(0, 0, 0, 0);
}
// Normals
if (pushConstants.calculateNormals == 1) {
float3 normal = float3(0, 0, 0);
float3 a, b, c;
if (id.y > 0) {
if (id.x > 0) {
a = particleIn[index - 1].pos.xyz - pos;
b = particleIn[index - params.particleCount.x - 1].pos.xyz - pos;
c = particleIn[index - params.particleCount.x].pos.xyz - pos;
normal += cross(a,b) + cross(b,c);
}
if (id.x < params.particleCount.x - 1) {
a = particleIn[index - params.particleCount.x].pos.xyz - pos;
b = particleIn[index - params.particleCount.x + 1].pos.xyz - pos;
c = particleIn[index + 1].pos.xyz - pos;
normal += cross(a,b) + cross(b,c);
}
}
if (id.y < params.particleCount.y - 1) {
if (id.x > 0) {
a = particleIn[index + params.particleCount.x].pos.xyz - pos;
b = particleIn[index + params.particleCount.x - 1].pos.xyz - pos;
c = particleIn[index - 1].pos.xyz - pos;
normal += cross(a,b) + cross(b,c);
}
if (id.x < params.particleCount.x - 1) {
a = particleIn[index + 1].pos.xyz - pos;
b = particleIn[index + params.particleCount.x + 1].pos.xyz - pos;
c = particleIn[index + params.particleCount.x].pos.xyz - pos;
normal += cross(a,b) + cross(b,c);
}
}
particleOut[index].normal = float4(normalize(normal), 0.0f);
}
}

View File

@ -0,0 +1,197 @@
/*
The MIT License (MIT)
Copyright (c) 2022 Google LLC
Copyright (c) 2022 Sascha Willems
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
Texture2D textureposition : register(t1);
SamplerState samplerposition : register(s1);
Texture2D textureNormal : register(t2);
SamplerState samplerNormal : register(s2);
Texture2D textureAlbedo : register(t3);
SamplerState samplerAlbedo : register(s3);
// Depth from the light's point of view
//layout (binding = 5) uniform sampler2DShadow samplerShadowMap;
Texture2DArray textureShadowMap : register(t5);
SamplerState samplerShadowMap : register(s5);
#define LIGHT_COUNT 3
#define SHADOW_FACTOR 0.25
#define AMBIENT_LIGHT 0.1
#define USE_PCF
struct Light
{
float4 position;
float4 target;
float4 color;
float4x4 viewMatrix;
};
struct UBO
{
float4 viewPos;
Light lights[LIGHT_COUNT];
int useShadows;
int displayDebugTarget;
};
cbuffer ubo : register(b4) { UBO ubo; }
float textureProj(float4 P, float layer, float2 offset)
{
float shadow = 1.0;
float4 shadowCoord = P / P.w;
shadowCoord.xy = shadowCoord.xy * 0.5 + 0.5;
if (shadowCoord.z > -1.0 && shadowCoord.z < 1.0)
{
float dist = textureShadowMap.Sample(samplerShadowMap, float3(shadowCoord.xy + offset, layer)).r;
if (shadowCoord.w > 0.0 && dist < shadowCoord.z)
{
shadow = SHADOW_FACTOR;
}
}
return shadow;
}
float filterPCF(float4 sc, float layer)
{
int2 texDim; int elements; int levels;
textureShadowMap.GetDimensions(0, texDim.x, texDim.y, elements, levels);
float scale = 1.5;
float dx = scale * 1.0 / float(texDim.x);
float dy = scale * 1.0 / float(texDim.y);
float shadowFactor = 0.0;
int count = 0;
int range = 1;
for (int x = -range; x <= range; x++)
{
for (int y = -range; y <= range; y++)
{
shadowFactor += textureProj(sc, layer, float2(dx*x, dy*y));
count++;
}
}
return shadowFactor / count;
}
float3 shadow(float3 fragcolor, float3 fragPos) {
for (int i = 0; i < LIGHT_COUNT; ++i)
{
float4 shadowClip = mul(ubo.lights[i].viewMatrix, float4(fragPos.xyz, 1.0));
float shadowFactor;
#ifdef USE_PCF
shadowFactor= filterPCF(shadowClip, i);
#else
shadowFactor = textureProj(shadowClip, i, float2(0.0, 0.0));
#endif
fragcolor *= shadowFactor;
}
return fragcolor;
}
float4 main([[vk::location(0)]] float2 inUV : TEXCOORD0) : SV_TARGET
{
// Get G-Buffer values
float3 fragPos = textureposition.Sample(samplerposition, inUV).rgb;
float3 normal = textureNormal.Sample(samplerNormal, inUV).rgb;
float4 albedo = textureAlbedo.Sample(samplerAlbedo, inUV);
float3 fragcolor;
// Debug display
if (ubo.displayDebugTarget > 0) {
switch (ubo.displayDebugTarget) {
case 1:
fragcolor.rgb = shadow(float3(1.0, 1.0, 1.0), fragPos);
break;
case 2:
fragcolor.rgb = fragPos;
break;
case 3:
fragcolor.rgb = normal;
break;
case 4:
fragcolor.rgb = albedo.rgb;
break;
case 5:
fragcolor.rgb = albedo.aaa;
break;
}
return float4(fragcolor, 1.0);
}
// Ambient part
fragcolor = albedo.rgb * AMBIENT_LIGHT;
float3 N = normalize(normal);
for(int i = 0; i < LIGHT_COUNT; ++i)
{
// Vector to light
float3 L = ubo.lights[i].position.xyz - fragPos;
// Distance from light to fragment position
float dist = length(L);
L = normalize(L);
// Viewer to fragment
float3 V = ubo.viewPos.xyz - fragPos;
V = normalize(V);
float lightCosInnerAngle = cos(radians(15.0));
float lightCosOuterAngle = cos(radians(25.0));
float lightRange = 100.0;
// Direction vector from source to target
float3 dir = normalize(ubo.lights[i].position.xyz - ubo.lights[i].target.xyz);
// Dual cone spot light with smooth transition between inner and outer angle
float cosDir = dot(L, dir);
float spotEffect = smoothstep(lightCosOuterAngle, lightCosInnerAngle, cosDir);
float heightAttenuation = smoothstep(lightRange, 0.0f, dist);
// Diffuse lighting
float NdotL = max(0.0, dot(N, L));
float3 diff = NdotL.xxx;
// Specular lighting
float3 R = reflect(-L, N);
float NdotR = max(0.0, dot(R, V));
float3 spec = (pow(NdotR, 16.0) * albedo.a * 2.5).xxx;
fragcolor += float3((diff + spec) * spotEffect * heightAttenuation) * ubo.lights[i].color.rgb * albedo.rgb;
}
// Shadow calculations in a separate pass
if (ubo.useShadows > 0)
{
fragcolor = shadow(fragcolor, fragPos);
}
return float4(fragcolor, 1);
}

View File

@ -0,0 +1,79 @@
/*
The MIT License (MIT)
Copyright (c) 2022 Google LLC
Copyright (c) 2022 Sascha Willems
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
struct UBO
{
float4x4 projection[2];
float4x4 modelview[2];
float4 lightPos;
};
cbuffer ubo : register(b0) { UBO ubo; }
struct VSOutput
{
float4 Pos : SV_POSITION;
[[vk::location(0)]] float3 Normal : NORMAL0;
[[vk::location(1)]] float3 Color : COLOR0;
};
struct GSOutput
{
float4 Pos : SV_POSITION;
uint ViewportIndex : SV_ViewportArrayIndex;
uint PrimitiveID : SV_PrimitiveID;
[[vk::location(0)]] float3 Normal : NORMAL0;
[[vk::location(1)]] float3 Color : COLOR0;
[[vk::location(2)]] float3 ViewVec : TEXCOOR1;
[[vk::location(3)]] float3 LightVec : TEXCOOR2;
};
[maxvertexcount(3)]
[instance(2)]
void main(triangle VSOutput input[3], inout TriangleStream<GSOutput> outStream, uint InvocationID : SV_GSInstanceID, uint PrimitiveID : SV_PrimitiveID)
{
for(int i = 0; i < 3; i++)
{
GSOutput output = (GSOutput)0;
output.Normal = mul((float3x3)ubo.modelview[InvocationID], input[i].Normal);
output.Color = input[i].Color;
float4 pos = input[i].Pos;
float4 worldPos = mul(ubo.modelview[InvocationID], pos);
float3 lPos = mul(ubo.modelview[InvocationID], ubo.lightPos).xyz;
output.LightVec = lPos - worldPos.xyz;
output.ViewVec = -worldPos.xyz;
output.Pos = mul(ubo.projection[InvocationID], worldPos);
// Set the viewport index that the vertex will be emitted to
output.ViewportIndex = InvocationID;
output.PrimitiveID = PrimitiveID;
outStream.Append( output );
}
outStream.RestartStrip();
}

View File

@ -0,0 +1,164 @@
/*
The MIT License (MIT)
Copyright (c) 2022 Google LLC
Copyright (c) 2022 Sascha Willems
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
struct UBO
{
float4x4 projection;
float4x4 modelview;
float4 lightPos;
float4 frustumPlanes[6];
float displacementFactor;
float tessellationFactor;
float2 viewportDim;
float tessellatedEdgeSize;
};
cbuffer ubo : register(b0) { UBO ubo; };
Texture2D textureHeight : register(t1);
SamplerState samplerHeight : register(s1);
struct VSOutput
{
float4 Pos : SV_POSITION;
[[vk::location(0)]] float3 Normal : NORMAL0;
[[vk::location(1)]] float2 UV : TEXCOORD0;
};
struct HSOutput
{
[[vk::location(2)]] float4 Pos : SV_POSITION;
[[vk::location(0)]] float3 Normal : NORMAL0;
[[vk::location(1)]] float2 UV : TEXCOORD0;
};
struct ConstantsHSOutput
{
float TessLevelOuter[4] : SV_TessFactor;
float TessLevelInner[2] : SV_InsideTessFactor;
};
// Calculate the tessellation factor based on screen space
// dimensions of the edge
float screenSpaceTessFactor(float4 p0, float4 p1)
{
// Calculate edge mid point
float4 midPoint = 0.5 * (p0 + p1);
// Sphere radius as distance between the control points
float radius = distance(p0, p1) / 2.0;
// View space
float4 v0 = mul(ubo.modelview, midPoint);
// Project into clip space
float4 clip0 = mul(ubo.projection, (v0 - float4(radius, float3(0.0, 0.0, 0.0))));
float4 clip1 = mul(ubo.projection, (v0 + float4(radius, float3(0.0, 0.0, 0.0))));
// Get normalized device coordinates
clip0 /= clip0.w;
clip1 /= clip1.w;
// Convert to viewport coordinates
clip0.xy *= ubo.viewportDim;
clip1.xy *= ubo.viewportDim;
// Return the tessellation factor based on the screen size
// given by the distance of the two edge control points in screen space
// and a reference (min.) tessellation size for the edge set by the application
return clamp(distance(clip0, clip1) / ubo.tessellatedEdgeSize * ubo.tessellationFactor, 1.0, 64.0);
}
// Checks the current's patch visibility against the frustum using a sphere check
// Sphere radius is given by the patch size
bool frustumCheck(float4 Pos, float2 inUV)
{
// Fixed radius (increase if patch size is increased in example)
const float radius = 8.0f;
float4 pos = Pos;
pos.y -= textureHeight.SampleLevel(samplerHeight, inUV, 0.0).r * ubo.displacementFactor;
// Check sphere against frustum planes
for (int i = 0; i < 6; i++) {
if (dot(pos, ubo.frustumPlanes[i]) + radius < 0.0)
{
return false;
}
}
return true;
}
ConstantsHSOutput ConstantsHS(InputPatch<VSOutput, 4> patch)
{
ConstantsHSOutput output = (ConstantsHSOutput)0;
if (!frustumCheck(patch[0].Pos, patch[0].UV))
{
output.TessLevelInner[0] = 0.0;
output.TessLevelInner[1] = 0.0;
output.TessLevelOuter[0] = 0.0;
output.TessLevelOuter[1] = 0.0;
output.TessLevelOuter[2] = 0.0;
output.TessLevelOuter[3] = 0.0;
}
else
{
if (ubo.tessellationFactor > 0.0)
{
output.TessLevelOuter[0] = screenSpaceTessFactor(patch[3].Pos, patch[0].Pos);
output.TessLevelOuter[1] = screenSpaceTessFactor(patch[0].Pos, patch[1].Pos);
output.TessLevelOuter[2] = screenSpaceTessFactor(patch[1].Pos, patch[2].Pos);
output.TessLevelOuter[3] = screenSpaceTessFactor(patch[2].Pos, patch[3].Pos);
output.TessLevelInner[0] = lerp(output.TessLevelOuter[0], output.TessLevelOuter[3], 0.5);
output.TessLevelInner[1] = lerp(output.TessLevelOuter[2], output.TessLevelOuter[1], 0.5);
}
else
{
// Tessellation factor can be set to zero by example
// to demonstrate a simple passthrough
output.TessLevelInner[0] = 1.0;
output.TessLevelInner[1] = 1.0;
output.TessLevelOuter[0] = 1.0;
output.TessLevelOuter[1] = 1.0;
output.TessLevelOuter[2] = 1.0;
output.TessLevelOuter[3] = 1.0;
}
}
return output;
}
[domain("quad")]
[partitioning("integer")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(4)]
[patchconstantfunc("ConstantsHS")]
[maxtessfactor(20.0f)]
HSOutput main(InputPatch<VSOutput, 4> patch, uint InvocationID : SV_OutputControlPointID)
{
HSOutput output = (HSOutput)0;
output.Pos = patch[InvocationID].Pos;
output.Normal = patch[InvocationID].Normal;
output.UV = patch[InvocationID].UV;
return output;
}

View File

@ -0,0 +1,94 @@
/*
The MIT License (MIT)
Copyright (c) 2022 Google LLC
Copyright (c) 2022 Sascha Willems
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
struct UBO
{
float4x4 projection;
float4x4 modelview;
float4 lightPos;
float4 frustumPlanes[6];
float displacementFactor;
float tessellationFactor;
float2 viewportDim;
float tessellatedEdgeSize;
};
cbuffer ubo : register(b0) { UBO ubo; };
Texture2D displacementMapTexture : register(t1);
SamplerState displacementMapSampler : register(s1);
struct HSOutput
{
[[vk::location(2)]] float4 Pos : SV_POSITION;
[[vk::location(0)]] float3 Normal : NORMAL0;
[[vk::location(1)]] float2 UV : TEXCOORD0;
};
struct ConstantsHSOutput
{
float TessLevelOuter[4] : SV_TessFactor;
float TessLevelInner[2] : SV_InsideTessFactor;
};
struct DSOutput
{
float4 Pos : SV_POSITION;
[[vk::location(0)]] float3 Normal : NORMAL0;
[[vk::location(1)]] float2 UV : TEXCOORD0;
[[vk::location(2)]] float3 ViewVec : TEXCOORD1;
[[vk::location(3)]] float3 LightVec : TEXCOORD2;
[[vk::location(4)]] float3 EyePos : POSITION1;
[[vk::location(5)]] float3 WorldPos : POSITION0;
};
[domain("quad")]
DSOutput main(ConstantsHSOutput input, float2 TessCoord : SV_DomainLocation, const OutputPatch<HSOutput, 4> patch)
{
// Interpolate UV coordinates
DSOutput output = (DSOutput)0;
float2 uv1 = lerp(patch[0].UV, patch[1].UV, TessCoord.x);
float2 uv2 = lerp(patch[3].UV, patch[2].UV, TessCoord.x);
output.UV = lerp(uv1, uv2, TessCoord.y);
float3 n1 = lerp(patch[0].Normal, patch[1].Normal, TessCoord.x);
float3 n2 = lerp(patch[3].Normal, patch[2].Normal, TessCoord.x);
output.Normal = lerp(n1, n2, TessCoord.y);
// Interpolate positions
float4 pos1 = lerp(patch[0].Pos, patch[1].Pos, TessCoord.x);
float4 pos2 = lerp(patch[3].Pos, patch[2].Pos, TessCoord.x);
float4 pos = lerp(pos1, pos2, TessCoord.y);
// Displace
pos.y -= displacementMapTexture.SampleLevel(displacementMapSampler, output.UV, 0.0).r * ubo.displacementFactor;
// Perspective projection
output.Pos = mul(ubo.projection, mul(ubo.modelview, pos));
// Calculate vectors for lighting based on tessellated position
output.ViewVec = -pos.xyz;
output.LightVec = normalize(ubo.lightPos.xyz + output.ViewVec);
output.WorldPos = pos.xyz;
output.EyePos = mul(ubo.modelview, pos).xyz;
return output;
}

View File

@ -0,0 +1,112 @@
/*
The MIT License (MIT)
Copyright (c) 2022 Google LLC
Copyright (c) 2022 Sascha Willems
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
struct VSInput
{
[[vk::location(0)]] float3 Pos : POSITION0;
[[vk::location(1)]] float3 Normal : NORMAL0;
[[vk::location(2)]] float2 UV : TEXCOORD0;
[[vk::location(3)]] float3 Color : COLOR0;
// Instanced attributes
[[vk::location(4)]] float3 instancePos : POSITION1;
[[vk::location(5)]] float3 instanceRot : TEXCOORD1;
[[vk::location(6)]] float instanceScale : TEXCOORD2;
[[vk::location(7)]] int instanceTexIndex : TEXCOORD3;
};
struct UBO
{
float4x4 projection;
float4x4 modelview;
float4 lightPos;
float locSpeed;
float globSpeed;
};
cbuffer ubo : register(b0) { UBO ubo; }
struct VSOutput
{
float4 Pos : SV_POSITION;
[[vk::location(0)]] float3 Normal : NORMAL0;
[[vk::location(1)]] float3 Color : COLOR0;
[[vk::location(2)]] float3 UV : TEXCOORD0;
[[vk::location(3)]] float3 ViewVec : TEXCOORD1;
[[vk::location(4)]] float3 LightVec : TEXCOORD2;
};
VSOutput main(VSInput input)
{
VSOutput output = (VSOutput)0;
output.Color = input.Color;
output.UV = float3(input.UV, input.instanceTexIndex);
// rotate around x
float s = sin(input.instanceRot.x + ubo.locSpeed);
float c = cos(input.instanceRot.x + ubo.locSpeed);
float3x3 mx = { c, -s, 0.0,
s, c, 0.0,
0.0, 0.0, 1.0 };
// rotate around y
s = sin(input.instanceRot.y + ubo.locSpeed);
c = cos(input.instanceRot.y + ubo.locSpeed);
float3x3 my = { c, 0.0, -s,
0.0, 1.0, 0.0,
s, 0.0, c };
// rot around z
s = sin(input.instanceRot.z + ubo.locSpeed);
c = cos(input.instanceRot.z + ubo.locSpeed);
float3x3 mz = { 1.0, 0.0, 0.0,
0.0, c, -s,
0.0, s, c };
float3x3 rotMat = mul(mz, mul(my, mx));
float4x4 gRotMat;
s = sin(input.instanceRot.y + ubo.globSpeed);
c = cos(input.instanceRot.y + ubo.globSpeed);
gRotMat[0] = float4(c, 0.0, -s, 0.0);
gRotMat[1] = float4(0.0, 1.0, 0.0, 0.0);
gRotMat[2] = float4(s, 0.0, c, 0.0);
gRotMat[3] = float4(0.0, 0.0, 0.0, 1.0);
float4 locPos = float4(mul(rotMat, input.Pos.xyz), 1.0);
float4 pos = float4((locPos.xyz * input.instanceScale) + input.instancePos, 1.0);
output.Pos = mul(ubo.projection, mul(ubo.modelview, mul(gRotMat, pos)));
output.Normal = mul((float3x3)mul(ubo.modelview, gRotMat), mul(rotMat, input.Normal));
pos = mul(ubo.modelview, float4(input.Pos.xyz + input.instancePos, 1.0));
float3 lPos = mul((float3x3)ubo.modelview, ubo.lightPos.xyz);
output.LightVec = lPos - pos.xyz;
output.ViewVec = -pos.xyz;
return output;
}

View File

@ -3428,7 +3428,7 @@ bool HlslGrammar::acceptCompoundStatement(TIntermNode*& retStatement)
}
}
if (compoundStatement)
compoundStatement->setOperator(EOpSequence);
compoundStatement->setOperator(intermediate.getDebugInfo() ? EOpScope : EOpSequence);
retStatement = compoundStatement;

View File

@ -2442,6 +2442,11 @@ void HlslParseContext::remapNonEntryPointIO(TFunction& function)
clearUniformInputOutput(function[i].type->getQualifier());
}
TIntermNode* HlslParseContext::handleDeclare(const TSourceLoc& loc, TIntermTyped* var)
{
return intermediate.addUnaryNode(EOpDeclare, var, loc, TType(EbtVoid));
}
// Handle function returns, including type conversions to the function return type
// if necessary.
TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermTyped* value)
@ -8035,11 +8040,16 @@ TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, const TStr
if (flattenVar)
flatten(*symbol->getAsVariable(), symbolTable.atGlobalLevel());
if (initializer == nullptr)
return nullptr;
TVariable* variable = symbol->getAsVariable();
if (initializer == nullptr) {
if (intermediate.getDebugInfo())
return executeDeclaration(loc, variable);
else
return nullptr;
}
// Deal with initializer
TVariable* variable = symbol->getAsVariable();
if (variable == nullptr) {
error(loc, "initializer requires a variable, not a member", identifier.c_str(), "");
return nullptr;
@ -8106,6 +8116,24 @@ TVariable* HlslParseContext::declareNonArray(const TSourceLoc& loc, const TStrin
return nullptr;
}
// Return a declaration of a temporary variable
//
// This is used to force a variable to be declared in the correct scope
// when debug information is being generated.
TIntermNode* HlslParseContext::executeDeclaration(const TSourceLoc& loc, TVariable* variable)
{
//
// Identifier must be of type temporary.
//
TStorageQualifier qualifier = variable->getType().getQualifier().storage;
if (qualifier != EvqTemporary)
return nullptr;
TIntermSymbol* intermSymbol = intermediate.addSymbol(*variable, loc);
return handleDeclare(loc, intermSymbol);
}
//
// Handle all types of initializers from the grammar.
//

View File

@ -87,6 +87,7 @@ public:
void handleFunctionBody(const TSourceLoc&, TFunction&, TIntermNode* functionBody, TIntermNode*& node);
void remapEntryPointIO(TFunction& function, TVariable*& returnValue, TVector<TVariable*>& inputs, TVector<TVariable*>& outputs);
void remapNonEntryPointIO(TFunction& function);
TIntermNode* handleDeclare(const TSourceLoc&, TIntermTyped*);
TIntermNode* handleReturnValue(const TSourceLoc&, TIntermTyped*);
void handleFunctionArgument(TFunction*, TIntermTyped*& arguments, TIntermTyped* newArg);
TIntermTyped* handleAssign(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right);
@ -243,6 +244,7 @@ protected:
TIntermSymbol* makeInternalVariableNode(const TSourceLoc&, const char* name, const TType&) const;
TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&, bool track);
void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&, bool track);
TIntermNode* executeDeclaration(const TSourceLoc&, TVariable* variable);
TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer, TIntermTyped* scalarInit);
bool isScalarConstructor(const TIntermNode*);

View File

@ -207,6 +207,8 @@ typedef struct glslang_spv_options_s {
bool optimize_size;
bool disassemble;
bool validate;
bool emit_nonsemantic_shader_debug_info;
bool emit_nonsemantic_shader_debug_source;
} glslang_spv_options_t;
#ifdef __cplusplus

View File

@ -67,6 +67,7 @@ class TIntermediate;
enum TOperator {
EOpNull, // if in a node, should only mean a node is still being built
EOpSequence, // denotes a list of statements, or parameters, etc.
EOpScope, // Used by debugging to denote a scoped list of statements
EOpLinkerObjects, // for aggregate node of objects the linker may need, if not reference by the rest of the AST
EOpFunctionCall,
EOpFunction, // For function definition
@ -91,6 +92,8 @@ enum TOperator {
EOpCopyObject,
EOpDeclare, // Used by debugging to force declaration of variable in correct scope
// (u)int* -> bool
EOpConvInt8ToBool,
EOpConvUint8ToBool,

View File

@ -2733,10 +2733,10 @@ TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* init
TIntermAggregate* loopSequence = (initializer == nullptr ||
initializer->getAsAggregate() == nullptr) ? makeAggregate(initializer, loc)
: initializer->getAsAggregate();
if (loopSequence != nullptr && loopSequence->getOp() == EOpSequence)
if (loopSequence != nullptr && (loopSequence->getOp() == EOpSequence || loopSequence->getOp() == EOpScope))
loopSequence->setOp(EOpNull);
loopSequence = growAggregate(loopSequence, node);
loopSequence->setOperator(EOpSequence);
loopSequence->setOperator(getDebugInfo() ? EOpScope : EOpSequence);
return loopSequence;
}

View File

@ -1839,6 +1839,7 @@ void TShader::setOverrideVersion(int version)
overrideVersion = version;
}
void TShader::setDebugInfo(bool debugInfo) { intermediate->setDebugInfo(debugInfo); }
void TShader::setInvertY(bool invert) { intermediate->setInvertY(invert); }
void TShader::setDxPositionW(bool invert) { intermediate->setDxPositionW(invert); }
void TShader::setEnhancedMsgs() { intermediate->setEnhancedMsgs(); }

View File

@ -3726,7 +3726,7 @@ compound_statement
}
RIGHT_BRACE {
if ($3 && $3->getAsAggregate())
$3->getAsAggregate()->setOperator(EOpSequence);
$3->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence);
$$ = $3;
}
;

View File

@ -151,7 +151,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%parse-param {glslang::TParseContext* pParseContext}
%lex-param {parseContext}
%pure-parser // enable thread safety
%define api.pure // enable thread safety
%expect 1 // One shift reduce conflict because of if | else
%token <lex> CONST BOOL INT UINT FLOAT
@ -3726,7 +3726,7 @@ compound_statement
}
RIGHT_BRACE {
if ($3 && $3->getAsAggregate())
$3->getAsAggregate()->setOperator(EOpSequence);
$3->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence);
$$ = $3;
}
;

View File

@ -11085,7 +11085,7 @@ yyreduce:
#line 3727 "MachineIndependent/glslang.y"
{
if ((yyvsp[-2].interm.intermNode) && (yyvsp[-2].interm.intermNode)->getAsAggregate())
(yyvsp[-2].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence);
(yyvsp[-2].interm.intermNode)->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence);
(yyval.interm.intermNode) = (yyvsp[-2].interm.intermNode);
}
#line 11092 "MachineIndependent/glslang_tab.cpp"

View File

@ -665,6 +665,8 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
case EOpConstructReference: out.debug << "Construct reference type"; break;
case EOpDeclare: out.debug << "Declare"; break;
#ifndef GLSLANG_WEB
case EOpSpirvInst: out.debug << "spirv_instruction"; break;
#endif
@ -692,6 +694,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
switch (node->getOp()) {
case EOpSequence: out.debug << "Sequence\n"; return true;
case EOpScope: out.debug << "Scope\n"; return true;
case EOpLinkerObjects: out.debug << "Linker Objects\n"; return true;
case EOpComma: out.debug << "Comma"; break;
case EOpFunction: out.debug << "Function Definition: " << node->getName(); break;
@ -1107,7 +1110,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
default: out.debug.message(EPrefixError, "Bad aggregation op");
}
if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)
if (node->getOp() != EOpSequence && node->getOp() != EOpScope && node->getOp() != EOpParameters)
out.debug << " (" << node->getCompleteString() << ")";
out.debug << "\n";

View File

@ -319,6 +319,7 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
MERGE_TRUE(autoMapLocations);
MERGE_TRUE(invertY);
MERGE_TRUE(dxPositionW);
MERGE_TRUE(debugInfo);
MERGE_TRUE(flattenUniformArrays);
MERGE_TRUE(useUnknownFormat);
MERGE_TRUE(hlslOffsets);

View File

@ -292,6 +292,7 @@ public:
invertY(false),
dxPositionW(false),
enhancedMsgs(false),
debugInfo(false),
useStorageBuffer(false),
invariantAll(false),
nanMinMaxClamp(false),
@ -461,6 +462,12 @@ public:
const std::string& getEntryPointName() const { return entryPointName; }
const std::string& getEntryPointMangledName() const { return entryPointMangledName; }
void setDebugInfo(bool debuginfo)
{
debugInfo = debuginfo;
}
bool getDebugInfo() const { return debugInfo; }
void setInvertY(bool invert)
{
invertY = invert;
@ -1109,6 +1116,7 @@ protected:
bool invertY;
bool dxPositionW;
bool enhancedMsgs;
bool debugInfo;
bool useStorageBuffer;
bool invariantAll;
bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN

View File

@ -472,6 +472,7 @@ public:
GLSLANG_EXPORT void addProcesses(const std::vector<std::string>&);
GLSLANG_EXPORT void setUniqueId(unsigned long long id);
GLSLANG_EXPORT void setOverrideVersion(int version);
GLSLANG_EXPORT void setDebugInfo(bool debugInfo);
// IO resolver binding data: see comments in ShaderLang.cpp
GLSLANG_EXPORT void setShiftBinding(TResourceType res, unsigned int base);

View File

@ -65,6 +65,7 @@ using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPoint
using HlslDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslDX9CompatibleTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslLegalDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslNonSemanticShaderDebugInfoTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
// Compiling HLSL to pre-legalized SPIR-V under Vulkan semantics. Expected
// to successfully generate both AST and SPIR-V.
@ -136,6 +137,13 @@ TEST_P(HlslLegalDebugTest, FromFile)
"/baseResults/", true, true);
}
TEST_P(HlslNonSemanticShaderDebugInfoTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv, true, GetParam().entryPoint, "/baseResults/", false, false, true);
}
// clang-format off
INSTANTIATE_TEST_SUITE_P(
ToSpirv, HlslCompileTest,
@ -527,7 +535,21 @@ INSTANTIATE_TEST_SUITE_P(
}),
FileNameAsCustomTestSuffix
);
// clang-format on
// clang-format off
INSTANTIATE_TEST_SUITE_P(
ToSpirv, HlslNonSemanticShaderDebugInfoTest,
::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
{"spv.debuginfo.hlsl.vert", "main"},
{"spv.debuginfo.hlsl.frag", "main"},
{"spv.debuginfo.hlsl.comp", "main"},
{"spv.debuginfo.hlsl.geom", "main"},
{"spv.debuginfo.hlsl.tesc", "main"},
{"spv.debuginfo.hlsl.tese", "main"},
}),
FileNameAsCustomTestSuffix
);
// clang-format on
} // anonymous namespace

View File

@ -80,6 +80,7 @@ using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::st
using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileVulkanToSpirv14TestNV = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileVulkanToNonSemanticShaderDebugInfoTest = GlslangTest<::testing::TestWithParam<std::string>>;
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
// generate SPIR-V.
@ -229,6 +230,13 @@ TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
Target::Spv);
}
TEST_P(CompileVulkanToNonSemanticShaderDebugInfoTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
Target::Spv, true, "", "/baseResults/", false, false, true);
}
// clang-format off
INSTANTIATE_TEST_SUITE_P(
Glsl, CompileVulkanToSpirvTest,
@ -812,6 +820,7 @@ INSTANTIATE_TEST_SUITE_P(
})),
FileNameAsCustomTestSuffix
);
INSTANTIATE_TEST_SUITE_P(
Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
::testing::ValuesIn(std::vector<std::string>({
@ -819,6 +828,19 @@ INSTANTIATE_TEST_SUITE_P(
})),
FileNameAsCustomTestSuffix
);
INSTANTIATE_TEST_SUITE_P(
Glsl, CompileVulkanToNonSemanticShaderDebugInfoTest,
::testing::ValuesIn(std::vector<std::string>({
"spv.debuginfo.glsl.vert",
"spv.debuginfo.glsl.frag",
"spv.debuginfo.glsl.comp",
"spv.debuginfo.glsl.geom",
"spv.debuginfo.glsl.tesc",
"spv.debuginfo.glsl.tese"
})),
FileNameAsCustomTestSuffix
);
// clang-format on
} // anonymous namespace

View File

@ -217,6 +217,7 @@ public:
EShTextureSamplerTransformMode texSampTransMode = EShTexSampTransKeep,
bool enableOptimizer = false,
bool enableDebug = false,
bool enableNonSemanticShaderDebugInfo = false,
bool automap = true)
{
const EShLanguage stage = GetShaderStage(GetSuffix(shaderName));
@ -263,6 +264,8 @@ public:
std::vector<uint32_t> spirv_binary;
options().disableOptimizer = !enableOptimizer;
options().generateDebugInfo = enableDebug;
options().emitNonSemanticShaderDebugInfo = enableNonSemanticShaderDebugInfo;
options().emitNonSemanticShaderDebugSource = enableNonSemanticShaderDebugInfo;
glslang::GlslangToSpv(*program.getIntermediate(stage),
spirv_binary, &logger, &options());
@ -448,7 +451,8 @@ public:
const std::string& entryPointName="",
const std::string& baseDir="/baseResults/",
const bool enableOptimizer = false,
const bool enableDebug = false)
const bool enableDebug = false,
const bool enableNonSemanticShaderDebugInfo = false)
{
const std::string inputFname = testDir + "/" + testName;
const std::string expectedOutputFname =
@ -464,7 +468,8 @@ public:
if (enableDebug)
controls = static_cast<EShMessages>(controls | EShMsgDebugInfo);
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion,
targetLanguageVersion, false, EShTexSampTransKeep, enableOptimizer, enableDebug, automap);
targetLanguageVersion, false, EShTexSampTransKeep, enableOptimizer, enableDebug,
enableNonSemanticShaderDebugInfo, automap);
// Generate the hybrid output in the way of glslangValidator.
std::ostringstream stream;

View File

@ -36,6 +36,7 @@
"SPIRV/GLSL.*.h",
"SPIRV/NonSemanticDebugPrintf.h",
"SPIRV/NonSemanticShaderDebugInfo100.h",
"SPIRV/spirv.hpp"
]
}