diff options
| author | 2019-07-17 19:37:01 -0400 | |
|---|---|---|
| committer | 2019-07-20 10:18:35 -0400 | |
| commit | 7a35178ee2c8ce60c87654ed2d80cc76abb0380b (patch) | |
| tree | 514fdc12910bb3b00d7c2df89b9e1882a8586320 | |
| parent | GL_State: Feedback and fixes (diff) | |
| download | yuzu-7a35178ee2c8ce60c87654ed2d80cc76abb0380b.tar.gz yuzu-7a35178ee2c8ce60c87654ed2d80cc76abb0380b.tar.xz yuzu-7a35178ee2c8ce60c87654ed2d80cc76abb0380b.zip | |
Maxwell3D: Reorganize and address feedback
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 45 |
3 files changed, 33 insertions, 20 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 87777e265..fe9fc0278 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -70,6 +70,10 @@ void Maxwell3D::InitializeRegisterDefaults() { | |||
| 70 | regs.stencil_back_func_mask = 0xFFFFFFFF; | 70 | regs.stencil_back_func_mask = 0xFFFFFFFF; |
| 71 | regs.stencil_back_mask = 0xFFFFFFFF; | 71 | regs.stencil_back_mask = 0xFFFFFFFF; |
| 72 | 72 | ||
| 73 | regs.depth_test_func = Regs::ComparisonOp::Always; | ||
| 74 | regs.cull.front_face = Regs::Cull::FrontFace::CounterClockWise; | ||
| 75 | regs.cull.cull_face = Regs::Cull::CullFace::Back; | ||
| 76 | |||
| 73 | // TODO(Rodrigo): Most games do not set a point size. I think this is a case of a | 77 | // TODO(Rodrigo): Most games do not set a point size. I think this is a case of a |
| 74 | // register carrying a default value. Assume it's OpenGL's default (1). | 78 | // register carrying a default value. Assume it's OpenGL's default (1). |
| 75 | regs.point_size = 1.0f; | 79 | regs.point_size = 1.0f; |
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 42feb0345..ac300bf76 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -1246,8 +1246,6 @@ private: | |||
| 1246 | /// Interpreter for the macro codes uploaded to the GPU. | 1246 | /// Interpreter for the macro codes uploaded to the GPU. |
| 1247 | MacroInterpreter macro_interpreter; | 1247 | MacroInterpreter macro_interpreter; |
| 1248 | 1248 | ||
| 1249 | Upload::State upload_state; | ||
| 1250 | |||
| 1251 | static constexpr u32 null_cb_data = 0xFFFFFFFF; | 1249 | static constexpr u32 null_cb_data = 0xFFFFFFFF; |
| 1252 | struct { | 1250 | struct { |
| 1253 | std::array<std::array<u32, 0x4000>, 16> buffer; | 1251 | std::array<std::array<u32, 0x4000>, 16> buffer; |
| @@ -1257,6 +1255,8 @@ private: | |||
| 1257 | u32 counter{}; | 1255 | u32 counter{}; |
| 1258 | } cb_data_state; | 1256 | } cb_data_state; |
| 1259 | 1257 | ||
| 1258 | Upload::State upload_state; | ||
| 1259 | |||
| 1260 | /// Retrieves information about a specific TIC entry from the TIC buffer. | 1260 | /// Retrieves information about a specific TIC entry from the TIC buffer. |
| 1261 | Texture::TICEntry GetTICEntry(u32 tic_index) const; | 1261 | Texture::TICEntry GetTICEntry(u32 tic_index) const; |
| 1262 | 1262 | ||
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index d1ae8a7c5..0432a9e10 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -993,37 +993,42 @@ void RasterizerOpenGL::SyncCullMode() { | |||
| 993 | const auto& regs = maxwell3d.regs; | 993 | const auto& regs = maxwell3d.regs; |
| 994 | 994 | ||
| 995 | state.cull.enabled = regs.cull.enabled != 0; | 995 | state.cull.enabled = regs.cull.enabled != 0; |
| 996 | state.cull.front_face = MaxwellToGL::FrontFace(regs.cull.front_face); | 996 | if (state.cull.enabled) { |
| 997 | state.cull.mode = MaxwellToGL::CullFace(regs.cull.cull_face); | 997 | state.cull.front_face = MaxwellToGL::FrontFace(regs.cull.front_face); |
| 998 | 998 | state.cull.mode = MaxwellToGL::CullFace(regs.cull.cull_face); | |
| 999 | const bool flip_triangles{regs.screen_y_control.triangle_rast_flip == 0 || | 999 | |
| 1000 | regs.viewport_transform[0].scale_y < 0.0f}; | 1000 | const bool flip_triangles{regs.screen_y_control.triangle_rast_flip == 0 || |
| 1001 | 1001 | regs.viewport_transform[0].scale_y < 0.0f}; | |
| 1002 | // If the GPU is configured to flip the rasterized triangles, then we need to flip the | 1002 | |
| 1003 | // notion of front and back. Note: We flip the triangles when the value of the register is 0 | 1003 | // If the GPU is configured to flip the rasterized triangles, then we need to flip the |
| 1004 | // because OpenGL already does it for us. | 1004 | // notion of front and back. Note: We flip the triangles when the value of the register is 0 |
| 1005 | if (flip_triangles) { | 1005 | // because OpenGL already does it for us. |
| 1006 | if (state.cull.front_face == GL_CCW) | 1006 | if (flip_triangles) { |
| 1007 | state.cull.front_face = GL_CW; | 1007 | if (state.cull.front_face == GL_CCW) |
| 1008 | else if (state.cull.front_face == GL_CW) | 1008 | state.cull.front_face = GL_CW; |
| 1009 | state.cull.front_face = GL_CCW; | 1009 | else if (state.cull.front_face == GL_CW) |
| 1010 | state.cull.front_face = GL_CCW; | ||
| 1011 | } | ||
| 1010 | } | 1012 | } |
| 1011 | } | 1013 | } |
| 1012 | 1014 | ||
| 1013 | void RasterizerOpenGL::SyncPrimitiveRestart() { | 1015 | void RasterizerOpenGL::SyncPrimitiveRestart() { |
| 1014 | auto& maxwell3d = system.GPU().Maxwell3D(); | 1016 | const auto& regs = system.GPU().Maxwell3D().regs; |
| 1015 | const auto& regs = maxwell3d.regs; | ||
| 1016 | 1017 | ||
| 1017 | state.primitive_restart.enabled = regs.primitive_restart.enabled; | 1018 | state.primitive_restart.enabled = regs.primitive_restart.enabled; |
| 1018 | state.primitive_restart.index = regs.primitive_restart.index; | 1019 | state.primitive_restart.index = regs.primitive_restart.index; |
| 1019 | } | 1020 | } |
| 1020 | 1021 | ||
| 1021 | void RasterizerOpenGL::SyncDepthTestState() { | 1022 | void RasterizerOpenGL::SyncDepthTestState() { |
| 1022 | auto& maxwell3d = system.GPU().Maxwell3D(); | 1023 | const auto& regs = system.GPU().Maxwell3D().regs; |
| 1023 | const auto& regs = maxwell3d.regs; | ||
| 1024 | 1024 | ||
| 1025 | state.depth.test_enabled = regs.depth_test_enable != 0; | 1025 | state.depth.test_enabled = regs.depth_test_enable != 0; |
| 1026 | state.depth.write_mask = regs.depth_write_enabled ? GL_TRUE : GL_FALSE; | 1026 | state.depth.write_mask = regs.depth_write_enabled ? GL_TRUE : GL_FALSE; |
| 1027 | |||
| 1028 | if (!state.depth.test_enabled) { | ||
| 1029 | return; | ||
| 1030 | } | ||
| 1031 | |||
| 1027 | state.depth.test_func = MaxwellToGL::ComparisonOp(regs.depth_test_func); | 1032 | state.depth.test_func = MaxwellToGL::ComparisonOp(regs.depth_test_func); |
| 1028 | } | 1033 | } |
| 1029 | 1034 | ||
| @@ -1035,6 +1040,10 @@ void RasterizerOpenGL::SyncStencilTestState() { | |||
| 1035 | const auto& regs = maxwell3d.regs; | 1040 | const auto& regs = maxwell3d.regs; |
| 1036 | 1041 | ||
| 1037 | state.stencil.test_enabled = regs.stencil_enable != 0; | 1042 | state.stencil.test_enabled = regs.stencil_enable != 0; |
| 1043 | if (!regs.stencil_enable) { | ||
| 1044 | return; | ||
| 1045 | } | ||
| 1046 | |||
| 1038 | state.stencil.front.test_func = MaxwellToGL::ComparisonOp(regs.stencil_front_func_func); | 1047 | state.stencil.front.test_func = MaxwellToGL::ComparisonOp(regs.stencil_front_func_func); |
| 1039 | state.stencil.front.test_ref = regs.stencil_front_func_ref; | 1048 | state.stencil.front.test_ref = regs.stencil_front_func_ref; |
| 1040 | state.stencil.front.test_mask = regs.stencil_front_func_mask; | 1049 | state.stencil.front.test_mask = regs.stencil_front_func_mask; |