|
|
@ -16,6 +16,7 @@ |
|
|
#include "core/memory.h"
|
|
|
#include "core/memory.h"
|
|
|
#include "core/settings.h"
|
|
|
#include "core/settings.h"
|
|
|
#include "core/tracer/recorder.h"
|
|
|
#include "core/tracer/recorder.h"
|
|
|
|
|
|
#include "video_core/renderer_opengl/gl_rasterizer.h"
|
|
|
#include "video_core/renderer_opengl/renderer_opengl.h"
|
|
|
#include "video_core/renderer_opengl/renderer_opengl.h"
|
|
|
#include "video_core/utils.h"
|
|
|
#include "video_core/utils.h"
|
|
|
|
|
|
|
|
|
@ -130,7 +131,7 @@ void RendererOpenGL::SwapBuffers(boost::optional<const Tegra::FramebufferConfig& |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Load the framebuffer from memory, draw it to the screen, and swap buffers
|
|
|
// Load the framebuffer from memory, draw it to the screen, and swap buffers
|
|
|
LoadFBToScreenInfo(*framebuffer, screen_info); |
|
|
|
|
|
|
|
|
LoadFBToScreenInfo(*framebuffer); |
|
|
DrawScreen(); |
|
|
DrawScreen(); |
|
|
render_window.SwapBuffers(); |
|
|
render_window.SwapBuffers(); |
|
|
} |
|
|
} |
|
|
@ -142,14 +143,12 @@ void RendererOpenGL::SwapBuffers(boost::optional<const Tegra::FramebufferConfig& |
|
|
|
|
|
|
|
|
// Restore the rasterizer state
|
|
|
// Restore the rasterizer state
|
|
|
prev_state.Apply(); |
|
|
prev_state.Apply(); |
|
|
RefreshRasterizerSetting(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* Loads framebuffer from emulated memory into the active OpenGL texture. |
|
|
* Loads framebuffer from emulated memory into the active OpenGL texture. |
|
|
*/ |
|
|
*/ |
|
|
void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer, |
|
|
|
|
|
ScreenInfo& screen_info) { |
|
|
|
|
|
|
|
|
void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer) { |
|
|
const u32 bytes_per_pixel{Tegra::FramebufferConfig::BytesPerPixel(framebuffer.pixel_format)}; |
|
|
const u32 bytes_per_pixel{Tegra::FramebufferConfig::BytesPerPixel(framebuffer.pixel_format)}; |
|
|
const u64 size_in_bytes{framebuffer.stride * framebuffer.height * bytes_per_pixel}; |
|
|
const u64 size_in_bytes{framebuffer.stride * framebuffer.height * bytes_per_pixel}; |
|
|
const VAddr framebuffer_addr{framebuffer.address + framebuffer.offset}; |
|
|
const VAddr framebuffer_addr{framebuffer.address + framebuffer.offset}; |
|
|
@ -162,8 +161,7 @@ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuf |
|
|
// only allows rows to have a memory alignement of 4.
|
|
|
// only allows rows to have a memory alignement of 4.
|
|
|
ASSERT(framebuffer.stride % 4 == 0); |
|
|
ASSERT(framebuffer.stride % 4 == 0); |
|
|
|
|
|
|
|
|
if (!rasterizer->AccelerateDisplay(framebuffer, framebuffer_addr, framebuffer.stride, |
|
|
|
|
|
screen_info)) { |
|
|
|
|
|
|
|
|
if (!rasterizer->AccelerateDisplay(framebuffer, framebuffer_addr, framebuffer.stride)) { |
|
|
// Reset the screen info's display texture to its own permanent texture
|
|
|
// Reset the screen info's display texture to its own permanent texture
|
|
|
screen_info.display_texture = screen_info.texture.resource.handle; |
|
|
screen_info.display_texture = screen_info.texture.resource.handle; |
|
|
|
|
|
|
|
|
@ -276,6 +274,14 @@ void RendererOpenGL::InitOpenGLObjects() { |
|
|
LoadColorToActiveGLTexture(0, 0, 0, 0, screen_info.texture); |
|
|
LoadColorToActiveGLTexture(0, 0, 0, 0, screen_info.texture); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RendererOpenGL::CreateRasterizer() { |
|
|
|
|
|
if (rasterizer) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
rasterizer = std::make_unique<RasterizerOpenGL>(render_window, screen_info); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture, |
|
|
void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture, |
|
|
const Tegra::FramebufferConfig& framebuffer) { |
|
|
const Tegra::FramebufferConfig& framebuffer) { |
|
|
|
|
|
|
|
|
@ -463,8 +469,7 @@ bool RendererOpenGL::Init() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
InitOpenGLObjects(); |
|
|
InitOpenGLObjects(); |
|
|
|
|
|
|
|
|
RefreshRasterizerSetting(); |
|
|
|
|
|
|
|
|
CreateRasterizer(); |
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|