summaryrefslogtreecommitdiff
path: root/src/video_core/rasterizer.cpp
diff options
context:
space:
mode:
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,
349 val = std::min(val, (int)size - 1); 349 val = std::min(val, (int)size - 1);
350 return val; 350 return val;
351 351
352 case Regs::TextureConfig::ClampToBorder:
353 return val;
354
352 case Regs::TextureConfig::Repeat: 355 case Regs::TextureConfig::Repeat:
353 return (int)((unsigned)val % size); 356 return (int)((unsigned)val % size);
354 357
@@ -367,17 +370,23 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
367 } 370 }
368 }; 371 };
369 372
370 // Textures are laid out from bottom to top, hence we invert the t coordinate. 373 if ((texture.config.wrap_s == Regs::TextureConfig::ClampToBorder && (s < 0 || s >= texture.config.width))
371 // NOTE: This may not be the right place for the inversion. 374 || (texture.config.wrap_t == Regs::TextureConfig::ClampToBorder && (t < 0 || t >= texture.config.height))) {
372 // TODO: Check if this applies to ETC textures, too. 375 auto border_color = texture.config.border_color;
373 s = GetWrappedTexCoord(texture.config.wrap_s, s, texture.config.width); 376 texture_color[i] = { border_color.r, border_color.g, border_color.b, border_color.a };
374 t = texture.config.height - 1 - GetWrappedTexCoord(texture.config.wrap_t, t, texture.config.height); 377 } else {
375 378 // Textures are laid out from bottom to top, hence we invert the t coordinate.
376 u8* texture_data = Memory::GetPhysicalPointer(texture.config.GetPhysicalAddress()); 379 // NOTE: This may not be the right place for the inversion.
377 auto info = DebugUtils::TextureInfo::FromPicaRegister(texture.config, texture.format); 380 // TODO: Check if this applies to ETC textures, too.
378 381 s = GetWrappedTexCoord(texture.config.wrap_s, s, texture.config.width);
379 texture_color[i] = DebugUtils::LookupTexture(texture_data, s, t, info); 382 t = texture.config.height - 1 - GetWrappedTexCoord(texture.config.wrap_t, t, texture.config.height);
380 DebugUtils::DumpTexture(texture.config, texture_data); 383
384 u8* texture_data = Memory::GetPhysicalPointer(texture.config.GetPhysicalAddress());
385 auto info = DebugUtils::TextureInfo::FromPicaRegister(texture.config, texture.format);
386
387 texture_color[i] = DebugUtils::LookupTexture(texture_data, s, t, info);
388 DebugUtils::DumpTexture(texture.config, texture_data);
389 }
381 } 390 }
382 391
383 // Texture environment - consists of 6 stages of color and alpha combining. 392 // Texture environment - consists of 6 stages of color and alpha combining.