citra-emu
/
citra
Archived
1
0
Fork 0

renderer_opengl: Header cleanup

* Should help with building times
This commit is contained in:
emufan4568 2022-08-21 02:22:57 +03:00
parent 07a69b7c7b
commit 2726fe66db
15 changed files with 43 additions and 96 deletions

View File

@ -103,6 +103,7 @@ inline PixelFormat PixelFormatFromDepthFormat(Pica::FramebufferRegs::DepthFormat
} }
inline constexpr PixelFormat PixelFormatFromGPUPixelFormat(GPU::Regs::PixelFormat format) { inline constexpr PixelFormat PixelFormatFromGPUPixelFormat(GPU::Regs::PixelFormat format) {
const u32 format_index = static_cast<u32>(format);
switch (format) { switch (format) {
// RGB565 and RGB5A1 are switched in PixelFormat compared to ColorFormat // RGB565 and RGB5A1 are switched in PixelFormat compared to ColorFormat
case GPU::Regs::PixelFormat::RGB565: case GPU::Regs::PixelFormat::RGB565:
@ -110,7 +111,7 @@ inline constexpr PixelFormat PixelFormatFromGPUPixelFormat(GPU::Regs::PixelForma
case GPU::Regs::PixelFormat::RGB5A1: case GPU::Regs::PixelFormat::RGB5A1:
return PixelFormat::RGB5A1; return PixelFormat::RGB5A1;
default: default:
return ((unsigned int)format < 5) ? (PixelFormat)format : PixelFormat::Invalid; return (format_index < 5) ? static_cast<PixelFormat>(format) : PixelFormat::Invalid;
} }
} }
@ -179,7 +180,7 @@ static constexpr u32 GetFormatBpp(PixelFormat format) {
case PixelFormat::A4: case PixelFormat::A4:
case PixelFormat::ETC1: case PixelFormat::ETC1:
return 4; return 4;
case PixelFormat::Invalid: default:
return 0; return 0;
} }
} }

View File

@ -3,13 +3,6 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once #pragma once
#include <array>
#include <cstddef>
#include <string>
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "video_core/regs_framebuffer.h" #include "video_core/regs_framebuffer.h"
#include "video_core/regs_lighting.h" #include "video_core/regs_lighting.h"
#include "video_core/regs_pipeline.h" #include "video_core/regs_pipeline.h"

View File

@ -3,9 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once #pragma once
#include <array> #include <array>
#include "common/assert.h" #include "common/assert.h"
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_funcs.h" #include "common/common_funcs.h"

View File

