mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-05 06:03:34 +00:00
Add `transform::DecomposeStridedMatrix`, which replaces matrix members of storage or uniform buffer structures, that have a [[stride]] decoration, into an array of N column vectors. This is required to correctly handle `mat2x2` matrices in UBOs, as std140 rules will expect a default stride of 16 bytes, when in WGSL the default structure layout expects a stride of 8 bytes. Bug: tint:1047 Change-Id: If5ca3c6ec087bbc1ac31a8d9a657b99bf34042a4 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59840 Reviewed-by: David Neto <dneto@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
39 lines
1.5 KiB
Plaintext
39 lines
1.5 KiB
Plaintext
; SPIR-V
|
|
; Version: 1.3
|
|
; Generator: Google Tint Compiler; 0
|
|
; Bound: 17
|
|
; Schema: 0
|
|
OpCapability Shader
|
|
OpMemoryModel Logical GLSL450
|
|
OpEntryPoint GLCompute %f "f"
|
|
OpExecutionMode %f LocalSize 1 1 1
|
|
OpName %SSBO "SSBO"
|
|
OpMemberName %SSBO 0 "m"
|
|
OpName %ssbo "ssbo"
|
|
OpName %f "f"
|
|
OpDecorate %SSBO Block
|
|
OpMemberDecorate %SSBO 0 Offset 0
|
|
OpMemberDecorate %SSBO 0 ColMajor
|
|
OpMemberDecorate %SSBO 0 MatrixStride 8
|
|
OpDecorate %ssbo DescriptorSet 0
|
|
OpDecorate %ssbo Binding 0
|
|
%float = OpTypeFloat 32
|
|
%v2float = OpTypeVector %float 2
|
|
%mat2v2float = OpTypeMatrix %v2float 2
|
|
%SSBO = OpTypeStruct %mat2v2float
|
|
%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO
|
|
%ssbo = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer
|
|
%void = OpTypeVoid
|
|
%7 = OpTypeFunction %void
|
|
%uint = OpTypeInt 32 0
|
|
%uint_0 = OpConstant %uint 0
|
|
%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
|
|
%f = OpFunction %void None %7
|
|
%10 = OpLabel
|
|
%14 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %ssbo %uint_0
|
|
%15 = OpLoad %mat2v2float %14
|
|
%16 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %ssbo %uint_0
|
|
OpStore %16 %15
|
|
OpReturn
|
|
OpFunctionEnd
|