mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-16 04:11:25 +00:00
In this CL the enable directive is implemented. 1. Add AST node for enable directive, assign a ExtensionKind (enum) for each supported extension. 2. Use an unorder_set in ast::Module to record all required extensions' kind. 3. Provide inspector methods for getting names of used extension, and getting all used enable directives' extension names and location. 4. For different writer, the extension nodes are handled in different ways. MSL and HLSL writers will just ignore the extension nodes, while SPIRV and GLSL writers will emit corresponding code. 5. Implement unittests and end2end test for enable directive and inspector, using a reserved extension name `InternalExtensionForTesting`. Bug: tint:1472 Change-Id: I40cb4061554deb477bc2005d7e38c9718385f825 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86623 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
48 lines
1.7 KiB
Plaintext
48 lines
1.7 KiB
Plaintext
; SPIR-V
|
|
; Version: 1.3
|
|
; Generator: Google Tint Compiler; 0
|
|
; Bound: 25
|
|
; Schema: 0
|
|
OpCapability Shader
|
|
OpMemoryModel Logical GLSL450
|
|
OpEntryPoint Fragment %main "main" %value
|
|
OpExecutionMode %main OriginUpperLeft
|
|
OpName %value "value"
|
|
OpName %bar "bar"
|
|
OpName %main_inner "main_inner"
|
|
OpName %a "a"
|
|
OpName %main "main"
|
|
OpDecorate %value Location 0
|
|
%float = OpTypeFloat 32
|
|
%v4float = OpTypeVector %float 4
|
|
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
|
%5 = OpConstantNull %v4float
|
|
%value = OpVariable %_ptr_Output_v4float Output %5
|
|
%void = OpTypeVoid
|
|
%6 = OpTypeFunction %void
|
|
%10 = OpTypeFunction %v4float
|
|
%v2float = OpTypeVector %float 2
|
|
%14 = OpConstantNull %v2float
|
|
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
|
%float_0_400000006 = OpConstant %float 0.400000006
|
|
%float_0_800000012 = OpConstant %float 0.800000012
|
|
%float_1 = OpConstant %float 1
|
|
%21 = OpConstantComposite %v4float %float_0_400000006 %float_0_400000006 %float_0_800000012 %float_1
|
|
%bar = OpFunction %void None %6
|
|
%9 = OpLabel
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%main_inner = OpFunction %v4float None %10
|
|
%12 = OpLabel
|
|
%a = OpVariable %_ptr_Function_v2float Function %14
|
|
OpStore %a %14
|
|
%17 = OpFunctionCall %void %bar
|
|
OpReturnValue %21
|
|
OpFunctionEnd
|
|
%main = OpFunction %void None %6
|
|
%23 = OpLabel
|
|
%24 = OpFunctionCall %v4float %main_inner
|
|
OpStore %value %24
|
|
OpReturn
|
|
OpFunctionEnd
|