summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/pica.h4
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp6
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp2
-rw-r--r--src/video_core/renderer_opengl/pica_to_gl.h10
4 files changed, 13 insertions, 9 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 855cb442e..c1dca5087 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -135,6 +135,7 @@ struct Regs {
};
union {
+ u32 raw;
BitField< 0, 8, u32> r;
BitField< 8, 8, u32> g;
BitField<16, 8, u32> b;
@@ -339,6 +340,7 @@ struct Regs {
};
union {
+ u32 const_color;
BitField< 0, 8, u32> const_r;
BitField< 8, 8, u32> const_g;
BitField<16, 8, u32> const_b;
@@ -389,6 +391,7 @@ struct Regs {
TevStageConfig tev_stage5;
union {
+ u32 raw;
BitField< 0, 8, u32> r;
BitField< 8, 8, u32> g;
BitField<16, 8, u32> b;
@@ -473,6 +476,7 @@ struct Regs {
};
union {
+ u32 raw;
BitField< 0, 8, u32> r;
BitField< 8, 8, u32> g;
BitField<16, 8, u32> b;
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
} };
}