summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-07-20 23:35:05 +0200
committerGitHub <noreply@github.com>2021-07-20 23:35:05 +0200
commitc53b688411d916192820520ef5280ad5e378aa11 (patch)
tree6b319d4eaa3b7807b9590268f308b1c03fb5d3a1 /src/video_core/renderer_opengl
parentMerge pull request #6658 from Morph1984/render-window-fix (diff)
parentBuffer cache: Fixes, Clang and Feedback. (diff)
downloadyuzu-c53b688411d916192820520ef5280ad5e378aa11.tar
yuzu-c53b688411d916192820520ef5280ad5e378aa11.tar.gz
yuzu-c53b688411d916192820520ef5280ad5e378aa11.tar.bz2
yuzu-c53b688411d916192820520ef5280ad5e378aa11.tar.lz
yuzu-c53b688411d916192820520ef5280ad5e378aa11.tar.xz
yuzu-c53b688411d916192820520ef5280ad5e378aa11.tar.zst
yuzu-c53b688411d916192820520ef5280ad5e378aa11.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_buffer_cache.cpp6
-rw-r--r--src/video_core/renderer_opengl/gl_buffer_cache.h2
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h2
4 files changed, 15 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp
index c225d1fc9..c4189fb60 100644
--- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp
@@ -98,6 +98,12 @@ void BufferCacheRuntime::CopyBuffer(Buffer& dst_buffer, Buffer& src_buffer,
}
}
+void BufferCacheRuntime::ClearBuffer(Buffer& dest_buffer, u32 offset, size_t size, u32 value) {
+ glClearNamedBufferSubData(dest_buffer.Handle(), GL_R32UI, static_cast<GLintptr>(offset),
+ static_cast<GLsizeiptr>(size / sizeof(u32)), GL_RGBA, GL_UNSIGNED_INT,
+ &value);
+}
+
void BufferCacheRuntime::BindIndexBuffer(Buffer& buffer, u32 offset, u32 size) {
if (has_unified_vertex_buffers) {
buffer.MakeResident(GL_READ_ONLY);
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h
index d8b20a9af..fe91aa452 100644
--- a/src/video_core/renderer_opengl/gl_buffer_cache.h
+++ b/src/video_core/renderer_opengl/gl_buffer_cache.h
@@ -57,6 +57,8 @@ public:
void CopyBuffer(Buffer& dst_buffer, Buffer& src_buffer,
std::span<const VideoCommon::BufferCopy> copies);
+ void ClearBuffer(Buffer& dest_buffer, u32 offset, size_t size, u32 value);
+
void BindIndexBuffer(Buffer& buffer, u32 offset, u32 size);
void BindVertexBuffer(u32 index, Buffer& buffer, u32 offset, u32 size, u32 stride);
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 82c84127a..ceb3abcb2 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -1407,4 +1407,9 @@ bool AccelerateDMA::BufferCopy(GPUVAddr src_address, GPUVAddr dest_address, u64
return buffer_cache.DMACopy(src_address, dest_address, amount);
}
+bool AccelerateDMA::BufferClear(GPUVAddr src_address, u64 amount, u32 value) {
+ std::scoped_lock lock{buffer_cache.mutex};
+ return buffer_cache.DMAClear(src_address, amount, value);
+}
+
} // namespace OpenGL
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index ccee9ba33..d30ad698f 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -65,6 +65,8 @@ public:
bool BufferCopy(GPUVAddr src_address, GPUVAddr dest_address, u64 amount) override;
+ bool BufferClear(GPUVAddr src_address, u64 amount, u32 value) override;
+
private:
BufferCache& buffer_cache;
};