diff options
| author | 2015-01-03 13:45:10 +0100 | |
|---|---|---|
| committer | 2015-02-18 14:50:28 +0100 | |
| commit | 04cd06d5c285848c29278083891474ee78797c8a (patch) | |
| tree | 850483bcfd106c8c4e3257b96f1b71f06cd21e60 /src/video_core/rasterizer.cpp | |
| parent | Pica/OutputMerger: Fix flipped framebuffers. (diff) | |
| download | yuzu-04cd06d5c285848c29278083891474ee78797c8a.tar.gz yuzu-04cd06d5c285848c29278083891474ee78797c8a.tar.xz yuzu-04cd06d5c285848c29278083891474ee78797c8a.zip | |
Pica/TextureEnvironment: Add support for the MAD-like texture combiners and clean up texture environment logic.
Diffstat (limited to 'src/video_core/rasterizer.cpp')
| -rw-r--r-- | src/video_core/rasterizer.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 9cad5f9b6..eacca82e5 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp | |||
| @@ -419,6 +419,25 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, | |||
| 419 | return result.Cast<u8>(); | 419 | return result.Cast<u8>(); |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | case Operation::MultiplyThenAdd: | ||
| 423 | { | ||
| 424 | auto result = (input[0] * input[1] + 255 * input[2].Cast<int>()) / 255; | ||
| 425 | result.r() = std::min(255, result.r()); | ||
| 426 | result.g() = std::min(255, result.g()); | ||
| 427 | result.b() = std::min(255, result.b()); | ||
| 428 | return result.Cast<u8>(); | ||
| 429 | } | ||
| 430 | |||
| 431 | case Operation::AddThenMultiply: | ||
| 432 | { | ||
| 433 | auto result = input[0] + input[1]; | ||
| 434 | result.r() = std::min(255, result.r()); | ||
| 435 | result.g() = std::min(255, result.g()); | ||
| 436 | result.b() = std::min(255, result.b()); | ||
| 437 | result = (result * input[2].Cast<int>()) / 255; | ||
| 438 | return result.Cast<u8>(); | ||
| 439 | } | ||
| 440 | |||
| 422 | default: | 441 | default: |
| 423 | LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); | 442 | LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); |
| 424 | UNIMPLEMENTED(); | 443 | UNIMPLEMENTED(); |
| @@ -443,6 +462,12 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, | |||
| 443 | case Operation::Subtract: | 462 | case Operation::Subtract: |
| 444 | return std::max(0, (int)input[0] - (int)input[1]); | 463 | return std::max(0, (int)input[0] - (int)input[1]); |
| 445 | 464 | ||
| 465 | case Operation::MultiplyThenAdd: | ||
| 466 | return std::min(255, (input[0] * input[1] + 255 * input[2]) / 255); | ||
| 467 | |||
| 468 | case Operation::AddThenMultiply: | ||
| 469 | return (std::min(255, (input[0] + input[1])) * input[2]) / 255; | ||
| 470 | |||
| 446 | default: | 471 | default: |
| 447 | LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op); | 472 | LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op); |
| 448 | UNIMPLEMENTED(); | 473 | UNIMPLEMENTED(); |