diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.h | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 30dfcfa6a..2f7d98d8b 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -9,8 +9,8 @@ | |||
| 9 | 9 | ||
| 10 | #include <glad/glad.h> | 10 | #include <glad/glad.h> |
| 11 | 11 | ||
| 12 | #include "common/literals.h" | ||
| 12 | #include "common/settings.h" | 13 | #include "common/settings.h" |
| 13 | |||
| 14 | #include "video_core/renderer_opengl/gl_device.h" | 14 | #include "video_core/renderer_opengl/gl_device.h" |
| 15 | #include "video_core/renderer_opengl/gl_shader_manager.h" | 15 | #include "video_core/renderer_opengl/gl_shader_manager.h" |
| 16 | #include "video_core/renderer_opengl/gl_state_tracker.h" | 16 | #include "video_core/renderer_opengl/gl_state_tracker.h" |
| @@ -42,6 +42,7 @@ using VideoCore::Surface::IsPixelFormatSRGB; | |||
| 42 | using VideoCore::Surface::MaxPixelFormat; | 42 | using VideoCore::Surface::MaxPixelFormat; |
| 43 | using VideoCore::Surface::PixelFormat; | 43 | using VideoCore::Surface::PixelFormat; |
| 44 | using VideoCore::Surface::SurfaceType; | 44 | using VideoCore::Surface::SurfaceType; |
| 45 | using namespace Common::Literals; | ||
| 45 | 46 | ||
| 46 | struct CopyOrigin { | 47 | struct CopyOrigin { |
| 47 | GLint level; | 48 | GLint level; |
| @@ -496,6 +497,15 @@ ImageBufferMap TextureCacheRuntime::DownloadStagingBuffer(size_t size) { | |||
| 496 | return download_buffers.RequestMap(size, false); | 497 | return download_buffers.RequestMap(size, false); |
| 497 | } | 498 | } |
| 498 | 499 | ||
| 500 | u64 TextureCacheRuntime::GetDeviceLocalMemory() const { | ||
| 501 | if (GLAD_GL_NVX_gpu_memory_info) { | ||
| 502 | GLint cur_avail_mem_kb = 0; | ||
| 503 | glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &cur_avail_mem_kb); | ||
| 504 | return static_cast<u64>(cur_avail_mem_kb) * 1_KiB; | ||
| 505 | } | ||
| 506 | return 2_GiB; // Return minimum requirements | ||
| 507 | } | ||
| 508 | |||
| 499 | void TextureCacheRuntime::CopyImage(Image& dst_image, Image& src_image, | 509 | void TextureCacheRuntime::CopyImage(Image& dst_image, Image& src_image, |
| 500 | std::span<const ImageCopy> copies) { | 510 | std::span<const ImageCopy> copies) { |
| 501 | const GLuint dst_name = dst_image.Handle(); | 511 | const GLuint dst_name = dst_image.Handle(); |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index a717cf8c8..1bb762568 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h | |||
| @@ -82,6 +82,8 @@ public: | |||
| 82 | 82 | ||
| 83 | ImageBufferMap DownloadStagingBuffer(size_t size); | 83 | ImageBufferMap DownloadStagingBuffer(size_t size); |
| 84 | 84 | ||
| 85 | u64 GetDeviceLocalMemory() const; | ||
| 86 | |||
| 85 | void CopyImage(Image& dst, Image& src, std::span<const VideoCommon::ImageCopy> copies); | 87 | void CopyImage(Image& dst, Image& src, std::span<const VideoCommon::ImageCopy> copies); |
| 86 | 88 | ||
| 87 | void ConvertImage(Framebuffer* dst, ImageView& dst_view, ImageView& src_view, bool rescaled) { | 89 | void ConvertImage(Framebuffer* dst, ImageView& dst_view, ImageView& src_view, bool rescaled) { |
| @@ -333,7 +335,7 @@ struct TextureCacheParams { | |||
| 333 | static constexpr bool ENABLE_VALIDATION = true; | 335 | static constexpr bool ENABLE_VALIDATION = true; |
| 334 | static constexpr bool FRAMEBUFFER_BLITS = true; | 336 | static constexpr bool FRAMEBUFFER_BLITS = true; |
| 335 | static constexpr bool HAS_EMULATED_COPIES = true; | 337 | static constexpr bool HAS_EMULATED_COPIES = true; |
| 336 | static constexpr bool HAS_DEVICE_MEMORY_INFO = false; | 338 | static constexpr bool HAS_DEVICE_MEMORY_INFO = true; |
| 337 | 339 | ||
| 338 | using Runtime = OpenGL::TextureCacheRuntime; | 340 | using Runtime = OpenGL::TextureCacheRuntime; |
| 339 | using Image = OpenGL::Image; | 341 | using Image = OpenGL::Image; |