test: add particle gpu ping-pong validation
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
This commit is contained in:
30
shaders/particle_gpu_validation.fragment.glsl
Normal file
30
shaders/particle_gpu_validation.fragment.glsl
Normal file
@@ -0,0 +1,30 @@
|
||||
layout (std140) uniform ParticleGpuValidationUBO {
|
||||
highp vec4 u_pass;
|
||||
highp vec4 u_marker;
|
||||
};
|
||||
|
||||
uniform sampler2D u_previous;
|
||||
in vec2 v_uv;
|
||||
|
||||
void main() {
|
||||
vec4 previous = texture(u_previous, v_uv);
|
||||
float mode = u_pass.x;
|
||||
|
||||
if (mode < 0.5) {
|
||||
// State pass: deterministic GPU-only state evolution.
|
||||
fragColor = vec4(fract(previous.r + 0.03125), v_uv, 1.0);
|
||||
} else if (mode < 1.5) {
|
||||
// Trail pass: fade the previous trail and add a moving validation marker.
|
||||
float marker = 1.0 - smoothstep(0.0, u_marker.z, distance(v_uv, u_marker.xy));
|
||||
vec3 color = previous.rgb * u_marker.w + marker * vec3(0.08, 0.55, 1.0);
|
||||
fragColor = vec4(min(color, vec3(1.0)), 1.0);
|
||||
} else {
|
||||
// Main pass: composite the latest trail without hiding the validation map.
|
||||
float intensity = max(previous.r, max(previous.g, previous.b));
|
||||
fragColor = vec4(previous.rgb * 0.72, min(intensity * 0.72, 0.72));
|
||||
}
|
||||
|
||||
#ifdef OVERDRAW_INSPECTOR
|
||||
fragColor = vec4(1.0);
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user