Merge pull request #3509 from stenzek/negative-indirect
PixelShaderGen: Manually wrap negative indirect texture coordinates
This commit is contained in:
commit
ea2765e010
|
@ -374,15 +374,15 @@ static inline s32 WrapIndirectCoord(s32 coord, int wrapMode)
|
||||||
case ITW_OFF:
|
case ITW_OFF:
|
||||||
return coord;
|
return coord;
|
||||||
case ITW_256:
|
case ITW_256:
|
||||||
return (coord % (256 << 7));
|
return (coord & ((256 << 7) - 1));
|
||||||
case ITW_128:
|
case ITW_128:
|
||||||
return (coord % (128 << 7));
|
return (coord & ((128 << 7) - 1));
|
||||||
case ITW_64:
|
case ITW_64:
|
||||||
return (coord % (64 << 7));
|
return (coord & ((64 << 7) - 1));
|
||||||
case ITW_32:
|
case ITW_32:
|
||||||
return (coord % (32 << 7));
|
return (coord & ((32 << 7) - 1));
|
||||||
case ITW_16:
|
case ITW_16:
|
||||||
return (coord % (16 << 7));
|
return (coord & ((16 << 7) - 1));
|
||||||
case ITW_0:
|
case ITW_0:
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -764,7 +764,7 @@ static void WriteStage(T& out, pixel_shader_uid_data* uid_data, int n, API_TYPE
|
||||||
else if (bpmem.tevind[n].sw == ITW_0)
|
else if (bpmem.tevind[n].sw == ITW_0)
|
||||||
out.Write("\twrappedcoord.x = 0;\n");
|
out.Write("\twrappedcoord.x = 0;\n");
|
||||||
else
|
else
|
||||||
out.Write("\twrappedcoord.x = fixpoint_uv%d.x %% %s;\n", texcoord, tevIndWrapStart[bpmem.tevind[n].sw]);
|
out.Write("\twrappedcoord.x = fixpoint_uv%d.x & (%s - 1);\n", texcoord, tevIndWrapStart[bpmem.tevind[n].sw]);
|
||||||
|
|
||||||
// wrap T
|
// wrap T
|
||||||
if (bpmem.tevind[n].tw == ITW_OFF)
|
if (bpmem.tevind[n].tw == ITW_OFF)
|
||||||
|
@ -772,7 +772,7 @@ static void WriteStage(T& out, pixel_shader_uid_data* uid_data, int n, API_TYPE
|
||||||
else if (bpmem.tevind[n].tw == ITW_0)
|
else if (bpmem.tevind[n].tw == ITW_0)
|
||||||
out.Write("\twrappedcoord.y = 0;\n");
|
out.Write("\twrappedcoord.y = 0;\n");
|
||||||
else
|
else
|
||||||
out.Write("\twrappedcoord.y = fixpoint_uv%d.y %% %s;\n", texcoord, tevIndWrapStart[bpmem.tevind[n].tw]);
|
out.Write("\twrappedcoord.y = fixpoint_uv%d.y & (%s - 1);\n", texcoord, tevIndWrapStart[bpmem.tevind[n].tw]);
|
||||||
|
|
||||||
if (bpmem.tevind[n].fb_addprev) // add previous tevcoord
|
if (bpmem.tevind[n].fb_addprev) // add previous tevcoord
|
||||||
out.Write("\ttevcoord.xy += wrappedcoord + indtevtrans%d;\n", n);
|
out.Write("\ttevcoord.xy += wrappedcoord + indtevtrans%d;\n", n);
|
||||||
|
|
Loading…
Reference in New Issue