diff options
| author | 2017-10-09 23:56:20 -0400 | |
|---|---|---|
| committer | 2017-10-09 23:56:20 -0400 | |
| commit | b1d5db1cf60344b6b081c9d03cb6ccc3264326cd (patch) | |
| tree | fde377c4ba3c0f92c032e6f5ec8627aae37270ef /src/video_core/swrasterizer/rasterizer.cpp | |
| parent | loader: Various improvements for NSO/NRO loaders. (diff) | |
| parent | Merge pull request #2996 from MerryMage/split-travis (diff) | |
| download | yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.tar.gz yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.tar.xz yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.zip | |
Merge remote-tracking branch 'upstream/master' into nx
# Conflicts:
# src/core/CMakeLists.txt
# src/core/arm/dynarmic/arm_dynarmic.cpp
# src/core/arm/dyncom/arm_dyncom.cpp
# src/core/hle/kernel/process.cpp
# src/core/hle/kernel/thread.cpp
# src/core/hle/kernel/thread.h
# src/core/hle/kernel/vm_manager.cpp
# src/core/loader/3dsx.cpp
# src/core/loader/elf.cpp
# src/core/loader/ncch.cpp
# src/core/memory.cpp
# src/core/memory.h
# src/core/memory_setup.h
Diffstat (limited to 'src/video_core/swrasterizer/rasterizer.cpp')
| -rw-r--r-- | src/video_core/swrasterizer/rasterizer.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/video_core/swrasterizer/rasterizer.cpp b/src/video_core/swrasterizer/rasterizer.cpp index 512e81c08..862135614 100644 --- a/src/video_core/swrasterizer/rasterizer.cpp +++ b/src/video_core/swrasterizer/rasterizer.cpp | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include "common/logging/log.h" | 13 | #include "common/logging/log.h" |
| 14 | #include "common/math_util.h" | 14 | #include "common/math_util.h" |
| 15 | #include "common/microprofile.h" | 15 | #include "common/microprofile.h" |
| 16 | #include "common/quaternion.h" | ||
| 16 | #include "common/vector_math.h" | 17 | #include "common/vector_math.h" |
| 17 | #include "core/hw/gpu.h" | 18 | #include "core/hw/gpu.h" |
| 18 | #include "core/memory.h" | 19 | #include "core/memory.h" |
| @@ -24,6 +25,7 @@ | |||
| 24 | #include "video_core/regs_texturing.h" | 25 | #include "video_core/regs_texturing.h" |
| 25 | #include "video_core/shader/shader.h" | 26 | #include "video_core/shader/shader.h" |
| 26 | #include "video_core/swrasterizer/framebuffer.h" | 27 | #include "video_core/swrasterizer/framebuffer.h" |
| 28 | #include "video_core/swrasterizer/lighting.h" | ||
| 27 | #include "video_core/swrasterizer/proctex.h" | 29 | #include "video_core/swrasterizer/proctex.h" |
| 28 | #include "video_core/swrasterizer/rasterizer.h" | 30 | #include "video_core/swrasterizer/rasterizer.h" |
| 29 | #include "video_core/swrasterizer/texturing.h" | 31 | #include "video_core/swrasterizer/texturing.h" |
| @@ -419,6 +421,26 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve | |||
| 419 | regs.texturing.tev_combiner_buffer_color.a, | 421 | regs.texturing.tev_combiner_buffer_color.a, |
| 420 | }; | 422 | }; |
| 421 | 423 | ||
| 424 | Math::Vec4<u8> primary_fragment_color = {0, 0, 0, 0}; | ||
| 425 | Math::Vec4<u8> secondary_fragment_color = {0, 0, 0, 0}; | ||
| 426 | |||
| 427 | if (!g_state.regs.lighting.disable) { | ||
| 428 | Math::Quaternion<float> normquat = Math::Quaternion<float>{ | ||
| 429 | {GetInterpolatedAttribute(v0.quat.x, v1.quat.x, v2.quat.x).ToFloat32(), | ||
| 430 | GetInterpolatedAttribute(v0.quat.y, v1.quat.y, v2.quat.y).ToFloat32(), | ||
| 431 | GetInterpolatedAttribute(v0.quat.z, v1.quat.z, v2.quat.z).ToFloat32()}, | ||
| 432 | GetInterpolatedAttribute(v0.quat.w, v1.quat.w, v2.quat.w).ToFloat32(), | ||
| 433 | }.Normalized(); | ||
| 434 | |||
| 435 | Math::Vec3<float> view{ | ||
| 436 | GetInterpolatedAttribute(v0.view.x, v1.view.x, v2.view.x).ToFloat32(), | ||
| 437 | GetInterpolatedAttribute(v0.view.y, v1.view.y, v2.view.y).ToFloat32(), | ||
| 438 | GetInterpolatedAttribute(v0.view.z, v1.view.z, v2.view.z).ToFloat32(), | ||
| 439 | }; | ||
| 440 | std::tie(primary_fragment_color, secondary_fragment_color) = ComputeFragmentsColors( | ||
| 441 | g_state.regs.lighting, g_state.lighting, normquat, view, texture_color); | ||
| 442 | } | ||
| 443 | |||
| 422 | for (unsigned tev_stage_index = 0; tev_stage_index < tev_stages.size(); | 444 | for (unsigned tev_stage_index = 0; tev_stage_index < tev_stages.size(); |
| 423 | ++tev_stage_index) { | 445 | ++tev_stage_index) { |
| 424 | const auto& tev_stage = tev_stages[tev_stage_index]; | 446 | const auto& tev_stage = tev_stages[tev_stage_index]; |
| @@ -427,14 +449,13 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve | |||
| 427 | auto GetSource = [&](Source source) -> Math::Vec4<u8> { | 449 | auto GetSource = [&](Source source) -> Math::Vec4<u8> { |
| 428 | switch (source) { | 450 | switch (source) { |
| 429 | case Source::PrimaryColor: | 451 | case Source::PrimaryColor: |
| 452 | return primary_color; | ||
| 430 | 453 | ||
| 431 | // HACK: Until we implement fragment lighting, use primary_color | ||
| 432 | case Source::PrimaryFragmentColor: | 454 | case Source::PrimaryFragmentColor: |
| 433 | return primary_color; | 455 | return primary_fragment_color; |
| 434 | 456 | ||
| 435 | // HACK: Until we implement fragment lighting, use zero | ||
| 436 | case Source::SecondaryFragmentColor: | 457 | case Source::SecondaryFragmentColor: |
| 437 | return {0, 0, 0, 0}; | 458 | return secondary_fragment_color; |
| 438 | 459 | ||
| 439 | case Source::Texture0: | 460 | case Source::Texture0: |
| 440 | return texture_color[0]; | 461 | return texture_color[0]; |