mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
renderer_opengl: Move commentaries to header file
This commit is contained in:
parent
e3ee017e91
commit
4589582eaf
2 changed files with 13 additions and 20 deletions
|
@ -62,9 +62,7 @@ void main() {
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
/**
|
/// Vertex structure that the drawn screen rectangles are composed of.
|
||||||
* Vertex structure that the drawn screen rectangles are composed of.
|
|
||||||
*/
|
|
||||||
struct ScreenRectVertex {
|
struct ScreenRectVertex {
|
||||||
ScreenRectVertex(GLfloat x, GLfloat y, GLfloat u, GLfloat v) {
|
ScreenRectVertex(GLfloat x, GLfloat y, GLfloat u, GLfloat v) {
|
||||||
position[0] = x;
|
position[0] = x;
|
||||||
|
@ -138,9 +136,6 @@ void RendererOpenGL::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
|
||||||
prev_state.Apply();
|
prev_state.Apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads framebuffer from emulated memory into the active OpenGL texture.
|
|
||||||
*/
|
|
||||||
void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer) {
|
void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer) {
|
||||||
// Framebuffer orientation handling
|
// Framebuffer orientation handling
|
||||||
framebuffer_transform_flags = framebuffer.transform_flags;
|
framebuffer_transform_flags = framebuffer.transform_flags;
|
||||||
|
@ -181,19 +176,12 @@ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuf
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fills active OpenGL texture with the given RGB color. Since the color is solid, the texture can
|
|
||||||
* be 1x1 but will stretch across whatever it's rendered on.
|
|
||||||
*/
|
|
||||||
void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a,
|
void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a,
|
||||||
const TextureInfo& texture) {
|
const TextureInfo& texture) {
|
||||||
const u8 framebuffer_data[4] = {color_a, color_b, color_g, color_r};
|
const u8 framebuffer_data[4] = {color_a, color_b, color_g, color_r};
|
||||||
glClearTexImage(texture.resource.handle, 0, GL_RGBA, GL_UNSIGNED_BYTE, framebuffer_data);
|
glClearTexImage(texture.resource.handle, 0, GL_RGBA, GL_UNSIGNED_BYTE, framebuffer_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the OpenGL state and creates persistent objects.
|
|
||||||
*/
|
|
||||||
void RendererOpenGL::InitOpenGLObjects() {
|
void RendererOpenGL::InitOpenGLObjects() {
|
||||||
glClearColor(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue,
|
glClearColor(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue,
|
||||||
0.0f);
|
0.0f);
|
||||||
|
@ -351,9 +339,6 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
|
||||||
state.Apply();
|
state.Apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws the emulated screens to the emulator window.
|
|
||||||
*/
|
|
||||||
void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
|
void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
|
||||||
if (renderer_settings.set_background_color) {
|
if (renderer_settings.set_background_color) {
|
||||||
// Update background color before drawing
|
// Update background color before drawing
|
||||||
|
@ -381,7 +366,6 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
|
||||||
m_current_frame++;
|
m_current_frame++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Updates the framerate
|
|
||||||
void RendererOpenGL::UpdateFramerate() {}
|
void RendererOpenGL::UpdateFramerate() {}
|
||||||
|
|
||||||
void RendererOpenGL::CaptureScreenshot() {
|
void RendererOpenGL::CaptureScreenshot() {
|
||||||
|
@ -495,7 +479,6 @@ bool RendererOpenGL::Init() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Shutdown the renderer
|
|
||||||
void RendererOpenGL::ShutDown() {}
|
void RendererOpenGL::ShutDown() {}
|
||||||
|
|
||||||
} // namespace OpenGL
|
} // namespace OpenGL
|
||||||
|
|
|
@ -59,21 +59,31 @@ public:
|
||||||
void ShutDown() override;
|
void ShutDown() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/// Initializes the OpenGL state and creates persistent objects.
|
||||||
void InitOpenGLObjects();
|
void InitOpenGLObjects();
|
||||||
|
|
||||||
void AddTelemetryFields();
|
void AddTelemetryFields();
|
||||||
|
|
||||||
void CreateRasterizer();
|
void CreateRasterizer();
|
||||||
|
|
||||||
void ConfigureFramebufferTexture(TextureInfo& texture,
|
void ConfigureFramebufferTexture(TextureInfo& texture,
|
||||||
const Tegra::FramebufferConfig& framebuffer);
|
const Tegra::FramebufferConfig& framebuffer);
|
||||||
|
|
||||||
|
/// Draws the emulated screens to the emulator window.
|
||||||
void DrawScreen(const Layout::FramebufferLayout& layout);
|
void DrawScreen(const Layout::FramebufferLayout& layout);
|
||||||
|
|
||||||
void DrawScreenTriangles(const ScreenInfo& screen_info, float x, float y, float w, float h);
|
void DrawScreenTriangles(const ScreenInfo& screen_info, float x, float y, float w, float h);
|
||||||
|
|
||||||
|
/// Updates the framerate.
|
||||||
void UpdateFramerate();
|
void UpdateFramerate();
|
||||||
|
|
||||||
void CaptureScreenshot();
|
void CaptureScreenshot();
|
||||||
|
|
||||||
// Loads framebuffer from emulated memory into the display information structure
|
/// Loads framebuffer from emulated memory into the active OpenGL texture.
|
||||||
void LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer);
|
void LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer);
|
||||||
// Fills active OpenGL texture with the given RGBA color.
|
|
||||||
|
/// Fills active OpenGL texture with the given RGB color.Since the color is solid, the texture
|
||||||
|
/// can be 1x1 but will stretch across whatever it's rendered on.
|
||||||
void LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a,
|
void LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a,
|
||||||
const TextureInfo& texture);
|
const TextureInfo& texture);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue