qt5base-lts/tests/manual/rhi/displacement/material.tesc
Laszlo Agocs 870a3011ed rhi: Add a displacement / tessellation manual test
There is something odd when running on Metal: note how the uv
is vec3 instead of vec2, in order to make the vertex-tesc-tese
data to look like this:

struct main0_out
{
    float3 out_uv;
    float3 out_normal;
    float4 gl_Position;
};

if out_uv was float2 we'd get some strange rendering results,
perhaps due to something related to alignment. But have no means
to investigate this further.

Change-Id: I79d4edb2ddde3971c599c4326d98e99a49aa7122
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-02-14 17:48:09 +01:00

33 lines
773 B
GLSL

#version 440
layout(vertices = 3) out;
layout(location = 0) in vec3 in_uv[];
layout(location = 1) in vec3 in_normal[];
layout(location = 0) out vec3 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];
}