summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index 7ded7415d..fafee62ee 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -1264,25 +1264,24 @@ Framebuffer::Framebuffer(TextureCacheRuntime& runtime, std::span<ImageView*, NUM
1264void BGRCopyPass::CopyBGR(Image& dst_image, Image& src_image, 1264void BGRCopyPass::CopyBGR(Image& dst_image, Image& src_image,
1265 std::span<const VideoCommon::ImageCopy> copies) { 1265 std::span<const VideoCommon::ImageCopy> copies) {
1266 static constexpr VideoCommon::Offset3D zero_offset{0, 0, 0}; 1266 static constexpr VideoCommon::Offset3D zero_offset{0, 0, 0};
1267 const u32 requested_pbo_size = 1267 const u32 img_bpp = BytesPerBlock(src_image.info.format);
1268 std::max(src_image.unswizzled_size_bytes, dst_image.unswizzled_size_bytes);
1269
1270 if (bgr_pbo_size < requested_pbo_size) {
1271 bgr_pbo.Create();
1272 bgr_pbo_size = requested_pbo_size;
1273 glNamedBufferData(bgr_pbo.handle, bgr_pbo_size, nullptr, GL_STREAM_COPY);
1274 }
1275 for (const ImageCopy& copy : copies) { 1268 for (const ImageCopy& copy : copies) {
1276 ASSERT(copy.src_offset == zero_offset); 1269 ASSERT(copy.src_offset == zero_offset);
1277 ASSERT(copy.dst_offset == zero_offset); 1270 ASSERT(copy.dst_offset == zero_offset);
1278 1271 const u32 num_src_layers = static_cast<u32>(copy.src_subresource.num_layers);
1272 const u32 copy_size = copy.extent.width * copy.extent.height * num_src_layers * img_bpp;
1273 if (bgr_pbo_size < copy_size) {
1274 bgr_pbo.Create();
1275 bgr_pbo_size = copy_size;
1276 glNamedBufferData(bgr_pbo.handle, bgr_pbo_size, nullptr, GL_STREAM_COPY);
1277 }
1279 // Copy from source to PBO 1278 // Copy from source to PBO
1280 glPixelStorei(GL_PACK_ALIGNMENT, 1); 1279 glPixelStorei(GL_PACK_ALIGNMENT, 1);
1281 glPixelStorei(GL_PACK_ROW_LENGTH, copy.extent.width); 1280 glPixelStorei(GL_PACK_ROW_LENGTH, copy.extent.width);
1282 glBindBuffer(GL_PIXEL_PACK_BUFFER, bgr_pbo.handle); 1281 glBindBuffer(GL_PIXEL_PACK_BUFFER, bgr_pbo.handle);
1283 glGetTextureSubImage(src_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height, 1282 glGetTextureSubImage(src_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height,
1284 copy.src_subresource.num_layers, src_image.GlFormat(), 1283 num_src_layers, src_image.GlFormat(), src_image.GlType(),
1285 src_image.GlType(), static_cast<GLsizei>(bgr_pbo_size), nullptr); 1284 static_cast<GLsizei>(bgr_pbo_size), nullptr);
1286 1285
1287 // Copy from PBO to destination in desired GL format 1286 // Copy from PBO to destination in desired GL format
1288 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 1287 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);