summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2023-03-07 03:16:17 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2023-03-07 04:57:45 +0100
commit6b9cc0ed23b15a1b96b322b03feff2153e44a4a9 (patch)
tree6949cedbe90b6d34e2092c8eba57b243defb21dc /src/video_core/renderer_opengl
parentMerge pull request #9890 from Kelebek1/reverb_fix (diff)
downloadyuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.tar
yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.tar.gz
yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.tar.bz2
yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.tar.lz
yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.tar.xz
yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.tar.zst
yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp24
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.h6
2 files changed, 23 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index b047e7b3d..4b13e807d 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -762,14 +762,14 @@ Image::Image(const VideoCommon::NullImageParams& params) : VideoCommon::ImageBas
Image::~Image() = default;
-void Image::UploadMemory(const ImageBufferMap& map,
+void Image::UploadMemory(GLuint buffer_handle, size_t buffer_offset,
std::span<const VideoCommon::BufferImageCopy> copies) {
const bool is_rescaled = True(flags & ImageFlagBits::Rescaled);
if (is_rescaled) {
ScaleDown(true);
}
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, map.buffer);
- glFlushMappedBufferRange(GL_PIXEL_UNPACK_BUFFER, map.offset, unswizzled_size_bytes);
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer_handle);
+ glFlushMappedBufferRange(GL_PIXEL_UNPACK_BUFFER, buffer_offset, unswizzled_size_bytes);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
@@ -788,21 +788,26 @@ void Image::UploadMemory(const ImageBufferMap& map,
current_image_height = copy.buffer_image_height;
glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, current_image_height);
}
- CopyBufferToImage(copy, map.offset);
+ CopyBufferToImage(copy, buffer_offset);
}
if (is_rescaled) {
ScaleUp();
}
}
-void Image::DownloadMemory(ImageBufferMap& map,
+void Image::UploadMemory(const ImageBufferMap& map,
+ std::span<const VideoCommon::BufferImageCopy> copies) {
+ UploadMemory(map.buffer, map.offset, copies);
+}
+
+void Image::DownloadMemory(GLuint buffer_handle, size_t buffer_offset,
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, map.buffer);
+ glBindBuffer(GL_PIXEL_PACK_BUFFER, buffer_handle);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
u32 current_row_length = std::numeric_limits<u32>::max();
@@ -820,13 +825,18 @@ void Image::DownloadMemory(ImageBufferMap& map,
current_image_height = copy.buffer_image_height;
glPixelStorei(GL_PACK_IMAGE_HEIGHT, current_image_height);
}
- CopyImageToBuffer(copy, map.offset);
+ CopyImageToBuffer(copy, buffer_offset);
}
if (is_rescaled) {
ScaleUp(true);
}
}
+void Image::DownloadMemory(ImageBufferMap& map,
+ std::span<const VideoCommon::BufferImageCopy> copies) {
+ DownloadMemory(map.buffer, map.offset, copies);
+}
+
GLuint Image::StorageHandle() noexcept {
switch (info.format) {
case PixelFormat::A8B8G8R8_SRGB:
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h
index e30875496..911e4607a 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.h
+++ b/src/video_core/renderer_opengl/gl_texture_cache.h
@@ -206,9 +206,15 @@ public:
Image(Image&&) = default;
Image& operator=(Image&&) = default;
+ void UploadMemory(GLuint buffer_handle, size_t buffer_offset,
+ std::span<const VideoCommon::BufferImageCopy> copies);
+
void UploadMemory(const ImageBufferMap& map,
std::span<const VideoCommon::BufferImageCopy> copies);
+ void DownloadMemory(GLuint buffer_handle, size_t buffer_offset,
+ std::span<const VideoCommon::BufferImageCopy> copies);
+
void DownloadMemory(ImageBufferMap& map, std::span<const VideoCommon::BufferImageCopy> copies);
GLuint StorageHandle() noexcept;