#version 460 //#extension GL_NV_gpu_shader5 : enable layout(packed, binding=0) buffer image { uint color[]; } ; // No local name for this one layout(local_size_x = 1) in; uniform uint width; vec3 extract_color(uint raw_color){ vec3 ogl_color; ogl_color.r = ((raw_color & 0x000000ff) >> 0) / 255.0f; ogl_color.g = ((raw_color & 0x0000ff00) >> 8) / 255.0f; ogl_color.b = ((raw_color & 0x00ff0000) >> 16) / 255.0f; return ogl_color; } uint package_color(vec3 ogl_color){ uint raw_color = 0; raw_color |= uint(ogl_color.r * 255.0) << 0; raw_color |= uint(ogl_color.g * 255.0) << 8; raw_color |= uint(ogl_color.b * 255.0) << 16; return raw_color; } void main(){ uint x_coord = gl_WorkGroupID.x % width; uint y_coord = gl_WorkGroupID.x / width; vec3 ogl_color = extract_color(color[gl_WorkGroupID.x]); ogl_color.r += 3/255.0; ogl_color.g += 5/255.0; ogl_color.b += 7/255.0; color[gl_WorkGroupID.x] = package_color(ogl_color); }