yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeUnify stdlib `Texture` types into one generic type. (#3327)4c78efd0c

master
1.3 KiB48 linesraw
1//TEST_IGNORE_FILE:
2#version 450
3layout(row_major) uniform;
4layout(row_major) buffer;
5#extension GL_EXT_shader_16bit_storage : require
6#extension GL_EXT_shader_explicit_arithmetic_types : require
7
8layout(r16f)
9layout(binding = 1)
10uniform image2D halfTexture_0;
11
12layout(rg16f)
13layout(binding = 2)
14uniform image2D halfTexture2_0;
15
16layout(rgba16f)
17layout(binding = 3)
18uniform image2D halfTexture4_0;
19
20layout(std430, binding = 0) buffer StructuredBuffer_int_t_0 {
21    int _data[];
22} outputBuffer_0;
23
24layout(local_size_x = 4, local_size_y = 4, local_size_z = 1) in;
25void main()
26{
27    ivec2 pos_0 = ivec2(gl_GlobalInvocationID.xy);
28
29    int _S1 = pos_0.y;
30
31    int _S2 = pos_0.x;
32
33    ivec2 _S3 = ivec2(uvec2(ivec2(3 - _S1, 3 - _S2)));
34
35    float16_t _S4 = (float16_t(imageLoad((halfTexture_0), (_S3)).x));
36    f16vec2 _S5 = (f16vec2(imageLoad((halfTexture2_0), (_S3)).xy));
37    f16vec4 _S6 = (f16vec4(imageLoad((halfTexture4_0), (_S3))));
38
39    ivec2 _S7 = ivec2(uvec2(pos_0));
40
41    imageStore((halfTexture_0), (_S7), f16vec4(_S5.x + _S5.y, float16_t(0), float16_t(0), float16_t(0)));
42    imageStore((halfTexture2_0), (_S7), f16vec4(_S6.xy, float16_t(0), float16_t(0)));
43    imageStore((halfTexture4_0), (_S7), f16vec4(_S5, _S4, _S4));
44
45    int index_0 = _S2 + _S1 * 4;
46    outputBuffer_0._data[uint(index_0)] = index_0;
47    return;
48}