Add support for extension GL_ARB_vertex_attrib_64bit (#2193)
authorpmistryNV <63069047+pmistryNV@users.noreply.github.com>
Wed, 29 Apr 2020 12:58:49 +0000 (05:58 -0700)
committerGitHub <noreply@github.com>
Wed, 29 Apr 2020 12:58:49 +0000 (06:58 -0600)
Test/150.vert
Test/baseResults/150.vert.out
glslang/MachineIndependent/ParseHelper.cpp
glslang/MachineIndependent/Scan.cpp
glslang/MachineIndependent/Versions.cpp
glslang/MachineIndependent/Versions.h

index 4dd9e5c..f9a920c 100644 (file)
@@ -25,5 +25,21 @@ uniform foob {
 };\r
 int a[5]; // ERROR, resizing user-block member\r
 \r
+in double dvarerr; // Error since extension GL_ARB_vertex_attrib_64bit is not enabled\r
+#extension GL_ARB_vertex_attrib_64bit: enable\r
+in double dvar;\r
+in dvec2  dv2var;\r
+in dvec3  dv3var;\r
+in dvec4  dv4var;\r
+in dmat2  dmat2var;\r
+in dmat3  dmat3var;\r
+in dmat4  dmat4var;\r
+in dmat2x3 dmat23var;\r
+in dmat2x4 dmat24var;\r
+in dmat3x2 dmat32var;\r
+in dmat3x4 dmat34var;\r
+in dmat4x2 dmat42var;\r
+in dmat4x3 dmat43var;\r
+\r
 #line 3000\r
 #error line of this error should be 3001\r
index 504160d..05a1db9 100644 (file)
@@ -1,10 +1,14 @@
 150.vert
 ERROR: 0:26: 'a' : cannot redeclare a user-block member array 
+ERROR: 0:28: 'double' : Reserved word. 
+ERROR: 0:28: 'double' : not supported for this version or the enabled extensions 
+ERROR: 0:28: 'vertex-shader `double` type input' : not supported for this version or the enabled extensions 
 ERROR: 0:3001: '#error' : line of this error should be 3001  
-ERROR: 2 compilation errors.  No code generated.
+ERROR: 5 compilation errors.  No code generated.
 
 
 Shader version: 150
+Requested GL_ARB_vertex_attrib_64bit
 ERROR: node is still EOpNull!
 0:13  Function Definition: main( ( global void)
 0:13    Function Parameters: 
@@ -43,6 +47,20 @@ ERROR: node is still EOpNull!
 0:?     'iv4' ( in 4-component vector of float)
 0:?     'ps' ( uniform float)
 0:?     'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform unsized 1-element array of int a})
+0:?     'dvarerr' ( in double)
+0:?     'dvar' ( in double)
+0:?     'dv2var' ( in 2-component vector of double)
+0:?     'dv3var' ( in 3-component vector of double)
+0:?     'dv4var' ( in 4-component vector of double)
+0:?     'dmat2var' ( in 2X2 matrix of double)
+0:?     'dmat3var' ( in 3X3 matrix of double)
+0:?     'dmat4var' ( in 4X4 matrix of double)
+0:?     'dmat23var' ( in 2X3 matrix of double)
+0:?     'dmat24var' ( in 2X4 matrix of double)
+0:?     'dmat32var' ( in 3X2 matrix of double)
+0:?     'dmat34var' ( in 3X4 matrix of double)
+0:?     'dmat42var' ( in 4X2 matrix of double)
+0:?     'dmat43var' ( in 4X3 matrix of double)
 0:?     'gl_VertexID' ( gl_VertexId int VertexId)
 0:?     'gl_InstanceID' ( gl_InstanceId int InstanceId)
 
@@ -52,6 +70,7 @@ Linked vertex stage:
 ERROR: Linking vertex stage: Can only use one of gl_ClipDistance or gl_ClipVertex (gl_ClipDistance is preferred)
 
 Shader version: 150
+Requested GL_ARB_vertex_attrib_64bit
 ERROR: node is still EOpNull!
 0:13  Function Definition: main( ( global void)
 0:13    Function Parameters: 
@@ -90,6 +109,20 @@ ERROR: node is still EOpNull!
 0:?     'iv4' ( in 4-component vector of float)
 0:?     'ps' ( uniform float)
 0:?     'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform 1-element array of int a})
+0:?     'dvarerr' ( in double)
+0:?     'dvar' ( in double)
+0:?     'dv2var' ( in 2-component vector of double)
+0:?     'dv3var' ( in 3-component vector of double)
+0:?     'dv4var' ( in 4-component vector of double)
+0:?     'dmat2var' ( in 2X2 matrix of double)
+0:?     'dmat3var' ( in 3X3 matrix of double)
+0:?     'dmat4var' ( in 4X4 matrix of double)
+0:?     'dmat23var' ( in 2X3 matrix of double)
+0:?     'dmat24var' ( in 2X4 matrix of double)
+0:?     'dmat32var' ( in 3X2 matrix of double)
+0:?     'dmat34var' ( in 3X4 matrix of double)
+0:?     'dmat42var' ( in 4X2 matrix of double)
+0:?     'dmat43var' ( in 4X3 matrix of double)
 0:?     'gl_VertexID' ( gl_VertexId int VertexId)
 0:?     'gl_InstanceID' ( gl_InstanceId int InstanceId)
 
index d3c9269..31b09f0 100644 (file)
@@ -3354,6 +3354,11 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
         !qualifier.hasBufferReference())
         error(loc, "buffers can be declared only as blocks", "buffer", "");
 
+    if (qualifier.storage != EvqVaryingIn && publicType.basicType == EbtDouble &&
+        extensionTurnedOn(E_GL_ARB_vertex_attrib_64bit) && language == EShLangVertex &&
+        version < 400) {
+        profileRequires(loc, ECoreProfile | ECompatibilityProfile, 410, E_GL_ARB_gpu_shader_fp64, "vertex-shader `double` type");
+    }
     if (qualifier.storage != EvqVaryingIn && qualifier.storage != EvqVaryingOut)
         return;
 
@@ -3404,7 +3409,7 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
                 profileRequires(loc, ENoProfile, 150, nullptr, "vertex input arrays");
             }
             if (publicType.basicType == EbtDouble)
-                profileRequires(loc, ~EEsProfile, 410, nullptr, "vertex-shader `double` type input");
+                profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_vertex_attrib_64bit, "vertex-shader `double` type input");
             if (qualifier.isAuxiliary() || qualifier.isInterpolation() || qualifier.isMemory() || qualifier.invariant)
                 error(loc, "vertex input cannot be further qualified", "", "");
             break;
