Skip to content

Instantly share code, notes, and snippets.

@rygorous
Last active January 4, 2016 10:39
Embed
What would you like to do?
#version 430 core
layout(std430, binding=0) buffer debugbuf {
int debug[128];
};
layout(binding=0) uniform isamplerBuffer zigzag8;
layout(binding=1) uniform isamplerBuffer coeff_data;
layout(binding=2) uniform isamplerBuffer dc_data;
layout(binding=3) uniform usampler2D i_img;
layout(binding=4) uniform isamplerBuffer motion_buf;
shared int magic_sink[1];
layout(local_size_x=64) in;
void main()
{
uint invoc = gl_LocalInvocationID.x;
// this should just copy the first 64 int pairs from "motion_buf"
// to debug, but it doesn't.
ivec2 rel_vec = texelFetch(motion_buf, int(invoc)).xy;
debug[invoc*2 + 0] = rel_vec.x;
debug[invoc*2 + 1] = rel_vec.y;
//return; // uncomment this and the shader works.
int magic = 0;
// comment out any of the following lines and the shader works.
magic += texelFetch(dc_data, 0).x & 0;
magic += texelFetch(zigzag8, 0).x & 0;
magic += texelFetch(coeff_data, 0).x & 0;
magic += int(textureGather(i_img, vec2(0.0, 0.0)).x) & 0;
magic_sink[0] = magic;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment