diff options
| -rw-r--r-- | src/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | src/video_core/gpu_thread.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/rasterizer_cache.h | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_buffer_cache.h | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_global_cache.h | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 26 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 28 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.h | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 11 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_buffer_cache.h | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/shader/decode/texture.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/textures/astc.cpp | 8 |
14 files changed, 64 insertions, 56 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a1d87bbbc..04018233f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt | |||
| @@ -27,6 +27,7 @@ if (MSVC) | |||
| 27 | # /Zo - Enhanced debug info for optimized builds | 27 | # /Zo - Enhanced debug info for optimized builds |
| 28 | # /permissive- - Enables stricter C++ standards conformance checks | 28 | # /permissive- - Enables stricter C++ standards conformance checks |
| 29 | # /EHsc - C++-only exception handling semantics | 29 | # /EHsc - C++-only exception handling semantics |
| 30 | # /volatile:iso - Use strict standards-compliant volatile semantics. | ||
| 30 | # /Zc:externConstexpr - Allow extern constexpr variables to have external linkage, like the standard mandates | 31 | # /Zc:externConstexpr - Allow extern constexpr variables to have external linkage, like the standard mandates |
| 31 | # /Zc:inline - Let codegen omit inline functions in object files | 32 | # /Zc:inline - Let codegen omit inline functions in object files |
| 32 | # /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null | 33 | # /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null |
| @@ -38,6 +39,7 @@ if (MSVC) | |||
| 38 | /permissive- | 39 | /permissive- |
| 39 | /EHsc | 40 | /EHsc |
| 40 | /std:c++latest | 41 | /std:c++latest |
| 42 | /volatile:iso | ||
| 41 | /Zc:externConstexpr | 43 | /Zc:externConstexpr |
| 42 | /Zc:inline | 44 | /Zc:inline |
| 43 | /Zc:throwingNew | 45 | /Zc:throwingNew |
| @@ -49,7 +51,10 @@ if (MSVC) | |||
| 49 | set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE) | 51 | set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE) |
| 50 | set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE) | 52 | set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE) |
| 51 | else() | 53 | else() |
| 52 | add_compile_options("-Wno-attributes") | 54 | add_compile_options( |
| 55 | -Wall | ||
| 56 | -Wno-attributes | ||
| 57 | ) | ||
| 53 | 58 | ||
| 54 | if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang) | 59 | if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang) |
| 55 | add_compile_options("-stdlib=libc++") | 60 | add_compile_options("-stdlib=libc++") |
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index c9a2077de..03856013f 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp | |||
| @@ -44,7 +44,7 @@ static void RunThread(VideoCore::RendererBase& renderer, Tegra::DmaPusher& dma_p | |||
| 44 | renderer.Rasterizer().FlushRegion(data->addr, data->size); | 44 | renderer.Rasterizer().FlushRegion(data->addr, data->size); |
| 45 | } else if (const auto data = std::get_if<InvalidateRegionCommand>(&next.data)) { | 45 | } else if (const auto data = std::get_if<InvalidateRegionCommand>(&next.data)) { |
| 46 | renderer.Rasterizer().InvalidateRegion(data->addr, data->size); | 46 | renderer.Rasterizer().InvalidateRegion(data->addr, data->size); |
| 47 | } else if (const auto data = std::get_if<EndProcessingCommand>(&next.data)) { | 47 | } else if (std::holds_alternative<EndProcessingCommand>(next.data)) { |
| 48 | return; | 48 | return; |
| 49 | } else { | 49 | } else { |
| 50 | UNREACHABLE(); | 50 | UNREACHABLE(); |
diff --git a/src/video_core/rasterizer_cache.h b/src/video_core/rasterizer_cache.h index 291772186..f820f3ed9 100644 --- a/src/video_core/rasterizer_cache.h +++ b/src/video_core/rasterizer_cache.h | |||
| @@ -37,9 +37,6 @@ public: | |||
| 37 | /// Gets the size of the shader in guest memory, required for cache management | 37 | /// Gets the size of the shader in guest memory, required for cache management |
| 38 | virtual std::size_t GetSizeInBytes() const = 0; | 38 | virtual std::size_t GetSizeInBytes() const = 0; |
| 39 | 39 | ||
| 40 | /// Wriets any cached resources back to memory | ||
| 41 | virtual void Flush() = 0; | ||
| 42 | |||
| 43 | /// Sets whether the cached object should be considered registered | 40 | /// Sets whether the cached object should be considered registered |
| 44 | void SetIsRegistered(bool registered) { | 41 | void SetIsRegistered(bool registered) { |
| 45 | is_registered = registered; | 42 | is_registered = registered; |
| @@ -158,6 +155,8 @@ protected: | |||
| 158 | return ++modified_ticks; | 155 | return ++modified_ticks; |
| 159 | } | 156 | } |
| 160 | 157 | ||
| 158 | virtual void FlushObjectInner(const T& object) = 0; | ||
| 159 | |||
| 161 | /// Flushes the specified object, updating appropriate cache state as needed | 160 | /// Flushes the specified object, updating appropriate cache state as needed |
| 162 | void FlushObject(const T& object) { | 161 | void FlushObject(const T& object) { |
| 163 | std::lock_guard lock{mutex}; | 162 | std::lock_guard lock{mutex}; |
| @@ -165,7 +164,7 @@ protected: | |||
| 165 | if (!object->IsDirty()) { | 164 | if (!object->IsDirty()) { |
| 166 | return; | 165 | return; |
| 167 | } | 166 | } |
| 168 | object->Flush(); | 167 | FlushObjectInner(object); |
| 169 | object->MarkAsModified(false, *this); | 168 | object->MarkAsModified(false, *this); |
| 170 | } | 169 | } |
| 171 | 170 | ||
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index fc33aa433..f9247a40e 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h | |||
| @@ -42,9 +42,6 @@ public: | |||
| 42 | return alignment; | 42 | return alignment; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | // We do not have to flush this cache as things in it are never modified by us. | ||
| 46 | void Flush() override {} | ||
| 47 | |||
| 48 | private: | 45 | private: |
| 49 | VAddr cpu_addr{}; | 46 | VAddr cpu_addr{}; |
| 50 | std::size_t size{}; | 47 | std::size_t size{}; |
| @@ -75,6 +72,9 @@ public: | |||
| 75 | protected: | 72 | protected: |
| 76 | void AlignBuffer(std::size_t alignment); | 73 | void AlignBuffer(std::size_t alignment); |
| 77 | 74 | ||
| 75 | // We do not have to flush this cache as things in it are never modified by us. | ||
| 76 | void FlushObjectInner(const std::shared_ptr<CachedBufferEntry>& object) override {} | ||
| 77 | |||
| 78 | private: | 78 | private: |
| 79 | OGLStreamBuffer stream_buffer; | 79 | OGLStreamBuffer stream_buffer; |
| 80 | 80 | ||
diff --git a/src/video_core/renderer_opengl/gl_global_cache.h b/src/video_core/renderer_opengl/gl_global_cache.h index 196e6e278..2d467a240 100644 --- a/src/video_core/renderer_opengl/gl_global_cache.h +++ b/src/video_core/renderer_opengl/gl_global_cache.h | |||
| @@ -46,7 +46,7 @@ public: | |||
| 46 | /// Reloads the global region from guest memory | 46 | /// Reloads the global region from guest memory |
| 47 | void Reload(u32 size_); | 47 | void Reload(u32 size_); |
| 48 | 48 | ||
| 49 | void Flush() override; | 49 | void Flush(); |
| 50 | 50 | ||
| 51 | private: | 51 | private: |
| 52 | VAddr cpu_addr{}; | 52 | VAddr cpu_addr{}; |
| @@ -65,6 +65,11 @@ public: | |||
| 65 | GlobalRegion GetGlobalRegion(const GLShader::GlobalMemoryEntry& descriptor, | 65 | GlobalRegion GetGlobalRegion(const GLShader::GlobalMemoryEntry& descriptor, |
| 66 | Tegra::Engines::Maxwell3D::Regs::ShaderStage stage); | 66 | Tegra::Engines::Maxwell3D::Regs::ShaderStage stage); |
| 67 | 67 | ||
| 68 | protected: | ||
| 69 | void FlushObjectInner(const GlobalRegion& object) override { | ||
| 70 | object->Flush(); | ||
| 71 | } | ||
| 72 | |||
| 68 | private: | 73 | private: |
| 69 | GlobalRegion TryGetReservedGlobalRegion(CacheAddr addr, u32 size) const; | 74 | GlobalRegion TryGetReservedGlobalRegion(CacheAddr addr, u32 size) const; |
| 70 | GlobalRegion GetUncachedGlobalRegion(GPUVAddr addr, u8* host_ptr, u32 size); | 75 | GlobalRegion GetUncachedGlobalRegion(GPUVAddr addr, u8* host_ptr, u32 size); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 5a25f5b37..a7681902e 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -628,9 +628,11 @@ CachedSurface::CachedSurface(const SurfaceParams& params) | |||
| 628 | } | 628 | } |
| 629 | 629 | ||
| 630 | MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 192, 64)); | 630 | MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 192, 64)); |
| 631 | void CachedSurface::LoadGLBuffer() { | 631 | void CachedSurface::LoadGLBuffer(RasterizerTemporaryMemory& res_cache_tmp_mem) { |
| 632 | MICROPROFILE_SCOPE(OpenGL_SurfaceLoad); | 632 | MICROPROFILE_SCOPE(OpenGL_SurfaceLoad); |
| 633 | gl_buffer.resize(params.max_mip_level); | 633 | auto& gl_buffer = res_cache_tmp_mem.gl_buffer; |
| 634 | if (gl_buffer.size() < params.max_mip_level) | ||
| 635 | gl_buffer.resize(params.max_mip_level); | ||
| 634 | for (u32 i = 0; i < params.max_mip_level; i++) | 636 | for (u32 i = 0; i < params.max_mip_level; i++) |
| 635 | gl_buffer[i].resize(params.GetMipmapSizeGL(i)); | 637 | gl_buffer[i].resize(params.GetMipmapSizeGL(i)); |
| 636 | if (params.is_tiled) { | 638 | if (params.is_tiled) { |
| @@ -671,13 +673,13 @@ void CachedSurface::LoadGLBuffer() { | |||
| 671 | } | 673 | } |
| 672 | 674 | ||
| 673 | MICROPROFILE_DEFINE(OpenGL_SurfaceFlush, "OpenGL", "Surface Flush", MP_RGB(128, 192, 64)); | 675 | MICROPROFILE_DEFINE(OpenGL_SurfaceFlush, "OpenGL", "Surface Flush", MP_RGB(128, 192, 64)); |
| 674 | void CachedSurface::FlushGLBuffer() { | 676 | void CachedSurface::FlushGLBuffer(RasterizerTemporaryMemory& res_cache_tmp_mem) { |
| 675 | MICROPROFILE_SCOPE(OpenGL_SurfaceFlush); | 677 | MICROPROFILE_SCOPE(OpenGL_SurfaceFlush); |
| 676 | 678 | ||
| 677 | ASSERT_MSG(!IsPixelFormatASTC(params.pixel_format), "Unimplemented"); | 679 | ASSERT_MSG(!IsPixelFormatASTC(params.pixel_format), "Unimplemented"); |
| 678 | 680 | ||
| 681 | auto& gl_buffer = res_cache_tmp_mem.gl_buffer; | ||
| 679 | // OpenGL temporary buffer needs to be big enough to store raw texture size | 682 | // OpenGL temporary buffer needs to be big enough to store raw texture size |
| 680 | gl_buffer.resize(1); | ||
| 681 | gl_buffer[0].resize(GetSizeInBytes()); | 683 | gl_buffer[0].resize(GetSizeInBytes()); |
| 682 | 684 | ||
| 683 | const FormatTuple& tuple = GetFormatTuple(params.pixel_format, params.component_type); | 685 | const FormatTuple& tuple = GetFormatTuple(params.pixel_format, params.component_type); |
| @@ -713,10 +715,12 @@ void CachedSurface::FlushGLBuffer() { | |||
| 713 | } | 715 | } |
| 714 | } | 716 | } |
| 715 | 717 | ||
| 716 | void CachedSurface::UploadGLMipmapTexture(u32 mip_map, GLuint read_fb_handle, | 718 | void CachedSurface::UploadGLMipmapTexture(RasterizerTemporaryMemory& res_cache_tmp_mem, u32 mip_map, |
| 717 | GLuint draw_fb_handle) { | 719 | GLuint read_fb_handle, GLuint draw_fb_handle) { |
| 718 | const auto& rect{params.GetRect(mip_map)}; | 720 | const auto& rect{params.GetRect(mip_map)}; |
| 719 | 721 | ||
| 722 | auto& gl_buffer = res_cache_tmp_mem.gl_buffer; | ||
| 723 | |||
| 720 | // Load data from memory to the surface | 724 | // Load data from memory to the surface |
| 721 | const auto x0 = static_cast<GLint>(rect.left); | 725 | const auto x0 = static_cast<GLint>(rect.left); |
| 722 | const auto y0 = static_cast<GLint>(rect.bottom); | 726 | const auto y0 = static_cast<GLint>(rect.bottom); |
| @@ -801,7 +805,6 @@ void CachedSurface::UploadGLMipmapTexture(u32 mip_map, GLuint read_fb_handle, | |||
| 801 | tuple.type, &gl_buffer[mip_map][buffer_offset]); | 805 | tuple.type, &gl_buffer[mip_map][buffer_offset]); |
| 802 | break; | 806 | break; |
| 803 | case SurfaceTarget::TextureCubemap: { | 807 | case SurfaceTarget::TextureCubemap: { |
| 804 | std::size_t start = buffer_offset; | ||
| 805 | for (std::size_t face = 0; face < params.depth; ++face) { | 808 | for (std::size_t face = 0; face < params.depth; ++face) { |
| 806 | glTextureSubImage3D(texture.handle, mip_map, x0, y0, static_cast<GLint>(face), | 809 | glTextureSubImage3D(texture.handle, mip_map, x0, y0, static_cast<GLint>(face), |
| 807 | static_cast<GLsizei>(rect.GetWidth()), | 810 | static_cast<GLsizei>(rect.GetWidth()), |
| @@ -845,11 +848,12 @@ void CachedSurface::EnsureTextureDiscrepantView() { | |||
| 845 | } | 848 | } |
| 846 | 849 | ||
| 847 | MICROPROFILE_DEFINE(OpenGL_TextureUL, "OpenGL", "Texture Upload", MP_RGB(128, 192, 64)); | 850 | MICROPROFILE_DEFINE(OpenGL_TextureUL, "OpenGL", "Texture Upload", MP_RGB(128, 192, 64)); |
| 848 | void CachedSurface::UploadGLTexture(GLuint read_fb_handle, GLuint draw_fb_handle) { | 851 | void CachedSurface::UploadGLTexture(RasterizerTemporaryMemory& res_cache_tmp_mem, |
| 852 | GLuint read_fb_handle, GLuint draw_fb_handle) { | ||
| 849 | MICROPROFILE_SCOPE(OpenGL_TextureUL); | 853 | MICROPROFILE_SCOPE(OpenGL_TextureUL); |
| 850 | 854 | ||
| 851 | for (u32 i = 0; i < params.max_mip_level; i++) | 855 | for (u32 i = 0; i < params.max_mip_level; i++) |
| 852 | UploadGLMipmapTexture(i, read_fb_handle, draw_fb_handle); | 856 | UploadGLMipmapTexture(res_cache_tmp_mem, i, read_fb_handle, draw_fb_handle); |
| 853 | } | 857 | } |
| 854 | 858 | ||
| 855 | void CachedSurface::UpdateSwizzle(Tegra::Texture::SwizzleSource swizzle_x, | 859 | void CachedSurface::UpdateSwizzle(Tegra::Texture::SwizzleSource swizzle_x, |
| @@ -929,8 +933,8 @@ Surface RasterizerCacheOpenGL::GetColorBufferSurface(std::size_t index, bool pre | |||
| 929 | } | 933 | } |
| 930 | 934 | ||
| 931 | void RasterizerCacheOpenGL::LoadSurface(const Surface& surface) { | 935 | void RasterizerCacheOpenGL::LoadSurface(const Surface& surface) { |
| 932 | surface->LoadGLBuffer(); | 936 | surface->LoadGLBuffer(temporal_memory); |
| 933 | surface->UploadGLTexture(read_framebuffer.handle, draw_framebuffer.handle); | 937 | surface->UploadGLTexture(temporal_memory, read_framebuffer.handle, draw_framebuffer.handle); |
| 934 | surface->MarkAsModified(false, *this); | 938 | surface->MarkAsModified(false, *this); |
| 935 | surface->MarkForReload(false); | 939 | surface->MarkForReload(false); |
| 936 | } | 940 | } |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index db280dbb3..6263ef3e7 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -355,6 +355,12 @@ namespace OpenGL { | |||
| 355 | 355 | ||
| 356 | class RasterizerOpenGL; | 356 | class RasterizerOpenGL; |
| 357 | 357 | ||
| 358 | // This is used to store temporary big buffers, | ||
| 359 | // instead of creating/destroying all the time | ||
| 360 | struct RasterizerTemporaryMemory { | ||
| 361 | std::vector<std::vector<u8>> gl_buffer; | ||
| 362 | }; | ||
| 363 | |||
| 358 | class CachedSurface final : public RasterizerCacheObject { | 364 | class CachedSurface final : public RasterizerCacheObject { |
| 359 | public: | 365 | public: |
| 360 | explicit CachedSurface(const SurfaceParams& params); | 366 | explicit CachedSurface(const SurfaceParams& params); |
| @@ -371,10 +377,6 @@ public: | |||
| 371 | return memory_size; | 377 | return memory_size; |
| 372 | } | 378 | } |
| 373 | 379 | ||
| 374 | void Flush() override { | ||
| 375 | FlushGLBuffer(); | ||
| 376 | } | ||
| 377 | |||
| 378 | const OGLTexture& Texture() const { | 380 | const OGLTexture& Texture() const { |
| 379 | return texture; | 381 | return texture; |
| 380 | } | 382 | } |
| @@ -397,11 +399,12 @@ public: | |||
| 397 | } | 399 | } |
| 398 | 400 | ||
| 399 | // Read/Write data in Switch memory to/from gl_buffer | 401 | // Read/Write data in Switch memory to/from gl_buffer |
| 400 | void LoadGLBuffer(); | 402 | void LoadGLBuffer(RasterizerTemporaryMemory& res_cache_tmp_mem); |
| 401 | void FlushGLBuffer(); | 403 | void FlushGLBuffer(RasterizerTemporaryMemory& res_cache_tmp_mem); |
| 402 | 404 | ||
| 403 | // Upload data in gl_buffer to this surface's texture | 405 | // Upload data in gl_buffer to this surface's texture |
| 404 | void UploadGLTexture(GLuint read_fb_handle, GLuint draw_fb_handle); | 406 | void UploadGLTexture(RasterizerTemporaryMemory& res_cache_tmp_mem, GLuint read_fb_handle, |
| 407 | GLuint draw_fb_handle); | ||
| 405 | 408 | ||
| 406 | void UpdateSwizzle(Tegra::Texture::SwizzleSource swizzle_x, | 409 | void UpdateSwizzle(Tegra::Texture::SwizzleSource swizzle_x, |
| 407 | Tegra::Texture::SwizzleSource swizzle_y, | 410 | Tegra::Texture::SwizzleSource swizzle_y, |
| @@ -429,13 +432,13 @@ public: | |||
| 429 | } | 432 | } |
| 430 | 433 | ||
| 431 | private: | 434 | private: |
| 432 | void UploadGLMipmapTexture(u32 mip_map, GLuint read_fb_handle, GLuint draw_fb_handle); | 435 | void UploadGLMipmapTexture(RasterizerTemporaryMemory& res_cache_tmp_mem, u32 mip_map, |
| 436 | GLuint read_fb_handle, GLuint draw_fb_handle); | ||
| 433 | 437 | ||
| 434 | void EnsureTextureDiscrepantView(); | 438 | void EnsureTextureDiscrepantView(); |
| 435 | 439 | ||
| 436 | OGLTexture texture; | 440 | OGLTexture texture; |
| 437 | OGLTexture discrepant_view; | 441 | OGLTexture discrepant_view; |
| 438 | std::vector<std::vector<u8>> gl_buffer; | ||
| 439 | SurfaceParams params{}; | 442 | SurfaceParams params{}; |
| 440 | GLenum gl_target{}; | 443 | GLenum gl_target{}; |
| 441 | GLenum gl_internal_format{}; | 444 | GLenum gl_internal_format{}; |
| @@ -473,6 +476,11 @@ public: | |||
| 473 | void SignalPreDrawCall(); | 476 | void SignalPreDrawCall(); |
| 474 | void SignalPostDrawCall(); | 477 | void SignalPostDrawCall(); |
| 475 | 478 | ||
| 479 | protected: | ||
| 480 | void FlushObjectInner(const Surface& object) override { | ||
| 481 | object->FlushGLBuffer(temporal_memory); | ||
| 482 | } | ||
| 483 | |||
| 476 | private: | 484 | private: |
| 477 | void LoadSurface(const Surface& surface); | 485 | void LoadSurface(const Surface& surface); |
| 478 | Surface GetSurface(const SurfaceParams& params, bool preserve_contents = true); | 486 | Surface GetSurface(const SurfaceParams& params, bool preserve_contents = true); |
| @@ -519,6 +527,8 @@ private: | |||
| 519 | std::array<Surface, Maxwell::NumRenderTargets> current_color_buffers; | 527 | std::array<Surface, Maxwell::NumRenderTargets> current_color_buffers; |
| 520 | Surface last_depth_buffer; | 528 | Surface last_depth_buffer; |
| 521 | 529 | ||
| 530 | RasterizerTemporaryMemory temporal_memory; | ||
| 531 | |||
| 522 | using SurfaceIntervalCache = boost::icl::interval_map<CacheAddr, Surface>; | 532 | using SurfaceIntervalCache = boost::icl::interval_map<CacheAddr, Surface>; |
| 523 | using SurfaceInterval = typename SurfaceIntervalCache::interval_type; | 533 | using SurfaceInterval = typename SurfaceIntervalCache::interval_type; |
| 524 | 534 | ||
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index b1c8f7c35..f700dc89a 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -345,7 +345,7 @@ ShaderDiskCacheUsage CachedShader::GetUsage(GLenum primitive_mode, | |||
| 345 | 345 | ||
| 346 | ShaderCacheOpenGL::ShaderCacheOpenGL(RasterizerOpenGL& rasterizer, Core::System& system, | 346 | ShaderCacheOpenGL::ShaderCacheOpenGL(RasterizerOpenGL& rasterizer, Core::System& system, |
| 347 | const Device& device) | 347 | const Device& device) |
| 348 | : RasterizerCache{rasterizer}, disk_cache{system}, device{device} {} | 348 | : RasterizerCache{rasterizer}, device{device}, disk_cache{system} {} |
| 349 | 349 | ||
| 350 | void ShaderCacheOpenGL::LoadDiskCache(const std::atomic_bool& stop_loading, | 350 | void ShaderCacheOpenGL::LoadDiskCache(const std::atomic_bool& stop_loading, |
| 351 | const VideoCore::DiskResourceLoadCallback& callback) { | 351 | const VideoCore::DiskResourceLoadCallback& callback) { |
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h index a332087f8..31b979987 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.h +++ b/src/video_core/renderer_opengl/gl_shader_cache.h | |||
| @@ -57,9 +57,6 @@ public: | |||
| 57 | return shader_length; | 57 | return shader_length; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | // We do not have to flush this cache as things in it are never modified by us. | ||
| 61 | void Flush() override {} | ||
| 62 | |||
| 63 | /// Gets the shader entries for the shader | 60 | /// Gets the shader entries for the shader |
| 64 | const GLShader::ShaderEntries& GetShaderEntries() const { | 61 | const GLShader::ShaderEntries& GetShaderEntries() const { |
| 65 | return entries; | 62 | return entries; |
| @@ -123,6 +120,10 @@ public: | |||
| 123 | /// Gets the current specified shader stage program | 120 | /// Gets the current specified shader stage program |
| 124 | Shader GetStageProgram(Maxwell::ShaderProgram program); | 121 | Shader GetStageProgram(Maxwell::ShaderProgram program); |
| 125 | 122 | ||
| 123 | protected: | ||
| 124 | // We do not have to flush this cache as things in it are never modified by us. | ||
| 125 | void FlushObjectInner(const Shader& object) override {} | ||
| 126 | |||
| 126 | private: | 127 | private: |
| 127 | std::unordered_map<u64, UnspecializedShader> GenerateUnspecializedShaders( | 128 | std::unordered_map<u64, UnspecializedShader> GenerateUnspecializedShaders( |
| 128 | const std::atomic_bool& stop_loading, const VideoCore::DiskResourceLoadCallback& callback, | 129 | const std::atomic_bool& stop_loading, const VideoCore::DiskResourceLoadCallback& callback, |
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index ef1a1995f..1a62795e1 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -871,17 +871,6 @@ private: | |||
| 871 | return {}; | 871 | return {}; |
| 872 | } | 872 | } |
| 873 | 873 | ||
| 874 | std::string Composite(Operation operation) { | ||
| 875 | std::string value = "vec4("; | ||
| 876 | for (std::size_t i = 0; i < 4; ++i) { | ||
| 877 | value += Visit(operation[i]); | ||
| 878 | if (i < 3) | ||
| 879 | value += ", "; | ||
| 880 | } | ||
| 881 | value += ')'; | ||
| 882 | return value; | ||
| 883 | } | ||
| 884 | |||
| 885 | template <Type type> | 874 | template <Type type> |
| 886 | std::string Add(Operation operation) { | 875 | std::string Add(Operation operation) { |
| 887 | return GenerateBinaryInfix(operation, "+", type, type, type); | 876 | return GenerateBinaryInfix(operation, "+", type, type, type); |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.h b/src/video_core/renderer_vulkan/vk_buffer_cache.h index 08b786aad..3edf460df 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.h +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.h | |||
| @@ -49,9 +49,6 @@ public: | |||
| 49 | return alignment; | 49 | return alignment; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | // We do not have to flush this cache as things in it are never modified by us. | ||
| 53 | void Flush() override {} | ||
| 54 | |||
| 55 | private: | 52 | private: |
| 56 | VAddr cpu_addr{}; | 53 | VAddr cpu_addr{}; |
| 57 | std::size_t size{}; | 54 | std::size_t size{}; |
| @@ -87,6 +84,10 @@ public: | |||
| 87 | return buffer_handle; | 84 | return buffer_handle; |
| 88 | } | 85 | } |
| 89 | 86 | ||
| 87 | protected: | ||
| 88 | // We do not have to flush this cache as things in it are never modified by us. | ||
| 89 | void FlushObjectInner(const std::shared_ptr<CachedBufferEntry>& object) override {} | ||
| 90 | |||
| 90 | private: | 91 | private: |
| 91 | void AlignBuffer(std::size_t alignment); | 92 | void AlignBuffer(std::size_t alignment); |
| 92 | 93 | ||
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index 23d9b10db..a11000f6b 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | |||
| @@ -315,7 +315,6 @@ private: | |||
| 315 | constexpr std::array<const char*, INTERNAL_FLAGS_COUNT> names = {"zero", "sign", "carry", | 315 | constexpr std::array<const char*, INTERNAL_FLAGS_COUNT> names = {"zero", "sign", "carry", |
| 316 | "overflow"}; | 316 | "overflow"}; |
| 317 | for (std::size_t flag = 0; flag < INTERNAL_FLAGS_COUNT; ++flag) { | 317 | for (std::size_t flag = 0; flag < INTERNAL_FLAGS_COUNT; ++flag) { |
| 318 | const auto flag_code = static_cast<InternalFlag>(flag); | ||
| 319 | const Id id = OpVariable(t_prv_bool, spv::StorageClass::Private, v_false); | 318 | const Id id = OpVariable(t_prv_bool, spv::StorageClass::Private, v_false); |
| 320 | internal_flags[flag] = AddGlobalVariable(Name(id, names[flag])); | 319 | internal_flags[flag] = AddGlobalVariable(Name(id, names[flag])); |
| 321 | } | 320 | } |
diff --git a/src/video_core/shader/decode/texture.cpp b/src/video_core/shader/decode/texture.cpp index 8b574d4e5..5b033126d 100644 --- a/src/video_core/shader/decode/texture.cpp +++ b/src/video_core/shader/decode/texture.cpp | |||
| @@ -540,7 +540,6 @@ Node4 ShaderIR::GetTexsCode(Instruction instr, TextureType texture_type, | |||
| 540 | Node4 ShaderIR::GetTld4Code(Instruction instr, TextureType texture_type, bool depth_compare, | 540 | Node4 ShaderIR::GetTld4Code(Instruction instr, TextureType texture_type, bool depth_compare, |
| 541 | bool is_array, bool is_aoffi) { | 541 | bool is_array, bool is_aoffi) { |
| 542 | const std::size_t coord_count = GetCoordCount(texture_type); | 542 | const std::size_t coord_count = GetCoordCount(texture_type); |
| 543 | const std::size_t total_coord_count = coord_count + (is_array ? 1 : 0); | ||
| 544 | 543 | ||
| 545 | // If enabled arrays index is always stored in the gpr8 field | 544 | // If enabled arrays index is always stored in the gpr8 field |
| 546 | const u64 array_register = instr.gpr8.Value(); | 545 | const u64 array_register = instr.gpr8.Value(); |
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp index eafb6b73a..a9b8f69af 100644 --- a/src/video_core/textures/astc.cpp +++ b/src/video_core/textures/astc.cpp | |||
| @@ -25,8 +25,8 @@ | |||
| 25 | 25 | ||
| 26 | class InputBitStream { | 26 | class InputBitStream { |
| 27 | public: | 27 | public: |
| 28 | explicit InputBitStream(const unsigned char* ptr, int nBits = 0, int start_offset = 0) | 28 | explicit InputBitStream(const unsigned char* ptr, int start_offset = 0) |
| 29 | : m_NumBits(nBits), m_CurByte(ptr), m_NextBit(start_offset % 8) {} | 29 | : m_CurByte(ptr), m_NextBit(start_offset % 8) {} |
| 30 | 30 | ||
| 31 | ~InputBitStream() = default; | 31 | ~InputBitStream() = default; |
| 32 | 32 | ||
| @@ -55,12 +55,9 @@ public: | |||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | private: | 57 | private: |
| 58 | const int m_NumBits; | ||
| 59 | const unsigned char* m_CurByte; | 58 | const unsigned char* m_CurByte; |
| 60 | int m_NextBit = 0; | 59 | int m_NextBit = 0; |
| 61 | int m_BitsRead = 0; | 60 | int m_BitsRead = 0; |
| 62 | |||
| 63 | bool done = false; | ||
| 64 | }; | 61 | }; |
| 65 | 62 | ||
| 66 | class OutputBitStream { | 63 | class OutputBitStream { |
| @@ -114,7 +111,6 @@ private: | |||
| 114 | const int m_NumBits; | 111 | const int m_NumBits; |
| 115 | unsigned char* m_CurByte; | 112 | unsigned char* m_CurByte; |
| 116 | int m_NextBit = 0; | 113 | int m_NextBit = 0; |
| 117 | int m_BitsRead = 0; | ||
| 118 | 114 | ||
| 119 | bool done = false; | 115 | bool done = false; |
| 120 | }; | 116 | }; |