Lines Matching defs:NL
56 const char* const kGLSLSIA = NL "#extension GL_OES_shader_image_atomic : require";
58 NL "precision highp float;" NL "precision highp int;" NL "precision highp sampler2D;" NL
59 "precision highp sampler3D;" NL "precision highp samplerCube;" NL "precision highp sampler2DArray;" NL
60 "precision highp isampler2D;" NL "precision highp isampler3D;" NL "precision highp isamplerCube;" NL
61 "precision highp isampler2DArray;" NL "precision highp usampler2D;" NL "precision highp usampler3D;" NL
62 "precision highp usamplerCube;" NL "precision highp usampler2DArray;" NL "precision highp image2D;" NL
63 "precision highp image3D;" NL "precision highp imageCube;" NL "precision highp image2DArray;" NL
64 "precision highp iimage2D;" NL "precision highp iimage3D;" NL "precision highp iimageCube;" NL
65 "precision highp iimage2DArray;" NL "precision highp uimage2D;" NL "precision highp uimage3D;" NL
66 "precision highp uimageCube;" NL "precision highp uimage2DArray;";
1148 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
1219 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 2) writeonly uniform "
1220 << TypePrefix<T>() << "image2D g_image;" NL "void main() {" NL " ivec2 coord = ivec2(gl_FragCoord.xy);" NL
1222 << TypePrefix<T>() << "vec4" << value << ");" NL " discard;" NL "}";
1230 os << NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "uniform "
1231 << TypePrefix<T>() << "sampler2D g_sampler;" NL "layout(std430) buffer OutputBuffer {" NL " "
1233 << "vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL
1234 " data[gl_LocalInvocationIndex] = texelFetch(g_sampler, ivec2(gl_LocalInvocationID), 0);" NL
1236 << value << ";" NL "}";
1252 os << NL "#define KSIZE 4" NL "layout(" << FormatEnumToString(internalformat) << ") writeonly uniform "
1254 << "image2D g_image;" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "void main() {" NL
1255 " ivec2 thread_xy = ivec2(gl_LocalInvocationID);" NL " imageStore(g_image, thread_xy, "
1256 << TypePrefix<T>() << "vec4" << value << ");" NL "}";
1264 os << NL "#define KSIZE 4" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "uniform "
1265 << TypePrefix<T>() << "sampler2D g_sampler;" NL "layout(std430) buffer OutputBuffer {" NL " "
1267 << "vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL
1268 " data[gl_LocalInvocationIndex] = texelFetch(g_sampler, ivec2(gl_LocalInvocationID), 0);" NL
1270 << TypePrefix<T>() << "vec4" << value << ";" NL "}";
1435 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
1504 os << NL "#define KSIZE 11" NL "layout(" << FormatEnumToString(internalformat)
1506 << "image2D g_image;" NL "layout(std430) buffer OutputBuffer {" NL " " << TypePrefix<T>()
1507 << "vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_FragCoord.xy);" NL " "
1508 << TypePrefix<T>() << "vec4 v = imageLoad(g_image, coord);" NL " data[coord.y * KSIZE + coord.x] = v;" NL
1510 << TypePrefix<T>() << "vec4" << expected_value << ";" NL " discard;" NL "}";
1526 os << NL "#define KSIZE 4" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "layout("
1528 << "image2D g_image;" NL "layout(std430) buffer OutputBuffer {" NL " " << TypePrefix<T>()
1529 << "vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
1531 << TypePrefix<T>() << "vec4 v = imageLoad(g_image, coord);" NL " data[gl_LocalInvocationIndex] = v;" NL
1533 << TypePrefix<T>() << "vec4" << expected_value << ";" NL "}";
1756 os << NL "#define KSIZE 8" NL "layout(local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "layout("
1758 << "image2D g_image_read;" NL "layout(" << FormatEnumToString(internalformat)
1760 << "image2D g_image_write;" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL " "
1761 << TypePrefix<T>() << "vec4 v = imageLoad(g_image_read, coord);" NL
1762 " imageStore(g_image_write, coord, v+v);" NL " //imageStore(g_image_write, coord, "
1763 << TypePrefix<T>() << "vec4" << expected_value << ");" NL "}";
1771 os << NL "#define KSIZE 8" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "uniform "
1772 << TypePrefix<T>() << "sampler2D g_sampler;" NL "layout(std430) buffer OutputBuffer {" NL " "
1774 << "vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL
1775 " data[gl_LocalInvocationIndex] = texelFetch(g_sampler, ivec2(gl_LocalInvocationID), 0);" NL
1777 << TypePrefix<T>() << "vec4" << value << ";" NL "}";
1843 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
1950 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 0) writeonly uniform "
1954 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 1) writeonly uniform "
1958 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 2) writeonly uniform "
1962 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 3) writeonly uniform "
1966 os << NL "void main() {" NL " ivec2 coord = ivec2(gl_FragCoord.xy);";
1971 os << NL " imageStore(g_image_2d, coord, " << TypePrefix<T>() << "vec4" << write_value << ");";
1974 os << NL " imageStore(g_image_3d, ivec3(coord, 0), " << TypePrefix<T>() << "vec4" << write_value
1975 << ");" NL " imageStore(g_image_3d, ivec3(coord, 1), " << TypePrefix<T>() << "vec4" << write_value
1979 os << NL " imageStore(g_image_cube, ivec3(coord, 0), " << TypePrefix<T>() << "vec4" << write_value
1980 << ");" NL " imageStore(g_image_cube, ivec3(coord, 1), " << TypePrefix<T>() << "vec4" << write_value
1981 << ");" NL " imageStore(g_image_cube, ivec3(coord, 2), " << TypePrefix<T>() << "vec4" << write_value
1982 << ");" NL " imageStore(g_image_cube, ivec3(coord, 3), " << TypePrefix<T>() << "vec4" << write_value
1983 << ");" NL " imageStore(g_image_cube, ivec3(coord, 4), " << TypePrefix<T>() << "vec4" << write_value
1984 << ");" NL " imageStore(g_image_cube, ivec3(coord, 5), " << TypePrefix<T>() << "vec4" << write_value
1988 os << NL " imageStore(g_image_2darray, ivec3(coord, 0), " << TypePrefix<T>() << "vec4" << write_value
1989 << ");" NL " imageStore(g_image_2darray, ivec3(coord, 1), " << TypePrefix<T>() << "vec4" << write_value
1993 os << NL " discard;" NL "}";
2001 os << NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "uniform "
2002 << TypePrefix<T>() << "sampler2D g_sampler_2d;" NL "uniform " << TypePrefix<T>()
2003 << "sampler3D g_sampler_3d;" NL "uniform " << TypePrefix<T>() << "samplerCube g_sampler_cube;" NL "uniform "
2005 << "sampler2DArray g_sampler_2darray;" NL "layout(std430, binding = 1) buffer OutputBuffer2D {" NL " "
2006 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE];" NL "} g_buff_2d;" NL
2007 "layout(std430, binding = 0) buffer OutputBuffer3D {" NL " "
2008 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_3d;" NL
2009 "layout(std430, binding = 3) buffer OutputBufferCube {" NL " "
2010 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*6];" NL "} g_buff_cube;" NL
2011 "layout(std430, binding = 2) buffer OutputBuffer2DArray {" NL " "
2013 << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_2darray;" NL "void main() {" NL
2014 " int cubemap_i = 2 * int(gl_LocalInvocationID.x) - KSIZE + 1;" NL
2015 " int cubemap_j = 2 * int(gl_LocalInvocationID.y) - KSIZE + 1;" NL
2016 " uint layer = uint(KSIZE * KSIZE);" NL
2017 " g_buff_2d.data[gl_LocalInvocationIndex] = texelFetch(g_sampler_2d, ivec2(gl_LocalInvocationID), 0);" NL
2019 "0);" NL " g_buff_3d.data[gl_LocalInvocationIndex + layer] = texelFetch(g_sampler_3d, "
2020 "ivec3(gl_LocalInvocationID.xy, 1), 0);" NL " g_buff_2darray.data[gl_LocalInvocationIndex] = "
2022 "ivec3(gl_LocalInvocationID.xy, 0), 0);" NL
2024 "ivec3(gl_LocalInvocationID.xy, 1), 0);" NL " g_buff_cube.data[gl_LocalInvocationIndex] = "
2025 "texture(g_sampler_cube, vec3(KSIZE,cubemap_i,cubemap_j));" NL
2027 "vec3(KSIZE,cubemap_i,cubemap_j));" NL " g_buff_cube.data[gl_LocalInvocationIndex + 2u * layer] = "
2028 "texture(g_sampler_cube, vec3(cubemap_i,KSIZE,cubemap_j));" NL
2030 "vec3(cubemap_i,KSIZE,cubemap_j));" NL " g_buff_cube.data[gl_LocalInvocationIndex + 4u * layer] = "
2031 "texture(g_sampler_cube, vec3(cubemap_i,cubemap_j,KSIZE));" NL
2033 "vec3(cubemap_i,cubemap_j,KSIZE));" NL " //g_buff_2d.data[gl_LocalInvocationIndex] = "
2034 << write_value << ";" NL "}";
2189 os << NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;";
2193 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 0) writeonly uniform "
2197 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 1) writeonly uniform "
2201 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 2) writeonly uniform "
2205 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 3) writeonly uniform "
2209 os << NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);";
2213 os << NL " imageStore(g_image_2d, coord, " << TypePrefix<T>() << "vec4" << write_value << ");";
2216 os << NL " imageStore(g_image_3d, ivec3(coord, 0), " << TypePrefix<T>() << "vec4" << write_value
2217 << ");" NL " imageStore(g_image_3d, ivec3(coord, 1), " << TypePrefix<T>() << "vec4" << write_value
2221 os << NL " imageStore(g_image_cube, ivec3(coord, 0), " << TypePrefix<T>() << "vec4" << write_value
2222 << ");" NL " imageStore(g_image_cube, ivec3(coord, 1), " << TypePrefix<T>() << "vec4" << write_value
2223 << ");" NL " imageStore(g_image_cube, ivec3(coord, 2), " << TypePrefix<T>() << "vec4" << write_value
2224 << ");" NL " imageStore(g_image_cube, ivec3(coord, 3), " << TypePrefix<T>() << "vec4" << write_value
2225 << ");" NL " imageStore(g_image_cube, ivec3(coord, 4), " << TypePrefix<T>() << "vec4" << write_value
2226 << ");" NL " imageStore(g_image_cube, ivec3(coord, 5), " << TypePrefix<T>() << "vec4" << write_value
2230 os << NL " imageStore(g_image_2darray, ivec3(coord, 0), " << TypePrefix<T>() << "vec4" << write_value
2231 << ");" NL " imageStore(g_image_2darray, ivec3(coord, 1), " << TypePrefix<T>() << "vec4" << write_value
2235 os << NL "}";
2243 os << NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "uniform "
2244 << TypePrefix<T>() << "sampler2D g_sampler_2d;" NL "uniform " << TypePrefix<T>()
2245 << "sampler3D g_sampler_3d;" NL "uniform " << TypePrefix<T>() << "samplerCube g_sampler_cube;" NL "uniform "
2247 << "sampler2DArray g_sampler_2darray;" NL "layout(std430, binding = 0) buffer OutputBuffer2D {" NL " "
2248 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE];" NL "} g_buff_2d;" NL
2249 "layout(std430, binding = 1) buffer OutputBuffer3D {" NL " "
2250 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_3d;" NL
2251 "layout(std430, binding = 2) buffer OutputBufferCube {" NL " "
2252 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*6];" NL "} g_buff_cube;" NL
2253 "layout(std430, binding = 3) buffer OutputBuffer2DArray {" NL " "
2255 << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_2darray;" NL "void main() {" NL
2256 " int cubemap_i = 2 * int(gl_LocalInvocationID.x) - KSIZE + 1;" NL
2257 " int cubemap_j = 2 * int(gl_LocalInvocationID.y) - KSIZE + 1;" NL
2258 " uint layer = uint(KSIZE * KSIZE);" NL
2259 " g_buff_2d.data[gl_LocalInvocationIndex] = texelFetch(g_sampler_2d, ivec2(gl_LocalInvocationID), 0);" NL
2261 "0);" NL " g_buff_3d.data[gl_LocalInvocationIndex + layer] = texelFetch(g_sampler_3d, "
2262 "ivec3(gl_LocalInvocationID.xy, 1), 0);" NL " g_buff_2darray.data[gl_LocalInvocationIndex] = "
2264 "ivec3(gl_LocalInvocationID.xy, 0), 0);" NL
2266 "ivec3(gl_LocalInvocationID.xy, 1), 0);" NL " g_buff_cube.data[gl_LocalInvocationIndex] = "
2267 "texture(g_sampler_cube, vec3(KSIZE,cubemap_i,cubemap_j));" NL
2269 "vec3(KSIZE,cubemap_i,cubemap_j));" NL " g_buff_cube.data[gl_LocalInvocationIndex + 2u * layer] = "
2270 "texture(g_sampler_cube, vec3(cubemap_i,KSIZE,cubemap_j));" NL
2272 "vec3(cubemap_i,KSIZE,cubemap_j));" NL " g_buff_cube.data[gl_LocalInvocationIndex + 4u * layer] = "
2273 "texture(g_sampler_cube, vec3(cubemap_i,cubemap_j,KSIZE));" NL
2275 "vec3(cubemap_i,cubemap_j,KSIZE));" NL " //g_buff_2d.data[gl_LocalInvocationIndex] = "
2276 << write_value << ";" NL "}";
2346 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
2441 os << NL "#define KSIZE 11";
2445 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 2) readonly uniform "
2447 << "image2D g_image_2d;" NL "layout(std430, binding = 1) buffer OutputBuffer2D {" NL " "
2448 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE];" NL "} g_buff_2d;";
2451 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 0) readonly uniform "
2453 << "image3D g_image_3d;" NL "layout(std430, binding = 0) buffer OutputBuffer3D {" NL " "
2454 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_3d;";
2457 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 3) readonly uniform "
2459 << "imageCube g_image_cube;" NL "layout(std430, binding = 3) buffer OutputBufferCube {" NL " "
2460 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*6];" NL "} g_buff_cube;";
2463 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 1) readonly uniform "
2465 << "image2DArray g_image_2darray;" NL "layout(std430, binding = 2) buffer OutputBuffer2DArray {" NL " "
2466 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_2darray;";
2469 os << NL "void main() {" NL " ivec2 coord = ivec2(gl_FragCoord.xy);" NL
2470 " int coordIndex = coord.x + KSIZE * coord.y;" NL " int layer = int(KSIZE * KSIZE);" NL " "
2476 os << NL " v = imageLoad(g_image_2d, coord);" NL " g_buff_2d.data[coordIndex] = v;";
2479 os << NL " v = imageLoad(g_image_3d, ivec3(coord.xy, 0));" NL " g_buff_3d.data[coordIndex] = v;" NL
2480 " v = imageLoad(g_image_3d, ivec3(coord.xy, 1));" NL " g_buff_3d.data[coordIndex + layer] = v;";
2483 os << NL
2484 " v = imageLoad(g_image_cube, ivec3(coord, 0));" NL " g_buff_cube.data[coordIndex] = v;" NL
2485 " v = imageLoad(g_image_cube, ivec3(coord, 1));" NL " g_buff_cube.data[coordIndex + layer] = v;" NL
2486 " v = imageLoad(g_image_cube, ivec3(coord, 2));" NL
2487 " g_buff_cube.data[coordIndex + 2 * layer] = v;" NL
2488 " v = imageLoad(g_image_cube, ivec3(coord, 3));" NL
2489 " g_buff_cube.data[coordIndex + 3 * layer] = v;" NL
2490 " v = imageLoad(g_image_cube, ivec3(coord, 4));" NL
2491 " g_buff_cube.data[coordIndex + 4 * layer] = v;" NL
2492 " v = imageLoad(g_image_cube, ivec3(coord, 5));" NL " g_buff_cube.data[coordIndex + 5 * layer] = v;";
2495 os << NL " v = imageLoad(g_image_2darray, ivec3(coord, 0));" NL " g_buff_2darray.data[coordIndex] = v;" NL
2496 " v = imageLoad(g_image_2darray, ivec3(coord, 1));" NL
2500 os << NL " //g_buff_2d.data[coordIndex] = " << expected_value << ";" NL "}";
2654 os << NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;";
2658 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 2) readonly uniform "
2660 << "image2D g_image_2d;" NL "layout(std430, binding = 0) buffer OutputBuffer2D {" NL " "
2661 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE];" NL "} g_buff_2d;";
2664 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 0) readonly uniform "
2666 << "image3D g_image_3d;" NL "layout(std430, binding = 1) buffer OutputBuffer3D {" NL " "
2667 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_3d;";
2670 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 3) readonly uniform "
2672 << "imageCube g_image_cube;" NL "layout(std430, binding = 2) buffer OutputBufferCube {" NL " "
2673 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*6];" NL "} g_buff_cube;";
2676 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 1) readonly uniform "
2678 << "image2DArray g_image_2darray;" NL "layout(std430, binding = 3) buffer OutputBuffer2DArray {" NL " "
2679 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_2darray;";
2682 os << NL "void main() {" NL " ivec3 coord = ivec3(gl_LocalInvocationID.xy, 0);" NL
2683 " uint layer = uint(KSIZE * KSIZE);" NL " "
2688 os << NL " v = imageLoad(g_image_2d, coord.xy);" NL " g_buff_2d.data[gl_LocalInvocationIndex] = v;";
2691 os << NL " v = imageLoad(g_image_3d, coord);" NL " g_buff_3d.data[gl_LocalInvocationIndex] = v;" NL
2692 " v = imageLoad(g_image_3d, ivec3(coord.xy, 1));" NL
2696 os << NL " v = imageLoad(g_image_cube, coord);" NL " g_buff_cube.data[gl_LocalInvocationIndex] = v;" NL
2697 " v = imageLoad(g_image_cube, ivec3(coord.xy, 1));" NL
2698 " g_buff_cube.data[gl_LocalInvocationIndex + layer] = v;" NL
2699 " v = imageLoad(g_image_cube, ivec3(coord.xy, 2));" NL
2700 " g_buff_cube.data[gl_LocalInvocationIndex + 2u * layer] = v;" NL
2701 " v = imageLoad(g_image_cube, ivec3(coord.xy, 3));" NL
2702 " g_buff_cube.data[gl_LocalInvocationIndex + 3u * layer] = v;" NL
2703 " v = imageLoad(g_image_cube, ivec3(coord.xy, 4));" NL
2704 " g_buff_cube.data[gl_LocalInvocationIndex + 4u * layer] = v;" NL
2705 " v = imageLoad(g_image_cube, ivec3(coord.xy, 5));" NL
2709 os << NL " v = imageLoad(g_image_2darray, coord);" NL
2710 " g_buff_2darray.data[gl_LocalInvocationIndex] = v;" NL
2711 " v = imageLoad(g_image_2darray, ivec3(coord.xy, 1));" NL
2715 os << NL " //g_buff_2d.data[gl_LocalInvocationIndex] = " << expected_value << ";" NL "}";
2766 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
2855 os << NL "#define KSIZE 11" NL "layout(" << FormatEnumToString(internalformat)
2856 << ", binding = 1) coherent uniform " << TypePrefix<T>() << "image2D g_image_2d;" NL "layout("
2858 << "image3D g_image_3d;" NL "layout(" << FormatEnumToString(internalformat)
2859 << ", binding = 0) coherent uniform " << TypePrefix<T>() << "imageCube g_image_cube;" NL "layout("
2861 << "image2DArray g_image_2darray;" NL "layout(std430) buffer out_data {" NL
2862 " ivec4 o_color[KSIZE*KSIZE];" NL "};" NL
2863 << TypePrefix<T>() << "vec2 t(int i) {" NL " return " << TypePrefix<T>()
2864 << "vec2(i);" NL "}" NL "void main() {" NL " ivec2 coord = ivec2(gl_FragCoord.xy);" NL
2865 " int coordIndex = coord.x + KSIZE * coord.y;" NL " o_color[coordIndex] = ivec4(coordIndex);" NL
2866 " if (imageAtomicAdd(g_image_2d, coord, t(2).x) != t(0).x) o_color[coordIndex].x = 1;" NL
2867 " else if (imageAtomicMin(g_image_2d, coord, t(3).x) != t(2).x) o_color[coordIndex].x = 2;" NL
2868 " else if (imageAtomicMax(g_image_2d, coord, t(4).x) != t(2).x) o_color[coordIndex].x = 3;" NL
2869 " else if (imageAtomicAnd(g_image_2d, coord, t(0).x) != t(4).x) o_color[coordIndex].x = 4;" NL
2870 " else if (imageAtomicOr(g_image_2d, coord, t(7).x) != t(0).x) o_color[coordIndex].x = 5;" NL
2871 " else if (imageAtomicXor(g_image_2d, coord, t(4).x) != t(7).x) o_color[coordIndex].x = 6;" NL
2872 " else if (imageAtomicExchange(g_image_2d, coord, t(1).x) != t(3).x) o_color[coordIndex].x = 7;" NL
2874 "8;" NL " else o_color[coordIndex].x = 10;" NL
2875 " if (imageAtomicAdd(g_image_3d, ivec3(coord, 2), t(2).x) != t(0).x) o_color[coordIndex].y = 1;" NL
2876 " else if (imageAtomicMin(g_image_3d, ivec3(coord, 2), t(3).x) != t(2).x) o_color[coordIndex].y = 2;" NL
2877 " else if (imageAtomicMax(g_image_3d, ivec3(coord, 2), t(4).x) != t(2).x) o_color[coordIndex].y = 3;" NL
2878 " else if (imageAtomicAnd(g_image_3d, ivec3(coord, 2), t(0).x) != t(4).x) o_color[coordIndex].y = 4;" NL
2879 " else if (imageAtomicOr(g_image_3d, ivec3(coord, 2), t(7).x) != t(0).x) o_color[coordIndex].y = 5;" NL
2880 " else if (imageAtomicXor(g_image_3d, ivec3(coord, 2), t(4).x) != t(7).x) o_color[coordIndex].y = 6;" NL
2882 "7;" NL " else if (imageAtomicCompSwap(g_image_3d, ivec3(coord, 2), t(1).x, t(6).x) != t(1).x) "
2883 "o_color[coordIndex].y = 8;" NL " else o_color[coordIndex].y = 10;" NL
2884 " if (imageAtomicAdd(g_image_cube, ivec3(coord, 3), t(2).x) != t(0).x) o_color[coordIndex].z = 1;" NL
2886 "2;" NL " else if (imageAtomicMax(g_image_cube, ivec3(coord, 3), t(4).x) != t(2).x) "
2887 "o_color[coordIndex].z = 3;" NL " else if (imageAtomicAnd(g_image_cube, ivec3(coord, 3), "
2888 "t(0).x) != t(4).x) o_color[coordIndex].z = 4;" NL
2889 " else if (imageAtomicOr(g_image_cube, ivec3(coord, 3), t(7).x) != t(0).x) o_color[coordIndex].z = 5;" NL
2891 "6;" NL " else if (imageAtomicExchange(g_image_cube, ivec3(coord, 3), t(1).x) != t(3).x) "
2892 "o_color[coordIndex].z = 7;" NL " else if (imageAtomicCompSwap(g_image_cube, ivec3(coord, 3), "
2893 "t(1).x, t(6).x) != t(1).x) o_color[coordIndex].z = 8;" NL " else o_color[coordIndex].z = 10;" NL
2894 " if (imageAtomicAdd(g_image_2darray, ivec3(coord, 2), t(2).x) != t(0).x) o_color[coordIndex].w = 1;" NL
2896 "2;" NL " else if (imageAtomicMax(g_image_2darray, ivec3(coord, 2), t(4).x) != t(2).x) "
2897 "o_color[coordIndex].w = 3;" NL " else if (imageAtomicAnd(g_image_2darray, ivec3(coord, 2), "
2898 "t(0).x) != t(4).x) o_color[coordIndex].w = 4;" NL
2900 "5;" NL " else if (imageAtomicXor(g_image_2darray, ivec3(coord, 2), t(4).x) != t(7).x) "
2901 "o_color[coordIndex].w = 6;" NL " else if (imageAtomicExchange(g_image_2darray, ivec3(coord, "
2902 "2), t(1).x) != t(3).x) o_color[coordIndex].w = 7;" NL
2904 "o_color[coordIndex].w = 8;" NL " else o_color[coordIndex].w = 10;" NL " discard;" NL "}";
2943 const char* src_fs = NL "void main() {" NL " discard;" NL "}";
3037 os << NL "#define KSIZE 100" NL "layout(local_size_x = KSIZE) in;";
3039 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 1) writeonly uniform "
3040 << TypePrefix<T>() << "image2D g_image_2d;" NL "layout(" << FormatEnumToString(internalformat)
3041 << ", binding = 2) writeonly uniform " << TypePrefix<T>() << "image3D g_image_3d;" NL "layout("
3043 << "imageCube g_image_cube;" NL "layout(" << FormatEnumToString(internalformat)
3045 << "image2DArray g_image_2darray;" NL "layout(std430) buffer out_data {" NL " ivec4 o_color;" NL "};" NL
3046 "void main() {" NL " "
3049 << ";" NL " int g_index[6] = int[](o_color.x, o_color.y, o_color.z, o_color.w, o_color.r, o_color.g);";
3052 os << NL " ivec2 coord = ivec2(gl_VertexID, g_index[0]);";
3056 os << NL " ivec2 coord = ivec2(gl_GlobalInvocationID.x, g_index[0]);";
3058 os << NL " imageStore(g_image_2d, coord, g_value);" NL
3059 " imageStore(g_image_3d, ivec3(coord.xy, g_index[0]), g_value);" NL
3060 " imageStore(g_image_3d, ivec3(coord.xy, g_index[1]), g_value);" NL
3061 " for (int i = 0; i < 6; ++i) {" NL
3062 " imageStore(g_image_cube, ivec3(coord, g_index[i]), g_value);" NL " }" NL
3063 " imageStore(g_image_2darray, ivec3(coord, g_index[0]), g_value);" NL
3064 " imageStore(g_image_2darray, ivec3(coord, g_index[1]), g_value);" NL "}";
3072 os << NL "#define KSIZE 100";
3075 os << NL "layout(local_size_x = KSIZE) in;";
3077 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 3) readonly uniform "
3078 << TypePrefix<T>() << "image2D g_image_2d;" NL "layout(" << FormatEnumToString(internalformat)
3079 << ", binding = 2) readonly uniform " << TypePrefix<T>() << "image3D g_image_3d;" NL "layout("
3081 << "imageCube g_image_cube;" NL "layout(" << FormatEnumToString(internalformat)
3083 << "image2DArray g_image_2darray;" NL "layout(std430) buffer out_data {" NL " ivec4 o_color[KSIZE];" NL
3084 "};" NL "void main() {";
3088 os << NL " " << TypePrefix<T>() << "vec4 g_value = " << TypePrefix<T>() << "vec4(o_color[gl_VertexID]) + "
3093 os << NL " " << TypePrefix<T>() << "vec4 g_value = " << TypePrefix<T>()
3097 os << NL " int g_index[6] = int[](o_color[0].x, o_color[0].y, o_color[0].z, o_color[0].w, o_color[1].r, "
3101 os << NL " ivec2 coord = ivec2(gl_VertexID, g_index[0]);";
3105 os << NL " ivec2 coord = ivec2(gl_GlobalInvocationID.x, g_index[0]);";
3107 os << NL " vec4 r = vec4(0.0, 1.0, 0.0, 1.0);" NL " " << TypePrefix<T>()
3108 << "vec4 v;" NL " v = imageLoad(g_image_2d, coord);" NL
3109 " if (v != g_value) r = vec4(1.0, 0.0, float(coord.x), 2.0);" NL
3110 " v = imageLoad(g_image_3d, ivec3(coord, g_index[0]));" NL
3111 " if (v != g_value) r = vec4(1.0, 0.0, float(coord.x), 3.0);" NL
3112 " v = imageLoad(g_image_cube, ivec3(coord, g_index[0]));" NL
3113 " if (v != g_value) r = vec4(1.0, 0.0, float(coord.x), 6.0);" NL
3114 " v = imageLoad(g_image_2darray, ivec3(coord, g_index[0]));" NL
3115 " if (v != g_value) r = vec4(1.0, 0.0, float(coord.x), 23.0);" NL " o_color[coord.x] = ivec4(r);" NL
3192 const char* src_fs = NL "void main() {" NL " discard;" NL "}";
3269 os << NL "#define KSIZE 100";
3272 os << NL "layout(local_size_x = KSIZE) in;";
3277 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 1) coherent uniform "
3281 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 2) coherent uniform "
3285 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 0) coherent uniform "
3289 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 3) coherent uniform "
3293 os << NL "layout(std430) buffer out_data {" NL " ivec4 o_color[KSIZE];" NL "} r;" NL << TypePrefix<T>()
3294 << "vec2 t(int i) {" NL " return " << TypePrefix<T>()
3295 << "vec2(i);" NL "}" NL "void main() {" NL " int g_value[6] = int[](r.o_color[0].x, r.o_color[0].y+1, "
3300 os << NL " ivec2 coord = ivec2(gl_VertexID, g_value[0]);";
3304 os << NL " ivec2 coord = ivec2(gl_GlobalInvocationID.x, g_value[0]);";
3306 os << NL " ivec4 o_color = ivec4(0, 1, 0, 1);";
3311 os << NL " ivec4 i = ivec4(1, 0, 0, 2);" NL " imageAtomicExchange(g_image_2d, coord, t(0).x);" NL
3312 " if (imageAtomicAdd(g_image_2d, coord, t(2).x) != t(0).x) o_color = i;" NL
3313 " if (imageAtomicMin(g_image_2d, coord, t(3).x) != t(2).x) o_color = i;" NL
3314 " if (imageAtomicMax(g_image_2d, coord, t(4).x) != t(2).x) o_color = i;" NL
3315 " if (imageAtomicAnd(g_image_2d, coord, t(0).x) != t(4).x) o_color = i;" NL
3316 " if (imageAtomicOr(g_image_2d, coord, t(7).x) != t(0).x) o_color = i;" NL
3317 " if (imageAtomicXor(g_image_2d, coord, t(4).x) != t(7).x) o_color = i;" NL
3318 " if (imageAtomicExchange(g_image_2d, coord, t(1).x) != t(3).x) o_color = i;" NL
3319 " if (imageAtomicCompSwap(g_image_2d, coord, t(1).x, t(6).x) != t(1).x) o_color = i;" NL
3323 os << NL " ivec4 i = ivec4(1, 0, 0, 3);" NL
3324 " imageAtomicExchange(g_image_3d, ivec3(coord, 0), t(0).x);" NL
3325 " if (imageAtomicAdd(g_image_3d, ivec3(coord, 0), t(2).x) != t(0).x) o_color = i;" NL
3326 " if (imageAtomicMin(g_image_3d, ivec3(coord, 0), t(3).x) != t(2).x) o_color = i;" NL
3327 " if (imageAtomicMax(g_image_3d, ivec3(coord, g_value[0]), t(4).x) != t(2).x) o_color = i;" NL
3328 " if (imageAtomicAnd(g_image_3d, ivec3(coord, 0), t(0).x) != t(4).x) o_color = i;" NL
3329 " if (imageAtomicOr(g_image_3d, ivec3(coord, 0), t(7).x) != t(0).x) o_color = i;" NL
3330 " if (imageAtomicXor(g_image_3d, ivec3(coord, 0), t(4).x) != t(7).x) o_color = i;" NL
3331 " if (imageAtomicExchange(g_image_3d, ivec3(coord, 0), t(1).x) != t(3).x) o_color = i;" NL
3332 " if (imageAtomicCompSwap(g_image_3d, ivec3(coord, 0), t(1).x, t(6).x) != t(1).x) o_color = i;" NL
3336 os << NL
3337 " ivec4 i = ivec4(1, 0, 0, 6);" NL " imageAtomicExchange(g_image_cube, ivec3(coord, 0), t(0).x);" NL
3338 " if (imageAtomicAdd(g_image_cube, ivec3(coord, 0), t(g_value[2]).x) != t(0).x) o_color = i;" NL
3339 " if (imageAtomicMin(g_image_cube, ivec3(coord, 0), t(3).x) != t(2).x) o_color = i;" NL
3340 " if (imageAtomicMax(g_image_cube, ivec3(coord, 0), t(4).x) != t(2).x) o_color = i;" NL
3341 " if (imageAtomicAnd(g_image_cube, ivec3(coord, 0), t(0).x) != t(4).x) o_color = i;" NL
3342 " if (imageAtomicOr(g_image_cube, ivec3(coord, 0), t(7).x) != t(0).x) o_color = i;" NL
3343 " if (imageAtomicXor(g_image_cube, ivec3(coord, 0), t(4).x) != t(7).x) o_color = i;" NL
3344 " if (imageAtomicExchange(g_image_cube, ivec3(coord, 0), t(1).x) != t(3).x) o_color = i;" NL
3346 "= i;" NL " if (imageAtomicExchange(g_image_cube, ivec3(coord, 0), t(0).x) != t(6).x) o_color = i;";
3349 os << NL
3350 " ivec4 i = ivec4(1, 0, 0, 23);" NL
3351 " imageAtomicExchange(g_image_2darray, ivec3(coord, 0), t(0).x);" NL
3352 " if (imageAtomicAdd(g_image_2darray, ivec3(coord, 0), t(2).x) != t(0).x) o_color = i;" NL
3353 " if (imageAtomicMin(g_image_2darray, ivec3(coord, 0), t(3).x) != t(2).x) o_color = i;" NL
3354 " if (imageAtomicMax(g_image_2darray, ivec3(coord, 0), t(4).x) != t(2).x) o_color = i;" NL
3355 " if (imageAtomicAnd(g_image_2darray, ivec3(coord, 0), t(0).x) != t(4).x) o_color = i;" NL
3356 " if (imageAtomicOr(g_image_2darray, ivec3(coord, 0), t(7).x) != t(0).x) o_color = i;" NL
3357 " if (imageAtomicXor(g_image_2darray, ivec3(coord, 0), t(g_value[4]).x) != t(7).x) o_color = i;" NL
3358 " if (imageAtomicExchange(g_image_2darray, ivec3(coord, 0), t(1).x) != t(3).x) o_color = i;" NL
3359 " if (imageAtomicCompSwap(g_image_2darray, ivec3(coord, 0), t(1).x, t(6).x) != t(1).x) o_color = i;" NL
3363 os << NL " r.o_color[coord.x] = o_color;" NL "}";
3476 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
3479 NL "#define KSIZE 32" NL "layout(std430) buffer out_data {" NL " ivec4 o_color[KSIZE*KSIZE];" NL "};" NL
3480 "layout(r32f, binding = 0) coherent restrict uniform image2D g_image_layer0;" NL
3481 "layout(r32f, binding = 1) volatile uniform image2D g_image_layer1;" NL "void main() {" NL
3482 " ivec2 coord = ivec2(gl_FragCoord.xy);" NL " imageStore(g_image_layer0, coord, vec4(1.0));" NL
3483 " memoryBarrier();" NL " imageStore(g_image_layer1, coord, vec4(2.0));" NL " memoryBarrier();" NL
3484 " imageStore(g_image_layer0, coord, vec4(3.0));" NL " memoryBarrier();" NL
3485 " int coordIndex = coord.x + KSIZE * coord.y;" NL
3486 " o_color[coordIndex] = ivec4(imageLoad(g_image_layer0, coord) + imageLoad(g_image_layer1, coord));" NL
3570 NL "#define KSIZE 10" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
3571 "layout(std430) buffer out_data {" NL " ivec4 o_color[KSIZE*KSIZE];" NL "};" NL
3572 "layout(r32f, binding = 0) coherent restrict uniform image2D g_image_layer0;" NL
3573 "layout(r32f, binding = 1) volatile uniform image2D g_image_layer1;" NL "void main() {" NL
3574 " ivec2 coord = ivec2(gl_LocalInvocationID.xy);" NL " imageStore(g_image_layer0, coord, vec4(1.0));" NL
3575 " memoryBarrier();" NL " imageStore(g_image_layer1, coord, vec4(2.0));" NL " memoryBarrier();" NL
3576 " imageStore(g_image_layer0, coord, vec4(3.0));" NL " memoryBarrier();" NL
3578 "imageLoad(g_image_layer1, coord));" NL "}";
3669 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
3671 NL "layout(early_fragment_tests) in;" NL "layout(location = 0) out vec4 o_color;" NL
3672 "layout(rgba32f, binding = 0) writeonly coherent uniform image2D g_image;" NL "void main() {" NL
3673 " ivec2 coord = ivec2(gl_FragCoord.xy);" NL " imageStore(g_image, coord, vec4(17.0));" NL
3674 " o_color = vec4(1.0, 0.0, 0.0, 1.0);" NL "}";
3676 NL "layout(location = 0) out vec4 o_color;" NL
3677 "layout(rgba32f, binding = 1) writeonly coherent uniform image2D g_image;" NL "void main() {" NL
3678 " ivec2 coord = ivec2(gl_FragCoord.xy);" NL " imageStore(g_image, coord, vec4(13.0));" NL
3679 " o_color = vec4(1.0, 0.0, 0.0, 1.0);" NL "}";
3705 NL "#define KSIZE 8" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
3706 "uniform sampler2D g_sampler;" NL "layout(std430) buffer OutputBuffer {" NL
3707 " vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL
3708 " data[gl_LocalInvocationIndex] = texelFetch(g_sampler, ivec2(gl_LocalInvocationID), 0);" NL "}";
3787 NL "layout (local_size_x = 1) in;" NL "layout(std430) buffer out_data {" NL " ivec4 o_color;" NL "};" NL
3788 "uniform int MaxImageUnits;" NL "uniform int MaxCombinedShaderOutputResources;" NL
3789 "uniform int MaxVertexImageUniforms;" NL "uniform int MaxFragmentImageUniforms;" NL
3790 "uniform int MaxComputeImageUniforms;" NL "uniform int MaxCombinedImageUniforms;" NL "void main() {" NL
3791 " o_color = ivec4(0, 1, 0, 1);" NL
3792 " if (gl_MaxImageUnits != MaxImageUnits) o_color = ivec4(1, 0, 0, 1);" NL
3794 "0, 2);" NL " if (gl_MaxVertexImageUniforms != MaxVertexImageUniforms) o_color = ivec4(1, 0, 0, 4);" NL
3795 " if (gl_MaxFragmentImageUniforms != MaxFragmentImageUniforms) o_color = ivec4(1, 0, 0, 5);" NL
3796 " if (gl_MaxComputeImageUniforms != MaxComputeImageUniforms) o_color = ivec4(1, 0, 0, 6);" NL
3797 " if (gl_MaxCombinedImageUniforms != MaxCombinedImageUniforms) o_color = ivec4(1, 0, 0, 9);" NL "}";
3877 NL "layout(rgba32f) writeonly uniform image2D g_output_data;" NL "void main() {" NL
3878 " vec2[4] data = vec2[4](vec2(-1, -1), vec2(1, -1), vec2(-1, 1), vec2(1, 1));" NL
3879 " imageStore(g_output_data, ivec2(gl_VertexID,0), vec4(data[gl_VertexID], 0.0, 1.0));" NL
3880 " gl_PointSize = 1.0;" NL "}";
3881 const char* const glsl_store_fs = NL "void main() {" NL " discard;" NL "}";
3883 NL "out vec4 vs_color;" NL "layout(rgba32f) readonly uniform image2D g_image;" NL
3884 "uniform sampler2D g_sampler;" NL "void main() {" NL
3885 " vec4 pi = imageLoad(g_image, ivec2(gl_VertexID, 0));" NL
3886 " vec4 ps = texelFetch(g_sampler, ivec2(gl_VertexID, 0), 0);" NL
3887 " if (pi != ps) vs_color = vec4(1.0, 0.0, 0.0, 1.0);" NL
3888 " else vs_color = vec4(0.0, 1.0, 0.0, 1.0);" NL " gl_Position = pi;" NL "}";
3890 NL "#define KSIZE 44" NL "in vec4 vs_color;" NL "layout(std430) buffer OutputBuffer {" NL
3891 " vec4 o_color[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_FragCoord.xy);" NL
3892 " int coordIndex = coord.x + KSIZE * coord.y;" NL " o_color[coordIndex] = vs_color;" NL "}";
3979 NL "layout(rgba32f, binding = 0) writeonly uniform image2D g_position_buffer;" NL
3980 "layout(rgba32f, binding = 1) writeonly uniform image2D g_color_buffer;" NL
3981 "layout(r32ui, binding = 2) writeonly uniform uimage2D g_element_buffer;" NL "uniform vec4 g_color;" NL
3982 "void main() {" NL " vec2[4] data = vec2[4](vec2(-1, -1), vec2(1, -1), vec2(-1, 1), vec2(1, 1));" NL
3983 " imageStore(g_position_buffer, ivec2(gl_VertexID,0), vec4(data[gl_VertexID], 0.0, 1.0));" NL
3984 " imageStore(g_color_buffer, ivec2(gl_VertexID,0), g_color);" NL
3985 " imageStore(g_element_buffer, ivec2(gl_VertexID,0), uvec4(gl_VertexID));" NL "}";
3986 const char* const glsl_store_fs = NL "void main() {" NL " discard;" NL "}";
3988 NL "#define KSIZE 4" NL "layout (local_size_x = KSIZE) in;" NL
3989 "layout(rgba32f, binding = 0) readonly uniform image2D g_position_img;" NL
3990 "layout(rgba32f, binding = 1) readonly uniform image2D g_color_img;" NL
3991 "layout(r32ui, binding = 2) readonly uniform uimage2D g_element_img;" NL
3992 "layout(std430, binding = 1) buffer g_position_buf {" NL " vec2 g_pos[KSIZE];" NL "};" NL
3993 "layout(std430, binding = 2) buffer g_color_buf {" NL " vec4 g_col[KSIZE];" NL "};" NL
3994 "layout(std430, binding = 3) buffer g_element_buf {" NL " uint g_elem[KSIZE];" NL "};" NL
3995 "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID.x, 0);" NL
3996 " g_pos[coord.x] = (imageLoad(g_position_img, coord)).xy;" NL
3997 " g_col[coord.x] = imageLoad(g_color_img, coord);" NL
3998 " g_elem[coord.x] = uint((imageLoad(g_element_img, coord)).x);" NL "}";
3999 const char* const glsl_draw_vs = NL
4000 "layout(location = 0) in vec4 i_position;" NL "layout(location = 1) in vec4 i_color;" NL
4001 "out vec4 vs_color;" NL "void main() {" NL " gl_Position = i_position;" NL " vs_color = i_color;" NL "}";
4002 const char* const glsl_draw_fs = NL "in vec4 vs_color;" NL "layout(location = 0) out vec4 o_color;" NL
4003 "void main() {" NL " o_color = vs_color;" NL "}";
4134 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
4136 NL "layout(rgba32f) writeonly uniform image2D g_image;" NL "uniform vec4 g_color;" NL "void main() {" NL
4137 " imageStore(g_image, ivec2(gl_FragCoord.xy), g_color);" NL " discard;" NL "}";
4139 NL "layout(location = 0) out vec4 o_color;" NL "uniform sampler2D g_sampler;" NL
4140 "layout(std430) buffer OutputBuffer {" NL " uvec4 counter;" NL " vec4 data[];" NL "};" NL
4141 "void main() {" NL " uint idx = atomicAdd(counter[0], 1u);" NL
4142 " data[idx] = texelFetch(g_sampler, ivec2(gl_FragCoord.xy), 0);" NL "}";
4229 NL "layout(location = 0) in vec4 i_position;" NL
4230 "layout(r32ui, binding = 3) coherent uniform uimage2D g_image;" NL "void main() {" NL
4231 " gl_Position = i_position;" NL " imageAtomicAdd(g_image, ivec2(0, gl_VertexID), 100u);" NL "}";
4233 NL "#define KSIZE 64" NL "layout(r32ui, binding = 3) coherent uniform uimage2D g_image;" NL
4234 "void main() {" NL " imageAtomicAdd(g_image, ivec2(0, int(gl_FragCoord.x) & 0x03), 0x1u);" NL "}";
4237 NL "#define KSIZE 4" NL "layout (local_size_x = KSIZE) in;" NL
4238 "layout(r32ui, binding = 3) uniform uimage2D g_image;" NL "layout(std430) buffer out_data {" NL
4239 " uvec4 data[KSIZE];" NL "};" NL "void main() {" NL
4240 " uvec4 v = imageLoad(g_image, ivec2(0, gl_LocalInvocationID.x));" NL
4241 " data[gl_LocalInvocationIndex] = v;" NL "}";
4317 const char* const glsl_vs = NL
4318 "layout(location = 0) in vec4 i_position;" NL "out vec4 vs_color;" NL
4319 "layout(r32f, binding = 0) uniform image2D g_image_vs;" NL "void main() {" NL
4320 " gl_Position = i_position;" NL " vs_color = vec4(41, 42, 43, 44);" NL
4321 " imageStore(g_image_vs, ivec2(gl_VertexID), vec4(1.0));" NL
4322 " imageStore(g_image_vs, ivec2(gl_VertexID), vec4(2.0));" NL
4323 " imageStore(g_image_vs, ivec2(gl_VertexID), vec4(3.0));" NL
4324 " if (imageLoad(g_image_vs, ivec2(gl_VertexID)) != vec4(3,0,0,1)) vs_color = vec4(21, 22, 23, 24);" NL "}";
4326 NL "#define KSIZE 11" NL "in vec4 vs_color;" NL "layout(r32f, binding = 1) uniform image2D g_image;" NL
4327 "layout(std430) buffer out_data {" NL " vec4 data[KSIZE*KSIZE*4];" NL "};" NL "void main() {" NL
4328 " ivec2 coord = ivec2(gl_FragCoord);" NL " int coordIndex = coord.x + KSIZE * coord.y;" NL
4329 " for (int i = 0; i < 4; ++i) {" NL " data[coordIndex + i * KSIZE*KSIZE] = vs_color;" NL " }" NL
4330 " for (int i = 0; i < 4; ++i) {" NL " imageStore(g_image, coord, vec4(i+50));" NL
4331 " vec4 v = imageLoad(g_image, coord);" NL " if (v.x != float(i+50)) {" NL
4332 " data[coordIndex + i * KSIZE*KSIZE] = vec4(v.xyz, i+10);" NL " break;" NL " }" NL " }" NL
4407 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
4409 NL "layout(rgba32f, binding = 2) writeonly uniform image2D g_image[2];" NL "void main() {" NL
4410 " int i = g_image.length();" NL " imageStore(g_image[0], ivec2(gl_FragCoord), vec4(i+98));" NL
4411 " imageStore(g_image[1], ivec2(gl_FragCoord), vec4(i+99));" NL " discard;" NL "}";
4413 NL "layout(rgba32f, binding = 0) writeonly uniform image2D g_image[2];" NL "void main() {" NL
4414 " int i = g_image.length();" NL " imageStore(g_image[0], ivec2(gl_FragCoord), vec4(i+8));" NL
4415 " imageStore(g_image[1], ivec2(gl_FragCoord), vec4(i+9));" NL " discard;" NL "}";
4468 NL "#define KSIZE 4" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4469 "layout(rgba32f, binding = 0) readonly uniform image2D g_image[4];" NL
4470 "layout(std430) buffer OutputBuffer {" NL " uvec4 counter;" NL " vec4 data[];" NL "};" NL
4471 "void main() {" NL " uint idx = atomicAdd(counter[0], 1u);" NL
4472 " data[idx][0] = (imageLoad(g_image[0], ivec2(gl_GlobalInvocationID))).z;" NL
4473 " data[idx][1] = (imageLoad(g_image[1], ivec2(gl_GlobalInvocationID))).z;" NL
4474 " data[idx][2] = (imageLoad(g_image[2], ivec2(gl_GlobalInvocationID))).z;" NL
4475 " data[idx][3] = (imageLoad(g_image[3], ivec2(gl_GlobalInvocationID))).z;" NL "}";
4544 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
4546 NL "layout(rgba32f, binding = 3) readonly uniform image2D g_input_image;" NL
4547 "layout(rgba32f, binding = 1) writeonly uniform image2D g_output_image;" NL "void main() {" NL
4548 " ivec2 coord = ivec2(gl_FragCoord);" NL
4549 " imageStore(g_output_image, coord, imageLoad(g_input_image, coord));" NL " discard;" NL "}";
4551 const char* const glsl_cs = NL
4552 "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4553 "layout(rgba32f, binding = 2) readonly uniform image2D g_image;" NL "layout(std430) buffer out_data {" NL
4554 " vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4555 " data[gl_LocalInvocationIndex] = imageLoad(g_image, coord);" NL "}";
4633 NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4634 "layout(rgba32f, binding = 3) readonly uniform image2D g_input_image;" NL
4635 "layout(rgba32f, binding = 1) writeonly uniform image2D g_output_image;" NL "void main() {" NL
4636 " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4637 " imageStore(g_output_image, coord, imageLoad(g_input_image, coord));" NL "}";
4639 const char* const glsl_cs_c = NL
4640 "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4641 "layout(rgba32f, binding = 2) readonly uniform image2D g_image;" NL "layout(std430) buffer out_data {" NL
4642 " vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4643 " data[gl_LocalInvocationIndex] = imageLoad(g_image, coord);" NL "}";
4717 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
4719 NL "layout(rgba32f, binding = 0) writeonly uniform image2D g_image[4];" NL "void main() {" NL
4720 " imageStore(g_image[0], ivec2(gl_FragCoord), vec4(23));" NL
4721 " imageStore(g_image[1], ivec2(gl_FragCoord), vec4(24));" NL
4722 " imageStore(g_image[2], ivec2(gl_FragCoord), vec4(25));" NL
4723 " imageStore(g_image[3], ivec2(gl_FragCoord), vec4(26));" NL " discard;" NL "}";
4724 const char* const glsl_load_cs = NL
4725 "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4726 "layout(rgba32f, binding = 0) readonly uniform image2D g_image[4];" NL "layout(std430) buffer out_data {" NL
4727 " ivec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4728 " data[gl_LocalInvocationIndex] = ivec4(2, 3, 4, 5);" NL " vec4 c0 = imageLoad(g_image[0], coord);" NL
4729 " vec4 c1 = imageLoad(g_image[1], coord);" NL " vec4 c2 = imageLoad(g_image[2], coord);" NL
4730 " vec4 c3 = imageLoad(g_image[3], coord);" NL
4732 "c0.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][0] = int(c0.x);" NL
4734 "c1.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][1] = int(c1.x);" NL
4736 "c2.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][2] = int(c2.x);" NL
4738 "c3.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][3] = int(c3.x);" NL "}";
4810 NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4811 "layout(rgba32f, binding = 0) writeonly uniform image2D g_image[4];" NL "void main() {" NL
4812 " ivec2 coord = ivec2(gl_LocalInvocationID);" NL " imageStore(g_image[0], coord, vec4(23));" NL
4813 " imageStore(g_image[1], coord, vec4(24));" NL " imageStore(g_image[2], coord, vec4(25));" NL
4814 " imageStore(g_image[3], coord, vec4(26));" NL "}";
4815 const char* const glsl_load_cs = NL
4816 "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4817 "layout(rgba32f, binding = 0) readonly uniform image2D g_image[4];" NL "layout(std430) buffer out_data {" NL
4818 " ivec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4819 " data[gl_LocalInvocationIndex] = ivec4(2, 3, 4, 5);" NL " vec4 c0 = imageLoad(g_image[0], coord);" NL
4820 " vec4 c1 = imageLoad(g_image[1], coord);" NL " vec4 c2 = imageLoad(g_image[2], coord);" NL
4821 " vec4 c3 = imageLoad(g_image[3], coord);" NL
4823 "c0.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][0] = int(c0.x);" NL
4825 "c1.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][1] = int(c1.x);" NL
4827 "c2.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][2] = int(c2.x);" NL
4829 "c3.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][3] = int(c3.x);" NL "}";
4907 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
4909 NL "#define KSIZE 11" NL "layout(r32i, binding = 0) coherent uniform iimage2D g_image0;" NL
4910 "layout(r32ui, binding = 1) coherent uniform uimage2D g_image1;" NL "void main() {" NL
4911 " ivec2 coord = ivec2(gl_FragCoord.xy);" NL " imageAtomicAdd(g_image0, coord, 2);" NL
4912 " imageAtomicAdd(g_image0, coord, -1);" NL " imageAtomicAdd(g_image1, coord, 1u);" NL
4913 " imageAtomicAdd(g_image1, coord, 2u);" NL "}";
4916 const char* const glsl_cs = NL
4917 "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4918 "layout(r32i, binding = 0) uniform iimage2D gi_image;" NL
4919 "layout(r32ui, binding = 1) uniform uimage2D gu_image;" NL "layout(std430) buffer out_data {" NL
4920 " ivec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4921 " data[gl_LocalInvocationIndex].yx = imageLoad(gi_image, coord).xy;" NL
4922 " data[gl_LocalInvocationIndex].wz = ivec2(imageLoad(gu_image, coord).xz);" NL "}";
5000 NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
5001 "layout(r32i, binding = 0) coherent uniform iimage2D g_image0;" NL
5002 "layout(r32ui, binding = 1) coherent uniform uimage2D g_image1;" NL "void main() {" NL
5003 " ivec2 coord = ivec2(gl_LocalInvocationID);" NL " imageAtomicAdd(g_image0, coord, 222);" NL
5004 " imageAtomicAdd(g_image0, coord, -11);" NL " imageAtomicAdd(g_image1, coord, 1u);" NL
5005 " imageAtomicAdd(g_image1, coord, 2u);" NL "}";
5008 const char* const glsl_cs_c = NL
5009 "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
5010 "layout(r32i, binding = 0) uniform iimage2D gi_image;" NL
5011 "layout(r32ui, binding = 1) uniform uimage2D gu_image;" NL "layout(std430) buffer out_data {" NL
5012 " ivec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
5013 " data[gl_LocalInvocationIndex].yz = imageLoad(gi_image, coord).xw;" NL
5014 " data[gl_LocalInvocationIndex].wx = ivec2(imageLoad(gu_image, coord).xy);" NL "}";
5078 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
5079 const char* glsl_fs = NL "layout(rgba32f) writeonly uniform image2D g_image;" NL "void main() {" NL
5080 " ivec2 coord = ivec2(gl_FragCoord.xy);" NL
5081 " imageStore(g_image, coord, vec4(0.0));" NL " discard;" NL "}";
5240 NL "layout(rgba32f) writeonly readonly uniform image2D g_image;" NL "void main() {" NL
5241 " vec4 o_color;" NL " o_color = imageLoad(g_image, ivec2(0));" NL "}"))
5245 NL "layout(rgba32f) writeonly uniform image2D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5246 " o_color = imageLoad(g_image, ivec2(0));" NL "}"))
5250 NL "uniform vec4 i_color;" NL "layout(rgba32f) readonly uniform image2D g_image;" NL "void main() {" NL
5251 " vec4 o_color;" NL " imageStore(g_image, ivec2(0), i_color);" NL " o_color = i_color;" NL "}"))
5255 NL "uniform image2D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5256 " o_color = imageLoad(g_image, ivec2(0));" NL "}"))
5260 NL "readonly uniform image2D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5261 " o_color = imageLoad(g_image, ivec2(0));" NL "}"))
5265 NL "layout(r32i) uniform image1D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5266 " o_color = vec4(1.0);" NL "}"))
5270 NL "layout(rgba16) writeonly uniform iimage2D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5271 " o_color = vec4(1.0);" NL "}"))
5275 NL "#extension GL_OES_shader_image_atomic : require" NL
5276 "layout(r32f) coherent uniform image2D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5277 " imageAtomicAdd(g_image, ivec2(1), 10);" NL " o_color = vec4(1.0);" NL "}"))
5281 NL "#extension GL_OES_shader_image_atomic : require" NL
5282 "layout(rgba8i) coherent uniform iimage2D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5283 " imageAtomicAdd(g_image, ivec2(1), 1);" NL " o_color = vec4(1.0);" NL "}"))
5287 NL "layout(r32ui) uniform iimage3D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5288 " imageStore(g_image, ivec3(1), ivec4(1));" NL " o_color = vec4(1.0);" NL "}"))
5292 NL "layout(r32f) uniform uimage2DArray g_image;" NL "void main() {" NL " vec4 o_color;" NL
5293 " imageStore(g_image, ivec3(0), uvec4(1));" NL " o_color = vec4(1.0);" NL "}"))
5297 NL "layout(r32f) coherent uniform image2D g_image;" NL "vec4 Load(iimage2D image) {" NL
5298 " return imageLoad(image, vec2(0));" NL "}" NL "void main() {" NL " vec4 o_color;" NL
5299 " o_color = Load(g_image);" NL "}"))
5307 const char* const csVer = "#version 310 es" NL "layout(local_size_x = 1) in;";
5328 const char* const fsVer = "#version 310 es" NL "precision highp float;";
5360 if (!Link(NL "layout(location = 0) in vec4 i_position;" NL
5361 "layout(rgba32f) writeonly uniform highp image3D g_image;" NL "void main() {" NL
5362 " imageStore(g_image, ivec3(gl_VertexID), vec4(0));" NL " gl_Position = i_position;" NL "}",
5364 NL "precision highp float;" NL "layout(location = 0) out vec4 o_color;" NL
5365 "layout(rgba32f) writeonly uniform highp image2D g_image;" NL "void main() {" NL
5366 " imageStore(g_image, ivec2(gl_FragCoord), vec4(1.0));" NL " o_color = vec4(1.0);" NL "}"))
5369 if (!Link(NL "layout(location = 0) in vec4 i_position;" NL
5370 "layout(rgba32f) writeonly uniform highp image2D g_image;" NL "void main() {" NL
5371 " imageStore(g_image, ivec2(gl_VertexID), vec4(0));" NL " gl_Position = i_position;" NL "}",
5373 NL "precision highp float;" NL "layout(location = 0) out vec4 o_color;" NL
5374 "layout(r32f) writeonly uniform highp image2D g_image;" NL "void main() {" NL
5375 " imageStore(g_image, ivec2(gl_FragCoord), vec4(1.0));" NL " o_color = vec4(1.0);" NL "}"))