diff options
| author | 2020-04-13 10:19:59 -0400 | |
|---|---|---|
| committer | 2020-04-13 10:19:59 -0400 | |
| commit | fbf13d3f48c1a75edbdf1a33bc5f29c1483a5099 (patch) | |
| tree | 321ded876262082f12dfeab470589c3cfc64ac2d /src | |
| parent | Merge pull request #3638 from ReinUsesLisp/remove-preserve-contents (diff) | |
| parent | gl_rasterizer: Implement line widths and smooth lines (diff) | |
| download | yuzu-fbf13d3f48c1a75edbdf1a33bc5f29c1483a5099.tar.gz yuzu-fbf13d3f48c1a75edbdf1a33bc5f29c1483a5099.tar.xz yuzu-fbf13d3f48c1a75edbdf1a33bc5f29c1483a5099.zip | |
Merge pull request #3651 from ReinUsesLisp/line-widths
gl_rasterizer: Implement line widths and smooth lines
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 14 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 3 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state_tracker.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state_tracker.h | 1 |
5 files changed, 33 insertions, 2 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 4637ddabd..2977a7d81 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -966,7 +966,10 @@ public: | |||
| 966 | BitField<4, 1, u32> triangle_rast_flip; | 966 | BitField<4, 1, u32> triangle_rast_flip; |
| 967 | } screen_y_control; | 967 | } screen_y_control; |
| 968 | 968 | ||
| 969 | INSERT_UNION_PADDING_WORDS(0x21); | 969 | float line_width_smooth; |
| 970 | float line_width_aliased; | ||
| 971 | |||
| 972 | INSERT_UNION_PADDING_WORDS(0x1F); | ||
| 970 | 973 | ||
| 971 | u32 vb_element_base; | 974 | u32 vb_element_base; |
| 972 | u32 vb_base_instance; | 975 | u32 vb_base_instance; |
| @@ -1024,7 +1027,7 @@ public: | |||
| 1024 | 1027 | ||
| 1025 | float polygon_offset_factor; | 1028 | float polygon_offset_factor; |
| 1026 | 1029 | ||
| 1027 | INSERT_UNION_PADDING_WORDS(0x1); | 1030 | u32 line_smooth_enable; |
| 1028 | 1031 | ||
| 1029 | struct { | 1032 | struct { |
| 1030 | u32 tic_address_high; | 1033 | u32 tic_address_high; |
| @@ -1591,6 +1594,8 @@ ASSERT_REG_POSITION(stencil_front_func_mask, 0x4E6); | |||
| 1591 | ASSERT_REG_POSITION(stencil_front_mask, 0x4E7); | 1594 | ASSERT_REG_POSITION(stencil_front_mask, 0x4E7); |
| 1592 | ASSERT_REG_POSITION(frag_color_clamp, 0x4EA); | 1595 | ASSERT_REG_POSITION(frag_color_clamp, 0x4EA); |
| 1593 | ASSERT_REG_POSITION(screen_y_control, 0x4EB); | 1596 | ASSERT_REG_POSITION(screen_y_control, 0x4EB); |
| 1597 | ASSERT_REG_POSITION(line_width_smooth, 0x4EC); | ||
| 1598 | ASSERT_REG_POSITION(line_width_aliased, 0x4ED); | ||
| 1594 | ASSERT_REG_POSITION(vb_element_base, 0x50D); | 1599 | ASSERT_REG_POSITION(vb_element_base, 0x50D); |
| 1595 | ASSERT_REG_POSITION(vb_base_instance, 0x50E); | 1600 | ASSERT_REG_POSITION(vb_base_instance, 0x50E); |
| 1596 | ASSERT_REG_POSITION(clip_distance_enabled, 0x544); | 1601 | ASSERT_REG_POSITION(clip_distance_enabled, 0x544); |
| @@ -1604,6 +1609,7 @@ ASSERT_REG_POSITION(multisample_control, 0x54F); | |||
| 1604 | ASSERT_REG_POSITION(condition, 0x554); | 1609 | ASSERT_REG_POSITION(condition, 0x554); |
| 1605 | ASSERT_REG_POSITION(tsc, 0x557); | 1610 | ASSERT_REG_POSITION(tsc, 0x557); |
| 1606 | ASSERT_REG_POSITION(polygon_offset_factor, 0x55B); | 1611 | ASSERT_REG_POSITION(polygon_offset_factor, 0x55B); |
| 1612 | ASSERT_REG_POSITION(line_smooth_enable, 0x55C); | ||
| 1607 | ASSERT_REG_POSITION(tic, 0x55D); | 1613 | ASSERT_REG_POSITION(tic, 0x55D); |
| 1608 | ASSERT_REG_POSITION(stencil_two_side_enable, 0x565); | 1614 | ASSERT_REG_POSITION(stencil_two_side_enable, 0x565); |
| 1609 | ASSERT_REG_POSITION(stencil_back_op_fail, 0x566); | 1615 | ASSERT_REG_POSITION(stencil_back_op_fail, 0x566); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index c6ff4e27f..f31d960c7 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -496,6 +496,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) { | |||
| 496 | SyncPrimitiveRestart(); | 496 | SyncPrimitiveRestart(); |
| 497 | SyncScissorTest(); | 497 | SyncScissorTest(); |
| 498 | SyncPointState(); | 498 | SyncPointState(); |
| 499 | SyncLineState(); | ||
| 499 | SyncPolygonOffset(); | 500 | SyncPolygonOffset(); |
| 500 | SyncAlphaTest(); | 501 | SyncAlphaTest(); |
| 501 | SyncFramebufferSRGB(); | 502 | SyncFramebufferSRGB(); |
| @@ -1311,6 +1312,19 @@ void RasterizerOpenGL::SyncPointState() { | |||
| 1311 | glDisable(GL_PROGRAM_POINT_SIZE); | 1312 | glDisable(GL_PROGRAM_POINT_SIZE); |
| 1312 | } | 1313 | } |
| 1313 | 1314 | ||
| 1315 | void RasterizerOpenGL::SyncLineState() { | ||
| 1316 | auto& gpu = system.GPU().Maxwell3D(); | ||
| 1317 | auto& flags = gpu.dirty.flags; | ||
| 1318 | if (!flags[Dirty::LineWidth]) { | ||
| 1319 | return; | ||
| 1320 | } | ||
| 1321 | flags[Dirty::LineWidth] = false; | ||
| 1322 | |||
| 1323 | const auto& regs = gpu.regs; | ||
| 1324 | oglEnable(GL_LINE_SMOOTH, regs.line_smooth_enable); | ||
| 1325 | glLineWidth(regs.line_smooth_enable ? regs.line_width_smooth : regs.line_width_aliased); | ||
| 1326 | } | ||
| 1327 | |||
| 1314 | void RasterizerOpenGL::SyncPolygonOffset() { | 1328 | void RasterizerOpenGL::SyncPolygonOffset() { |
| 1315 | auto& gpu = system.GPU().Maxwell3D(); | 1329 | auto& gpu = system.GPU().Maxwell3D(); |
| 1316 | auto& flags = gpu.dirty.flags; | 1330 | auto& flags = gpu.dirty.flags; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 212dad852..435da4425 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h | |||
| @@ -171,6 +171,9 @@ private: | |||
| 171 | /// Syncs the point state to match the guest state | 171 | /// Syncs the point state to match the guest state |
| 172 | void SyncPointState(); | 172 | void SyncPointState(); |
| 173 | 173 | ||
| 174 | /// Syncs the line state to match the guest state | ||
| 175 | void SyncLineState(); | ||
| 176 | |||
| 174 | /// Syncs the rasterizer enable state to match the guest state | 177 | /// Syncs the rasterizer enable state to match the guest state |
| 175 | void SyncRasterizeEnable(); | 178 | void SyncRasterizeEnable(); |
| 176 | 179 | ||
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp index 255ac3147..d24fad3de 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.cpp +++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp | |||
| @@ -185,6 +185,12 @@ void SetupDirtyPointSize(Tables& tables) { | |||
| 185 | tables[0][OFF(point_sprite_enable)] = PointSize; | 185 | tables[0][OFF(point_sprite_enable)] = PointSize; |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | void SetupDirtyLineWidth(Tables& tables) { | ||
| 189 | tables[0][OFF(line_width_smooth)] = LineWidth; | ||
| 190 | tables[0][OFF(line_width_aliased)] = LineWidth; | ||
| 191 | tables[0][OFF(line_smooth_enable)] = LineWidth; | ||
| 192 | } | ||
| 193 | |||
| 188 | void SetupDirtyClipControl(Tables& tables) { | 194 | void SetupDirtyClipControl(Tables& tables) { |
| 189 | auto& table = tables[0]; | 195 | auto& table = tables[0]; |
| 190 | table[OFF(screen_y_control)] = ClipControl; | 196 | table[OFF(screen_y_control)] = ClipControl; |
| @@ -233,6 +239,7 @@ void StateTracker::Initialize() { | |||
| 233 | SetupDirtyLogicOp(tables); | 239 | SetupDirtyLogicOp(tables); |
| 234 | SetupDirtyFragmentClampColor(tables); | 240 | SetupDirtyFragmentClampColor(tables); |
| 235 | SetupDirtyPointSize(tables); | 241 | SetupDirtyPointSize(tables); |
| 242 | SetupDirtyLineWidth(tables); | ||
| 236 | SetupDirtyClipControl(tables); | 243 | SetupDirtyClipControl(tables); |
| 237 | SetupDirtyDepthClampEnabled(tables); | 244 | SetupDirtyDepthClampEnabled(tables); |
| 238 | SetupDirtyMisc(tables); | 245 | SetupDirtyMisc(tables); |
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.h b/src/video_core/renderer_opengl/gl_state_tracker.h index b882d75c3..0f823288e 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.h +++ b/src/video_core/renderer_opengl/gl_state_tracker.h | |||
| @@ -78,6 +78,7 @@ enum : u8 { | |||
| 78 | LogicOp, | 78 | LogicOp, |
| 79 | FragmentClampColor, | 79 | FragmentClampColor, |
| 80 | PointSize, | 80 | PointSize, |
| 81 | LineWidth, | ||
| 81 | ClipControl, | 82 | ClipControl, |
| 82 | DepthClampEnabled, | 83 | DepthClampEnabled, |
| 83 | 84 | ||