Chore: Enable warnings as errors on MSVC (#6456)
* tests: add Sanity test for SplitFilename83 fix test fix test * disable `C4715:not all control paths return a value` for nihstro includes nihstro: no warn * Chore: Enable warnings as errors on msvc + fix warnings fixes some more warnings clang-format * more fixes * Externals: Add target_compile_options `/W0` nihstro-headers and ... Revert "disable `C4715:not all control paths return a value` for nihstro includes" This reverts commit 606d79b55d3044b744fb835025b8eb0f4ea5b757. * src\citra\config.cpp: ReadSetting: simplify type casting * settings.cpp: Get*Name: remove superflous logs
This commit is contained in:
@@ -290,14 +290,14 @@ bool CustomTexManager::Decode(Material* material, std::function<bool()>&& upload
|
||||
|
||||
void CustomTexManager::ReadConfig(const std::string& load_path) {
|
||||
const std::string config_path = load_path + "pack.json";
|
||||
FileUtil::IOFile file{config_path, "r"};
|
||||
if (!file.IsOpen()) {
|
||||
FileUtil::IOFile config_file{config_path, "r"};
|
||||
if (!config_file.IsOpen()) {
|
||||
LOG_INFO(Render, "Unable to find pack config file, using legacy defaults");
|
||||
refuse_dds = true;
|
||||
return;
|
||||
}
|
||||
std::string config(file.GetSize(), '\0');
|
||||
const std::size_t read_size = file.ReadBytes(config.data(), config.size());
|
||||
std::string config(config_file.GetSize(), '\0');
|
||||
const std::size_t read_size = config_file.ReadBytes(config.data(), config.size());
|
||||
if (!read_size) {
|
||||
return;
|
||||
}
|
||||
|
@@ -40,8 +40,8 @@ void Zero(T& o) {
|
||||
State::State() : geometry_pipeline(*this) {
|
||||
auto SubmitVertex = [this](const Shader::AttributeBuffer& vertex) {
|
||||
using Pica::Shader::OutputVertex;
|
||||
auto AddTriangle = [this](const OutputVertex& v0, const OutputVertex& v1,
|
||||
const OutputVertex& v2) {
|
||||
auto AddTriangle = [](const OutputVertex& v0, const OutputVertex& v1,
|
||||
const OutputVertex& v2) {
|
||||
VideoCore::g_renderer->Rasterizer()->AddTriangle(v0, v1, v2);
|
||||
};
|
||||
primitive_assembler.SubmitVertex(
|
||||
|
@@ -679,7 +679,8 @@ void RasterizerAccelerated::SyncProcTexBias() {
|
||||
}
|
||||
|
||||
void RasterizerAccelerated::SyncAlphaTest() {
|
||||
if (regs.framebuffer.output_merger.alpha_test.ref != uniform_block_data.data.alphatest_ref) {
|
||||
if (regs.framebuffer.output_merger.alpha_test.ref !=
|
||||
static_cast<u32>(uniform_block_data.data.alphatest_ref)) {
|
||||
uniform_block_data.data.alphatest_ref = regs.framebuffer.output_merger.alpha_test.ref;
|
||||
uniform_block_data.dirty = true;
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ enum class ScaleMatch {
|
||||
};
|
||||
|
||||
class CustomTexManager;
|
||||
struct CustomTexture;
|
||||
class CustomTexture;
|
||||
class RendererBase;
|
||||
|
||||
class RasterizerCache : NonCopyable {
|
||||
|
@@ -161,7 +161,7 @@ constexpr void EncodePixel(const u8* source, u8* dest) {
|
||||
} else if constexpr (format == PixelFormat::D24 && converted) {
|
||||
float d32;
|
||||
std::memcpy(&d32, source, sizeof(d32));
|
||||
EncodeD24(d32 * 0xFFFFFF, dest);
|
||||
EncodeD24(static_cast<u32>(d32 * 0xFFFFFF), dest);
|
||||
} else if constexpr (format == PixelFormat::D24S8) {
|
||||
const u32 s8d24 = std::rotr(MakeInt<u32>(source), 8);
|
||||
std::memcpy(dest, &s8d24, sizeof(u32));
|
||||
|
@@ -59,34 +59,37 @@ public:
|
||||
virtual void ClearAll(bool flush) = 0;
|
||||
|
||||
/// Attempt to use a faster method to perform a display transfer with is_texture_copy = 0
|
||||
virtual bool AccelerateDisplayTransfer(const GPU::Regs::DisplayTransferConfig& config) {
|
||||
virtual bool AccelerateDisplayTransfer(
|
||||
[[maybe_unused]] const GPU::Regs::DisplayTransferConfig& config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Attempt to use a faster method to perform a display transfer with is_texture_copy = 1
|
||||
virtual bool AccelerateTextureCopy(const GPU::Regs::DisplayTransferConfig& config) {
|
||||
virtual bool AccelerateTextureCopy(
|
||||
[[maybe_unused]] const GPU::Regs::DisplayTransferConfig& config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Attempt to use a faster method to fill a region
|
||||
virtual bool AccelerateFill(const GPU::Regs::MemoryFillConfig& config) {
|
||||
virtual bool AccelerateFill([[maybe_unused]] const GPU::Regs::MemoryFillConfig& config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Attempt to use a faster method to display the framebuffer to screen
|
||||
virtual bool AccelerateDisplay(const GPU::Regs::FramebufferConfig& config,
|
||||
PAddr framebuffer_addr, u32 pixel_stride,
|
||||
OpenGL::ScreenInfo& screen_info) {
|
||||
virtual bool AccelerateDisplay([[maybe_unused]] const GPU::Regs::FramebufferConfig& config,
|
||||
[[maybe_unused]] PAddr framebuffer_addr,
|
||||
[[maybe_unused]] u32 pixel_stride,
|
||||
[[maybe_unused]] OpenGL::ScreenInfo& screen_info) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Attempt to draw using hardware shaders
|
||||
virtual bool AccelerateDrawBatch(bool is_indexed) {
|
||||
virtual bool AccelerateDrawBatch([[maybe_unused]] bool is_indexed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void LoadDiskResources(const std::atomic_bool& stop_loading,
|
||||
const DiskResourceLoadCallback& callback) {}
|
||||
virtual void LoadDiskResources([[maybe_unused]] const std::atomic_bool& stop_loading,
|
||||
[[maybe_unused]] const DiskResourceLoadCallback& callback) {}
|
||||
|
||||
virtual void SyncEntireState() {}
|
||||
};
|
||||
|
@@ -413,10 +413,10 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) {
|
||||
|
||||
// Sync the viewport
|
||||
const auto viewport = framebuffer.Viewport();
|
||||
state.viewport.x = viewport.x;
|
||||
state.viewport.y = viewport.y;
|
||||
state.viewport.width = viewport.width;
|
||||
state.viewport.height = viewport.height;
|
||||
state.viewport.x = static_cast<GLint>(viewport.x);
|
||||
state.viewport.y = static_cast<GLint>(viewport.y);
|
||||
state.viewport.width = static_cast<GLsizei>(viewport.width);
|
||||
state.viewport.height = static_cast<GLsizei>(viewport.height);
|
||||
|
||||
// Viewport can have negative offsets or larger dimensions than our framebuffer sub-rect.
|
||||
// Enable scissor test to prevent drawing outside of the framebuffer region
|
||||
@@ -427,7 +427,7 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) {
|
||||
state.scissor.width = draw_rect.GetWidth();
|
||||
state.scissor.height = draw_rect.GetHeight();
|
||||
|
||||
const u32 res_scale = framebuffer.ResolutionScale();
|
||||
const int res_scale = static_cast<int>(framebuffer.ResolutionScale());
|
||||
if (uniform_block_data.data.framebuffer_scale != res_scale) {
|
||||
uniform_block_data.data.framebuffer_scale = res_scale;
|
||||
uniform_block_data.dirty = true;
|
||||
|
@@ -398,8 +398,8 @@ void DrawShadowMapPixel(int x, int y, u32 depth, u8 stencil) {
|
||||
} else {
|
||||
float16 constant = float16::FromRaw(shadow.constant);
|
||||
float16 linear = float16::FromRaw(shadow.linear);
|
||||
float16 x = float16::FromFloat32(static_cast<float>(depth) / ref_z);
|
||||
float16 stencil_new = float16::FromFloat32(stencil) / (constant + linear * x);
|
||||
float16 x_ = float16::FromFloat32(static_cast<float>(depth) / ref_z);
|
||||
float16 stencil_new = float16::FromFloat32(stencil) / (constant + linear * x_);
|
||||
stencil = static_cast<u8>(std::clamp(stencil_new.ToFloat32(), 0.0f, 255.0f));
|
||||
|
||||
if (stencil < ref_s)
|
||||
|
@@ -456,7 +456,7 @@ static void RunInterpreter(const ShaderSetup& setup, UnitState& state, DebugData
|
||||
case OpCode::Type::MultiplyAdd: {
|
||||
if ((instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MAD) ||
|
||||
(instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MADI)) {
|
||||
const SwizzlePattern& swizzle = *reinterpret_cast<const SwizzlePattern*>(
|
||||
const SwizzlePattern& mad_swizzle = *reinterpret_cast<const SwizzlePattern*>(
|
||||
&swizzle_data[instr.mad.operand_desc_id]);
|
||||
|
||||
bool is_inverted = (instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MADI);
|
||||
@@ -472,15 +472,15 @@ static void RunInterpreter(const ShaderSetup& setup, UnitState& state, DebugData
|
||||
const float24* src3_ = LookupSourceRegister(instr.mad.GetSrc3(is_inverted) +
|
||||
(is_inverted * address_offset));
|
||||
|
||||
const bool negate_src1 = ((bool)swizzle.negate_src1 != false);
|
||||
const bool negate_src2 = ((bool)swizzle.negate_src2 != false);
|
||||
const bool negate_src3 = ((bool)swizzle.negate_src3 != false);
|
||||
const bool negate_src1 = ((bool)mad_swizzle.negate_src1 != false);
|
||||
const bool negate_src2 = ((bool)mad_swizzle.negate_src2 != false);
|
||||
const bool negate_src3 = ((bool)mad_swizzle.negate_src3 != false);
|
||||
|
||||
float24 src1[4] = {
|
||||
src1_[(int)swizzle.src1_selector_0.Value()],
|
||||
src1_[(int)swizzle.src1_selector_1.Value()],
|
||||
src1_[(int)swizzle.src1_selector_2.Value()],
|
||||
src1_[(int)swizzle.src1_selector_3.Value()],
|
||||
src1_[(int)mad_swizzle.src1_selector_0.Value()],
|
||||
src1_[(int)mad_swizzle.src1_selector_1.Value()],
|
||||
src1_[(int)mad_swizzle.src1_selector_2.Value()],
|
||||
src1_[(int)mad_swizzle.src1_selector_3.Value()],
|
||||
};
|
||||
if (negate_src1) {
|
||||
src1[0] = -src1[0];
|
||||
@@ -489,10 +489,10 @@ static void RunInterpreter(const ShaderSetup& setup, UnitState& state, DebugData
|
||||
src1[3] = -src1[3];
|
||||
}
|
||||
float24 src2[4] = {
|
||||
src2_[(int)swizzle.src2_selector_0.Value()],
|
||||
src2_[(int)swizzle.src2_selector_1.Value()],
|
||||
src2_[(int)swizzle.src2_selector_2.Value()],
|
||||
src2_[(int)swizzle.src2_selector_3.Value()],
|
||||
src2_[(int)mad_swizzle.src2_selector_0.Value()],
|
||||
src2_[(int)mad_swizzle.src2_selector_1.Value()],
|
||||
src2_[(int)mad_swizzle.src2_selector_2.Value()],
|
||||
src2_[(int)mad_swizzle.src2_selector_3.Value()],
|
||||
};
|
||||
if (negate_src2) {
|
||||
src2[0] = -src2[0];
|
||||
@@ -501,10 +501,10 @@ static void RunInterpreter(const ShaderSetup& setup, UnitState& state, DebugData
|
||||
src2[3] = -src2[3];
|
||||
}
|
||||
float24 src3[4] = {
|
||||
src3_[(int)swizzle.src3_selector_0.Value()],
|
||||
src3_[(int)swizzle.src3_selector_1.Value()],
|
||||
src3_[(int)swizzle.src3_selector_2.Value()],
|
||||
src3_[(int)swizzle.src3_selector_3.Value()],
|
||||
src3_[(int)mad_swizzle.src3_selector_0.Value()],
|
||||
src3_[(int)mad_swizzle.src3_selector_1.Value()],
|
||||
src3_[(int)mad_swizzle.src3_selector_2.Value()],
|
||||
src3_[(int)mad_swizzle.src3_selector_3.Value()],
|
||||
};
|
||||
if (negate_src3) {
|
||||
src3[0] = -src3[0];
|
||||
@@ -525,7 +525,7 @@ static void RunInterpreter(const ShaderSetup& setup, UnitState& state, DebugData
|
||||
Record<DebugDataRecord::SRC3>(debug_data, iteration, src3);
|
||||
Record<DebugDataRecord::DEST_IN>(debug_data, iteration, dest);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (!swizzle.DestComponentEnabled(i))
|
||||
if (!mad_swizzle.DestComponentEnabled(i))
|
||||
continue;
|
||||
|
||||
dest[i] = src1[i] * src2[i] + src3[i];
|
||||
|
Reference in New Issue
Block a user