2022-01-21 22:38:16 +00:00
|
|
|
SKIP: FAILED
|
|
|
|
|
|
|
|
#version 310 es
|
|
|
|
|
2022-01-28 22:36:58 +00:00
|
|
|
layout(location = 0) in vec3 position_1;
|
|
|
|
layout(location = 1) in vec4 color_1;
|
|
|
|
layout(location = 2) in vec2 quad_pos_1;
|
|
|
|
layout(location = 0) out vec4 color_2;
|
|
|
|
layout(location = 1) out vec2 quad_pos_2;
|
2022-01-21 22:38:16 +00:00
|
|
|
struct RenderParams {
|
|
|
|
mat4 modelViewProjectionMatrix;
|
|
|
|
vec3 right;
|
|
|
|
vec3 up;
|
|
|
|
};
|
|
|
|
|
2022-01-25 20:06:05 +00:00
|
|
|
layout(binding = 0) uniform RenderParams_1 {
|
2022-01-21 22:38:16 +00:00
|
|
|
mat4 modelViewProjectionMatrix;
|
|
|
|
vec3 right;
|
|
|
|
vec3 up;
|
|
|
|
} render_params;
|
|
|
|
|
|
|
|
struct VertexInput {
|
|
|
|
vec3 position;
|
|
|
|
vec4 color;
|
|
|
|
vec2 quad_pos;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct VertexOutput {
|
|
|
|
vec4 position;
|
|
|
|
vec4 color;
|
|
|
|
vec2 quad_pos;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct SimulationParams {
|
|
|
|
float deltaTime;
|
|
|
|
vec4 seed;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct Particle {
|
|
|
|
vec3 position;
|
|
|
|
float lifetime;
|
|
|
|
vec4 color;
|
|
|
|
vec3 velocity;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct UBO {
|
|
|
|
uint width;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-28 22:36:58 +00:00
|
|
|
VertexOutput vs_main(VertexInput tint_symbol) {
|
|
|
|
vec3 quad_pos = (mat2x3(render_params.right, render_params.up) * tint_symbol.quad_pos);
|
|
|
|
vec3 position = (tint_symbol.position + (quad_pos * 0.01f));
|
|
|
|
VertexOutput tint_symbol_1 = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec2(0.0f, 0.0f));
|
|
|
|
tint_symbol_1.position = (render_params.modelViewProjectionMatrix * vec4(position, 1.0f));
|
|
|
|
tint_symbol_1.color = tint_symbol.color;
|
|
|
|
tint_symbol_1.quad_pos = tint_symbol.quad_pos;
|
|
|
|
return tint_symbol_1;
|
2022-01-21 22:38:16 +00:00
|
|
|
}
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
void main() {
|
2022-04-22 21:25:02 +00:00
|
|
|
gl_PointSize = 1.0;
|
2022-02-10 16:22:28 +00:00
|
|
|
VertexInput tint_symbol_2 = VertexInput(position_1, color_1, quad_pos_1);
|
|
|
|
VertexOutput inner_result = vs_main(tint_symbol_2);
|
2022-01-28 22:36:58 +00:00
|
|
|
gl_Position = inner_result.position;
|
|
|
|
color_2 = inner_result.color;
|
|
|
|
quad_pos_2 = inner_result.quad_pos;
|
|
|
|
gl_Position.y = -(gl_Position.y);
|
|
|
|
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
|
|
|
return;
|
2022-01-21 22:38:16 +00:00
|
|
|
}
|
|
|
|
#version 310 es
|
|
|
|
precision mediump float;
|
|
|
|
|
2022-01-28 22:36:58 +00:00
|
|
|
layout(location = 0) in vec4 color_1;
|
|
|
|
layout(location = 1) in vec2 quad_pos_1;
|
2022-02-10 16:22:28 +00:00
|
|
|
layout(location = 0) out vec4 value;
|
2022-01-21 22:38:16 +00:00
|
|
|
struct RenderParams {
|
|
|
|
mat4 modelViewProjectionMatrix;
|
|
|
|
vec3 right;
|
|
|
|
vec3 up;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct VertexInput {
|
|
|
|
vec3 position;
|
|
|
|
vec4 color;
|
|
|
|
vec2 quad_pos;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct VertexOutput {
|
|
|
|
vec4 position;
|
|
|
|
vec4 color;
|
|
|
|
vec2 quad_pos;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct SimulationParams {
|
|
|
|
float deltaTime;
|
|
|
|
vec4 seed;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct Particle {
|
|
|
|
vec3 position;
|
|
|
|
float lifetime;
|
|
|
|
vec4 color;
|
|
|
|
vec3 velocity;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct UBO {
|
|
|
|
uint width;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-28 22:36:58 +00:00
|
|
|
vec4 fs_main(VertexOutput tint_symbol) {
|
|
|
|
vec4 color = tint_symbol.color;
|
|
|
|
color.a = (color.a * max((1.0f - length(tint_symbol.quad_pos)), 0.0f));
|
|
|
|
return color;
|
2022-01-21 22:38:16 +00:00
|
|
|
}
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
void main() {
|
2022-02-10 16:22:28 +00:00
|
|
|
VertexOutput tint_symbol_1 = VertexOutput(gl_FragCoord, color_1, quad_pos_1);
|
|
|
|
vec4 inner_result = fs_main(tint_symbol_1);
|
|
|
|
value = inner_result;
|
2022-01-28 22:36:58 +00:00
|
|
|
return;
|
2022-01-21 22:38:16 +00:00
|
|
|
}
|
|
|
|
#version 310 es
|
|
|
|
|
|
|
|
vec2 rand_seed = vec2(0.0f, 0.0f);
|
|
|
|
float rand() {
|
2022-02-28 18:19:47 +00:00
|
|
|
rand_seed.x = fract((cos(dot(rand_seed, vec2(23.140779495f, 232.616897583f))) * 136.816802979f));
|
|
|
|
rand_seed.y = fract((cos(dot(rand_seed, vec2(54.478565216f, 345.841522217f))) * 534.764526367f));
|
2022-01-21 22:38:16 +00:00
|
|
|
return rand_seed.y;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct RenderParams {
|
|
|
|
mat4 modelViewProjectionMatrix;
|
|
|
|
vec3 right;
|
|
|
|
vec3 up;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct VertexInput {
|
|
|
|
vec3 position;
|
|
|
|
vec4 color;
|
|
|
|
vec2 quad_pos;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct VertexOutput {
|
|
|
|
vec4 position;
|
|
|
|
vec4 color;
|
|
|
|
vec2 quad_pos;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct SimulationParams {
|
|
|
|
float deltaTime;
|
|
|
|
vec4 seed;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct Particle {
|
|
|
|
vec3 position;
|
|
|
|
float lifetime;
|
|
|
|
vec4 color;
|
|
|
|
vec3 velocity;
|
|
|
|
};
|
|
|
|
|
2022-01-25 20:06:05 +00:00
|
|
|
layout(binding = 0) uniform SimulationParams_1 {
|
2022-01-21 22:38:16 +00:00
|
|
|
float deltaTime;
|
|
|
|
vec4 seed;
|
|
|
|
} sim_params;
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-02-04 23:09:23 +00:00
|
|
|
layout(binding = 1, std430) buffer Particles_1 {
|
2022-01-21 22:38:16 +00:00
|
|
|
Particle particles[];
|
|
|
|
} data;
|
2022-01-28 22:36:58 +00:00
|
|
|
struct UBO {
|
|
|
|
uint width;
|
2022-01-21 22:38:16 +00:00
|
|
|
};
|
|
|
|
|
2022-03-28 18:01:02 +00:00
|
|
|
uniform highp sampler2D tint_symbol_6;
|
2022-01-28 22:36:58 +00:00
|
|
|
void simulate(uvec3 GlobalInvocationID) {
|
2022-01-21 22:38:16 +00:00
|
|
|
rand_seed = ((sim_params.seed.xy + vec2(GlobalInvocationID.xy)) * sim_params.seed.zw);
|
|
|
|
uint idx = GlobalInvocationID.x;
|
|
|
|
Particle particle = data.particles[idx];
|
|
|
|
particle.velocity.z = (particle.velocity.z - (sim_params.deltaTime * 0.5f));
|
|
|
|
particle.position = (particle.position + (sim_params.deltaTime * particle.velocity));
|
|
|
|
particle.lifetime = (particle.lifetime - sim_params.deltaTime);
|
|
|
|
particle.color.a = smoothstep(0.0f, 0.5f, particle.lifetime);
|
|
|
|
if ((particle.lifetime < 0.0f)) {
|
2022-07-26 14:23:24 +00:00
|
|
|
ivec2 coord = ivec2(0);
|
2022-01-21 22:38:16 +00:00
|
|
|
{
|
2022-03-28 18:01:02 +00:00
|
|
|
for(int level = (textureQueryLevels(tint_symbol_6) - 1); (level > 0); level = (level - 1)) {
|
|
|
|
vec4 probabilites = texelFetch(tint_symbol_6, coord, level);
|
|
|
|
float tint_symbol_5 = rand();
|
|
|
|
vec4 value = vec4(tint_symbol_5);
|
2022-02-15 17:52:37 +00:00
|
|
|
bvec4 mask = bvec4(uvec4(greaterThanEqual(value, vec4(0.0f, probabilites.xyz))) & uvec4(lessThan(value, probabilites)));
|
2022-01-21 22:38:16 +00:00
|
|
|
coord = (coord * 2);
|
|
|
|
coord.x = (coord.x + (any(mask.yw) ? 1 : 0));
|
|
|
|
coord.y = (coord.y + (any(mask.zw) ? 1 : 0));
|
|
|
|
}
|
|
|
|
}
|
2022-03-28 18:01:02 +00:00
|
|
|
vec2 uv = (vec2(coord) / vec2(textureSize(tint_symbol_6, 0)));
|
2022-01-21 22:38:16 +00:00
|
|
|
particle.position = vec3((((uv - 0.5f) * 3.0f) * vec2(1.0f, -1.0f)), 0.0f);
|
2022-03-28 18:01:02 +00:00
|
|
|
particle.color = texelFetch(tint_symbol_6, coord, 0);
|
|
|
|
float tint_symbol_1 = rand();
|
|
|
|
particle.velocity.x = ((tint_symbol_1 - 0.5f) * 0.100000001f);
|
|
|
|
float tint_symbol_2 = rand();
|
|
|
|
particle.velocity.y = ((tint_symbol_2 - 0.5f) * 0.100000001f);
|
|
|
|
float tint_symbol_3 = rand();
|
|
|
|
particle.velocity.z = (tint_symbol_3 * 0.300000012f);
|
|
|
|
float tint_symbol_4 = rand();
|
|
|
|
particle.lifetime = (0.5f + (tint_symbol_4 * 2.0f));
|
2022-01-21 22:38:16 +00:00
|
|
|
}
|
|
|
|
data.particles[idx] = particle;
|
|
|
|
}
|
|
|
|
|
|
|
|
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
|
|
|
|
void main() {
|
2022-01-28 22:36:58 +00:00
|
|
|
simulate(gl_GlobalInvocationID);
|
|
|
|
return;
|
2022-01-21 22:38:16 +00:00
|
|
|
}
|
|
|
|
Error parsing GLSL shader:
|
2022-02-28 18:19:47 +00:00
|
|
|
ERROR: 0:64: 'textureQueryLevels' : no matching overloaded function found
|
|
|
|
ERROR: 0:64: '' : compilation terminated
|
2022-01-21 22:38:16 +00:00
|
|
|
ERROR: 2 compilation errors. No code generated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#version 310 es
|
|
|
|
|
|
|
|
struct RenderParams {
|
|
|
|
mat4 modelViewProjectionMatrix;
|
|
|
|
vec3 right;
|
|
|
|
vec3 up;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct VertexInput {
|
|
|
|
vec3 position;
|
|
|
|
vec4 color;
|
|
|
|
vec2 quad_pos;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct VertexOutput {
|
|
|
|
vec4 position;
|
|
|
|
vec4 color;
|
|
|
|
vec2 quad_pos;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct SimulationParams {
|
|
|
|
float deltaTime;
|
|
|
|
vec4 seed;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct Particle {
|
|
|
|
vec3 position;
|
|
|
|
float lifetime;
|
|
|
|
vec4 color;
|
|
|
|
vec3 velocity;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct UBO {
|
|
|
|
uint width;
|
|
|
|
};
|
|
|
|
|
2022-01-25 20:06:05 +00:00
|
|
|
layout(binding = 3) uniform UBO_1 {
|
2022-01-21 22:38:16 +00:00
|
|
|
uint width;
|
|
|
|
} ubo;
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-02-04 23:09:23 +00:00
|
|
|
layout(binding = 4, std430) buffer Buffer_1 {
|
2022-01-21 22:38:16 +00:00
|
|
|
float weights[];
|
|
|
|
} buf_in;
|
2022-02-04 23:09:23 +00:00
|
|
|
layout(binding = 5, std430) buffer Buffer_2 {
|
2022-01-21 22:38:16 +00:00
|
|
|
float weights[];
|
|
|
|
} buf_out;
|
2022-01-25 00:35:20 +00:00
|
|
|
uniform highp sampler2D tex_in_1;
|
2022-01-28 22:36:58 +00:00
|
|
|
void import_level(uvec3 coord) {
|
2022-01-21 22:38:16 +00:00
|
|
|
uint offset = (coord.x + (coord.y * ubo.width));
|
2022-01-25 00:35:20 +00:00
|
|
|
buf_out.weights[offset] = texelFetch(tex_in_1, ivec2(coord.xy), 0).w;
|
2022-01-21 22:38:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
|
|
|
|
void main() {
|
2022-01-28 22:36:58 +00:00
|
|
|
import_level(gl_GlobalInvocationID);
|
|
|
|
return;
|
2022-01-21 22:38:16 +00:00
|
|
|
}
|
|
|
|
#version 310 es
|
|
|
|
|
|
|
|
struct RenderParams {
|
|
|
|
mat4 modelViewProjectionMatrix;
|
|
|
|
vec3 right;
|
|
|
|
vec3 up;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct VertexInput {
|
|
|
|
vec3 position;
|
|
|
|
vec4 color;
|
|
|
|
vec2 quad_pos;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct VertexOutput {
|
|
|
|
vec4 position;
|
|
|
|
vec4 color;
|
|
|
|
vec2 quad_pos;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct SimulationParams {
|
|
|
|
float deltaTime;
|
|
|
|
vec4 seed;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct Particle {
|
|
|
|
vec3 position;
|
|
|
|
float lifetime;
|
|
|
|
vec4 color;
|
|
|
|
vec3 velocity;
|
|
|
|
};
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-01-21 22:38:16 +00:00
|
|
|
struct UBO {
|
|
|
|
uint width;
|
|
|
|
};
|
|
|
|
|
2022-01-25 20:06:05 +00:00
|
|
|
layout(binding = 3) uniform UBO_1 {
|
2022-01-21 22:38:16 +00:00
|
|
|
uint width;
|
|
|
|
} ubo;
|
2022-01-26 16:48:55 +00:00
|
|
|
|
2022-02-04 23:09:23 +00:00
|
|
|
layout(binding = 4, std430) buffer Buffer_1 {
|
2022-01-21 22:38:16 +00:00
|
|
|
float weights[];
|
|
|
|
} buf_in;
|
2022-02-04 23:09:23 +00:00
|
|
|
layout(binding = 5, std430) buffer Buffer_2 {
|
2022-01-21 22:38:16 +00:00
|
|
|
float weights[];
|
|
|
|
} buf_out;
|
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>
2022-02-03 22:39:13 +00:00
|
|
|
layout(rgba8) uniform highp writeonly image2D tex_out;
|
2022-01-28 22:36:58 +00:00
|
|
|
void export_level(uvec3 coord) {
|
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>
2022-02-03 22:39:13 +00:00
|
|
|
if (all(lessThan(coord.xy, uvec2(imageSize(tex_out))))) {
|
2022-01-21 22:38:16 +00:00
|
|
|
uint dst_offset = (coord.x + (coord.y * ubo.width));
|
|
|
|
uint src_offset = ((coord.x * 2u) + ((coord.y * 2u) * ubo.width));
|
2022-02-10 16:22:28 +00:00
|
|
|
float a = buf_in.weights[(src_offset + 0u)];
|
2022-01-21 22:38:16 +00:00
|
|
|
float b = buf_in.weights[(src_offset + 1u)];
|
|
|
|
float c = buf_in.weights[((src_offset + 0u) + ubo.width)];
|
|
|
|
float d = buf_in.weights[((src_offset + 1u) + ubo.width)];
|
2022-02-10 16:22:28 +00:00
|
|
|
float sum = dot(vec4(a, b, c, d), vec4(1.0f));
|
2022-01-21 22:38:16 +00:00
|
|
|
buf_out.weights[dst_offset] = (sum / 4.0f);
|
2022-02-10 16:22:28 +00:00
|
|
|
vec4 probabilities = (vec4(a, (a + b), ((a + b) + c), sum) / max(sum, 0.0001f));
|
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>
2022-02-03 22:39:13 +00:00
|
|
|
imageStore(tex_out, ivec2(coord.xy), probabilities);
|
2022-01-21 22:38:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
|
|
|
|
void main() {
|
2022-01-28 22:36:58 +00:00
|
|
|
export_level(gl_GlobalInvocationID);
|
|
|
|
return;
|
2022-01-21 22:38:16 +00:00
|
|
|
}
|