Skip to content

Commit e4954df

Browse files
committed
Fix compiler warnings
1 parent 052e51b commit e4954df

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

spirv_msl_vertex_loader.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ struct ConstexprLookupTable
3636
template <uint32_t Highest, typename OutType, uint32_t InSize, typename IndexType>
3737
constexpr static ConstexprLookupTable<OutType, Highest + 1> gen_lookup_table(const std::pair<IndexType, OutType> (&entry_list)[InSize])
3838
{
39+
#define CXPR_ASSERT_REL(x) ((x) ? static_cast<void>(0) : abort())
3940
bool written[Highest + 1] = {};
4041
ConstexprLookupTable<OutType, Highest + 1> output = {};
4142
for (const auto &pair : entry_list)
4243
{
4344
uint32_t index = static_cast<uint32_t>(pair.first);
44-
assert(!written[index] && "Duplicate entry!");
45+
CXPR_ASSERT_REL(!written[index] && "Duplicate entry!");
4546
written[index] = true;
4647
output.data[index] = pair.second;
4748
}
48-
assert(written[Highest] && "Highest too high");
49+
CXPR_ASSERT_REL(written[Highest] && "Highest too high");
50+
#undef CXPR_ASSERT_REL
4951
return output;
5052
}
5153

@@ -562,6 +564,8 @@ class CompilerMSL::MSLVertexLoaderWriter::Impl
562564
case RGB9E5:
563565
return 2;
564566
}
567+
assert(0);
568+
return 0;
565569
}
566570
else
567571
{
@@ -687,6 +691,8 @@ class CompilerMSL::MSLVertexLoaderWriter::Impl
687691
case RGB9E5: return "rgb9e5";
688692
case SRGBA8Unorm: return "srgba8unorm";
689693
}
694+
assert(0);
695+
return "unknown_pixel_format";
690696
}
691697
static const char* _int_name(uint32_t log2_size)
692698
{
@@ -888,10 +894,10 @@ class CompilerMSL::MSLVertexLoaderWriter::Impl
888894
BindingInfo info_list[MaxBindings];
889895

890896
public:
891-
Impl(MSLVertexLoaderWriter &writer, CompilerMSL &out)
897+
Impl(MSLVertexLoaderWriter &writer, CompilerMSL &out_)
892898
: bindings(writer.bindings)
893899
, attributes(writer.attributes)
894-
, out(out)
900+
, out(out_)
895901
{
896902
// Only apple GPUs support loading from pixel structs (e.g. rgba8unorm<float4>)
897903
// But use them in structs anyways, to improve decoding when viewed in Xcode GPU captures

0 commit comments

Comments
 (0)