Skip to content

Commit 91f19be

Browse files
aleino-nvslangbot
andauthored
Various fixes to enable some WGSL graphics tests (shader-slang#5548)
* Update Slang-RHI to get WGPU backend fixes * render-test: Use device local memory type for vertex buffers This helps to avoid shader-slang/slang-rhi#104 * Fix bug in WGSL emitter layout code. There was a "kinds" vs. "kind flags" mismatch, and also getBindingOffsetForKinds was not being used. This patch enables a bunch of tests for WGPU. This helps to address issue shader-slang#4943. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
1 parent 2be4fa4 commit 91f19be

7 files changed

+7
-10
lines changed

source/slang/slang-emit-wgsl.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ void WGSLSourceEmitter::emitParameterGroupImpl(
135135
case LayoutResourceKind::SamplerState:
136136
case LayoutResourceKind::DescriptorTableSlot:
137137
{
138+
auto kinds = LayoutResourceKindFlag::make(LayoutResourceKind::DescriptorTableSlot);
138139
m_writer->emit("@binding(");
139-
m_writer->emit(attr->getOffset());
140+
auto index = getBindingOffsetForKinds(&containerChain, kinds);
141+
m_writer->emit(index);
140142
m_writer->emit(") ");
141143
m_writer->emit("@group(");
142-
auto space = getBindingSpaceForKinds(
143-
&containerChain,
144-
LayoutResourceKind::DescriptorTableSlot);
144+
auto space = getBindingSpaceForKinds(&containerChain, kinds);
145145
m_writer->emit(space);
146146
m_writer->emit(") ");
147147
}

tests/compute/compile-time-loop.slang

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//TEST(compute):COMPARE_RENDER_COMPUTE: -shaderobj
22
//TEST(compute):COMPARE_RENDER_COMPUTE: -mtl -shaderobj
3-
//DISABLE_TEST(compute):COMPARE_COMPUTE:-wgpu
43

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

tests/compute/discard-stmt.slang

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//TEST_INPUT: Texture2D(size=4, content = one):name tex
44
//TEST_INPUT: Sampler:name samp
55
//TEST_INPUT: ubuffer(data=[0 0], stride=4):out,name outputBuffer
6-
//DISABLE_TEST(compute):COMPARE_COMPUTE:-wgpu
76

87

98
Texture2D tex;

tests/compute/texture-sampling.slang

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
//TEST_INPUT: TextureCube(size=4, content = one, arrayLength=2):name=tCubeArray
1313
//TEST_INPUT: Sampler:name=samplerState
1414
//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
15+
// There is no texture_1d_array type in WGSL https://github.com/shader-slang/slang/issues/5223
1516
//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -wgpu
1617

1718
Texture1D t1D;

tests/expected-failure-github.txt

-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ tests/compute/atomics (wgpu)
1919
tests/compute/atomics-buffer (wgpu)
2020
tests/compute/atomics-groupshared (wgpu)
2121
tests/compute/buffer-type-splitting (wgpu)
22-
tests/compute/compile-time-loop.slang.2 syn (wgpu)
2322
tests/compute/constant-buffer-memory-packing.slang.6 syn (wgpu)
2423
tests/compute/constexpr.slang.2 syn (wgpu)
25-
tests/compute/discard-stmt.slang.2 syn (wgpu)
2624
tests/compute/func-cbuffer-param.slang.4 syn (wgpu)
2725
tests/compute/interface-shader-param-in-struct.slang.4 syn (wgpu)
2826
tests/compute/interface-shader-param.slang.5 syn (wgpu)

tools/render-test/render-test-main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ SlangResult RenderTestApp::initialize(
597597

598598
BufferDesc vertexBufferDesc;
599599
vertexBufferDesc.size = kVertexCount * sizeof(Vertex);
600-
vertexBufferDesc.memoryType = MemoryType::Upload;
600+
vertexBufferDesc.memoryType = MemoryType::DeviceLocal;
601601
vertexBufferDesc.usage = BufferUsage::VertexBuffer;
602602
vertexBufferDesc.defaultState = ResourceState::VertexBuffer;
603603

0 commit comments

Comments
 (0)