Merge pull request #3025 from pmistryNV/GL_EXT_mesh_shader
Make a spirv builder utility function for termination instructions that take input …
This commit is contained in:
commit
c0cf8ad876
@ -8594,11 +8594,10 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
|||||||
builder.createNoResultOp(spv::OpWritePackedPrimitiveIndices4x8NV, operands);
|
builder.createNoResultOp(spv::OpWritePackedPrimitiveIndices4x8NV, operands);
|
||||||
return 0;
|
return 0;
|
||||||
case glslang::EOpEmitMeshTasksEXT:
|
case glslang::EOpEmitMeshTasksEXT:
|
||||||
if(taskPayloadID)
|
if (taskPayloadID)
|
||||||
operands.push_back(taskPayloadID);
|
operands.push_back(taskPayloadID);
|
||||||
builder.createNoResultOp(spv::OpEmitMeshTasksEXT, operands);
|
// As per SPV_EXT_mesh_shader make it a terminating instruction in the current block
|
||||||
// Make it a terminating instruction in the current block
|
builder.makeStatementTerminator(spv::OpEmitMeshTasksEXT, operands, "post-OpEmitMeshTasksEXT");
|
||||||
builder.createAndSetNoPredecessorBlock("post-OpEmitMeshTasksEXT");
|
|
||||||
return 0;
|
return 0;
|
||||||
case glslang::EOpSetMeshOutputsEXT:
|
case glslang::EOpSetMeshOutputsEXT:
|
||||||
builder.createNoResultOp(spv::OpSetMeshOutputsEXT, operands);
|
builder.createNoResultOp(spv::OpSetMeshOutputsEXT, operands);
|
||||||
|
|||||||
@ -2206,7 +2206,7 @@ void Builder::leaveFunction()
|
|||||||
|
|
||||||
// Clear function scope from debug scope stack
|
// Clear function scope from debug scope stack
|
||||||
if (emitNonSemanticShaderDebugInfo)
|
if (emitNonSemanticShaderDebugInfo)
|
||||||
currentDebugScopeId.pop();
|
currentDebugScopeId.pop();
|
||||||
|
|
||||||
emitNonSemanticShaderDebugInfo = restoreNonSemanticShaderDebugInfo;
|
emitNonSemanticShaderDebugInfo = restoreNonSemanticShaderDebugInfo;
|
||||||
}
|
}
|
||||||
@ -2218,6 +2218,16 @@ void Builder::makeStatementTerminator(spv::Op opcode, const char *name)
|
|||||||
createAndSetNoPredecessorBlock(name);
|
createAndSetNoPredecessorBlock(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Comments in header
|
||||||
|
void Builder::makeStatementTerminator(spv::Op opcode, const std::vector<Id>& operands, const char* name)
|
||||||
|
{
|
||||||
|
// It's assumed that the terminator instruction is always of void return type
|
||||||
|
// However in future if there is a need for non void return type, new helper
|
||||||
|
// methods can be created.
|
||||||
|
createNoResultOp(opcode, operands);
|
||||||
|
createAndSetNoPredecessorBlock(name);
|
||||||
|
}
|
||||||
|
|
||||||
// Comments in header
|
// 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)
|
bool const compilerGenerated)
|
||||||
@ -2282,7 +2292,7 @@ spv::MemoryAccessMask Builder::sanitizeMemoryAccessForStorageClass(spv::MemoryAc
|
|||||||
case spv::StorageClassPhysicalStorageBufferEXT:
|
case spv::StorageClassPhysicalStorageBufferEXT:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
memoryAccess = spv::MemoryAccessMask(memoryAccess &
|
memoryAccess = spv::MemoryAccessMask(memoryAccess &
|
||||||
~(spv::MemoryAccessMakePointerAvailableKHRMask |
|
~(spv::MemoryAccessMakePointerAvailableKHRMask |
|
||||||
spv::MemoryAccessMakePointerVisibleKHRMask |
|
spv::MemoryAccessMakePointerVisibleKHRMask |
|
||||||
spv::MemoryAccessNonPrivatePointerKHRMask));
|
spv::MemoryAccessNonPrivatePointerKHRMask));
|
||||||
@ -2767,7 +2777,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
|||||||
texArgs[numArgs++] = parameters.granularity;
|
texArgs[numArgs++] = parameters.granularity;
|
||||||
if (parameters.coarse != NoResult)
|
if (parameters.coarse != NoResult)
|
||||||
texArgs[numArgs++] = parameters.coarse;
|
texArgs[numArgs++] = parameters.coarse;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set up the optional arguments
|
// Set up the optional arguments
|
||||||
|
|||||||
@ -436,6 +436,10 @@ public:
|
|||||||
// discard, terminate-invocation, terminateRayEXT, or ignoreIntersectionEXT
|
// discard, terminate-invocation, terminateRayEXT, or ignoreIntersectionEXT
|
||||||
void makeStatementTerminator(spv::Op opcode, const char *name);
|
void makeStatementTerminator(spv::Op opcode, const char *name);
|
||||||
|
|
||||||
|
// Create block terminator instruction for statements that have input operands
|
||||||
|
// such as OpEmitMeshTasksEXT
|
||||||
|
void makeStatementTerminator(spv::Op opcode, const std::vector<Id>& operands, const char* name);
|
||||||
|
|
||||||
// Create a global or function local or IO variable.
|
// Create a global or function local or IO variable.
|
||||||
Id createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name = nullptr,
|
Id createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name = nullptr,
|
||||||
Id initializer = NoResult, bool const compilerGenerated = true);
|
Id initializer = NoResult, bool const compilerGenerated = true);
|
||||||
@ -844,7 +848,6 @@ public:
|
|||||||
void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock);
|
void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock);
|
||||||
void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control,
|
void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control,
|
||||||
const std::vector<unsigned int>& operands);
|
const std::vector<unsigned int>& operands);
|
||||||
void createAndSetNoPredecessorBlock(const char*);
|
|
||||||
|
|
||||||
// Sets to generate opcode for specialization constants.
|
// Sets to generate opcode for specialization constants.
|
||||||
void setToSpecConstCodeGenMode() { generatingOpCodeForSpecConst = true; }
|
void setToSpecConstCodeGenMode() { generatingOpCodeForSpecConst = true; }
|
||||||
@ -864,6 +867,7 @@ public:
|
|||||||
void remapDynamicSwizzle();
|
void remapDynamicSwizzle();
|
||||||
void transferAccessChainSwizzle(bool dynamic);
|
void transferAccessChainSwizzle(bool dynamic);
|
||||||
void simplifyAccessChainSwizzle();
|
void simplifyAccessChainSwizzle();
|
||||||
|
void createAndSetNoPredecessorBlock(const char*);
|
||||||
void createSelectionMerge(Block* mergeBlock, unsigned int control);
|
void createSelectionMerge(Block* mergeBlock, unsigned int control);
|
||||||
void dumpSourceInstructions(std::vector<unsigned int>&) const;
|
void dumpSourceInstructions(std::vector<unsigned int>&) const;
|
||||||
void dumpSourceInstructions(const spv::Id fileId, const std::string& text, std::vector<unsigned int>&) const;
|
void dumpSourceInstructions(const spv::Id fileId, const std::string& text, std::vector<unsigned int>&) const;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user