qt5base-lts/tests/manual/rhi/displacement/material.tesc
Ben Fletcher d50f2fc1cc rhi: displacement / tessellation manual test Metal memory alignment
This test was created with a work around for a Metal tessellation
pipeline memory alignment issue.  The workaround was to specify shader
stage in / out variable uv as vec3 rather than vec2.  A recent patch to
correct Metal tessellation pipeline memory alignment has now allowed
this test to use vec2 for variable uv as originally intended.

Change-Id: I6772c0e824e1e4b7e749dafa218f3fd8eba0e541
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-03-10 12:21:56 -08:00

33 lines
773 B
GLSL

#version 440
layout(vertices = 3) out;
layout(location = 0) in vec2 in_uv[];
layout(location = 1) in vec3 in_normal[];
layout(location = 0) out vec2 out_uv[];
layout(location = 1) out vec3 out_normal[];
layout(std140, binding = 0) uniform buf {
mat4 mvp;
float displacementAmount;
float tessInner;
float tessOuter;
int useTex;
};
void main()
{
if (gl_InvocationID == 0) {
gl_TessLevelOuter[0] = tessOuter;
gl_TessLevelOuter[1] = tessOuter;
gl_TessLevelOuter[2] = tessOuter;
gl_TessLevelInner[0] = tessInner;
}
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
out_uv[gl_InvocationID] = in_uv[gl_InvocationID];
out_normal[gl_InvocationID] = in_normal[gl_InvocationID];
}