From 5f629276a7a5f302bb3db460f63fc7afd094ad79 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Sun, 5 Jun 2016 20:13:45 +0200 Subject: [PATCH] Use Boolean instead of Bool. Xlib.h header uses a very ugly define for Bool which conflicts with SPIRV-Cross. The hassle free solution is to use Boolean instead. --- spirv_common.hpp | 2 +- spirv_cross.cpp | 4 ++-- spirv_glsl.cpp | 16 ++++++++-------- spirv_msl.cpp | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/spirv_common.hpp b/spirv_common.hpp index 7de8aa18..f81b5a4a 100644 --- a/spirv_common.hpp +++ b/spirv_common.hpp @@ -160,7 +160,7 @@ struct SPIRType : IVariant { Unknown, Void, - Bool, + Boolean, Char, Int, UInt, diff --git a/spirv_cross.cpp b/spirv_cross.cpp index 522c5e61..5a320cb4 100644 --- a/spirv_cross.cpp +++ b/spirv_cross.cpp @@ -1016,7 +1016,7 @@ void Compiler::parse(const Instruction &instruction) { uint32_t id = ops[0]; auto &type = set(id); - type.basetype = SPIRType::Bool; + type.basetype = SPIRType::Boolean; type.width = 1; break; } @@ -1786,7 +1786,7 @@ size_t Compiler::get_declared_struct_member_size(const SPIRType &struct_type, ui { case SPIRType::Unknown: case SPIRType::Void: - case SPIRType::Bool: // Bools are purely logical, and cannot be used for externally visible types. + case SPIRType::Boolean: // Bools are purely logical, and cannot be used for externally visible types. case SPIRType::AtomicCounter: case SPIRType::Image: case SPIRType::SampledImage: diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp index e31ea0b6..9df30ed9 100644 --- a/spirv_glsl.cpp +++ b/spirv_glsl.cpp @@ -1283,7 +1283,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t } break; - case SPIRType::Bool: + case SPIRType::Boolean: if (splat) res += c.scalar(vector, 0) ? "true" : "false"; else @@ -1421,7 +1421,7 @@ void CompilerGLSL::emit_binary_op_cast(uint32_t result_type, uint32_t result_id, // Special case boolean outputs since relational opcodes output booleans instead of int/uint. bool extra_parens = true; string expr; - if (out_type.basetype != input_type && out_type.basetype != SPIRType::Bool) + if (out_type.basetype != input_type && out_type.basetype != SPIRType::Boolean) { expected_type.basetype = input_type; expr = bitcast_glsl_op(out_type, expected_type); @@ -1459,7 +1459,7 @@ void CompilerGLSL::emit_binary_func_op_cast(uint32_t result_type, uint32_t resul // Special case boolean outputs since relational opcodes output booleans instead of int/uint. string expr; - if (out_type.basetype != input_type && out_type.basetype != SPIRType::Bool) + if (out_type.basetype != input_type && out_type.basetype != SPIRType::Boolean) { expected_type.basetype = input_type; expr = bitcast_glsl_op(out_type, expected_type); @@ -1540,7 +1540,7 @@ void CompilerGLSL::emit_mix_op(uint32_t result_type, uint32_t id, uint32_t left, // Boolean mix not supported on desktop without extension. // Was added in OpenGL 4.5 with ES 3.1 compat. - if (!has_boolean_mix && lerptype.basetype == SPIRType::Bool) + if (!has_boolean_mix && lerptype.basetype == SPIRType::Boolean) { // Could use GL_EXT_shader_integer_mix on desktop at least, // but Apple doesn't support it. :( @@ -3982,7 +3982,7 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type) { switch (type.basetype) { - case SPIRType::Bool: + case SPIRType::Boolean: return "bool"; case SPIRType::Int: return backend.basic_int_type; @@ -4000,7 +4000,7 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type) { switch (type.basetype) { - case SPIRType::Bool: + case SPIRType::Boolean: return join("bvec", type.vecsize); case SPIRType::Int: return join("ivec", type.vecsize); @@ -4016,7 +4016,7 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type) { switch (type.basetype) { - case SPIRType::Bool: + case SPIRType::Boolean: return join("bmat", type.vecsize); case SPIRType::Int: return join("imat", type.vecsize); @@ -4032,7 +4032,7 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type) { switch (type.basetype) { - case SPIRType::Bool: + case SPIRType::Boolean: return join("bmat", type.columns, "x", type.vecsize); case SPIRType::Int: return join("imat", type.columns, "x", type.vecsize); diff --git a/spirv_msl.cpp b/spirv_msl.cpp index e1dc474a..04ff7393 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -1287,7 +1287,7 @@ string CompilerMSL::type_to_glsl(const SPIRType &type) { switch (type.basetype) { - case SPIRType::Bool: + case SPIRType::Boolean: return "bool"; case SPIRType::Char: return "char"; @@ -1307,7 +1307,7 @@ string CompilerMSL::type_to_glsl(const SPIRType &type) { switch (type.basetype) { - case SPIRType::Bool: + case SPIRType::Boolean: return join("bool", type.vecsize); case SPIRType::Char: return join("char", type.vecsize); @@ -1326,7 +1326,7 @@ string CompilerMSL::type_to_glsl(const SPIRType &type) { switch (type.basetype) { - case SPIRType::Bool: + case SPIRType::Boolean: case SPIRType::Int: case SPIRType::UInt: case SPIRType::Float: