renderer_opengl: Namespace OpenGL code
Namespaces all OpenGL code under the OpenGL namespace. Prevents polluting the global namespace and allows clear distinction between other renderers' code in the future.
This commit is contained in:
parent
b38d67d940
commit
dd35b4b18a
@ -25,6 +25,8 @@
|
|||||||
#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"
|
||||||
|
|
||||||
|
namespace OpenGL {
|
||||||
|
|
||||||
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
||||||
using PixelFormat = SurfaceParams::PixelFormat;
|
using PixelFormat = SurfaceParams::PixelFormat;
|
||||||
using SurfaceType = SurfaceParams::SurfaceType;
|
using SurfaceType = SurfaceParams::SurfaceType;
|
||||||
@ -874,3 +876,5 @@ void RasterizerOpenGL::SyncLogicOpState() {
|
|||||||
|
|
||||||
state.logic_op.operation = MaxwellToGL::LogicOp(regs.logic_op.operation);
|
state.logic_op.operation = MaxwellToGL::LogicOp(regs.logic_op.operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace OpenGL
|
||||||
|
@ -22,12 +22,14 @@
|
|||||||
#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"
|
||||||
|
|
||||||
struct ScreenInfo;
|
|
||||||
|
|
||||||
namespace Core::Frontend {
|
namespace Core::Frontend {
|
||||||
class EmuWindow;
|
class EmuWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace OpenGL {
|
||||||
|
|
||||||
|
struct ScreenInfo;
|
||||||
|
|
||||||
class RasterizerOpenGL : public VideoCore::RasterizerInterface {
|
class RasterizerOpenGL : public VideoCore::RasterizerInterface {
|
||||||
public:
|
public:
|
||||||
explicit RasterizerOpenGL(Core::Frontend::EmuWindow& renderer, ScreenInfo& info);
|
explicit RasterizerOpenGL(Core::Frontend::EmuWindow& renderer, ScreenInfo& info);
|
||||||
@ -184,3 +186,5 @@ private:
|
|||||||
enum class AccelDraw { Disabled, Arrays, Indexed };
|
enum class AccelDraw { Disabled, Arrays, Indexed };
|
||||||
AccelDraw accelerate_draw = AccelDraw::Disabled;
|
AccelDraw accelerate_draw = AccelDraw::Disabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace OpenGL
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#include "video_core/textures/decoders.h"
|
#include "video_core/textures/decoders.h"
|
||||||
#include "video_core/utils.h"
|
#include "video_core/utils.h"
|
||||||
|
|
||||||
|
namespace OpenGL {
|
||||||
|
|
||||||
using SurfaceType = SurfaceParams::SurfaceType;
|
using SurfaceType = SurfaceParams::SurfaceType;
|
||||||
using PixelFormat = SurfaceParams::PixelFormat;
|
using PixelFormat = SurfaceParams::PixelFormat;
|
||||||
using ComponentType = SurfaceParams::ComponentType;
|
using ComponentType = SurfaceParams::ComponentType;
|
||||||
@ -967,3 +969,5 @@ void RasterizerCacheOpenGL::UpdatePagesCachedCount(Tegra::GPUVAddr addr, u64 siz
|
|||||||
if (delta < 0)
|
if (delta < 0)
|
||||||
cached_pages.add({pages_interval, delta});
|
cached_pages.add({pages_interval, delta});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace OpenGL
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
#include "video_core/renderer_opengl/gl_resource_manager.h"
|
#include "video_core/renderer_opengl/gl_resource_manager.h"
|
||||||
#include "video_core/textures/texture.h"
|
#include "video_core/textures/texture.h"
|
||||||
|
|
||||||
|
namespace OpenGL {
|
||||||
|
|
||||||
class CachedSurface;
|
class CachedSurface;
|
||||||
using Surface = std::shared_ptr<CachedSurface>;
|
using Surface = std::shared_ptr<CachedSurface>;
|
||||||
using SurfaceSurfaceRect_Tuple = std::tuple<Surface, Surface, MathUtil::Rectangle<u32>>;
|
using SurfaceSurfaceRect_Tuple = std::tuple<Surface, Surface, MathUtil::Rectangle<u32>>;
|
||||||
@ -759,3 +761,5 @@ private:
|
|||||||
OGLFramebuffer read_framebuffer;
|
OGLFramebuffer read_framebuffer;
|
||||||
OGLFramebuffer draw_framebuffer;
|
OGLFramebuffer draw_framebuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace OpenGL
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include "video_core/renderer_opengl/gl_shader_util.h"
|
#include "video_core/renderer_opengl/gl_shader_util.h"
|
||||||
#include "video_core/renderer_opengl/gl_state.h"
|
#include "video_core/renderer_opengl/gl_state.h"
|
||||||
|
|
||||||
|
namespace OpenGL {
|
||||||
|
|
||||||
class OGLTexture : private NonCopyable {
|
class OGLTexture : private NonCopyable {
|
||||||
public:
|
public:
|
||||||
OGLTexture() = default;
|
OGLTexture() = default;
|
||||||
@ -331,3 +333,5 @@ public:
|
|||||||
|
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace OpenGL
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "video_core/renderer_opengl/gl_rasterizer.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"
|
||||||
|
|
||||||
namespace GLShader::Decompiler {
|
namespace OpenGL::GLShader::Decompiler {
|
||||||
|
|
||||||
using Tegra::Shader::Attribute;
|
using Tegra::Shader::Attribute;
|
||||||
using Tegra::Shader::Instruction;
|
using Tegra::Shader::Instruction;
|
||||||
@ -2176,4 +2176,4 @@ boost::optional<ProgramResult> DecompileProgram(const ProgramCode& program_code,
|
|||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace GLShader::Decompiler
|
} // namespace OpenGL::GLShader::Decompiler
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "video_core/engines/maxwell_3d.h"
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
#include "video_core/renderer_opengl/gl_shader_gen.h"
|
#include "video_core/renderer_opengl/gl_shader_gen.h"
|
||||||
|
|
||||||
namespace GLShader::Decompiler {
|
namespace OpenGL::GLShader::Decompiler {
|
||||||
|
|
||||||
using Tegra::Engines::Maxwell3D;
|
using Tegra::Engines::Maxwell3D;
|
||||||
|
|
||||||
@ -22,4 +22,4 @@ boost::optional<ProgramResult> DecompileProgram(const ProgramCode& program_code,
|
|||||||
Maxwell3D::Regs::ShaderStage stage,
|
Maxwell3D::Regs::ShaderStage stage,
|
||||||
const std::string& suffix);
|
const std::string& suffix);
|
||||||
|
|
||||||
} // namespace GLShader::Decompiler
|
} // namespace OpenGL::GLShader::Decompiler
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#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"
|
||||||
|
|
||||||
namespace GLShader {
|
namespace OpenGL::GLShader {
|
||||||
|
|
||||||
using Tegra::Engines::Maxwell3D;
|
using Tegra::Engines::Maxwell3D;
|
||||||
|
|
||||||
@ -103,4 +103,4 @@ void main() {
|
|||||||
return {out, program.second};
|
return {out, program.second};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace GLShader
|
} // namespace OpenGL::GLShader
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/hash.h"
|
#include "common/hash.h"
|
||||||
|
|
||||||
namespace GLShader {
|
namespace OpenGL::GLShader {
|
||||||
|
|
||||||
constexpr size_t MAX_PROGRAM_CODE_LENGTH{0x1000};
|
constexpr size_t MAX_PROGRAM_CODE_LENGTH{0x1000};
|
||||||
|
|
||||||
@ -191,20 +191,20 @@ ProgramResult GenerateVertexShader(const ShaderSetup& setup, const MaxwellVSConf
|
|||||||
*/
|
*/
|
||||||
ProgramResult GenerateFragmentShader(const ShaderSetup& setup, const MaxwellFSConfig& config);
|
ProgramResult GenerateFragmentShader(const ShaderSetup& setup, const MaxwellFSConfig& config);
|
||||||
|
|
||||||
} // namespace GLShader
|
} // namespace OpenGL::GLShader
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<GLShader::MaxwellVSConfig> {
|
struct hash<OpenGL::GLShader::MaxwellVSConfig> {
|
||||||
size_t operator()(const GLShader::MaxwellVSConfig& k) const {
|
size_t operator()(const OpenGL::GLShader::MaxwellVSConfig& k) const {
|
||||||
return k.Hash();
|
return k.Hash();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<GLShader::MaxwellFSConfig> {
|
struct hash<OpenGL::GLShader::MaxwellFSConfig> {
|
||||||
size_t operator()(const GLShader::MaxwellFSConfig& k) const {
|
size_t operator()(const OpenGL::GLShader::MaxwellFSConfig& k) const {
|
||||||
return k.Hash();
|
return k.Hash();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "video_core/engines/maxwell_3d.h"
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
#include "video_core/renderer_opengl/gl_shader_manager.h"
|
#include "video_core/renderer_opengl/gl_shader_manager.h"
|
||||||
|
|
||||||
namespace GLShader {
|
namespace OpenGL::GLShader {
|
||||||
|
|
||||||
namespace Impl {
|
namespace Impl {
|
||||||
static void SetShaderUniformBlockBinding(GLuint shader, const char* name,
|
static void SetShaderUniformBlockBinding(GLuint shader, const char* name,
|
||||||
@ -49,4 +49,4 @@ void MaxwellUniformData::SetFromRegs(const Maxwell3D::State::ShaderStageInfo& sh
|
|||||||
instance_id[0] = state.current_instance;
|
instance_id[0] = state.current_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace GLShader
|
} // namespace OpenGL::GLShader
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "video_core/renderer_opengl/gl_shader_gen.h"
|
#include "video_core/renderer_opengl/gl_shader_gen.h"
|
||||||
#include "video_core/renderer_opengl/maxwell_to_gl.h"
|
#include "video_core/renderer_opengl/maxwell_to_gl.h"
|
||||||
|
|
||||||
namespace GLShader {
|
namespace OpenGL::GLShader {
|
||||||
|
|
||||||
/// Number of OpenGL texture samplers that can be used in the fragment shader
|
/// Number of OpenGL texture samplers that can be used in the fragment shader
|
||||||
static constexpr size_t NumTextureSamplers = 32;
|
static constexpr size_t NumTextureSamplers = 32;
|
||||||
@ -171,4 +171,4 @@ private:
|
|||||||
OGLPipeline pipeline;
|
OGLPipeline pipeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace GLShader
|
} // namespace OpenGL::GLShader
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "video_core/renderer_opengl/gl_shader_util.h"
|
#include "video_core/renderer_opengl/gl_shader_util.h"
|
||||||
|
|
||||||
namespace GLShader {
|
namespace OpenGL::GLShader {
|
||||||
|
|
||||||
GLuint LoadShader(const char* source, GLenum type) {
|
GLuint LoadShader(const char* source, GLenum type) {
|
||||||
const char* debug_type;
|
const char* debug_type;
|
||||||
@ -47,4 +47,4 @@ GLuint LoadShader(const char* source, GLenum type) {
|
|||||||
return shader_id;
|
return shader_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace GLShader
|
} // namespace OpenGL::GLShader
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
|
||||||
namespace GLShader {
|
namespace OpenGL::GLShader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility function to log the source code of a list of shaders.
|
* Utility function to log the source code of a list of shaders.
|
||||||
@ -89,4 +89,4 @@ GLuint LoadProgram(bool separable_program, T... shaders) {
|
|||||||
return program_id;
|
return program_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace GLShader
|
} // namespace OpenGL::GLShader
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "video_core/renderer_opengl/gl_state.h"
|
#include "video_core/renderer_opengl/gl_state.h"
|
||||||
|
|
||||||
|
namespace OpenGL {
|
||||||
|
|
||||||
OpenGLState OpenGLState::cur_state;
|
OpenGLState OpenGLState::cur_state;
|
||||||
|
|
||||||
OpenGLState::OpenGLState() {
|
OpenGLState::OpenGLState() {
|
||||||
@ -338,3 +340,5 @@ OpenGLState& OpenGLState::ResetFramebuffer(GLuint handle) {
|
|||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace OpenGL
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
#include "video_core/engines/maxwell_3d.h"
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
|
|
||||||
|
namespace OpenGL {
|
||||||
|
|
||||||
using Regs = Tegra::Engines::Maxwell3D::Regs;
|
using Regs = Tegra::Engines::Maxwell3D::Regs;
|
||||||
|
|
||||||
namespace TextureUnits {
|
namespace TextureUnits {
|
||||||
@ -163,3 +165,5 @@ public:
|
|||||||
private:
|
private:
|
||||||
static OpenGLState cur_state;
|
static OpenGLState cur_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace OpenGL
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#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"
|
||||||
|
|
||||||
|
namespace OpenGL {
|
||||||
|
|
||||||
OGLStreamBuffer::OGLStreamBuffer(GLenum target, GLsizeiptr size, bool prefer_coherent)
|
OGLStreamBuffer::OGLStreamBuffer(GLenum target, GLsizeiptr size, bool prefer_coherent)
|
||||||
: gl_target(target), buffer_size(size) {
|
: gl_target(target), buffer_size(size) {
|
||||||
gl_buffer.Create();
|
gl_buffer.Create();
|
||||||
@ -97,3 +99,5 @@ void OGLStreamBuffer::Unmap(GLsizeiptr size) {
|
|||||||
|
|
||||||
buffer_pos += size;
|
buffer_pos += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace OpenGL
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include "common/common_types.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 {
|
||||||
|
|
||||||
class OGLStreamBuffer : private NonCopyable {
|
class OGLStreamBuffer : private NonCopyable {
|
||||||
public:
|
public:
|
||||||
explicit OGLStreamBuffer(GLenum target, GLsizeiptr size, bool prefer_coherent = false);
|
explicit OGLStreamBuffer(GLenum target, GLsizeiptr size, bool prefer_coherent = false);
|
||||||
@ -42,3 +44,5 @@ private:
|
|||||||
GLsizeiptr mapped_size = 0;
|
GLsizeiptr mapped_size = 0;
|
||||||
u8* mapped_ptr = nullptr;
|
u8* mapped_ptr = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace OpenGL
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "video_core/engines/maxwell_3d.h"
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
|
|
||||||
|
namespace OpenGL {
|
||||||
|
|
||||||
using GLvec2 = std::array<GLfloat, 2>;
|
using GLvec2 = std::array<GLfloat, 2>;
|
||||||
using GLvec3 = std::array<GLfloat, 3>;
|
using GLvec3 = std::array<GLfloat, 3>;
|
||||||
using GLvec4 = std::array<GLfloat, 4>;
|
using GLvec4 = std::array<GLfloat, 4>;
|
||||||
@ -360,3 +362,4 @@ inline GLenum LogicOp(Maxwell::LogicOperation operation) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace MaxwellToGL
|
} // namespace MaxwellToGL
|
||||||
|
} // namespace OpenGL
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#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"
|
||||||
|
|
||||||
|
namespace OpenGL {
|
||||||
|
|
||||||
static const char vertex_shader[] = R"(
|
static const char vertex_shader[] = R"(
|
||||||
#version 150 core
|
#version 150 core
|
||||||
|
|
||||||
@ -476,3 +478,5 @@ bool RendererOpenGL::Init() {
|
|||||||
|
|
||||||
/// Shutdown the renderer
|
/// Shutdown the renderer
|
||||||
void RendererOpenGL::ShutDown() {}
|
void RendererOpenGL::ShutDown() {}
|
||||||
|
|
||||||
|
} // namespace OpenGL
|
||||||
|
@ -16,6 +16,8 @@ namespace Core::Frontend {
|
|||||||
class EmuWindow;
|
class EmuWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace OpenGL {
|
||||||
|
|
||||||
/// Structure used for storing information about the textures for the Switch screen
|
/// Structure used for storing information about the textures for the Switch screen
|
||||||
struct TextureInfo {
|
struct TextureInfo {
|
||||||
OGLTexture resource;
|
OGLTexture resource;
|
||||||
@ -98,3 +100,5 @@ private:
|
|||||||
Tegra::FramebufferConfig::TransformFlags framebuffer_transform_flags;
|
Tegra::FramebufferConfig::TransformFlags framebuffer_transform_flags;
|
||||||
MathUtil::Rectangle<int> framebuffer_crop_rect;
|
MathUtil::Rectangle<int> framebuffer_crop_rect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace OpenGL
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
namespace VideoCore {
|
namespace VideoCore {
|
||||||
|
|
||||||
std::unique_ptr<RendererBase> CreateRenderer(Core::Frontend::EmuWindow& emu_window) {
|
std::unique_ptr<RendererBase> CreateRenderer(Core::Frontend::EmuWindow& emu_window) {
|
||||||
return std::make_unique<RendererOpenGL>(emu_window);
|
return std::make_unique<OpenGL::RendererOpenGL>(emu_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace VideoCore
|
} // namespace VideoCore
|
||||||
|
Loading…
Reference in New Issue
Block a user