summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/present/window_adapt_pass.h
blob: 65dcd09ffa0a5701cd52a0ff52c93b5a36a9be7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include "common/math_util.h"
#include "video_core/renderer_opengl/gl_resource_manager.h"

namespace Layout {
struct FramebufferLayout;
}

namespace OpenGL {

class Device;
class ProgramManager;

class WindowAdaptPass final {
public:
    explicit WindowAdaptPass(const Device& device, OGLSampler&& sampler,
                             std::string_view frag_source);
    ~WindowAdaptPass();

    void DrawToFramebuffer(ProgramManager& program_manager, GLuint texture,
                           const Layout::FramebufferLayout& layout,
                           const Common::Rectangle<f32>& crop);

private:
    const Device& device;
    OGLSampler sampler;
    OGLProgram vert;
    OGLProgram frag;
    OGLBuffer vertex_buffer;

    // GPU address of the vertex buffer
    GLuint64EXT vertex_buffer_address = 0;
};

} // namespace OpenGL