shader_recompiler, video_core: Resolve clang errors
Silences the following warnings-turned-errors: -Wsign-conversion -Wunused-private-field -Wbraced-scalar-init -Wunused-variable And some other errors
This commit is contained in:
parent
4e4b8775b5
commit
49946cf780
14 changed files with 40 additions and 44 deletions
|
@ -59,14 +59,14 @@ IR::U32U64 ApplyIntegerAtomOp(IR::IREmitter& ir, const IR::U32U64& offset, const
|
|||
IR::Value ApplyFpAtomOp(IR::IREmitter& ir, const IR::U64& offset, const IR::Value& op_b, AtomOp op,
|
||||
AtomSize size) {
|
||||
static constexpr IR::FpControl f16_control{
|
||||
.no_contraction{false},
|
||||
.rounding{IR::FpRounding::RN},
|
||||
.fmz_mode{IR::FmzMode::DontCare},
|
||||
.no_contraction = false,
|
||||
.rounding = IR::FpRounding::RN,
|
||||
.fmz_mode = IR::FmzMode::DontCare,
|
||||
};
|
||||
static constexpr IR::FpControl f32_control{
|
||||
.no_contraction{false},
|
||||
.rounding{IR::FpRounding::RN},
|
||||
.fmz_mode{IR::FmzMode::FTZ},
|
||||
.no_contraction = false,
|
||||
.rounding = IR::FpRounding::RN,
|
||||
.fmz_mode = IR::FmzMode::FTZ,
|
||||
};
|
||||
switch (op) {
|
||||
case AtomOp::ADD:
|
||||
|
|
|
@ -104,7 +104,9 @@ void I2F(TranslatorVisitor& v, u64 insn, IR::U32U64 src) {
|
|||
.rounding = CastFpRounding(i2f.fp_rounding),
|
||||
.fmz_mode = IR::FmzMode::DontCare,
|
||||
};
|
||||
auto value{v.ir.ConvertIToF(dst_bitsize, conversion_src_bitsize, is_signed, src, fp_control)};
|
||||
auto value{v.ir.ConvertIToF(static_cast<size_t>(dst_bitsize),
|
||||
static_cast<size_t>(conversion_src_bitsize), is_signed, src,
|
||||
fp_control)};
|
||||
if (i2f.neg != 0) {
|
||||
if (i2f.abs != 0 || !is_signed) {
|
||||
// We know the value is positive
|
||||
|
|
|
@ -80,10 +80,10 @@ void TranslatorVisitor::ALD(u64 insn) {
|
|||
for (u32 element = 0; element < num_elements; ++element) {
|
||||
if (ald.patch != 0) {
|
||||
const IR::Patch patch{offset / 4 + element};
|
||||
F(ald.dest_reg + element, ir.GetPatch(patch));
|
||||
F(ald.dest_reg + static_cast<int>(element), ir.GetPatch(patch));
|
||||
} else {
|
||||
const IR::Attribute attr{offset / 4 + element};
|
||||
F(ald.dest_reg + element, ir.GetAttribute(attr, vertex));
|
||||
F(ald.dest_reg + static_cast<int>(element), ir.GetAttribute(attr, vertex));
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -92,7 +92,7 @@ void TranslatorVisitor::ALD(u64 insn) {
|
|||
throw NotImplementedException("Indirect patch read");
|
||||
}
|
||||
HandleIndexed(*this, ald.index_reg, num_elements, [&](u32 element, IR::U32 final_offset) {
|
||||
F(ald.dest_reg + element, ir.GetAttributeIndexed(final_offset, vertex));
|
||||
F(ald.dest_reg + static_cast<int>(element), ir.GetAttributeIndexed(final_offset, vertex));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -121,10 +121,10 @@ void TranslatorVisitor::AST(u64 insn) {
|
|||
for (u32 element = 0; element < num_elements; ++element) {
|
||||
if (ast.patch != 0) {
|
||||
const IR::Patch patch{offset / 4 + element};
|
||||
ir.SetPatch(patch, F(ast.src_reg + element));
|
||||
ir.SetPatch(patch, F(ast.src_reg + static_cast<int>(element)));
|
||||
} else {
|
||||
const IR::Attribute attr{offset / 4 + element};
|
||||
ir.SetAttribute(attr, F(ast.src_reg + element), vertex);
|
||||
ir.SetAttribute(attr, F(ast.src_reg + static_cast<int>(element)), vertex);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -133,7 +133,7 @@ void TranslatorVisitor::AST(u64 insn) {
|
|||
throw NotImplementedException("Indexed tessellation patch store");
|
||||
}
|
||||
HandleIndexed(*this, ast.index_reg, num_elements, [&](u32 element, IR::U32 final_offset) {
|
||||
ir.SetAttributeIndexed(final_offset, F(ast.src_reg + element), vertex);
|
||||
ir.SetAttributeIndexed(final_offset, F(ast.src_reg + static_cast<int>(element)), vertex);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -69,9 +69,6 @@ TextureType GetType(Type type) {
|
|||
}
|
||||
|
||||
IR::Value MakeCoords(TranslatorVisitor& v, IR::Reg reg, Type type) {
|
||||
const auto array{[&](int index) {
|
||||
return v.ir.BitFieldExtract(v.X(reg + index), v.ir.Imm32(0), v.ir.Imm32(16));
|
||||
}};
|
||||
switch (type) {
|
||||
case Type::_1D:
|
||||
case Type::BUFFER_1D:
|
||||
|
|
|
@ -160,10 +160,10 @@ unsigned SwizzleMask(u64 swizzle) {
|
|||
IR::Value MakeColor(IR::IREmitter& ir, IR::Reg reg, int num_regs) {
|
||||
std::array<IR::U32, 4> colors;
|
||||
for (int i = 0; i < num_regs; ++i) {
|
||||
colors[i] = ir.GetReg(reg + i);
|
||||
colors[static_cast<size_t>(i)] = ir.GetReg(reg + i);
|
||||
}
|
||||
for (int i = num_regs; i < 4; ++i) {
|
||||
colors[i] = ir.Imm32(0);
|
||||
colors[static_cast<size_t>(i)] = ir.Imm32(0);
|
||||
}
|
||||
return ir.CompositeConstruct(colors[0], colors[1], colors[2], colors[3]);
|
||||
}
|
||||
|
@ -211,12 +211,12 @@ void TranslatorVisitor::SULD(u64 insn) {
|
|||
if (is_typed) {
|
||||
const int num_regs{SizeInRegs(suld.size)};
|
||||
for (int i = 0; i < num_regs; ++i) {
|
||||
X(dest_reg + i, IR::U32{ir.CompositeExtract(result, i)});
|
||||
X(dest_reg + i, IR::U32{ir.CompositeExtract(result, static_cast<size_t>(i))});
|
||||
}
|
||||
} else {
|
||||
const unsigned mask{SwizzleMask(suld.swizzle)};
|
||||
const int bits{std::popcount(mask)};
|
||||
if (!IR::IsAligned(dest_reg, bits == 3 ? 4 : bits)) {
|
||||
if (!IR::IsAligned(dest_reg, bits == 3 ? 4 : static_cast<size_t>(bits))) {
|
||||
throw NotImplementedException("Unaligned destination register");
|
||||
}
|
||||
for (unsigned component = 0; component < 4; ++component) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue