Skip to content

Commit

Permalink
Fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
etang-cw committed Sep 29, 2023
1 parent ae11d9f commit 58e1a3c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions spirv_msl_vertex_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,18 @@ struct ConstexprLookupTable
template <uint32_t Highest, typename OutType, uint32_t InSize, typename IndexType>
constexpr static ConstexprLookupTable<OutType, Highest + 1> gen_lookup_table(const std::pair<IndexType, OutType> (&entry_list)[InSize])
{
#define CXPR_ASSERT_REL(x) ((x) ? static_cast<void>(0) : abort())
bool written[Highest + 1] = {};
ConstexprLookupTable<OutType, Highest + 1> output = {};
for (const auto &pair : entry_list)
{
uint32_t index = static_cast<uint32_t>(pair.first);
assert(!written[index] && "Duplicate entry!");
CXPR_ASSERT_REL(!written[index] && "Duplicate entry!");
written[index] = true;
output.data[index] = pair.second;
}
assert(written[Highest] && "Highest too high");
CXPR_ASSERT_REL(written[Highest] && "Highest too high");
#undef CXPR_ASSERT_REL
return output;
}

Expand Down Expand Up @@ -562,6 +564,8 @@ class CompilerMSL::MSLVertexLoaderWriter::Impl
case RGB9E5:
return 2;
}
assert(0);
return 0;
}
else
{
Expand Down Expand Up @@ -687,6 +691,8 @@ class CompilerMSL::MSLVertexLoaderWriter::Impl
case RGB9E5: return "rgb9e5";
case SRGBA8Unorm: return "srgba8unorm";
}
assert(0);
return "unknown_pixel_format";
}
static const char* _int_name(uint32_t log2_size)
{
Expand Down Expand Up @@ -888,10 +894,10 @@ class CompilerMSL::MSLVertexLoaderWriter::Impl
BindingInfo info_list[MaxBindings];

public:
Impl(MSLVertexLoaderWriter &writer, CompilerMSL &out)
Impl(MSLVertexLoaderWriter &writer, CompilerMSL &out_)
: bindings(writer.bindings)
, attributes(writer.attributes)
, out(out)
, out(out_)
{
// Only apple GPUs support loading from pixel structs (e.g. rgba8unorm<float4>)
// But use them in structs anyways, to improve decoding when viewed in Xcode GPU captures
Expand Down

0 comments on commit 58e1a3c

Please sign in to comment.