forked from suyu/suyu
TextureCache: OGL query device memory if possible.
This commit is contained in:
parent
978f598ff6
commit
1128cc35b9
2 changed files with 14 additions and 2 deletions
|
@ -9,8 +9,8 @@
|
|||
|
||||
#include <glad/glad.h>
|
||||
|
||||
#include "common/literals.h"
|
||||
#include "common/settings.h"
|
||||
|
||||
#include "video_core/renderer_opengl/gl_device.h"
|
||||
#include "video_core/renderer_opengl/gl_shader_manager.h"
|
||||
#include "video_core/renderer_opengl/gl_state_tracker.h"
|
||||
|
@ -42,6 +42,7 @@ using VideoCore::Surface::IsPixelFormatSRGB;
|
|||
using VideoCore::Surface::MaxPixelFormat;
|
||||
using VideoCore::Surface::PixelFormat;
|
||||
using VideoCore::Surface::SurfaceType;
|
||||
using namespace Common::Literals;
|
||||
|
||||
struct CopyOrigin {
|
||||
GLint level;
|
||||
|
@ -496,6 +497,15 @@ ImageBufferMap TextureCacheRuntime::DownloadStagingBuffer(size_t size) {
|
|||
return download_buffers.RequestMap(size, false);
|
||||
}
|
||||
|
||||
u64 TextureCacheRuntime::GetDeviceLocalMemory() const {
|
||||
if (GLAD_GL_NVX_gpu_memory_info) {
|
||||
GLint cur_avail_mem_kb = 0;
|
||||
glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &cur_avail_mem_kb);
|
||||
return static_cast<u64>(cur_avail_mem_kb) * 1_KiB;
|
||||
}
|
||||
return 2_GiB; // Return minimum requirements
|
||||
}
|
||||
|
||||
void TextureCacheRuntime::CopyImage(Image& dst_image, Image& src_image,
|
||||
std::span<const ImageCopy> copies) {
|
||||
const GLuint dst_name = dst_image.Handle();
|
||||
|
|
|
@ -82,6 +82,8 @@ public:
|
|||
|
||||
ImageBufferMap DownloadStagingBuffer(size_t size);
|
||||
|
||||
u64 GetDeviceLocalMemory() const;
|
||||
|
||||
void CopyImage(Image& dst, Image& src, std::span<const VideoCommon::ImageCopy> copies);
|
||||
|
||||
void ConvertImage(Framebuffer* dst, ImageView& dst_view, ImageView& src_view, bool rescaled) {
|
||||
|
@ -333,7 +335,7 @@ struct TextureCacheParams {
|
|||
static constexpr bool ENABLE_VALIDATION = true;
|
||||
static constexpr bool FRAMEBUFFER_BLITS = true;
|
||||
static constexpr bool HAS_EMULATED_COPIES = true;
|
||||
static constexpr bool HAS_DEVICE_MEMORY_INFO = false;
|
||||
static constexpr bool HAS_DEVICE_MEMORY_INFO = true;
|
||||
|
||||
using Runtime = OpenGL::TextureCacheRuntime;
|
||||
using Image = OpenGL::Image;
|
||||
|
|
Loading…
Reference in a new issue