From f4460c27a4d19ffb34017b92389420adad44d051 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 7 Nov 2021 11:21:35 +0200 Subject: [PATCH] Disallow bool variables in shader interface blocks Although OpenGL allows them in uniform blocks, SPIR-V says they can't be used with externally visible storage classes. --- source/glsl/validate.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/glsl/validate.cpp b/source/glsl/validate.cpp index 0c4b98cb..ec322f42 100644 --- a/source/glsl/validate.cpp +++ b/source/glsl/validate.cpp @@ -254,8 +254,13 @@ void DeclarationValidator::visit(VariableDeclaration &var) } else if(kind==BasicTypeDeclaration::VOID) error(var, "Type 'void' not allowed on variable"); - else if(kind==BasicTypeDeclaration::BOOL && !var.interface.empty() && var.source!=BUILTIN_SOURCE) - error(var, "Type 'bool' not allowed on interface variable"); + else if(kind==BasicTypeDeclaration::BOOL && var.source!=BUILTIN_SOURCE) + { + if(scope==INTERFACE_BLOCK) + error(var, "Type 'bool' not allowed in an interface block"); + else if(!var.interface.empty()) + error(var, "Type 'bool' not allowed on interface variable"); + } if(var.init_expression) { -- 2.43.0