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.
This commit is contained in:
Hans-Kristian Arntzen 2016-06-05 20:13:45 +02:00
parent 81a8fc1952
commit 5f629276a7
4 changed files with 14 additions and 14 deletions

View File

@ -160,7 +160,7 @@ struct SPIRType : IVariant
{ {
Unknown, Unknown,
Void, Void,
Bool, Boolean,
Char, Char,
Int, Int,
UInt, UInt,

View File

@ -1016,7 +1016,7 @@ void Compiler::parse(const Instruction &instruction)
{ {
uint32_t id = ops[0]; uint32_t id = ops[0];
auto &type = set<SPIRType>(id); auto &type = set<SPIRType>(id);
type.basetype = SPIRType::Bool; type.basetype = SPIRType::Boolean;
type.width = 1; type.width = 1;
break; break;
} }
@ -1786,7 +1786,7 @@ size_t Compiler::get_declared_struct_member_size(const SPIRType &struct_type, ui
{ {
case SPIRType::Unknown: case SPIRType::Unknown:
case SPIRType::Void: 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::AtomicCounter:
case SPIRType::Image: case SPIRType::Image:
case SPIRType::SampledImage: case SPIRType::SampledImage:

View File

@ -1283,7 +1283,7 @@ string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t
} }
break; break;
case SPIRType::Bool: case SPIRType::Boolean:
if (splat) if (splat)
res += c.scalar(vector, 0) ? "true" : "false"; res += c.scalar(vector, 0) ? "true" : "false";
else 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. // Special case boolean outputs since relational opcodes output booleans instead of int/uint.
bool extra_parens = true; bool extra_parens = true;
string expr; 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; expected_type.basetype = input_type;
expr = bitcast_glsl_op(out_type, expected_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. // Special case boolean outputs since relational opcodes output booleans instead of int/uint.
string expr; 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; expected_type.basetype = input_type;
expr = bitcast_glsl_op(out_type, expected_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. // Boolean mix not supported on desktop without extension.
// Was added in OpenGL 4.5 with ES 3.1 compat. // 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, // Could use GL_EXT_shader_integer_mix on desktop at least,
// but Apple doesn't support it. :( // but Apple doesn't support it. :(
@ -3982,7 +3982,7 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type)
{ {
switch (type.basetype) switch (type.basetype)
{ {
case SPIRType::Bool: case SPIRType::Boolean:
return "bool"; return "bool";
case SPIRType::Int: case SPIRType::Int:
return backend.basic_int_type; return backend.basic_int_type;
@ -4000,7 +4000,7 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type)
{ {
switch (type.basetype) switch (type.basetype)
{ {
case SPIRType::Bool: case SPIRType::Boolean:
return join("bvec", type.vecsize); return join("bvec", type.vecsize);
case SPIRType::Int: case SPIRType::Int:
return join("ivec", type.vecsize); return join("ivec", type.vecsize);
@ -4016,7 +4016,7 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type)
{ {
switch (type.basetype) switch (type.basetype)
{ {
case SPIRType::Bool: case SPIRType::Boolean:
return join("bmat", type.vecsize); return join("bmat", type.vecsize);
case SPIRType::Int: case SPIRType::Int:
return join("imat", type.vecsize); return join("imat", type.vecsize);
@ -4032,7 +4032,7 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type)
{ {
switch (type.basetype) switch (type.basetype)
{ {
case SPIRType::Bool: case SPIRType::Boolean:
return join("bmat", type.columns, "x", type.vecsize); return join("bmat", type.columns, "x", type.vecsize);
case SPIRType::Int: case SPIRType::Int:
return join("imat", type.columns, "x", type.vecsize); return join("imat", type.columns, "x", type.vecsize);

View File

@ -1287,7 +1287,7 @@ string CompilerMSL::type_to_glsl(const SPIRType &type)
{ {
switch (type.basetype) switch (type.basetype)
{ {
case SPIRType::Bool: case SPIRType::Boolean:
return "bool"; return "bool";
case SPIRType::Char: case SPIRType::Char:
return "char"; return "char";
@ -1307,7 +1307,7 @@ string CompilerMSL::type_to_glsl(const SPIRType &type)
{ {
switch (type.basetype) switch (type.basetype)
{ {
case SPIRType::Bool: case SPIRType::Boolean:
return join("bool", type.vecsize); return join("bool", type.vecsize);
case SPIRType::Char: case SPIRType::Char:
return join("char", type.vecsize); return join("char", type.vecsize);
@ -1326,7 +1326,7 @@ string CompilerMSL::type_to_glsl(const SPIRType &type)
{ {
switch (type.basetype) switch (type.basetype)
{ {
case SPIRType::Bool: case SPIRType::Boolean:
case SPIRType::Int: case SPIRType::Int:
case SPIRType::UInt: case SPIRType::UInt:
case SPIRType::Float: case SPIRType::Float: