diff options
| author | 2023-04-23 21:37:13 +0200 | |
|---|---|---|
| committer | 2023-04-29 15:31:38 +0200 | |
| commit | 4bc5469f52157cd18e697120df40e40e32365e89 (patch) | |
| tree | 43879297dd91ac1ab824010610e724c37ec3cb95 /src/video_core/renderer_opengl | |
| parent | Address Feedback & Clang Format (diff) | |
| download | yuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar.gz yuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar.xz yuzu-4bc5469f52157cd18e697120df40e40e32365e89.zip | |
Texture Cache: Release stagging buffers on tick frame
Diffstat (limited to 'src/video_core/renderer_opengl')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 19 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.h | 5 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 670d8cafd..032a8ebc5 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -801,14 +801,22 @@ void Image::UploadMemory(const ImageBufferMap& map, | |||
| 801 | UploadMemory(map.buffer, map.offset, copies); | 801 | UploadMemory(map.buffer, map.offset, copies); |
| 802 | } | 802 | } |
| 803 | 803 | ||
| 804 | void Image::DownloadMemory(std::span<GLuint> buffer_handles, size_t buffer_offset, | 804 | void Image::DownloadMemory(GLuint buffer_handle, size_t buffer_offset, |
| 805 | std::span<const VideoCommon::BufferImageCopy> copies) { | ||
| 806 | std::array buffer_handles{buffer_handle}; | ||
| 807 | std::array buffer_offsets{buffer_offset}; | ||
| 808 | DownloadMemory(buffer_handles, buffer_offsets, copies); | ||
| 809 | } | ||
| 810 | |||
| 811 | void Image::DownloadMemory(std::span<GLuint> buffer_handles, std::span<size_t> buffer_offsets, | ||
| 805 | std::span<const VideoCommon::BufferImageCopy> copies) { | 812 | std::span<const VideoCommon::BufferImageCopy> copies) { |
| 806 | const bool is_rescaled = True(flags & ImageFlagBits::Rescaled); | 813 | const bool is_rescaled = True(flags & ImageFlagBits::Rescaled); |
| 807 | if (is_rescaled) { | 814 | if (is_rescaled) { |
| 808 | ScaleDown(); | 815 | ScaleDown(); |
| 809 | } | 816 | } |
| 810 | glMemoryBarrier(GL_PIXEL_BUFFER_BARRIER_BIT); // TODO: Move this to its own API | 817 | glMemoryBarrier(GL_PIXEL_BUFFER_BARRIER_BIT); // TODO: Move this to its own API |
| 811 | for (auto buffer_handle : buffer_handles) { | 818 | for (size_t i = 0; i < buffer_handles.size(); i++) { |
| 819 | auto& buffer_handle = buffer_handles[i]; | ||
| 812 | glBindBuffer(GL_PIXEL_PACK_BUFFER, buffer_handle); | 820 | glBindBuffer(GL_PIXEL_PACK_BUFFER, buffer_handle); |
| 813 | glPixelStorei(GL_PACK_ALIGNMENT, 1); | 821 | glPixelStorei(GL_PACK_ALIGNMENT, 1); |
| 814 | 822 | ||
| @@ -827,7 +835,7 @@ void Image::DownloadMemory(std::span<GLuint> buffer_handles, size_t buffer_offse | |||
| 827 | current_image_height = copy.buffer_image_height; | 835 | current_image_height = copy.buffer_image_height; |
| 828 | glPixelStorei(GL_PACK_IMAGE_HEIGHT, current_image_height); | 836 | glPixelStorei(GL_PACK_IMAGE_HEIGHT, current_image_height); |
| 829 | } | 837 | } |
| 830 | CopyImageToBuffer(copy, buffer_offset); | 838 | CopyImageToBuffer(copy, buffer_offsets[i]); |
| 831 | } | 839 | } |
| 832 | } | 840 | } |
| 833 | if (is_rescaled) { | 841 | if (is_rescaled) { |
| @@ -837,10 +845,7 @@ void Image::DownloadMemory(std::span<GLuint> buffer_handles, size_t buffer_offse | |||
| 837 | 845 | ||
| 838 | void Image::DownloadMemory(ImageBufferMap& map, | 846 | void Image::DownloadMemory(ImageBufferMap& map, |
| 839 | std::span<const VideoCommon::BufferImageCopy> copies) { | 847 | std::span<const VideoCommon::BufferImageCopy> copies) { |
| 840 | std::array buffers{ | 848 | DownloadMemory(map.buffer, map.offset, copies); |
| 841 | map.buffer, | ||
| 842 | }; | ||
| 843 | DownloadMemory(buffers, map.offset, copies); | ||
| 844 | } | 849 | } |
| 845 | 850 | ||
| 846 | GLuint Image::StorageHandle() noexcept { | 851 | GLuint Image::StorageHandle() noexcept { |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index 67d6910b4..0dd039ed2 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h | |||
| @@ -212,7 +212,10 @@ public: | |||
| 212 | void UploadMemory(const ImageBufferMap& map, | 212 | void UploadMemory(const ImageBufferMap& map, |
| 213 | std::span<const VideoCommon::BufferImageCopy> copies); | 213 | std::span<const VideoCommon::BufferImageCopy> copies); |
| 214 | 214 | ||
| 215 | void DownloadMemory(std::span<GLuint> buffer_handle, size_t buffer_offset, | 215 | void DownloadMemory(GLuint buffer_handle, size_t buffer_offset, |
| 216 | std::span<const VideoCommon::BufferImageCopy> copies); | ||
| 217 | |||
| 218 | void DownloadMemory(std::span<GLuint> buffer_handle, std::span<size_t> buffer_offset, | ||
| 216 | std::span<const VideoCommon::BufferImageCopy> copies); | 219 | std::span<const VideoCommon::BufferImageCopy> copies); |
| 217 | 220 | ||
| 218 | void DownloadMemory(ImageBufferMap& map, std::span<const VideoCommon::BufferImageCopy> copies); | 221 | void DownloadMemory(ImageBufferMap& map, std::span<const VideoCommon::BufferImageCopy> copies); |