mirror of
https://github.com/KhronosGroup/SPIRV-Cross.git
synced 2024-11-12 15:10:30 +00:00
GLSL: Force block declaration if clip/cull is used in tesc.
This commit is contained in:
parent
014b3bc5ea
commit
3776d8978c
@ -2,9 +2,14 @@ static const float _23[1] = { 0.0f };
|
||||
static const float _24[1] = { 0.0f };
|
||||
|
||||
static float4 gl_Position = 0.0f.xxxx;
|
||||
static float gl_PointSize = 0.0f;
|
||||
static float gl_ClipDistance[1] = _23;
|
||||
static float gl_CullDistance[1] = _24;
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 gl_Position : SV_Position;
|
||||
float gl_ClipDistance0 : SV_ClipDistance0;
|
||||
float gl_CullDistance0 : SV_CullDistance0;
|
||||
};
|
||||
|
||||
void vert_main()
|
||||
@ -17,5 +22,7 @@ SPIRV_Cross_Output main()
|
||||
vert_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.gl_Position = gl_Position;
|
||||
stage_output.gl_ClipDistance0.x = gl_ClipDistance[0];
|
||||
stage_output.gl_CullDistance0.x = gl_CullDistance[0];
|
||||
return stage_output;
|
||||
}
|
||||
|
@ -1,6 +1,14 @@
|
||||
#version 450
|
||||
layout(vertices = 4) out;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
float gl_PointSize;
|
||||
float gl_ClipDistance[1];
|
||||
float gl_CullDistance[1];
|
||||
} gl_out[4];
|
||||
|
||||
layout(location = 0) patch out vert
|
||||
{
|
||||
float v0;
|
||||
@ -23,6 +31,8 @@ layout(location = 8) out vert2
|
||||
|
||||
const vec4 _3_0_init[4] = vec4[](vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0));
|
||||
const float _3_1_init[4] = float[](0.0, 0.0, 0.0, 0.0);
|
||||
const float _3_2_init[4][1] = float[][](float[](0.0), float[](0.0), float[](0.0), float[](0.0));
|
||||
const float _3_3_init[4][1] = float[][](float[](0.0), float[](0.0), float[](0.0), float[](0.0));
|
||||
const float _6_0_init[2] = float[](0.0, 0.0);
|
||||
const float _6_1_init[2] = float[](0.0, 0.0);
|
||||
const float _7_init = 0.0;
|
||||
@ -34,6 +44,8 @@ void main()
|
||||
{
|
||||
gl_out[gl_InvocationID].gl_Position = _3_0_init[gl_InvocationID];
|
||||
gl_out[gl_InvocationID].gl_PointSize = _3_1_init[gl_InvocationID];
|
||||
gl_out[gl_InvocationID].gl_ClipDistance = _3_2_init[gl_InvocationID];
|
||||
gl_out[gl_InvocationID].gl_CullDistance = _3_3_init[gl_InvocationID];
|
||||
if (gl_InvocationID == 0)
|
||||
{
|
||||
_5.v0 = 0.0;
|
||||
|
@ -1,9 +1,14 @@
|
||||
#version 450
|
||||
|
||||
out float gl_ClipDistance[1];
|
||||
out float gl_CullDistance[1];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(0.0);
|
||||
gl_PointSize = 0.0;
|
||||
gl_ClipDistance = float[](0.0);
|
||||
gl_CullDistance = float[](0.0);
|
||||
gl_Position = vec4(1.0);
|
||||
}
|
||||
|
||||
|
@ -2801,6 +2801,13 @@ bool CompilerGLSL::should_force_emit_builtin_block(StorageClass storage)
|
||||
}
|
||||
});
|
||||
|
||||
// If we're declaring clip/cull planes with control points we need to force block declaration.
|
||||
if (get_execution_model() == ExecutionModelTessellationControl &&
|
||||
(clip_distance_count || cull_distance_count))
|
||||
{
|
||||
should_force = true;
|
||||
}
|
||||
|
||||
return should_force;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user