summaryrefslogtreecommitdiffstats
path: root/src/video_core/swrasterizer/rasterizer.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-05-25 06:37:42 +0200
committerGitHub <noreply@github.com>2017-05-25 06:37:42 +0200
commitbae3799bd5208d08bb52546ad0723103c94cada3 (patch)
treee4c921df6bf28cdeb50f48d1b7aa4d7a0bc002ed /src/video_core/swrasterizer/rasterizer.cpp
parentMerge pull request #2683 from bunnei/telemetry-framework (diff)
parentgl_rasterizer: implement procedural texture (diff)
downloadyuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar
yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.gz
yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.bz2
yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.lz
yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.xz
yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.tar.zst
yuzu-bae3799bd5208d08bb52546ad0723103c94cada3.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/swrasterizer/rasterizer.cpp13
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 @@
#include "video_core/regs_texturing.h"
#include "video_core/shader/shader.h"
#include "video_core/swrasterizer/framebuffer.h"
+#include "video_core/swrasterizer/proctex.h"
#include "video_core/swrasterizer/rasterizer.h"
#include "video_core/swrasterizer/texturing.h"
#include "video_core/texture/texture_decode.h"
@@ -268,7 +269,7 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve
uv[2].u() = GetInterpolatedAttribute(v0.tc2.u(), v1.tc2.u(), v2.tc2.u());
uv[2].v() = GetInterpolatedAttribute(v0.tc2.v(), v1.tc2.v(), v2.tc2.v());
- Math::Vec4<u8> texture_color[3]{};
+ Math::Vec4<u8> texture_color[4]{};
for (int i = 0; i < 3; ++i) {
const auto& texture = textures[i];
if (!texture.enabled)
@@ -334,6 +335,13 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve
}
}
+ // sample procedural texture
+ if (regs.texturing.main_config.texture3_enable) {
+ const auto& proctex_uv = uv[regs.texturing.main_config.texture3_coordinates];
+ texture_color[3] = ProcTex(proctex_uv.u().ToFloat32(), proctex_uv.v().ToFloat32(),
+ g_state.regs.texturing, g_state.proctex);
+ }
+
// Texture environment - consists of 6 stages of color and alpha combining.
//
// 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
case Source::Texture2:
return texture_color[2];
+ case Source::Texture3:
+ return texture_color[3];
+
case Source::PreviousBuffer:
return combiner_buffer;