Use the new utility function for generating OpEmitMeshTasksEXT.
builder.createNoResultOp(spv::OpWritePackedPrimitiveIndices4x8NV, operands);
return 0;
case glslang::EOpEmitMeshTasksEXT:
- if(taskPayloadID)
+ if (taskPayloadID)
operands.push_back(taskPayloadID);
- builder.createNoResultOp(spv::OpEmitMeshTasksEXT, operands);
- // Make it a terminating instruction in the current block
- builder.createAndSetNoPredecessorBlock("post-OpEmitMeshTasksEXT");
+ // As per SPV_EXT_mesh_shader make it a terminating instruction in the current block
+ builder.makeStatementTerminator(spv::OpEmitMeshTasksEXT, operands, "post-OpEmitMeshTasksEXT");
return 0;
case glslang::EOpSetMeshOutputsEXT:
builder.createNoResultOp(spv::OpSetMeshOutputsEXT, operands);
// Clear function scope from debug scope stack
if (emitNonSemanticShaderDebugInfo)
- currentDebugScopeId.pop();
+ currentDebugScopeId.pop();
emitNonSemanticShaderDebugInfo = restoreNonSemanticShaderDebugInfo;
}
}
// 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
Id Builder::createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name, Id initializer,
bool const compilerGenerated)
{
case spv::StorageClassPhysicalStorageBufferEXT:
break;
default:
- memoryAccess = spv::MemoryAccessMask(memoryAccess &
+ memoryAccess = spv::MemoryAccessMask(memoryAccess &
~(spv::MemoryAccessMakePointerAvailableKHRMask |
spv::MemoryAccessMakePointerVisibleKHRMask |
spv::MemoryAccessNonPrivatePointerKHRMask));
texArgs[numArgs++] = parameters.granularity;
if (parameters.coarse != NoResult)
texArgs[numArgs++] = parameters.coarse;
-#endif
+#endif
//
// Set up the optional arguments
// discard, terminate-invocation, terminateRayEXT, or ignoreIntersectionEXT
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.
Id createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name = nullptr,
Id initializer = NoResult, bool const compilerGenerated = true);
void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock);
void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control,
const std::vector<unsigned int>& operands);
- void createAndSetNoPredecessorBlock(const char*);
// Sets to generate opcode for specialization constants.
void setToSpecConstCodeGenMode() { generatingOpCodeForSpecConst = true; }
void remapDynamicSwizzle();
void transferAccessChainSwizzle(bool dynamic);
void simplifyAccessChainSwizzle();
+ void createAndSetNoPredecessorBlock(const char*);
void createSelectionMerge(Block* mergeBlock, unsigned int control);
void dumpSourceInstructions(std::vector<unsigned int>&) const;
void dumpSourceInstructions(const spv::Id fileId, const std::string& text, std::vector<unsigned int>&) const;