summaryrefslogtreecommitdiffstats
path: root/src/video_core/rasterizer.cpp
diff options
context:
space:
mode:
authorLectem <lectem@gmail.com>2015-07-07 23:36:06 +0200
committerLectem <lectem@gmail.com>2015-07-09 22:23:26 +0200
commit58d1c6398e555f95bc6da60467c3f49183eb18df (patch)
treee8e371e16943c9501594bf8ada6bad8e7c72012e /src/video_core/rasterizer.cpp
parentMerge pull request #797 from linkmauve/blended-downscaling (diff)
downloadyuzu-58d1c6398e555f95bc6da60467c3f49183eb18df.tar
yuzu-58d1c6398e555f95bc6da60467c3f49183eb18df.tar.gz
yuzu-58d1c6398e555f95bc6da60467c3f49183eb18df.tar.bz2
yuzu-58d1c6398e555f95bc6da60467c3f49183eb18df.tar.lz
yuzu-58d1c6398e555f95bc6da60467c3f49183eb18df.tar.xz
yuzu-58d1c6398e555f95bc6da60467c3f49183eb18df.tar.zst
yuzu-58d1c6398e555f95bc6da60467c3f49183eb18df.zip
Diffstat (limited to 'src/video_core/rasterizer.cpp')
-rw-r--r--src/video_core/rasterizer.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index 59d156ee7..70b115744 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -349,6 +349,9 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
val = std::min(val, (int)size - 1);
return val;
+ case Regs::TextureConfig::ClampToBorder:
+ return val;
+
case Regs::TextureConfig::Repeat:
return (int)((unsigned)val % size);
@@ -367,17 +370,23 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
}
};
- // Textures are laid out from bottom to top, hence we invert the t coordinate.
- // NOTE: This may not be the right place for the inversion.
- // TODO: Check if this applies to ETC textures, too.
- s = GetWrappedTexCoord(texture.config.wrap_s, s, texture.config.width);
- t = texture.config.height - 1 - GetWrappedTexCoord(texture.config.wrap_t, t, texture.config.height);
-
- u8* texture_data = Memory::GetPhysicalPointer(texture.config.GetPhysicalAddress());
- auto info = DebugUtils::TextureInfo::FromPicaRegister(texture.config, texture.format);
-
- texture_color[i] = DebugUtils::LookupTexture(texture_data, s, t, info);
- DebugUtils::DumpTexture(texture.config, texture_data);
+ if ((texture.config.wrap_s == Regs::TextureConfig::ClampToBorder && (s < 0 || s >= texture.config.width))
+ || (texture.config.wrap_t == Regs::TextureConfig::ClampToBorder && (t < 0 || t >= texture.config.height))) {
+ auto border_color = texture.config.border_color;
+ texture_color[i] = { border_color.r, border_color.g, border_color.b, border_color.a };
+ } else {
+ // Textures are laid out from bottom to top, hence we invert the t coordinate.
+ // NOTE: This may not be the right place for the inversion.
+ // TODO: Check if this applies to ETC textures, too.
+ s = GetWrappedTexCoord(texture.config.wrap_s, s, texture.config.width);
+ t = texture.config.height - 1 - GetWrappedTexCoord(texture.config.wrap_t, t, texture.config.height);
+
+ u8* texture_data = Memory::GetPhysicalPointer(texture.config.GetPhysicalAddress());
+ auto info = DebugUtils::TextureInfo::FromPicaRegister(texture.config, texture.format);
+
+ texture_color[i] = DebugUtils::LookupTexture(texture_data, s, t, info);
+ DebugUtils::DumpTexture(texture.config, texture_data);
+ }
}
// Texture environment - consists of 6 stages of color and alpha combining.