mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-05 19:55:37 +00:00
This uses FXC compilation failure mitigation for _any_ vector index assignment that has a non-constant index. FXC can still fall over if the loop calls a function that performs the dynamic index. Use some vector swizzle logic to avoid branches in the helper. Fixed: tint:980 Change-Id: I2a759d88a7d884bc61b4631cf57feb4acc8178de Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57882 Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com>
73 lines
2.9 KiB
Plaintext
73 lines
2.9 KiB
Plaintext
; SPIR-V
|
|
; Version: 1.3
|
|
; Generator: Google Tint Compiler; 0
|
|
; Bound: 41
|
|
; Schema: 0
|
|
OpCapability Shader
|
|
%23 = OpExtInstImport "GLSL.std.450"
|
|
OpMemoryModel Logical GLSL450
|
|
OpEntryPoint GLCompute %main "main"
|
|
OpExecutionMode %main LocalSize 1 1 1
|
|
OpName %S "S"
|
|
OpMemberName %S 0 "v"
|
|
OpMemberName %S 1 "i"
|
|
OpName %io "io"
|
|
OpName %tint_symbol "tint_symbol"
|
|
OpName %Bad "Bad"
|
|
OpName %index "index"
|
|
OpName %rd "rd"
|
|
OpName %normal "normal"
|
|
OpName %main "main"
|
|
OpDecorate %S Block
|
|
OpMemberDecorate %S 0 Offset 0
|
|
OpMemberDecorate %S 1 Offset 12
|
|
OpDecorate %io Binding 0
|
|
OpDecorate %io DescriptorSet 0
|
|
OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
|
|
%float = OpTypeFloat 32
|
|
%v3float = OpTypeVector %float 3
|
|
%uint = OpTypeInt 32 0
|
|
%S = OpTypeStruct %v3float %uint
|
|
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
|
%io = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
|
%_ptr_Input_uint = OpTypePointer Input %uint
|
|
%tint_symbol = OpVariable %_ptr_Input_uint Input
|
|
%9 = OpTypeFunction %v3float %uint %v3float
|
|
%float_0 = OpConstant %float 0
|
|
%15 = OpConstantComposite %v3float %float_0 %float_0 %float_0
|
|
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
|
%18 = OpConstantNull %v3float
|
|
%_ptr_Function_float = OpTypePointer Function %float
|
|
%void = OpTypeVoid
|
|
%27 = OpTypeFunction %void
|
|
%uint_0 = OpConstant %uint 0
|
|
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
|
|
%uint_1 = OpConstant %uint 1
|
|
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
|
|
%Bad = OpFunction %v3float None %9
|
|
%index = OpFunctionParameter %uint
|
|
%rd = OpFunctionParameter %v3float
|
|
%13 = OpLabel
|
|
%normal = OpVariable %_ptr_Function_v3float Function %18
|
|
OpStore %normal %15
|
|
%20 = OpAccessChain %_ptr_Function_float %normal %index
|
|
%24 = OpVectorExtractDynamic %float %rd %index
|
|
%22 = OpExtInst %float %23 FSign %24
|
|
%21 = OpFNegate %float %22
|
|
OpStore %20 %21
|
|
%26 = OpLoad %v3float %normal
|
|
%25 = OpExtInst %v3float %23 Normalize %26
|
|
OpReturnValue %25
|
|
OpFunctionEnd
|
|
%main = OpFunction %void None %27
|
|
%30 = OpLabel
|
|
%33 = OpAccessChain %_ptr_StorageBuffer_v3float %io %uint_0
|
|
%37 = OpAccessChain %_ptr_StorageBuffer_uint %io %uint_1
|
|
%38 = OpLoad %uint %37
|
|
%39 = OpAccessChain %_ptr_StorageBuffer_v3float %io %uint_0
|
|
%40 = OpLoad %v3float %39
|
|
%34 = OpFunctionCall %v3float %Bad %38 %40
|
|
OpStore %33 %34
|
|
OpReturn
|
|
OpFunctionEnd
|