summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2015-05-07 18:37:59 -0400
committerGravatar bunnei2015-05-09 22:26:17 -0400
commit23e8be573ef047d8a0bee191f4065dbcd60a7f65 (patch)
treee4274244ccd93c0b4e15e84f551c99382e8169d9 /src
parentrasterizer: Implemented AddSigned combiner op. (diff)
downloadyuzu-23e8be573ef047d8a0bee191f4065dbcd60a7f65.tar.gz
yuzu-23e8be573ef047d8a0bee191f4065dbcd60a7f65.tar.xz
yuzu-23e8be573ef047d8a0bee191f4065dbcd60a7f65.zip
rasterizer: Implemented combiner output scaling.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/pica.h13
-rw-r--r--src/video_core/rasterizer.cpp5
2 files changed, 16 insertions, 2 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 26a700038..5e169ff69 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -300,7 +300,18 @@ struct Regs {
300 BitField<24, 8, u32> const_a; 300 BitField<24, 8, u32> const_a;
301 }; 301 };
302 302
303 INSERT_PADDING_WORDS(0x1); 303 union {
304 BitField< 0, 2, u32> color_scale;
305 BitField<16, 2, u32> alpha_scale;
306 };
307
308 inline unsigned GetColorMultiplier() const {
309 return (color_scale < 3) ? (1 << color_scale) : 1;
310 }
311
312 inline unsigned GetAlphaMultiplier() const {
313 return (alpha_scale < 3) ? (1 << alpha_scale) : 1;
314 }
304 }; 315 };
305 316
306 TevStageConfig tev_stage0; 317 TevStageConfig tev_stage0;
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index f74721d4b..46a326bb4 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -597,7 +597,10 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
597 }; 597 };
598 auto alpha_output = AlphaCombine(tev_stage.alpha_op, alpha_result); 598 auto alpha_output = AlphaCombine(tev_stage.alpha_op, alpha_result);
599 599
600 combiner_output = Math::MakeVec(color_output, alpha_output); 600 combiner_output[0] = std::min((unsigned)255, color_output.r() * tev_stage.GetColorMultiplier());
601 combiner_output[1] = std::min((unsigned)255, color_output.g() * tev_stage.GetColorMultiplier());
602 combiner_output[2] = std::min((unsigned)255, color_output.b() * tev_stage.GetColorMultiplier());
603 combiner_output[3] = std::min((unsigned)255, alpha_output * tev_stage.GetAlphaMultiplier());
601 604
602 if (registers.tev_combiner_buffer_input.TevStageUpdatesCombinerBufferColor(tev_stage_index)) { 605 if (registers.tev_combiner_buffer_input.TevStageUpdatesCombinerBufferColor(tev_stage_index)) {
603 combiner_buffer.r() = combiner_output.r(); 606 combiner_buffer.r() = combiner_output.r();