diff options
| author | Anders Leino <aleino@nvidia.com> | 2024-11-13 18:08:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-13 08:08:14 -0800 |
| commit | 91f19bedb902fb8b97c9b9da9fcb9c82e6f1c785 (patch) | |
| tree | cbb68b387a07f08258ca0b533569c48b3906d5a4 | |
| parent | 2be4fa42278173c2a1ef78c776cbf9a952cce83e (diff) | |
Various fixes to enable some WGSL graphics tests (#5548)
* Update Slang-RHI to get WGPU backend fixes
* render-test: Use device local memory type for vertex buffers
This helps to avoid https://github.com/shader-slang/slang-rhi/issues/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 #4943.
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
| m--------- | external/slang-rhi | 0 | ||||
| -rw-r--r-- | source/slang/slang-emit-wgsl.cpp | 8 | ||||
| -rw-r--r-- | tests/compute/compile-time-loop.slang | 1 | ||||
| -rw-r--r-- | tests/compute/discard-stmt.slang | 1 | ||||
| -rw-r--r-- | tests/compute/texture-sampling.slang | 1 | ||||
| -rw-r--r-- | tests/expected-failure-github.txt | 2 | ||||
| -rw-r--r-- | tools/render-test/render-test-main.cpp | 2 |
7 files changed, 6 insertions, 9 deletions
diff --git a/external/slang-rhi b/external/slang-rhi -Subproject 663707edd481d76761302fbbd2bf0b4018c1c64 +Subproject 7de6f247649b86358d79b2ae91f84dd3f85cafc diff --git a/source/slang/slang-emit-wgsl.cpp b/source/slang/slang-emit-wgsl.cpp index 5df94f561..b5ed7b9d2 100644 --- a/source/slang/slang-emit-wgsl.cpp +++ b/source/slang/slang-emit-wgsl.cpp @@ -135,13 +135,13 @@ 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); + auto space = getBindingSpaceForKinds(&containerChain, kinds); m_writer->emit(space); m_writer->emit(") "); } diff --git a/tests/compute/compile-time-loop.slang b/tests/compute/compile-time-loop.slang index 840ffd145..9035bde2a 100644 --- a/tests/compute/compile-time-loop.slang +++ b/tests/compute/compile-time-loop.slang @@ -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 diff --git a/tests/compute/discard-stmt.slang b/tests/compute/discard-stmt.slang index b665a56a8..fa00c9ec3 100644 --- a/tests/compute/discard-stmt.slang +++ b/tests/compute/discard-stmt.slang @@ -3,7 +3,6 @@ //TEST_INPUT: Texture2D(size=4, content = one):name tex //TEST_INPUT: Sampler:name samp //TEST_INPUT: ubuffer(data=[0 0], stride=4):out,name outputBuffer -//DISABLE_TEST(compute):COMPARE_COMPUTE:-wgpu Texture2D tex; diff --git a/tests/compute/texture-sampling.slang b/tests/compute/texture-sampling.slang index 3e56be5a7..d8c5f4c4b 100644 --- a/tests/compute/texture-sampling.slang +++ b/tests/compute/texture-sampling.slang @@ -12,6 +12,7 @@ //TEST_INPUT: TextureCube(size=4, content = one, arrayLength=2):name=tCubeArray //TEST_INPUT: Sampler:name=samplerState //TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +// There is no texture_1d_array type in WGSL https://github.com/shader-slang/slang/issues/5223 //DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -wgpu Texture1D t1D; diff --git a/tests/expected-failure-github.txt b/tests/expected-failure-github.txt index 11dac66fe..117a0372a 100644 --- a/tests/expected-failure-github.txt +++ b/tests/expected-failure-github.txt @@ -19,10 +19,8 @@ tests/compute/atomics (wgpu) tests/compute/atomics-buffer (wgpu) tests/compute/atomics-groupshared (wgpu) tests/compute/buffer-type-splitting (wgpu) -tests/compute/compile-time-loop.slang.2 syn (wgpu) tests/compute/constant-buffer-memory-packing.slang.6 syn (wgpu) tests/compute/constexpr.slang.2 syn (wgpu) -tests/compute/discard-stmt.slang.2 syn (wgpu) tests/compute/func-cbuffer-param.slang.4 syn (wgpu) tests/compute/interface-shader-param-in-struct.slang.4 syn (wgpu) tests/compute/interface-shader-param.slang.5 syn (wgpu) diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp index e64954029..d128be453 100644 --- a/tools/render-test/render-test-main.cpp +++ b/tools/render-test/render-test-main.cpp @@ -597,7 +597,7 @@ SlangResult RenderTestApp::initialize( BufferDesc vertexBufferDesc; vertexBufferDesc.size = kVertexCount * sizeof(Vertex); - vertexBufferDesc.memoryType = MemoryType::Upload; + vertexBufferDesc.memoryType = MemoryType::DeviceLocal; vertexBufferDesc.usage = BufferUsage::VertexBuffer; vertexBufferDesc.defaultState = ResourceState::VertexBuffer; |
