mirror of https://github.com/PCSX2/pcsx2.git
zzogl-pg: More sync changes. (See r3768 & r3786)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3787 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
cc5414f49e
commit
da49cce435
|
@ -55,7 +55,7 @@ inline bool NoHighlights(int i)
|
||||||
|
|
||||||
// if ( results[resultA] == 0 ) {
|
// if ( results[resultA] == 0 ) {
|
||||||
// results[resultA] = 1;
|
// results[resultA] = 1;
|
||||||
// ZZLog::ERROR_LOG("%x = %d %d %d %d %d %d %d %d \n", resultA, prim->iip, (prim->tme), (prim->fge), (prim->abe) , (prim->aa1) ,(prim->fst), (prim->ctxt), (prim->fix)) ;
|
// ZZLog::Error_Log("%x = %d %d %d %d %d %d %d %d \n", resultA, prim->iip, (prim->tme), (prim->fge), (prim->abe) , (prim->aa1) ,(prim->fst), (prim->ctxt), (prim->fix)) ;
|
||||||
// }
|
// }
|
||||||
// if (resultA == 0xb && ZeroGS::vb[i].zbuf.zmsk ) return false; //ATF
|
// if (resultA == 0xb && ZeroGS::vb[i].zbuf.zmsk ) return false; //ATF
|
||||||
|
|
||||||
|
|
|
@ -282,7 +282,7 @@ inline float4 RenderGetForClip(u32 bInterlace, int interlace, int psm, FRAGMENTS
|
||||||
valpha.w = 1;
|
valpha.w = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZZshSetParameter4fv(prog->sOneColor, valpha, "g_fOneColor");
|
ZZshSetParameter4fv(prog->prog, prog->sOneColor, valpha, "g_fOneColor");
|
||||||
|
|
||||||
return valpha;
|
return valpha;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ inline void RenderCreateInterlaceTex(u32 bInterlace, int th, FRAGMENTSHADER* pro
|
||||||
|
|
||||||
int interlacetex = CreateInterlaceTex(2 * th);
|
int interlacetex = CreateInterlaceTex(2 * th);
|
||||||
|
|
||||||
ZZshGLSetTextureParameter(prog->sInterlace, interlacetex, "Interlace");
|
ZZshGLSetTextureParameter(prog->prog, prog->sInterlace, interlacetex, "Interlace");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Well, do blending setup prior to second pass of half-frame drawing
|
// Well, do blending setup prior to second pass of half-frame drawing
|
||||||
|
@ -416,7 +416,7 @@ inline float4 RenderSetTargetBitPos(int dh, int th, int movy, bool isInterlace)
|
||||||
v.w += 1.0f / (float)dh ;
|
v.w += 1.0f / (float)dh ;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZZshSetParameter4fv(pvsBitBlt.sBitBltPos, v, "g_fBitBltPos");
|
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltPos, v, "g_fBitBltPos");
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ inline float4 RenderSetTargetBitTex(float th, float tw, float dh, float dw, bool
|
||||||
v.w += 1.0f / conf.height;
|
v.w += 1.0f / conf.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
|
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ inline float4 RenderSetTargetBitTrans(int th)
|
||||||
{
|
{
|
||||||
SetShaderCaller("RenderSetTargetBitTrans");
|
SetShaderCaller("RenderSetTargetBitTrans");
|
||||||
float4 v = float4(float(th), -float(th), float(th), float(th));
|
float4 v = float4(float(th), -float(th), float(th), float(th));
|
||||||
ZZshSetParameter4fv(pvsBitBlt.fBitBltTrans, v, "g_fBitBltTrans");
|
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.fBitBltTrans, v, "g_fBitBltTrans");
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ inline float4 RenderSetTargetInvTex(int bInterlace, int tw, int th, FRAGMENTSHAD
|
||||||
v.y = 1.0f / (float)th;
|
v.y = 1.0f / (float)th;
|
||||||
v.z = (float)0.0;
|
v.z = (float)0.0;
|
||||||
v.w = -0.5f / (float)th;
|
v.w = -0.5f / (float)th;
|
||||||
ZZshSetParameter4fv(prog->sInvTexDims, v, "g_fInvTexDims");
|
ZZshSetParameter4fv(prog->prog, prog->sInvTexDims, v, "g_fInvTexDims");
|
||||||
}
|
}
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
|
@ -554,7 +554,7 @@ inline void RenderCheckForTargets(tex0Info& texframe, list<CRenderTarget*>& list
|
||||||
float4 valpha = RenderGetForClip(bInterlace, interlace, texframe.psm, &ppsCRTCTarg[bInterlace]);
|
float4 valpha = RenderGetForClip(bInterlace, interlace, texframe.psm, &ppsCRTCTarg[bInterlace]);
|
||||||
|
|
||||||
// inside vb[0]'s target area, so render that region only
|
// inside vb[0]'s target area, so render that region only
|
||||||
ZZshGLSetTextureParameter(ppsCRTCTarg[bInterlace].sFinal, ptarg->ptex, "CRTC target");
|
ZZshGLSetTextureParameter(ppsCRTCTarg[bInterlace].prog, ppsCRTCTarg[bInterlace].sFinal, ptarg->ptex, "CRTC target");
|
||||||
RenderCreateInterlaceTex(bInterlace, texframe.th, &ppsCRTCTarg[bInterlace]);
|
RenderCreateInterlaceTex(bInterlace, texframe.th, &ppsCRTCTarg[bInterlace]);
|
||||||
|
|
||||||
ZZshSetPixelShader(ppsCRTCTarg[bInterlace].prog);
|
ZZshSetPixelShader(ppsCRTCTarg[bInterlace].prog);
|
||||||
|
@ -626,7 +626,7 @@ inline void RenderCheckForMemory(tex0Info& texframe, list<CRenderTarget*>& listT
|
||||||
v = RenderSetTargetInvTex(bInterlace, texframe.tw, texframe.th, &ppsCRTC[bInterlace]);
|
v = RenderSetTargetInvTex(bInterlace, texframe.tw, texframe.th, &ppsCRTC[bInterlace]);
|
||||||
float4 valpha = RenderGetForClip(bInterlace, interlace, texframe.psm, &ppsCRTC[bInterlace]);
|
float4 valpha = RenderGetForClip(bInterlace, interlace, texframe.psm, &ppsCRTC[bInterlace]);
|
||||||
|
|
||||||
ZZshGLSetTextureParameter(ppsCRTC[bInterlace].sMemory, vb[0].pmemtarg->ptex->tex, "CRTC memory");
|
ZZshGLSetTextureParameter(ppsCRTC[bInterlace].prog, ppsCRTC[bInterlace].sMemory, vb[0].pmemtarg->ptex->tex, "CRTC memory");
|
||||||
RenderCreateInterlaceTex(bInterlace, texframe.th, &ppsCRTC[bInterlace]);
|
RenderCreateInterlaceTex(bInterlace, texframe.th, &ppsCRTC[bInterlace]);
|
||||||
ZZshSetPixelShader(ppsCRTC[bInterlace].prog);
|
ZZshSetPixelShader(ppsCRTC[bInterlace].prog);
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,6 @@ void (APIENTRY *zgsBlendFuncSeparateEXT)(GLenum, GLenum, GLenum, GLenum) = NULL;
|
||||||
// State parameters
|
// State parameters
|
||||||
|
|
||||||
extern u8* s_lpShaderResources;
|
extern u8* s_lpShaderResources;
|
||||||
ZZshProgram pvs[16] = {NULL};
|
|
||||||
|
|
||||||
// String's for shader file in developer mode
|
// String's for shader file in developer mode
|
||||||
#ifdef DEVBUILD
|
#ifdef DEVBUILD
|
||||||
|
|
|
@ -312,7 +312,7 @@ void ZeroGS::ReloadEffects()
|
||||||
|
|
||||||
memset(ppsTexture, 0, sizeof(ppsTexture));
|
memset(ppsTexture, 0, sizeof(ppsTexture));
|
||||||
|
|
||||||
LoadExtraEffects();
|
ZZshLoadExtraEffects();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,7 +859,7 @@ inline float4 FlushSetPageOffset(FRAGMENTSHADER* pfragment, int shadertype, CRen
|
||||||
// zoe2
|
// zoe2
|
||||||
if (PSMT_ISZTEX(ptextarg->psm)) vpageoffset.w = -1.0f;
|
if (PSMT_ISZTEX(ptextarg->psm)) vpageoffset.w = -1.0f;
|
||||||
|
|
||||||
ZZshSetParameter4fv(pfragment->fPageOffset, vpageoffset, "g_fPageOffset");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fPageOffset, vpageoffset, "g_fPageOffset");
|
||||||
|
|
||||||
return vpageoffset;
|
return vpageoffset;
|
||||||
}
|
}
|
||||||
|
@ -877,7 +877,7 @@ inline float4 FlushSetTexOffset(FRAGMENTSHADER* pfragment, int shadertype, VB& c
|
||||||
v.y = 16.0f / (float)curvb.tex0.th;
|
v.y = 16.0f / (float)curvb.tex0.th;
|
||||||
v.z = 0.5f * v.x;
|
v.z = 0.5f * v.x;
|
||||||
v.w = 0.5f * v.y;
|
v.w = 0.5f * v.y;
|
||||||
ZZshSetParameter4fv(pfragment->fTexOffset, v, "g_fTexOffset");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fTexOffset, v, "g_fTexOffset");
|
||||||
}
|
}
|
||||||
else if (shadertype == 4)
|
else if (shadertype == 4)
|
||||||
{
|
{
|
||||||
|
@ -886,7 +886,7 @@ inline float4 FlushSetTexOffset(FRAGMENTSHADER* pfragment, int shadertype, VB& c
|
||||||
v.y = 16.0f / (float)ptextarg->fbh;
|
v.y = 16.0f / (float)ptextarg->fbh;
|
||||||
v.z = -1;
|
v.z = -1;
|
||||||
v.w = 8.0f / (float)ptextarg->fbh;
|
v.w = 8.0f / (float)ptextarg->fbh;
|
||||||
ZZshSetParameter4fv(pfragment->fTexOffset, v, "g_fTexOffset");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fTexOffset, v, "g_fTexOffset");
|
||||||
}
|
}
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
|
@ -920,7 +920,7 @@ inline float4 FlushTextureDims(FRAGMENTSHADER* pfragment, int shadertype, VB& cu
|
||||||
if (shadertype == 4)
|
if (shadertype == 4)
|
||||||
vTexDims.z += 8.0f;
|
vTexDims.z += 8.0f;
|
||||||
|
|
||||||
ZZshSetParameter4fv(pfragment->fTexDims, vTexDims, "g_fTexDims");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fTexDims, vTexDims, "g_fTexDims");
|
||||||
|
|
||||||
return vTexDims;
|
return vTexDims;
|
||||||
}
|
}
|
||||||
|
@ -960,7 +960,7 @@ inline FRAGMENTSHADER* FlushUseExistRenderTarget(VB& curvb, CRenderTarget* ptext
|
||||||
//int psm = PIXEL_STORAGE_FORMAT(curvb.tex0);
|
//int psm = PIXEL_STORAGE_FORMAT(curvb.tex0);
|
||||||
int shadertype = FlushGetShaderType(curvb, ptextarg, ptexclut);
|
int shadertype = FlushGetShaderType(curvb, ptextarg, ptexclut);
|
||||||
|
|
||||||
FRAGMENTSHADER* pfragment = LoadShadeEffect(shadertype, 0, curvb.curprim.fge,
|
FRAGMENTSHADER* pfragment = ZZshLoadShadeEffect(shadertype, 0, curvb.curprim.fge,
|
||||||
IsAlphaTestExpansion(curvb.tex0), exactcolor, curvb.clamp, context, NULL);
|
IsAlphaTestExpansion(curvb.tex0), exactcolor, curvb.clamp, context, NULL);
|
||||||
|
|
||||||
float4 vpageoffset = FlushSetPageOffset(pfragment, shadertype, ptextarg);
|
float4 vpageoffset = FlushSetPageOffset(pfragment, shadertype, ptextarg);
|
||||||
|
@ -970,7 +970,7 @@ inline FRAGMENTSHADER* FlushUseExistRenderTarget(VB& curvb, CRenderTarget* ptext
|
||||||
float4 vTexDims = FlushTextureDims(pfragment, shadertype, curvb, ptextarg);
|
float4 vTexDims = FlushTextureDims(pfragment, shadertype, curvb, ptextarg);
|
||||||
|
|
||||||
if (pfragment->sCLUT != NULL && ptexclut != 0)
|
if (pfragment->sCLUT != NULL && ptexclut != 0)
|
||||||
ZZshGLSetTextureParameter(pfragment->sCLUT, ptexclut, "CLUT");
|
ZZshGLSetTextureParameter(pfragment->prog, pfragment->sCLUT, ptexclut, "CLUT");
|
||||||
|
|
||||||
FlushApplyResizeFilter(curvb, dwFilterOpts, ptextarg, context);
|
FlushApplyResizeFilter(curvb, dwFilterOpts, ptextarg, context);
|
||||||
|
|
||||||
|
@ -999,7 +999,7 @@ inline FRAGMENTSHADER* FlushMadeNewTarget(VB& curvb, int exactcolor, int context
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAGMENTSHADER* pfragment = LoadShadeEffect(0, GetTexFilter(curvb.tex1), curvb.curprim.fge,
|
FRAGMENTSHADER* pfragment = ZZshLoadShadeEffect(0, GetTexFilter(curvb.tex1), curvb.curprim.fge,
|
||||||
IsAlphaTestExpansion(curvb.tex0), exactcolor, curvb.clamp, context, NULL);
|
IsAlphaTestExpansion(curvb.tex0), exactcolor, curvb.clamp, context, NULL);
|
||||||
|
|
||||||
if (pfragment == NULL)
|
if (pfragment == NULL)
|
||||||
|
@ -1016,13 +1016,13 @@ inline void FlushSetTexture(VB& curvb, FRAGMENTSHADER* pfragment, CRenderTarget*
|
||||||
|
|
||||||
// have to enable the texture parameters(curtest.atst)
|
// have to enable the texture parameters(curtest.atst)
|
||||||
if( curvb.ptexClamp[0] != 0 )
|
if( curvb.ptexClamp[0] != 0 )
|
||||||
ZZshGLSetTextureParameter(pfragment->sBitwiseANDX, curvb.ptexClamp[0], "Clamp 0");
|
ZZshGLSetTextureParameter(pfragment->prog, pfragment->sBitwiseANDX, curvb.ptexClamp[0], "Clamp 0");
|
||||||
|
|
||||||
if( curvb.ptexClamp[1] != 0 )
|
if( curvb.ptexClamp[1] != 0 )
|
||||||
ZZshGLSetTextureParameter(pfragment->sBitwiseANDY, curvb.ptexClamp[1], "Clamp 1");
|
ZZshGLSetTextureParameter(pfragment->prog, pfragment->sBitwiseANDY, curvb.ptexClamp[1], "Clamp 1");
|
||||||
|
|
||||||
if( pfragment->sMemory != NULL && s_ptexCurSet[context] != 0)
|
if( pfragment->sMemory != NULL && s_ptexCurSet[context] != 0)
|
||||||
ZZshGLSetTextureParameter(pfragment->sMemory, s_ptexCurSet[context], "Clamp memory");
|
ZZshGLSetTextureParameter(pfragment->prog, pfragment->sMemory, s_ptexCurSet[context], "Clamp memory");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1170,13 +1170,13 @@ inline u32 AlphaRenderAlpha(VB& curvb, const pixTest curtest, FRAGMENTSHADER* pf
|
||||||
v.w *= 255;
|
v.w *= 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZZshSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->sOneColor, v, "g_fOneColor");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// not using blending so set to defaults
|
// not using blending so set to defaults
|
||||||
float4 v = exactcolor ? float4(1, 510 * 255.0f / 256.0f, 0, 0) : float4(1, 2 * 255.0f / 256.0f, 0, 0);
|
float4 v = exactcolor ? float4(1, 510 * 255.0f / 256.0f, 0, 0) : float4(1, 2 * 255.0f / 256.0f, 0, 0);
|
||||||
ZZshSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->sOneColor, v, "g_fOneColor");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1267,7 +1267,7 @@ inline void AlphaPabe(VB& curvb, FRAGMENTSHADER* pfragment, int exactcolor)
|
||||||
|
|
||||||
if (exactcolor) v.y *= 255;
|
if (exactcolor) v.y *= 255;
|
||||||
|
|
||||||
ZZshSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->sOneColor, v, "g_fOneColor");
|
||||||
|
|
||||||
Draw(curvb);
|
Draw(curvb);
|
||||||
|
|
||||||
|
@ -1336,7 +1336,7 @@ inline void AlphaFailureTestJob(VB& curvb, const pixTest curtest, FRAGMENTSHADE
|
||||||
|
|
||||||
if (exactcolor) { v.y *= 255; v.w *= 255; }
|
if (exactcolor) { v.y *= 255; v.w *= 255; }
|
||||||
|
|
||||||
ZZshSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->sOneColor, v, "g_fOneColor");
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
GL_STENCILFUNC(GL_EQUAL, s_stencilref | STENCIL_FBA, s_stencilmask | STENCIL_FBA);
|
GL_STENCILFUNC(GL_EQUAL, s_stencilref | STENCIL_FBA, s_stencilmask | STENCIL_FBA);
|
||||||
|
@ -1360,7 +1360,7 @@ inline void AlphaFailureTestJob(VB& curvb, const pixTest curtest, FRAGMENTSHADE
|
||||||
|
|
||||||
if (exactcolor) v.y *= 255;
|
if (exactcolor) v.y *= 255;
|
||||||
|
|
||||||
ZZshSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->sOneColor, v, "g_fOneColor");
|
||||||
|
|
||||||
Draw(curvb);
|
Draw(curvb);
|
||||||
|
|
||||||
|
@ -1412,7 +1412,7 @@ inline void AlphaSpecialTesting(VB& curvb, FRAGMENTSHADER* pfragment, u32 dwUsin
|
||||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||||
|
|
||||||
float4 v = float4(0, exactcolor ? 510.0f : 2.0f, 0, 0);
|
float4 v = float4(0, exactcolor ? 510.0f : 2.0f, 0, 0);
|
||||||
ZZshSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->sOneColor, v, "g_fOneColor");
|
||||||
Draw(curvb);
|
Draw(curvb);
|
||||||
|
|
||||||
// don't need to restore
|
// don't need to restore
|
||||||
|
@ -1497,7 +1497,7 @@ inline void AlphaColorClamping(VB& curvb, const pixTest curtest)
|
||||||
if (bAlphaClamping & 1) // min
|
if (bAlphaClamping & 1) // min
|
||||||
{
|
{
|
||||||
f = 0;
|
f = 0;
|
||||||
ZZshSetParameter4fv(ppsOne.sOneColor, &f, "g_fOneColor");
|
ZZshSetParameter4fv(ppsOne.prog, ppsOne.sOneColor, &f, "g_fOneColor");
|
||||||
GL_BLENDEQ_RGB(GL_MAX_EXT);
|
GL_BLENDEQ_RGB(GL_MAX_EXT);
|
||||||
Draw(curvb);
|
Draw(curvb);
|
||||||
}
|
}
|
||||||
|
@ -1506,7 +1506,7 @@ inline void AlphaColorClamping(VB& curvb, const pixTest curtest)
|
||||||
if (bAlphaClamping & 2) // max
|
if (bAlphaClamping & 2) // max
|
||||||
{
|
{
|
||||||
f = 1;
|
f = 1;
|
||||||
ZZshSetParameter4fv(ppsOne.sOneColor, &f, "g_fOneColor");
|
ZZshSetParameter4fv(ppsOne.prog, ppsOne.sOneColor, &f, "g_fOneColor");
|
||||||
GL_BLENDEQ_RGB(GL_MIN_EXT);
|
GL_BLENDEQ_RGB(GL_MIN_EXT);
|
||||||
Draw(curvb);
|
Draw(curvb);
|
||||||
}
|
}
|
||||||
|
@ -1988,7 +1988,7 @@ void ZeroGS::SetTexInt(int context, FRAGMENTSHADER* pfragment, int settexint)
|
||||||
}
|
}
|
||||||
|
|
||||||
// clamp relies on texture width
|
// clamp relies on texture width
|
||||||
void ZeroGS::SetTexClamping(int context, FRAGMENTSHADER* pfragment)
|
inline void SetTexClamping(int context, FRAGMENTSHADER* pfragment )
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
SetShaderCaller("SetTexClamping");
|
SetShaderCaller("SetTexClamping");
|
||||||
|
@ -1998,30 +1998,25 @@ void ZeroGS::SetTexClamping(int context, FRAGMENTSHADER* pfragment)
|
||||||
u32* ptex = ZeroGS::vb[context].ptexClamp;
|
u32* ptex = ZeroGS::vb[context].ptexClamp;
|
||||||
ptex[0] = ptex[1] = 0;
|
ptex[0] = ptex[1] = 0;
|
||||||
|
|
||||||
float fw = ZeroGS::vb[context].tex0.tw ;
|
float fw = ZeroGS::vb[context].tex0.tw;
|
||||||
float fh = ZeroGS::vb[context].tex0.th ;
|
float fh = ZeroGS::vb[context].tex0.th;
|
||||||
|
|
||||||
switch (pclamp->wms)
|
switch(pclamp->wms)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
v2.x = -1e10;
|
v2.x = -1e10; v2.z = 1e10;
|
||||||
v2.z = 1e10;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // pclamp
|
case 1: // pclamp
|
||||||
// suikoden5 movie text
|
// suikoden5 movie text
|
||||||
v2.x = 0;
|
v2.x = 0; v2.z = 1-0.5f/fw;
|
||||||
v2.z = 1 - 0.5f / fw;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // reg pclamp
|
case 2: // reg pclamp
|
||||||
v2.x = (pclamp->minu + 0.5f) / fw;
|
v2.x = (pclamp->minu+0.5f)/fw; v2.z = (pclamp->maxu-0.5f)/fw;
|
||||||
v2.z = (pclamp->maxu - 0.5f) / fw;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // region rep x
|
case 3: // region rep x
|
||||||
v.x = 0.9999f;
|
v.x = 0.9999f;
|
||||||
v.z = (float)fw;
|
v.z = (float)fw ;
|
||||||
v2.x = (float)GPU_TEXMASKWIDTH / fw;
|
v2.x = (float)GPU_TEXMASKWIDTH / fw;
|
||||||
v2.z = pclamp->maxu / fw;
|
v2.z = pclamp->maxu / fw;
|
||||||
int correctMinu = pclamp->minu & (~pclamp->maxu); // (A && B) || C == (A && (B && !C)) + C
|
int correctMinu = pclamp->minu & (~pclamp->maxu); // (A && B) || C == (A && (B && !C)) + C
|
||||||
|
@ -2031,51 +2026,40 @@ void ZeroGS::SetTexClamping(int context, FRAGMENTSHADER* pfragment)
|
||||||
g_PrevBitwiseTexX = correctMinu;
|
g_PrevBitwiseTexX = correctMinu;
|
||||||
ptex[0] = ZeroGS::s_BitwiseTextures.GetTex(correctMinu, 0);
|
ptex[0] = ZeroGS::s_BitwiseTextures.GetTex(correctMinu, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (pclamp->wmt)
|
switch(pclamp->wmt)
|
||||||
{
|
{
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
v2.y = -1e10;
|
v2.y = -1e10; v2.w = 1e10;
|
||||||
v2.w = 1e10;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // pclamp
|
case 1: // pclamp
|
||||||
// suikoden5 movie text
|
// suikoden5 movie text
|
||||||
v2.y = 0;
|
v2.y = 0; v2.w = 1-0.5f/fh;
|
||||||
v2.w = 1 - 0.5f / fh;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // reg pclamp
|
case 2: // reg pclamp
|
||||||
v2.y = (pclamp->minv + 0.5f) / fh;
|
v2.y = (pclamp->minv+0.5f)/fh; v2.w = (pclamp->maxv-0.5f)/fh;
|
||||||
v2.w = (pclamp->maxv - 0.5f) / fh;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // region rep y
|
case 3: // region rep y
|
||||||
v.y = 0.9999f;
|
v.y = 0.9999f;
|
||||||
v.w = (float)fh;
|
v.w = (float)fh ;
|
||||||
v2.y = (float)GPU_TEXMASKWIDTH / fh;
|
v2.y = (float)GPU_TEXMASKWIDTH / fh;
|
||||||
v2.w = pclamp->maxv / fh;
|
v2.w = pclamp->maxv / fh;
|
||||||
int correctMinv = pclamp->minv & (~pclamp->maxv); // (A && B) || C == (A && (B && !C)) + C
|
int correctMinv = pclamp->minv & (~pclamp->maxv); // (A && B) || C == (A && (B && !C)) + C
|
||||||
|
|
||||||
if (correctMinv != g_PrevBitwiseTexY)
|
if (correctMinv != g_PrevBitwiseTexY) {
|
||||||
{
|
|
||||||
g_PrevBitwiseTexY = correctMinv;
|
g_PrevBitwiseTexY = correctMinv;
|
||||||
ptex[1] = ZeroGS::s_BitwiseTextures.GetTex(correctMinv, ptex[0]);
|
ptex[1] = ZeroGS::s_BitwiseTextures.GetTex(correctMinv, ptex[0]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pfragment->fTexWrapMode != 0)
|
|
||||||
ZZshSetParameter4fv(pfragment->fTexWrapMode, v, "g_fTexWrapMode");
|
|
||||||
|
|
||||||
if (pfragment->fClampExts != 0)
|
|
||||||
ZZshSetParameter4fv(pfragment->fClampExts, v2, "g_fClampExts");
|
|
||||||
|
|
||||||
|
|
||||||
|
if (ZZshActiveParameter(pfragment->fTexWrapMode))
|
||||||
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fTexWrapMode, v, "g_fTexWrapMode");
|
||||||
|
if (ZZshActiveParameter( pfragment->fClampExts))
|
||||||
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fClampExts, v2, "g_fClampExts");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fixme should be in float4 lib
|
// Fixme should be in float4 lib
|
||||||
|
@ -2246,11 +2230,11 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment)
|
||||||
|
|
||||||
// Test;*/
|
// Test;*/
|
||||||
|
|
||||||
ZZshSetParameter4fv(pfragment->fTexAlpha, valpha, "g_fTexAlpha");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fTexAlpha, valpha, "g_fTexAlpha");
|
||||||
ZZshSetParameter4fv(pfragment->fTexAlpha2, valpha2, "g_fTexAlpha2");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fTexAlpha2, valpha2, "g_fTexAlpha2");
|
||||||
|
|
||||||
if (IsAlphaTestExpansion(tex0))
|
if (IsAlphaTestExpansion(tex0))
|
||||||
ZZshSetParameter4fv(pfragment->fTestBlack, vblack, "g_fTestBlack");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fTestBlack, vblack, "g_fTestBlack");
|
||||||
|
|
||||||
SetTexClamping(context, pfragment);
|
SetTexClamping(context, pfragment);
|
||||||
|
|
||||||
|
@ -2296,7 +2280,7 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0,
|
||||||
v.w = 1.0f / (float)fh;
|
v.w = 1.0f / (float)fh;
|
||||||
|
|
||||||
if (pfragment->fRealTexDims)
|
if (pfragment->fRealTexDims)
|
||||||
ZZshSetParameter4fv(pfragment->fRealTexDims, v, "g_fRealTexDims");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fRealTexDims, v, "g_fRealTexDims");
|
||||||
else
|
else
|
||||||
ZZshSetParameter4fv(cgGetNamedParameter(pfragment->prog,"g_fRealTexDims"),v, "g_fRealTexDims");
|
ZZshSetParameter4fv(cgGetNamedParameter(pfragment->prog,"g_fRealTexDims"),v, "g_fRealTexDims");
|
||||||
}
|
}
|
||||||
|
@ -2352,11 +2336,11 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0,
|
||||||
v.z *= b.bpp * (1 / 32.0f);
|
v.z *= b.bpp * (1 / 32.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZZshSetParameter4fv(pfragment->fTexDims, vTexDims, "g_fTexDims");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fTexDims, vTexDims, "g_fTexDims");
|
||||||
|
|
||||||
// ZZshSetParameter4fv(pfragment->fTexBlock, b.vTexBlock, "g_fTexBlock"); // I change it, and it's working. Seems casting from float4 to float[4] is ok.
|
// ZZshSetParameter4fv(pfragment->prog, pfragment->fTexBlock, b.vTexBlock, "g_fTexBlock"); // I change it, and it's working. Seems casting from float4 to float[4] is ok.
|
||||||
ZZshSetParameter4fv(pfragment->fTexBlock, &b.vTexBlock.x, "g_fTexBlock");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fTexBlock, &b.vTexBlock.x, "g_fTexBlock");
|
||||||
ZZshSetParameter4fv(pfragment->fTexOffset, v, "g_fTexOffset");
|
ZZshSetParameter4fv(pfragment->prog, pfragment->fTexOffset, v, "g_fTexOffset");
|
||||||
|
|
||||||
// get hardware texture dims
|
// get hardware texture dims
|
||||||
//int texheight = (pmemtarg->realheight+pmemtarg->widthmult-1)/pmemtarg->widthmult;
|
//int texheight = (pmemtarg->realheight+pmemtarg->widthmult-1)/pmemtarg->widthmult;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -55,16 +55,16 @@ inline bool ZZshActiveParameter(ZZshParameter param) {return (param !=NULL); }
|
||||||
#endif // end NVIDIA cg-toolkit API
|
#endif // end NVIDIA cg-toolkit API
|
||||||
|
|
||||||
const static char* g_pPsTexWrap[] = { "-DREPEAT", "-DCLAMP", "-DREGION_REPEAT", NULL };
|
const static char* g_pPsTexWrap[] = { "-DREPEAT", "-DCLAMP", "-DREGION_REPEAT", NULL };
|
||||||
const static char* g_pTexTypes[] = { "32", "tex32", "clut32", "tex32to16", "tex16to8h" };
|
|
||||||
|
|
||||||
enum ZZshShaderType {ZZ_SH_ZERO, ZZ_SH_REGULAR, ZZ_SH_REGULAR_FOG, ZZ_SH_TEXTURE, ZZ_SH_TEXTURE_FOG, ZZ_SH_CRTC};
|
enum ZZshShaderType {ZZ_SH_ZERO, ZZ_SH_REGULAR, ZZ_SH_REGULAR_FOG, ZZ_SH_TEXTURE, ZZ_SH_TEXTURE_FOG, ZZ_SH_CRTC};
|
||||||
// We have "compatible" shaders, as RegularFogVS and RegularFogPS, if we don't need to worry about incompatible shaders.
|
// We have "compatible" shaders, as RegularFogVS and RegularFogPS. if don't need to wory about incompatible shaders
|
||||||
// It's used only in GLSL mode.
|
// It used only in GLSL mode.
|
||||||
|
|
||||||
// ------------------------- Variables -------------------------------
|
// ------------------------- Variables -------------------------------
|
||||||
extern int g_nPixelShaderVer;
|
|
||||||
extern ZZshShaderLink pvs[16], g_vsprog, g_psprog;
|
extern int g_nPixelShaderVer;
|
||||||
extern ZZshParameter g_vparamPosXY[2], g_fparamFogColor;
|
extern ZZshShaderLink pvs[16], g_vsprog, g_psprog;
|
||||||
|
extern ZZshParameter g_vparamPosXY[2], g_fparamFogColor;
|
||||||
|
|
||||||
#define MAX_ACTIVE_UNIFORMS 600
|
#define MAX_ACTIVE_UNIFORMS 600
|
||||||
#define MAX_ACTIVE_SHADERS 400
|
#define MAX_ACTIVE_SHADERS 400
|
||||||
|
@ -73,18 +73,18 @@ struct FRAGMENTSHADER
|
||||||
{
|
{
|
||||||
FRAGMENTSHADER() : prog(sZero), Shader(0), sMemory(pZero), sFinal(pZero), sBitwiseANDX(pZero), sBitwiseANDY(pZero), sInterlace(pZero), sCLUT(pZero), sOneColor(pZero), sBitBltZ(pZero),
|
FRAGMENTSHADER() : prog(sZero), Shader(0), sMemory(pZero), sFinal(pZero), sBitwiseANDX(pZero), sBitwiseANDY(pZero), sInterlace(pZero), sCLUT(pZero), sOneColor(pZero), sBitBltZ(pZero),
|
||||||
fTexAlpha2(pZero), fTexOffset(pZero), fTexDims(pZero), fTexBlock(pZero), fClampExts(pZero), fTexWrapMode(pZero),
|
fTexAlpha2(pZero), fTexOffset(pZero), fTexDims(pZero), fTexBlock(pZero), fClampExts(pZero), fTexWrapMode(pZero),
|
||||||
fRealTexDims(pZero), fTestBlack(pZero), fPageOffset(pZero), fTexAlpha(pZero) {}
|
fRealTexDims(pZero), fTestBlack(pZero), fPageOffset(pZero), fTexAlpha(pZero) {}
|
||||||
|
|
||||||
ZZshShaderLink prog; // it links to the FRAGMENTSHADER structure, for compatibility between GLSL and CG.
|
ZZshShaderLink prog; // it link to FRAGMENTSHADER structure, for compability between GLSL and CG
|
||||||
ZZshShader Shader; // GLSL store shaders not as ready programs, but as shader compiled objects. VS and PS should be linked together to
|
ZZshShader Shader; // GLSL store shader's not as ready programs, but as shaders compilated object. VS and PS should be linked together to
|
||||||
// make a program.
|
// made a program.
|
||||||
ZZshShaderType ShaderType; // Not every PS and VS are used together, only compatible ones.
|
ZZshShaderType ShaderType; // Not every PS and VS are used together, only compatible ones.
|
||||||
|
|
||||||
ZZshParameter sMemory, sFinal, sBitwiseANDX, sBitwiseANDY, sInterlace, sCLUT;
|
ZZshParameter sMemory, sFinal, sBitwiseANDX, sBitwiseANDY, sInterlace, sCLUT;
|
||||||
ZZshParameter sOneColor, sBitBltZ, sInvTexDims;
|
ZZshParameter sOneColor, sBitBltZ, sInvTexDims;
|
||||||
ZZshParameter fTexAlpha2, fTexOffset, fTexDims, fTexBlock, fClampExts, fTexWrapMode, fRealTexDims, fTestBlack, fPageOffset, fTexAlpha;
|
ZZshParameter fTexAlpha2, fTexOffset, fTexDims, fTexBlock, fClampExts, fTexWrapMode, fRealTexDims, fTestBlack, fPageOffset, fTexAlpha;
|
||||||
|
|
||||||
int ParametersStart, ParametersFinish; // this is part of UniformsIndex array in which parameters of this shader asre stored. The last one is ParametersFinish-1
|
int ParametersStart, ParametersFinish; // this is part of UniformsIndex array in which parameters of this shader stored. Last one is ParametersFinish-1
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
string filename;
|
string filename;
|
||||||
|
@ -175,28 +175,16 @@ struct VERTEXSHADER
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace ZeroGS {
|
namespace ZeroGS {
|
||||||
// Shaders variables
|
|
||||||
extern float4 g_vdepth;
|
extern float4 g_vdepth;
|
||||||
extern float4 vlogz;
|
extern float4 vlogz;
|
||||||
extern VERTEXSHADER pvsBitBlt;
|
extern VERTEXSHADER pvsBitBlt;
|
||||||
extern FRAGMENTSHADER ppsBitBlt[2], ppsBitBltDepth, ppsOne; // ppsOne used to stop using shaders for draw
|
extern FRAGMENTSHADER ppsBitBlt[2], ppsBitBltDepth, ppsOne; // ppsOne used to stop using shaders for draw
|
||||||
extern FRAGMENTSHADER ppsBaseTexture, ppsConvert16to32, ppsConvert32to16;
|
extern FRAGMENTSHADER ppsBaseTexture, ppsConvert16to32, ppsConvert32to16;
|
||||||
bool LoadEffects();
|
|
||||||
bool LoadExtraEffects();
|
|
||||||
FRAGMENTSHADER* LoadShadeEffect(int type, int texfilter, int fog, int testaem, int exactcolor, const clampInfo& clamp, int context, bool* pbFailed);
|
|
||||||
|
|
||||||
// only sets a limited amount of state (for Update)
|
extern FRAGMENTSHADER ppsRegular[4], ppsTexture[NUM_SHADERS];
|
||||||
void SetTexClamping(int context, FRAGMENTSHADER* pfragment);
|
extern FRAGMENTSHADER ppsCRTC[2], ppsCRTC24[2], ppsCRTCTarg[2];
|
||||||
void SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, bool CheckVB, FRAGMENTSHADER* pfragment, int force);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------- Variables -------------------------------
|
|
||||||
|
|
||||||
extern u8* s_lpShaderResources;
|
|
||||||
extern ZZshProfile cgvProf, cgfProf;
|
|
||||||
extern FRAGMENTSHADER ppsRegular[4], ppsTexture[NUM_SHADERS];
|
|
||||||
extern FRAGMENTSHADER ppsCRTC[2], ppsCRTC24[2], ppsCRTCTarg[2];
|
|
||||||
|
|
||||||
// ------------------------- Functions -------------------------------
|
// ------------------------- Functions -------------------------------
|
||||||
|
|
||||||
#ifdef NVIDIA_CG_API
|
#ifdef NVIDIA_CG_API
|
||||||
|
@ -222,22 +210,23 @@ inline void ResetShaderCounters() {
|
||||||
|
|
||||||
extern bool ZZshCheckProfilesSupport();
|
extern bool ZZshCheckProfilesSupport();
|
||||||
extern bool ZZshStartUsingShaders();
|
extern bool ZZshStartUsingShaders();
|
||||||
|
extern bool ZZshCreateOpenShadersFile();
|
||||||
extern void ZZshGLDisableProfile();
|
extern void ZZshGLDisableProfile();
|
||||||
extern void ZZshGLEnableProfile();
|
extern void ZZshGLEnableProfile();
|
||||||
|
extern void ZZshSetParameter4fv(ZZshShaderLink prog, ZZshParameter param, const float* v, const char* name);
|
||||||
extern void ZZshSetParameter4fv(ZZshParameter param, const float* v, const char* name);
|
extern void ZZshSetParameter4fv(ZZshParameter param, const float* v, const char* name);
|
||||||
|
extern void ZZshSetParameter4fvWithRetry(ZZshParameter* param, ZZshShaderLink prog, const float* v, const char* name);
|
||||||
|
extern void ZZshGLSetTextureParameter(ZZshShaderLink prog, ZZshParameter param, GLuint texobj, const char* name);
|
||||||
extern void ZZshGLSetTextureParameter(ZZshParameter param, GLuint texobj, const char* name);
|
extern void ZZshGLSetTextureParameter(ZZshParameter param, GLuint texobj, const char* name);
|
||||||
extern void ZZshDefaultOneColor( FRAGMENTSHADER ptr );
|
extern void ZZshDefaultOneColor( FRAGMENTSHADER ptr );
|
||||||
extern void ZZshSetVertexShader(ZZshShader prog);
|
extern void ZZshSetVertexShader(ZZshShaderLink prog);
|
||||||
extern void ZZshSetPixelShader(ZZshShader prog);
|
extern void ZZshSetPixelShader(ZZshShaderLink prog);
|
||||||
|
extern bool ZZshLoadExtraEffects();
|
||||||
|
|
||||||
inline int GET_SHADER_INDEX(int type, int texfilter, int texwrap, int fog, int writedepth, int testaem, int exactcolor, int context, int ps)
|
extern FRAGMENTSHADER* ZZshLoadShadeEffect(int type, int texfilter, int fog, int testaem, int exactcolor, const clampInfo& clamp, int context, bool* pbFailed);
|
||||||
{
|
|
||||||
return type + texfilter*NUM_TYPES + NUM_FILTERS*NUM_TYPES*texwrap + NUM_TEXWRAPS*NUM_FILTERS*NUM_TYPES*(fog+2*writedepth+4*testaem+8*exactcolor+16*context+32*ps);
|
namespace ZeroGS {
|
||||||
|
// only sets a limited amount of state (for Update)
|
||||||
|
void SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, bool CheckVB, FRAGMENTSHADER* pfragment, int force);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SHADERHEADER
|
|
||||||
{
|
|
||||||
unsigned int index, offset, size; // if highest bit of index is set, pixel shader
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -127,7 +127,7 @@ inline float4 ZeroGS::CRenderTarget::DefaultBitBltPos()
|
||||||
{
|
{
|
||||||
float4 v = float4(1, -1, 0.5f / (float)RW(fbw), 0.5f / (float)RH(fbh));
|
float4 v = float4(1, -1, 0.5f / (float)RW(fbw), 0.5f / (float)RH(fbh));
|
||||||
v *= 1.0f / 32767.0f;
|
v *= 1.0f / 32767.0f;
|
||||||
ZZshSetParameter4fv(pvsBitBlt.sBitBltPos, v, "g_sBitBltPos");
|
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltPos, v, "g_sBitBltPos");
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ inline float4 ZeroGS::CRenderTarget::DefaultBitBltTex()
|
||||||
// I really sure that -0.5 is correct, because OpenGL have no half-offset
|
// I really sure that -0.5 is correct, because OpenGL have no half-offset
|
||||||
// issue, DirectX known for.
|
// issue, DirectX known for.
|
||||||
float4 v = float4(1, -1, 0.5f / (float)RW(fbw), -0.5f / (float)RH(fbh));
|
float4 v = float4(1, -1, 0.5f / (float)RW(fbw), -0.5f / (float)RH(fbh));
|
||||||
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_sBitBltTex");
|
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltTex, v, "g_sBitBltTex");
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
|
||||||
|
|
||||||
if (nUpdateTarg)
|
if (nUpdateTarg)
|
||||||
{
|
{
|
||||||
ZZshGLSetTextureParameter(ppsBaseTexture.sFinal, ittarg->second->ptex, "BaseTexture.final");
|
ZZshGLSetTextureParameter(ppsBaseTexture.prog, ppsBaseTexture.sFinal, ittarg->second->ptex, "BaseTexture.final");
|
||||||
|
|
||||||
//assert( ittarg->second->fbw == fbw );
|
//assert( ittarg->second->fbw == fbw );
|
||||||
int offset = (fbp - ittarg->second->fbp) * 64 / fbw;
|
int offset = (fbp - ittarg->second->fbp) * 64 / fbw;
|
||||||
|
@ -446,7 +446,7 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
|
||||||
v.z = 0.25f;
|
v.z = 0.25f;
|
||||||
v.w = (float)RH(offset) + 0.25f;
|
v.w = (float)RH(offset) + 0.25f;
|
||||||
|
|
||||||
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
|
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
|
||||||
|
|
||||||
// v = DefaultBitBltTex(); Maybe?
|
// v = DefaultBitBltTex(); Maybe?
|
||||||
ZZshDefaultOneColor ( ppsBaseTexture );
|
ZZshDefaultOneColor ( ppsBaseTexture );
|
||||||
|
@ -473,14 +473,14 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
|
||||||
// Fix in r133 -- FFX movies and Gust backgrounds!
|
// Fix in r133 -- FFX movies and Gust backgrounds!
|
||||||
//SetTexVariablesInt(0, 0*(AA.x || AA.y) ? 2 : 0, texframe, false, &ppsBitBlt[!!s_AAx], 1);
|
//SetTexVariablesInt(0, 0*(AA.x || AA.y) ? 2 : 0, texframe, false, &ppsBitBlt[!!s_AAx], 1);
|
||||||
SetTexVariablesInt(0, 0, texframe, false, &ppsBitBlt[bit_idx], 1);
|
SetTexVariablesInt(0, 0, texframe, false, &ppsBitBlt[bit_idx], 1);
|
||||||
ZZshGLSetTextureParameter(ppsBitBlt[bit_idx].sMemory, vb[0].pmemtarg->ptex->tex, "BitBlt.memory");
|
ZZshGLSetTextureParameter(ppsBitBlt[bit_idx].prog, ppsBitBlt[bit_idx].sMemory, vb[0].pmemtarg->ptex->tex, "BitBlt.memory");
|
||||||
|
|
||||||
v = float4(1, 1, 0.0f, 0.0f);
|
v = float4(1, 1, 0.0f, 0.0f);
|
||||||
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
|
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
|
||||||
|
|
||||||
v.x = 1;
|
v.x = 1;
|
||||||
v.y = 2;
|
v.y = 2;
|
||||||
ZZshSetParameter4fv(ppsBitBlt[bit_idx].sOneColor, v, "g_fOneColor");
|
ZZshSetParameter4fv(ppsBitBlt[bit_idx].prog, ppsBitBlt[bit_idx].sOneColor, v, "g_fOneColor");
|
||||||
|
|
||||||
assert(ptex != 0);
|
assert(ptex != 0);
|
||||||
|
|
||||||
|
@ -544,19 +544,19 @@ void ZeroGS::CRenderTarget::ConvertTo32()
|
||||||
v.y = (float)RH(16);
|
v.y = (float)RH(16);
|
||||||
v.z = -(float)RW(fbw);
|
v.z = -(float)RW(fbw);
|
||||||
v.w = (float)RH(8);
|
v.w = (float)RH(8);
|
||||||
ZZshSetParameter4fv(ppsConvert16to32.fTexOffset, v, "g_fTexOffset");
|
ZZshSetParameter4fv(ppsConvert16to32.prog, ppsConvert16to32.fTexOffset, v, "g_fTexOffset");
|
||||||
|
|
||||||
v.x = (float)RW(8);
|
v.x = (float)RW(8);
|
||||||
v.y = 0;
|
v.y = 0;
|
||||||
v.z = 0;
|
v.z = 0;
|
||||||
v.w = 0.25f;
|
v.w = 0.25f;
|
||||||
ZZshSetParameter4fv(ppsConvert16to32.fPageOffset, v, "g_fPageOffset");
|
ZZshSetParameter4fv(ppsConvert16to32.prog, ppsConvert16to32.fPageOffset, v, "g_fPageOffset");
|
||||||
|
|
||||||
v.x = (float)RW(2 * fbw);
|
v.x = (float)RW(2 * fbw);
|
||||||
v.y = (float)RH(fbh);
|
v.y = (float)RH(fbh);
|
||||||
v.z = 0;
|
v.z = 0;
|
||||||
v.w = 0.0001f * (float)RH(fbh);
|
v.w = 0.0001f * (float)RH(fbh);
|
||||||
ZZshSetParameter4fv(ppsConvert16to32.fTexDims, v, "g_fTexDims");
|
ZZshSetParameter4fv(ppsConvert16to32.prog, ppsConvert16to32.fTexDims, v, "g_fTexDims");
|
||||||
|
|
||||||
// v.x = 0;
|
// v.x = 0;
|
||||||
// ZZshSetParameter4fv(ppsConvert16to32.fTexBlock, v, "g_fTexBlock");
|
// ZZshSetParameter4fv(ppsConvert16to32.fTexBlock, v, "g_fTexBlock");
|
||||||
|
@ -569,7 +569,7 @@ void ZeroGS::CRenderTarget::ConvertTo32()
|
||||||
ZeroGS::ResetRenderTarget(1);
|
ZeroGS::ResetRenderTarget(1);
|
||||||
|
|
||||||
BindToSample(&ptex);
|
BindToSample(&ptex);
|
||||||
ZZshGLSetTextureParameter(ppsConvert16to32.sFinal, ptex, "Convert 16 to 32.Final");
|
ZZshGLSetTextureParameter(ppsConvert16to32.prog, ppsConvert16to32.sFinal, ptex, "Convert 16 to 32.Final");
|
||||||
|
|
||||||
fbh /= 2; // have 16 bit surfaces are usually 2x higher
|
fbh /= 2; // have 16 bit surfaces are usually 2x higher
|
||||||
SetViewport();
|
SetViewport();
|
||||||
|
@ -648,19 +648,19 @@ void ZeroGS::CRenderTarget::ConvertTo16()
|
||||||
v.y = 8.0f / (float)fbh;
|
v.y = 8.0f / (float)fbh;
|
||||||
v.z = 0.5f * v.x;
|
v.z = 0.5f * v.x;
|
||||||
v.w = 0.5f * v.y;
|
v.w = 0.5f * v.y;
|
||||||
ZZshSetParameter4fv(ppsConvert32to16.fTexOffset, v, "g_fTexOffset");
|
ZZshSetParameter4fv(ppsConvert32to16.prog, ppsConvert32to16.fTexOffset, v, "g_fTexOffset");
|
||||||
|
|
||||||
v.x = 256.0f / 255.0f;
|
v.x = 256.0f / 255.0f;
|
||||||
v.y = 256.0f / 255.0f;
|
v.y = 256.0f / 255.0f;
|
||||||
v.z = 0.05f / 256.0f;
|
v.z = 0.05f / 256.0f;
|
||||||
v.w = -0.001f / 256.0f;
|
v.w = -0.001f / 256.0f;
|
||||||
ZZshSetParameter4fv(ppsConvert32to16.fPageOffset, v, "g_fPageOffset");
|
ZZshSetParameter4fv(ppsConvert32to16.prog, ppsConvert32to16.fPageOffset, v, "g_fPageOffset");
|
||||||
|
|
||||||
v.x = (float)RW(fbw);
|
v.x = (float)RW(fbw);
|
||||||
v.y = (float)RH(2 * fbh);
|
v.y = (float)RH(2 * fbh);
|
||||||
v.z = 0;
|
v.z = 0;
|
||||||
v.w = -0.1f / RH(fbh);
|
v.w = -0.1f / RH(fbh);
|
||||||
ZZshSetParameter4fv(ppsConvert32to16.fTexDims, v, "g_fTexDims");
|
ZZshSetParameter4fv(ppsConvert32to16.prog, ppsConvert32to16.fTexDims, v, "g_fTexDims");
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
|
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
|
||||||
SET_STREAM();
|
SET_STREAM();
|
||||||
|
@ -672,7 +672,7 @@ void ZeroGS::CRenderTarget::ConvertTo16()
|
||||||
|
|
||||||
BindToSample(&ptex);
|
BindToSample(&ptex);
|
||||||
|
|
||||||
ZZshGLSetTextureParameter(ppsConvert32to16.sFinal, ptex, "Convert 32 to 16");
|
ZZshGLSetTextureParameter(ppsConvert32to16.prog, ppsConvert32to16.sFinal, ptex, "Convert 32 to 16");
|
||||||
|
|
||||||
// fbh *= 2; // have 16 bit surfaces are usually 2x higher
|
// fbh *= 2; // have 16 bit surfaces are usually 2x higher
|
||||||
|
|
||||||
|
@ -751,7 +751,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback()
|
||||||
// tex coords, test ffx bikanel island when changing these
|
// tex coords, test ffx bikanel island when changing these
|
||||||
/* float4 v = DefaultBitBltPos();
|
/* float4 v = DefaultBitBltPos();
|
||||||
v = float4 ((float)(RW(fbw+4)), (float)(RH(fbh+4)), +0.25f, -0.25f);
|
v = float4 ((float)(RW(fbw+4)), (float)(RH(fbh+4)), +0.25f, -0.25f);
|
||||||
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "BitBltTex");*/
|
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltTex, v, "BitBltTex");*/
|
||||||
|
|
||||||
// tex coords, test ffx bikanel island when changing these
|
// tex coords, test ffx bikanel island when changing these
|
||||||
|
|
||||||
|
@ -764,7 +764,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback()
|
||||||
v.y = (float)(RH(fbh));
|
v.y = (float)(RH(fbh));
|
||||||
v.z = 0.0f;
|
v.z = 0.0f;
|
||||||
v.w = 0.0f;
|
v.w = 0.0f;
|
||||||
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "BitBlt.Feedback");
|
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltTex, v, "BitBlt.Feedback");
|
||||||
ZZshDefaultOneColor(ppsBaseTexture);
|
ZZshDefaultOneColor(ppsBaseTexture);
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
|
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
|
||||||
|
@ -774,7 +774,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback()
|
||||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptex);
|
glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptex);
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
ZZshGLSetTextureParameter(ppsBaseTexture.sFinal, ptex, "BaseTexture.Feedback");
|
ZZshGLSetTextureParameter(ppsBaseTexture.prog, ppsBaseTexture.sFinal, ptex, "BaseTexture.Feedback");
|
||||||
|
|
||||||
SetViewport();
|
SetViewport();
|
||||||
|
|
||||||
|
@ -977,7 +977,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
|
||||||
|
|
||||||
// write color and zero out stencil buf, always 0 context!
|
// write color and zero out stencil buf, always 0 context!
|
||||||
SetTexVariablesInt(0, 0, texframe, false, &ppsBitBltDepth, 1);
|
SetTexVariablesInt(0, 0, texframe, false, &ppsBitBltDepth, 1);
|
||||||
ZZshGLSetTextureParameter(ppsBitBltDepth.sMemory, vb[0].pmemtarg->ptex->tex, "BitBltDepth");
|
ZZshGLSetTextureParameter(ppsBitBltDepth.prog, ppsBitBltDepth.sMemory, vb[0].pmemtarg->ptex->tex, "BitBltDepth");
|
||||||
|
|
||||||
float4 v = DefaultBitBltPos();
|
float4 v = DefaultBitBltPos();
|
||||||
|
|
||||||
|
@ -987,7 +987,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
|
||||||
v.y = 2;
|
v.y = 2;
|
||||||
v.z = PSMT_IS16Z(psm) ? 1.0f : 0.0f;
|
v.z = PSMT_IS16Z(psm) ? 1.0f : 0.0f;
|
||||||
v.w = g_filog32;
|
v.w = g_filog32;
|
||||||
ZZshSetParameter4fv(ppsBitBltDepth.sOneColor, v, "g_fOneColor");
|
ZZshSetParameter4fv(ppsBitBltDepth.prog, ppsBitBltDepth.sOneColor, v, "g_fOneColor");
|
||||||
|
|
||||||
float4 vdepth = g_vdepth;
|
float4 vdepth = g_vdepth;
|
||||||
|
|
||||||
|
@ -1002,7 +1002,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
|
||||||
|
|
||||||
assert(ppsBitBltDepth.sBitBltZ != 0);
|
assert(ppsBitBltDepth.sBitBltZ != 0);
|
||||||
|
|
||||||
ZZshSetParameter4fv(ppsBitBltDepth.sBitBltZ, ((255.0f / 256.0f)*vdepth), "g_fBitBltZ");
|
ZZshSetParameter4fv(ppsBitBltDepth.prog, ppsBitBltDepth.sBitBltZ, ((255.0f / 256.0f)*vdepth), "g_fBitBltZ");
|
||||||
|
|
||||||
assert(pdepth != 0);
|
assert(pdepth != 0);
|
||||||
//GLint w1 = 0;
|
//GLint w1 = 0;
|
||||||
|
|
|
@ -228,7 +228,6 @@ inline list<ZeroGS::CRenderTarget*> CreateTargetsList(int start, int end)
|
||||||
return listTargs;
|
return listTargs;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern float4 g_vdepth;
|
|
||||||
extern int icurctx;
|
extern int icurctx;
|
||||||
extern GLuint vboRect;
|
extern GLuint vboRect;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ extern int g_nFrame, g_nRealFrame;
|
||||||
//-------------------------- Variables
|
//-------------------------- Variables
|
||||||
|
|
||||||
primInfo *prim;
|
primInfo *prim;
|
||||||
ZZshProgram g_vsprog = 0, g_psprog = 0; // 2 -- ZZ
|
|
||||||
|
|
||||||
inline u32 FtoDW(float f) { return (*((u32*)&f)); }
|
inline u32 FtoDW(float f) { return (*((u32*)&f)); }
|
||||||
|
|
||||||
|
@ -81,7 +80,6 @@ PFNGLDRAWBUFFERSPROC glDrawBuffers = NULL;
|
||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// graphics resources
|
// graphics resources
|
||||||
ZZshParameter g_vparamPosXY[2] = {0}, g_fparamFogColor = 0;
|
|
||||||
|
|
||||||
bool s_bTexFlush = false;
|
bool s_bTexFlush = false;
|
||||||
int s_nLastResolveReset = 0;
|
int s_nLastResolveReset = 0;
|
||||||
|
@ -93,8 +91,6 @@ int nBackbufferWidth, nBackbufferHeight; // ZZ
|
||||||
|
|
||||||
namespace ZeroGS
|
namespace ZeroGS
|
||||||
{
|
{
|
||||||
float4 g_vdepth, vlogz;
|
|
||||||
|
|
||||||
// = float4( 255.0 /256.0f, 255.0/65536.0f, 255.0f/(65535.0f*256.0f), 1.0f/(65536.0f*65536.0f));
|
// = float4( 255.0 /256.0f, 255.0/65536.0f, 255.0f/(65535.0f*256.0f), 1.0f/(65536.0f*65536.0f));
|
||||||
// float4 g_vdepth = float4( 65536.0f*65536.0f, 256.0f*65536.0f, 65536.0f, 256.0f);
|
// float4 g_vdepth = float4( 65536.0f*65536.0f, 256.0f*65536.0f, 65536.0f, 256.0f);
|
||||||
|
|
||||||
|
@ -491,18 +487,18 @@ void ZeroGS::RenderCustom(float fAlpha)
|
||||||
|
|
||||||
// tex coords
|
// tex coords
|
||||||
float4 v = float4(1 / 32767.0f, 1 / 32767.0f, 0, 0);
|
float4 v = float4(1 / 32767.0f, 1 / 32767.0f, 0, 0);
|
||||||
ZZshSetParameter4fv(pvsBitBlt.sBitBltPos, v, "g_fBitBltPos");
|
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltPos, v, "g_fBitBltPos");
|
||||||
v.x = (float)nLogoWidth;
|
v.x = (float)nLogoWidth;
|
||||||
v.y = (float)nLogoHeight;
|
v.y = (float)nLogoHeight;
|
||||||
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
|
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
|
||||||
|
|
||||||
v.x = v.y = v.z = v.w = fAlpha;
|
v.x = v.y = v.z = v.w = fAlpha;
|
||||||
ZZshSetParameter4fv(ppsBaseTexture.sOneColor, v, "g_fOneColor");
|
ZZshSetParameter4fv(ppsBaseTexture.prog, ppsBaseTexture.sOneColor, v, "g_fOneColor");
|
||||||
|
|
||||||
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
|
|
||||||
// inside vhDCb[0]'s target area, so render that region only
|
// inside vhDCb[0]'s target area, so render that region only
|
||||||
ZZshGLSetTextureParameter(ppsBaseTexture.sFinal, ptexLogo, "Logo");
|
ZZshGLSetTextureParameter(ppsBaseTexture.prog, ppsBaseTexture.sFinal, ptexLogo, "Logo");
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
|
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
|
||||||
|
|
||||||
SET_STREAM();
|
SET_STREAM();
|
||||||
|
|
|
@ -66,7 +66,10 @@ extern float g_fiGPU_TEXWIDTH;
|
||||||
#define MASKDIVISOR 0 // Used for decrement bitwise mask texture size if 1024 is too big
|
#define MASKDIVISOR 0 // Used for decrement bitwise mask texture size if 1024 is too big
|
||||||
#define GPU_TEXMASKWIDTH (1024 >> MASKDIVISOR) // bitwise mask width for region repeat mode
|
#define GPU_TEXMASKWIDTH (1024 >> MASKDIVISOR) // bitwise mask width for region repeat mode
|
||||||
|
|
||||||
|
extern u32 ptexBlocks; // holds information on block tiling. It's texture number in OpenGL -- if 0 than such texture
|
||||||
|
extern u32 ptexConv16to32; // does not exists. This textures should be created on start and released on finish.
|
||||||
extern u32 ptexBilinearBlocks;
|
extern u32 ptexBilinearBlocks;
|
||||||
|
extern u32 ptexConv32to16;
|
||||||
|
|
||||||
// this is currently *not* used as a bool, in spite of its moniker --air
|
// this is currently *not* used as a bool, in spite of its moniker --air
|
||||||
// Actually, the only thing written to it is 1 or 0, which makes the (g_bSaveFlushedFrame & 0x80000000) check rather bizzare.
|
// Actually, the only thing written to it is 1 or 0, which makes the (g_bSaveFlushedFrame & 0x80000000) check rather bizzare.
|
||||||
|
|
Loading…
Reference in New Issue