Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions tools/clang/lib/SPIRV/SpirvEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,21 +809,17 @@ void SpirvEmitter::HandleTranslationUnit(ASTContext &context) {
spvBuilder.setMemoryModel(spv::AddressingModel::Logical,
spv::MemoryModel::GLSL450);

// Even though the 'workQueue' grows due to the above loop, the first
// 'numEntryPoints' entries in the 'workQueue' are the ones with the HLSL
// 'shader' attribute, and must therefore be entry functions.
assert(numEntryPoints <= workQueue.size());

for (uint32_t i = 0; i < numEntryPoints; ++i) {
for (uint32_t i = 0; i < workQueue.size(); ++i) {
// TODO: assign specific StageVars w.r.t. to entry point
const FunctionInfo *entryInfo = workQueue[i];
assert(entryInfo->isEntryFunction);
spvBuilder.addEntryPoint(
getSpirvShaderStage(
entryInfo->shaderModelKind,
featureManager.isExtensionEnabled(Extension::EXT_mesh_shader)),
entryInfo->entryFunction, getEntryPointName(entryInfo),
getInterfacesForEntryPoint(entryInfo->entryFunction));
if (entryInfo->isEntryFunction) {
spvBuilder.addEntryPoint(
getSpirvShaderStage(
entryInfo->shaderModelKind,
featureManager.isExtensionEnabled(Extension::EXT_mesh_shader)),
entryInfo->entryFunction, getEntryPointName(entryInfo),
getInterfacesForEntryPoint(entryInfo->entryFunction));
}
}

// Add Location decorations to stage input/output variables.
Expand Down
19 changes: 19 additions & 0 deletions tools/clang/test/CodeGenSPIRV/lib.fn.export.with.entrypoint.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// RUN: %dxc -T lib_6_6 -E main -fspv-target-env=universal1.5 -fcgl %s -spirv | FileCheck %s

// CHECK: OpEntryPoint MissKHR %miss "miss" %payload
// CHECK: OpDecorate %func LinkageAttributes "func" Export


struct RayPayload
{
uint a;
};

export void func()
{
}

[shader("miss")]
void miss(inout RayPayload payload)
{
}