diff options
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 19 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/pica_to_gl.h | 5 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 4 |
4 files changed, 18 insertions, 14 deletions
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() { | |||
| 920 | } | 920 | } |
| 921 | 921 | ||
| 922 | void RasterizerOpenGL::SyncLightingLUT(unsigned lut_index) { | 922 | void RasterizerOpenGL::SyncLightingLUT(unsigned lut_index) { |
| 923 | std::array<std::array<GLfloat, 4>, 256> new_data; | 923 | std::array<GLvec4, 256> new_data; |
| 924 | 924 | ||
| 925 | for (unsigned offset = 0; offset < new_data.size(); ++offset) { | 925 | for (unsigned offset = 0; offset < new_data.size(); ++offset) { |
| 926 | new_data[offset][0] = Pica::g_state.lighting.luts[(lut_index * 4) + 0][offset].ToFloat(); | 926 | 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) { | |||
| 969 | } | 969 | } |
| 970 | 970 | ||
| 971 | void RasterizerOpenGL::SyncLightPosition(int light_index) { | 971 | void RasterizerOpenGL::SyncLightPosition(int light_index) { |
| 972 | std::array<GLfloat, 3> position = { | 972 | GLvec3 position = { |
| 973 | Pica::float16::FromRaw(Pica::g_state.regs.lighting.light[light_index].x).ToFloat32(), | 973 | Pica::float16::FromRaw(Pica::g_state.regs.lighting.light[light_index].x).ToFloat32(), |
| 974 | Pica::float16::FromRaw(Pica::g_state.regs.lighting.light[light_index].y).ToFloat32(), | 974 | Pica::float16::FromRaw(Pica::g_state.regs.lighting.light[light_index].y).ToFloat32(), |
| 975 | Pica::float16::FromRaw(Pica::g_state.regs.lighting.light[light_index].z).ToFloat32() }; | 975 | 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 @@ | |||
| 17 | #include "video_core/rasterizer_interface.h" | 17 | #include "video_core/rasterizer_interface.h" |
| 18 | #include "video_core/renderer_opengl/gl_rasterizer_cache.h" | 18 | #include "video_core/renderer_opengl/gl_rasterizer_cache.h" |
| 19 | #include "video_core/renderer_opengl/gl_state.h" | 19 | #include "video_core/renderer_opengl/gl_state.h" |
| 20 | #include "video_core/renderer_opengl/pica_to_gl.h" | ||
| 20 | #include "video_core/shader/shader_interpreter.h" | 21 | #include "video_core/shader/shader_interpreter.h" |
| 21 | 22 | ||
| 22 | /** | 23 | /** |
| @@ -288,27 +289,27 @@ private: | |||
| 288 | }; | 289 | }; |
| 289 | 290 | ||
| 290 | struct LightSrc { | 291 | struct LightSrc { |
| 291 | std::array<GLfloat, 3> specular_0; | 292 | GLvec3 specular_0; |
| 292 | INSERT_PADDING_WORDS(1); | 293 | INSERT_PADDING_WORDS(1); |
| 293 | std::array<GLfloat, 3> specular_1; | 294 | GLvec3 specular_1; |
| 294 | INSERT_PADDING_WORDS(1); | 295 | INSERT_PADDING_WORDS(1); |
| 295 | std::array<GLfloat, 3> diffuse; | 296 | GLvec3 diffuse; |
| 296 | INSERT_PADDING_WORDS(1); | 297 | INSERT_PADDING_WORDS(1); |
| 297 | std::array<GLfloat, 3> ambient; | 298 | GLvec3 ambient; |
| 298 | INSERT_PADDING_WORDS(1); | 299 | INSERT_PADDING_WORDS(1); |
| 299 | std::array<GLfloat, 3> position; | 300 | GLvec3 position; |
| 300 | INSERT_PADDING_WORDS(1); | 301 | INSERT_PADDING_WORDS(1); |
| 301 | }; | 302 | }; |
| 302 | 303 | ||
| 303 | /// Uniform structure for the Uniform Buffer Object, all members must be 16-byte aligned | 304 | /// Uniform structure for the Uniform Buffer Object, all members must be 16-byte aligned |
| 304 | struct UniformData { | 305 | struct UniformData { |
| 305 | // A vec4 color for each of the six tev stages | 306 | // A vec4 color for each of the six tev stages |
| 306 | std::array<GLfloat, 4> const_color[6]; | 307 | GLvec4 const_color[6]; |
| 307 | std::array<GLfloat, 4> tev_combiner_buffer_color; | 308 | GLvec4 tev_combiner_buffer_color; |
| 308 | GLint alphatest_ref; | 309 | GLint alphatest_ref; |
| 309 | GLfloat depth_offset; | 310 | GLfloat depth_offset; |
| 310 | INSERT_PADDING_WORDS(2); | 311 | INSERT_PADDING_WORDS(2); |
| 311 | std::array<GLfloat, 3> lighting_global_ambient; | 312 | GLvec3 lighting_global_ambient; |
| 312 | INSERT_PADDING_WORDS(1); | 313 | INSERT_PADDING_WORDS(1); |
| 313 | LightSrc light_src[8]; | 314 | LightSrc light_src[8]; |
| 314 | }; | 315 | }; |
| @@ -434,5 +435,5 @@ private: | |||
| 434 | OGLFramebuffer framebuffer; | 435 | OGLFramebuffer framebuffer; |
| 435 | 436 | ||
| 436 | std::array<OGLTexture, 6> lighting_lut; | 437 | std::array<OGLTexture, 6> lighting_lut; |
| 437 | std::array<std::array<std::array<GLfloat, 4>, 256>, 6> lighting_lut_data; | 438 | std::array<std::array<GLvec4, 256>, 6> lighting_lut_data; |
| 438 | }; | 439 | }; |
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 @@ | |||
| 10 | 10 | ||
| 11 | #include "video_core/pica.h" | 11 | #include "video_core/pica.h" |
| 12 | 12 | ||
| 13 | using GLvec3 = std::array<GLfloat, 3>; | ||
| 14 | using GLvec4 = std::array<GLfloat, 4>; | ||
| 15 | |||
| 13 | namespace PicaToGL { | 16 | namespace PicaToGL { |
| 14 | 17 | ||
| 15 | inline GLenum TextureFilterMode(Pica::Regs::TextureConfig::TextureFilter mode) { | 18 | inline GLenum TextureFilterMode(Pica::Regs::TextureConfig::TextureFilter mode) { |
| @@ -175,7 +178,7 @@ inline GLenum StencilOp(Pica::Regs::StencilAction action) { | |||
| 175 | return stencil_op_table[(unsigned)action]; | 178 | return stencil_op_table[(unsigned)action]; |
| 176 | } | 179 | } |
| 177 | 180 | ||
| 178 | inline std::array<GLfloat, 4> ColorRGBA8(const u32 color) { | 181 | inline GLvec4 ColorRGBA8(const u32 color) { |
| 179 | return { { (color >> 0 & 0xFF) / 255.0f, | 182 | return { { (color >> 0 & 0xFF) / 255.0f, |
| 180 | (color >> 8 & 0xFF) / 255.0f, | 183 | (color >> 8 & 0xFF) / 255.0f, |
| 181 | (color >> 16 & 0xFF) / 255.0f, | 184 | (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 { | |||
| 81 | * The projection part of the matrix is trivial, hence these operations are represented | 81 | * The projection part of the matrix is trivial, hence these operations are represented |
| 82 | * by a 3x2 matrix. | 82 | * by a 3x2 matrix. |
| 83 | */ | 83 | */ |
| 84 | static std::array<GLfloat, 3*2> MakeOrthographicMatrix(const float width, const float height) { | 84 | static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, const float height) { |
| 85 | std::array<GLfloat, 3*2> matrix; | 85 | std::array<GLfloat, 3 * 2> matrix; |
| 86 | 86 | ||
| 87 | matrix[0] = 2.f / width; matrix[2] = 0.f; matrix[4] = -1.f; | 87 | matrix[0] = 2.f / width; matrix[2] = 0.f; matrix[4] = -1.f; |
| 88 | matrix[1] = 0.f; matrix[3] = -2.f / height; matrix[5] = 1.f; | 88 | matrix[1] = 0.f; matrix[3] = -2.f / height; matrix[5] = 1.f; |