Skip to content

Commit

Permalink
wgpu: Enable Metal-like legalization for byte addressible buffers (sh…
Browse files Browse the repository at this point in the history
…ader-slang#5681)

* Enable hlsl-intrinsic/byte-address-buffer/byte-address-struct

* Set byte address buffer legalization options for WGSL
  • Loading branch information
aleino-nv authored Nov 26, 2024
1 parent cf0e3a6 commit 9e21cd4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
9 changes: 9 additions & 0 deletions source/slang/slang-emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,15 @@ Result linkAndOptimizeIR(
byteAddressBufferOptions.translateToStructuredBufferOps = false;
byteAddressBufferOptions.lowerBasicTypeOps = true;
break;
case CodeGenTarget::WGSL:
case CodeGenTarget::WGSLSPIRV:
case CodeGenTarget::WGSLSPIRVAssembly:
byteAddressBufferOptions.scalarizeVectorLoadStore = true;
byteAddressBufferOptions.treatGetEquivalentStructuredBufferAsGetThis = true;
byteAddressBufferOptions.translateToStructuredBufferOps = false;
byteAddressBufferOptions.lowerBasicTypeOps = true;
byteAddressBufferOptions.useBitCastFromUInt = true;
break;
}

// We also need to decide whether to translate
Expand Down
1 change: 0 additions & 1 deletion tests/expected-failure-github.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ tests/autodiff/custom-intrinsic.slang.2 syn (wgpu)
tests/bugs/buffer-swizzle-store.slang.3 syn (wgpu)
tests/compute/interface-shader-param-in-struct.slang.4 syn (wgpu)
tests/compute/interface-shader-param.slang.5 syn (wgpu)
tests/hlsl-intrinsic/byte-address-buffer/byte-address-struct.slang.5 syn (wgpu)
tests/language-feature/constants/static-const-in-generic-interface.slang.1 syn (wgpu)
tests/language-feature/enums/strongly-typed-id.slang.1 syn (wgpu)
tests/language-feature/generics/tuple.slang.1 syn (wgpu)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -shaderobj
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-slang -vk -compute -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX:-slang -cuda -compute -shaderobj
// WGSL: Signed int initialized using unsigned int #5283
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-wgpu

// Note: This input should really be just a `ByteAddressBuffer`,
// so that we can confirm that the functionality works in the
Expand Down

0 comments on commit 9e21cd4

Please sign in to comment.