summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/core.cpp4
-rw-r--r--src/core/core.h9
-rw-r--r--src/core/frontend/emu_window.cpp4
-rw-r--r--src/core/frontend/emu_window.h4
-rw-r--r--src/video_core/engines/maxwell_3d.h26
-rw-r--r--src/video_core/gpu.cpp1
-rw-r--r--src/video_core/gpu.h1
-rw-r--r--src/video_core/renderer_base.cpp2
-rw-r--r--src/video_core/renderer_base.h6
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp11
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h9
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp43
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h84
-rw-r--r--src/video_core/renderer_opengl/maxwell_to_gl.h19
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp8
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.h8
-rw-r--r--src/video_core/video_core.cpp2
-rw-r--r--src/video_core/video_core.h4
-rw-r--r--src/yuzu/bootmanager.h2
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.h2
20 files changed, 170 insertions, 79 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 6b8004eb2..83d4d742b 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -88,7 +88,7 @@ System::ResultStatus System::SingleStep() {
88 return RunLoop(false); 88 return RunLoop(false);
89} 89}
90 90
91System::ResultStatus System::Load(EmuWindow& emu_window, const std::string& filepath) { 91System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath) {
92 app_loader = Loader::GetLoader(virtual_filesystem->OpenFile(filepath, FileSys::Mode::Read)); 92 app_loader = Loader::GetLoader(virtual_filesystem->OpenFile(filepath, FileSys::Mode::Read));
93 93
94 if (!app_loader) { 94 if (!app_loader) {
@@ -151,7 +151,7 @@ Cpu& System::CpuCore(size_t core_index) {
151 return *cpu_cores[core_index]; 151 return *cpu_cores[core_index];
152} 152}
153 153
154System::ResultStatus System::Init(EmuWindow& emu_window) { 154System::ResultStatus System::Init(Frontend::EmuWindow& emu_window) {
155 LOG_DEBUG(HW_Memory, "initialized OK"); 155 LOG_DEBUG(HW_Memory, "initialized OK");
156 156
157 CoreTiming::Init(); 157 CoreTiming::Init();
diff --git a/src/core/core.h b/src/core/core.h
index 2944b09cd..d98b15a71 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -22,9 +22,12 @@
22#include "video_core/debug_utils/debug_utils.h" 22#include "video_core/debug_utils/debug_utils.h"
23#include "video_core/gpu.h" 23#include "video_core/gpu.h"
24 24
25class EmuWindow;
26class ARM_Interface; 25class ARM_Interface;
27 26
27namespace Core::Frontend {
28class EmuWindow;
29}
30
28namespace Service::SM { 31namespace Service::SM {
29class ServiceManager; 32class ServiceManager;
30} 33}
@@ -99,7 +102,7 @@ public:
99 * @param filepath String path to the executable application to load on the host file system. 102 * @param filepath String path to the executable application to load on the host file system.
100 * @returns ResultStatus code, indicating if the operation succeeded. 103 * @returns ResultStatus code, indicating if the operation succeeded.
101 */ 104 */
102 ResultStatus Load(EmuWindow& emu_window, const std::string& filepath); 105 ResultStatus Load(Frontend::EmuWindow& emu_window, const std::string& filepath);
103 106
104 /** 107 /**
105 * Indicates if the emulated system is powered on (all subsystems initialized and able to run an 108 * Indicates if the emulated system is powered on (all subsystems initialized and able to run an
@@ -227,7 +230,7 @@ private:
227 * input. 230 * input.
228 * @return ResultStatus code, indicating if the operation succeeded. 231 * @return ResultStatus code, indicating if the operation succeeded.
229 */ 232 */
230 ResultStatus Init(EmuWindow& emu_window); 233 ResultStatus Init(Frontend::EmuWindow& emu_window);
231 234
232 /// RealVfsFilesystem instance 235 /// RealVfsFilesystem instance
233 FileSys::VirtualFilesystem virtual_filesystem; 236 FileSys::VirtualFilesystem virtual_filesystem;
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp
index 2d776c693..9dd493efb 100644
--- a/src/core/frontend/emu_window.cpp
+++ b/src/core/frontend/emu_window.cpp
@@ -8,6 +8,8 @@
8#include "core/frontend/input.h" 8#include "core/frontend/input.h"
9#include "core/settings.h" 9#include "core/settings.h"
10 10
11namespace Core::Frontend {
12
11class EmuWindow::TouchState : public Input::Factory<Input::TouchDevice>, 13class EmuWindow::TouchState : public Input::Factory<Input::TouchDevice>,
12 public std::enable_shared_from_this<TouchState> { 14 public std::enable_shared_from_this<TouchState> {
13public: 15public:
@@ -108,3 +110,5 @@ void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) {
108void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) { 110void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) {
109 NotifyFramebufferLayoutChanged(Layout::DefaultFrameLayout(width, height)); 111 NotifyFramebufferLayoutChanged(Layout::DefaultFrameLayout(width, height));
110} 112}
113
114} // namespace Core::Frontend
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h
index e8c29adfb..384dc7822 100644
--- a/src/core/frontend/emu_window.h
+++ b/src/core/frontend/emu_window.h
@@ -10,6 +10,8 @@
10#include "common/common_types.h" 10#include "common/common_types.h"
11#include "core/frontend/framebuffer_layout.h" 11#include "core/frontend/framebuffer_layout.h"
12 12
13namespace Core::Frontend {
14
13/** 15/**
14 * Abstraction class used to provide an interface between emulation code and the frontend 16 * Abstraction class used to provide an interface between emulation code and the frontend
15 * (e.g. SDL, QGLWidget, GLFW, etc...). 17 * (e.g. SDL, QGLWidget, GLFW, etc...).
@@ -166,3 +168,5 @@ private:
166 */ 168 */
167 std::tuple<unsigned, unsigned> ClipToTouchScreen(unsigned new_x, unsigned new_y); 169 std::tuple<unsigned, unsigned> ClipToTouchScreen(unsigned new_x, unsigned new_y);
168}; 170};
171
172} // namespace Core::Frontend
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 0506ac8fe..1b30ce018 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -93,6 +93,7 @@ public:
93 93
94 struct VertexAttribute { 94 struct VertexAttribute {
95 enum class Size : u32 { 95 enum class Size : u32 {
96 Invalid = 0x0,
96 Size_32_32_32_32 = 0x01, 97 Size_32_32_32_32 = 0x01,
97 Size_32_32_32 = 0x02, 98 Size_32_32_32 = 0x02,
98 Size_16_16_16_16 = 0x03, 99 Size_16_16_16_16 = 0x03,
@@ -257,6 +258,10 @@ public:
257 bool IsNormalized() const { 258 bool IsNormalized() const {
258 return (type == Type::SignedNorm) || (type == Type::UnsignedNorm); 259 return (type == Type::SignedNorm) || (type == Type::UnsignedNorm);
259 } 260 }
261
262 bool IsValid() const {
263 return size != Size::Invalid;
264 }
260 }; 265 };
261 266
262 enum class PrimitiveTopology : u32 { 267 enum class PrimitiveTopology : u32 {
@@ -352,6 +357,27 @@ public:
352 OneMinusConstantColor = 0x62, 357 OneMinusConstantColor = 0x62,
353 ConstantAlpha = 0x63, 358 ConstantAlpha = 0x63,
354 OneMinusConstantAlpha = 0x64, 359 OneMinusConstantAlpha = 0x64,
360
361 // These values are used by Nouveau and some games.
362 ZeroGL = 0x4000,
363 OneGL = 0x4001,
364 SourceColorGL = 0x4300,
365 OneMinusSourceColorGL = 0x4301,
366 SourceAlphaGL = 0x4302,
367 OneMinusSourceAlphaGL = 0x4303,
368 DestAlphaGL = 0x4304,
369 OneMinusDestAlphaGL = 0x4305,
370 DestColorGL = 0x4306,
371 OneMinusDestColorGL = 0x4307,
372 SourceAlphaSaturateGL = 0x4308,
373 ConstantColorGL = 0xc001,
374 OneMinusConstantColorGL = 0xc002,
375 ConstantAlphaGL = 0xc003,
376 OneMinusConstantAlphaGL = 0xc004,
377 Source1ColorGL = 0xc900,
378 OneMinusSource1ColorGL = 0xc901,
379 Source1AlphaGL = 0xc902,
380 OneMinusSource1AlphaGL = 0xc903,
355 }; 381 };
356 382
357 u32 separate_alpha; 383 u32 separate_alpha;
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index 834940b83..19e7f1161 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -70,6 +70,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
70 case RenderTargetFormat::RG8_SNORM: 70 case RenderTargetFormat::RG8_SNORM:
71 return 2; 71 return 2;
72 case RenderTargetFormat::R8_UNORM: 72 case RenderTargetFormat::R8_UNORM:
73 case RenderTargetFormat::R8_UINT:
73 return 1; 74 return 1;
74 default: 75 default:
75 UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format)); 76 UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format));
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index de5b037be..e008d8f26 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -42,6 +42,7 @@ enum class RenderTargetFormat : u32 {
42 R16_UINT = 0xF1, 42 R16_UINT = 0xF1,
43 R16_FLOAT = 0xF2, 43 R16_FLOAT = 0xF2,
44 R8_UNORM = 0xF3, 44 R8_UNORM = 0xF3,
45 R8_UINT = 0xF6,
45}; 46};
46 47
47enum class DepthFormat : u32 { 48enum class DepthFormat : u32 {
diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp
index e87016429..afd86a83a 100644
--- a/src/video_core/renderer_base.cpp
+++ b/src/video_core/renderer_base.cpp
@@ -10,7 +10,7 @@
10 10
11namespace VideoCore { 11namespace VideoCore {
12 12
13RendererBase::RendererBase(EmuWindow& window) : render_window{window} { 13RendererBase::RendererBase(Core::Frontend::EmuWindow& window) : render_window{window} {
14 RefreshBaseSettings(); 14 RefreshBaseSettings();
15} 15}
16 16
diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h
index fd8c47592..d9f16b8e6 100644
--- a/src/video_core/renderer_base.h
+++ b/src/video_core/renderer_base.h
@@ -11,7 +11,9 @@
11#include "video_core/gpu.h" 11#include "video_core/gpu.h"
12#include "video_core/rasterizer_interface.h" 12#include "video_core/rasterizer_interface.h"
13 13
14namespace Core::Frontend {
14class EmuWindow; 15class EmuWindow;
16}
15 17
16namespace VideoCore { 18namespace VideoCore {
17 19
@@ -21,7 +23,7 @@ struct RendererSettings {
21 23
22class RendererBase : NonCopyable { 24class RendererBase : NonCopyable {
23public: 25public:
24 explicit RendererBase(EmuWindow& window); 26 explicit RendererBase(Core::Frontend::EmuWindow& window);
25 virtual ~RendererBase(); 27 virtual ~RendererBase();
26 28
27 /// Swap buffers (render frame) 29 /// Swap buffers (render frame)
@@ -59,7 +61,7 @@ protected:
59 /// Refreshes settings specific to the rasterizer. 61 /// Refreshes settings specific to the rasterizer.
60 void RefreshRasterizerSetting(); 62 void RefreshRasterizerSetting();
61 63
62 EmuWindow& render_window; ///< Reference to the render window handle. 64 Core::Frontend::EmuWindow& render_window; ///< Reference to the render window handle.
63 std::unique_ptr<RasterizerInterface> rasterizer; 65 std::unique_ptr<RasterizerInterface> rasterizer;
64 f32 m_current_fps = 0.0f; ///< Current framerate, should be set by the renderer 66 f32 m_current_fps = 0.0f; ///< Current framerate, should be set by the renderer
65 int m_current_frame = 0; ///< Current frame, should be set by the renderer 67 int m_current_frame = 0; ///< Current frame, should be set by the renderer
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 8360feb5d..38a7b1413 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -36,7 +36,7 @@ MICROPROFILE_DEFINE(OpenGL_Drawing, "OpenGL", "Drawing", MP_RGB(128, 128, 192));
36MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(100, 100, 255)); 36MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(100, 100, 255));
37MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100)); 37MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100));
38 38
39RasterizerOpenGL::RasterizerOpenGL(EmuWindow& window) : emu_window{window} { 39RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& window) : emu_window{window} {
40 // Create sampler objects 40 // Create sampler objects
41 for (size_t i = 0; i < texture_samplers.size(); ++i) { 41 for (size_t i = 0; i < texture_samplers.size(); ++i) {
42 texture_samplers[i].Create(); 42 texture_samplers[i].Create();
@@ -161,11 +161,16 @@ std::pair<u8*, GLintptr> RasterizerOpenGL::SetupVertexArrays(u8* array_ptr,
161 // assume every shader uses them all. 161 // assume every shader uses them all.
162 for (unsigned index = 0; index < 16; ++index) { 162 for (unsigned index = 0; index < 16; ++index) {
163 auto& attrib = regs.vertex_attrib_format[index]; 163 auto& attrib = regs.vertex_attrib_format[index];
164
165 // Ignore invalid attributes.
166 if (!attrib.IsValid())
167 continue;
168
169 auto& buffer = regs.vertex_array[attrib.buffer];
164 LOG_TRACE(HW_GPU, "vertex attrib {}, count={}, size={}, type={}, offset={}, normalize={}", 170 LOG_TRACE(HW_GPU, "vertex attrib {}, count={}, size={}, type={}, offset={}, normalize={}",
165 index, attrib.ComponentCount(), attrib.SizeString(), attrib.TypeString(), 171 index, attrib.ComponentCount(), attrib.SizeString(), attrib.TypeString(),
166 attrib.offset.Value(), attrib.IsNormalized()); 172 attrib.offset.Value(), attrib.IsNormalized());
167 173
168 auto& buffer = regs.vertex_array[attrib.buffer];
169 ASSERT(buffer.IsEnabled()); 174 ASSERT(buffer.IsEnabled());
170 175
171 glEnableVertexAttribArray(index); 176 glEnableVertexAttribArray(index);
@@ -211,7 +216,7 @@ void RasterizerOpenGL::SetupShaders(u8* buffer_ptr, GLintptr buffer_offset) {
211 216
212 // Next available bindpoints to use when uploading the const buffers and textures to the GLSL 217 // Next available bindpoints to use when uploading the const buffers and textures to the GLSL
213 // shaders. The constbuffer bindpoint starts after the shader stage configuration bind points. 218 // shaders. The constbuffer bindpoint starts after the shader stage configuration bind points.
214 u32 current_constbuffer_bindpoint = uniform_buffers.size(); 219 u32 current_constbuffer_bindpoint = static_cast<u32>(uniform_buffers.size());
215 u32 current_texture_bindpoint = 0; 220 u32 current_texture_bindpoint = 0;
216 221
217 for (size_t index = 0; index < Maxwell::MaxShaderProgram; ++index) { 222 for (size_t index = 0; index < Maxwell::MaxShaderProgram; ++index) {
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 6d6d85cc1..bd01dc0ae 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -21,12 +21,15 @@
21#include "video_core/renderer_opengl/gl_state.h" 21#include "video_core/renderer_opengl/gl_state.h"
22#include "video_core/renderer_opengl/gl_stream_buffer.h" 22#include "video_core/renderer_opengl/gl_stream_buffer.h"
23 23
24class EmuWindow;
25struct ScreenInfo; 24struct ScreenInfo;
26 25
26namespace Core::Frontend {
27class EmuWindow;
28}
29
27class RasterizerOpenGL : public VideoCore::RasterizerInterface { 30class RasterizerOpenGL : public VideoCore::RasterizerInterface {
28public: 31public:
29 explicit RasterizerOpenGL(EmuWindow& renderer); 32 explicit RasterizerOpenGL(Core::Frontend::EmuWindow& renderer);
30 ~RasterizerOpenGL() override; 33 ~RasterizerOpenGL() override;
31 34
32 void DrawArrays() override; 35 void DrawArrays() override;
@@ -145,7 +148,7 @@ private:
145 148
146 RasterizerCacheOpenGL res_cache; 149 RasterizerCacheOpenGL res_cache;
147 150
148 EmuWindow& emu_window; 151 Core::Frontend::EmuWindow& emu_window;
149 152
150 std::unique_ptr<GLShader::ProgramManager> shader_program_manager; 153 std::unique_ptr<GLShader::ProgramManager> shader_program_manager;
151 OGLVertexArray sw_vao; 154 OGLVertexArray sw_vao;
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index d055b1dfa..84c250c63 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -99,6 +99,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
99 false}, // A2B10G10R10 99 false}, // A2B10G10R10
100 {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, ComponentType::UNorm, false}, // A1B5G5R5 100 {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, ComponentType::UNorm, false}, // A1B5G5R5
101 {GL_R8, GL_RED, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // R8 101 {GL_R8, GL_RED, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // R8
102 {GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, ComponentType::UInt, false}, // R8UI
102 {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, ComponentType::Float, false}, // RGBA16F 103 {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, ComponentType::Float, false}, // RGBA16F
103 {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, ComponentType::Float, 104 {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, ComponentType::Float,
104 false}, // R11FG11FB10F 105 false}, // R11FG11FB10F
@@ -233,26 +234,27 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, std::vector<u8>& gl_bu
233static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), 234static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr),
234 SurfaceParams::MaxPixelFormat> 235 SurfaceParams::MaxPixelFormat>
235 morton_to_gl_fns = { 236 morton_to_gl_fns = {
236 MortonCopy<true, PixelFormat::ABGR8U>, MortonCopy<true, PixelFormat::ABGR8S>, 237 MortonCopy<true, PixelFormat::ABGR8U>, MortonCopy<true, PixelFormat::ABGR8S>,
237 MortonCopy<true, PixelFormat::B5G6R5>, MortonCopy<true, PixelFormat::A2B10G10R10>, 238 MortonCopy<true, PixelFormat::B5G6R5>, MortonCopy<true, PixelFormat::A2B10G10R10>,
238 MortonCopy<true, PixelFormat::A1B5G5R5>, MortonCopy<true, PixelFormat::R8>, 239 MortonCopy<true, PixelFormat::A1B5G5R5>, MortonCopy<true, PixelFormat::R8>,
239 MortonCopy<true, PixelFormat::RGBA16F>, MortonCopy<true, PixelFormat::R11FG11FB10F>, 240 MortonCopy<true, PixelFormat::R8UI>, MortonCopy<true, PixelFormat::RGBA16F>,
240 MortonCopy<true, PixelFormat::RGBA32UI>, MortonCopy<true, PixelFormat::DXT1>, 241 MortonCopy<true, PixelFormat::R11FG11FB10F>, MortonCopy<true, PixelFormat::RGBA32UI>,
241 MortonCopy<true, PixelFormat::DXT23>, MortonCopy<true, PixelFormat::DXT45>, 242 MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>,
242 MortonCopy<true, PixelFormat::DXN1>, MortonCopy<true, PixelFormat::DXN2UNORM>, 243 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>,
243 MortonCopy<true, PixelFormat::DXN2SNORM>, MortonCopy<true, PixelFormat::BC7U>, 244 MortonCopy<true, PixelFormat::DXN2UNORM>, MortonCopy<true, PixelFormat::DXN2SNORM>,
244 MortonCopy<true, PixelFormat::ASTC_2D_4X4>, MortonCopy<true, PixelFormat::G8R8>, 245 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
245 MortonCopy<true, PixelFormat::BGRA8>, MortonCopy<true, PixelFormat::RGBA32F>, 246 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
246 MortonCopy<true, PixelFormat::RG32F>, MortonCopy<true, PixelFormat::R32F>, 247 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
247 MortonCopy<true, PixelFormat::R16F>, MortonCopy<true, PixelFormat::R16UNORM>, 248 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
248 MortonCopy<true, PixelFormat::R16S>, MortonCopy<true, PixelFormat::R16UI>, 249 MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::R16S>,
249 MortonCopy<true, PixelFormat::R16I>, MortonCopy<true, PixelFormat::RG16>, 250 MortonCopy<true, PixelFormat::R16UI>, MortonCopy<true, PixelFormat::R16I>,
250 MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>, 251 MortonCopy<true, PixelFormat::RG16>, MortonCopy<true, PixelFormat::RG16F>,
251 MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>, 252 MortonCopy<true, PixelFormat::RG16UI>, MortonCopy<true, PixelFormat::RG16I>,
252 MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>, 253 MortonCopy<true, PixelFormat::RG16S>, MortonCopy<true, PixelFormat::RGB32F>,
253 MortonCopy<true, PixelFormat::RG8S>, MortonCopy<true, PixelFormat::Z24S8>, 254 MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::RG8S>,
254 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, 255 MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>,
255 MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>, 256 MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>,
257 MortonCopy<true, PixelFormat::Z32FS8>,
256}; 258};
257 259
258static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), 260static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr),
@@ -264,6 +266,7 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
264 MortonCopy<false, PixelFormat::A2B10G10R10>, 266 MortonCopy<false, PixelFormat::A2B10G10R10>,
265 MortonCopy<false, PixelFormat::A1B5G5R5>, 267 MortonCopy<false, PixelFormat::A1B5G5R5>,
266 MortonCopy<false, PixelFormat::R8>, 268 MortonCopy<false, PixelFormat::R8>,
269 MortonCopy<false, PixelFormat::R8UI>,
267 MortonCopy<false, PixelFormat::RGBA16F>, 270 MortonCopy<false, PixelFormat::RGBA16F>,
268 MortonCopy<false, PixelFormat::R11FG11FB10F>, 271 MortonCopy<false, PixelFormat::R11FG11FB10F>,
269 MortonCopy<false, PixelFormat::RGBA32UI>, 272 MortonCopy<false, PixelFormat::RGBA32UI>,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index d7a43652e..202257b58 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -29,44 +29,45 @@ struct SurfaceParams {
29 A2B10G10R10 = 3, 29 A2B10G10R10 = 3,
30 A1B5G5R5 = 4, 30 A1B5G5R5 = 4,
31 R8 = 5, 31 R8 = 5,
32 RGBA16F = 6, 32 R8UI = 6,
33 R11FG11FB10F = 7, 33 RGBA16F = 7,
34 RGBA32UI = 8, 34 R11FG11FB10F = 8,
35 DXT1 = 9, 35 RGBA32UI = 9,
36 DXT23 = 10, 36 DXT1 = 10,
37 DXT45 = 11, 37 DXT23 = 11,
38 DXN1 = 12, // This is also known as BC4 38 DXT45 = 12,
39 DXN2UNORM = 13, 39 DXN1 = 13, // This is also known as BC4
40 DXN2SNORM = 14, 40 DXN2UNORM = 14,
41 BC7U = 15, 41 DXN2SNORM = 15,
42 ASTC_2D_4X4 = 16, 42 BC7U = 16,
43 G8R8 = 17, 43 ASTC_2D_4X4 = 17,
44 BGRA8 = 18, 44 G8R8 = 18,
45 RGBA32F = 19, 45 BGRA8 = 19,
46 RG32F = 20, 46 RGBA32F = 20,
47 R32F = 21, 47 RG32F = 21,
48 R16F = 22, 48 R32F = 22,
49 R16UNORM = 23, 49 R16F = 23,
50 R16S = 24, 50 R16UNORM = 24,
51 R16UI = 25, 51 R16S = 25,
52 R16I = 26, 52 R16UI = 26,
53 RG16 = 27, 53 R16I = 27,
54 RG16F = 28, 54 RG16 = 28,
55 RG16UI = 29, 55 RG16F = 29,
56 RG16I = 30, 56 RG16UI = 30,
57 RG16S = 31, 57 RG16I = 31,
58 RGB32F = 32, 58 RG16S = 32,
59 SRGBA8 = 33, 59 RGB32F = 33,
60 RG8S = 34, 60 SRGBA8 = 34,
61 RG8S = 35,
61 62
62 MaxColorFormat, 63 MaxColorFormat,
63 64
64 // DepthStencil formats 65 // DepthStencil formats
65 Z24S8 = 35, 66 Z24S8 = 36,
66 S8Z24 = 36, 67 S8Z24 = 37,
67 Z32F = 37, 68 Z32F = 38,
68 Z16 = 38, 69 Z16 = 39,
69 Z32FS8 = 39, 70 Z32FS8 = 40,
70 71
71 MaxDepthStencilFormat, 72 MaxDepthStencilFormat,
72 73
@@ -110,6 +111,7 @@ struct SurfaceParams {
110 1, // A2B10G10R10 111 1, // A2B10G10R10
111 1, // A1B5G5R5 112 1, // A1B5G5R5
112 1, // R8 113 1, // R8
114 1, // R8UI
113 1, // RGBA16F 115 1, // RGBA16F
114 1, // R11FG11FB10F 116 1, // R11FG11FB10F
115 1, // RGBA32UI 117 1, // RGBA32UI
@@ -161,6 +163,7 @@ struct SurfaceParams {
161 32, // A2B10G10R10 163 32, // A2B10G10R10
162 16, // A1B5G5R5 164 16, // A1B5G5R5
163 8, // R8 165 8, // R8
166 8, // R8UI
164 64, // RGBA16F 167 64, // RGBA16F
165 32, // R11FG11FB10F 168 32, // R11FG11FB10F
166 128, // RGBA32UI 169 128, // RGBA32UI
@@ -250,6 +253,8 @@ struct SurfaceParams {
250 return PixelFormat::RGBA32UI; 253 return PixelFormat::RGBA32UI;
251 case Tegra::RenderTargetFormat::R8_UNORM: 254 case Tegra::RenderTargetFormat::R8_UNORM:
252 return PixelFormat::R8; 255 return PixelFormat::R8;
256 case Tegra::RenderTargetFormat::R8_UINT:
257 return PixelFormat::R8UI;
253 case Tegra::RenderTargetFormat::RG16_FLOAT: 258 case Tegra::RenderTargetFormat::RG16_FLOAT:
254 return PixelFormat::RG16F; 259 return PixelFormat::RG16F;
255 case Tegra::RenderTargetFormat::RG16_UINT: 260 case Tegra::RenderTargetFormat::RG16_UINT:
@@ -301,7 +306,15 @@ struct SurfaceParams {
301 case Tegra::Texture::TextureFormat::A1B5G5R5: 306 case Tegra::Texture::TextureFormat::A1B5G5R5:
302 return PixelFormat::A1B5G5R5; 307 return PixelFormat::A1B5G5R5;
303 case Tegra::Texture::TextureFormat::R8: 308 case Tegra::Texture::TextureFormat::R8:
304 return PixelFormat::R8; 309 switch (component_type) {
310 case Tegra::Texture::ComponentType::UNORM:
311 return PixelFormat::R8;
312 case Tegra::Texture::ComponentType::UINT:
313 return PixelFormat::R8UI;
314 }
315 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
316 static_cast<u32>(component_type));
317 UNREACHABLE();
305 case Tegra::Texture::TextureFormat::G8R8: 318 case Tegra::Texture::TextureFormat::G8R8:
306 return PixelFormat::G8R8; 319 return PixelFormat::G8R8;
307 case Tegra::Texture::TextureFormat::R16_G16_B16_A16: 320 case Tegra::Texture::TextureFormat::R16_G16_B16_A16:
@@ -435,6 +448,7 @@ struct SurfaceParams {
435 return ComponentType::Float; 448 return ComponentType::Float;
436 case Tegra::RenderTargetFormat::RGBA32_UINT: 449 case Tegra::RenderTargetFormat::RGBA32_UINT:
437 case Tegra::RenderTargetFormat::RG16_UINT: 450 case Tegra::RenderTargetFormat::RG16_UINT:
451 case Tegra::RenderTargetFormat::R8_UINT:
438 case Tegra::RenderTargetFormat::R16_UINT: 452 case Tegra::RenderTargetFormat::R16_UINT:
439 return ComponentType::UInt; 453 return ComponentType::UInt;
440 case Tegra::RenderTargetFormat::RG16_SINT: 454 case Tegra::RenderTargetFormat::RG16_SINT:
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h
index c439446b1..5afd20dbe 100644
--- a/src/video_core/renderer_opengl/maxwell_to_gl.h
+++ b/src/video_core/renderer_opengl/maxwell_to_gl.h
@@ -156,42 +156,61 @@ inline GLenum BlendEquation(Maxwell::Blend::Equation equation) {
156inline GLenum BlendFunc(Maxwell::Blend::Factor factor) { 156inline GLenum BlendFunc(Maxwell::Blend::Factor factor) {
157 switch (factor) { 157 switch (factor) {
158 case Maxwell::Blend::Factor::Zero: 158 case Maxwell::Blend::Factor::Zero:
159 case Maxwell::Blend::Factor::ZeroGL:
159 return GL_ZERO; 160 return GL_ZERO;
160 case Maxwell::Blend::Factor::One: 161 case Maxwell::Blend::Factor::One:
162 case Maxwell::Blend::Factor::OneGL:
161 return GL_ONE; 163 return GL_ONE;
162 case Maxwell::Blend::Factor::SourceColor: 164 case Maxwell::Blend::Factor::SourceColor:
165 case Maxwell::Blend::Factor::SourceColorGL:
163 return GL_SRC_COLOR; 166 return GL_SRC_COLOR;
164 case Maxwell::Blend::Factor::OneMinusSourceColor: 167 case Maxwell::Blend::Factor::OneMinusSourceColor:
168 case Maxwell::Blend::Factor::OneMinusSourceColorGL:
165 return GL_ONE_MINUS_SRC_COLOR; 169 return GL_ONE_MINUS_SRC_COLOR;
166 case Maxwell::Blend::Factor::SourceAlpha: 170 case Maxwell::Blend::Factor::SourceAlpha:
171 case Maxwell::Blend::Factor::SourceAlphaGL:
167 return GL_SRC_ALPHA; 172 return GL_SRC_ALPHA;
168 case Maxwell::Blend::Factor::OneMinusSourceAlpha: 173 case Maxwell::Blend::Factor::OneMinusSourceAlpha:
174 case Maxwell::Blend::Factor::OneMinusSourceAlphaGL:
169 return GL_ONE_MINUS_SRC_ALPHA; 175 return GL_ONE_MINUS_SRC_ALPHA;
170 case Maxwell::Blend::Factor::DestAlpha: 176 case Maxwell::Blend::Factor::DestAlpha:
177 case Maxwell::Blend::Factor::DestAlphaGL:
171 return GL_DST_ALPHA; 178 return GL_DST_ALPHA;
172 case Maxwell::Blend::Factor::OneMinusDestAlpha: 179 case Maxwell::Blend::Factor::OneMinusDestAlpha:
180 case Maxwell::Blend::Factor::OneMinusDestAlphaGL:
173 return GL_ONE_MINUS_DST_ALPHA; 181 return GL_ONE_MINUS_DST_ALPHA;
174 case Maxwell::Blend::Factor::DestColor: 182 case Maxwell::Blend::Factor::DestColor:
183 case Maxwell::Blend::Factor::DestColorGL:
175 return GL_DST_COLOR; 184 return GL_DST_COLOR;
176 case Maxwell::Blend::Factor::OneMinusDestColor: 185 case Maxwell::Blend::Factor::OneMinusDestColor:
186 case Maxwell::Blend::Factor::OneMinusDestColorGL:
177 return GL_ONE_MINUS_DST_COLOR; 187 return GL_ONE_MINUS_DST_COLOR;
178 case Maxwell::Blend::Factor::SourceAlphaSaturate: 188 case Maxwell::Blend::Factor::SourceAlphaSaturate:
189 case Maxwell::Blend::Factor::SourceAlphaSaturateGL:
179 return GL_SRC_ALPHA_SATURATE; 190 return GL_SRC_ALPHA_SATURATE;
180 case Maxwell::Blend::Factor::Source1Color: 191 case Maxwell::Blend::Factor::Source1Color:
192 case Maxwell::Blend::Factor::Source1ColorGL:
181 return GL_SRC1_COLOR; 193 return GL_SRC1_COLOR;
182 case Maxwell::Blend::Factor::OneMinusSource1Color: 194 case Maxwell::Blend::Factor::OneMinusSource1Color:
195 case Maxwell::Blend::Factor::OneMinusSource1ColorGL:
183 return GL_ONE_MINUS_SRC1_COLOR; 196 return GL_ONE_MINUS_SRC1_COLOR;
184 case Maxwell::Blend::Factor::Source1Alpha: 197 case Maxwell::Blend::Factor::Source1Alpha:
198 case Maxwell::Blend::Factor::Source1AlphaGL:
185 return GL_SRC1_ALPHA; 199 return GL_SRC1_ALPHA;
186 case Maxwell::Blend::Factor::OneMinusSource1Alpha: 200 case Maxwell::Blend::Factor::OneMinusSource1Alpha:
201 case Maxwell::Blend::Factor::OneMinusSource1AlphaGL:
187 return GL_ONE_MINUS_SRC1_ALPHA; 202 return GL_ONE_MINUS_SRC1_ALPHA;
188 case Maxwell::Blend::Factor::ConstantColor: 203 case Maxwell::Blend::Factor::ConstantColor:
204 case Maxwell::Blend::Factor::ConstantColorGL:
189 return GL_CONSTANT_COLOR; 205 return GL_CONSTANT_COLOR;
190 case Maxwell::Blend::Factor::OneMinusConstantColor: 206 case Maxwell::Blend::Factor::OneMinusConstantColor:
207 case Maxwell::Blend::Factor::OneMinusConstantColorGL:
191 return GL_ONE_MINUS_CONSTANT_COLOR; 208 return GL_ONE_MINUS_CONSTANT_COLOR;
192 case Maxwell::Blend::Factor::ConstantAlpha: 209 case Maxwell::Blend::Factor::ConstantAlpha:
210 case Maxwell::Blend::Factor::ConstantAlphaGL:
193 return GL_CONSTANT_ALPHA; 211 return GL_CONSTANT_ALPHA;
194 case Maxwell::Blend::Factor::OneMinusConstantAlpha: 212 case Maxwell::Blend::Factor::OneMinusConstantAlpha:
213 case Maxwell::Blend::Factor::OneMinusConstantAlphaGL:
195 return GL_ONE_MINUS_CONSTANT_ALPHA; 214 return GL_ONE_MINUS_CONSTANT_ALPHA;
196 } 215 }
197 LOG_CRITICAL(Render_OpenGL, "Unimplemented blend factor={}", static_cast<u32>(factor)); 216 LOG_CRITICAL(Render_OpenGL, "Unimplemented blend factor={}", static_cast<u32>(factor));
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 899865e3b..95f1aa0fe 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -18,7 +18,6 @@
18#include "core/tracer/recorder.h" 18#include "core/tracer/recorder.h"
19#include "video_core/renderer_opengl/renderer_opengl.h" 19#include "video_core/renderer_opengl/renderer_opengl.h"
20#include "video_core/utils.h" 20#include "video_core/utils.h"
21#include "video_core/video_core.h"
22 21
23static const char vertex_shader[] = R"( 22static const char vertex_shader[] = R"(
24#version 150 core 23#version 150 core
@@ -92,7 +91,8 @@ static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, cons
92 return matrix; 91 return matrix;
93} 92}
94 93
95ScopeAcquireGLContext::ScopeAcquireGLContext(EmuWindow& emu_window_) : emu_window{emu_window_} { 94ScopeAcquireGLContext::ScopeAcquireGLContext(Core::Frontend::EmuWindow& emu_window_)
95 : emu_window{emu_window_} {
96 if (Settings::values.use_multi_core) { 96 if (Settings::values.use_multi_core) {
97 emu_window.MakeCurrent(); 97 emu_window.MakeCurrent();
98 } 98 }
@@ -103,7 +103,9 @@ ScopeAcquireGLContext::~ScopeAcquireGLContext() {
103 } 103 }
104} 104}
105 105
106RendererOpenGL::RendererOpenGL(EmuWindow& window) : VideoCore::RendererBase{window} {} 106RendererOpenGL::RendererOpenGL(Core::Frontend::EmuWindow& window)
107 : VideoCore::RendererBase{window} {}
108
107RendererOpenGL::~RendererOpenGL() = default; 109RendererOpenGL::~RendererOpenGL() = default;
108 110
109/// Swap buffers (render frame) 111/// Swap buffers (render frame)
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h
index 428afa3b7..a5eab6997 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.h
+++ b/src/video_core/renderer_opengl/renderer_opengl.h
@@ -12,7 +12,9 @@
12#include "video_core/renderer_opengl/gl_resource_manager.h" 12#include "video_core/renderer_opengl/gl_resource_manager.h"
13#include "video_core/renderer_opengl/gl_state.h" 13#include "video_core/renderer_opengl/gl_state.h"
14 14
15namespace Core::Frontend {
15class EmuWindow; 16class EmuWindow;
17}
16 18
17/// Structure used for storing information about the textures for the Switch screen 19/// Structure used for storing information about the textures for the Switch screen
18struct TextureInfo { 20struct TextureInfo {
@@ -34,16 +36,16 @@ struct ScreenInfo {
34/// Helper class to acquire/release OpenGL context within a given scope 36/// Helper class to acquire/release OpenGL context within a given scope
35class ScopeAcquireGLContext : NonCopyable { 37class ScopeAcquireGLContext : NonCopyable {
36public: 38public:
37 explicit ScopeAcquireGLContext(EmuWindow& window); 39 explicit ScopeAcquireGLContext(Core::Frontend::EmuWindow& window);
38 ~ScopeAcquireGLContext(); 40 ~ScopeAcquireGLContext();
39 41
40private: 42private:
41 EmuWindow& emu_window; 43 Core::Frontend::EmuWindow& emu_window;
42}; 44};
43 45
44class RendererOpenGL : public VideoCore::RendererBase { 46class RendererOpenGL : public VideoCore::RendererBase {
45public: 47public:
46 explicit RendererOpenGL(EmuWindow& window); 48 explicit RendererOpenGL(Core::Frontend::EmuWindow& window);
47 ~RendererOpenGL() override; 49 ~RendererOpenGL() override;
48 50
49 /// Swap buffers (render frame) 51 /// Swap buffers (render frame)
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp
index 1e686b89e..6780d1c16 100644
--- a/src/video_core/video_core.cpp
+++ b/src/video_core/video_core.cpp
@@ -9,7 +9,7 @@
9 9
10namespace VideoCore { 10namespace VideoCore {
11 11
12std::unique_ptr<RendererBase> CreateRenderer(EmuWindow& emu_window) { 12std::unique_ptr<RendererBase> CreateRenderer(Core::Frontend::EmuWindow& emu_window) {
13 return std::make_unique<RendererOpenGL>(emu_window); 13 return std::make_unique<RendererOpenGL>(emu_window);
14} 14}
15 15
diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h
index 2dc07540f..f79f85dfe 100644
--- a/src/video_core/video_core.h
+++ b/src/video_core/video_core.h
@@ -6,7 +6,9 @@
6 6
7#include <memory> 7#include <memory>
8 8
9namespace Core::Frontend {
9class EmuWindow; 10class EmuWindow;
11}
10 12
11namespace VideoCore { 13namespace VideoCore {
12 14
@@ -18,6 +20,6 @@ class RendererBase;
18 * @note The returned renderer instance is simply allocated. Its Init() 20 * @note The returned renderer instance is simply allocated. Its Init()
19 * function still needs to be called to fully complete its setup. 21 * function still needs to be called to fully complete its setup.
20 */ 22 */
21std::unique_ptr<RendererBase> CreateRenderer(EmuWindow& emu_window); 23std::unique_ptr<RendererBase> CreateRenderer(Core::Frontend::EmuWindow& emu_window);
22 24
23} // namespace VideoCore 25} // namespace VideoCore
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index d0f990c64..f133bfadf 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -101,7 +101,7 @@ signals:
101 void ErrorThrown(Core::System::ResultStatus, std::string); 101 void ErrorThrown(Core::System::ResultStatus, std::string);
102}; 102};
103 103
104class GRenderWindow : public QWidget, public EmuWindow { 104class GRenderWindow : public QWidget, public Core::Frontend::EmuWindow {
105 Q_OBJECT 105 Q_OBJECT
106 106
107public: 107public:
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.h b/src/yuzu_cmd/emu_window/emu_window_sdl2.h
index 1d835c3c6..d34902109 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.h
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.h
@@ -10,7 +10,7 @@
10 10
11struct SDL_Window; 11struct SDL_Window;
12 12
13class EmuWindow_SDL2 : public EmuWindow { 13class EmuWindow_SDL2 : public Core::Frontend::EmuWindow {
14public: 14public:
15 explicit EmuWindow_SDL2(bool fullscreen); 15 explicit EmuWindow_SDL2(bool fullscreen);
16 ~EmuWindow_SDL2(); 16 ~EmuWindow_SDL2();