Merge pull request #967 from dsrbecky/multiview

Multiview extension: Accept layout(num_views) qualifier
This commit is contained in:
John Kessenich 2017-07-03 22:14:09 -06:00 committed by GitHub
commit eb5f12d1ca
5 changed files with 34 additions and 10 deletions

View File

@ -186,6 +186,8 @@ void fooDeeparray()
yp = x; // ERROR, wrong size
}
layout(num_views = 2) in; // ERROR, no extension
void mwErr()
{
gl_ViewID_OVR; // ERROR, no extension
@ -193,6 +195,9 @@ void mwErr()
#extension GL_OVR_multiview : enable
layout(num_views = 2) uniform float mwUniform; // ERROR, must be global
layout(num_views = 2) in; // OK
void mwOk()
{
gl_ViewID_OVR;

View File

@ -43,10 +43,14 @@ ERROR: 0:172: 'std430' : requires the 'buffer' storage qualifier
ERROR: 0:175: '' : array size required
ERROR: 0:185: 'assign' : cannot convert from ' temp 4-element array of highp float' to ' temp 3-element array of highp float'
ERROR: 0:186: 'assign' : cannot convert from ' temp 3-element array of highp float' to ' temp 4-element array of highp float'
ERROR: 0:191: 'gl_ViewID_OVR' : required extension not requested: Possible extensions include:
ERROR: 0:189: 'num_views' : required extension not requested: Possible extensions include:
GL_OVR_multiview
GL_OVR_multiview2
ERROR: 45 compilation errors. No code generated.
ERROR: 0:193: 'gl_ViewID_OVR' : required extension not requested: Possible extensions include:
GL_OVR_multiview
GL_OVR_multiview2
ERROR: 0:198: 'num_views' : can only apply to a standalone qualifier
ERROR: 47 compilation errors. No code generated.
Shader version: 300
@ -293,14 +297,14 @@ ERROR: node is still EOpNull!
0:184 'y' ( temp 4-element array of highp float)
0:185 'xp' ( temp 3-element array of highp float)
0:186 'yp' ( temp 4-element array of highp float)
0:189 Function Definition: mwErr( ( global void)
0:189 Function Parameters:
0:191 Sequence
0:191 'gl_ViewID_OVR' ( in highp uint ViewIndex)
0:196 Function Definition: mwOk( ( global void)
0:196 Function Parameters:
0:198 Sequence
0:198 'gl_ViewID_OVR' ( in highp uint ViewIndex)
0:191 Function Definition: mwErr( ( global void)
0:191 Function Parameters:
0:193 Sequence
0:193 'gl_ViewID_OVR' ( in highp uint ViewIndex)
0:201 Function Definition: mwOk( ( global void)
0:201 Function Parameters:
0:203 Sequence
0:203 'gl_ViewID_OVR' ( in highp uint ViewIndex)
0:? Linker Objects
0:? 'm43' ( uniform highp 4X3 matrix of float)
0:? 'm33' ( uniform highp 3X3 matrix of float)
@ -335,6 +339,7 @@ ERROR: node is still EOpNull!
0:? 'Binst' (layout( column_major shared) uniform block{layout( column_major shared) uniform highp int a})
0:? 'Bfoo' ( global highp int)
0:? 'B430i' (layout( column_major std430) uniform block{layout( column_major std430 offset=0) uniform highp int a})
0:? 'mwUniform' ( uniform highp float)
0:? 'gl_VertexID' ( gl_VertexId highp int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId highp int InstanceId)
@ -494,6 +499,7 @@ ERROR: node is still EOpNull!
0:? 'Binst' (layout( column_major shared) uniform block{layout( column_major shared) uniform highp int a})
0:? 'Bfoo' ( global highp int)
0:? 'B430i' (layout( column_major std430) uniform block{layout( column_major std430 offset=0) uniform highp int a})
0:? 'mwUniform' ( uniform highp float)
0:? 'gl_VertexID' ( gl_VertexId highp int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId highp int InstanceId)

View File

@ -2,6 +2,8 @@
#extension GL_OVR_multiview : enable
layout(num_views = 2) in;
void main() {
gl_Position = vec4(gl_ViewID_OVR, 0, 0, 0);
}

View File

@ -970,6 +970,7 @@ struct TShaderQualifiers {
bool earlyFragmentTests; // fragment input
TLayoutDepth layoutDepth;
bool blendEquation; // true if any blend equation was specified
int numViews; // multiview extenstions
#ifdef NV_EXTENSIONS
bool layoutOverrideCoverage; // true if layout override_coverage set
@ -994,6 +995,7 @@ struct TShaderQualifiers {
earlyFragmentTests = false;
layoutDepth = EldNone;
blendEquation = false;
numViews = TQualifier::layoutNotSet;
#ifdef NV_EXTENSIONS
layoutOverrideCoverage = false;
#endif
@ -1033,6 +1035,8 @@ struct TShaderQualifiers {
layoutDepth = src.layoutDepth;
if (src.blendEquation)
blendEquation = src.blendEquation;
if (src.numViews != TQualifier::layoutNotSet)
numViews = src.numViews;
#ifdef NV_EXTENSIONS
if (src.layoutOverrideCoverage)
layoutOverrideCoverage = src.layoutOverrideCoverage;

View File

@ -4206,6 +4206,11 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
}
return;
}
if (id == "num_views") {
requireExtensions(loc, Num_OVR_multiview_EXTs, OVR_multiview_EXTs, "num_views");
publicType.shaderQualifiers.numViews = value;
return;
}
#if NV_EXTENSIONS
if (language == EShLangVertex ||
@ -4804,6 +4809,8 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua
}
if (shaderQualifiers.blendEquation)
error(loc, message, "blend equation", "");
if (shaderQualifiers.numViews != TQualifier::layoutNotSet)
error(loc, message, "num_views", "");
}
// Correct and/or advance an object's offset layout qualifier.