25 lines
901 B
GLSL
25 lines
901 B
GLSL
#version 330 core // Transform Feedback available in 330+
|
|
|
|
layout (location = 0) in vec2 aPos; // Dummy input vertex position (we don't use it)
|
|
|
|
uniform sampler2D InputTexture; // Linear Float texture (e.g., RGBA16F)
|
|
|
|
// Output to Geometry Shader
|
|
out VS_OUT {
|
|
vec3 linearColor;
|
|
} vs_out;
|
|
|
|
void main() {
|
|
// We use gl_VertexID to figure out which texel to read
|
|
ivec2 textureSize = textureSize(InputTexture, 0);
|
|
ivec2 texelCoord = ivec2(gl_VertexID % textureSize.x, gl_VertexID / textureSize.x);
|
|
|
|
// Boundary check (important if drawing more vertices than pixels)
|
|
if (texelCoord.x >= textureSize.x || texelCoord.y >= textureSize.y) {
|
|
vs_out.linearColor = vec3(-1.0); // Indicate invalid pixel
|
|
} else {
|
|
vs_out.linearColor = texture(InputTexture, vec2(texelCoord) / vec2(textureSize)).rgb;
|
|
}
|
|
|
|
// We don't output gl_Position as rasterization is disabled
|
|
} |