dawn-cmake/test/tint/var/uses/push_constant.wgsl.expected...

77 lines
2.8 KiB
Plaintext
Raw Normal View History

tint: Add basic support for chromium_experimental_push_constant. This extension adds support for the push_constant storage class such that it can be tested with WGSL test files. The real goal is to allow future transforms that will add push constants that the SPIRV writer will output. The extension: - Adds the `chromium_experimental_push_constant` enable. - Allows the push_constant storage class for global variables. - Adds validation that the types are host-shareable for push_constant variables, and that they don't contain f16 (must be 32bit types only). - Validates that at most one push_constant variable is statically used per entry-point. - Skips validation that the extension has been enabled if kIgnoreStorageClass is used. Tests are added: - For parsing of var<push_constant> - Caught a missing conversion. - For each of the validation rules. - For the wrapping of push constants in structs if needed by AddSpirvBlockAttribute. - For the layout and type rules of the storage class. - For a shader with multiple entry-points using various push constants. - Caught a missing reset of the previous push constant variable in the validation check that at most one is used. - Caught the missing wrapping in structs that had to be added to AddSpirvBlockAttribute. - Caught incorrect logic when adding diagnostics about the call graph leading to the reference to push constants. Bug: tint:1620 Change-Id: I04a5d8e5188c0dcef077f2233ba1359d1575bf51 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96682 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com>
2022-08-02 15:55:35 +00:00
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main1 "main1"
OpEntryPoint GLCompute %main2 "main2"
OpEntryPoint GLCompute %main3 "main3"
OpEntryPoint GLCompute %main4 "main4"
OpExecutionMode %main1 LocalSize 1 1 1
OpExecutionMode %main2 LocalSize 1 1 1
OpExecutionMode %main3 LocalSize 1 1 1
OpExecutionMode %main4 LocalSize 1 1 1
OpName %a_block "a_block"
OpMemberName %a_block 0 "inner"
OpName %a "a"
OpName %b "b"
OpName %c "c"
OpName %uses_a "uses_a"
OpName %uses_uses_a "uses_uses_a"
OpName %uses_b "uses_b"
OpName %main1 "main1"
OpName %main2 "main2"
OpName %main3 "main3"
OpName %main4 "main4"
OpDecorate %a_block Block
OpMemberDecorate %a_block 0 Offset 0
%int = OpTypeInt 32 1
%a_block = OpTypeStruct %int
%_ptr_PushConstant_a_block = OpTypePointer PushConstant %a_block
%a = OpVariable %_ptr_PushConstant_a_block PushConstant
%b = OpVariable %_ptr_PushConstant_a_block PushConstant
%c = OpVariable %_ptr_PushConstant_a_block PushConstant
%void = OpTypeVoid
%7 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_PushConstant_int = OpTypePointer PushConstant %int
%uses_a = OpFunction %void None %7
%10 = OpLabel
%14 = OpAccessChain %_ptr_PushConstant_int %a %uint_0
%15 = OpLoad %int %14
OpReturn
OpFunctionEnd
%uses_uses_a = OpFunction %void None %7
%17 = OpLabel
%18 = OpFunctionCall %void %uses_a
OpReturn
OpFunctionEnd
%uses_b = OpFunction %void None %7
%20 = OpLabel
%21 = OpAccessChain %_ptr_PushConstant_int %b %uint_0
%22 = OpLoad %int %21
OpReturn
OpFunctionEnd
%main1 = OpFunction %void None %7
%24 = OpLabel
%25 = OpFunctionCall %void %uses_a
OpReturn
OpFunctionEnd
%main2 = OpFunction %void None %7
%27 = OpLabel
%28 = OpFunctionCall %void %uses_uses_a
OpReturn
OpFunctionEnd
%main3 = OpFunction %void None %7
%30 = OpLabel
%31 = OpFunctionCall %void %uses_b
OpReturn
OpFunctionEnd
%main4 = OpFunction %void None %7
%33 = OpLabel
OpReturn
OpFunctionEnd