tint/intrinsics: Texture queries now return unsigned integer / vectors

To match the spec.

Also add a bunch of missing texture test cases to
src/tint/ast/builtin_texture_helper_test.cc. Fix all the tests that were
broken because these were not being exercised.

Fixed: tint:1526
Change-Id: I207b51d307bbdc054b595e0e0e0fd3330607e171
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106681
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton
2022-10-26 18:36:44 +00:00
committed by Dawn LUCI CQ
parent 980145bc16
commit 13f089095f
5443 changed files with 116933 additions and 115307 deletions

View File

@@ -5,7 +5,7 @@ void textureNumSamples_a3c8a0() {
int res = 0;
int3 tint_tmp;
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
const int x_16 = tint_tmp.z;
const int x_16 = int(tint_tmp.z);
res = x_16;
return;
}

View File

@@ -5,7 +5,7 @@ void textureNumSamples_a3c8a0() {
int res = 0;
int3 tint_tmp;
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
const int x_16 = tint_tmp.z;
const int x_16 = int(tint_tmp.z);
res = x_16;
return;
}

View File

@@ -6,7 +6,7 @@ vec4 tint_symbol_1 = vec4(0.0f);
uniform highp sampler2DMS arg_0_1;
void textureNumSamples_a3c8a0() {
int res = 0;
int x_16 = textureSamples(arg_0_1);
int x_16 = int(uint(textureSamples(arg_0_1)));
res = x_16;
return;
}
@@ -42,9 +42,8 @@ void main() {
}
Error parsing GLSL shader:
ERROR: 0:7: 'textureSamples' : no matching overloaded function found
ERROR: 0:7: '=' : cannot convert from ' const float' to ' temp highp int'
ERROR: 0:7: '' : compilation terminated
ERROR: 3 compilation errors. No code generated.
ERROR: 2 compilation errors. No code generated.
@@ -54,7 +53,7 @@ precision mediump float;
uniform highp sampler2DMS arg_0_1;
void textureNumSamples_a3c8a0() {
int res = 0;
int x_16 = textureSamples(arg_0_1);
int x_16 = int(uint(textureSamples(arg_0_1)));
res = x_16;
return;
}
@@ -78,9 +77,8 @@ void main() {
}
Error parsing GLSL shader:
ERROR: 0:7: 'textureSamples' : no matching overloaded function found
ERROR: 0:7: '=' : cannot convert from ' const float' to ' temp mediump int'
ERROR: 0:7: '' : compilation terminated
ERROR: 3 compilation errors. No code generated.
ERROR: 2 compilation errors. No code generated.
@@ -89,7 +87,7 @@ ERROR: 3 compilation errors. No code generated.
uniform highp sampler2DMS arg_0_1;
void textureNumSamples_a3c8a0() {
int res = 0;
int x_16 = textureSamples(arg_0_1);
int x_16 = int(uint(textureSamples(arg_0_1)));
res = x_16;
return;
}
@@ -114,9 +112,8 @@ void main() {
}
Error parsing GLSL shader:
ERROR: 0:6: 'textureSamples' : no matching overloaded function found
ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp highp int'
ERROR: 0:6: '' : compilation terminated
ERROR: 3 compilation errors. No code generated.
ERROR: 2 compilation errors. No code generated.

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 56
; Bound: 58
; Schema: 0
OpCapability Shader
OpCapability ImageQuery
@@ -51,63 +51,65 @@
%int = OpTypeInt 32 1
%19 = OpConstantNull %int
%_ptr_Function_int = OpTypePointer Function %int
%24 = OpTypeFunction %void %v4float
%uint = OpTypeInt 32 0
%26 = OpTypeFunction %void %v4float
%vertex_main_out = OpTypeStruct %v4float
%32 = OpTypeFunction %vertex_main_out
%34 = OpTypeFunction %vertex_main_out
%float_1 = OpConstant %float 1
%textureNumSamples_a3c8a0 = OpFunction %void None %14
%17 = OpLabel
%res = OpVariable %_ptr_Function_int Function %19
OpStore %res %19
%23 = OpLoad %11 %arg_0
%22 = OpImageQuerySamples %int %23
%25 = OpLoad %11 %arg_0
%23 = OpImageQuerySamples %uint %25
%22 = OpBitcast %int %23
OpStore %res %22
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %24
%tint_symbol_2 = OpFunction %void None %26
%tint_symbol = OpFunctionParameter %v4float
%27 = OpLabel
%29 = OpLabel
OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
%vertex_main_1 = OpFunction %void None %14
%29 = OpLabel
%30 = OpFunctionCall %void %textureNumSamples_a3c8a0
%31 = OpFunctionCall %void %tint_symbol_2 %5
%31 = OpLabel
%32 = OpFunctionCall %void %textureNumSamples_a3c8a0
%33 = OpFunctionCall %void %tint_symbol_2 %5
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %vertex_main_out None %32
%35 = OpLabel
%36 = OpFunctionCall %void %vertex_main_1
%37 = OpLoad %v4float %tint_symbol_1
%38 = OpCompositeConstruct %vertex_main_out %37
OpReturnValue %38
%vertex_main_inner = OpFunction %vertex_main_out None %34
%37 = OpLabel
%38 = OpFunctionCall %void %vertex_main_1
%39 = OpLoad %v4float %tint_symbol_1
%40 = OpCompositeConstruct %vertex_main_out %39
OpReturnValue %40
OpFunctionEnd
%vertex_main = OpFunction %void None %14
%40 = OpLabel
%41 = OpFunctionCall %vertex_main_out %vertex_main_inner
%42 = OpCompositeExtract %v4float %41 0
OpStore %tint_symbol_1_1_1 %42
%42 = OpLabel
%43 = OpFunctionCall %vertex_main_out %vertex_main_inner
%44 = OpCompositeExtract %v4float %43 0
OpStore %tint_symbol_1_1_1 %44
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main_1 = OpFunction %void None %14
%45 = OpLabel
%46 = OpFunctionCall %void %textureNumSamples_a3c8a0
%47 = OpLabel
%48 = OpFunctionCall %void %textureNumSamples_a3c8a0
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %14
%48 = OpLabel
%49 = OpFunctionCall %void %fragment_main_1
%50 = OpLabel
%51 = OpFunctionCall %void %fragment_main_1
OpReturn
OpFunctionEnd
%compute_main_1 = OpFunction %void None %14
%51 = OpLabel
%52 = OpFunctionCall %void %textureNumSamples_a3c8a0
%53 = OpLabel
%54 = OpFunctionCall %void %textureNumSamples_a3c8a0
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %14
%54 = OpLabel
%55 = OpFunctionCall %void %compute_main_1
%56 = OpLabel
%57 = OpFunctionCall %void %compute_main_1
OpReturn
OpFunctionEnd

View File

@@ -4,7 +4,7 @@ var<private> tint_symbol_1 : vec4<f32> = vec4<f32>();
fn textureNumSamples_a3c8a0() {
var res : i32 = 0i;
let x_16 : i32 = textureNumSamples(arg_0);
let x_16 : i32 = i32(textureNumSamples(arg_0));
res = x_16;
return;
}