GLSL: Fix #1330: default outputs for GL_NV_geometry_shader_passthrough

This commit is contained in:
John Kessenich 2018-04-10 22:01:19 -06:00
parent 9de57c815b
commit e891afacf4
2 changed files with 21 additions and 1 deletions

View File

@ -11,7 +11,7 @@ spv.GeometryShaderPassthrough.geom
EntryPoint Geometry 4 "main" 10 14 EntryPoint Geometry 4 "main" 10 14
ExecutionMode 4 Triangles ExecutionMode 4 Triangles
ExecutionMode 4 Invocations 1 ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputVertices ExecutionMode 4 OutputVertices 3
Source GLSL 450 Source GLSL 450
SourceExtension "GL_NV_geometry_shader_passthrough" SourceExtension "GL_NV_geometry_shader_passthrough"
Name 4 "main" Name 4 "main"

View File

@ -3977,6 +3977,26 @@ void TParseContext::finish()
default: default:
break; break;
} }
// Set default outputs for GL_NV_geometry_shader_passthrough
if (language == EShLangGeometry && extensionTurnedOn(E_SPV_NV_geometry_shader_passthrough)) {
if (intermediate.getOutputPrimitive() == ElgNone) {
switch (intermediate.getInputPrimitive()) {
case ElgPoints: intermediate.setOutputPrimitive(ElgPoints); break;
case ElgLines: intermediate.setOutputPrimitive(ElgLineStrip); break;
case ElgTriangles: intermediate.setOutputPrimitive(ElgTriangles); break;
default: break;
}
}
if (intermediate.getVertices() == TQualifier::layoutNotSet) {
switch (intermediate.getInputPrimitive()) {
case ElgPoints: intermediate.setVertices(1); break;
case ElgLines: intermediate.setVertices(2); break;
case ElgTriangles: intermediate.setVertices(3); break;
default: break;
}
}
}
} }
// //