yum-mirror/glslang

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

janharaldfredriksen-armGL_KHR_compute_shader_derivatives bugfixes118ac898

main
773 B31 linesraw
1#version 450
2#extension GL_EXT_mesh_shader : enable
3#extension GL_NV_compute_shader_derivatives : require
4
5layout(local_size_x = 4) in;
6layout(derivative_group_linearNV) in;
7
8layout(max_vertices = 3) out;
9layout(max_primitives = 1) out;
10layout(triangles) out;
11
12layout(binding = 0) uniform sampler2D tex;
13layout(binding = 1, std430) buffer Output {
14    vec2 lod;
15} outData;
16
17void main()
18{
19    uint iid = gl_LocalInvocationIndex;
20    float localDx = dFdx(float(iid));
21    vec2 localLod = textureQueryLod(tex, vec2(0.5f));
22
23    if (iid == 0u) {
24        SetMeshOutputsEXT(3u, 1u);
25        outData.lod = localLod;
26        gl_PrimitiveTriangleIndicesEXT[0] = uvec3(0u, 1u, 2u);
27    }
28
29    if (iid < 3u)
30        gl_MeshVerticesEXT[iid].gl_Position = vec4(localDx + localLod.x);
31}