summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_texture_cache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/renderer_opengl/gl_texture_cache.cpp')
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index 0b9c4a904..032a8ebc5 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -803,30 +803,40 @@ void Image::UploadMemory(const ImageBufferMap& map,
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
- glBindBuffer(GL_PIXEL_PACK_BUFFER, buffer_handle);
- glPixelStorei(GL_PACK_ALIGNMENT, 1);
+ 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);
- u32 current_row_length = std::numeric_limits<u32>::max();
- u32 current_image_height = std::numeric_limits<u32>::max();
+ u32 current_row_length = std::numeric_limits<u32>::max();
+ u32 current_image_height = std::numeric_limits<u32>::max();
- for (const VideoCommon::BufferImageCopy& copy : copies) {
- if (copy.image_subresource.base_level >= gl_num_levels) {
- continue;
- }
- if (current_row_length != copy.buffer_row_length) {
- current_row_length = copy.buffer_row_length;
- glPixelStorei(GL_PACK_ROW_LENGTH, current_row_length);
- }
- if (current_image_height != copy.buffer_image_height) {
- current_image_height = copy.buffer_image_height;
- glPixelStorei(GL_PACK_IMAGE_HEIGHT, current_image_height);
+ for (const VideoCommon::BufferImageCopy& copy : copies) {
+ if (copy.image_subresource.base_level >= gl_num_levels) {
+ continue;
+ }
+ if (current_row_length != copy.buffer_row_length) {
+ current_row_length = copy.buffer_row_length;
+ glPixelStorei(GL_PACK_ROW_LENGTH, current_row_length);
+ }
+ if (current_image_height != copy.buffer_image_height) {
+ current_image_height = copy.buffer_image_height;
+ glPixelStorei(GL_PACK_IMAGE_HEIGHT, current_image_height);
+ }
+ CopyImageToBuffer(copy, buffer_offsets[i]);
}
- CopyImageToBuffer(copy, buffer_offset);
}
if (is_rescaled) {
ScaleUp(true);