From aaa7beeda8be312294a32e620a172c33cb231866 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 4 Feb 2016 00:03:20 -0500 Subject: renderer_opengl: Use GLvec3/GLvec4 aliases for commonly used types. --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 4 ++-- src/video_core/renderer_opengl/gl_rasterizer.h | 19 ++++++++++--------- src/video_core/renderer_opengl/pica_to_gl.h | 5 ++++- src/video_core/renderer_opengl/renderer_opengl.cpp | 4 ++-- 4 files changed, 18 insertions(+), 14 deletions(-) (limited to 'src/video_core/renderer_opengl') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 6ed67efeb..b7d19bf94 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -920,7 +920,7 @@ void RasterizerOpenGL::SyncGlobalAmbient() { } void RasterizerOpenGL::SyncLightingLUT(unsigned lut_index) { - std::array, 256> new_data; + std::array new_data; for (unsigned offset = 0; offset < new_data.size(); ++offset) { new_data[offset][0] = Pica::g_state.lighting.luts[(lut_index * 4) + 0][offset].ToFloat(); @@ -969,7 +969,7 @@ void RasterizerOpenGL::SyncLightAmbient(int light_index) { } void RasterizerOpenGL::SyncLightPosition(int light_index) { - std::array position = { + GLvec3 position = { Pica::float16::FromRaw(Pica::g_state.regs.lighting.light[light_index].x).ToFloat32(), Pica::float16::FromRaw(Pica::g_state.regs.lighting.light[light_index].y).ToFloat32(), Pica::float16::FromRaw(Pica::g_state.regs.lighting.light[light_index].z).ToFloat32() }; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 99266854c..e7fec30cf 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -17,6 +17,7 @@ #include "video_core/rasterizer_interface.h" #include "video_core/renderer_opengl/gl_rasterizer_cache.h" #include "video_core/renderer_opengl/gl_state.h" +#include "video_core/renderer_opengl/pica_to_gl.h" #include "video_core/shader/shader_interpreter.h" /** @@ -288,27 +289,27 @@ private: }; struct LightSrc { - std::array specular_0; + GLvec3 specular_0; INSERT_PADDING_WORDS(1); - std::array specular_1; + GLvec3 specular_1; INSERT_PADDING_WORDS(1); - std::array diffuse; + GLvec3 diffuse; INSERT_PADDING_WORDS(1); - std::array ambient; + GLvec3 ambient; INSERT_PADDING_WORDS(1); - std::array position; + GLvec3 position; INSERT_PADDING_WORDS(1); }; /// Uniform structure for the Uniform Buffer Object, all members must be 16-byte aligned struct UniformData { // A vec4 color for each of the six tev stages - std::array const_color[6]; - std::array tev_combiner_buffer_color; + GLvec4 const_color[6]; + GLvec4 tev_combiner_buffer_color; GLint alphatest_ref; GLfloat depth_offset; INSERT_PADDING_WORDS(2); - std::array lighting_global_ambient; + GLvec3 lighting_global_ambient; INSERT_PADDING_WORDS(1); LightSrc light_src[8]; }; @@ -434,5 +435,5 @@ private: OGLFramebuffer framebuffer; std::array lighting_lut; - std::array, 256>, 6> lighting_lut_data; + std::array, 6> lighting_lut_data; }; diff --git a/src/video_core/renderer_opengl/pica_to_gl.h b/src/video_core/renderer_opengl/pica_to_gl.h index 346c9391d..3d6c4e9e5 100644 --- a/src/video_core/renderer_opengl/pica_to_gl.h +++ b/src/video_core/renderer_opengl/pica_to_gl.h @@ -10,6 +10,9 @@ #include "video_core/pica.h" +using GLvec3 = std::array; +using GLvec4 = std::array; + namespace PicaToGL { inline GLenum TextureFilterMode(Pica::Regs::TextureConfig::TextureFilter mode) { @@ -175,7 +178,7 @@ inline GLenum StencilOp(Pica::Regs::StencilAction action) { return stencil_op_table[(unsigned)action]; } -inline std::array ColorRGBA8(const u32 color) { +inline GLvec4 ColorRGBA8(const u32 color) { return { { (color >> 0 & 0xFF) / 255.0f, (color >> 8 & 0xFF) / 255.0f, (color >> 16 & 0xFF) / 255.0f, diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index a6a38f0af..ca3a6a6b4 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -81,8 +81,8 @@ struct ScreenRectVertex { * The projection part of the matrix is trivial, hence these operations are represented * by a 3x2 matrix. */ -static std::array MakeOrthographicMatrix(const float width, const float height) { - std::array matrix; +static std::array MakeOrthographicMatrix(const float width, const float height) { + std::array matrix; matrix[0] = 2.f / width; matrix[2] = 0.f; matrix[4] = -1.f; matrix[1] = 0.f; matrix[3] = -2.f / height; matrix[5] = 1.f; -- cgit v1.2.3