Skip to content

Commit

Permalink
Fix bug in WGSL emitter layout code.
Browse files Browse the repository at this point in the history
There was a "kinds" vs. "kind flags" mismatch, and also getBindingOffsetForKinds was not
being used.

This helps to address issue shader-slang#4943.
  • Loading branch information
aleino-nv committed Nov 13, 2024
1 parent 0f20fd5 commit 2333306
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions source/slang/slang-emit-wgsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,17 @@ void WGSLSourceEmitter::emitParameterGroupImpl(
case LayoutResourceKind::SamplerState:
case LayoutResourceKind::DescriptorTableSlot:
{
auto kinds = LayoutResourceKindFlag::make(LayoutResourceKind::DescriptorTableSlot);
m_writer->emit("@binding(");
m_writer->emit(attr->getOffset());
auto index = getBindingOffsetForKinds(
&containerChain,
kinds);
m_writer->emit(index);
m_writer->emit(") ");
m_writer->emit("@group(");
auto space = getBindingSpaceForKinds(
&containerChain,
LayoutResourceKind::DescriptorTableSlot);
kinds);
m_writer->emit(space);
m_writer->emit(") ");
}
Expand Down
1 change: 0 additions & 1 deletion tests/compute/compile-time-loop.slang
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//TEST(compute):COMPARE_RENDER_COMPUTE: -shaderobj
//TEST(compute):COMPARE_RENDER_COMPUTE: -mtl -shaderobj
//DISABLE_TEST(compute):COMPARE_COMPUTE:-wgpu

//TEST_INPUT: Texture2D(size=4, content = one):name t
//TEST_INPUT: Sampler:name s
Expand Down

0 comments on commit 2333306

Please sign in to comment.