From 33b9abb91e17e39ebadfa34ff3f6dac9f07f87d7 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 25 May 2015 18:45:05 -0400 Subject: Pica: Use zero for the SecondaryFragmentColor source. - This is a workaround until we support fragment lighting. --- src/video_core/pica.h | 1 + src/video_core/rasterizer.cpp | 7 ++++++- src/video_core/renderer_opengl/gl_shaders.h | 24 ++++++++++++++---------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/video_core/pica.h b/src/video_core/pica.h index f8313d20d..8ad47a928 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -240,6 +240,7 @@ struct Regs { enum class Source : u32 { PrimaryColor = 0x0, PrimaryFragmentColor = 0x1, + SecondaryFragmentColor = 0x2, Texture0 = 0x3, Texture1 = 0x4, diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index e0f8d9e6f..113b573f8 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -402,11 +402,16 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, auto GetSource = [&](Source source) -> Math::Vec4 { switch (source) { - // TODO: What's the difference between these two? case Source::PrimaryColor: + + // HACK: Until we implement fragment lighting, use primary_color case Source::PrimaryFragmentColor: return primary_color; + // HACK: Until we implement fragment lighting, use zero + case Source::SecondaryFragmentColor: + return {0, 0, 0, 0}; + case Source::Texture0: return texture_color[0]; diff --git a/src/video_core/renderer_opengl/gl_shaders.h b/src/video_core/renderer_opengl/gl_shaders.h index 8f0941230..a8cb2f595 100644 --- a/src/video_core/renderer_opengl/gl_shaders.h +++ b/src/video_core/renderer_opengl/gl_shaders.h @@ -69,15 +69,16 @@ const char g_fragment_shader_hw[] = R"( #define NUM_VTX_ATTR 7 #define NUM_TEV_STAGES 6 -#define SOURCE_PRIMARYCOLOR 0x0 -#define SOURCE_PRIMARYFRAGMENTCOLOR 0x1 -#define SOURCE_TEXTURE0 0x3 -#define SOURCE_TEXTURE1 0x4 -#define SOURCE_TEXTURE2 0x5 -#define SOURCE_TEXTURE3 0x6 -#define SOURCE_PREVIOUSBUFFER 0xd -#define SOURCE_CONSTANT 0xe -#define SOURCE_PREVIOUS 0xf +#define SOURCE_PRIMARYCOLOR 0x0 +#define SOURCE_PRIMARYFRAGMENTCOLOR 0x1 +#define SOURCE_SECONDARYFRAGMENTCOLOR 0x2 +#define SOURCE_TEXTURE0 0x3 +#define SOURCE_TEXTURE1 0x4 +#define SOURCE_TEXTURE2 0x5 +#define SOURCE_TEXTURE3 0x6 +#define SOURCE_PREVIOUSBUFFER 0xd +#define SOURCE_CONSTANT 0xe +#define SOURCE_PREVIOUS 0xf #define COLORMODIFIER_SOURCECOLOR 0x0 #define COLORMODIFIER_ONEMINUSSOURCECOLOR 0x1 @@ -151,8 +152,11 @@ vec4 GetSource(int source) { if (source == SOURCE_PRIMARYCOLOR) { return o[2]; } else if (source == SOURCE_PRIMARYFRAGMENTCOLOR) { - // HACK: Uses color value, but should really use fragment lighting output + // HACK: Until we implement fragment lighting, use primary_color return o[2]; + } else if (source == SOURCE_SECONDARYFRAGMENTCOLOR) { + // HACK: Until we implement fragment lighting, use zero + return vec4(0.0, 0.0, 0.0, 0.0); } else if (source == SOURCE_TEXTURE0) { return texture(tex[0], o[3].xy); } else if (source == SOURCE_TEXTURE1) { -- cgit v1.2.3