mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-06 12:15:43 +00:00
This transform converts all separate texture/sampler references in a program into combined texture/samplers. This is required for GLSL, which does not support separate texture/samplers. As input, the transform requires a map from the unique sampler/texture pairs previously gathered by the Resolver to strings, which will be used as the names of the newly-generated combined samplers. Note that binding points are unused by GLSL, and so are set to (0, 0) with collision detection disabled. All function signatures containing textures or samplers are rewritten, as well as function calls and texture intrinsic calls. For texture intrinsic calls, a placeholder sampler is used to satisfy the subsequent Resolver pass (GLSL texture intrinsics do not require a separate sampler, but WGSL intrinsics do). The placeholder is also used if the shader contains only texture references (e.g., textureLoad). Bug: tint:1366 Change-Id: Iff8407d28fdc2a8adac5cb655707a08c8553c389 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77080 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
41 lines
932 B
GLSL
41 lines
932 B
GLSL
#version 310 es
|
|
precision mediump float;
|
|
|
|
struct Constants {
|
|
int level;
|
|
};
|
|
|
|
layout (binding = 3) buffer Result_1 {
|
|
float values[];
|
|
} result;
|
|
|
|
struct tint_symbol_2 {
|
|
uvec3 GlobalInvocationID;
|
|
};
|
|
|
|
uniform highp sampler2DArray myTexture_1;
|
|
|
|
void tint_symbol_inner(uvec3 GlobalInvocationID) {
|
|
uint flatIndex = ((((2u * 2u) * GlobalInvocationID.z) + (2u * GlobalInvocationID.y)) + GlobalInvocationID.x);
|
|
flatIndex = (flatIndex * 1u);
|
|
vec4 texel = texelFetch(myTexture_1, ivec3(ivec2(GlobalInvocationID.xy), 0), 0);
|
|
{
|
|
for(uint i = 0u; (i < 1u); i = (i + 1u)) {
|
|
result.values[(flatIndex + i)] = texel.r;
|
|
}
|
|
}
|
|
}
|
|
|
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
|
void tint_symbol(tint_symbol_2 tint_symbol_1) {
|
|
tint_symbol_inner(tint_symbol_1.GlobalInvocationID);
|
|
return;
|
|
}
|
|
void main() {
|
|
tint_symbol_2 inputs;
|
|
inputs.GlobalInvocationID = gl_GlobalInvocationID;
|
|
tint_symbol(inputs);
|
|
}
|
|
|
|
|