This commit is contained in:
Hans-Kristian Arntzen 2018-03-13 14:05:33 +01:00
Родитель 8e90382675
Коммит 719cf9d42f
4 изменённых файлов: 19 добавлений и 21 удалений

Просмотреть файл

@ -99,7 +99,7 @@ class Bitset
public:
Bitset() = default;
explicit inline Bitset(uint64_t lower_)
: lower(lower_)
: lower(lower_)
{
}
@ -1252,7 +1252,6 @@ static inline bool type_is_floating_point(const SPIRType &type)
{
return type.basetype == SPIRType::Half || type.basetype == SPIRType::Float || type.basetype == SPIRType::Double;
}
}
#endif

Просмотреть файл

@ -3942,7 +3942,8 @@ bool Compiler::get_common_basic_type(const SPIRType &type, SPIRType::BaseType &b
}
}
void Compiler::ActiveBuiltinHandler::handle_builtin(const SPIRType &type, BuiltIn builtin, const Bitset &decoration_flags)
void Compiler::ActiveBuiltinHandler::handle_builtin(const SPIRType &type, BuiltIn builtin,
const Bitset &decoration_flags)
{
// If used, we will need to explicitly declare a new array size for these builtins.

Просмотреть файл

@ -883,7 +883,8 @@ uint32_t CompilerGLSL::type_to_packed_base_size(const SPIRType &type, BufferPack
}
}
uint32_t CompilerGLSL::type_to_packed_alignment(const SPIRType &type, const Bitset &flags, BufferPackingStandard packing)
uint32_t CompilerGLSL::type_to_packed_alignment(const SPIRType &type, const Bitset &flags,
BufferPackingStandard packing)
{
if (!type.array.empty())
{
@ -971,7 +972,8 @@ uint32_t CompilerGLSL::type_to_packed_alignment(const SPIRType &type, const Bits
SPIRV_CROSS_THROW("Did not find suitable rule for type. Bogus decorations?");
}
uint32_t CompilerGLSL::type_to_packed_array_stride(const SPIRType &type, const Bitset &flags, BufferPackingStandard packing)
uint32_t CompilerGLSL::type_to_packed_array_stride(const SPIRType &type, const Bitset &flags,
BufferPackingStandard packing)
{
// Array stride is equal to aligned size of the underlying type.
uint32_t parent = type.parent_type;
@ -1914,11 +1916,9 @@ void CompilerGLSL::emit_declared_builtin_block(StorageClass storage, ExecutionMo
block_var = &var;
}
global_builtins = Bitset(global_builtins.get_lower() &
((1ull << BuiltInPosition) |
(1ull << BuiltInPointSize) |
(1ull << BuiltInClipDistance) |
(1ull << BuiltInCullDistance)));
global_builtins =
Bitset(global_builtins.get_lower() & ((1ull << BuiltInPosition) | (1ull << BuiltInPointSize) |
(1ull << BuiltInClipDistance) | (1ull << BuiltInCullDistance)));
// Try to collect all other declared builtins.
if (!emitted_block)

Просмотреть файл

@ -611,16 +611,14 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage)
else if (!is_builtin || has_active_builtin(builtin, storage))
{
// Arrays of MRT output is not allowed in MSL, so need to handle it specially.
if (!is_builtin &&
storage == StorageClassOutput &&
get_entry_point().model == ExecutionModelFragment &&
if (!is_builtin && storage == StorageClassOutput && get_entry_point().model == ExecutionModelFragment &&
!type.array.empty())
{
if (type.array.size() != 1)
SPIRV_CROSS_THROW("Cannot emit arrays-of-arrays with MRT.");
uint32_t num_mrts =
type.array_size_literal.back() ? type.array.back() : get<SPIRConstant>(type.array.back()).scalar();
uint32_t num_mrts = type.array_size_literal.back() ? type.array.back() :
get<SPIRConstant>(type.array.back()).scalar();
auto *no_array_type = &type;
while (!no_array_type->array.empty())
@ -648,7 +646,8 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage)
}
// Lower the internal array to flattened output when entry point returns.
entry_func.fixup_statements.push_back(join(ib_var_ref, ".", mbr_name, " = ", to_name(p_var->self), "[", i, "];"));
entry_func.fixup_statements.push_back(
join(ib_var_ref, ".", mbr_name, " = ", to_name(p_var->self), "[", i, "];"));
}
}
else
@ -2939,9 +2938,8 @@ string CompilerMSL::func_type_decl(SPIRType &type)
entry_type = "vertex";
break;
case ExecutionModelFragment:
entry_type = execution.flags.get(ExecutionModeEarlyFragmentTests) ?
"fragment [[ early_fragment_tests ]]" :
"fragment";
entry_type =
execution.flags.get(ExecutionModeEarlyFragmentTests) ? "fragment [[ early_fragment_tests ]]" : "fragment";
break;
case ExecutionModelGLCompute:
case ExecutionModelKernel:
@ -2974,8 +2972,8 @@ string CompilerMSL::get_argument_address_space(const SPIRVariable &argument)
if (type.basetype == SPIRType::Struct)
return (meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock) &&
!meta[argument.self].decoration.decoration_flags.get(DecorationNonWritable)) ?
"device" :
"constant";
"device" :
"constant";
break;