gl_shader_decompiler: Fix geometry shader outputs for Intel drivers

On Intel's proprietary drivers, gl_Layer and gl_ViewportIndex are not allowed members of gl_PerVertex block, causing the shader to fail to compile. Fix this by declaring these variables outside of gl_PerVertex.
This commit is contained in:
Morph 2020-06-01 13:34:18 -04:00
parent e68ee43a1a
commit 70188d69b0
1 changed files with 15 additions and 13 deletions

View File

@ -618,19 +618,6 @@ private:
break; break;
} }
} }
if (stage != ShaderType::Vertex || device.HasVertexViewportLayer()) {
if (ir.UsesLayer()) {
code.AddLine("int gl_Layer;");
}
if (ir.UsesViewportIndex()) {
code.AddLine("int gl_ViewportIndex;");
}
} else if ((ir.UsesLayer() || ir.UsesViewportIndex()) && stage == ShaderType::Vertex &&
!device.HasVertexViewportLayer()) {
LOG_ERROR(
Render_OpenGL,
"GL_ARB_shader_viewport_layer_array is not available and its required by a shader");
}
if (ir.UsesPointSize()) { if (ir.UsesPointSize()) {
code.AddLine("float gl_PointSize;"); code.AddLine("float gl_PointSize;");
@ -647,6 +634,21 @@ private:
--code.scope; --code.scope;
code.AddLine("}};"); code.AddLine("}};");
code.AddNewLine(); code.AddNewLine();
if (stage != ShaderType::Vertex || device.HasVertexViewportLayer()) {
if (ir.UsesLayer()) {
code.AddLine("out int gl_Layer;");
}
if (ir.UsesViewportIndex()) {
code.AddLine("out int gl_ViewportIndex;");
}
} else if ((ir.UsesLayer() || ir.UsesViewportIndex()) && stage == ShaderType::Vertex &&
!device.HasVertexViewportLayer()) {
LOG_ERROR(
Render_OpenGL,
"GL_ARB_shader_viewport_layer_array is not available and its required by a shader");
}
code.AddNewLine();
} }
void DeclareRegisters() { void DeclareRegisters() {