mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 13:38:00 +00:00
Implemement const-eval for some pack routines.
This CL adds const-eval for pack2x16snorm, pack2x16unorm, pack4x8snorm and pack4x8unorm. Bug: tint:1581 Change-Id: I58d8f02da32a6a173ca54ee5110ca7be39e2c52f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108466 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
3b2b5484e2
commit
2d706a0436
@@ -1,10 +1,5 @@
|
||||
uint tint_pack2x16snorm(float2 param_0) {
|
||||
int2 i = int2(round(clamp(param_0, -1.0, 1.0) * 32767.0)) & 0xffff;
|
||||
return asuint(i.x | i.y << 16);
|
||||
}
|
||||
|
||||
void pack2x16snorm_6c169b() {
|
||||
uint res = tint_pack2x16snorm((1.0f).xx);
|
||||
uint res = 2147450879u;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
uint tint_pack2x16snorm(float2 param_0) {
|
||||
int2 i = int2(round(clamp(param_0, -1.0, 1.0) * 32767.0)) & 0xffff;
|
||||
return asuint(i.x | i.y << 16);
|
||||
}
|
||||
|
||||
void pack2x16snorm_6c169b() {
|
||||
uint res = tint_pack2x16snorm((1.0f).xx);
|
||||
uint res = 2147450879u;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#version 310 es
|
||||
|
||||
void pack2x16snorm_6c169b() {
|
||||
uint res = packSnorm2x16(vec2(1.0f));
|
||||
uint res = 2147450879u;
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
@@ -21,7 +21,7 @@ void main() {
|
||||
precision mediump float;
|
||||
|
||||
void pack2x16snorm_6c169b() {
|
||||
uint res = packSnorm2x16(vec2(1.0f));
|
||||
uint res = 2147450879u;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
@@ -35,7 +35,7 @@ void main() {
|
||||
#version 310 es
|
||||
|
||||
void pack2x16snorm_6c169b() {
|
||||
uint res = packSnorm2x16(vec2(1.0f));
|
||||
uint res = 2147450879u;
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
using namespace metal;
|
||||
void pack2x16snorm_6c169b() {
|
||||
uint res = pack_float_to_snorm2x16(float2(1.0f));
|
||||
uint res = 2147450879u;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 35
|
||||
; Bound: 32
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%15 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
@@ -32,38 +31,36 @@
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%v2float = OpTypeVector %float 2
|
||||
%float_1 = OpConstant %float 1
|
||||
%18 = OpConstantComposite %v2float %float_1 %float_1
|
||||
%uint_2147450879 = OpConstant %uint 2147450879
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%21 = OpConstantNull %uint
|
||||
%22 = OpTypeFunction %v4float
|
||||
%17 = OpConstantNull %uint
|
||||
%18 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%pack2x16snorm_6c169b = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_uint Function %21
|
||||
%13 = OpExtInst %uint %15 PackSnorm2x16 %18
|
||||
OpStore %res %13
|
||||
%res = OpVariable %_ptr_Function_uint Function %17
|
||||
OpStore %res %uint_2147450879
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %22
|
||||
%24 = OpLabel
|
||||
%25 = OpFunctionCall %void %pack2x16snorm_6c169b
|
||||
%vertex_main_inner = OpFunction %v4float None %18
|
||||
%20 = OpLabel
|
||||
%21 = OpFunctionCall %void %pack2x16snorm_6c169b
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%27 = OpLabel
|
||||
%28 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %28
|
||||
%23 = OpLabel
|
||||
%24 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %24
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%27 = OpLabel
|
||||
%28 = OpFunctionCall %void %pack2x16snorm_6c169b
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%30 = OpLabel
|
||||
%31 = OpFunctionCall %void %pack2x16snorm_6c169b
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%33 = OpLabel
|
||||
%34 = OpFunctionCall %void %pack2x16snorm_6c169b
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
uint tint_pack2x16unorm(float2 param_0) {
|
||||
uint2 i = uint2(round(clamp(param_0, 0.0, 1.0) * 65535.0));
|
||||
return (i.x | i.y << 16);
|
||||
}
|
||||
|
||||
void pack2x16unorm_0f08e4() {
|
||||
uint res = tint_pack2x16unorm((1.0f).xx);
|
||||
uint res = 4294967295u;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
uint tint_pack2x16unorm(float2 param_0) {
|
||||
uint2 i = uint2(round(clamp(param_0, 0.0, 1.0) * 65535.0));
|
||||
return (i.x | i.y << 16);
|
||||
}
|
||||
|
||||
void pack2x16unorm_0f08e4() {
|
||||
uint res = tint_pack2x16unorm((1.0f).xx);
|
||||
uint res = 4294967295u;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#version 310 es
|
||||
|
||||
void pack2x16unorm_0f08e4() {
|
||||
uint res = packUnorm2x16(vec2(1.0f));
|
||||
uint res = 4294967295u;
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
@@ -21,7 +21,7 @@ void main() {
|
||||
precision mediump float;
|
||||
|
||||
void pack2x16unorm_0f08e4() {
|
||||
uint res = packUnorm2x16(vec2(1.0f));
|
||||
uint res = 4294967295u;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
@@ -35,7 +35,7 @@ void main() {
|
||||
#version 310 es
|
||||
|
||||
void pack2x16unorm_0f08e4() {
|
||||
uint res = packUnorm2x16(vec2(1.0f));
|
||||
uint res = 4294967295u;
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
using namespace metal;
|
||||
void pack2x16unorm_0f08e4() {
|
||||
uint res = pack_float_to_unorm2x16(float2(1.0f));
|
||||
uint res = 4294967295u;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 35
|
||||
; Bound: 32
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%15 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
@@ -32,38 +31,36 @@
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%v2float = OpTypeVector %float 2
|
||||
%float_1 = OpConstant %float 1
|
||||
%18 = OpConstantComposite %v2float %float_1 %float_1
|
||||
%uint_4294967295 = OpConstant %uint 4294967295
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%21 = OpConstantNull %uint
|
||||
%22 = OpTypeFunction %v4float
|
||||
%17 = OpConstantNull %uint
|
||||
%18 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%pack2x16unorm_0f08e4 = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_uint Function %21
|
||||
%13 = OpExtInst %uint %15 PackUnorm2x16 %18
|
||||
OpStore %res %13
|
||||
%res = OpVariable %_ptr_Function_uint Function %17
|
||||
OpStore %res %uint_4294967295
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %22
|
||||
%24 = OpLabel
|
||||
%25 = OpFunctionCall %void %pack2x16unorm_0f08e4
|
||||
%vertex_main_inner = OpFunction %v4float None %18
|
||||
%20 = OpLabel
|
||||
%21 = OpFunctionCall %void %pack2x16unorm_0f08e4
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%27 = OpLabel
|
||||
%28 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %28
|
||||
%23 = OpLabel
|
||||
%24 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %24
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%27 = OpLabel
|
||||
%28 = OpFunctionCall %void %pack2x16unorm_0f08e4
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%30 = OpLabel
|
||||
%31 = OpFunctionCall %void %pack2x16unorm_0f08e4
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%33 = OpLabel
|
||||
%34 = OpFunctionCall %void %pack2x16unorm_0f08e4
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
uint tint_pack4x8snorm(float4 param_0) {
|
||||
int4 i = int4(round(clamp(param_0, -1.0, 1.0) * 127.0)) & 0xff;
|
||||
return asuint(i.x | i.y << 8 | i.z << 16 | i.w << 24);
|
||||
}
|
||||
|
||||
void pack4x8snorm_4d22e7() {
|
||||
uint res = tint_pack4x8snorm((1.0f).xxxx);
|
||||
uint res = 2139062143u;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
uint tint_pack4x8snorm(float4 param_0) {
|
||||
int4 i = int4(round(clamp(param_0, -1.0, 1.0) * 127.0)) & 0xff;
|
||||
return asuint(i.x | i.y << 8 | i.z << 16 | i.w << 24);
|
||||
}
|
||||
|
||||
void pack4x8snorm_4d22e7() {
|
||||
uint res = tint_pack4x8snorm((1.0f).xxxx);
|
||||
uint res = 2139062143u;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#version 310 es
|
||||
|
||||
void pack4x8snorm_4d22e7() {
|
||||
uint res = packSnorm4x8(vec4(1.0f));
|
||||
uint res = 2139062143u;
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
@@ -21,7 +21,7 @@ void main() {
|
||||
precision mediump float;
|
||||
|
||||
void pack4x8snorm_4d22e7() {
|
||||
uint res = packSnorm4x8(vec4(1.0f));
|
||||
uint res = 2139062143u;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
@@ -35,7 +35,7 @@ void main() {
|
||||
#version 310 es
|
||||
|
||||
void pack4x8snorm_4d22e7() {
|
||||
uint res = packSnorm4x8(vec4(1.0f));
|
||||
uint res = 2139062143u;
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
using namespace metal;
|
||||
void pack4x8snorm_4d22e7() {
|
||||
uint res = pack_float_to_snorm4x8(float4(1.0f));
|
||||
uint res = 2139062143u;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 34
|
||||
; Bound: 32
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%15 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
@@ -32,37 +31,36 @@
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
|
||||
%uint_2139062143 = OpConstant %uint 2139062143
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%20 = OpConstantNull %uint
|
||||
%21 = OpTypeFunction %v4float
|
||||
%17 = OpConstantNull %uint
|
||||
%18 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%pack4x8snorm_4d22e7 = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_uint Function %20
|
||||
%13 = OpExtInst %uint %15 PackSnorm4x8 %17
|
||||
OpStore %res %13
|
||||
%res = OpVariable %_ptr_Function_uint Function %17
|
||||
OpStore %res %uint_2139062143
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %21
|
||||
%23 = OpLabel
|
||||
%24 = OpFunctionCall %void %pack4x8snorm_4d22e7
|
||||
%vertex_main_inner = OpFunction %v4float None %18
|
||||
%20 = OpLabel
|
||||
%21 = OpFunctionCall %void %pack4x8snorm_4d22e7
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%26 = OpLabel
|
||||
%27 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %27
|
||||
%23 = OpLabel
|
||||
%24 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %24
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %pack4x8snorm_4d22e7
|
||||
%27 = OpLabel
|
||||
%28 = OpFunctionCall %void %pack4x8snorm_4d22e7
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %pack4x8snorm_4d22e7
|
||||
%30 = OpLabel
|
||||
%31 = OpFunctionCall %void %pack4x8snorm_4d22e7
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
uint tint_pack4x8unorm(float4 param_0) {
|
||||
uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0));
|
||||
return (i.x | i.y << 8 | i.z << 16 | i.w << 24);
|
||||
}
|
||||
|
||||
void pack4x8unorm_95c456() {
|
||||
uint res = tint_pack4x8unorm((1.0f).xxxx);
|
||||
uint res = 4294967295u;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
uint tint_pack4x8unorm(float4 param_0) {
|
||||
uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0));
|
||||
return (i.x | i.y << 8 | i.z << 16 | i.w << 24);
|
||||
}
|
||||
|
||||
void pack4x8unorm_95c456() {
|
||||
uint res = tint_pack4x8unorm((1.0f).xxxx);
|
||||
uint res = 4294967295u;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#version 310 es
|
||||
|
||||
void pack4x8unorm_95c456() {
|
||||
uint res = packUnorm4x8(vec4(1.0f));
|
||||
uint res = 4294967295u;
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
@@ -21,7 +21,7 @@ void main() {
|
||||
precision mediump float;
|
||||
|
||||
void pack4x8unorm_95c456() {
|
||||
uint res = packUnorm4x8(vec4(1.0f));
|
||||
uint res = 4294967295u;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
@@ -35,7 +35,7 @@ void main() {
|
||||
#version 310 es
|
||||
|
||||
void pack4x8unorm_95c456() {
|
||||
uint res = packUnorm4x8(vec4(1.0f));
|
||||
uint res = 4294967295u;
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
using namespace metal;
|
||||
void pack4x8unorm_95c456() {
|
||||
uint res = pack_float_to_unorm4x8(float4(1.0f));
|
||||
uint res = 4294967295u;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 34
|
||||
; Bound: 32
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%15 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
@@ -32,37 +31,36 @@
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
|
||||
%uint_4294967295 = OpConstant %uint 4294967295
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%20 = OpConstantNull %uint
|
||||
%21 = OpTypeFunction %v4float
|
||||
%17 = OpConstantNull %uint
|
||||
%18 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%pack4x8unorm_95c456 = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_uint Function %20
|
||||
%13 = OpExtInst %uint %15 PackUnorm4x8 %17
|
||||
OpStore %res %13
|
||||
%res = OpVariable %_ptr_Function_uint Function %17
|
||||
OpStore %res %uint_4294967295
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %21
|
||||
%23 = OpLabel
|
||||
%24 = OpFunctionCall %void %pack4x8unorm_95c456
|
||||
%vertex_main_inner = OpFunction %v4float None %18
|
||||
%20 = OpLabel
|
||||
%21 = OpFunctionCall %void %pack4x8unorm_95c456
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %9
|
||||
%26 = OpLabel
|
||||
%27 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %27
|
||||
%23 = OpLabel
|
||||
%24 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %24
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %9
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %void %pack4x8unorm_95c456
|
||||
%27 = OpLabel
|
||||
%28 = OpFunctionCall %void %pack4x8unorm_95c456
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %9
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %pack4x8unorm_95c456
|
||||
%30 = OpLabel
|
||||
%31 = OpFunctionCall %void %pack4x8unorm_95c456
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user