diff options
| author | 2020-04-13 10:19:59 -0400 | |
|---|---|---|
| committer | 2020-04-13 10:19:59 -0400 | |
| commit | fbf13d3f48c1a75edbdf1a33bc5f29c1483a5099 (patch) | |
| tree | 321ded876262082f12dfeab470589c3cfc64ac2d /src/video_core/renderer_opengl | |
| 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/video_core/renderer_opengl')
4 files changed, 25 insertions, 0 deletions
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 | ||