From e7f9caeac4ba65c6e64c50ca3647e9e31923f3db Mon Sep 17 00:00:00 2001 From: John Kessenich <cepheus@frii.com> Date: Thu, 12 Jul 2018 15:11:07 -0600 Subject: [PATCH] Errors and Build: Fix build warnings, which also improved error messages. --- StandAlone/StandAlone.cpp | 13 +- Test/baseResults/120.frag.out | 2 +- .../spv.16bitstorage_Error-int.frag.out | 40 ++--- .../spv.16bitstorage_Error-uint.frag.out | 40 ++--- .../spv.16bitstorage_Error.frag.out | 44 +++--- .../spv.8bitstorage_Error-int.frag.out | 40 ++--- .../spv.8bitstorage_Error-uint.frag.out | 40 ++--- glslang/MachineIndependent/ParseHelper.cpp | 149 +++++++----------- glslang/MachineIndependent/Versions.cpp | 47 ++++-- glslang/MachineIndependent/iomapper.cpp | 3 + glslang/MachineIndependent/parseVersions.h | 6 +- 11 files changed, 208 insertions(+), 216 deletions(-) mode change 100644 => 100755 glslang/MachineIndependent/iomapper.cpp diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index 549cb0dd9..a159bc840 100755 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -737,17 +737,18 @@ void CompileShaders(glslang::TWorklist& worklist) glslang::TWorkItem* workItem; if (Options & EOptionStdin) { - worklist.remove(workItem); - ShHandle compiler = ShConstructCompiler(FindLanguage("stdin"), Options); - if (compiler == 0) - return; + if (worklist.remove(workItem)) { + ShHandle compiler = ShConstructCompiler(FindLanguage("stdin"), Options); + if (compiler == nullptr) + return; - CompileFile("stdin", compiler); + CompileFile("stdin", compiler); if (! (Options & EOptionSuppressInfolog)) workItem->results = ShGetInfoLog(compiler); - ShDestruct(compiler); + ShDestruct(compiler); + } } else { while (worklist.remove(workItem)) { ShHandle compiler = ShConstructCompiler(FindLanguage(workItem->name), Options); diff --git a/Test/baseResults/120.frag.out b/Test/baseResults/120.frag.out index 025cb68aa..8909f16f4 100644 --- a/Test/baseResults/120.frag.out +++ b/Test/baseResults/120.frag.out @@ -52,7 +52,7 @@ ERROR: 0:209: 'assign' : cannot convert from ' const float' to ' temp 4-compone ERROR: 0:212: 'sampler2DRect' : Reserved word. ERROR: 0:244: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' global void' and a right operand of type ' const int' (or there is no acceptable conversion) ERROR: 0:245: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' const int' and a right operand of type ' global void' (or there is no acceptable conversion) -ERROR: 0:248: 'explicit types' : required extension not requested: Possible extensions include: +ERROR: 0:248: 'half floating-point suffix' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 diff --git a/Test/baseResults/spv.16bitstorage_Error-int.frag.out b/Test/baseResults/spv.16bitstorage_Error-int.frag.out index 697df3e55..40552583f 100755 --- a/Test/baseResults/spv.16bitstorage_Error-int.frag.out +++ b/Test/baseResults/spv.16bitstorage_Error-int.frag.out @@ -1,85 +1,85 @@ spv.16bitstorage_Error-int.frag -ERROR: 0:54: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:54: 'structure: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:58: 'can't use with structs containing int16' : required extension not requested: Possible extensions include: +ERROR: 0:58: 'return: can't use with structs containing int16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:61: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:61: 'int16_t: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:74: ''[' does not operate on types containing (u)int16' : required extension not requested: Possible extensions include: +ERROR: 0:74: '[: does not operate on types containing (u)int16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:75: 'can't swizzle types containing (u)int16' : required extension not requested: Possible extensions include: +ERROR: 0:75: '.: can't swizzle types containing (u)int16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:76: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:76: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:76: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:77: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:77: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:77: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:77: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 ERROR: 0:78: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform int16_t' and a right operand of type 'layout( column_major std140 offset=0) uniform int16_t' (or there is no acceptable conversion) ERROR: 0:79: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( column_major std140 offset=0) uniform int16_t (or there is no acceptable conversion) ERROR: 0:80: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform int16_t' and a right operand of type ' const int' (or there is no acceptable conversion) -ERROR: 0:81: 'can't swizzle types containing (u)int16' : required extension not requested: Possible extensions include: +ERROR: 0:81: '.: can't swizzle types containing (u)int16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:82: 'can't use with structs containing int16' : required extension not requested: Possible extensions include: +ERROR: 0:82: '=: can't use with structs containing int16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:83: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:83: 'qualifier: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:84: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:84: 'qualifier: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:85: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:85: 'qualifier: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 ERROR: 0:86: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform int16_t' and a right operand of type 'layout( column_major std140 offset=0) uniform int16_t' (or there is no acceptable conversion) -ERROR: 0:87: 'can't use with arrays containing int16' : required extension not requested: Possible extensions include: +ERROR: 0:87: '=: can't use with arrays containing int16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:88: '16-bit vector constructors only take vector types' : required extension not requested: Possible extensions include: +ERROR: 0:88: 'constructor: 16-bit vectors only take vector types' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:89: '16-bit array constructors not supported' : required extension not requested: Possible extensions include: +ERROR: 0:89: 'constructor: 16-bit arrays not supported' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:89: '16-bit vector constructors only take vector types' : required extension not requested: Possible extensions include: +ERROR: 0:89: 'constructor: 16-bit vectors only take vector types' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:92: 'Can't construct structure containing 16-bit type' : required extension not requested: Possible extensions include: +ERROR: 0:92: 'constructor: can't construct structure containing 16-bit type' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 diff --git a/Test/baseResults/spv.16bitstorage_Error-uint.frag.out b/Test/baseResults/spv.16bitstorage_Error-uint.frag.out index 786c4d289..bff46d444 100755 --- a/Test/baseResults/spv.16bitstorage_Error-uint.frag.out +++ b/Test/baseResults/spv.16bitstorage_Error-uint.frag.out @@ -1,85 +1,85 @@ spv.16bitstorage_Error-uint.frag -ERROR: 0:54: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:54: 'structure: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:58: 'can't use with structs containing uint16' : required extension not requested: Possible extensions include: +ERROR: 0:58: 'return: can't use with structs containing uint16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:61: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:61: 'uint16_t: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:74: ''[' does not operate on types containing (u)int16' : required extension not requested: Possible extensions include: +ERROR: 0:74: '[: does not operate on types containing (u)int16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:75: 'can't swizzle types containing (u)int16' : required extension not requested: Possible extensions include: +ERROR: 0:75: '.: can't swizzle types containing (u)int16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:76: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:76: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:76: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:77: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:77: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:77: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:77: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 ERROR: 0:78: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform uint16_t' and a right operand of type 'layout( column_major std140 offset=0) uniform uint16_t' (or there is no acceptable conversion) ERROR: 0:79: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( column_major std140 offset=0) uniform uint16_t (or there is no acceptable conversion) ERROR: 0:80: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform uint16_t' and a right operand of type ' const int' (or there is no acceptable conversion) -ERROR: 0:81: 'can't swizzle types containing (u)int16' : required extension not requested: Possible extensions include: +ERROR: 0:81: '.: can't swizzle types containing (u)int16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:82: 'can't use with structs containing uint16' : required extension not requested: Possible extensions include: +ERROR: 0:82: '=: can't use with structs containing uint16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:83: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:83: 'qualifier: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:84: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:84: 'qualifier: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:85: '(u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:85: 'qualifier: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 ERROR: 0:86: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform uint16_t' and a right operand of type 'layout( column_major std140 offset=0) uniform uint16_t' (or there is no acceptable conversion) -ERROR: 0:87: 'can't use with arrays containing uint16' : required extension not requested: Possible extensions include: +ERROR: 0:87: '=: can't use with arrays containing uint16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:88: '16-bit vector constructors only take vector types' : required extension not requested: Possible extensions include: +ERROR: 0:88: 'constructor: 16-bit vectors only take vector types' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:89: '16-bit array constructors not supported' : required extension not requested: Possible extensions include: +ERROR: 0:89: 'constructor: 16-bit arrays not supported' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:89: '16-bit vector constructors only take vector types' : required extension not requested: Possible extensions include: +ERROR: 0:89: 'constructor: 16-bit vectors only take vector types' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 -ERROR: 0:92: 'Can't construct structure containing 16-bit type' : required extension not requested: Possible extensions include: +ERROR: 0:92: 'constructor: can't construct structure containing 16-bit type' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_int16 GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int16 diff --git a/Test/baseResults/spv.16bitstorage_Error.frag.out b/Test/baseResults/spv.16bitstorage_Error.frag.out index 6de8566cd..08c75e73b 100755 --- a/Test/baseResults/spv.16bitstorage_Error.frag.out +++ b/Test/baseResults/spv.16bitstorage_Error.frag.out @@ -1,93 +1,93 @@ spv.16bitstorage_Error.frag -ERROR: 0:54: 'float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:54: 'structure: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:58: 'can't use with structs containing float16' : required extension not requested: Possible extensions include: +ERROR: 0:58: 'return: can't use with structs containing float16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:61: 'float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:61: 'float16_t: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:74: ''[' does not operate on types containing float16' : required extension not requested: Possible extensions include: +ERROR: 0:74: '[: does not operate on types containing float16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:75: 'can't swizzle types containing float16' : required extension not requested: Possible extensions include: +ERROR: 0:75: '.: can't swizzle types containing float16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:76: 'float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:76: 'float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:76: 'float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:77: 'float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:77: 'built-in function: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:77: 'float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:77: 'built-in function: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 ERROR: 0:78: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform float16_t' and a right operand of type 'layout( column_major std140 offset=0) uniform float16_t' (or there is no acceptable conversion) ERROR: 0:79: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( column_major std140 offset=0) uniform float16_t (or there is no acceptable conversion) ERROR: 0:80: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform float16_t' and a right operand of type ' const float' (or there is no acceptable conversion) -ERROR: 0:81: 'can't swizzle types containing float16' : required extension not requested: Possible extensions include: +ERROR: 0:81: '.: can't swizzle types containing float16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:82: 'can't use with structs containing float16' : required extension not requested: Possible extensions include: +ERROR: 0:82: '=: can't use with structs containing float16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:83: 'float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:83: 'qualifier: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:84: 'float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:84: 'qualifier: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:85: 'float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:85: 'qualifier: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 ERROR: 0:86: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform float16_t' and a right operand of type 'layout( column_major std140 offset=0) uniform float16_t' (or there is no acceptable conversion) -ERROR: 0:87: 'can't use with arrays containing float16' : required extension not requested: Possible extensions include: +ERROR: 0:87: '=: can't use with arrays containing float16' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:88: 'explicit types' : required extension not requested: Possible extensions include: +ERROR: 0:88: 'half floating-point suffix' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:88: 'explicit types' : required extension not requested: Possible extensions include: +ERROR: 0:88: 'half float literal' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:89: '16-bit vector constructors only take vector types' : required extension not requested: Possible extensions include: +ERROR: 0:89: 'constructor: 16-bit vectors only take vector types' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:90: '16-bit array constructors not supported' : required extension not requested: Possible extensions include: +ERROR: 0:90: 'constructor: 16-bit arrays not supported' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:90: '16-bit vector constructors only take vector types' : required extension not requested: Possible extensions include: +ERROR: 0:90: 'constructor: 16-bit vectors only take vector types' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 -ERROR: 0:93: 'Can't construct structure containing 16-bit type' : required extension not requested: Possible extensions include: +ERROR: 0:93: 'constructor: can't construct structure containing 16-bit type' : required extension not requested: Possible extensions include: GL_AMD_gpu_shader_half_float GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_float16 diff --git a/Test/baseResults/spv.8bitstorage_Error-int.frag.out b/Test/baseResults/spv.8bitstorage_Error-int.frag.out index 14104abd0..0562111ba 100755 --- a/Test/baseResults/spv.8bitstorage_Error-int.frag.out +++ b/Test/baseResults/spv.8bitstorage_Error-int.frag.out @@ -1,66 +1,66 @@ spv.8bitstorage_Error-int.frag -ERROR: 0:54: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:54: 'structure: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:58: 'can't use with structs containing int8' : required extension not requested: Possible extensions include: +ERROR: 0:58: 'return: can't use with structs containing int8' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:61: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:61: 'int8_t: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:74: ''[' does not operate on types containing (u)int8' : required extension not requested: Possible extensions include: +ERROR: 0:74: '[: does not operate on types containing (u)int8' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:75: 'can't swizzle types containing (u)int8' : required extension not requested: Possible extensions include: +ERROR: 0:75: '.: can't swizzle types containing (u)int8' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:76: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:76: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:76: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:77: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:77: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:77: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:77: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 ERROR: 0:78: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform int8_t' and a right operand of type 'layout( column_major std140 offset=0) uniform int8_t' (or there is no acceptable conversion) ERROR: 0:79: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( column_major std140 offset=0) uniform int8_t (or there is no acceptable conversion) ERROR: 0:80: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform int8_t' and a right operand of type ' const int' (or there is no acceptable conversion) -ERROR: 0:81: 'can't swizzle types containing (u)int8' : required extension not requested: Possible extensions include: +ERROR: 0:81: '.: can't swizzle types containing (u)int8' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:82: 'can't use with structs containing int8' : required extension not requested: Possible extensions include: +ERROR: 0:82: '=: can't use with structs containing int8' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:83: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:83: 'qualifier: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:84: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:84: 'qualifier: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:85: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:85: 'qualifier: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 ERROR: 0:86: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform int8_t' and a right operand of type 'layout( column_major std140 offset=0) uniform int8_t' (or there is no acceptable conversion) -ERROR: 0:87: 'can't use with arrays containing int8' : required extension not requested: Possible extensions include: +ERROR: 0:87: '=: can't use with arrays containing int8' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:88: '8-bit vector constructors only take vector types' : required extension not requested: Possible extensions include: +ERROR: 0:88: 'constructor: 8-bit vectors only take vector types' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:89: '8-bit array constructors not supported' : required extension not requested: Possible extensions include: +ERROR: 0:89: 'constructor: 8-bit arrays not supported' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:89: '8-bit vector constructors only take vector types' : required extension not requested: Possible extensions include: +ERROR: 0:89: 'constructor: 8-bit vectors only take vector types' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:92: 'Can't construct structure containing 8-bit type' : required extension not requested: Possible extensions include: +ERROR: 0:92: 'constructor: can't construct structure containing 8-bit type' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 ERROR: 0:93: 'func2' : no matching overloaded function found diff --git a/Test/baseResults/spv.8bitstorage_Error-uint.frag.out b/Test/baseResults/spv.8bitstorage_Error-uint.frag.out index f8a9d90a6..93070f2ae 100755 --- a/Test/baseResults/spv.8bitstorage_Error-uint.frag.out +++ b/Test/baseResults/spv.8bitstorage_Error-uint.frag.out @@ -1,66 +1,66 @@ spv.8bitstorage_Error-uint.frag -ERROR: 0:54: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:54: 'structure: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:58: 'can't use with structs containing uint8' : required extension not requested: Possible extensions include: +ERROR: 0:58: 'return: can't use with structs containing uint8' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:61: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:61: 'uint8_t: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:74: ''[' does not operate on types containing (u)int8' : required extension not requested: Possible extensions include: +ERROR: 0:74: '[: does not operate on types containing (u)int8' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:75: 'can't swizzle types containing (u)int8' : required extension not requested: Possible extensions include: +ERROR: 0:75: '.: can't swizzle types containing (u)int8' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:76: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:76: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:76: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:76: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:77: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:77: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:77: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:77: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 ERROR: 0:78: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform uint8_t' and a right operand of type 'layout( column_major std140 offset=0) uniform uint8_t' (or there is no acceptable conversion) ERROR: 0:79: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( column_major std140 offset=0) uniform uint8_t (or there is no acceptable conversion) ERROR: 0:80: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform uint8_t' and a right operand of type ' const int' (or there is no acceptable conversion) -ERROR: 0:81: 'can't swizzle types containing (u)int8' : required extension not requested: Possible extensions include: +ERROR: 0:81: '.: can't swizzle types containing (u)int8' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:82: 'can't use with structs containing uint8' : required extension not requested: Possible extensions include: +ERROR: 0:82: '=: can't use with structs containing uint8' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:83: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:83: 'qualifier: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:84: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:84: 'qualifier: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:85: '(u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +ERROR: 0:85: 'qualifier: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 ERROR: 0:86: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform uint8_t' and a right operand of type 'layout( column_major std140 offset=0) uniform uint8_t' (or there is no acceptable conversion) -ERROR: 0:87: 'can't use with arrays containing uint8' : required extension not requested: Possible extensions include: +ERROR: 0:87: '=: can't use with arrays containing uint8' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:88: '8-bit vector constructors only take vector types' : required extension not requested: Possible extensions include: +ERROR: 0:88: 'constructor: 8-bit vectors only take vector types' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:89: '8-bit array constructors not supported' : required extension not requested: Possible extensions include: +ERROR: 0:89: 'constructor: 8-bit arrays not supported' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:89: '8-bit vector constructors only take vector types' : required extension not requested: Possible extensions include: +ERROR: 0:89: 'constructor: 8-bit vectors only take vector types' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 -ERROR: 0:92: 'Can't construct structure containing 8-bit type' : required extension not requested: Possible extensions include: +ERROR: 0:92: 'constructor: can't construct structure containing 8-bit type' : required extension not requested: Possible extensions include: GL_KHX_shader_explicit_arithmetic_types GL_KHX_shader_explicit_arithmetic_types_int8 ERROR: 0:93: 'func2' : no matching overloaded function found diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 926cb4904..94af16700 100755 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -372,15 +372,12 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn } if (!base->isArray() && base->isVector()) { - if (base->getType().containsBasicType(EbtFloat16)) { - requireFloat16Arithmetic(loc, "'[' does not operate on types containing float16"); - } - if (base->getType().contains16BitInt()) { - requireInt16Arithmetic(loc, "'[' does not operate on types containing (u)int16"); - } - if (base->getType().contains8BitInt()) { - requireInt8Arithmetic(loc, "'[' does not operate on types containing (u)int8"); - } + if (base->getType().containsBasicType(EbtFloat16)) + requireFloat16Arithmetic(loc, "[", "does not operate on types containing float16"); + if (base->getType().contains16BitInt()) + requireInt16Arithmetic(loc, "[", "does not operate on types containing (u)int16"); + if (base->getType().contains8BitInt()) + requireInt8Arithmetic(loc, "[", "does not operate on types containing (u)int8"); } // check for constant folding @@ -721,15 +718,12 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm TSwizzleSelectors<TVectorSelector> selectors; parseSwizzleSelector(loc, field, base->getVectorSize(), selectors); - if (base->isVector() && selectors.size() != 1 && base->getType().containsBasicType(EbtFloat16)) { - requireFloat16Arithmetic(loc, "can't swizzle types containing float16"); - } - if (base->isVector() && selectors.size() != 1 && base->getType().contains16BitInt()) { - requireInt16Arithmetic(loc, "can't swizzle types containing (u)int16"); - } - if (base->isVector() && selectors.size() != 1 && base->getType().contains8BitInt()) { - requireInt8Arithmetic(loc, "can't swizzle types containing (u)int8"); - } + if (base->isVector() && selectors.size() != 1 && base->getType().containsBasicType(EbtFloat16)) + requireFloat16Arithmetic(loc, ".", "can't swizzle types containing float16"); + if (base->isVector() && selectors.size() != 1 && base->getType().contains16BitInt()) + requireInt16Arithmetic(loc, ".", "can't swizzle types containing (u)int16"); + if (base->isVector() && selectors.size() != 1 && base->getType().contains8BitInt()) + requireInt8Arithmetic(loc, ".", "can't swizzle types containing (u)int8"); if (base->isScalar()) { if (selectors.size() == 1) @@ -1009,15 +1003,12 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction if (builtIn && fnCandidate->getNumExtensions()) requireExtensions(loc, fnCandidate->getNumExtensions(), fnCandidate->getExtensions(), fnCandidate->getName().c_str()); - if (builtIn && fnCandidate->getType().containsBasicType(EbtFloat16)) { - requireFloat16Arithmetic(loc, "float16 types can only be in uniform block or buffer storage"); - } - if (builtIn && fnCandidate->getType().contains16BitInt()) { - requireInt16Arithmetic(loc, "(u)int16 types can only be in uniform block or buffer storage"); - } - if (builtIn && fnCandidate->getType().contains8BitInt()) { - requireInt8Arithmetic(loc, "(u)int8 types can only be in uniform block or buffer storage"); - } + if (builtIn && fnCandidate->getType().containsBasicType(EbtFloat16)) + requireFloat16Arithmetic(loc, "built-in function", "float16 types can only be in uniform block or buffer storage"); + if (builtIn && fnCandidate->getType().contains16BitInt()) + requireInt16Arithmetic(loc, "built-in function", "(u)int16 types can only be in uniform block or buffer storage"); + if (builtIn && fnCandidate->getType().contains8BitInt()) + requireInt8Arithmetic(loc, "built-in function", "(u)int8 types can only be in uniform block or buffer storage"); if (arguments != nullptr) { // Make sure qualifications work for these arguments. @@ -1045,15 +1036,12 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction error(arguments->getLoc(), message, "writeonly", ""); } - if (builtIn && arg->getAsTyped()->getType().containsBasicType(EbtFloat16)) { - requireFloat16Arithmetic(arguments->getLoc(), "float16 types can only be in uniform block or buffer storage"); - } - if (builtIn && arg->getAsTyped()->getType().contains16BitInt()) { - requireInt16Arithmetic(arguments->getLoc(), "(u)int16 types can only be in uniform block or buffer storage"); - } - if (builtIn && arg->getAsTyped()->getType().contains8BitInt()) { - requireInt8Arithmetic(arguments->getLoc(), "(u)int8 types can only be in uniform block or buffer storage"); - } + if (builtIn && arg->getAsTyped()->getType().containsBasicType(EbtFloat16)) + requireFloat16Arithmetic(arguments->getLoc(), "built-in function", "float16 types can only be in uniform block or buffer storage"); + if (builtIn && arg->getAsTyped()->getType().contains16BitInt()) + requireInt16Arithmetic(arguments->getLoc(), "built-in function", "(u)int16 types can only be in uniform block or buffer storage"); + if (builtIn && arg->getAsTyped()->getType().contains8BitInt()) + requireInt8Arithmetic(arguments->getLoc(), "built-in function", "(u)int8 types can only be in uniform block or buffer storage"); // TODO 4.5 functionality: A shader will fail to compile // if the value passed to the memargument of an atomic memory function does not correspond to a buffer or @@ -2417,15 +2405,15 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T floatArgument = true; if (type.isStruct()) { if (function[arg].type->containsBasicType(EbtFloat16)) { - requireFloat16Arithmetic(loc, "Can't construct structure containing 16-bit type"); + requireFloat16Arithmetic(loc, "constructor", "can't construct structure containing 16-bit type"); } if (function[arg].type->containsBasicType(EbtUint16) || function[arg].type->containsBasicType(EbtInt16)) { - requireInt16Arithmetic(loc, "Can't construct structure containing 16-bit type"); + requireInt16Arithmetic(loc, "constructor", "can't construct structure containing 16-bit type"); } if (function[arg].type->containsBasicType(EbtUint8) || function[arg].type->containsBasicType(EbtInt8)) { - requireInt8Arithmetic(loc, "Can't construct structure containing 8-bit type"); + requireInt8Arithmetic(loc, "constructor", "can't construct structure containing 8-bit type"); } } } @@ -2435,13 +2423,10 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructF16Vec2: case EOpConstructF16Vec3: case EOpConstructF16Vec4: - if (type.isArray()) { - requireFloat16Arithmetic(loc, "16-bit array constructors not supported"); - } - - if (type.isVector() && function.getParamCount() != 1) { - requireFloat16Arithmetic(loc, "16-bit vector constructors only take vector types"); - } + if (type.isArray()) + requireFloat16Arithmetic(loc, "constructor", "16-bit arrays not supported"); + if (type.isVector() && function.getParamCount() != 1) + requireFloat16Arithmetic(loc, "constructor", "16-bit vectors only take vector types"); break; case EOpConstructUint16: case EOpConstructU16Vec2: @@ -2451,13 +2436,10 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructI16Vec2: case EOpConstructI16Vec3: case EOpConstructI16Vec4: - if (type.isArray()) { - requireInt16Arithmetic(loc, "16-bit array constructors not supported"); - } - - if (type.isVector() && function.getParamCount() != 1) { - requireInt16Arithmetic(loc, "16-bit vector constructors only take vector types"); - } + if (type.isArray()) + requireInt16Arithmetic(loc, "constructor", "16-bit arrays not supported"); + if (type.isVector() && function.getParamCount() != 1) + requireInt16Arithmetic(loc, "constructor", "16-bit vectors only take vector types"); break; case EOpConstructUint8: case EOpConstructU8Vec2: @@ -2467,13 +2449,10 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructI8Vec2: case EOpConstructI8Vec3: case EOpConstructI8Vec4: - if (type.isArray()) { - requireInt8Arithmetic(loc, "8-bit array constructors not supported"); - } - - if (type.isVector() && function.getParamCount() != 1) { - requireInt8Arithmetic(loc, "8-bit vector constructors only take vector types"); - } + if (type.isArray()) + requireInt8Arithmetic(loc, "constructor", "8-bit arrays not supported"); + if (type.isVector() && function.getParamCount() != 1) + requireInt8Arithmetic(loc, "constructor", "8-bit vectors only take vector types"); break; default: break; @@ -3162,15 +3141,12 @@ void TParseContext::parameterTypeCheck(const TSourceLoc& loc, TStorageQualifier if ((qualifier == EvqOut || qualifier == EvqInOut) && type.isOpaque()) error(loc, "samplers and atomic_uints cannot be output parameters", type.getBasicTypeString().c_str(), ""); - if (!parsingBuiltins && type.containsBasicType(EbtFloat16)) { - requireFloat16Arithmetic(loc, "float16 types can only be in uniform block or buffer storage"); - } - if (!parsingBuiltins && type.contains16BitInt()) { - requireInt16Arithmetic(loc, "(u)int16 types can only be in uniform block or buffer storage"); - } - if (!parsingBuiltins && type.contains8BitInt()) { - requireInt8Arithmetic(loc, "(u)int8 types can only be in uniform block or buffer storage"); - } + if (!parsingBuiltins && type.containsBasicType(EbtFloat16)) + requireFloat16Arithmetic(loc, type.getBasicTypeString().c_str(), "float16 types can only be in uniform block or buffer storage"); + if (!parsingBuiltins && type.contains16BitInt()) + requireInt16Arithmetic(loc, type.getBasicTypeString().c_str(), "(u)int16 types can only be in uniform block or buffer storage"); + if (!parsingBuiltins && type.contains8BitInt()) + requireInt8Arithmetic(loc, type.getBasicTypeString().c_str(), "(u)int8 types can only be in uniform block or buffer storage"); } bool TParseContext::containsFieldWithBasicType(const TType& type, TBasicType basicType) @@ -3948,34 +3924,34 @@ void TParseContext::opaqueCheck(const TSourceLoc& loc, const TType& type, const void TParseContext::storage16BitAssignmentCheck(const TSourceLoc& loc, const TType& type, const char* op) { if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtFloat16)) - requireFloat16Arithmetic(loc, "can't use with structs containing float16"); + requireFloat16Arithmetic(loc, op, "can't use with structs containing float16"); if (type.isArray() && type.getBasicType() == EbtFloat16) - requireFloat16Arithmetic(loc, "can't use with arrays containing float16"); + requireFloat16Arithmetic(loc, op, "can't use with arrays containing float16"); if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtInt16)) - requireInt16Arithmetic(loc, "can't use with structs containing int16"); + requireInt16Arithmetic(loc, op, "can't use with structs containing int16"); if (type.isArray() && type.getBasicType() == EbtInt16) - requireInt16Arithmetic(loc, "can't use with arrays containing int16"); + requireInt16Arithmetic(loc, op, "can't use with arrays containing int16"); if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtUint16)) - requireInt16Arithmetic(loc, "can't use with structs containing uint16"); + requireInt16Arithmetic(loc, op, "can't use with structs containing uint16"); if (type.isArray() && type.getBasicType() == EbtUint16) - requireInt16Arithmetic(loc, "can't use with arrays containing uint16"); + requireInt16Arithmetic(loc, op, "can't use with arrays containing uint16"); if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtInt8)) - requireInt8Arithmetic(loc, "can't use with structs containing int8"); + requireInt8Arithmetic(loc, op, "can't use with structs containing int8"); if (type.isArray() && type.getBasicType() == EbtInt8) - requireInt8Arithmetic(loc, "can't use with arrays containing int8"); + requireInt8Arithmetic(loc, op, "can't use with arrays containing int8"); if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtUint8)) - requireInt8Arithmetic(loc, "can't use with structs containing uint8"); + requireInt8Arithmetic(loc, op, "can't use with structs containing uint8"); if (type.isArray() && type.getBasicType() == EbtUint8) - requireInt8Arithmetic(loc, "can't use with arrays containing uint8"); + requireInt8Arithmetic(loc, op, "can't use with arrays containing uint8"); } void TParseContext::specializationCheck(const TSourceLoc& loc, const TType& type, const char* op) @@ -5582,15 +5558,12 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden transparentOpaqueCheck(loc, type, identifier); if (type.getQualifier().storage != EvqUniform && type.getQualifier().storage != EvqBuffer) { - if (type.containsBasicType(EbtFloat16)) { - requireFloat16Arithmetic(loc, "float16 types can only be in uniform block or buffer storage"); - } - if (type.contains16BitInt()) { - requireInt16Arithmetic(loc, "(u)int16 types can only be in uniform block or buffer storage"); - } - if (type.contains8BitInt()) { - requireInt8Arithmetic(loc, "(u)int8 types can only be in uniform block or buffer storage"); - } + if (type.containsBasicType(EbtFloat16)) + requireFloat16Arithmetic(loc, "qualifier", "float16 types can only be in uniform block or buffer storage"); + if (type.contains16BitInt()) + requireInt16Arithmetic(loc, "qualifier", "(u)int16 types can only be in uniform block or buffer storage"); + if (type.contains8BitInt()) + requireInt8Arithmetic(loc, "qualifier", "(u)int8 types can only be in uniform block or buffer storage"); } if (identifier != "gl_FragCoord" && (publicType.shaderQualifiers.originUpperLeft || publicType.shaderQualifiers.pixelCenterInteger)) diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index add65ef4a..00af4d436 100755 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -831,7 +831,7 @@ void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool bu #endif E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_float16}; - requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, "explicit types"); + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); } } @@ -865,34 +865,49 @@ bool TParseVersions::int8Arithmetic() return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions); } -void TParseVersions::requireFloat16Arithmetic(const TSourceLoc& loc, const char* featureDesc) +void TParseVersions::requireFloat16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { + TString combined; + combined = op; + combined += ": "; + combined += featureDesc; + const char* const extensions[] = { #if AMD_EXTENSIONS E_GL_AMD_gpu_shader_half_float, #endif E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_float16}; - requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, featureDesc); + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str()); } -void TParseVersions::requireInt16Arithmetic(const TSourceLoc& loc, const char* featureDesc) +void TParseVersions::requireInt16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { + TString combined; + combined = op; + combined += ": "; + combined += featureDesc; + const char* const extensions[] = { #if AMD_EXTENSIONS E_GL_AMD_gpu_shader_int16, #endif E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_int16}; - requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, featureDesc); + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str()); } -void TParseVersions::requireInt8Arithmetic(const TSourceLoc& loc, const char* featureDesc) +void TParseVersions::requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { + TString combined; + combined = op; + combined += ": "; + combined += featureDesc; + const char* const extensions[] = { E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_int8}; - requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, featureDesc); + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str()); } void TParseVersions::float16ScalarVectorCheck(const TSourceLoc& loc, const char* op, bool builtIn) @@ -905,7 +920,7 @@ void TParseVersions::float16ScalarVectorCheck(const TSourceLoc& loc, const char* E_GL_EXT_shader_16bit_storage, E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_float16}; - requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, "explicit types"); + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); } } @@ -915,7 +930,7 @@ void TParseVersions::explicitFloat32Check(const TSourceLoc& loc, const char* op, if (!builtIn) { const char* const extensions[2] = {E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_float32}; - requireExtensions(loc, 2, extensions, "explicit types"); + requireExtensions(loc, 2, extensions, op); } } @@ -925,7 +940,7 @@ void TParseVersions::explicitFloat64Check(const TSourceLoc& loc, const char* op, if (!builtIn) { const char* const extensions[2] = {E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_float64}; - requireExtensions(loc, 2, extensions, "explicit types"); + requireExtensions(loc, 2, extensions, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, nullptr, op); } @@ -937,7 +952,7 @@ void TParseVersions::explicitInt8Check(const TSourceLoc& loc, const char* op, bo if (! builtIn) { const char* const extensions[2] = {E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_int8}; - requireExtensions(loc, 2, extensions, "explicit types"); + requireExtensions(loc, 2, extensions, op); } } @@ -963,7 +978,7 @@ void TParseVersions::explicitInt16Check(const TSourceLoc& loc, const char* op, b #endif E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_int16}; - requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, "explicit types"); + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); } } @@ -977,7 +992,7 @@ void TParseVersions::int16ScalarVectorCheck(const TSourceLoc& loc, const char* o E_GL_EXT_shader_16bit_storage, E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_int16}; - requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, "explicit types"); + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); } } @@ -988,7 +1003,7 @@ void TParseVersions::int8ScalarVectorCheck(const TSourceLoc& loc, const char* op E_GL_EXT_shader_8bit_storage, E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_int8}; - requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, "explicit types"); + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); } } @@ -998,7 +1013,7 @@ void TParseVersions::explicitInt32Check(const TSourceLoc& loc, const char* op, b if (! builtIn) { const char* const extensions[2] = {E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_int32}; - requireExtensions(loc, 2, extensions, "explicit types"); + requireExtensions(loc, 2, extensions, op); } } @@ -1009,7 +1024,7 @@ void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool buil const char* const extensions[3] = {E_GL_ARB_gpu_shader_int64, E_GL_KHX_shader_explicit_arithmetic_types, E_GL_KHX_shader_explicit_arithmetic_types_int64}; - requireExtensions(loc, 3, extensions, "shader int64"); + requireExtensions(loc, 3, extensions, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, nullptr, op); } diff --git a/glslang/MachineIndependent/iomapper.cpp b/glslang/MachineIndependent/iomapper.cpp old mode 100644 new mode 100755 index 9ab9deaa3..9248214b6 --- a/glslang/MachineIndependent/iomapper.cpp +++ b/glslang/MachineIndependent/iomapper.cpp @@ -513,6 +513,9 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver void endResolve(EShLanguage) override {} protected: + TDefaultIoResolverBase(TDefaultIoResolverBase&); + TDefaultIoResolverBase& operator=(TDefaultIoResolverBase&); + const TIntermediate &intermediate; int nextUniformLocation; int nextInputLocation; diff --git a/glslang/MachineIndependent/parseVersions.h b/glslang/MachineIndependent/parseVersions.h index a96f73aa1..f5e19769c 100755 --- a/glslang/MachineIndependent/parseVersions.h +++ b/glslang/MachineIndependent/parseVersions.h @@ -81,13 +81,13 @@ public: virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void float16ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); virtual bool float16Arithmetic(); - virtual void requireFloat16Arithmetic(const TSourceLoc& loc, const char* featureDesc); + virtual void requireFloat16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc); virtual void int16ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); virtual bool int16Arithmetic(); - virtual void requireInt16Arithmetic(const TSourceLoc& loc, const char* featureDesc); + virtual void requireInt16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc); virtual void int8ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); virtual bool int8Arithmetic(); - virtual void requireInt8Arithmetic(const TSourceLoc& loc, const char* featureDesc); + virtual void requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc); #ifdef AMD_EXTENSIONS virtual void float16OpaqueCheck(const TSourceLoc&, const char* op, bool builtIn = false); #endif -- GitLab