diff options
Diffstat (limited to 'src/video_core/rasterizer.cpp')
| -rw-r--r-- | src/video_core/rasterizer.cpp | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 7f66c6d42..845f1c4b2 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp | |||
| @@ -528,18 +528,48 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, | |||
| 528 | auto params = registers.output_merger.alpha_blending; | 528 | auto params = registers.output_merger.alpha_blending; |
| 529 | 529 | ||
| 530 | auto LookupFactorRGB = [&](decltype(params)::BlendFactor factor) -> Math::Vec3<u8> { | 530 | auto LookupFactorRGB = [&](decltype(params)::BlendFactor factor) -> Math::Vec3<u8> { |
| 531 | switch(factor) { | 531 | switch (factor) { |
| 532 | case params.Zero: | 532 | case params.Zero: |
| 533 | return Math::Vec3<u8>(0, 0, 0); | 533 | return Math::Vec3<u8>(0, 0, 0); |
| 534 | 534 | ||
| 535 | case params.One: | 535 | case params.One: |
| 536 | return Math::Vec3<u8>(255, 255, 255); | 536 | return Math::Vec3<u8>(255, 255, 255); |
| 537 | 537 | ||
| 538 | case params.SourceColor: | ||
| 539 | return combiner_output.rgb(); | ||
| 540 | |||
| 541 | case params.OneMinusSourceColor: | ||
| 542 | return Math::Vec3<u8>(255 - combiner_output.r(), 255 - combiner_output.g(), 255 - combiner_output.b()); | ||
| 543 | |||
| 544 | case params.DestColor: | ||
| 545 | return dest.rgb(); | ||
| 546 | |||
| 547 | case params.OneMinusDestColor: | ||
| 548 | return Math::Vec3<u8>(255 - dest.r(), 255 - dest.g(), 255 - dest.b()); | ||
| 549 | |||
| 538 | case params.SourceAlpha: | 550 | case params.SourceAlpha: |
| 539 | return Math::MakeVec(combiner_output.a(), combiner_output.a(), combiner_output.a()); | 551 | return Math::Vec3<u8>(combiner_output.a(), combiner_output.a(), combiner_output.a()); |
| 540 | 552 | ||
| 541 | case params.OneMinusSourceAlpha: | 553 | case params.OneMinusSourceAlpha: |
| 542 | return Math::Vec3<u8>(255-combiner_output.a(), 255-combiner_output.a(), 255-combiner_output.a()); | 554 | return Math::Vec3<u8>(255 - combiner_output.a(), 255 - combiner_output.a(), 255 - combiner_output.a()); |
| 555 | |||
| 556 | case params.DestAlpha: | ||
| 557 | return Math::Vec3<u8>(dest.a(), dest.a(), dest.a()); | ||
| 558 | |||
| 559 | case params.OneMinusDestAlpha: | ||
| 560 | return Math::Vec3<u8>(255 - dest.a(), 255 - dest.a(), 255 - dest.a()); | ||
| 561 | |||
| 562 | case params.ConstantColor: | ||
| 563 | return Math::Vec3<u8>(registers.output_merger.blend_const.r, registers.output_merger.blend_const.g, registers.output_merger.blend_const.b); | ||
| 564 | |||
| 565 | case params.OneMinusConstantColor: | ||
| 566 | return Math::Vec3<u8>(255 - registers.output_merger.blend_const.r, 255 - registers.output_merger.blend_const.g, 255 - registers.output_merger.blend_const.b); | ||
| 567 | |||
| 568 | case params.ConstantAlpha: | ||
| 569 | return Math::Vec3<u8>(registers.output_merger.blend_const.a, registers.output_merger.blend_const.a, registers.output_merger.blend_const.a); | ||
| 570 | |||
| 571 | case params.OneMinusConstantAlpha: | ||
| 572 | return Math::Vec3<u8>(255 - registers.output_merger.blend_const.a, 255 - registers.output_merger.blend_const.a, 255 - registers.output_merger.blend_const.a); | ||
| 543 | 573 | ||
| 544 | default: | 574 | default: |
| 545 | LOG_CRITICAL(HW_GPU, "Unknown color blend factor %x", factor); | 575 | LOG_CRITICAL(HW_GPU, "Unknown color blend factor %x", factor); |
| @@ -549,7 +579,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, | |||
| 549 | }; | 579 | }; |
| 550 | 580 | ||
| 551 | auto LookupFactorA = [&](decltype(params)::BlendFactor factor) -> u8 { | 581 | auto LookupFactorA = [&](decltype(params)::BlendFactor factor) -> u8 { |
| 552 | switch(factor) { | 582 | switch (factor) { |
| 553 | case params.Zero: | 583 | case params.Zero: |
| 554 | return 0; | 584 | return 0; |
| 555 | 585 | ||
| @@ -562,6 +592,18 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, | |||
| 562 | case params.OneMinusSourceAlpha: | 592 | case params.OneMinusSourceAlpha: |
| 563 | return 255 - combiner_output.a(); | 593 | return 255 - combiner_output.a(); |
| 564 | 594 | ||
| 595 | case params.DestAlpha: | ||
| 596 | return dest.a(); | ||
| 597 | |||
| 598 | case params.OneMinusDestAlpha: | ||
| 599 | return 255 - dest.a(); | ||
| 600 | |||
| 601 | case params.ConstantAlpha: | ||
| 602 | return registers.output_merger.blend_const.a; | ||
| 603 | |||
| 604 | case params.OneMinusConstantAlpha: | ||
| 605 | return 255 - registers.output_merger.blend_const.a; | ||
| 606 | |||
| 565 | default: | 607 | default: |
| 566 | LOG_CRITICAL(HW_GPU, "Unknown alpha blend factor %x", factor); | 608 | LOG_CRITICAL(HW_GPU, "Unknown alpha blend factor %x", factor); |
| 567 | exit(0); | 609 | exit(0); |