diff options
Diffstat (limited to 'src/video_core/swrasterizer/rasterizer.cpp')
| -rw-r--r-- | src/video_core/swrasterizer/rasterizer.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/video_core/swrasterizer/rasterizer.cpp b/src/video_core/swrasterizer/rasterizer.cpp index 20addf0bd..e9edf0360 100644 --- a/src/video_core/swrasterizer/rasterizer.cpp +++ b/src/video_core/swrasterizer/rasterizer.cpp | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include "video_core/regs_texturing.h" | 23 | #include "video_core/regs_texturing.h" |
| 24 | #include "video_core/shader/shader.h" | 24 | #include "video_core/shader/shader.h" |
| 25 | #include "video_core/swrasterizer/framebuffer.h" | 25 | #include "video_core/swrasterizer/framebuffer.h" |
| 26 | #include "video_core/swrasterizer/proctex.h" | ||
| 26 | #include "video_core/swrasterizer/rasterizer.h" | 27 | #include "video_core/swrasterizer/rasterizer.h" |
| 27 | #include "video_core/swrasterizer/texturing.h" | 28 | #include "video_core/swrasterizer/texturing.h" |
| 28 | #include "video_core/texture/texture_decode.h" | 29 | #include "video_core/texture/texture_decode.h" |
| @@ -268,7 +269,7 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve | |||
| 268 | uv[2].u() = GetInterpolatedAttribute(v0.tc2.u(), v1.tc2.u(), v2.tc2.u()); | 269 | uv[2].u() = GetInterpolatedAttribute(v0.tc2.u(), v1.tc2.u(), v2.tc2.u()); |
| 269 | uv[2].v() = GetInterpolatedAttribute(v0.tc2.v(), v1.tc2.v(), v2.tc2.v()); | 270 | uv[2].v() = GetInterpolatedAttribute(v0.tc2.v(), v1.tc2.v(), v2.tc2.v()); |
| 270 | 271 | ||
| 271 | Math::Vec4<u8> texture_color[3]{}; | 272 | Math::Vec4<u8> texture_color[4]{}; |
| 272 | for (int i = 0; i < 3; ++i) { | 273 | for (int i = 0; i < 3; ++i) { |
| 273 | const auto& texture = textures[i]; | 274 | const auto& texture = textures[i]; |
| 274 | if (!texture.enabled) | 275 | if (!texture.enabled) |
| @@ -334,6 +335,13 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve | |||
| 334 | } | 335 | } |
| 335 | } | 336 | } |
| 336 | 337 | ||
| 338 | // sample procedural texture | ||
| 339 | if (regs.texturing.main_config.texture3_enable) { | ||
| 340 | const auto& proctex_uv = uv[regs.texturing.main_config.texture3_coordinates]; | ||
| 341 | texture_color[3] = ProcTex(proctex_uv.u().ToFloat32(), proctex_uv.v().ToFloat32(), | ||
| 342 | g_state.regs.texturing, g_state.proctex); | ||
| 343 | } | ||
| 344 | |||
| 337 | // Texture environment - consists of 6 stages of color and alpha combining. | 345 | // Texture environment - consists of 6 stages of color and alpha combining. |
| 338 | // | 346 | // |
| 339 | // Color combiners take three input color values from some source (e.g. interpolated | 347 | // Color combiners take three input color values from some source (e.g. interpolated |
| @@ -376,6 +384,9 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve | |||
| 376 | case Source::Texture2: | 384 | case Source::Texture2: |
| 377 | return texture_color[2]; | 385 | return texture_color[2]; |
| 378 | 386 | ||
| 387 | case Source::Texture3: | ||
| 388 | return texture_color[3]; | ||
| 389 | |||
| 379 | case Source::PreviousBuffer: | 390 | case Source::PreviousBuffer: |
| 380 | return combiner_buffer; | 391 | return combiner_buffer; |
| 381 | 392 | ||