2022-08-20 23:50:20 +02:00
|
|
|
// Copyright 2022 Citra Emulator Project
|
2020-04-07 16:12:32 +02:00
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-08-20 23:50:20 +02:00
|
|
|
#include <unordered_map>
|
2020-04-07 16:12:32 +02:00
|
|
|
#include "common/math_util.h"
|
2022-08-20 11:17:31 +02:00
|
|
|
#include "video_core/rasterizer_cache/pixel_format.h"
|
2022-08-20 23:50:20 +02:00
|
|
|
#include "video_core/renderer_opengl/gl_resource_manager.h"
|
2020-04-07 16:12:32 +02:00
|
|
|
|
|
|
|
namespace OpenGL {
|
|
|
|
|
|
|
|
class RasterizerCacheOpenGL;
|
|
|
|
|
|
|
|
class FormatReinterpreterBase {
|
|
|
|
public:
|
2022-08-20 23:50:20 +02:00
|
|
|
FormatReinterpreterBase() {
|
|
|
|
read_fbo.Create();
|
|
|
|
draw_fbo.Create();
|
|
|
|
}
|
|
|
|
|
2020-04-07 16:12:32 +02:00
|
|
|
virtual ~FormatReinterpreterBase() = default;
|
|
|
|
|
2022-08-20 23:50:20 +02:00
|
|
|
virtual PixelFormat GetSourceFormat() const = 0;
|
|
|
|
virtual void Reinterpret(const OGLTexture& src_tex, Common::Rectangle<u32> src_rect,
|
|
|
|
const OGLTexture& dst_tex, Common::Rectangle<u32> dst_rect) = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
OGLFramebuffer read_fbo, draw_fbo;
|
2020-04-07 16:12:32 +02:00
|
|
|
};
|
|
|
|
|
2022-08-20 23:50:20 +02:00
|
|
|
using ReinterpreterList = std::vector<std::unique_ptr<FormatReinterpreterBase>>;
|
2020-04-07 16:12:32 +02:00
|
|
|
|
2022-08-20 23:50:20 +02:00
|
|
|
class FormatReinterpreterOpenGL : NonCopyable {
|
2020-04-07 16:12:32 +02:00
|
|
|
public:
|
2022-08-20 23:50:20 +02:00
|
|
|
FormatReinterpreterOpenGL();
|
|
|
|
~FormatReinterpreterOpenGL() = default;
|
2020-04-07 16:12:32 +02:00
|
|
|
|
2022-08-20 23:50:20 +02:00
|
|
|
const ReinterpreterList& GetPossibleReinterpretations(PixelFormat dst_format);
|
2020-04-07 16:12:32 +02:00
|
|
|
|
|
|
|
private:
|
2022-08-20 23:50:20 +02:00
|
|
|
std::array<ReinterpreterList, PIXEL_FORMAT_COUNT> reinterpreters;
|
2020-04-07 16:12:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace OpenGL
|