summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_texture_cache.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.h69
1 files changed, 57 insertions, 12 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h
index 1ca2c90be..40acc8fad 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.h
+++ b/src/video_core/renderer_opengl/gl_texture_cache.h
@@ -15,6 +15,10 @@
#include "video_core/texture_cache/image_view_base.h"
#include "video_core/texture_cache/texture_cache_base.h"
+namespace Settings {
+struct ResolutionScalingInfo;
+}
+
namespace OpenGL {
class Device;
@@ -48,17 +52,17 @@ struct FormatProperties {
bool is_compressed;
};
-class BGRCopyPass {
+class FormatConversionPass {
public:
- BGRCopyPass() = default;
- ~BGRCopyPass() = default;
+ FormatConversionPass() = default;
+ ~FormatConversionPass() = default;
- void CopyBGR(Image& dst_image, Image& src_image,
- std::span<const VideoCommon::ImageCopy> copies);
+ void ConvertImage(Image& dst_image, Image& src_image,
+ std::span<const VideoCommon::ImageCopy> copies);
private:
- OGLBuffer bgr_pbo;
- size_t bgr_pbo_size{};
+ OGLBuffer intermediate_pbo;
+ size_t pbo_size{};
};
class TextureCacheRuntime {
@@ -78,9 +82,13 @@ 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) {
+ void ConvertImage(Image& dst, Image& src, std::span<const VideoCommon::ImageCopy> copies);
+
+ void ConvertImage(Framebuffer* dst, ImageView& dst_view, ImageView& src_view, bool rescaled) {
UNIMPLEMENTED();
}
@@ -110,6 +118,12 @@ public:
bool HasNativeASTC() const noexcept;
+ void TickFrame() {}
+
+ StateTracker& GetStateTracker() {
+ return state_tracker;
+ }
+
private:
struct StagingBuffers {
explicit StagingBuffers(GLenum storage_flags_, GLenum map_flags_);
@@ -132,7 +146,7 @@ private:
const Device& device;
StateTracker& state_tracker;
UtilShaders util_shaders;
- BGRCopyPass bgr_copy_pass;
+ FormatConversionPass format_conversion_pass;
std::array<std::unordered_map<GLenum, FormatProperties>, 3> format_properties;
bool has_broken_texture_view_formats = false;
@@ -149,6 +163,10 @@ private:
OGLTextureView null_image_view_cube;
std::array<GLuint, Shader::NUM_TEXTURE_TYPES> null_image_views{};
+
+ std::array<OGLFramebuffer, 4> rescale_draw_fbos;
+ std::array<OGLFramebuffer, 4> rescale_read_fbos;
+ const Settings::ResolutionScalingInfo& resolution;
};
class Image : public VideoCommon::ImageBase {
@@ -157,6 +175,7 @@ class Image : public VideoCommon::ImageBase {
public:
explicit Image(TextureCacheRuntime&, const VideoCommon::ImageInfo& info, GPUVAddr gpu_addr,
VAddr cpu_addr);
+ explicit Image(const VideoCommon::NullImageParams&);
~Image();
@@ -174,7 +193,7 @@ public:
GLuint StorageHandle() noexcept;
GLuint Handle() const noexcept {
- return texture.handle;
+ return current_texture;
}
GLuint GlFormat() const noexcept {
@@ -185,16 +204,25 @@ public:
return gl_type;
}
+ bool ScaleUp(bool ignore = false);
+
+ bool ScaleDown(bool ignore = false);
+
private:
void CopyBufferToImage(const VideoCommon::BufferImageCopy& copy, size_t buffer_offset);
void CopyImageToBuffer(const VideoCommon::BufferImageCopy& copy, size_t buffer_offset);
+ void Scale(bool up_scale);
+
OGLTexture texture;
+ OGLTexture upscaled_backup;
OGLTextureView store_view;
GLenum gl_internal_format = GL_NONE;
GLenum gl_format = GL_NONE;
GLenum gl_type = GL_NONE;
+ TextureCacheRuntime* runtime{};
+ GLuint current_texture{};
};
class ImageView : public VideoCommon::ImageViewBase {
@@ -206,7 +234,15 @@ public:
const VideoCommon::ImageViewInfo&, GPUVAddr);
explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo& info,
const VideoCommon::ImageViewInfo& view_info);
- explicit ImageView(TextureCacheRuntime&, const VideoCommon::NullImageParams&);
+ explicit ImageView(TextureCacheRuntime&, const VideoCommon::NullImageViewParams&);
+
+ ~ImageView();
+
+ ImageView(const ImageView&) = delete;
+ ImageView& operator=(const ImageView&) = delete;
+
+ ImageView(ImageView&&) = default;
+ ImageView& operator=(ImageView&&) = default;
[[nodiscard]] GLuint StorageView(Shader::TextureType texture_type,
Shader::ImageFormat image_format);
@@ -276,6 +312,14 @@ public:
explicit Framebuffer(TextureCacheRuntime&, std::span<ImageView*, NUM_RT> color_buffers,
ImageView* depth_buffer, const VideoCommon::RenderTargets& key);
+ ~Framebuffer();
+
+ Framebuffer(const Framebuffer&) = delete;
+ Framebuffer& operator=(const Framebuffer&) = delete;
+
+ Framebuffer(Framebuffer&&) = default;
+ Framebuffer& operator=(Framebuffer&&) = default;
+
[[nodiscard]] GLuint Handle() const noexcept {
return framebuffer.handle;
}
@@ -293,7 +337,8 @@ 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;
+ static constexpr bool HAS_PIXEL_FORMAT_CONVERSIONS = true;
using Runtime = OpenGL::TextureCacheRuntime;
using Image = OpenGL::Image;