mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
GLSL: fix textureLoad() and textureStore(), depth textures, and more.
The CombineSamplers transform was incorrectly flagging StorageTexture (which in GLSL ends up as image2D) as needing to be combined with a sampler, or at least renamed. This is incorrect: StorageTexture never has an associated sampler, so don't try to pair it up and just output it as image* in GLSL. In GLSL, textureLoad (aka texelFetch) of depth textures is not allowed. The fix is to bind the depth texture as the corresponding f32 texture instead (e.g., texture_depth_2d -> texture_2d<f32>, texture_depth_cube -> texture_cube<f32>, etc). This requires changing both the uniform globals and function parameter types. We're now going to receive a vec4 instead of a float from texelFetch, so add a ".x" member accessor to retrieve the first component. (Note that we don't do this inside a CallStatement since this gives the CloneContext indigestion, and CallStatement is going to ignore the result of the call anyway.) We were failing to find the dummy samplers that Dawn creates for the calls that actually do require a dummy sampler, since the old Inspector implementation of GetSamplerTextureUses() does not find them. The fix is to implement a new Inspector call to return the texture/sampler pairs the Resolver found during resolution. This will include the dummy sampler as a null variable pointer. In order to identify the placeholder sampler, we pass in a BindingPair to represent it. When we discover a null sampler in the variable pair, we return the passed-in placeholder binding point to the caller (Dawn). (Dawn will use a group of kMaxBindGroups, to ensure that it never collides with an existing sampler.) Bug: tint:1298 Change-Id: I82e142c2b4318608c27a9fa9521c27f15a6214cd Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78820 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
committed by
Tint LUCI CQ
parent
382b2a23c8
commit
d9b32c3178
@@ -3,7 +3,7 @@ SKIP: FAILED
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(r32f) uniform highp writeonly image1D x_20_1;
|
||||
layout(r32f) uniform highp writeonly image1D x_20;
|
||||
void main_1() {
|
||||
float float_var = 0.0f;
|
||||
int i1 = 1;
|
||||
@@ -18,7 +18,7 @@ void main_1() {
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
vec3 vf123 = vec3(1.0f, 2.0f, 3.0f);
|
||||
vec4 vf1234 = vec4(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
imageStore(x_20_1, int(u1), vf1234);
|
||||
imageStore(x_20, int(u1), vf1234);
|
||||
uint x_1000 = 0u;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
SKIP: FAILED
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
uniform highp sampler2DShadow x_20_1;
|
||||
void main_1() {
|
||||
float f1 = 1.0f;
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
vec3 vf123 = vec3(1.0f, 2.0f, 3.0f);
|
||||
vec4 vf1234 = vec4(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
int i1 = 1;
|
||||
ivec2 vi12 = ivec2(1, 2);
|
||||
ivec3 vi123 = ivec3(1, 2, 3);
|
||||
ivec4 vi1234 = ivec4(1, 2, 3, 4);
|
||||
uint u1 = 1u;
|
||||
uvec2 vu12 = uvec2(1u, 2u);
|
||||
uvec3 vu123 = uvec3(1u, 2u, 3u);
|
||||
uvec4 vu1234 = uvec4(1u, 2u, 3u, 4u);
|
||||
ivec2 offsets2d = ivec2(3, 4);
|
||||
vec4 x_99 = vec4(texelFetch(x_20_1, vi12, 0).x, 0.0f, 0.0f, 0.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol() {
|
||||
main_1();
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
Error parsing GLSL shader:
|
||||
ERROR: 0:19: 'texelFetch' : no matching overloaded function found
|
||||
ERROR: 0:19: '' : compilation terminated
|
||||
ERROR: 2 compilation errors. No code generated.
|
||||
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
SKIP: FAILED
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
uniform highp sampler2DShadow x_20_1;
|
||||
void main_1() {
|
||||
float f1 = 1.0f;
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
vec3 vf123 = vec3(1.0f, 2.0f, 3.0f);
|
||||
vec4 vf1234 = vec4(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
int i1 = 1;
|
||||
ivec2 vi12 = ivec2(1, 2);
|
||||
ivec3 vi123 = ivec3(1, 2, 3);
|
||||
ivec4 vi1234 = ivec4(1, 2, 3, 4);
|
||||
uint u1 = 1u;
|
||||
uvec2 vu12 = uvec2(1u, 2u);
|
||||
uvec3 vu123 = uvec3(1u, 2u, 3u);
|
||||
uvec4 vu1234 = uvec4(1u, 2u, 3u, 4u);
|
||||
ivec2 offsets2d = ivec2(3, 4);
|
||||
vec4 x_99 = vec4(texelFetch(x_20_1, vi12, 0).x, 0.0f, 0.0f, 0.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol() {
|
||||
main_1();
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
Error parsing GLSL shader:
|
||||
ERROR: 0:19: 'texelFetch' : no matching overloaded function found
|
||||
ERROR: 0:19: '' : compilation terminated
|
||||
ERROR: 2 compilation errors. No code generated.
|
||||
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
SKIP: FAILED
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
uniform highp sampler2DShadow x_20_1;
|
||||
void main_1() {
|
||||
float f1 = 1.0f;
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
vec3 vf123 = vec3(1.0f, 2.0f, 3.0f);
|
||||
vec4 vf1234 = vec4(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
int i1 = 1;
|
||||
ivec2 vi12 = ivec2(1, 2);
|
||||
ivec3 vi123 = ivec3(1, 2, 3);
|
||||
ivec4 vi1234 = ivec4(1, 2, 3, 4);
|
||||
uint u1 = 1u;
|
||||
uvec2 vu12 = uvec2(1u, 2u);
|
||||
uvec3 vu123 = uvec3(1u, 2u, 3u);
|
||||
uvec4 vu1234 = uvec4(1u, 2u, 3u, 4u);
|
||||
ivec2 offsets2d = ivec2(3, 4);
|
||||
vec4 x_99 = vec4(texelFetch(x_20_1, vi12, 3).x, 0.0f, 0.0f, 0.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol() {
|
||||
main_1();
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
Error parsing GLSL shader:
|
||||
ERROR: 0:19: 'texelFetch' : no matching overloaded function found
|
||||
ERROR: 0:19: '' : compilation terminated
|
||||
ERROR: 2 compilation errors. No code generated.
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ SKIP: FAILED
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
uniform highp sampler2DShadow x_20_1;
|
||||
uniform highp sampler2D x_20_1;
|
||||
void main_1() {
|
||||
float f1 = 1.0f;
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
|
||||
@@ -3,7 +3,7 @@ SKIP: FAILED
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
uniform highp sampler2DArrayShadow x_20_1;
|
||||
uniform highp sampler2DArray x_20_1;
|
||||
void main_1() {
|
||||
float f1 = 1.0f;
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
|
||||
@@ -3,7 +3,7 @@ SKIP: FAILED
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
uniform highp samplerCubeShadow x_20_1;
|
||||
uniform highp samplerCube x_20_1;
|
||||
void main_1() {
|
||||
float f1 = 1.0f;
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
|
||||
@@ -3,7 +3,7 @@ SKIP: FAILED
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
uniform highp samplerCubeArrayShadow x_20_1;
|
||||
uniform highp samplerCubeArray x_20_1;
|
||||
void main_1() {
|
||||
float f1 = 1.0f;
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
@@ -35,7 +35,7 @@ void main() {
|
||||
return;
|
||||
}
|
||||
Error parsing GLSL shader:
|
||||
ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word.
|
||||
ERROR: 0:4: 'samplerCubeArray' : Reserved word.
|
||||
ERROR: 0:4: '' : compilation terminated
|
||||
ERROR: 2 compilation errors. No code generated.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ SKIP: FAILED
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
uniform highp sampler2DArrayShadow x_20_1;
|
||||
uniform highp sampler2DArray x_20_1;
|
||||
void main_1() {
|
||||
float f1 = 1.0f;
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
|
||||
@@ -3,7 +3,7 @@ SKIP: FAILED
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
uniform highp samplerCubeArrayShadow x_20_1;
|
||||
uniform highp samplerCubeArray x_20_1;
|
||||
void main_1() {
|
||||
float f1 = 1.0f;
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
@@ -35,7 +35,7 @@ void main() {
|
||||
return;
|
||||
}
|
||||
Error parsing GLSL shader:
|
||||
ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word.
|
||||
ERROR: 0:4: 'samplerCubeArray' : Reserved word.
|
||||
ERROR: 0:4: '' : compilation terminated
|
||||
ERROR: 2 compilation errors. No code generated.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ SKIP: FAILED
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(rg32f) uniform highp writeonly image2D x_20_1;
|
||||
layout(rg32f) uniform highp writeonly image2D x_20;
|
||||
void main_1() {
|
||||
float f1 = 1.0f;
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
@@ -18,7 +18,7 @@ void main_1() {
|
||||
uvec3 vu123 = uvec3(1u, 2u, 3u);
|
||||
uvec4 vu1234 = uvec4(1u, 2u, 3u, 4u);
|
||||
ivec2 offsets2d = ivec2(3, 4);
|
||||
imageStore(x_20_1, vi12, vec4(vf12, 0.0f, 0.0f));
|
||||
imageStore(x_20, vi12, vec4(vf12, 0.0f, 0.0f));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ SKIP: FAILED
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(rg32f) uniform highp writeonly image2D x_20_1;
|
||||
layout(rg32f) uniform highp writeonly image2D x_20;
|
||||
void main_1() {
|
||||
float f1 = 1.0f;
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
@@ -18,7 +18,7 @@ void main_1() {
|
||||
uvec3 vu123 = uvec3(1u, 2u, 3u);
|
||||
uvec4 vu1234 = uvec4(1u, 2u, 3u, 4u);
|
||||
ivec2 offsets2d = ivec2(3, 4);
|
||||
imageStore(x_20_1, vi12, vec4(vf123, 0.0f));
|
||||
imageStore(x_20, vi12, vec4(vf123, 0.0f));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ SKIP: FAILED
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(rg32f) uniform highp writeonly image2D x_20_1;
|
||||
layout(rg32f) uniform highp writeonly image2D x_20;
|
||||
void main_1() {
|
||||
float f1 = 1.0f;
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
@@ -18,7 +18,7 @@ void main_1() {
|
||||
uvec3 vu123 = uvec3(1u, 2u, 3u);
|
||||
uvec4 vu1234 = uvec4(1u, 2u, 3u, 4u);
|
||||
ivec2 offsets2d = ivec2(3, 4);
|
||||
imageStore(x_20_1, vi12, vf1234);
|
||||
imageStore(x_20, vi12, vf1234);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ SKIP: FAILED
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(r32f) uniform highp writeonly image1D x_20_1;
|
||||
layout(r32f) uniform highp writeonly image1D x_20;
|
||||
void main_1() {
|
||||
float float_var = 0.0f;
|
||||
int i1 = 1;
|
||||
@@ -18,7 +18,7 @@ void main_1() {
|
||||
vec2 vf12 = vec2(1.0f, 2.0f);
|
||||
vec3 vf123 = vec3(1.0f, 2.0f, 3.0f);
|
||||
vec4 vf1234 = vec4(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
imageStore(x_20_1, i1, vf1234);
|
||||
imageStore(x_20, i1, vf1234);
|
||||
uint x_1000 = 0u;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ SKIP: FAILED
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(rg32f) uniform highp writeonly image1D x_20_1;
|
||||
layout(rg32f) uniform highp writeonly image1D x_20;
|
||||
void main_1() {
|
||||
imageStore(x_20_1, int(1u), vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
imageStore(x_20, int(1u), vec4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user