forked from suyu/suyu
Pica/TextureUnit: Implement mirrored repeating texture wrapping.
This commit is contained in:
parent
8bd7a896ea
commit
6ca752ccbc
2 changed files with 12 additions and 3 deletions
|
@ -118,8 +118,9 @@ struct Regs {
|
||||||
|
|
||||||
struct TextureConfig {
|
struct TextureConfig {
|
||||||
enum WrapMode : u32 {
|
enum WrapMode : u32 {
|
||||||
ClampToEdge = 0,
|
ClampToEdge = 0,
|
||||||
Repeat = 2,
|
Repeat = 2,
|
||||||
|
MirroredRepeat = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
INSERT_PADDING_WORDS(0x1);
|
INSERT_PADDING_WORDS(0x1);
|
||||||
|
|
|
@ -251,7 +251,15 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
|
||||||
return val;
|
return val;
|
||||||
|
|
||||||
case Regs::TextureConfig::Repeat:
|
case Regs::TextureConfig::Repeat:
|
||||||
return (int)(((unsigned)val) % size);
|
return (int)((unsigned)val % size);
|
||||||
|
|
||||||
|
case Regs::TextureConfig::MirroredRepeat:
|
||||||
|
{
|
||||||
|
int val = (int)((unsigned)val % (2 * size));
|
||||||
|
if (val >= size)
|
||||||
|
val = 2 * size - 1 - val;
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(HW_GPU, "Unknown texture coordinate wrapping mode %x\n", (int)mode);
|
LOG_ERROR(HW_GPU, "Unknown texture coordinate wrapping mode %x\n", (int)mode);
|
||||||
|
|
Loading…
Reference in a new issue