summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_device.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2022-01-18 18:05:44 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2022-03-25 03:05:56 +0100
commit9872d4bc4f78fea478e7db4d5a04208cb8a871fa (patch)
treed61944d1a7a5e03b5d00da43a92acee848f7bd4e /src/video_core/renderer_opengl/gl_device.cpp
parentGarbage Collection: Final tuning. (diff)
downloadyuzu-9872d4bc4f78fea478e7db4d5a04208cb8a871fa.tar
yuzu-9872d4bc4f78fea478e7db4d5a04208cb8a871fa.tar.gz
yuzu-9872d4bc4f78fea478e7db4d5a04208cb8a871fa.tar.bz2
yuzu-9872d4bc4f78fea478e7db4d5a04208cb8a871fa.tar.lz
yuzu-9872d4bc4f78fea478e7db4d5a04208cb8a871fa.tar.xz
yuzu-9872d4bc4f78fea478e7db4d5a04208cb8a871fa.tar.zst
yuzu-9872d4bc4f78fea478e7db4d5a04208cb8a871fa.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_device.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp
index 715cd3a48..656dd7eb0 100644
--- a/src/video_core/renderer_opengl/gl_device.cpp
+++ b/src/video_core/renderer_opengl/gl_device.cpp
@@ -13,12 +13,15 @@
#include <glad/glad.h>
+#include "common/literals.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "shader_recompiler/stage.h"
#include "video_core/renderer_opengl/gl_device.h"
#include "video_core/renderer_opengl/gl_resource_manager.h"
+using namespace Common::Literals;
+
namespace OpenGL {
namespace {
constexpr std::array LIMIT_UBOS = {
@@ -165,6 +168,7 @@ Device::Device() {
has_sparse_texture_2 = GLAD_GL_ARB_sparse_texture2;
warp_size_potentially_larger_than_guest = !is_nvidia && !is_intel;
need_fastmath_off = is_nvidia;
+ can_report_memory = GLAD_GL_NVX_gpu_memory_info;
// At the moment of writing this, only Nvidia's driver optimizes BufferSubData on exclusive
// uniform buffers as "push constants"
@@ -276,4 +280,10 @@ void main() {
})");
}
+u64 Device::GetCurrentDedicatedVideoMemory() const {
+ GLint cur_avail_mem_kb = 0;
+ glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &cur_avail_mem_kb);
+ return static_cast<u64>(cur_avail_mem_kb) * 1_KiB;
+}
+
} // namespace OpenGL