summaryrefslogtreecommitdiffstats
path: root/src/video_core/rasterizer.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-05-12 03:47:08 +0200
committerbunnei <bunneidev@gmail.com>2016-05-12 03:47:08 +0200
commitf6eb62d0628d31efc4f93a0057ebd85bb39bc0fe (patch)
treefc06c2b51cbfbf4867ab885d32b0427ddc56e3b6 /src/video_core/rasterizer.cpp
parentMerge pull request #1780 from JayFoxRox/shadersetup-class (diff)
parentOpenGL: Implement texture type 3 (diff)
downloadyuzu-f6eb62d0628d31efc4f93a0057ebd85bb39bc0fe.tar
yuzu-f6eb62d0628d31efc4f93a0057ebd85bb39bc0fe.tar.gz
yuzu-f6eb62d0628d31efc4f93a0057ebd85bb39bc0fe.tar.bz2
yuzu-f6eb62d0628d31efc4f93a0057ebd85bb39bc0fe.tar.lz
yuzu-f6eb62d0628d31efc4f93a0057ebd85bb39bc0fe.tar.xz
yuzu-f6eb62d0628d31efc4f93a0057ebd85bb39bc0fe.tar.zst
yuzu-f6eb62d0628d31efc4f93a0057ebd85bb39bc0fe.zip
Diffstat (limited to 'src/video_core/rasterizer.cpp')
-rw-r--r--src/video_core/rasterizer.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index 80cad9056..65168f05a 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -442,8 +442,33 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
DEBUG_ASSERT(0 != texture.config.address);
- int s = (int)(uv[i].u() * float24::FromFloat32(static_cast<float>(texture.config.width))).ToFloat32();
- int t = (int)(uv[i].v() * float24::FromFloat32(static_cast<float>(texture.config.height))).ToFloat32();
+ float24 u = uv[i].u();
+ float24 v = uv[i].v();
+
+ // Only unit 0 respects the texturing type (according to 3DBrew)
+ // TODO: Refactor so cubemaps and shadowmaps can be handled
+ if (i == 0) {
+ switch(texture.config.type) {
+ case Regs::TextureConfig::Texture2D:
+ break;
+ case Regs::TextureConfig::Projection2D: {
+ auto tc0_w = GetInterpolatedAttribute(v0.tc0_w, v1.tc0_w, v2.tc0_w);
+ u /= tc0_w;
+ v /= tc0_w;
+ break;
+ }
+ default:
+ // TODO: Change to LOG_ERROR when more types are handled.
+ LOG_DEBUG(HW_GPU, "Unhandled texture type %x", (int)texture.config.type);
+ UNIMPLEMENTED();
+ break;
+ }
+ }
+
+ int s = (int)(u * float24::FromFloat32(static_cast<float>(texture.config.width))).ToFloat32();
+ int t = (int)(v * float24::FromFloat32(static_cast<float>(texture.config.height))).ToFloat32();
+
+
static auto GetWrappedTexCoord = [](Regs::TextureConfig::WrapMode mode, int val, unsigned size) {
switch (mode) {
case Regs::TextureConfig::ClampToEdge: