tint/writer/spirv: Inline constant expressions

This is required to handle materialized values, and for constant
expressions.

Bug: tint:1504
Change-Id: If0a49e9b03566c06aa6e4e4c284fc427e1541e91
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92082
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
Ben Clayton
2022-06-01 15:57:22 +00:00
committed by Dawn LUCI CQ
parent 609ce6de8d
commit 8e3485248e
242 changed files with 10432 additions and 10031 deletions

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Bound: 16
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -16,17 +16,16 @@
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
%9 = OpConstantNull %float
%float_0 = OpConstant %float 0
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_float Function %9
%b = OpVariable %_ptr_Function_float Function %9
OpStore %a %float_1
OpStore %b %float_0
%12 = OpLoad %float %a
OpStore %b %9
%11 = OpLoad %float %a
%12 = OpLoad %float %b
%13 = OpLoad %float %b
%14 = OpLoad %float %b
%15 = OpFAdd %float %13 %14
%16 = OpFRem %float %12 %15
%14 = OpFAdd %float %12 %13
%15 = OpFRem %float %11 %14
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Bound: 16
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -16,17 +16,16 @@
%int_1 = OpConstant %int 1
%_ptr_Function_int = OpTypePointer Function %int
%9 = OpConstantNull %int
%int_0 = OpConstant %int 0
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_int Function %9
%b = OpVariable %_ptr_Function_int Function %9
OpStore %a %int_1
OpStore %b %int_0
%12 = OpLoad %int %a
OpStore %b %9
%11 = OpLoad %int %a
%12 = OpLoad %int %b
%13 = OpLoad %int %b
%14 = OpLoad %int %b
%15 = OpIAdd %int %13 %14
%16 = OpSMod %int %12 %15
%14 = OpIAdd %int %12 %13
%15 = OpSMod %int %11 %14
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Bound: 16
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -16,17 +16,16 @@
%uint_1 = OpConstant %uint 1
%_ptr_Function_uint = OpTypePointer Function %uint
%9 = OpConstantNull %uint
%uint_0 = OpConstant %uint 0
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_uint Function %9
%b = OpVariable %_ptr_Function_uint Function %9
OpStore %a %uint_1
OpStore %b %uint_0
%12 = OpLoad %uint %a
OpStore %b %9
%11 = OpLoad %uint %a
%12 = OpLoad %uint %b
%13 = OpLoad %uint %b
%14 = OpLoad %uint %b
%15 = OpIAdd %uint %13 %14
%16 = OpUMod %uint %12 %15
%14 = OpIAdd %uint %12 %13
%15 = OpUMod %uint %11 %14
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Bound: 24
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -20,21 +20,20 @@
%10 = OpConstantComposite %v3int %int_1 %int_2 %int_3
%_ptr_Function_v3int = OpTypePointer Function %v3int
%13 = OpConstantNull %v3int
%int_0 = OpConstant %int 0
%14 = OpConstantNull %int
%_ptr_Function_int = OpTypePointer Function %int
%17 = OpConstantNull %int
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_v3int Function %13
%b = OpVariable %_ptr_Function_int Function %17
%23 = OpVariable %_ptr_Function_v3int Function %13
%b = OpVariable %_ptr_Function_int Function %14
%22 = OpVariable %_ptr_Function_v3int Function %13
OpStore %a %10
OpStore %b %int_0
%18 = OpLoad %v3int %a
OpStore %b %14
%17 = OpLoad %v3int %a
%18 = OpLoad %int %b
%19 = OpLoad %int %b
%20 = OpLoad %int %b
%21 = OpIAdd %int %19 %20
%24 = OpCompositeConstruct %v3int %21 %21 %21
%22 = OpSMod %v3int %18 %24
%20 = OpIAdd %int %18 %19
%23 = OpCompositeConstruct %v3int %20 %20 %20
%21 = OpSMod %v3int %17 %23
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Bound: 24
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -20,21 +20,20 @@
%10 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
%13 = OpConstantNull %v3uint
%uint_0 = OpConstant %uint 0
%14 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%17 = OpConstantNull %uint
%f = OpFunction %void None %1
%4 = OpLabel
%a = OpVariable %_ptr_Function_v3uint Function %13
%b = OpVariable %_ptr_Function_uint Function %17
%23 = OpVariable %_ptr_Function_v3uint Function %13
%b = OpVariable %_ptr_Function_uint Function %14
%22 = OpVariable %_ptr_Function_v3uint Function %13
OpStore %a %10
OpStore %b %uint_0
%18 = OpLoad %v3uint %a
OpStore %b %14
%17 = OpLoad %v3uint %a
%18 = OpLoad %uint %b
%19 = OpLoad %uint %b
%20 = OpLoad %uint %b
%21 = OpIAdd %uint %19 %20
%24 = OpCompositeConstruct %v3uint %21 %21 %21
%22 = OpUMod %v3uint %18 %24
%20 = OpIAdd %uint %18 %19
%23 = OpCompositeConstruct %v3uint %20 %20 %20
%21 = OpUMod %v3uint %17 %23
OpReturn
OpFunctionEnd