@ -1,28 +1,18 @@
// Copyright 2015 Citra Emulator Project // Copyright 2022 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <algorithm>
#include <memory>
#include <string>
#include <tuple>
#include <utility>
#include <glad/glad.h>
#include "common/alignment.h" #include "common/alignment.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/math_util.h" #include "common/math_util.h"
#include "common/microprofile.h" #include "common/microprofile.h"
#include "common/vector_math.h"
#include "core/hw/gpu.h"
#include "video_core/pica_state.h" #include "video_core/pica_state.h"
#include "video_core/regs_framebuffer.h" #include "video_core/regs_framebuffer.h"
#include "video_core/regs_rasterizer.h" #include "video_core/regs_rasterizer.h"
#include "video_core/regs_texturing.h"
#include "video_core/renderer_opengl/gl_rasterizer.h" #include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/renderer_opengl/gl_shader_gen.h" #include "video_core/renderer_opengl/gl_shader_gen.h"
#include "video_core/renderer_opengl/gl_vars.h" #include "video_core/renderer_opengl/gl_vars.h"
#include "video_core/renderer_opengl/pica_to_gl.h"
#include "video_core/renderer_opengl/renderer_opengl.h" #include "video_core/renderer_opengl/renderer_opengl.h"
#include "video_core/video_core.h" #include "video_core/video_core.h"
@ -35,6 +25,13 @@ MICROPROFILE_DEFINE(OpenGL_Drawing, "OpenGL", "Drawing", MP_RGB(128, 128, 192));
MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(100, 100, 255)); MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(100, 100, 255));
MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100)); MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100));
#ifdef __APPLE__
static bool IsVendorIntel() {
std::string gpu_vendor{reinterpret_cast<char const*>(glGetString(GL_VENDOR))};
return gpu_vendor == "Intel Inc.";
}
#endif
RasterizerOpenGL::RasterizerOpenGL(Frontend::EmuWindow& emu_window) RasterizerOpenGL::RasterizerOpenGL(Frontend::EmuWindow& emu_window)
: vertex_buffer(GL_ARRAY_BUFFER, VERTEX_BUFFER_SIZE), : vertex_buffer(GL_ARRAY_BUFFER, VERTEX_BUFFER_SIZE),
uniform_buffer(GL_UNIFORM_BUFFER, UNIFORM_BUFFER_SIZE, false), uniform_buffer(GL_UNIFORM_BUFFER, UNIFORM_BUFFER_SIZE, false),
@ -148,15 +145,13 @@ RasterizerOpenGL::RasterizerOpenGL(Frontend::EmuWindow& emu_window)
if (IsVendorIntel()) { if (IsVendorIntel()) {
shader_program_manager = std::make_unique<ShaderProgramManager>( shader_program_manager = std::make_unique<ShaderProgramManager>(
emu_window, emu_window,
VideoCore::g_separable_shader_enabled ? GLAD_GL_ARB_separate_shader_objects : false, VideoCore::g_separable_shader_enabled ? GLAD_GL_ARB_separate_shader_objects : false);
is_amd);
} else { } else {
shader_program_manager = std::make_unique<ShaderProgramManager>( shader_program_manager = std::make_unique<ShaderProgramManager>(
emu_window, GLAD_GL_ARB_separate_shader_objects, is_amd); emu_window, GLAD_GL_ARB_separate_shader_objects);
} }
#else #else
shader_program_manager = std::make_unique<ShaderProgramManager>( shader_program_manager = std::make_unique<ShaderProgramManager>(emu_window, true);
emu_window, GLAD_GL_ARB_separate_shader_objects);
#endif #endif
glEnable(GL_BLEND); glEnable(GL_BLEND);

View File

@ -1,28 +1,15 @@
// Copyright 2015 Citra Emulator Project // Copyright 2022 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once #pragma once
#include <array>
#include <cstddef>
#include <cstring>
#include <memory>
#include <vector>
#include <glad/glad.h>
#include "common/bit_field.h"
#include "common/common_types.h"
#include "common/vector_math.h" #include "common/vector_math.h"
#include "core/hw/gpu.h" #include "core/hw/gpu.h"
#include "video_core/pica_state.h"
#include "video_core/pica_types.h" #include "video_core/pica_types.h"
#include "video_core/rasterizer_interface.h" #include "video_core/rasterizer_interface.h"
#include "video_core/regs_framebuffer.h"
#include "video_core/regs_lighting.h" #include "video_core/regs_lighting.h"
#include "video_core/regs_rasterizer.h"
#include "video_core/regs_texturing.h" #include "video_core/regs_texturing.h"
#include "video_core/rasterizer_cache/rasterizer_cache.h" #include "video_core/rasterizer_cache/rasterizer_cache.h"
#include "video_core/renderer_opengl/gl_resource_manager.h"
#include "video_core/renderer_opengl/gl_shader_manager.h" #include "video_core/renderer_opengl/gl_shader_manager.h"
#include "video_core/renderer_opengl/gl_state.h" #include "video_core/renderer_opengl/gl_state.h"
#include "video_core/renderer_opengl/gl_stream_buffer.h" #include "video_core/renderer_opengl/gl_stream_buffer.h"

View File

@ -1,10 +1,7 @@
// Copyright 2015 Citra Emulator Project // Copyright 2022 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <utility>
#include <glad/glad.h>
#include "common/common_types.h"
#include "common/microprofile.h" #include "common/microprofile.h"
#include "video_core/renderer_opengl/gl_resource_manager.h" #include "video_core/renderer_opengl/gl_resource_manager.h"
#include "video_core/renderer_opengl/gl_shader_util.h" #include "video_core/renderer_opengl/gl_shader_util.h"

View File

