summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2023-04-23 21:37:13 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2023-04-29 15:31:38 +0200
commit4bc5469f52157cd18e697120df40e40e32365e89 (patch)
tree43879297dd91ac1ab824010610e724c37ec3cb95 /src/video_core/renderer_opengl
parentAddress Feedback & Clang Format (diff)
downloadyuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar
yuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar.gz
yuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar.bz2
yuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar.lz
yuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar.xz
yuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar.zst
yuzu-4bc5469f52157cd18e697120df40e40e32365e89.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp19
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.h5
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,
UploadMemory(map.buffer, map.offset, copies);
}
-void Image::DownloadMemory(std::span<GLuint> buffer_handles, size_t buffer_offset,
+void Image::DownloadMemory(GLuint buffer_handle, size_t buffer_offset,
+ std::span<const VideoCommon::BufferImageCopy> copies) {
+ std::array buffer_handles{buffer_handle};
+ std::array buffer_offsets{buffer_offset};
+ DownloadMemory(buffer_handles, buffer_offsets, copies);
+}
+
+void Image::DownloadMemory(std::span<GLuint> buffer_handles, std::span<size_t> buffer_offsets,
std::span<const VideoCommon::BufferImageCopy> copies) {
const bool is_rescaled = True(flags & ImageFlagBits::Rescaled);
if (is_rescaled) {
ScaleDown();
}
glMemoryBarrier(GL_PIXEL_BUFFER_BARRIER_BIT); // TODO: Move this to its own API
- for (auto buffer_handle : buffer_handles) {
+ for (size_t i = 0; i < buffer_handles.size(); i++) {
+ auto& buffer_handle = buffer_handles[i];
glBindBuffer(GL_PIXEL_PACK_BUFFER, buffer_handle);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
@@ -827,7 +835,7 @@ void Image::DownloadMemory(std::span<GLuint> buffer_handles, size_t buffer_offse
current_image_height = copy.buffer_image_height;
glPixelStorei(GL_PACK_IMAGE_HEIGHT, current_image_height);
}
- CopyImageToBuffer(copy, buffer_offset);
+ CopyImageToBuffer(copy, buffer_offsets[i]);
}
}
if (is_rescaled) {
@@ -837,10 +845,7 @@ void Image::DownloadMemory(std::span<GLuint> buffer_handles, size_t buffer_offse
void Image::DownloadMemory(ImageBufferMap& map,
std::span<const VideoCommon::BufferImageCopy> copies) {
- std::array buffers{
- map.buffer,
- };
- DownloadMemory(buffers, map.offset, copies);
+ DownloadMemory(map.buffer, map.offset, copies);
}
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:
void UploadMemory(const ImageBufferMap& map,
std::span<const VideoCommon::BufferImageCopy> copies);
- void DownloadMemory(std::span<GLuint> buffer_handle, size_t buffer_offset,
+ void DownloadMemory(GLuint buffer_handle, size_t buffer_offset,
+ std::span<const VideoCommon::BufferImageCopy> copies);
+
+ void DownloadMemory(std::span<GLuint> buffer_handle, std::span<size_t> buffer_offset,
std::span<const VideoCommon::BufferImageCopy> copies);
void DownloadMemory(ImageBufferMap& map, std::span<const VideoCommon::BufferImageCopy> copies);