summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-06-15 00:58:16 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-07-06 05:37:55 +0200
commit2bcae41a73cf2f2c6b21a3ab298eddd0855a0245 (patch)
tree3a7e53d3072659fe2b994cd99d825ead458c35b7
parentgl_device: Query SSBO alignment (diff)
downloadyuzu-2bcae41a73cf2f2c6b21a3ab298eddd0855a0245.tar
yuzu-2bcae41a73cf2f2c6b21a3ab298eddd0855a0245.tar.gz
yuzu-2bcae41a73cf2f2c6b21a3ab298eddd0855a0245.tar.bz2
yuzu-2bcae41a73cf2f2c6b21a3ab298eddd0855a0245.tar.lz
yuzu-2bcae41a73cf2f2c6b21a3ab298eddd0855a0245.tar.xz
yuzu-2bcae41a73cf2f2c6b21a3ab298eddd0855a0245.tar.zst
yuzu-2bcae41a73cf2f2c6b21a3ab298eddd0855a0245.zip
-rw-r--r--src/video_core/renderer_opengl/gl_buffer_cache.cpp10
-rw-r--r--src/video_core/renderer_opengl/gl_buffer_cache.h8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp5
3 files changed, 14 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp
index 3ce61c5cd..fb3aedd07 100644
--- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp
@@ -33,8 +33,8 @@ OGLBuffer CreateBuffer(std::size_t size, GLenum usage) {
CachedBufferEntry::CachedBufferEntry(VAddr cpu_addr, u8* host_ptr)
: RasterizerCacheObject{host_ptr}, host_ptr{host_ptr}, cpu_addr{cpu_addr} {}
-OGLBufferCache::OGLBufferCache(RasterizerOpenGL& rasterizer, std::size_t size)
- : RasterizerCache{rasterizer}, stream_buffer(size, true) {}
+OGLBufferCache::OGLBufferCache(RasterizerOpenGL& rasterizer, Core::System& system, std::size_t size)
+ : RasterizerCache{rasterizer}, system{system}, stream_buffer(size, true) {}
OGLBufferCache::~OGLBufferCache() = default;
@@ -53,7 +53,7 @@ OGLBufferCache::BufferInfo OGLBufferCache::UploadMemory(GPUVAddr gpu_addr, std::
bool is_written) {
std::lock_guard lock{mutex};
- auto& memory_manager = Core::System::GetInstance().GPU().MemoryManager();
+ auto& memory_manager = system.GPU().MemoryManager();
const auto host_ptr{memory_manager.GetPointer(gpu_addr)};
const auto cache_addr{ToCacheAddr(host_ptr)};
if (!host_ptr) {
@@ -119,7 +119,7 @@ OGLBufferCache::BufferInfo OGLBufferCache::StreamBufferUpload(const void* raw_po
OGLBufferCache::BufferInfo OGLBufferCache::FixedBufferUpload(GPUVAddr gpu_addr, u8* host_ptr,
std::size_t size, bool internalize,
bool is_written) {
- auto& memory_manager = Core::System::GetInstance().GPU().MemoryManager();
+ auto& memory_manager = system.GPU().MemoryManager();
const auto cpu_addr = *memory_manager.GpuToCpuAddress(gpu_addr);
auto entry = GetUncachedBuffer(cpu_addr, host_ptr);
entry->SetSize(size);
@@ -161,7 +161,7 @@ void OGLBufferCache::GrowBuffer(std::shared_ptr<CachedBufferEntry>& entry, std::
}
std::shared_ptr<CachedBufferEntry> OGLBufferCache::GetUncachedBuffer(VAddr cpu_addr, u8* host_ptr) {
- if (auto entry = TryGetReservedBuffer(host_ptr); entry) {
+ if (auto entry = TryGetReservedBuffer(host_ptr)) {
return entry;
}
return std::make_shared<CachedBufferEntry>(cpu_addr, host_ptr);
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h
index 4267a5067..19d643e41 100644
--- a/src/video_core/renderer_opengl/gl_buffer_cache.h
+++ b/src/video_core/renderer_opengl/gl_buffer_cache.h
@@ -17,6 +17,10 @@
#include "video_core/renderer_opengl/gl_resource_manager.h"
#include "video_core/renderer_opengl/gl_stream_buffer.h"
+namespace Core {
+class System;
+}
+
namespace OpenGL {
class RasterizerOpenGL;
@@ -79,7 +83,7 @@ class OGLBufferCache final : public RasterizerCache<std::shared_ptr<CachedBuffer
using BufferInfo = std::pair<GLuint, GLintptr>;
public:
- explicit OGLBufferCache(RasterizerOpenGL& rasterizer, std::size_t size);
+ explicit OGLBufferCache(RasterizerOpenGL& rasterizer, Core::System& system, std::size_t size);
~OGLBufferCache();
void Unregister(const std::shared_ptr<CachedBufferEntry>& entry) override;
@@ -116,6 +120,8 @@ private:
void AlignBuffer(std::size_t alignment);
+ Core::System& system;
+
u8* buffer_ptr = nullptr;
GLintptr buffer_offset = 0;
GLintptr buffer_offset_base = 0;
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index d1790f24f..35ba84235 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -83,9 +83,8 @@ struct DrawParameters {
RasterizerOpenGL::RasterizerOpenGL(Core::System& system, Core::Frontend::EmuWindow& emu_window,
ScreenInfo& info)
- : texture_cache{system, *this, device},
- shader_cache{*this, system, emu_window, device}, system{system}, screen_info{info},
- buffer_cache(*this, STREAM_BUFFER_SIZE) {
+ : texture_cache{system, *this, device}, shader_cache{*this, system, emu_window, device},
+ system{system}, screen_info{info}, buffer_cache{*this, system, STREAM_BUFFER_SIZE} {
OpenGLState::ApplyDefaultState();
shader_program_manager = std::make_unique<GLShader::ProgramManager>();