@ -1,4 +1,4 @@
// Copyright 2015 Citra Emulator Project // Copyright 2022 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -8,7 +8,6 @@
#include <vector> #include <vector>
#include <glad/glad.h> #include <glad/glad.h>
#include "common/common_types.h" #include "common/common_types.h"
#include "video_core/renderer_opengl/gl_shader_util.h"
namespace OpenGL { namespace OpenGL {

View File

@ -1,21 +1,13 @@
// Copyright 2015 Citra Emulator Project // Copyright 2022 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <array>
#include <cstddef>
#include <string_view> #include <string_view>
#include <fmt/format.h> #include <fmt/format.h>
#include "common/assert.h"
#include "common/bit_field.h"
#include "common/bit_set.h" #include "common/bit_set.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/core.h" #include "core/core.h"
#include "video_core/regs_framebuffer.h" #include "video_core/pica_state.h"
#include "video_core/regs_lighting.h"
#include "video_core/regs_rasterizer.h"
#include "video_core/regs_texturing.h"
#include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/renderer_opengl/gl_shader_decompiler.h" #include "video_core/renderer_opengl/gl_shader_decompiler.h"
#include "video_core/renderer_opengl/gl_shader_gen.h" #include "video_core/renderer_opengl/gl_shader_gen.h"
#include "video_core/renderer_opengl/gl_shader_util.h" #include "video_core/renderer_opengl/gl_shader_util.h"

View File

@ -3,13 +3,8 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once #pragma once
#include <array>
#include <cstring>
#include <functional> #include <functional>
#include <optional> #include <optional>
#include <string>
#include <type_traits>
#include "common/hash.h" #include "common/hash.h"
#include "video_core/regs.h" #include "video_core/regs.h"
#include "video_core/shader/shader.h" #include "video_core/shader/shader.h"

View File

@ -1,16 +1,18 @@
// Copyright 2018 Citra Emulator Project // Copyright 2022 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <algorithm> #include <algorithm>
#include <thread> #include <thread>
#include <unordered_map> #include <unordered_map>
#include <boost/functional/hash.hpp>
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/functional/hash.hpp>
#include "core/frontend/scope_acquire_context.h" #include "core/frontend/scope_acquire_context.h"
#include "video_core/renderer_opengl/gl_resource_manager.h"
#include "video_core/renderer_opengl/gl_shader_disk_cache.h" #include "video_core/renderer_opengl/gl_shader_disk_cache.h"
#include "video_core/renderer_opengl/gl_shader_manager.h" #include "video_core/renderer_opengl/gl_shader_manager.h"
#include "video_core/renderer_opengl/gl_vars.h" #include "video_core/renderer_opengl/gl_vars.h"
#include "video_core/renderer_opengl/gl_state.h"
#include "video_core/video_core.h" #include "video_core/video_core.h"
namespace OpenGL { namespace OpenGL {

View File

@ -1,22 +1,25 @@
// Copyright 2018 Citra Emulator Project // Copyright 2022 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once #pragma once
#include <memory> #include <memory>
#include <glad/glad.h>
#include "video_core/rasterizer_interface.h" #include "video_core/rasterizer_interface.h"
#include "video_core/regs_lighting.h"
#include "video_core/renderer_opengl/gl_resource_manager.h"
#include "video_core/renderer_opengl/gl_shader_gen.h"
#include "video_core/renderer_opengl/gl_state.h"
#include "video_core/renderer_opengl/pica_to_gl.h" #include "video_core/renderer_opengl/pica_to_gl.h"
namespace Core { namespace Core {
class System; class System;
} }
namespace Pica {
struct Regs;
struct ShaderRegs;
namespace Shader {
struct ShaderSetup;
}
}
namespace OpenGL { namespace OpenGL {
enum class UniformBindings : GLuint { Common, VS, GS }; enum class UniformBindings : GLuint { Common, VS, GS };
@ -96,6 +99,8 @@ static_assert(
static_assert(sizeof(VSUniformData) < 16384, static_assert(sizeof(VSUniformData) < 16384,
"VSUniformData structure must be less than 16kb as per the OpenGL spec"); "VSUniformData structure must be less than 16kb as per the OpenGL spec");
class OpenGLState;
/// A class that manage different shader stages and configures them with given config data. /// A class that manage different shader stages and configures them with given config data.
class ShaderProgramManager { class ShaderProgramManager {
public: public:

View File

@ -1,9 +1,7 @@
// Copyright 2018 Citra Emulator Project // Copyright 2022 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <deque>
#include <vector>
#include "common/alignment.h" #include "common/alignment.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/microprofile.h" #include "common/microprofile.h"

View File

@ -1,12 +1,9 @@
// Copyright 2018 Citra Emulator Project // Copyright 2022 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once #pragma once
#include <tuple> #include <tuple>
#include <glad/glad.h>
#include "common/common_types.h"
#include "video_core/renderer_opengl/gl_resource_manager.h" #include "video_core/renderer_opengl/gl_resource_manager.h"
namespace OpenGL { namespace OpenGL {

View File

@ -1,27 +1,14 @@
// Copyright 2014 Citra Emulator Project // Copyright 2022 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <algorithm>
#include <array>
#include <condition_variable>
#include <cstddef>
#include <cstdlib>
#include <deque>
#include <memory>
#include <mutex>
#include <glad/glad.h>
#include <queue> #include <queue>
#include "common/assert.h"
#include "common/bit_field.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/microprofile.h" #include "common/microprofile.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h"
#include "core/dumping/backend.h" #include "core/dumping/backend.h"
#include "core/frontend/emu_window.h" #include "core/frontend/emu_window.h"
#include "core/frontend/framebuffer_layout.h" #include "core/frontend/framebuffer_layout.h"
#include "core/hw/gpu.h"
#include "core/hw/hw.h" #include "core/hw/hw.h"
#include "core/hw/lcd.h" #include "core/hw/lcd.h"
#include "core/memory.h" #include "core/memory.h"
@ -30,6 +17,7 @@
#include "video_core/debug_utils/debug_utils.h" #include "video_core/debug_utils/debug_utils.h"
#include "video_core/rasterizer_interface.h" #include "video_core/rasterizer_interface.h"
#include "video_core/renderer_opengl/gl_state.h" #include "video_core/renderer_opengl/gl_state.h"
#include "video_core/renderer_opengl/gl_shader_util.h"
#include "video_core/renderer_opengl/gl_vars.h" #include "video_core/renderer_opengl/gl_vars.h"
#include "video_core/renderer_opengl/post_processing_opengl.h" #include "video_core/renderer_opengl/post_processing_opengl.h"
#include "video_core/renderer_opengl/renderer_opengl.h" #include "video_core/renderer_opengl/renderer_opengl.h"
@ -526,7 +514,6 @@ void RendererOpenGL::RenderToMailbox(const Layout::FramebufferLayout& layout,
mailbox->ReloadRenderFrame(frame, layout.width, layout.height); mailbox->ReloadRenderFrame(frame, layout.width, layout.height);
} }
GLuint render_texture = frame->color.handle;
state.draw.draw_framebuffer = frame->render.handle; state.draw.draw_framebuffer = frame->render.handle;
state.Apply(); state.Apply();
DrawScreens(layout, flipped); DrawScreens(layout, flipped);
@ -1200,6 +1187,8 @@ static const char* GetSource(GLenum source) {
UNREACHABLE(); UNREACHABLE();
} }
#undef RET #undef RET
return "";
} }
static const char* GetType(GLenum type) { static const char* GetType(GLenum type) {
@ -1218,6 +1207,8 @@ static const char* GetType(GLenum type) {
UNREACHABLE(); UNREACHABLE();
} }
#undef RET #undef RET
return "";
} }
static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severity, static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severity,

View File

@ -1,13 +1,10 @@
// Copyright 2014 Citra Emulator Project // Copyright 2022 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once #pragma once
#include <array> #include <array>
#include <glad/glad.h>
#include "common/common_types.h"
#include "common/math_util.h"
#include "core/hw/gpu.h" #include "core/hw/gpu.h"
#include "video_core/renderer_base.h" #include "video_core/renderer_base.h"
#include "video_core/renderer_opengl/frame_dumper_opengl.h" #include "video_core/renderer_opengl/frame_dumper_opengl.h"