Lines Matching refs:NL

55 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;";
1114 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
1185 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 2) writeonly uniform "
1186 << TypePrefix<T>() << "image2D g_image;" NL "void main() {" NL " ivec2 coord = ivec2(gl_FragCoord.xy);" NL
1188 << TypePrefix<T>() << "vec4" << value << ");" NL " discard;" NL "}";
1196 os << NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "uniform "
1197 << TypePrefix<T>() << "sampler2D g_sampler;" NL "layout(std430) buffer OutputBuffer {" NL " "
1199 << "vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL
1200 " data[gl_LocalInvocationIndex] = texelFetch(g_sampler, ivec2(gl_LocalInvocationID), 0);" NL
1202 << value << ";" NL "}";
1218 os << NL "#define KSIZE 4" NL "layout(" << FormatEnumToString(internalformat) << ") writeonly uniform "
1220 << "image2D g_image;" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "void main() {" NL
1221 " ivec2 thread_xy = ivec2(gl_LocalInvocationID);" NL " imageStore(g_image, thread_xy, "
1222 << TypePrefix<T>() << "vec4" << value << ");" NL "}";
1230 os << NL "#define KSIZE 4" 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 << TypePrefix<T>() << "vec4" << value << ";" NL "}";
1400 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
1469 os << NL "#define KSIZE 11" NL "layout(" << FormatEnumToString(internalformat)
1471 << "image2D g_image;" NL "layout(std430) buffer OutputBuffer {" NL " " << TypePrefix<T>()
1472 << "vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_FragCoord.xy);" NL " "
1473 << TypePrefix<T>() << "vec4 v = imageLoad(g_image, coord);" NL " data[coord.y * KSIZE + coord.x] = v;" NL
1475 << TypePrefix<T>() << "vec4" << expected_value << ";" NL " discard;" NL "}";
1491 os << NL "#define KSIZE 4" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "layout("
1493 << "image2D g_image;" NL "layout(std430) buffer OutputBuffer {" NL " " << TypePrefix<T>()
1494 << "vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
1496 << TypePrefix<T>() << "vec4 v = imageLoad(g_image, coord);" NL " data[gl_LocalInvocationIndex] = v;" NL
1498 << TypePrefix<T>() << "vec4" << expected_value << ";" NL "}";
1720 os << NL "#define KSIZE 8" NL "layout(local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "layout("
1722 << "image2D g_image_read;" NL "layout(" << FormatEnumToString(internalformat)
1724 << "image2D g_image_write;" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL " "
1725 << TypePrefix<T>() << "vec4 v = imageLoad(g_image_read, coord);" NL
1726 " imageStore(g_image_write, coord, v+v);" NL " //imageStore(g_image_write, coord, "
1727 << TypePrefix<T>() << "vec4" << expected_value << ");" NL "}";
1735 os << NL "#define KSIZE 8" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "uniform "
1736 << TypePrefix<T>() << "sampler2D g_sampler;" NL "layout(std430) buffer OutputBuffer {" NL " "
1738 << "vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL
1739 " data[gl_LocalInvocationIndex] = texelFetch(g_sampler, ivec2(gl_LocalInvocationID), 0);" NL
1741 << TypePrefix<T>() << "vec4" << value << ";" NL "}";
1807 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
1914 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 0) writeonly uniform "
1918 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 1) writeonly uniform "
1922 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 2) writeonly uniform "
1926 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 3) writeonly uniform "
1930 os << NL "void main() {" NL " ivec2 coord = ivec2(gl_FragCoord.xy);";
1934 os << NL " imageStore(g_image_2d, coord, " << TypePrefix<T>() << "vec4" << write_value << ");";
1937 os << NL " imageStore(g_image_3d, ivec3(coord, 0), " << TypePrefix<T>() << "vec4" << write_value
1938 << ");" NL " imageStore(g_image_3d, ivec3(coord, 1), " << TypePrefix<T>() << "vec4" << write_value
1942 os << NL " imageStore(g_image_cube, ivec3(coord, 0), " << TypePrefix<T>() << "vec4" << write_value
1943 << ");" NL " imageStore(g_image_cube, ivec3(coord, 1), " << TypePrefix<T>() << "vec4" << write_value
1944 << ");" NL " imageStore(g_image_cube, ivec3(coord, 2), " << TypePrefix<T>() << "vec4" << write_value
1945 << ");" NL " imageStore(g_image_cube, ivec3(coord, 3), " << TypePrefix<T>() << "vec4" << write_value
1946 << ");" NL " imageStore(g_image_cube, ivec3(coord, 4), " << TypePrefix<T>() << "vec4" << write_value
1947 << ");" NL " imageStore(g_image_cube, ivec3(coord, 5), " << TypePrefix<T>() << "vec4" << write_value
1951 os << NL " imageStore(g_image_2darray, ivec3(coord, 0), " << TypePrefix<T>() << "vec4" << write_value
1952 << ");" NL " imageStore(g_image_2darray, ivec3(coord, 1), " << TypePrefix<T>() << "vec4" << write_value
1956 os << NL " discard;" NL "}";
1964 os << NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "uniform "
1965 << TypePrefix<T>() << "sampler2D g_sampler_2d;" NL "uniform " << TypePrefix<T>()
1966 << "sampler3D g_sampler_3d;" NL "uniform " << TypePrefix<T>() << "samplerCube g_sampler_cube;" NL "uniform "
1968 << "sampler2DArray g_sampler_2darray;" NL "layout(std430, binding = 1) buffer OutputBuffer2D {" NL " "
1969 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE];" NL "} g_buff_2d;" NL
1970 "layout(std430, binding = 0) buffer OutputBuffer3D {" NL " "
1971 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_3d;" NL
1972 "layout(std430, binding = 3) buffer OutputBufferCube {" NL " "
1973 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*6];" NL "} g_buff_cube;" NL
1974 "layout(std430, binding = 2) buffer OutputBuffer2DArray {" NL " "
1976 << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_2darray;" NL "void main() {" NL
1977 " int cubemap_i = 2 * int(gl_LocalInvocationID.x) - KSIZE + 1;" NL
1978 " int cubemap_j = 2 * int(gl_LocalInvocationID.y) - KSIZE + 1;" NL
1979 " uint layer = uint(KSIZE * KSIZE);" NL
1980 " g_buff_2d.data[gl_LocalInvocationIndex] = texelFetch(g_sampler_2d, ivec2(gl_LocalInvocationID), 0);" NL
1982 "0);" NL " g_buff_3d.data[gl_LocalInvocationIndex + layer] = texelFetch(g_sampler_3d, "
1983 "ivec3(gl_LocalInvocationID.xy, 1), 0);" NL " g_buff_2darray.data[gl_LocalInvocationIndex] = "
1985 "ivec3(gl_LocalInvocationID.xy, 0), 0);" NL
1987 "ivec3(gl_LocalInvocationID.xy, 1), 0);" NL " g_buff_cube.data[gl_LocalInvocationIndex] = "
1988 "texture(g_sampler_cube, vec3(KSIZE,cubemap_i,cubemap_j));" NL
1990 "vec3(KSIZE,cubemap_i,cubemap_j));" NL " g_buff_cube.data[gl_LocalInvocationIndex + 2u * layer] = "
1991 "texture(g_sampler_cube, vec3(cubemap_i,KSIZE,cubemap_j));" NL
1993 "vec3(cubemap_i,KSIZE,cubemap_j));" NL " g_buff_cube.data[gl_LocalInvocationIndex + 4u * layer] = "
1994 "texture(g_sampler_cube, vec3(cubemap_i,cubemap_j,KSIZE));" NL
1996 "vec3(cubemap_i,cubemap_j,KSIZE));" NL " //g_buff_2d.data[gl_LocalInvocationIndex] = "
1997 << write_value << ";" NL "}";
2150 os << NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;";
2154 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 0) writeonly uniform "
2158 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 1) writeonly uniform "
2162 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 2) writeonly uniform "
2166 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 3) writeonly uniform "
2170 os << NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);";
2175 os << NL " imageStore(g_image_2d, coord, " << TypePrefix<T>() << "vec4" << write_value << ");";
2178 os << NL " imageStore(g_image_3d, ivec3(coord, 0), " << TypePrefix<T>() << "vec4" << write_value
2179 << ");" NL " imageStore(g_image_3d, ivec3(coord, 1), " << TypePrefix<T>() << "vec4" << write_value
2183 os << NL " imageStore(g_image_cube, ivec3(coord, 0), " << TypePrefix<T>() << "vec4" << write_value
2184 << ");" NL " imageStore(g_image_cube, ivec3(coord, 1), " << TypePrefix<T>() << "vec4" << write_value
2185 << ");" NL " imageStore(g_image_cube, ivec3(coord, 2), " << TypePrefix<T>() << "vec4" << write_value
2186 << ");" NL " imageStore(g_image_cube, ivec3(coord, 3), " << TypePrefix<T>() << "vec4" << write_value
2187 << ");" NL " imageStore(g_image_cube, ivec3(coord, 4), " << TypePrefix<T>() << "vec4" << write_value
2188 << ");" NL " imageStore(g_image_cube, ivec3(coord, 5), " << TypePrefix<T>() << "vec4" << write_value
2192 os << NL " imageStore(g_image_2darray, ivec3(coord, 0), " << TypePrefix<T>() << "vec4" << write_value
2193 << ");" NL " imageStore(g_image_2darray, ivec3(coord, 1), " << TypePrefix<T>() << "vec4" << write_value
2197 os << NL "}";
2205 os << NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL "uniform "
2206 << TypePrefix<T>() << "sampler2D g_sampler_2d;" NL "uniform " << TypePrefix<T>()
2207 << "sampler3D g_sampler_3d;" NL "uniform " << TypePrefix<T>() << "samplerCube g_sampler_cube;" NL "uniform "
2209 << "sampler2DArray g_sampler_2darray;" NL "layout(std430, binding = 0) buffer OutputBuffer2D {" NL " "
2210 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE];" NL "} g_buff_2d;" NL
2211 "layout(std430, binding = 1) buffer OutputBuffer3D {" NL " "
2212 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_3d;" NL
2213 "layout(std430, binding = 2) buffer OutputBufferCube {" NL " "
2214 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*6];" NL "} g_buff_cube;" NL
2215 "layout(std430, binding = 3) buffer OutputBuffer2DArray {" NL " "
2217 << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_2darray;" NL "void main() {" NL
2218 " int cubemap_i = 2 * int(gl_LocalInvocationID.x) - KSIZE + 1;" NL
2219 " int cubemap_j = 2 * int(gl_LocalInvocationID.y) - KSIZE + 1;" NL
2220 " uint layer = uint(KSIZE * KSIZE);" NL
2221 " g_buff_2d.data[gl_LocalInvocationIndex] = texelFetch(g_sampler_2d, ivec2(gl_LocalInvocationID), 0);" NL
2223 "0);" NL " g_buff_3d.data[gl_LocalInvocationIndex + layer] = texelFetch(g_sampler_3d, "
2224 "ivec3(gl_LocalInvocationID.xy, 1), 0);" NL " g_buff_2darray.data[gl_LocalInvocationIndex] = "
2226 "ivec3(gl_LocalInvocationID.xy, 0), 0);" NL
2228 "ivec3(gl_LocalInvocationID.xy, 1), 0);" NL " g_buff_cube.data[gl_LocalInvocationIndex] = "
2229 "texture(g_sampler_cube, vec3(KSIZE,cubemap_i,cubemap_j));" NL
2231 "vec3(KSIZE,cubemap_i,cubemap_j));" NL " g_buff_cube.data[gl_LocalInvocationIndex + 2u * layer] = "
2232 "texture(g_sampler_cube, vec3(cubemap_i,KSIZE,cubemap_j));" NL
2234 "vec3(cubemap_i,KSIZE,cubemap_j));" NL " g_buff_cube.data[gl_LocalInvocationIndex + 4u * layer] = "
2235 "texture(g_sampler_cube, vec3(cubemap_i,cubemap_j,KSIZE));" NL
2237 "vec3(cubemap_i,cubemap_j,KSIZE));" NL " //g_buff_2d.data[gl_LocalInvocationIndex] = "
2238 << write_value << ";" NL "}";
2308 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
2403 os << NL "#define KSIZE 11";
2407 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 2) readonly uniform "
2409 << "image2D g_image_2d;" NL "layout(std430, binding = 1) buffer OutputBuffer2D {" NL " "
2410 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE];" NL "} g_buff_2d;";
2413 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 0) readonly uniform "
2415 << "image3D g_image_3d;" NL "layout(std430, binding = 0) buffer OutputBuffer3D {" NL " "
2416 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_3d;";
2419 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 3) readonly uniform "
2421 << "imageCube g_image_cube;" NL "layout(std430, binding = 3) buffer OutputBufferCube {" NL " "
2422 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*6];" NL "} g_buff_cube;";
2425 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 1) readonly uniform "
2427 << "image2DArray g_image_2darray;" NL "layout(std430, binding = 2) buffer OutputBuffer2DArray {" NL " "
2428 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_2darray;";
2431 os << NL "void main() {" NL " ivec2 coord = ivec2(gl_FragCoord.xy);" NL
2432 " int coordIndex = coord.x + KSIZE * coord.y;" NL " int layer = int(KSIZE * KSIZE);" NL " "
2438 os << NL " v = imageLoad(g_image_2d, coord);" NL " g_buff_2d.data[coordIndex] = v;";
2441 os << NL " v = imageLoad(g_image_3d, ivec3(coord.xy, 0));" NL " g_buff_3d.data[coordIndex] = v;" NL
2442 " v = imageLoad(g_image_3d, ivec3(coord.xy, 1));" NL " g_buff_3d.data[coordIndex + layer] = v;";
2445 os << NL
2446 " v = imageLoad(g_image_cube, ivec3(coord, 0));" NL " g_buff_cube.data[coordIndex] = v;" NL
2447 " v = imageLoad(g_image_cube, ivec3(coord, 1));" NL " g_buff_cube.data[coordIndex + layer] = v;" NL
2448 " v = imageLoad(g_image_cube, ivec3(coord, 2));" NL
2449 " g_buff_cube.data[coordIndex + 2 * layer] = v;" NL
2450 " v = imageLoad(g_image_cube, ivec3(coord, 3));" NL
2451 " g_buff_cube.data[coordIndex + 3 * layer] = v;" NL
2452 " v = imageLoad(g_image_cube, ivec3(coord, 4));" NL
2453 " g_buff_cube.data[coordIndex + 4 * layer] = v;" NL
2454 " v = imageLoad(g_image_cube, ivec3(coord, 5));" NL " g_buff_cube.data[coordIndex + 5 * layer] = v;";
2457 os << NL " v = imageLoad(g_image_2darray, ivec3(coord, 0));" NL " g_buff_2darray.data[coordIndex] = v;" NL
2458 " v = imageLoad(g_image_2darray, ivec3(coord, 1));" NL
2462 os << NL " //g_buff_2d.data[coordIndex] = " << expected_value << ";" NL "}";
2616 os << NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;";
2620 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 2) readonly uniform "
2622 << "image2D g_image_2d;" NL "layout(std430, binding = 0) buffer OutputBuffer2D {" NL " "
2623 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE];" NL "} g_buff_2d;";
2626 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 0) readonly uniform "
2628 << "image3D g_image_3d;" NL "layout(std430, binding = 1) buffer OutputBuffer3D {" NL " "
2629 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_3d;";
2632 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 3) readonly uniform "
2634 << "imageCube g_image_cube;" NL "layout(std430, binding = 2) buffer OutputBufferCube {" NL " "
2635 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*6];" NL "} g_buff_cube;";
2638 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 1) readonly uniform "
2640 << "image2DArray g_image_2darray;" NL "layout(std430, binding = 3) buffer OutputBuffer2DArray {" NL " "
2641 << TypePrefix<T>() << "vec4 data[KSIZE*KSIZE*2];" NL "} g_buff_2darray;";
2644 os << NL "void main() {" NL " ivec3 coord = ivec3(gl_LocalInvocationID.xy, 0);" NL
2645 " uint layer = uint(KSIZE * KSIZE);" NL " "
2651 os << NL " v = imageLoad(g_image_2d, coord.xy);" NL " g_buff_2d.data[gl_LocalInvocationIndex] = v;";
2654 os << NL " v = imageLoad(g_image_3d, coord);" NL " g_buff_3d.data[gl_LocalInvocationIndex] = v;" NL
2655 " v = imageLoad(g_image_3d, ivec3(coord.xy, 1));" NL
2659 os << NL " v = imageLoad(g_image_cube, coord);" NL " g_buff_cube.data[gl_LocalInvocationIndex] = v;" NL
2660 " v = imageLoad(g_image_cube, ivec3(coord.xy, 1));" NL
2661 " g_buff_cube.data[gl_LocalInvocationIndex + layer] = v;" NL
2662 " v = imageLoad(g_image_cube, ivec3(coord.xy, 2));" NL
2663 " g_buff_cube.data[gl_LocalInvocationIndex + 2u * layer] = v;" NL
2664 " v = imageLoad(g_image_cube, ivec3(coord.xy, 3));" NL
2665 " g_buff_cube.data[gl_LocalInvocationIndex + 3u * layer] = v;" NL
2666 " v = imageLoad(g_image_cube, ivec3(coord.xy, 4));" NL
2667 " g_buff_cube.data[gl_LocalInvocationIndex + 4u * layer] = v;" NL
2668 " v = imageLoad(g_image_cube, ivec3(coord.xy, 5));" NL
2672 os << NL " v = imageLoad(g_image_2darray, coord);" NL
2673 " g_buff_2darray.data[gl_LocalInvocationIndex] = v;" NL
2674 " v = imageLoad(g_image_2darray, ivec3(coord.xy, 1));" NL
2678 os << NL " //g_buff_2d.data[gl_LocalInvocationIndex] = " << expected_value << ";" NL "}";
2730 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
2820 os << NL "#define KSIZE 11" NL "layout(" << FormatEnumToString(internalformat)
2821 << ", binding = 1) coherent uniform " << TypePrefix<T>() << "image2D g_image_2d;" NL "layout("
2823 << "image3D g_image_3d;" NL "layout(" << FormatEnumToString(internalformat)
2824 << ", binding = 0) coherent uniform " << TypePrefix<T>() << "imageCube g_image_cube;" NL "layout("
2826 << "image2DArray g_image_2darray;" NL "layout(std430) buffer out_data {" NL
2827 " ivec4 o_color[KSIZE*KSIZE];" NL "};" NL
2828 << TypePrefix<T>() << "vec2 t(int i) {" NL " return " << TypePrefix<T>()
2829 << "vec2(i);" NL "}" NL "void main() {" NL " ivec2 coord = ivec2(gl_FragCoord.xy);" NL
2830 " int coordIndex = coord.x + KSIZE * coord.y;" NL " o_color[coordIndex] = ivec4(coordIndex);" NL
2831 " if (imageAtomicAdd(g_image_2d, coord, t(2).x) != t(0).x) o_color[coordIndex].x = 1;" NL
2832 " else if (imageAtomicMin(g_image_2d, coord, t(3).x) != t(2).x) o_color[coordIndex].x = 2;" NL
2833 " else if (imageAtomicMax(g_image_2d, coord, t(4).x) != t(2).x) o_color[coordIndex].x = 3;" NL
2834 " else if (imageAtomicAnd(g_image_2d, coord, t(0).x) != t(4).x) o_color[coordIndex].x = 4;" NL
2835 " else if (imageAtomicOr(g_image_2d, coord, t(7).x) != t(0).x) o_color[coordIndex].x = 5;" NL
2836 " else if (imageAtomicXor(g_image_2d, coord, t(4).x) != t(7).x) o_color[coordIndex].x = 6;" NL
2837 " else if (imageAtomicExchange(g_image_2d, coord, t(1).x) != t(3).x) o_color[coordIndex].x = 7;" NL
2839 "8;" NL " else o_color[coordIndex].x = 10;" NL
2840 " if (imageAtomicAdd(g_image_3d, ivec3(coord, 2), t(2).x) != t(0).x) o_color[coordIndex].y = 1;" NL
2841 " else if (imageAtomicMin(g_image_3d, ivec3(coord, 2), t(3).x) != t(2).x) o_color[coordIndex].y = 2;" NL
2842 " else if (imageAtomicMax(g_image_3d, ivec3(coord, 2), t(4).x) != t(2).x) o_color[coordIndex].y = 3;" NL
2843 " else if (imageAtomicAnd(g_image_3d, ivec3(coord, 2), t(0).x) != t(4).x) o_color[coordIndex].y = 4;" NL
2844 " else if (imageAtomicOr(g_image_3d, ivec3(coord, 2), t(7).x) != t(0).x) o_color[coordIndex].y = 5;" NL
2845 " else if (imageAtomicXor(g_image_3d, ivec3(coord, 2), t(4).x) != t(7).x) o_color[coordIndex].y = 6;" NL
2847 "7;" NL " else if (imageAtomicCompSwap(g_image_3d, ivec3(coord, 2), t(1).x, t(6).x) != t(1).x) "
2848 "o_color[coordIndex].y = 8;" NL " else o_color[coordIndex].y = 10;" NL
2849 " if (imageAtomicAdd(g_image_cube, ivec3(coord, 3), t(2).x) != t(0).x) o_color[coordIndex].z = 1;" NL
2851 "2;" NL " else if (imageAtomicMax(g_image_cube, ivec3(coord, 3), t(4).x) != t(2).x) "
2852 "o_color[coordIndex].z = 3;" NL " else if (imageAtomicAnd(g_image_cube, ivec3(coord, 3), "
2853 "t(0).x) != t(4).x) o_color[coordIndex].z = 4;" NL
2854 " else if (imageAtomicOr(g_image_cube, ivec3(coord, 3), t(7).x) != t(0).x) o_color[coordIndex].z = 5;" NL
2856 "6;" NL " else if (imageAtomicExchange(g_image_cube, ivec3(coord, 3), t(1).x) != t(3).x) "
2857 "o_color[coordIndex].z = 7;" NL " else if (imageAtomicCompSwap(g_image_cube, ivec3(coord, 3), "
2858 "t(1).x, t(6).x) != t(1).x) o_color[coordIndex].z = 8;" NL " else o_color[coordIndex].z = 10;" NL
2859 " if (imageAtomicAdd(g_image_2darray, ivec3(coord, 2), t(2).x) != t(0).x) o_color[coordIndex].w = 1;" NL
2861 "2;" NL " else if (imageAtomicMax(g_image_2darray, ivec3(coord, 2), t(4).x) != t(2).x) "
2862 "o_color[coordIndex].w = 3;" NL " else if (imageAtomicAnd(g_image_2darray, ivec3(coord, 2), "
2863 "t(0).x) != t(4).x) o_color[coordIndex].w = 4;" NL
2865 "5;" NL " else if (imageAtomicXor(g_image_2darray, ivec3(coord, 2), t(4).x) != t(7).x) "
2866 "o_color[coordIndex].w = 6;" NL " else if (imageAtomicExchange(g_image_2darray, ivec3(coord, "
2867 "2), t(1).x) != t(3).x) o_color[coordIndex].w = 7;" NL
2869 "o_color[coordIndex].w = 8;" NL " else o_color[coordIndex].w = 10;" NL " discard;" NL "}";
2908 const char* src_fs = NL "void main() {" NL " discard;" NL "}";
3002 os << NL "#define KSIZE 100" NL "layout(local_size_x = KSIZE) in;";
3004 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 1) writeonly uniform "
3005 << TypePrefix<T>() << "image2D g_image_2d;" NL "layout(" << FormatEnumToString(internalformat)
3006 << ", binding = 2) writeonly uniform " << TypePrefix<T>() << "image3D g_image_3d;" NL "layout("
3008 << "imageCube g_image_cube;" NL "layout(" << FormatEnumToString(internalformat)
3010 << "image2DArray g_image_2darray;" NL "layout(std430) buffer out_data {" NL " ivec4 o_color;" NL "};" NL
3011 "void main() {" NL " "
3014 << ";" NL " int g_index[6] = int[](o_color.x, o_color.y, o_color.z, o_color.w, o_color.r, o_color.g);";
3017 os << NL " ivec2 coord = ivec2(gl_VertexID, g_index[0]);";
3021 os << NL " ivec2 coord = ivec2(gl_GlobalInvocationID.x, g_index[0]);";
3023 os << NL " imageStore(g_image_2d, coord, g_value);" NL
3024 " imageStore(g_image_3d, ivec3(coord.xy, g_index[0]), g_value);" NL
3025 " imageStore(g_image_3d, ivec3(coord.xy, g_index[1]), g_value);" NL
3026 " for (int i = 0; i < 6; ++i) {" NL
3027 " imageStore(g_image_cube, ivec3(coord, g_index[i]), g_value);" NL " }" NL
3028 " imageStore(g_image_2darray, ivec3(coord, g_index[0]), g_value);" NL
3029 " imageStore(g_image_2darray, ivec3(coord, g_index[1]), g_value);" NL "}";
3037 os << NL "#define KSIZE 100";
3040 os << NL "layout(local_size_x = KSIZE) in;";
3042 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 3) readonly uniform "
3043 << TypePrefix<T>() << "image2D g_image_2d;" NL "layout(" << FormatEnumToString(internalformat)
3044 << ", binding = 2) readonly uniform " << TypePrefix<T>() << "image3D g_image_3d;" NL "layout("
3046 << "imageCube g_image_cube;" NL "layout(" << FormatEnumToString(internalformat)
3048 << "image2DArray g_image_2darray;" NL "layout(std430) buffer out_data {" NL " ivec4 o_color[KSIZE];" NL
3049 "};" NL "void main() {";
3053 os << NL " " << TypePrefix<T>() << "vec4 g_value = " << TypePrefix<T>() << "vec4(o_color[gl_VertexID]) + "
3058 os << NL " " << TypePrefix<T>() << "vec4 g_value = " << TypePrefix<T>()
3062 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, "
3066 os << NL " ivec2 coord = ivec2(gl_VertexID, g_index[0]);";
3070 os << NL " ivec2 coord = ivec2(gl_GlobalInvocationID.x, g_index[0]);";
3072 os << NL " vec4 r = vec4(0.0, 1.0, 0.0, 1.0);" NL " " << TypePrefix<T>()
3073 << "vec4 v;" NL " v = imageLoad(g_image_2d, coord);" NL
3074 " if (v != g_value) r = vec4(1.0, 0.0, float(coord.x), 2.0);" NL
3075 " v = imageLoad(g_image_3d, ivec3(coord, g_index[0]));" NL
3076 " if (v != g_value) r = vec4(1.0, 0.0, float(coord.x), 3.0);" NL
3077 " v = imageLoad(g_image_cube, ivec3(coord, g_index[0]));" NL
3078 " if (v != g_value) r = vec4(1.0, 0.0, float(coord.x), 6.0);" NL
3079 " v = imageLoad(g_image_2darray, ivec3(coord, g_index[0]));" NL
3080 " if (v != g_value) r = vec4(1.0, 0.0, float(coord.x), 23.0);" NL " o_color[coord.x] = ivec4(r);" NL
3156 const char* src_fs = NL "void main() {" NL " discard;" NL "}";
3233 os << NL "#define KSIZE 100";
3236 os << NL "layout(local_size_x = KSIZE) in;";
3241 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 1) coherent uniform "
3245 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 2) coherent uniform "
3249 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 0) coherent uniform "
3253 os << NL "layout(" << FormatEnumToString(internalformat) << ", binding = 3) coherent uniform "
3257 os << NL "layout(std430) buffer out_data {" NL " ivec4 o_color[KSIZE];" NL "} r;" NL << TypePrefix<T>()
3258 << "vec2 t(int i) {" NL " return " << TypePrefix<T>()
3259 << "vec2(i);" NL "}" NL "void main() {" NL " int g_value[6] = int[](r.o_color[0].x, r.o_color[0].y+1, "
3264 os << NL " ivec2 coord = ivec2(gl_VertexID, g_value[0]);";
3268 os << NL " ivec2 coord = ivec2(gl_GlobalInvocationID.x, g_value[0]);";
3270 os << NL " ivec4 o_color = ivec4(0, 1, 0, 1);";
3274 os << NL " ivec4 i = ivec4(1, 0, 0, 2);" NL " imageAtomicExchange(g_image_2d, coord, t(0).x);" NL
3275 " if (imageAtomicAdd(g_image_2d, coord, t(2).x) != t(0).x) o_color = i;" NL
3276 " if (imageAtomicMin(g_image_2d, coord, t(3).x) != t(2).x) o_color = i;" NL
3277 " if (imageAtomicMax(g_image_2d, coord, t(4).x) != t(2).x) o_color = i;" NL
3278 " if (imageAtomicAnd(g_image_2d, coord, t(0).x) != t(4).x) o_color = i;" NL
3279 " if (imageAtomicOr(g_image_2d, coord, t(7).x) != t(0).x) o_color = i;" NL
3280 " if (imageAtomicXor(g_image_2d, coord, t(4).x) != t(7).x) o_color = i;" NL
3281 " if (imageAtomicExchange(g_image_2d, coord, t(1).x) != t(3).x) o_color = i;" NL
3282 " if (imageAtomicCompSwap(g_image_2d, coord, t(1).x, t(6).x) != t(1).x) o_color = i;" NL
3286 os << NL " ivec4 i = ivec4(1, 0, 0, 3);" NL
3287 " imageAtomicExchange(g_image_3d, ivec3(coord, 0), t(0).x);" NL
3288 " if (imageAtomicAdd(g_image_3d, ivec3(coord, 0), t(2).x) != t(0).x) o_color = i;" NL
3289 " if (imageAtomicMin(g_image_3d, ivec3(coord, 0), t(3).x) != t(2).x) o_color = i;" NL
3290 " if (imageAtomicMax(g_image_3d, ivec3(coord, g_value[0]), t(4).x) != t(2).x) o_color = i;" NL
3291 " if (imageAtomicAnd(g_image_3d, ivec3(coord, 0), t(0).x) != t(4).x) o_color = i;" NL
3292 " if (imageAtomicOr(g_image_3d, ivec3(coord, 0), t(7).x) != t(0).x) o_color = i;" NL
3293 " if (imageAtomicXor(g_image_3d, ivec3(coord, 0), t(4).x) != t(7).x) o_color = i;" NL
3294 " if (imageAtomicExchange(g_image_3d, ivec3(coord, 0), t(1).x) != t(3).x) o_color = i;" NL
3295 " if (imageAtomicCompSwap(g_image_3d, ivec3(coord, 0), t(1).x, t(6).x) != t(1).x) o_color = i;" NL
3299 os << NL
3300 " ivec4 i = ivec4(1, 0, 0, 6);" NL " imageAtomicExchange(g_image_cube, ivec3(coord, 0), t(0).x);" NL
3301 " if (imageAtomicAdd(g_image_cube, ivec3(coord, 0), t(g_value[2]).x) != t(0).x) o_color = i;" NL
3302 " if (imageAtomicMin(g_image_cube, ivec3(coord, 0), t(3).x) != t(2).x) o_color = i;" NL
3303 " if (imageAtomicMax(g_image_cube, ivec3(coord, 0), t(4).x) != t(2).x) o_color = i;" NL
3304 " if (imageAtomicAnd(g_image_cube, ivec3(coord, 0), t(0).x) != t(4).x) o_color = i;" NL
3305 " if (imageAtomicOr(g_image_cube, ivec3(coord, 0), t(7).x) != t(0).x) o_color = i;" NL
3306 " if (imageAtomicXor(g_image_cube, ivec3(coord, 0), t(4).x) != t(7).x) o_color = i;" NL
3307 " if (imageAtomicExchange(g_image_cube, ivec3(coord, 0), t(1).x) != t(3).x) o_color = i;" NL
3309 "= i;" NL " if (imageAtomicExchange(g_image_cube, ivec3(coord, 0), t(0).x) != t(6).x) o_color = i;";
3312 os << NL
3313 " ivec4 i = ivec4(1, 0, 0, 23);" NL
3314 " imageAtomicExchange(g_image_2darray, ivec3(coord, 0), t(0).x);" NL
3315 " if (imageAtomicAdd(g_image_2darray, ivec3(coord, 0), t(2).x) != t(0).x) o_color = i;" NL
3316 " if (imageAtomicMin(g_image_2darray, ivec3(coord, 0), t(3).x) != t(2).x) o_color = i;" NL
3317 " if (imageAtomicMax(g_image_2darray, ivec3(coord, 0), t(4).x) != t(2).x) o_color = i;" NL
3318 " if (imageAtomicAnd(g_image_2darray, ivec3(coord, 0), t(0).x) != t(4).x) o_color = i;" NL
3319 " if (imageAtomicOr(g_image_2darray, ivec3(coord, 0), t(7).x) != t(0).x) o_color = i;" NL
3320 " if (imageAtomicXor(g_image_2darray, ivec3(coord, 0), t(g_value[4]).x) != t(7).x) o_color = i;" NL
3321 " if (imageAtomicExchange(g_image_2darray, ivec3(coord, 0), t(1).x) != t(3).x) o_color = i;" NL
3322 " if (imageAtomicCompSwap(g_image_2darray, ivec3(coord, 0), t(1).x, t(6).x) != t(1).x) o_color = i;" NL
3326 os << NL " r.o_color[coord.x] = o_color;" NL "}";
3433 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
3435 NL "#define KSIZE 32" NL "layout(std430) buffer out_data {" NL " ivec4 o_color[KSIZE*KSIZE];" NL "};" NL
3436 "layout(r32f, binding = 0) coherent restrict uniform image2D g_image_layer0;" NL
3437 "layout(r32f, binding = 1) volatile uniform image2D g_image_layer1;" NL "void main() {" NL
3438 " ivec2 coord = ivec2(gl_FragCoord.xy);" NL " imageStore(g_image_layer0, coord, vec4(1.0));" NL
3439 " memoryBarrier();" NL " imageStore(g_image_layer1, coord, vec4(2.0));" NL " memoryBarrier();" NL
3440 " imageStore(g_image_layer0, coord, vec4(3.0));" NL " memoryBarrier();" NL
3441 " int coordIndex = coord.x + KSIZE * coord.y;" NL
3442 " o_color[coordIndex] = ivec4(imageLoad(g_image_layer0, coord) + imageLoad(g_image_layer1, coord));" NL
3523 NL "#define KSIZE 10" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
3524 "layout(std430) buffer out_data {" NL " ivec4 o_color[KSIZE*KSIZE];" NL "};" NL
3525 "layout(r32f, binding = 0) coherent restrict uniform image2D g_image_layer0;" NL
3526 "layout(r32f, binding = 1) volatile uniform image2D g_image_layer1;" NL "void main() {" NL
3527 " ivec2 coord = ivec2(gl_LocalInvocationID.xy);" NL " imageStore(g_image_layer0, coord, vec4(1.0));" NL
3528 " memoryBarrier();" NL " imageStore(g_image_layer1, coord, vec4(2.0));" NL " memoryBarrier();" NL
3529 " imageStore(g_image_layer0, coord, vec4(3.0));" NL " memoryBarrier();" NL
3531 "imageLoad(g_image_layer1, coord));" NL "}";
3620 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
3622 NL "layout(early_fragment_tests) in;" NL "layout(location = 0) out vec4 o_color;" NL
3623 "layout(rgba32f, binding = 0) writeonly coherent uniform image2D g_image;" NL "void main() {" NL
3624 " ivec2 coord = ivec2(gl_FragCoord.xy);" NL " imageStore(g_image, coord, vec4(17.0));" NL
3625 " o_color = vec4(1.0, 0.0, 0.0, 1.0);" NL "}";
3627 NL "layout(location = 0) out vec4 o_color;" NL
3628 "layout(rgba32f, binding = 1) writeonly coherent uniform image2D g_image;" NL "void main() {" NL
3629 " ivec2 coord = ivec2(gl_FragCoord.xy);" NL " imageStore(g_image, coord, vec4(13.0));" NL
3630 " o_color = vec4(1.0, 0.0, 0.0, 1.0);" NL "}";
3656 NL "#define KSIZE 8" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
3657 "uniform sampler2D g_sampler;" NL "layout(std430) buffer OutputBuffer {" NL
3658 " vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL
3659 " data[gl_LocalInvocationIndex] = texelFetch(g_sampler, ivec2(gl_LocalInvocationID), 0);" NL "}";
3738 NL "layout (local_size_x = 1) in;" NL "layout(std430) buffer out_data {" NL " ivec4 o_color;" NL "};" NL
3739 "uniform int MaxImageUnits;" NL "uniform int MaxCombinedShaderOutputResources;" NL
3740 "uniform int MaxVertexImageUniforms;" NL "uniform int MaxFragmentImageUniforms;" NL
3741 "uniform int MaxComputeImageUniforms;" NL "uniform int MaxCombinedImageUniforms;" NL "void main() {" NL
3742 " o_color = ivec4(0, 1, 0, 1);" NL
3743 " if (gl_MaxImageUnits != MaxImageUnits) o_color = ivec4(1, 0, 0, 1);" NL
3745 "0, 2);" NL " if (gl_MaxVertexImageUniforms != MaxVertexImageUniforms) o_color = ivec4(1, 0, 0, 4);" NL
3746 " if (gl_MaxFragmentImageUniforms != MaxFragmentImageUniforms) o_color = ivec4(1, 0, 0, 5);" NL
3747 " if (gl_MaxComputeImageUniforms != MaxComputeImageUniforms) o_color = ivec4(1, 0, 0, 6);" NL
3748 " if (gl_MaxCombinedImageUniforms != MaxCombinedImageUniforms) o_color = ivec4(1, 0, 0, 9);" NL "}";
3828 NL "layout(rgba32f) writeonly uniform image2D g_output_data;" NL "void main() {" NL
3829 " vec2[4] data = vec2[4](vec2(-1, -1), vec2(1, -1), vec2(-1, 1), vec2(1, 1));" NL
3830 " imageStore(g_output_data, ivec2(gl_VertexID,0), vec4(data[gl_VertexID], 0.0, 1.0));" NL
3831 " gl_PointSize = 1.0;" NL "}";
3832 const char* const glsl_store_fs = NL "void main() {" NL " discard;" NL "}";
3834 NL "out vec4 vs_color;" NL "layout(rgba32f) readonly uniform image2D g_image;" NL
3835 "uniform sampler2D g_sampler;" NL "void main() {" NL
3836 " vec4 pi = imageLoad(g_image, ivec2(gl_VertexID, 0));" NL
3837 " vec4 ps = texelFetch(g_sampler, ivec2(gl_VertexID, 0), 0);" NL
3838 " if (pi != ps) vs_color = vec4(1.0, 0.0, 0.0, 1.0);" NL
3839 " else vs_color = vec4(0.0, 1.0, 0.0, 1.0);" NL " gl_Position = pi;" NL "}";
3841 NL "#define KSIZE 44" NL "in vec4 vs_color;" NL "layout(std430) buffer OutputBuffer {" NL
3842 " vec4 o_color[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_FragCoord.xy);" NL
3843 " int coordIndex = coord.x + KSIZE * coord.y;" NL " o_color[coordIndex] = vs_color;" NL "}";
3930 NL "layout(rgba32f, binding = 0) writeonly uniform image2D g_position_buffer;" NL
3931 "layout(rgba32f, binding = 1) writeonly uniform image2D g_color_buffer;" NL
3932 "layout(r32ui, binding = 2) writeonly uniform uimage2D g_element_buffer;" NL "uniform vec4 g_color;" NL
3933 "void main() {" NL " vec2[4] data = vec2[4](vec2(-1, -1), vec2(1, -1), vec2(-1, 1), vec2(1, 1));" NL
3934 " imageStore(g_position_buffer, ivec2(gl_VertexID,0), vec4(data[gl_VertexID], 0.0, 1.0));" NL
3935 " imageStore(g_color_buffer, ivec2(gl_VertexID,0), g_color);" NL
3936 " imageStore(g_element_buffer, ivec2(gl_VertexID,0), uvec4(gl_VertexID));" NL "}";
3937 const char* const glsl_store_fs = NL "void main() {" NL " discard;" NL "}";
3939 NL "#define KSIZE 4" NL "layout (local_size_x = KSIZE) in;" NL
3940 "layout(rgba32f, binding = 0) readonly uniform image2D g_position_img;" NL
3941 "layout(rgba32f, binding = 1) readonly uniform image2D g_color_img;" NL
3942 "layout(r32ui, binding = 2) readonly uniform uimage2D g_element_img;" NL
3943 "layout(std430, binding = 1) buffer g_position_buf {" NL " vec2 g_pos[KSIZE];" NL "};" NL
3944 "layout(std430, binding = 2) buffer g_color_buf {" NL " vec4 g_col[KSIZE];" NL "};" NL
3945 "layout(std430, binding = 3) buffer g_element_buf {" NL " uint g_elem[KSIZE];" NL "};" NL
3946 "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID.x, 0);" NL
3947 " g_pos[coord.x] = (imageLoad(g_position_img, coord)).xy;" NL
3948 " g_col[coord.x] = imageLoad(g_color_img, coord);" NL
3949 " g_elem[coord.x] = uint((imageLoad(g_element_img, coord)).x);" NL "}";
3950 const char* const glsl_draw_vs = NL
3951 "layout(location = 0) in vec4 i_position;" NL "layout(location = 1) in vec4 i_color;" NL
3952 "out vec4 vs_color;" NL "void main() {" NL " gl_Position = i_position;" NL " vs_color = i_color;" NL "}";
3953 const char* const glsl_draw_fs = NL "in vec4 vs_color;" NL "layout(location = 0) out vec4 o_color;" NL
3954 "void main() {" NL " o_color = vs_color;" NL "}";
4084 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
4086 NL "layout(rgba32f) writeonly uniform image2D g_image;" NL "uniform vec4 g_color;" NL "void main() {" NL
4087 " imageStore(g_image, ivec2(gl_FragCoord.xy), g_color);" NL " discard;" NL "}";
4089 NL "layout(location = 0) out vec4 o_color;" NL "uniform sampler2D g_sampler;" NL
4090 "layout(std430) buffer OutputBuffer {" NL " uvec4 counter;" NL " vec4 data[];" NL "};" NL
4091 "void main() {" NL " uint idx = atomicAdd(counter[0], 1u);" NL
4092 " data[idx] = texelFetch(g_sampler, ivec2(gl_FragCoord.xy), 0);" NL "}";
4197 NL "layout(location = 0) in vec4 i_position;" NL
4198 "layout(r32ui, binding = 3) coherent uniform uimage2D g_image;" NL "void main() {" NL
4199 " gl_Position = i_position;" NL " imageAtomicCompSwap(g_image, ivec2(0, gl_VertexID), 0u, 100u);" NL "}";
4201 NL "#define KSIZE 64" NL "layout(r32ui, binding = 3) coherent uniform uimage2D g_image;" NL
4202 "void main() {" NL " imageAtomicAdd(g_image, ivec2(0, int(gl_FragCoord.x) & 0x03), 0x1u);" NL "}";
4205 NL "#define KSIZE 4" NL "layout (local_size_x = KSIZE) in;" NL
4206 "layout(r32ui, binding = 3) uniform uimage2D g_image;" NL "layout(std430) buffer out_data {" NL
4207 " uvec4 data[KSIZE];" NL "};" NL "void main() {" NL
4208 " uvec4 v = imageLoad(g_image, ivec2(0, gl_LocalInvocationID.x));" NL
4209 " data[gl_LocalInvocationIndex] = v;" NL "}";
4285 const char* const glsl_vs = NL
4286 "layout(location = 0) in vec4 i_position;" NL "out vec4 vs_color;" NL
4287 "layout(r32f, binding = 0) uniform image2D g_image_vs;" NL "void main() {" NL
4288 " gl_Position = i_position;" NL " vs_color = vec4(41, 42, 43, 44);" NL
4289 " imageStore(g_image_vs, ivec2(gl_VertexID), vec4(1.0));" NL
4290 " imageStore(g_image_vs, ivec2(gl_VertexID), vec4(2.0));" NL
4291 " imageStore(g_image_vs, ivec2(gl_VertexID), vec4(3.0));" NL
4292 " if (imageLoad(g_image_vs, ivec2(gl_VertexID)) != vec4(3,0,0,1)) vs_color = vec4(21, 22, 23, 24);" NL "}";
4294 NL "#define KSIZE 11" NL "in vec4 vs_color;" NL "layout(r32f, binding = 1) uniform image2D g_image;" NL
4295 "layout(std430) buffer out_data {" NL " vec4 data[KSIZE*KSIZE*4];" NL "};" NL "void main() {" NL
4296 " ivec2 coord = ivec2(gl_FragCoord);" NL " int coordIndex = coord.x + KSIZE * coord.y;" NL
4297 " for (int i = 0; i < 4; ++i) {" NL " data[coordIndex + i * KSIZE*KSIZE] = vs_color;" NL " }" NL
4298 " for (int i = 0; i < 4; ++i) {" NL " imageStore(g_image, coord, vec4(i+50));" NL
4299 " vec4 v = imageLoad(g_image, coord);" NL " if (v.x != float(i+50)) {" NL
4300 " data[coordIndex + i * KSIZE*KSIZE] = vec4(v.xyz, i+10);" NL " break;" NL " }" NL " }" NL
4375 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
4377 NL "layout(rgba32f, binding = 2) writeonly uniform image2D g_image[2];" NL "void main() {" NL
4378 " int i = g_image.length();" NL " imageStore(g_image[0], ivec2(gl_FragCoord), vec4(i+98));" NL
4379 " imageStore(g_image[1], ivec2(gl_FragCoord), vec4(i+99));" NL " discard;" NL "}";
4381 NL "layout(rgba32f, binding = 0) writeonly uniform image2D g_image[2];" NL "void main() {" NL
4382 " int i = g_image.length();" NL " imageStore(g_image[0], ivec2(gl_FragCoord), vec4(i+8));" NL
4383 " imageStore(g_image[1], ivec2(gl_FragCoord), vec4(i+9));" NL " discard;" NL "}";
4438 NL "#define KSIZE 4" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4439 "layout(rgba32f, binding = 0) readonly uniform image2D g_image[4];" NL
4440 "layout(std430) buffer OutputBuffer {" NL " uvec4 counter;" NL " vec4 data[];" NL "};" NL
4441 "void main() {" NL " uint idx = atomicAdd(counter[0], 1u);" NL
4442 " data[idx][0] = (imageLoad(g_image[0], ivec2(gl_GlobalInvocationID))).z;" NL
4443 " data[idx][1] = (imageLoad(g_image[1], ivec2(gl_GlobalInvocationID))).z;" NL
4444 " data[idx][2] = (imageLoad(g_image[2], ivec2(gl_GlobalInvocationID))).z;" NL
4445 " data[idx][3] = (imageLoad(g_image[3], ivec2(gl_GlobalInvocationID))).z;" NL "}";
4514 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
4516 NL "layout(rgba32f, binding = 3) readonly uniform image2D g_input_image;" NL
4517 "layout(rgba32f, binding = 1) writeonly uniform image2D g_output_image;" NL "void main() {" NL
4518 " ivec2 coord = ivec2(gl_FragCoord);" NL
4519 " imageStore(g_output_image, coord, imageLoad(g_input_image, coord));" NL " discard;" NL "}";
4521 const char* const glsl_cs = NL
4522 "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4523 "layout(rgba32f, binding = 2) readonly uniform image2D g_image;" NL "layout(std430) buffer out_data {" NL
4524 " vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4525 " data[gl_LocalInvocationIndex] = imageLoad(g_image, coord);" NL "}";
4602 NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4603 "layout(rgba32f, binding = 3) readonly uniform image2D g_input_image;" NL
4604 "layout(rgba32f, binding = 1) writeonly uniform image2D g_output_image;" NL "void main() {" NL
4605 " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4606 " imageStore(g_output_image, coord, imageLoad(g_input_image, coord));" NL "}";
4608 const char* const glsl_cs_c = NL
4609 "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4610 "layout(rgba32f, binding = 2) readonly uniform image2D g_image;" NL "layout(std430) buffer out_data {" NL
4611 " vec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4612 " data[gl_LocalInvocationIndex] = imageLoad(g_image, coord);" NL "}";
4685 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
4687 NL "layout(rgba32f, binding = 0) writeonly uniform image2D g_image[4];" NL "void main() {" NL
4688 " imageStore(g_image[0], ivec2(gl_FragCoord), vec4(23));" NL
4689 " imageStore(g_image[1], ivec2(gl_FragCoord), vec4(24));" NL
4690 " imageStore(g_image[2], ivec2(gl_FragCoord), vec4(25));" NL
4691 " imageStore(g_image[3], ivec2(gl_FragCoord), vec4(26));" NL " discard;" NL "}";
4692 const char* const glsl_load_cs = NL
4693 "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4694 "layout(rgba32f, binding = 0) readonly uniform image2D g_image[4];" NL "layout(std430) buffer out_data {" NL
4695 " ivec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4696 " data[gl_LocalInvocationIndex] = ivec4(2, 3, 4, 5);" NL " vec4 c0 = imageLoad(g_image[0], coord);" NL
4697 " vec4 c1 = imageLoad(g_image[1], coord);" NL " vec4 c2 = imageLoad(g_image[2], coord);" NL
4698 " vec4 c3 = imageLoad(g_image[3], coord);" NL
4700 "c0.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][0] = int(c0.x);" NL
4702 "c1.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][1] = int(c1.x);" NL
4704 "c2.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][2] = int(c2.x);" NL
4706 "c3.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][3] = int(c3.x);" NL "}";
4778 NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4779 "layout(rgba32f, binding = 0) writeonly uniform image2D g_image[4];" NL "void main() {" NL
4780 " ivec2 coord = ivec2(gl_LocalInvocationID);" NL " imageStore(g_image[0], coord, vec4(23));" NL
4781 " imageStore(g_image[1], coord, vec4(24));" NL " imageStore(g_image[2], coord, vec4(25));" NL
4782 " imageStore(g_image[3], coord, vec4(26));" NL "}";
4783 const char* const glsl_load_cs = NL
4784 "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4785 "layout(rgba32f, binding = 0) readonly uniform image2D g_image[4];" NL "layout(std430) buffer out_data {" NL
4786 " ivec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4787 " data[gl_LocalInvocationIndex] = ivec4(2, 3, 4, 5);" NL " vec4 c0 = imageLoad(g_image[0], coord);" NL
4788 " vec4 c1 = imageLoad(g_image[1], coord);" NL " vec4 c2 = imageLoad(g_image[2], coord);" NL
4789 " vec4 c3 = imageLoad(g_image[3], coord);" NL
4791 "c0.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][0] = int(c0.x);" NL
4793 "c1.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][1] = int(c1.x);" NL
4795 "c2.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][2] = int(c2.x);" NL
4797 "c3.xyz != vec3(0.0)))" NL " data[gl_LocalInvocationIndex][3] = int(c3.x);" NL "}";
4874 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
4876 NL "#define KSIZE 11" NL "layout(r32i, binding = 0) coherent uniform iimage2D g_image0;" NL
4877 "layout(r32ui, binding = 1) coherent uniform uimage2D g_image1;" NL "void main() {" NL
4878 " ivec2 coord = ivec2(gl_FragCoord.xy);" NL " imageAtomicAdd(g_image0, coord, 2);" NL
4879 " imageAtomicAdd(g_image0, coord, -1);" NL " imageAtomicAdd(g_image1, coord, 1u);" NL
4880 " imageAtomicAdd(g_image1, coord, 2u);" NL "}";
4883 const char* const glsl_cs = NL
4884 "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4885 "layout(r32i, binding = 0) uniform iimage2D gi_image;" NL
4886 "layout(r32ui, binding = 1) uniform uimage2D gu_image;" NL "layout(std430) buffer out_data {" NL
4887 " ivec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4888 " data[gl_LocalInvocationIndex].yx = imageLoad(gi_image, coord).xy;" NL
4889 " data[gl_LocalInvocationIndex].wz = ivec2(imageLoad(gu_image, coord).xz);" NL "}";
4966 NL "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4967 "layout(r32i, binding = 0) coherent uniform iimage2D g_image0;" NL
4968 "layout(r32ui, binding = 1) coherent uniform uimage2D g_image1;" NL "void main() {" NL
4969 " ivec2 coord = ivec2(gl_LocalInvocationID);" NL " imageAtomicAdd(g_image0, coord, 222);" NL
4970 " imageAtomicAdd(g_image0, coord, -11);" NL " imageAtomicAdd(g_image1, coord, 1u);" NL
4971 " imageAtomicAdd(g_image1, coord, 2u);" NL "}";
4974 const char* const glsl_cs_c = NL
4975 "#define KSIZE 11" NL "layout (local_size_x = KSIZE, local_size_y = KSIZE) in;" NL
4976 "layout(r32i, binding = 0) uniform iimage2D gi_image;" NL
4977 "layout(r32ui, binding = 1) uniform uimage2D gu_image;" NL "layout(std430) buffer out_data {" NL
4978 " ivec4 data[KSIZE*KSIZE];" NL "};" NL "void main() {" NL " ivec2 coord = ivec2(gl_LocalInvocationID);" NL
4979 " data[gl_LocalInvocationIndex].yz = imageLoad(gi_image, coord).xw;" NL
4980 " data[gl_LocalInvocationIndex].wx = ivec2(imageLoad(gu_image, coord).xy);" NL "}";
5044 NL "layout(location = 0) in vec4 i_position;" NL "void main() {" NL " gl_Position = i_position;" NL "}";
5045 const char* glsl_fs = NL "layout(rgba32f) writeonly uniform image2D g_image;" NL "void main() {" NL
5046 " ivec2 coord = ivec2(gl_FragCoord.xy);" NL
5047 " imageStore(g_image, coord, vec4(0.0));" NL " discard;" NL "}";
5214 NL "layout(rgba32f) writeonly readonly uniform image2D g_image;" NL "void main() {" NL
5215 " vec4 o_color;" NL " o_color = imageLoad(g_image, ivec2(0));" NL "}"))
5219 NL "layout(rgba32f) writeonly uniform image2D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5220 " o_color = imageLoad(g_image, ivec2(0));" NL "}"))
5224 NL "uniform vec4 i_color;" NL "layout(rgba32f) readonly uniform image2D g_image;" NL "void main() {" NL
5225 " vec4 o_color;" NL " imageStore(g_image, ivec2(0), i_color);" NL " o_color = i_color;" NL "}"))
5229 NL "uniform image2D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5230 " o_color = imageLoad(g_image, ivec2(0));" NL "}"))
5234 NL "readonly uniform image2D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5235 " o_color = imageLoad(g_image, ivec2(0));" NL "}"))
5239 NL "layout(r32i) uniform image1D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5240 " o_color = vec4(1.0);" NL "}"))
5244 NL "layout(rgba16) writeonly uniform iimage2D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5245 " o_color = vec4(1.0);" NL "}"))
5249 NL "#extension GL_OES_shader_image_atomic : require" NL
5250 "layout(r32f) coherent uniform image2D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5251 " imageAtomicAdd(g_image, ivec2(1), 10);" NL " o_color = vec4(1.0);" NL "}"))
5255 NL "#extension GL_OES_shader_image_atomic : require" NL
5256 "layout(rgba8i) coherent uniform iimage2D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5257 " imageAtomicAdd(g_image, ivec2(1), 1);" NL " o_color = vec4(1.0);" NL "}"))
5261 NL "layout(r32ui) uniform iimage3D g_image;" NL "void main() {" NL " vec4 o_color;" NL
5262 " imageStore(g_image, ivec3(1), ivec4(1));" NL " o_color = vec4(1.0);" NL "}"))
5266 NL "layout(r32f) uniform uimage2DArray g_image;" NL "void main() {" NL " vec4 o_color;" NL
5267 " imageStore(g_image, ivec3(0), uvec4(1));" NL " o_color = vec4(1.0);" NL "}"))
5271 NL "layout(r32f) coherent uniform image2D g_image;" NL "vec4 Load(iimage2D image) {" NL
5272 " return imageLoad(image, vec2(0));" NL "}" NL "void main() {" NL " vec4 o_color;" NL
5273 " o_color = Load(g_image);" NL "}"))
5281 const char* const csVer = "#version 310 es" NL "layout(local_size_x = 1) in;";
5302 const char* const fsVer = "#version 310 es" NL "precision highp float;";
5335 if (!Link(NL "layout(location = 0) in vec4 i_position;" NL
5336 "layout(rgba32f) writeonly uniform highp image3D g_image;" NL "void main() {" NL
5337 " imageStore(g_image, ivec3(gl_VertexID), vec4(0));" NL " gl_Position = i_position;" NL "}",
5339 NL "precision highp float;" NL "layout(location = 0) out vec4 o_color;" NL
5340 "layout(rgba32f) writeonly uniform highp image2D g_image;" NL "void main() {" NL
5341 " imageStore(g_image, ivec2(gl_FragCoord), vec4(1.0));" NL " o_color = vec4(1.0);" NL "}"))
5344 if (!Link(NL "layout(location = 0) in vec4 i_position;" NL
5345 "layout(rgba32f) writeonly uniform highp image2D g_image;" NL "void main() {" NL
5346 " imageStore(g_image, ivec2(gl_VertexID), vec4(0));" NL " gl_Position = i_position;" NL "}",
5348 NL "precision highp float;" NL "layout(location = 0) out vec4 o_color;" NL
5349 "layout(r32f) writeonly uniform highp image2D g_image;" NL "void main() {" NL
5350 " imageStore(g_image, ivec2(gl_FragCoord), vec4(1.0));" NL " o_color = vec4(1.0);" NL "}"))