blob: 82ef4b14bef557f64b7bade3d153db163430302c (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include "generated/gl_3_2_core.h"
#include "common/common.h"
#include "core/hw/gpu.h"
#include "video_core/renderer_base.h"
#include <array>
class EmuWindow;
class RendererOpenGL : public RendererBase {
public:
RendererOpenGL();
~RendererOpenGL() override;
/// Swap buffers (render frame)
void SwapBuffers();
/**
* Set the emulator window to use for renderer
* @param window EmuWindow handle to emulator window to use for rendering
*/
void SetWindow(EmuWindow* window);
/// Initialize the renderer
void Init();
/// Shutdown the renderer
void ShutDown();
private:
/// Structure used for storing information about the textures for each 3DS screen
struct TextureInfo {
GLuint handle;
GLsizei width;
GLsizei height;
};
void InitOpenGLObjects();
void DrawScreens();
void DrawSingleScreenRotated(const TextureInfo& texture, float x, float y, float w, float h);
void UpdateFramerate();
// Loads framebuffer from emulated memory into the active OpenGL texture.
static void LoadFBToActiveGLTexture(const GPU::Regs::FramebufferConfig& framebuffer,
const TextureInfo& texture);
EmuWindow* render_window; ///< Handle to render window
u32 last_mode; ///< Last render mode
int resolution_width; ///< Current resolution width
int resolution_height; ///< Current resolution height
// OpenGL object IDs
GLuint vertex_array_handle;
GLuint vertex_buffer_handle;
GLuint program_id;
std::array<TextureInfo, 2> textures;
// Shader uniform location indices
GLuint uniform_modelview_matrix;
GLuint uniform_color_texture;
// Shader attribute input indices
GLuint attrib_position;
GLuint attrib_tex_coord;
};
|