mirror of
https://github.com/KhronosGroup/glslang
synced 2024-09-19 12:19:53 +00:00
Merge pull request #964 from dsrbecky/multiview
Implement extensions GL_OVR_multiview and GL_OVR_multiview2
This commit is contained in:
commit
994660208c
@ -184,4 +184,16 @@ void fooDeeparray()
|
||||
yp = y;
|
||||
xp = y; // ERROR, wrong size
|
||||
yp = x; // ERROR, wrong size
|
||||
}
|
||||
|
||||
void mwErr()
|
||||
{
|
||||
gl_ViewID_OVR; // ERROR, no extension
|
||||
}
|
||||
|
||||
#extension GL_OVR_multiview : enable
|
||||
|
||||
void mwOk()
|
||||
{
|
||||
gl_ViewID_OVR;
|
||||
}
|
||||
|
@ -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: 44 compilation errors. No code generated.
|
||||
ERROR: 0:191: 'gl_ViewID_OVR' : required extension not requested: Possible extensions include:
|
||||
GL_OVR_multiview
|
||||
GL_OVR_multiview2
|
||||
ERROR: 45 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 300
|
||||
Requested GL_OVR_multiview
|
||||
ERROR: node is still EOpNull!
|
||||
0:27 Function Definition: main( ( global void)
|
||||
0:27 Function Parameters:
|
||||
@ -289,6 +293,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:? Linker Objects
|
||||
0:? 'm43' ( uniform highp 4X3 matrix of float)
|
||||
0:? 'm33' ( uniform highp 3X3 matrix of float)
|
||||
@ -331,6 +343,7 @@ Linked vertex stage:
|
||||
|
||||
|
||||
Shader version: 300
|
||||
Requested GL_OVR_multiview
|
||||
ERROR: node is still EOpNull!
|
||||
0:27 Function Definition: main( ( global void)
|
||||
0:27 Function Parameters:
|
||||
|
57
Test/baseResults/spv.OVR_multiview.vert.out
Normal file
57
Test/baseResults/spv.OVR_multiview.vert.out
Normal file
@ -0,0 +1,57 @@
|
||||
spv.OVR_multiview.vert
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 27
|
||||
|
||||
Capability Shader
|
||||
Capability MultiView
|
||||
Extension "SPV_KHR_multiview"
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 4 "main" 13 17 25 26
|
||||
Source GLSL 330
|
||||
SourceExtension "GL_OVR_multiview"
|
||||
Name 4 "main"
|
||||
Name 11 "gl_PerVertex"
|
||||
MemberName 11(gl_PerVertex) 0 "gl_Position"
|
||||
MemberName 11(gl_PerVertex) 1 "gl_PointSize"
|
||||
MemberName 11(gl_PerVertex) 2 "gl_ClipDistance"
|
||||
Name 13 ""
|
||||
Name 17 "gl_ViewID_OVR"
|
||||
Name 25 "gl_VertexID"
|
||||
Name 26 "gl_InstanceID"
|
||||
MemberDecorate 11(gl_PerVertex) 0 BuiltIn Position
|
||||
MemberDecorate 11(gl_PerVertex) 1 BuiltIn PointSize
|
||||
MemberDecorate 11(gl_PerVertex) 2 BuiltIn ClipDistance
|
||||
Decorate 11(gl_PerVertex) Block
|
||||
Decorate 17(gl_ViewID_OVR) BuiltIn ViewIndex
|
||||
Decorate 25(gl_VertexID) BuiltIn VertexId
|
||||
Decorate 26(gl_InstanceID) BuiltIn InstanceId
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypeInt 32 0
|
||||
9: 8(int) Constant 1
|
||||
10: TypeArray 6(float) 9
|
||||
11(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 10
|
||||
12: TypePointer Output 11(gl_PerVertex)
|
||||
13: 12(ptr) Variable Output
|
||||
14: TypeInt 32 1
|
||||
15: 14(int) Constant 0
|
||||
16: TypePointer Input 8(int)
|
||||
17(gl_ViewID_OVR): 16(ptr) Variable Input
|
||||
20: 6(float) Constant 0
|
||||
22: TypePointer Output 7(fvec4)
|
||||
24: TypePointer Input 14(int)
|
||||
25(gl_VertexID): 24(ptr) Variable Input
|
||||
26(gl_InstanceID): 24(ptr) Variable Input
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
18: 8(int) Load 17(gl_ViewID_OVR)
|
||||
19: 6(float) ConvertUToF 18
|
||||
21: 7(fvec4) CompositeConstruct 19 20 20 20
|
||||
23: 22(ptr) AccessChain 13 15
|
||||
Store 23 21
|
||||
Return
|
||||
FunctionEnd
|
@ -11,7 +11,7 @@ spv.specConstant.vert
|
||||
Source GLSL 400
|
||||
Name 4 "main"
|
||||
Name 9 "arraySize"
|
||||
Name 14 "foo(vf4[s1521];"
|
||||
Name 14 "foo(vf4[s1522];"
|
||||
Name 13 "p"
|
||||
Name 17 "builtin_spec_constant("
|
||||
Name 20 "color"
|
||||
@ -102,10 +102,10 @@ spv.specConstant.vert
|
||||
Store 20(color) 46
|
||||
48: 10 Load 22(ucol)
|
||||
Store 47(param) 48
|
||||
49: 2 FunctionCall 14(foo(vf4[s1521];) 47(param)
|
||||
49: 2 FunctionCall 14(foo(vf4[s1522];) 47(param)
|
||||
Return
|
||||
FunctionEnd
|
||||
14(foo(vf4[s1521];): 2 Function None 12
|
||||
14(foo(vf4[s1522];): 2 Function None 12
|
||||
13(p): 11(ptr) FunctionParameter
|
||||
15: Label
|
||||
54: 24(ptr) AccessChain 53(dupUcol) 23
|
||||
|
7
Test/spv.OVR_multiview.vert
Normal file
7
Test/spv.OVR_multiview.vert
Normal file
@ -0,0 +1,7 @@
|
||||
#version 330
|
||||
|
||||
#extension GL_OVR_multiview : enable
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(gl_ViewID_OVR, 0, 0, 0);
|
||||
}
|
@ -3457,6 +3457,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"\n");
|
||||
}
|
||||
|
||||
if (version >= 300 /* both ES and non-ES */) {
|
||||
stageBuiltins[EShLangVertex].append(
|
||||
"in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview2
|
||||
"\n");
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
@ -3905,6 +3911,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"\n");
|
||||
}
|
||||
|
||||
if (version >= 300 /* both ES and non-ES */) {
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"flat in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview2
|
||||
"\n");
|
||||
}
|
||||
|
||||
// printf("%s\n", commonBuiltins.c_str());
|
||||
// printf("%s\n", stageBuiltins[EShLangFragment].c_str());
|
||||
}
|
||||
@ -5331,6 +5343,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable);
|
||||
}
|
||||
|
||||
if (version >= 300 /* both ES and non-ES */) {
|
||||
symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs);
|
||||
BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable);
|
||||
}
|
||||
|
||||
if (profile == EEsProfile) {
|
||||
symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);
|
||||
symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers);
|
||||
@ -5678,6 +5695,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
|
||||
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
|
||||
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
|
||||
if (version >= 300 /* both ES and non-ES */) {
|
||||
symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs);
|
||||
BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable);
|
||||
}
|
||||
|
||||
if (profile == EEsProfile) {
|
||||
symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);
|
||||
|
@ -239,6 +239,10 @@ void TParseVersions::initializeExtensionBehavior()
|
||||
// EXT extensions
|
||||
extensionBehavior[E_GL_EXT_device_group] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_multiview] = EBhDisable;
|
||||
|
||||
// OVR extensions
|
||||
extensionBehavior[E_GL_OVR_multiview] = EBhDisable;
|
||||
extensionBehavior[E_GL_OVR_multiview2] = EBhDisable;
|
||||
}
|
||||
|
||||
// Get code that is not part of a shared symbol table, is specific to this shader,
|
||||
@ -343,12 +347,19 @@ void TParseVersions::getPreamble(std::string& preamble)
|
||||
|
||||
if ((profile != EEsProfile && version >= 140) ||
|
||||
(profile == EEsProfile && version >= 310)) {
|
||||
preamble +=
|
||||
preamble +=
|
||||
"#define GL_EXT_device_group 1\n"
|
||||
"#define GL_EXT_multiview 1\n"
|
||||
;
|
||||
}
|
||||
|
||||
if (version >= 300 /* both ES and non-ES */) {
|
||||
preamble +=
|
||||
"#define GL_OVR_multiview 1\n"
|
||||
"#define GL_OVR_multiview2 1\n"
|
||||
;
|
||||
}
|
||||
|
||||
// #line and #include
|
||||
preamble +=
|
||||
"#define GL_GOOGLE_cpp_style_line_directive 1\n"
|
||||
|
@ -143,6 +143,13 @@ const char* const E_GL_EXT_shader_image_load_formatted = "GL_EXT_shader_image_lo
|
||||
const char* const E_GL_EXT_device_group = "GL_EXT_device_group";
|
||||
const char* const E_GL_EXT_multiview = "GL_EXT_multiview";
|
||||
|
||||
// OVR extensions
|
||||
const char* const E_GL_OVR_multiview = "GL_OVR_multiview";
|
||||
const char* const E_GL_OVR_multiview2 = "GL_OVR_multiview2";
|
||||
|
||||
const char* const OVR_multiview_EXTs[] = { E_GL_OVR_multiview, E_GL_OVR_multiview2 };
|
||||
const int Num_OVR_multiview_EXTs = sizeof(OVR_multiview_EXTs) / sizeof(OVR_multiview_EXTs[0]);
|
||||
|
||||
// #line and #include
|
||||
const char* const E_GL_GOOGLE_cpp_style_line_directive = "GL_GOOGLE_cpp_style_line_directive";
|
||||
const char* const E_GL_GOOGLE_include_directive = "GL_GOOGLE_include_directive";
|
||||
|
@ -333,7 +333,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
{ "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
|
||||
{ "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },
|
||||
{ "spv.rw.autoassign.frag", "main", 5, 10, 20, 15, 30, true, true },
|
||||
{ "spv.register.autoassign.rangetest.frag", "main",
|
||||
{ "spv.register.autoassign.rangetest.frag", "main",
|
||||
glslang::TQualifier::layoutBindingEnd-2,
|
||||
glslang::TQualifier::layoutBindingEnd+5,
|
||||
20, 30, true, false },
|
||||
@ -358,6 +358,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
"spv.atomic.comp",
|
||||
"spv.glFragColor.frag",
|
||||
"spv.specConst.vert",
|
||||
"spv.OVR_multiview.vert",
|
||||
})),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user