index a2f1546..bd3181a 100644 (file)
@@ -1196,8 +1196,8 @@ int TScanContext::tokenizeIdentifier()
         afterType = true;
         if (parseContext.isEsProfile() || parseContext.version < 150 ||
             (!parseContext.symbolTable.atBuiltInLevel() &&
-              parseContext.version < 400 &&
-             !parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_fp64)))
+              (parseContext.version < 400 && !parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_fp64) &&
+              (parseContext.version < 410 && !parseContext.extensionTurnedOn(E_GL_ARB_vertex_attrib_64bit)))))
             reservedWord();
         return keyword;
 
@@ -1774,7 +1774,9 @@ int TScanContext::dMat()
 
     if (!parseContext.isEsProfile() && (parseContext.version >= 400 ||
         parseContext.symbolTable.atBuiltInLevel() ||
-        (parseContext.version >= 150 && parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_fp64))))
+        (parseContext.version >= 150 && parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_fp64)) ||
+        (parseContext.version >= 150 && parseContext.extensionTurnedOn(E_GL_ARB_vertex_attrib_64bit)
+         && parseContext.language == EShLangVertex)))
         return keyword;
 
     if (parseContext.isForwardCompatible())
index f98f2b6..cdcba3b 100644 (file)
@@ -202,6 +202,7 @@ void TParseVersions::initializeExtensionBehavior()
     extensionBehavior[E_GL_ARB_shader_storage_buffer_object] = EBhDisable;
     extensionBehavior[E_GL_ARB_shading_language_packing]     = EBhDisable;
     extensionBehavior[E_GL_ARB_texture_query_lod]            = EBhDisable;
+    extensionBehavior[E_GL_ARB_vertex_attrib_64bit]          = EBhDisable;
 
     extensionBehavior[E_GL_KHR_shader_subgroup_basic]            = EBhDisable;
     extensionBehavior[E_GL_KHR_shader_subgroup_vote]             = EBhDisable;
@@ -419,6 +420,7 @@ void TParseVersions::getPreamble(std::string& preamble)
             "#define GL_ARB_shader_bit_encoding 1\n"
             "#define GL_ARB_shader_storage_buffer_object 1\n"
             "#define GL_ARB_texture_query_lod 1\n"
+            "#define GL_ARB_vertex_attrib_64bit 1\n"
             "#define GL_EXT_shader_non_constant_global_initializers 1\n"
             "#define GL_EXT_shader_image_load_formatted 1\n"
             "#define GL_EXT_post_depth_coverage 1\n"
@@ -946,8 +948,13 @@ void TParseVersions::fullIntegerCheck(const TSourceLoc& loc, const char* op)
 // Call for any operation needing GLSL double data-type support.
 void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op)
 {
+
     //requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
-    profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader_fp64, op);
+    if (language == EShLangVertex) {
+        const char* const f64_Extensions[] = {E_GL_ARB_gpu_shader_fp64, E_GL_ARB_vertex_attrib_64bit};
+        profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, 2, f64_Extensions, op);
+    } else
+        profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader_fp64, op);
 }
 
 // Call for any operation needing GLSL float16 data-type support.
index 98a88e1..f5ea06f 100644 (file)
@@ -157,6 +157,7 @@ const char* const E_GL_ARB_shader_image_size            = "GL_ARB_shader_image_s
 const char* const E_GL_ARB_shader_storage_buffer_object = "GL_ARB_shader_storage_buffer_object";
 const char* const E_GL_ARB_shading_language_packing     = "GL_ARB_shading_language_packing";
 const char* const E_GL_ARB_texture_query_lod            = "GL_ARB_texture_query_lod";
+const char* const E_GL_ARB_vertex_attrib_64bit          = "GL_ARB_vertex_attrib_64bit";
 
 const char* const E_GL_KHR_shader_subgroup_basic            = "GL_KHR_shader_subgroup_basic";
 const char* const E_GL_KHR_shader_subgroup_vote             = "GL_KHR_shader_subgroup_vote";