diff options
| author | 2018-10-12 22:31:04 -0400 | |
|---|---|---|
| committer | 2018-10-16 11:31:01 -0400 | |
| commit | 3afdfd7bfa50399ace417114786fedf429d44e70 (patch) | |
| tree | 5262bd04f25be2b412549759cadfacf169f5ef26 /src | |
| parent | gl_rasterizer_cache: Remove usage of Memory::Read/Write functions. (diff) | |
| download | yuzu-3afdfd7bfa50399ace417114786fedf429d44e70.tar.gz yuzu-3afdfd7bfa50399ace417114786fedf429d44e70.tar.xz yuzu-3afdfd7bfa50399ace417114786fedf429d44e70.zip | |
gl_rasterizer: Implement flushing.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 8d5f277e2..18db07217 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -424,6 +424,13 @@ void RasterizerOpenGL::ConfigureFramebuffers(bool using_color_fb, bool using_dep | |||
| 424 | // Used when just a single color attachment is enabled, e.g. for clearing a color buffer | 424 | // Used when just a single color attachment is enabled, e.g. for clearing a color buffer |
| 425 | Surface color_surface = | 425 | Surface color_surface = |
| 426 | res_cache.GetColorBufferSurface(*single_color_target, preserve_contents); | 426 | res_cache.GetColorBufferSurface(*single_color_target, preserve_contents); |
| 427 | |||
| 428 | if (color_surface) { | ||
| 429 | // Assume that a surface will be written to if it is used as a framebuffer, even if | ||
| 430 | // the shader doesn't actually write to it. | ||
| 431 | color_surface->MarkAsDirty(); | ||
| 432 | } | ||
| 433 | |||
| 427 | glFramebufferTexture2D( | 434 | glFramebufferTexture2D( |
| 428 | GL_DRAW_FRAMEBUFFER, | 435 | GL_DRAW_FRAMEBUFFER, |
| 429 | GL_COLOR_ATTACHMENT0 + static_cast<GLenum>(*single_color_target), GL_TEXTURE_2D, | 436 | GL_COLOR_ATTACHMENT0 + static_cast<GLenum>(*single_color_target), GL_TEXTURE_2D, |
| @@ -434,6 +441,13 @@ void RasterizerOpenGL::ConfigureFramebuffers(bool using_color_fb, bool using_dep | |||
| 434 | std::array<GLenum, Maxwell::NumRenderTargets> buffers; | 441 | std::array<GLenum, Maxwell::NumRenderTargets> buffers; |
| 435 | for (std::size_t index = 0; index < Maxwell::NumRenderTargets; ++index) { | 442 | for (std::size_t index = 0; index < Maxwell::NumRenderTargets; ++index) { |
| 436 | Surface color_surface = res_cache.GetColorBufferSurface(index, preserve_contents); | 443 | Surface color_surface = res_cache.GetColorBufferSurface(index, preserve_contents); |
| 444 | |||
| 445 | if (color_surface) { | ||
| 446 | // Assume that a surface will be written to if it is used as a framebuffer, even | ||
| 447 | // if the shader doesn't actually write to it. | ||
| 448 | color_surface->MarkAsDirty(); | ||
| 449 | } | ||
| 450 | |||
| 437 | buffers[index] = GL_COLOR_ATTACHMENT0 + regs.rt_control.GetMap(index); | 451 | buffers[index] = GL_COLOR_ATTACHMENT0 + regs.rt_control.GetMap(index); |
| 438 | glFramebufferTexture2D( | 452 | glFramebufferTexture2D( |
| 439 | GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + static_cast<GLenum>(index), | 453 | GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + static_cast<GLenum>(index), |
| @@ -453,6 +467,10 @@ void RasterizerOpenGL::ConfigureFramebuffers(bool using_color_fb, bool using_dep | |||
| 453 | } | 467 | } |
| 454 | 468 | ||
| 455 | if (depth_surface) { | 469 | if (depth_surface) { |
| 470 | // Assume that a surface will be written to if it is used as a framebuffer, even if | ||
| 471 | // the shader doesn't actually write to it. | ||
| 472 | depth_surface->MarkAsDirty(); | ||
| 473 | |||
| 456 | if (regs.stencil_enable) { | 474 | if (regs.stencil_enable) { |
| 457 | // Attach both depth and stencil | 475 | // Attach both depth and stencil |
| 458 | glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, | 476 | glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, |
| @@ -617,7 +635,12 @@ void RasterizerOpenGL::DrawArrays() { | |||
| 617 | 635 | ||
| 618 | void RasterizerOpenGL::FlushAll() {} | 636 | void RasterizerOpenGL::FlushAll() {} |
| 619 | 637 | ||
| 620 | void RasterizerOpenGL::FlushRegion(VAddr addr, u64 size) {} | 638 | void RasterizerOpenGL::FlushRegion(VAddr addr, u64 size) { |
| 639 | MICROPROFILE_SCOPE(OpenGL_CacheManagement); | ||
| 640 | res_cache.FlushRegion(addr, size); | ||
| 641 | shader_cache.FlushRegion(addr, size); | ||
| 642 | buffer_cache.FlushRegion(addr, size); | ||
| 643 | } | ||
| 621 | 644 | ||
| 622 | void RasterizerOpenGL::InvalidateRegion(VAddr addr, u64 size) { | 645 | void RasterizerOpenGL::InvalidateRegion(VAddr addr, u64 size) { |
| 623 | MICROPROFILE_SCOPE(OpenGL_CacheManagement); | 646 | MICROPROFILE_SCOPE(OpenGL_CacheManagement); |
| @@ -627,6 +650,7 @@ void RasterizerOpenGL::InvalidateRegion(VAddr addr, u64 size) { | |||
| 627 | } | 650 | } |
| 628 | 651 | ||
| 629 | void RasterizerOpenGL::FlushAndInvalidateRegion(VAddr addr, u64 size) { | 652 | void RasterizerOpenGL::FlushAndInvalidateRegion(VAddr addr, u64 size) { |
| 653 | FlushRegion(addr, size); | ||
| 630 | InvalidateRegion(addr, size); | 654 | InvalidateRegion(addr, size); |
| 631 | } | 655 | } |
| 632 | 656 | ||