diff options
| author | 2015-05-06 22:18:11 -0400 | |
|---|---|---|
| committer | 2015-05-09 22:12:36 -0400 | |
| commit | a806b420a64d44e8b9a0d6f0a742d7eaad06168a (patch) | |
| tree | 5620a7882d73cbefbf63a0a0813507fc512eef16 /src/video_core/rasterizer.cpp | |
| parent | rasterizer: Return zero'd vectors on error conditions. (diff) | |
| download | yuzu-a806b420a64d44e8b9a0d6f0a742d7eaad06168a.tar.gz yuzu-a806b420a64d44e8b9a0d6f0a742d7eaad06168a.tar.xz yuzu-a806b420a64d44e8b9a0d6f0a742d7eaad06168a.zip | |
rasterizer: Implement combiner buffer input.
Diffstat (limited to 'src/video_core/rasterizer.cpp')
| -rw-r--r-- | src/video_core/rasterizer.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 3b36afad9..7bdb503c8 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp | |||
| @@ -376,7 +376,13 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, | |||
| 376 | // with some basic arithmetic. Alpha combiners can be configured separately but work | 376 | // with some basic arithmetic. Alpha combiners can be configured separately but work |
| 377 | // analogously. | 377 | // analogously. |
| 378 | Math::Vec4<u8> combiner_output; | 378 | Math::Vec4<u8> combiner_output; |
| 379 | for (const auto& tev_stage : tev_stages) { | 379 | Math::Vec4<u8> combiner_buffer = { |
| 380 | registers.tev_combiner_buffer_color.r, registers.tev_combiner_buffer_color.g, | ||
| 381 | registers.tev_combiner_buffer_color.b, registers.tev_combiner_buffer_color.a | ||
| 382 | }; | ||
| 383 | |||
| 384 | for (unsigned tev_stage_index = 0; tev_stage_index < tev_stages.size(); ++tev_stage_index) { | ||
| 385 | const auto& tev_stage = tev_stages[tev_stage_index]; | ||
| 380 | using Source = Regs::TevStageConfig::Source; | 386 | using Source = Regs::TevStageConfig::Source; |
| 381 | using ColorModifier = Regs::TevStageConfig::ColorModifier; | 387 | using ColorModifier = Regs::TevStageConfig::ColorModifier; |
| 382 | using AlphaModifier = Regs::TevStageConfig::AlphaModifier; | 388 | using AlphaModifier = Regs::TevStageConfig::AlphaModifier; |
| @@ -398,6 +404,9 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, | |||
| 398 | case Source::Texture2: | 404 | case Source::Texture2: |
| 399 | return texture_color[2]; | 405 | return texture_color[2]; |
| 400 | 406 | ||
| 407 | case Source::PreviousBuffer: | ||
| 408 | return combiner_buffer; | ||
| 409 | |||
| 401 | case Source::Constant: | 410 | case Source::Constant: |
| 402 | return {tev_stage.const_r, tev_stage.const_g, tev_stage.const_b, tev_stage.const_a}; | 411 | return {tev_stage.const_r, tev_stage.const_g, tev_stage.const_b, tev_stage.const_a}; |
| 403 | 412 | ||
| @@ -579,6 +588,16 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, | |||
| 579 | auto alpha_output = AlphaCombine(tev_stage.alpha_op, alpha_result); | 588 | auto alpha_output = AlphaCombine(tev_stage.alpha_op, alpha_result); |
| 580 | 589 | ||
| 581 | combiner_output = Math::MakeVec(color_output, alpha_output); | 590 | combiner_output = Math::MakeVec(color_output, alpha_output); |
| 591 | |||
| 592 | if (registers.tev_combiner_buffer_input.TevStageUpdatesCombinerBufferColor(tev_stage_index)) { | ||
| 593 | combiner_buffer.r() = combiner_output.r(); | ||
| 594 | combiner_buffer.g() = combiner_output.g(); | ||
| 595 | combiner_buffer.b() = combiner_output.b(); | ||
| 596 | } | ||
| 597 | |||
| 598 | if (registers.tev_combiner_buffer_input.TevStageUpdatesCombinerBufferAlpha(tev_stage_index)) { | ||
| 599 | combiner_buffer.a() = combiner_output.a(); | ||
| 600 | } | ||
| 582 | } | 601 | } |
| 583 | 602 | ||
| 584 | if (registers.output_merger.alpha_test.enable) { | 603 | if (registers.output_merger.alpha_test.enable) { |