diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-08-30 14:15:35 +0200 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-09-03 20:09:51 +0200 |
commit | 466e608c19c5bd70392bd4f4049fc7ba9963a14c (patch) | |
tree | e08a8ca19c935f4b2513151e0f280a29940f6d24 /src/video_core/renderer_opengl | |
parent | OpenGL: Add support for Sampler Objects to state tracker (diff) | |
download | yuzu-466e608c19c5bd70392bd4f4049fc7ba9963a14c.tar yuzu-466e608c19c5bd70392bd4f4049fc7ba9963a14c.tar.gz yuzu-466e608c19c5bd70392bd4f4049fc7ba9963a14c.tar.bz2 yuzu-466e608c19c5bd70392bd4f4049fc7ba9963a14c.tar.lz yuzu-466e608c19c5bd70392bd4f4049fc7ba9963a14c.tar.xz yuzu-466e608c19c5bd70392bd4f4049fc7ba9963a14c.tar.zst yuzu-466e608c19c5bd70392bd4f4049fc7ba9963a14c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 6 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/pica_to_gl.h | 10 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 80e773728..b556ea65b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -658,7 +658,7 @@ void RasterizerOpenGL::SyncBlendFuncs() { } void RasterizerOpenGL::SyncBlendColor() { - auto blend_color = PicaToGL::ColorRGBA8((u8*)&Pica::g_state.regs.output_merger.blend_const.r); + auto blend_color = PicaToGL::ColorRGBA8(Pica::g_state.regs.output_merger.blend_const.raw); state.blend.color.red = blend_color[0]; state.blend.color.green = blend_color[1]; state.blend.color.blue = blend_color[2]; @@ -728,7 +728,7 @@ void RasterizerOpenGL::SyncTevOps(unsigned stage_index, const Pica::Regs::TevSta } void RasterizerOpenGL::SyncTevColor(unsigned stage_index, const Pica::Regs::TevStageConfig& config) { - auto const_color = PicaToGL::ColorRGBA8((u8*)&config.const_r); + auto const_color = PicaToGL::ColorRGBA8(config.const_color); glUniform4fv(uniform_tev_cfgs[stage_index].const_color, 1, const_color.data()); } @@ -737,7 +737,7 @@ void RasterizerOpenGL::SyncTevMultipliers(unsigned stage_index, const Pica::Regs } void RasterizerOpenGL::SyncCombinerColor() { - auto combiner_color = PicaToGL::ColorRGBA8((u8*)&Pica::g_state.regs.tev_combiner_buffer_color.r); + auto combiner_color = PicaToGL::ColorRGBA8(Pica::g_state.regs.tev_combiner_buffer_color.raw); glUniform4fv(uniform_tev_combiner_buffer_color, 1, combiner_color.data()); } diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 1e38c2e6d..5d9a80cd4 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -46,7 +46,7 @@ void RasterizerCacheOpenGL::LoadAndBindTexture(OpenGLState &state, unsigned text glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_t); if (wrap_s == GL_CLAMP_TO_BORDER || wrap_t == GL_CLAMP_TO_BORDER) { - auto border_color = PicaToGL::ColorRGBA8((u8*)&config.config.border_color.r); + auto border_color = PicaToGL::ColorRGBA8(config.config.border_color.raw); glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, border_color.data()); } diff --git a/src/video_core/renderer_opengl/pica_to_gl.h b/src/video_core/renderer_opengl/pica_to_gl.h index 6344f467f..04c1d1a34 100644 --- a/src/video_core/renderer_opengl/pica_to_gl.h +++ b/src/video_core/renderer_opengl/pica_to_gl.h @@ -175,11 +175,11 @@ inline GLenum StencilOp(Pica::Regs::StencilAction action) { return stencil_op_table[(unsigned)action]; } -inline std::array<GLfloat, 4> ColorRGBA8(const u8* bytes) { - return { { bytes[0] / 255.0f, - bytes[1] / 255.0f, - bytes[2] / 255.0f, - bytes[3] / 255.0f +inline std::array<GLfloat, 4> ColorRGBA8(const u32 color) { + return { { (color >> 0 & 0xFF) / 255.0f, + (color >> 8 & 0xFF) / 255.0f, + (color >> 16 & 0xFF) / 255.0f, + (color >> 24 & 0xFF) / 255.0f } }; } |