mirror of https://github.com/PCSX2/pcsx2.git
GSdx:
- Automatic texture filtering should be ok now, occasionally point filtering was used. Tested it on the ps2 and figured with no mip levels LoD and minification settings are just ignored altogether. - Also run a few tests on the gather instruction with the reference rasterizer and found a fatal flaw with it. It returns the four samples for bilinear sampling (in a funny order, which isn't documented of course, x = bl, y = br, z = tr, w = tl), but there is no way to guess which four were selected exactly. Due to some hidden rounding error it might grab different texels than I would when calculating the position of the upper-left texel, of which the fractional part is be used for the interpolation. When the texel positions do not match it leaves annoying discontinuity errors. Oh well... git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1571 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
c595eab036
commit
cc3130660a
|
@ -769,9 +769,9 @@ REG64_(GIFReg, TEST)
|
|||
uint32 _PAD1:13;
|
||||
uint32 _PAD2:32;
|
||||
REG_END2
|
||||
__forceinline bool DoFirstPass() {return !ATE || ATST != 0;} // not all pixels fail automatically
|
||||
__forceinline bool DoSecondPass() {return ATE && ATST != 1 && AFAIL != 0;} // pixels may fail, write fb/z
|
||||
__forceinline bool NoSecondPass() {return ATE && ATST != 1 && AFAIL == 0;} // pixels may fail, no output
|
||||
__forceinline bool DoFirstPass() {return !ATE || ATST != ATST_NEVER;} // not all pixels fail automatically
|
||||
__forceinline bool DoSecondPass() {return ATE && ATST != ATST_ALWAYS && AFAIL != AFAIL_KEEP;} // pixels may fail, write fb/z
|
||||
__forceinline bool NoSecondPass() {return ATE && ATST != ATST_ALWAYS && AFAIL == AFAIL_KEEP;} // pixels may fail, no output
|
||||
REG_END2
|
||||
|
||||
REG64_(GIFReg, TEX0)
|
||||
|
|
|
@ -71,7 +71,7 @@ __declspec(align(16)) class GSClut : public GSAlignedClass<16>
|
|||
template<int n> void WriteCLUT16_CSM2(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT);
|
||||
template<int n> void WriteCLUT16S_CSM2(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT);
|
||||
|
||||
void WriteCLUT_NULL(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT) {}
|
||||
void WriteCLUT_NULL(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT) {ASSERT(0);} // xenosaga 3
|
||||
|
||||
static void WriteCLUT_T32_I8_CSM1(const uint32* RESTRICT src, uint16* RESTRICT clut);
|
||||
static void WriteCLUT_T32_I4_CSM1(const uint32* RESTRICT src, uint16* RESTRICT clut);
|
||||
|
|
|
@ -86,8 +86,8 @@ bool GSDevice10::Create(GSWnd* wnd, bool vsync)
|
|||
scd.SampleDesc.Quality = 0;
|
||||
scd.Windowed = TRUE;
|
||||
|
||||
uint32 flags = 0;
|
||||
flags = D3D10_CREATE_DEVICE_SINGLETHREADED; //disables thread safety, should be fine (speedup)
|
||||
uint32 flags = D3D10_CREATE_DEVICE_SINGLETHREADED; //disables thread safety, should be fine (speedup)
|
||||
|
||||
#ifdef DEBUG
|
||||
flags |= D3D10_CREATE_DEVICE_DEBUG;
|
||||
#endif
|
||||
|
@ -113,8 +113,6 @@ bool GSDevice10::Create(GSWnd* wnd, bool vsync)
|
|||
}
|
||||
}
|
||||
|
||||
// hr = D3D10CreateDeviceAndSwapChain(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, flags, D3D10_SDK_VERSION, &scd, &m_swapchain, &m_dev);
|
||||
|
||||
if(FAILED(hr)) return false;
|
||||
|
||||
// convert
|
||||
|
|
|
@ -86,8 +86,8 @@ bool GSDevice11::Create(GSWnd* wnd, bool vsync)
|
|||
scd.SampleDesc.Quality = 0;
|
||||
scd.Windowed = TRUE;
|
||||
|
||||
uint32 flags = 0;
|
||||
flags = D3D11_CREATE_DEVICE_SINGLETHREADED; //disables thread safety, should be fine (speedup)
|
||||
uint32 flags = D3D11_CREATE_DEVICE_SINGLETHREADED; //disables thread safety, should be fine (speedup)
|
||||
|
||||
#ifdef DEBUG
|
||||
flags |= D3D11_CREATE_DEVICE_DEBUG;
|
||||
#endif
|
||||
|
|
|
@ -969,29 +969,6 @@ void GSDevice9::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector4
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: D3DXCompileShaderFromResource of d3dx9 v37 (march 2008) calls GetFullPathName on id for some reason and then crashes
|
||||
|
||||
static HRESULT LoadShader(uint32 id, LPCSTR& data, uint32& size)
|
||||
{
|
||||
CComPtr<ID3DXBuffer> shader, error;
|
||||
|
||||
HRSRC hRes = FindResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), RT_RCDATA);
|
||||
|
||||
if(!hRes) return E_FAIL;
|
||||
|
||||
size = SizeofResource(theApp.GetModuleHandle(), hRes);
|
||||
|
||||
if(size == 0) return E_FAIL;
|
||||
|
||||
HGLOBAL hResData = LoadResource(theApp.GetModuleHandle(), hRes);
|
||||
|
||||
if(!hResData) return E_FAIL;
|
||||
|
||||
data = (LPCSTR)LockResource(hResData);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO* macro, IDirect3DVertexShader9** vs, const D3DVERTEXELEMENT9* layout, int count, IDirect3DVertexDeclaration9** il)
|
||||
{
|
||||
vector<D3DXMACRO> m;
|
||||
|
@ -1002,16 +979,7 @@ HRESULT GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO
|
|||
|
||||
CComPtr<ID3DXBuffer> shader, error;
|
||||
|
||||
// FIXME: hr = D3DXCompileShaderFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), &m[0], NULL, entry.c_str(), target, 0, &shader, &error, NULL);
|
||||
|
||||
LPCSTR data;
|
||||
uint32 size;
|
||||
|
||||
hr = LoadShader(id, data, size);
|
||||
|
||||
if(FAILED(hr)) return E_FAIL;
|
||||
|
||||
hr = D3DXCompileShader(data, size, &m[0], NULL, entry.c_str(), m_shader.vs.c_str(), 0, &shader, &error, NULL);
|
||||
hr = D3DXCompileShaderFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), &m[0], NULL, entry.c_str(), m_shader.vs.c_str(), 0, &shader, &error, NULL);
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
|
@ -1047,6 +1015,10 @@ HRESULT GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO
|
|||
{
|
||||
flags |= D3DXSHADER_AVOID_FLOW_CONTROL;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= D3DXSHADER_SKIPVALIDATION;
|
||||
}
|
||||
|
||||
vector<D3DXMACRO> m;
|
||||
|
||||
|
@ -1056,16 +1028,7 @@ HRESULT GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO
|
|||
|
||||
CComPtr<ID3DXBuffer> shader, error;
|
||||
|
||||
// FIXME: hr = D3DXCompileShaderFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), &m[0], NULL, entry.c_str(), target, flags, &shader, &error, NULL);
|
||||
|
||||
LPCSTR data;
|
||||
uint32 size;
|
||||
|
||||
hr = LoadShader(id, data, size);
|
||||
|
||||
if(FAILED(hr)) return E_FAIL;
|
||||
|
||||
hr = D3DXCompileShader(data, size, &m[0], NULL, entry.c_str(), m_shader.ps.c_str(), 0, &shader, &error, NULL);
|
||||
hr = D3DXCompileShaderFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), &m[0], NULL, entry.c_str(), m_shader.ps.c_str(), flags, &shader, &error, NULL);
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
|
|
|
@ -709,7 +709,10 @@ bool GSRenderer::IsLinear()
|
|||
bool mmin = TEX1.IsMinLinear();
|
||||
bool mmag = TEX1.IsMagLinear();
|
||||
|
||||
if(mmag == mmin) return mmag;
|
||||
if(mmag == mmin || TEX1.MXL == 0) // MXL == 0 => MMIN ignored, tested it on ps2
|
||||
{
|
||||
return mmag;
|
||||
}
|
||||
|
||||
if(!TEX1.LCM && !PRIM->FST) // if FST => assume Q = 1.0f (should not, but Q is very often bogus, 0 or DEN)
|
||||
{
|
||||
|
@ -761,7 +764,7 @@ bool GSRenderer::IsOpaque()
|
|||
amin = amax = 0x80;
|
||||
}
|
||||
}
|
||||
else if(context->ALPHA.C == 1)
|
||||
else if(context->ALPHA.C == 2)
|
||||
{
|
||||
amin = amax = context->ALPHA.FIX;
|
||||
}
|
||||
|
|
|
@ -199,7 +199,6 @@ public:
|
|||
|
||||
if(context->TEST.ATE)
|
||||
{
|
||||
ps_sel.ate = 1;
|
||||
ps_sel.atst = context->TEST.ATST;
|
||||
|
||||
switch(ps_sel.atst)
|
||||
|
@ -215,6 +214,10 @@ public:
|
|||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_sel.atst = ATST_ALWAYS;
|
||||
}
|
||||
|
||||
if(tex)
|
||||
{
|
||||
|
|
|
@ -624,7 +624,7 @@ protected:
|
|||
{
|
||||
if(TryAlphaTest(fm, zm))
|
||||
{
|
||||
context->TEST.ATE = 0;
|
||||
context->TEST.ATST = ATST_ALWAYS;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,6 @@ public:
|
|||
uint32 aem:1;
|
||||
uint32 tfx:3;
|
||||
uint32 tcc:1;
|
||||
uint32 ate:1;
|
||||
uint32 atst:3;
|
||||
uint32 fog:1;
|
||||
uint32 clr1:1;
|
||||
|
@ -187,7 +186,7 @@ public:
|
|||
uint32 key;
|
||||
};
|
||||
|
||||
operator uint32() {return key & 0x7fffff;}
|
||||
operator uint32() {return key & 0x3fffff;}
|
||||
|
||||
PSSelector() : key(0) {}
|
||||
};
|
||||
|
|
|
@ -197,7 +197,7 @@ void GSTextureFX10::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSample
|
|||
|
||||
if(i == m_ps.end())
|
||||
{
|
||||
string str[14];
|
||||
string str[13];
|
||||
|
||||
str[0] = format("%d", sel.fst);
|
||||
str[1] = format("%d", sel.wms);
|
||||
|
@ -206,13 +206,12 @@ void GSTextureFX10::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSample
|
|||
str[4] = format("%d", sel.aem);
|
||||
str[5] = format("%d", sel.tfx);
|
||||
str[6] = format("%d", sel.tcc);
|
||||
str[7] = format("%d", sel.ate);
|
||||
str[8] = format("%d", sel.atst);
|
||||
str[9] = format("%d", sel.fog);
|
||||
str[10] = format("%d", sel.clr1);
|
||||
str[11] = format("%d", sel.fba);
|
||||
str[12] = format("%d", sel.aout);
|
||||
str[13] = format("%d", sel.ltf);
|
||||
str[7] = format("%d", sel.atst);
|
||||
str[8] = format("%d", sel.fog);
|
||||
str[9] = format("%d", sel.clr1);
|
||||
str[10] = format("%d", sel.fba);
|
||||
str[11] = format("%d", sel.aout);
|
||||
str[12] = format("%d", sel.ltf);
|
||||
|
||||
D3D10_SHADER_MACRO macro[] =
|
||||
{
|
||||
|
@ -223,13 +222,12 @@ void GSTextureFX10::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSample
|
|||
{"PS_AEM", str[4].c_str()},
|
||||
{"PS_TFX", str[5].c_str()},
|
||||
{"PS_TCC", str[6].c_str()},
|
||||
{"PS_ATE", str[7].c_str()},
|
||||
{"PS_ATST", str[8].c_str()},
|
||||
{"PS_FOG", str[9].c_str()},
|
||||
{"PS_CLR1", str[10].c_str()},
|
||||
{"PS_FBA", str[11].c_str()},
|
||||
{"PS_AOUT", str[12].c_str()},
|
||||
{"PS_LTF", str[13].c_str()},
|
||||
{"PS_ATST", str[7].c_str()},
|
||||
{"PS_FOG", str[8].c_str()},
|
||||
{"PS_CLR1", str[9].c_str()},
|
||||
{"PS_FBA", str[10].c_str()},
|
||||
{"PS_AOUT", str[11].c_str()},
|
||||
{"PS_LTF", str[12].c_str()},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ void GSTextureFX11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSample
|
|||
|
||||
if(i == m_ps.end())
|
||||
{
|
||||
string str[14];
|
||||
string str[13];
|
||||
|
||||
str[0] = format("%d", sel.fst);
|
||||
str[1] = format("%d", sel.wms);
|
||||
|
@ -208,13 +208,12 @@ void GSTextureFX11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSample
|
|||
str[4] = format("%d", sel.aem);
|
||||
str[5] = format("%d", sel.tfx);
|
||||
str[6] = format("%d", sel.tcc);
|
||||
str[7] = format("%d", sel.ate);
|
||||
str[8] = format("%d", sel.atst);
|
||||
str[9] = format("%d", sel.fog);
|
||||
str[10] = format("%d", sel.clr1);
|
||||
str[11] = format("%d", sel.fba);
|
||||
str[12] = format("%d", sel.aout);
|
||||
str[13] = format("%d", sel.ltf);
|
||||
str[7] = format("%d", sel.atst);
|
||||
str[8] = format("%d", sel.fog);
|
||||
str[9] = format("%d", sel.clr1);
|
||||
str[10] = format("%d", sel.fba);
|
||||
str[11] = format("%d", sel.aout);
|
||||
str[12] = format("%d", sel.ltf);
|
||||
|
||||
D3D11_SHADER_MACRO macro[] =
|
||||
{
|
||||
|
@ -225,13 +224,12 @@ void GSTextureFX11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSample
|
|||
{"PS_AEM", str[4].c_str()},
|
||||
{"PS_TFX", str[5].c_str()},
|
||||
{"PS_TCC", str[6].c_str()},
|
||||
{"PS_ATE", str[7].c_str()},
|
||||
{"PS_ATST", str[8].c_str()},
|
||||
{"PS_FOG", str[9].c_str()},
|
||||
{"PS_CLR1", str[10].c_str()},
|
||||
{"PS_FBA", str[11].c_str()},
|
||||
{"PS_AOUT", str[12].c_str()},
|
||||
{"PS_LTF", str[13].c_str()},
|
||||
{"PS_ATST", str[7].c_str()},
|
||||
{"PS_FOG", str[8].c_str()},
|
||||
{"PS_CLR1", str[9].c_str()},
|
||||
{"PS_FBA", str[10].c_str()},
|
||||
{"PS_AOUT", str[11].c_str()},
|
||||
{"PS_LTF", str[12].c_str()},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ void GSTextureFX9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSampler
|
|||
|
||||
if(i == m_ps.end())
|
||||
{
|
||||
string str[13];
|
||||
string str[12];
|
||||
|
||||
str[0] = format("%d", sel.fst);
|
||||
str[1] = format("%d", sel.wms);
|
||||
|
@ -186,12 +186,11 @@ void GSTextureFX9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSampler
|
|||
str[4] = format("%d", sel.aem);
|
||||
str[5] = format("%d", sel.tfx);
|
||||
str[6] = format("%d", sel.tcc);
|
||||
str[7] = format("%d", sel.ate);
|
||||
str[8] = format("%d", sel.atst);
|
||||
str[9] = format("%d", sel.fog);
|
||||
str[10] = format("%d", sel.clr1);
|
||||
str[11] = format("%d", sel.rt);
|
||||
str[12] = format("%d", sel.ltf);
|
||||
str[7] = format("%d", sel.atst);
|
||||
str[8] = format("%d", sel.fog);
|
||||
str[9] = format("%d", sel.clr1);
|
||||
str[10] = format("%d", sel.rt);
|
||||
str[11] = format("%d", sel.ltf);
|
||||
|
||||
D3DXMACRO macro[] =
|
||||
{
|
||||
|
@ -202,12 +201,11 @@ void GSTextureFX9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSampler
|
|||
{"PS_AEM", str[4].c_str()},
|
||||
{"PS_TFX", str[5].c_str()},
|
||||
{"PS_TCC", str[6].c_str()},
|
||||
{"PS_ATE", str[7].c_str()},
|
||||
{"PS_ATST", str[8].c_str()},
|
||||
{"PS_FOG", str[9].c_str()},
|
||||
{"PS_CLR1", str[10].c_str()},
|
||||
{"PS_RT", str[11].c_str()},
|
||||
{"PS_LTF", str[12].c_str()},
|
||||
{"PS_ATST", str[7].c_str()},
|
||||
{"PS_FOG", str[8].c_str()},
|
||||
{"PS_CLR1", str[9].c_str()},
|
||||
{"PS_RT", str[10].c_str()},
|
||||
{"PS_LTF", str[11].c_str()},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ bool GSUtil::CheckSSE()
|
|||
|
||||
bool GSUtil::IsDirect3D10Available()
|
||||
{
|
||||
if(HMODULE hModule = LoadLibrary(_T("d3d10.dll")))
|
||||
if(HMODULE hModule = LoadLibrary(_T("d3d10_1.dll")))
|
||||
{
|
||||
FreeLibrary(hModule);
|
||||
|
||||
|
|
|
@ -1319,6 +1319,7 @@
|
|||
<ClCompile Include="GSPerfMon.cpp" />
|
||||
<ClCompile Include="GSRasterizer.cpp" />
|
||||
<ClCompile Include="GSRenderer.cpp" />
|
||||
<ClCompile Include="GSRendererDX.cpp" />
|
||||
<ClCompile Include="GSRendererHW.cpp" />
|
||||
<ClCompile Include="GSRendererDX10.cpp" />
|
||||
<ClCompile Include="GSRendererDX11.cpp" />
|
||||
|
@ -1444,6 +1445,7 @@
|
|||
<ClInclude Include="GSPerfMon.h" />
|
||||
<ClInclude Include="GSRasterizer.h" />
|
||||
<ClInclude Include="GSRenderer.h" />
|
||||
<ClInclude Include="GSRendererDX.h" />
|
||||
<ClInclude Include="GSRendererHW.h" />
|
||||
<ClInclude Include="GSRendererDX10.h" />
|
||||
<ClInclude Include="GSRendererDX11.h" />
|
||||
|
|
|
@ -198,6 +198,9 @@
|
|||
<ClCompile Include="GSRenderer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GSRendererDX.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GSRendererHW.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -518,6 +521,9 @@
|
|||
<ClInclude Include="GSRenderer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GSRendererDX.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GSRendererHW.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
#define PS_AEM 0
|
||||
#define PS_TFX 0
|
||||
#define PS_TCC 1
|
||||
#define PS_ATE 0
|
||||
#define PS_ATST 4
|
||||
#define PS_ATST 1
|
||||
#define PS_FOG 0
|
||||
#define PS_CLR1 0
|
||||
#define PS_FBA 0
|
||||
|
@ -100,15 +99,6 @@ float4 sample_p(float u)
|
|||
return Palette.Sample(PaletteSampler, u);
|
||||
}
|
||||
|
||||
#if SHADER_MODEL >= 0x401
|
||||
|
||||
float4 gather_c(float2 uv)
|
||||
{
|
||||
return Texture.Gather(TextureSampler, uv, int2(0, 0));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#elif SHADER_MODEL <= 0x300
|
||||
|
||||
#ifndef VS_BPPZ
|
||||
|
@ -126,7 +116,6 @@ float4 gather_c(float2 uv)
|
|||
#define PS_AEM 0
|
||||
#define PS_TFX 0
|
||||
#define PS_TCC 0
|
||||
#define PS_ATE 0
|
||||
#define PS_ATST 4
|
||||
#define PS_FOG 0
|
||||
#define PS_CLR1 0
|
||||
|
@ -304,23 +293,15 @@ float4x4 sample_4c(float4 uv)
|
|||
return c;
|
||||
}
|
||||
|
||||
float4 sample_4a(float4 uv, float2 st)
|
||||
float4 sample_4a(float4 uv)
|
||||
{
|
||||
float4 c;
|
||||
/*
|
||||
#if SHADER_MODEL >= 0x401 && PS_FMT == FMT_8 && PS_LTF && PS_WMS < 2 && PS_WMT < 2
|
||||
|
||||
c = gather_c(st); // the order of samples returned might not be the same as ours
|
||||
|
||||
#else
|
||||
*/
|
||||
|
||||
c.x = sample_c(uv.xy).a;
|
||||
c.y = sample_c(uv.zy).a;
|
||||
c.z = sample_c(uv.xw).a;
|
||||
c.w = sample_c(uv.zw).a;
|
||||
/*
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if SHADER_MODEL <= 0x300
|
||||
if(PS_RT) c *= 128.0f / 255;
|
||||
#endif
|
||||
|
@ -379,19 +360,19 @@ float4 sample(float2 st, float q)
|
|||
|
||||
if(PS_FMT == FMT_8H)
|
||||
{
|
||||
c = sample_4p(sample_4a(uv, st.xy));
|
||||
c = sample_4p(sample_4a(uv));
|
||||
}
|
||||
else if(PS_FMT == FMT_4HL)
|
||||
{
|
||||
c = sample_4p(fmod(sample_4a(uv, st.xy), 1.0f / 16));
|
||||
c = sample_4p(fmod(sample_4a(uv), 1.0f / 16));
|
||||
}
|
||||
else if(PS_FMT == FMT_4HH)
|
||||
{
|
||||
c = sample_4p(fmod(sample_4a(uv, st.xy) * 16, 1.0f / 16));
|
||||
c = sample_4p(fmod(sample_4a(uv) * 16, 1.0f / 16));
|
||||
}
|
||||
else if(PS_FMT == FMT_8)
|
||||
{
|
||||
c = sample_4p(sample_4a(uv, st.xy));
|
||||
c = sample_4p(sample_4a(uv));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -476,30 +457,31 @@ float4 tfx(float4 t, float4 c)
|
|||
|
||||
void atst(float4 c)
|
||||
{
|
||||
if(PS_ATE)
|
||||
float a = trunc(c.a * 255);
|
||||
|
||||
if(PS_ATST == 0) // never
|
||||
{
|
||||
float a = trunc(c.a * 255);
|
||||
|
||||
if(PS_ATST == 0)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
else if(PS_ATST == 2 || PS_ATST == 3) // l, le
|
||||
{
|
||||
clip(AREF - a);
|
||||
}
|
||||
else if(PS_ATST == 4) // e
|
||||
{
|
||||
clip(0.5f - abs(a - AREF));
|
||||
}
|
||||
else if(PS_ATST == 5 || PS_ATST == 6) // ge, g
|
||||
{
|
||||
clip(a - AREF);
|
||||
}
|
||||
else if(PS_ATST == 7) // ne
|
||||
{
|
||||
clip(abs(a - AREF) - 0.5f);
|
||||
}
|
||||
discard;
|
||||
}
|
||||
else if(PS_ATST == 1) // always
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
else if(PS_ATST == 2 || PS_ATST == 3) // l, le
|
||||
{
|
||||
clip(AREF - a);
|
||||
}
|
||||
else if(PS_ATST == 4) // e
|
||||
{
|
||||
clip(0.5f - abs(a - AREF));
|
||||
}
|
||||
else if(PS_ATST == 5 || PS_ATST == 6) // ge, g
|
||||
{
|
||||
clip(a - AREF);
|
||||
}
|
||||
else if(PS_ATST == 7) // ne
|
||||
{
|
||||
clip(abs(a - AREF) - 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue