From 80cb324ff603009761917672f463e26b32890b9e Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sun, 5 Jun 2016 18:52:05 -0600 Subject: [PATCH] Front-end: Fix issue #146: which versions allow double in/out. --- Test/400.vert | 9 ++++++++ Test/410.vert | 9 ++++++++ Test/baseResults/400.vert.out | 34 ++++++++++++++++++++++++++++++ Test/baseResults/410.vert.out | 29 +++++++++++++++++++++++++ glslang/MachineIndependent/ParseHelper.cpp | 4 ++++ gtests/AST.FromFile.cpp | 2 ++ 6 files changed, 87 insertions(+) create mode 100644 Test/400.vert create mode 100644 Test/410.vert create mode 100755 Test/baseResults/400.vert.out create mode 100755 Test/baseResults/410.vert.out diff --git a/Test/400.vert b/Test/400.vert new file mode 100644 index 0000000..2c3dd04 --- /dev/null +++ b/Test/400.vert @@ -0,0 +1,9 @@ +#version 400 core + +in double d; // ERROR, no doubles +in dvec3 d3; // ERROR, no doubles +in dmat4 dm4; // ERROR, no doubles + +void main() +{ +} diff --git a/Test/410.vert b/Test/410.vert new file mode 100644 index 0000000..0ecf476 --- /dev/null +++ b/Test/410.vert @@ -0,0 +1,9 @@ +#version 410 core + +in double d; +in dvec3 d3; +in dmat4 dm4; + +void main() +{ +} diff --git a/Test/baseResults/400.vert.out b/Test/baseResults/400.vert.out new file mode 100755 index 0000000..946f21d --- /dev/null +++ b/Test/baseResults/400.vert.out @@ -0,0 +1,34 @@ +400.vert +Warning, version 400 is not yet complete; most version-specific features are present, but some are missing. +ERROR: 0:3: 'vertex-shader `double` type input' : not supported for this version or the enabled extensions +ERROR: 0:4: 'vertex-shader `double` type input' : not supported for this version or the enabled extensions +ERROR: 0:5: 'vertex-shader `double` type input' : not supported for this version or the enabled extensions +ERROR: 3 compilation errors. No code generated. + + +Shader version: 400 +ERROR: node is still EOpNull! +0:7 Function Definition: main( (global void) +0:7 Function Parameters: +0:? Linker Objects +0:? 'd' (in double) +0:? 'd3' (in 3-component vector of double) +0:? 'dm4' (in 4X4 matrix of double) +0:? 'gl_VertexID' (gl_VertexId int VertexId) +0:? 'gl_InstanceID' (gl_InstanceId int InstanceId) + + +Linked vertex stage: + + +Shader version: 400 +ERROR: node is still EOpNull! +0:7 Function Definition: main( (global void) +0:7 Function Parameters: +0:? Linker Objects +0:? 'd' (in double) +0:? 'd3' (in 3-component vector of double) +0:? 'dm4' (in 4X4 matrix of double) +0:? 'gl_VertexID' (gl_VertexId int VertexId) +0:? 'gl_InstanceID' (gl_InstanceId int InstanceId) + diff --git a/Test/baseResults/410.vert.out b/Test/baseResults/410.vert.out new file mode 100755 index 0000000..eb4f43a --- /dev/null +++ b/Test/baseResults/410.vert.out @@ -0,0 +1,29 @@ +410.vert +Warning, version 410 is not yet complete; most version-specific features are present, but some are missing. + +Shader version: 410 +0:? Sequence +0:7 Function Definition: main( (global void) +0:7 Function Parameters: +0:? Linker Objects +0:? 'd' (in double) +0:? 'd3' (in 3-component vector of double) +0:? 'dm4' (in 4X4 matrix of double) +0:? 'gl_VertexID' (gl_VertexId int VertexId) +0:? 'gl_InstanceID' (gl_InstanceId int InstanceId) + + +Linked vertex stage: + + +Shader version: 410 +0:? Sequence +0:7 Function Definition: main( (global void) +0:7 Function Parameters: +0:? Linker Objects +0:? 'd' (in double) +0:? 'd3' (in 3-component vector of double) +0:? 'dm4' (in 4X4 matrix of double) +0:? 'gl_VertexID' (gl_VertexId int VertexId) +0:? 'gl_InstanceID' (gl_InstanceId int InstanceId) + diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 959d690..eb9100b 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -2661,6 +2661,8 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali requireProfile(loc, ~EEsProfile, "vertex input arrays"); profileRequires(loc, ENoProfile, 150, nullptr, "vertex input arrays"); } + if (publicType.basicType == EbtDouble) + profileRequires(loc, ~EEsProfile, 410, nullptr, "vertex-shader `double` type input"); if (qualifier.isAuxiliary() || qualifier.isInterpolation() || qualifier.isMemory() || qualifier.invariant) error(loc, "vertex input cannot be further qualified", "", ""); break; @@ -2735,6 +2737,8 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali error(loc, "can't use auxiliary qualifier on a fragment output", "centroid/sample/patch", ""); if (qualifier.isInterpolation()) error(loc, "can't use interpolation qualifier on a fragment output", "flat/smooth/noperspective", ""); + if (publicType.basicType == EbtDouble) + error(loc, "cannot contain a double", GetStorageQualifierString(qualifier.storage), ""); break; case EShLangCompute: diff --git a/gtests/AST.FromFile.cpp b/gtests/AST.FromFile.cpp index 08ec919..38d6d0a 100644 --- a/gtests/AST.FromFile.cpp +++ b/gtests/AST.FromFile.cpp @@ -113,6 +113,8 @@ INSTANTIATE_TEST_CASE_P( "110scope.vert", "300scope.vert", "400.frag", + "400.vert", + "410.vert", "420.comp", "420.frag", "420.vert", -- 2.7.4