mirror of https://github.com/PCSX2/pcsx2.git
GSDX: Probably fix D3D10 and maybe D3D9 (might be working anyway but I think I have it addressing texel centres now) palette lookups. I noticed that this was broken in D3D10 while fixing the Realta Nua issue in r5273.
Explanation, because this gives me a headache and this might save someone else one (or I might be wrong and they might see why): in D3D10, 0.0 points to the centre of the leftmost texel and 1.0 points one texel to the right of the rightmost texel, so to map a UNORM uniformly across a texel we need to multiply the input by (w-1)/w. In D3D9 0.0 points to the left edge of the leftmost texel and 1.0 to the right edge of the rightmost texel so after the multiplication we add 1/2w. Actual texture sampling is probably not right for at least one of D3D9 and D3D10, but this headache is killing me. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5279 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
b534fcc1bc
commit
1df5b7ef7a
|
@ -109,7 +109,7 @@ float4 sample_c(float2 uv)
|
||||||
|
|
||||||
float4 sample_p(float u)
|
float4 sample_p(float u)
|
||||||
{
|
{
|
||||||
return Palette.Sample(PaletteSampler, u);
|
return Palette.Sample(PaletteSampler, u * 255./256);
|
||||||
}
|
}
|
||||||
|
|
||||||
float4 sample_rt(float2 uv)
|
float4 sample_rt(float2 uv)
|
||||||
|
@ -199,7 +199,7 @@ float4 sample_c(float2 uv)
|
||||||
|
|
||||||
float4 sample_p(float u)
|
float4 sample_p(float u)
|
||||||
{
|
{
|
||||||
return tex2D(Palette, u);
|
return tex2D(Palette, u * 255./256 + 1./512);
|
||||||
}
|
}
|
||||||
|
|
||||||
float4 sample_rt(float2 uv)
|
float4 sample_rt(float2 uv)
|
||||||
|
|
Loading…
Reference in New Issue