diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/citra_qt/main.cpp | 4 | ||||
-rw-r--r-- | src/video_core/rasterizer.cpp | 16 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 6 |
3 files changed, 16 insertions, 10 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index da9ea6c91..1854f442a 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <clocale> #include <thread> #include <QDesktopWidget> @@ -563,6 +564,9 @@ int main(int argc, char* argv[]) { QApplication::setAttribute(Qt::AA_X11InitThreads); QApplication app(argc, argv); + // Qt changes the locale and causes issues in float conversion using std::to_string() when generating shaders + setlocale(LC_ALL, "C"); + GMainWindow main_window; // After settings have been loaded by GMainWindow, apply the filter log_filter.ParseFilterString(Settings::values.log_filter); diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index dd1604a38..fd02aa652 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -858,12 +858,12 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, } } - // TODO: Does depth indeed only get written even if depth testing is enabled? + unsigned num_bits = Regs::DepthBitsPerPixel(regs.framebuffer.depth_format); + u32 z = (u32)((v0.screenpos[2].ToFloat32() * w0 + + v1.screenpos[2].ToFloat32() * w1 + + v2.screenpos[2].ToFloat32() * w2) * ((1 << num_bits) - 1) / wsum); + if (output_merger.depth_test_enable) { - unsigned num_bits = Regs::DepthBitsPerPixel(regs.framebuffer.depth_format); - u32 z = (u32)((v0.screenpos[2].ToFloat32() * w0 + - v1.screenpos[2].ToFloat32() * w1 + - v2.screenpos[2].ToFloat32() * w2) * ((1 << num_bits) - 1) / wsum); u32 ref_z = GetDepth(x >> 4, y >> 4); bool pass = false; @@ -907,11 +907,11 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, UpdateStencil(stencil_test.action_depth_fail); continue; } - - if (output_merger.depth_write_enable) - SetDepth(x >> 4, y >> 4, z); } + if (output_merger.depth_write_enable) + SetDepth(x >> 4, y >> 4, z); + // The stencil depth_pass action is executed even if depth testing is disabled if (stencil_action_enable) UpdateStencil(stencil_test.action_depth_pass); diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 0f864b617..b3dc6aa19 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -887,8 +887,10 @@ void RasterizerOpenGL::SyncStencilTest() { void RasterizerOpenGL::SyncDepthTest() { const auto& regs = Pica::g_state.regs; - state.depth.test_enabled = (regs.output_merger.depth_test_enable == 1); - state.depth.test_func = PicaToGL::CompareFunc(regs.output_merger.depth_test_func); + state.depth.test_enabled = regs.output_merger.depth_test_enable == 1 || + regs.output_merger.depth_write_enable == 1; + state.depth.test_func = regs.output_merger.depth_test_enable == 1 ? + PicaToGL::CompareFunc(regs.output_merger.depth_test_func) : GL_ALWAYS; state.color_mask.red_enabled = regs.output_merger.red_enable; state.color_mask.green_enabled = regs.output_merger.green_enable; state.color_mask.blue_enabled = regs.output_merger.blue_enable; |