zzogl-pg: Search and replace on a few things.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3755 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-09-12 07:15:52 +00:00
parent 2f004397f6
commit 6b4d447c8d
12 changed files with 168 additions and 169 deletions

View File

@ -155,9 +155,9 @@
<Unit filename="../../ZZoglFlushHack.h" />
<Unit filename="../../ZZoglSave.cpp" />
<Unit filename="../../ZZoglShaders.cpp" />
<Unit filename="../../ZZoglShaders.h" />
<Unit filename="../../ZZoglShoots.cpp" />
<Unit filename="../../ZZoglVB.cpp" />
<Unit filename="../../ZeroGSShaders/zerogsshaders.h" />
<Unit filename="../../common.h" />
<Unit filename="../../glprocs.c">
<Option compilerVar="CC" />

View File

@ -5,7 +5,7 @@
#include "resrc1.h"
#include "GS.h"
#include "zerogsshaders.h"
#include "ZZoglShaders.h"
#include "Win32.h"
#include <map>

View File

@ -21,7 +21,7 @@
#include "Util.h"
#include "GS.h"
#include "ZeroGSShaders/zerogsshaders.h"
#include "ZZoglShaders.h"
#include "Profile.h"
#include "GLWin.h"

View File

@ -222,7 +222,7 @@ inline void RenderStartHelper(u32 bInterlace)
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
ZZcgSetVertexShader(pvsBitBlt.prog);
ZZshSetVertexShader(pvsBitBlt.prog);
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
SET_STREAM();
@ -282,7 +282,7 @@ inline Vector RenderGetForClip(u32 bInterlace, int interlace, int psm, FRAGMENTS
valpha.w = 1;
}
ZZcgSetParameter4fv(prog->sOneColor, valpha, "g_fOneColor");
ZZshSetParameter4fv(prog->sOneColor, valpha, "g_fOneColor");
return valpha;
}
@ -295,7 +295,7 @@ inline void RenderCreateInterlaceTex(u32 bInterlace, int th, FRAGMENTSHADER* pro
int interlacetex = CreateInterlaceTex(2 * th);
ZZcgGLSetTextureParameter(prog->sInterlace, interlacetex, "Interlace");
ZZshGLSetTextureParameter(prog->sInterlace, interlacetex, "Interlace");
}
// Well, do blending setup prior to second pass of half-frame drawing
@ -359,7 +359,7 @@ inline void RenderCRTC24helper(u32 bInterlace, int interlace, int psm)
SetShaderCaller("RenderCRTC24helper");
// assume that data is already in ptexMem (do Resolve?)
RenderGetForClip(bInterlace, interlace, psm, &ppsCRTC24[bInterlace]);
ZZcgSetPixelShader(ppsCRTC24[bInterlace].prog);
ZZshSetPixelShader(ppsCRTC24[bInterlace].prog);
DrawTriangleArray();
}
@ -416,7 +416,7 @@ inline Vector RenderSetTargetBitPos(int dh, int th, int movy, bool isInterlace)
v.w += 1.0f / (float)dh ;
}
ZZcgSetParameter4fv(pvsBitBlt.sBitBltPos, v, "g_fBitBltPos");
ZZshSetParameter4fv(pvsBitBlt.sBitBltPos, v, "g_fBitBltPos");
return v;
}
@ -440,7 +440,7 @@ inline Vector RenderSetTargetBitTex(float th, float tw, float dh, float dw, bool
v.w += 1.0f / conf.height;
}
ZZcgSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
return v;
}
@ -451,7 +451,7 @@ inline Vector RenderSetTargetBitTrans(int th)
{
SetShaderCaller("RenderSetTargetBitTrans");
Vector v = Vector(float(th), -float(th), float(th), float(th));
ZZcgSetParameter4fv(pvsBitBlt.fBitBltTrans, v, "g_fBitBltTrans");
ZZshSetParameter4fv(pvsBitBlt.fBitBltTrans, v, "g_fBitBltTrans");
return v;
}
@ -469,7 +469,7 @@ inline Vector RenderSetTargetInvTex(int bInterlace, int tw, int th, FRAGMENTSHAD
v.y = 1.0f / (float)th;
v.z = (float)0.0;
v.w = -0.5f / (float)th;
ZZcgSetParameter4fv(prog->sInvTexDims, v, "g_fInvTexDims");
ZZshSetParameter4fv(prog->sInvTexDims, v, "g_fInvTexDims");
}
return v;
@ -554,10 +554,10 @@ inline void RenderCheckForTargets(tex0Info& texframe, list<CRenderTarget*>& list
Vector valpha = RenderGetForClip(bInterlace, interlace, texframe.psm, &ppsCRTCTarg[bInterlace]);
// inside vb[0]'s target area, so render that region only
ZZcgGLSetTextureParameter(ppsCRTCTarg[bInterlace].sFinal, ptarg->ptex, "CRTC target");
ZZshGLSetTextureParameter(ppsCRTCTarg[bInterlace].sFinal, ptarg->ptex, "CRTC target");
RenderCreateInterlaceTex(bInterlace, texframe.th, &ppsCRTCTarg[bInterlace]);
ZZcgSetPixelShader(ppsCRTCTarg[bInterlace].prog);
ZZshSetPixelShader(ppsCRTCTarg[bInterlace].prog);
DrawTriangleArray();
@ -626,9 +626,9 @@ inline void RenderCheckForMemory(tex0Info& texframe, list<CRenderTarget*>& listT
v = RenderSetTargetInvTex(bInterlace, texframe.tw, texframe.th, &ppsCRTC[bInterlace]);
Vector valpha = RenderGetForClip(bInterlace, interlace, texframe.psm, &ppsCRTC[bInterlace]);
ZZcgGLSetTextureParameter(ppsCRTC[bInterlace].sMemory, vb[0].pmemtarg->ptex->tex, "CRTC memory");
ZZshGLSetTextureParameter(ppsCRTC[bInterlace].sMemory, vb[0].pmemtarg->ptex->tex, "CRTC memory");
RenderCreateInterlaceTex(bInterlace, texframe.th, &ppsCRTC[bInterlace]);
ZZcgSetPixelShader(ppsCRTC[bInterlace].prog);
ZZshSetPixelShader(ppsCRTC[bInterlace].prog);
DrawTriangleArray();
}

View File

@ -129,7 +129,7 @@ void (APIENTRY *zgsBlendFuncSeparateEXT)(GLenum, GLenum, GLenum, GLenum) = NULL;
// State parameters
extern u8* s_lpShaderResources;
CGprogram pvs[16] = {NULL};
ZZshProgram pvs[16] = {NULL};
// String's for shader file in developer mode
#ifdef DEVBUILD
@ -217,7 +217,7 @@ inline bool ZeroGS::CreateImportantCheck()
bSuccess = false;
}
bSuccess &= ZZcgCheckProfilesSupport();
bSuccess &= ZZshCheckProfilesSupport();
return bSuccess;
}
@ -767,7 +767,7 @@ bool ZeroGS::Create(int _width, int _height)
if (err != GL_NO_ERROR) bSuccess = false;
if (!ZZcgStartUsingShaders()) bSuccess = false;
if (!ZZshStartUsingShaders()) bSuccess = false;
GL_REPORT_ERROR();

View File

@ -124,7 +124,7 @@ extern float g_fBlockMult; // used for old cards, that do not support Alpha-32fl
bool g_bUpdateStencil = 1;
//u32 g_SaveFrameNum = 0; // ZZ
extern CGprogram g_psprog; // 2 -- ZZ
extern ZZshProgram g_psprog; // 2 -- ZZ
// local alpha blending settings
static GLenum s_rgbeq, s_alphaeq; // set by zgsBlendEquationSeparateEXT // ZZ
@ -217,11 +217,11 @@ void ResetAlphaVariables();
inline void SetAlphaTestInt(pixTest curtest);
inline void RenderAlphaTest(const VB& curvb, CGparameter sOneColor);
inline void RenderAlphaTest(const VB& curvb, ZZshParameter sOneColor);
inline void RenderStencil(const VB& curvb, u32 dwUsingSpecialTesting);
inline void ProcessStencil(const VB& curvb);
inline void RenderFBA(const VB& curvb, CGparameter sOneColor);
inline void ProcessFBA(const VB& curvb, CGparameter sOneColor); // zz
inline void RenderFBA(const VB& curvb, ZZshParameter sOneColor);
inline void ProcessFBA(const VB& curvb, ZZshParameter sOneColor); // zz
}
@ -859,7 +859,7 @@ inline Vector FlushSetPageOffset(FRAGMENTSHADER* pfragment, int shadertype, CRen
// zoe2
if (PSMT_ISZTEX(ptextarg->psm)) vpageoffset.w = -1.0f;
ZZcgSetParameter4fv(pfragment->fPageOffset, vpageoffset, "g_fPageOffset");
ZZshSetParameter4fv(pfragment->fPageOffset, vpageoffset, "g_fPageOffset");
return vpageoffset;
}
@ -877,7 +877,7 @@ inline Vector FlushSetTexOffset(FRAGMENTSHADER* pfragment, int shadertype, VB& c
v.y = 16.0f / (float)curvb.tex0.th;
v.z = 0.5f * v.x;
v.w = 0.5f * v.y;
ZZcgSetParameter4fv(pfragment->fTexOffset, v, "g_fTexOffset");
ZZshSetParameter4fv(pfragment->fTexOffset, v, "g_fTexOffset");
}
else if (shadertype == 4)
{
@ -886,7 +886,7 @@ inline Vector FlushSetTexOffset(FRAGMENTSHADER* pfragment, int shadertype, VB& c
v.y = 16.0f / (float)ptextarg->fbh;
v.z = -1;
v.w = 8.0f / (float)ptextarg->fbh;
ZZcgSetParameter4fv(pfragment->fTexOffset, v, "g_fTexOffset");
ZZshSetParameter4fv(pfragment->fTexOffset, v, "g_fTexOffset");
}
return v;
@ -920,7 +920,7 @@ inline Vector FlushTextureDims(FRAGMENTSHADER* pfragment, int shadertype, VB& cu
if (shadertype == 4)
vTexDims.z += 8.0f;
ZZcgSetParameter4fv(pfragment->fTexDims, vTexDims, "g_fTexDims");
ZZshSetParameter4fv(pfragment->fTexDims, vTexDims, "g_fTexDims");
return vTexDims;
}
@ -970,7 +970,7 @@ inline FRAGMENTSHADER* FlushUseExistRenderTarget(VB& curvb, CRenderTarget* ptext
Vector vTexDims = FlushTextureDims(pfragment, shadertype, curvb, ptextarg);
if (pfragment->sCLUT != NULL && ptexclut != 0)
ZZcgGLSetTextureParameter(pfragment->sCLUT, ptexclut, "CLUT");
ZZshGLSetTextureParameter(pfragment->sCLUT, ptexclut, "CLUT");
FlushApplyResizeFilter(curvb, dwFilterOpts, ptextarg, context);
@ -1016,13 +1016,13 @@ inline void FlushSetTexture(VB& curvb, FRAGMENTSHADER* pfragment, CRenderTarget*
// have to enable the texture parameters(curtest.atst)
if( curvb.ptexClamp[0] != 0 )
ZZcgGLSetTextureParameter(pfragment->sBitwiseANDX, curvb.ptexClamp[0], "Clamp 0");
ZZshGLSetTextureParameter(pfragment->sBitwiseANDX, curvb.ptexClamp[0], "Clamp 0");
if( curvb.ptexClamp[1] != 0 )
ZZcgGLSetTextureParameter(pfragment->sBitwiseANDY, curvb.ptexClamp[1], "Clamp 1");
ZZshGLSetTextureParameter(pfragment->sBitwiseANDY, curvb.ptexClamp[1], "Clamp 1");
if( pfragment->sMemory != NULL && s_ptexCurSet[context] != 0)
ZZcgGLSetTextureParameter(pfragment->sMemory, s_ptexCurSet[context], "Clamp memory");
ZZshGLSetTextureParameter(pfragment->sMemory, s_ptexCurSet[context], "Clamp memory");
}
@ -1032,7 +1032,7 @@ inline void FlushBindProgramm(FRAGMENTSHADER* pfragment, int context)
vb[context].bTexConstsSync = 0;
vb[context].bVarsTexSync = 0;
ZZcgSetPixelShader(pfragment->prog);
ZZshSetPixelShader(pfragment->prog);
}
inline FRAGMENTSHADER* FlushRendererStage(VB& curvb, u32& dwFilterOpts, CRenderTarget* ptextarg, int exactcolor, int context)
@ -1066,7 +1066,7 @@ inline FRAGMENTSHADER* FlushRendererStage(VB& curvb, u32& dwFilterOpts, CRenderT
// set the shaders
SetShaderCaller("FlushRendererStage");
ZZcgSetVertexShader(pvs[2 * ((curvb.curprim._val >> 1) & 3) + 8 * s_bWriteDepth + context]);
ZZshSetVertexShader(pvs[2 * ((curvb.curprim._val >> 1) & 3) + 8 * s_bWriteDepth + context]);
FlushBindProgramm(pfragment, context);
GL_REPORT_ERRORD();
@ -1170,13 +1170,13 @@ inline u32 AlphaRenderAlpha(VB& curvb, const pixTest curtest, FRAGMENTSHADER* pf
v.w *= 255;
}
ZZcgSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
ZZshSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
}
else
{
// not using blending so set to defaults
Vector v = exactcolor ? Vector(1, 510 * 255.0f / 256.0f, 0, 0) : Vector(1, 2 * 255.0f / 256.0f, 0, 0);
ZZcgSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
ZZshSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
}
@ -1267,7 +1267,7 @@ inline void AlphaPabe(VB& curvb, FRAGMENTSHADER* pfragment, int exactcolor)
if (exactcolor) v.y *= 255;
ZZcgSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
ZZshSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
Draw(curvb);
@ -1336,7 +1336,7 @@ inline void AlphaFailureTestJob(VB& curvb, const pixTest curtest, FRAGMENTSHADE
if (exactcolor) { v.y *= 255; v.w *= 255; }
ZZcgSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
ZZshSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
glEnable(GL_BLEND);
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;
ZZcgSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
ZZshSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
Draw(curvb);
@ -1412,7 +1412,7 @@ inline void AlphaSpecialTesting(VB& curvb, FRAGMENTSHADER* pfragment, u32 dwUsin
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
Vector v = Vector(0, exactcolor ? 510.0f : 2.0f, 0, 0);
ZZcgSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
ZZshSetParameter4fv(pfragment->sOneColor, v, "g_fOneColor");
Draw(curvb);
// don't need to restore
@ -1489,7 +1489,7 @@ inline void AlphaColorClamping(VB& curvb, const pixTest curtest)
SetShaderCaller("AlphaColorClamping");
ZZcgSetPixelShader(ppsOne.prog);
ZZshSetPixelShader(ppsOne.prog);
GL_BLEND_RGB(GL_ONE, GL_ONE);
float f;
@ -1497,7 +1497,7 @@ inline void AlphaColorClamping(VB& curvb, const pixTest curtest)
if (bAlphaClamping & 1) // min
{
f = 0;
ZZcgSetParameter4fv(ppsOne.sOneColor, &f, "g_fOneColor");
ZZshSetParameter4fv(ppsOne.sOneColor, &f, "g_fOneColor");
GL_BLENDEQ_RGB(GL_MAX_EXT);
Draw(curvb);
}
@ -1506,7 +1506,7 @@ inline void AlphaColorClamping(VB& curvb, const pixTest curtest)
if (bAlphaClamping & 2) // max
{
f = 1;
ZZcgSetParameter4fv(ppsOne.sOneColor, &f, "g_fOneColor");
ZZshSetParameter4fv(ppsOne.sOneColor, &f, "g_fOneColor");
GL_BLENDEQ_RGB(GL_MIN_EXT);
Draw(curvb);
}
@ -1604,7 +1604,7 @@ void ZeroGS::FlushBoth()
Flush(1);
}
inline void ZeroGS::RenderFBA(const VB& curvb, CGparameter sOneColor)
inline void ZeroGS::RenderFBA(const VB& curvb, ZZshParameter sOneColor)
{
// add fba to all pixels
GL_STENCILFUNC(GL_ALWAYS, STENCIL_FBA, 0xff);
@ -1625,7 +1625,7 @@ inline void ZeroGS::RenderFBA(const VB& curvb, CGparameter sOneColor)
Vector v(1,2,0,0);
ZZcgSetParameter4fv(sOneColor, v, "g_fOneColor");
ZZshSetParameter4fv(sOneColor, v, "g_fOneColor");
Draw(curvb);
@ -1648,7 +1648,7 @@ inline void ZeroGS::RenderFBA(const VB& curvb, CGparameter sOneColor)
GL_ZTEST(curvb.test.zte);
}
__forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColor)
__forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, ZZshParameter sOneColor)
{
if (!g_bUpdateStencil) return;
@ -1664,7 +1664,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo
Vector v(1,2,0,0);
ZZcgSetParameter4fv(sOneColor, v, "g_fOneColor");
ZZshSetParameter4fv(sOneColor, v, "g_fOneColor");
// or a 1 to the stencil buffer wherever alpha passes
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
@ -1688,7 +1688,7 @@ __forceinline void ZeroGS::RenderAlphaTest(const VB& curvb, CGparameter sOneColo
if (curvb.test.ate && curvb.test.atst > 1 && curvb.test.aref > 0x80)
{
v = Vector(1,1,0,0);
ZZcgSetParameter4fv(sOneColor, v, "g_fOneColor");
ZZshSetParameter4fv(sOneColor, v, "g_fOneColor");
glAlphaFunc(g_dwAlphaCmp[curvb.test.atst], AlphaReferedValue(curvb.test.aref));
}
@ -1752,7 +1752,7 @@ inline void ZeroGS::ProcessStencil(const VB& curvb)
SetShaderCaller("ProcessStencil");
ZZcgSetPixelShader(ppsOne.prog);
ZZshSetPixelShader(ppsOne.prog);
Draw(curvb);
// process when alpha >= 0xff
@ -1786,7 +1786,7 @@ inline void ZeroGS::ProcessStencil(const VB& curvb)
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
}
__forceinline void ZeroGS::ProcessFBA(const VB& curvb, CGparameter sOneColor)
__forceinline void ZeroGS::ProcessFBA(const VB& curvb, ZZshParameter sOneColor)
{
if ((curvb.frame.fbm&0x80000000)) return;
@ -1812,8 +1812,8 @@ __forceinline void ZeroGS::ProcessFBA(const VB& curvb, CGparameter sOneColor)
GL_BLENDEQ_ALPHA(GL_FUNC_ADD);
float f = 1;
ZZcgSetParameter4fv(sOneColor, &f, "g_fOneColor");
ZZcgSetPixelShader(ppsOne.prog);
ZZshSetParameter4fv(sOneColor, &f, "g_fOneColor");
ZZshSetPixelShader(ppsOne.prog);
Draw(curvb);
glDisable(GL_ALPHA_TEST);
@ -2070,10 +2070,10 @@ void ZeroGS::SetTexClamping(int context, FRAGMENTSHADER* pfragment)
}
if (pfragment->fTexWrapMode != 0)
ZZcgSetParameter4fv(pfragment->fTexWrapMode, v, "g_fTexWrapMode");
ZZshSetParameter4fv(pfragment->fTexWrapMode, v, "g_fTexWrapMode");
if (pfragment->fClampExts != 0)
ZZcgSetParameter4fv(pfragment->fClampExts, v2, "g_fClampExts");
ZZshSetParameter4fv(pfragment->fClampExts, v2, "g_fClampExts");
}
@ -2246,11 +2246,11 @@ void ZeroGS::SetTexVariables(int context, FRAGMENTSHADER* pfragment)
// Test;*/
ZZcgSetParameter4fv(pfragment->fTexAlpha, valpha, "g_fTexAlpha");
ZZcgSetParameter4fv(pfragment->fTexAlpha2, valpha2, "g_fTexAlpha2");
ZZshSetParameter4fv(pfragment->fTexAlpha, valpha, "g_fTexAlpha");
ZZshSetParameter4fv(pfragment->fTexAlpha2, valpha2, "g_fTexAlpha2");
if (IsAlphaTestExpansion(tex0))
ZZcgSetParameter4fv(pfragment->fTestBlack, vblack, "g_fTestBlack");
ZZshSetParameter4fv(pfragment->fTestBlack, vblack, "g_fTestBlack");
SetTexClamping(context, pfragment);
@ -2296,9 +2296,9 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0,
v.w = 1.0f / (float)fh;
if (pfragment->fRealTexDims)
ZZcgSetParameter4fv(pfragment->fRealTexDims, v, "g_fRealTexDims");
ZZshSetParameter4fv(pfragment->fRealTexDims, v, "g_fRealTexDims");
else
ZZcgSetParameter4fv(cgGetNamedParameter(pfragment->prog,"g_fRealTexDims"),v, "g_fRealTexDims");
ZZshSetParameter4fv(cgGetNamedParameter(pfragment->prog,"g_fRealTexDims"),v, "g_fRealTexDims");
}
if (m_Blocks[tex0.psm].bpp == 0)
@ -2352,11 +2352,11 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0,
v.z *= b.bpp * (1 / 32.0f);
}
ZZcgSetParameter4fv(pfragment->fTexDims, vTexDims, "g_fTexDims");
ZZshSetParameter4fv(pfragment->fTexDims, vTexDims, "g_fTexDims");
// ZZcgSetParameter4fv(pfragment->fTexBlock, b.vTexBlock, "g_fTexBlock"); // I change it, and it's working. Seems casting from Vector to float[4] is ok.
ZZcgSetParameter4fv(pfragment->fTexBlock, &b.vTexBlock.x, "g_fTexBlock");
ZZcgSetParameter4fv(pfragment->fTexOffset, v, "g_fTexOffset");
// ZZshSetParameter4fv(pfragment->fTexBlock, b.vTexBlock, "g_fTexBlock"); // I change it, and it's working. Seems casting from Vector to float[4] is ok.
ZZshSetParameter4fv(pfragment->fTexBlock, &b.vTexBlock.x, "g_fTexBlock");
ZZshSetParameter4fv(pfragment->fTexOffset, v, "g_fTexOffset");
// get hardware texture dims
//int texheight = (pmemtarg->realheight+pmemtarg->widthmult-1)/pmemtarg->widthmult;
@ -2376,7 +2376,7 @@ void ZeroGS::SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0,
v.w = 0.5f;*/
v.w = 0.5f;
ZZcgSetParameter4fv(pfragment->fPageOffset, v, "g_fPageOffset");
ZZshSetParameter4fv(pfragment->fPageOffset, v, "g_fPageOffset");
if (force)
s_ptexCurSet[context] = pmemtarg->ptex->tex;

View File

@ -48,13 +48,13 @@ extern u32 ptexConv32to16;
bool g_bCRTCBilinear = true;
u8* s_lpShaderResources = NULL;
map<int, SHADERHEADER*> mapShaderResources;
CGcontext g_cgcontext;
CGprofile cgvProf, cgfProf;
ZZshContext g_cgcontext;
ZZshProfile cgvProf, cgfProf;
int g_nPixelShaderVer = 0; // default
//------------------ Code
bool ZZcgCheckProfilesSupport() {
bool ZZshCheckProfilesSupport() {
// load the effect, find the best profiles (if any)
if (cgGLIsProfileSupported(CG_PROFILE_ARBVP1) != CG_TRUE) {
ZZLog::Error_Log("arbvp1 not supported.");
@ -68,7 +68,7 @@ bool ZZcgCheckProfilesSupport() {
}
// Error handler. Setup in ZZogl_Create once.
void HandleCgError(CGcontext ctx, CGerror err, void* appdata)
void HandleCgError(ZZshContext ctx, ZZshError err, void* appdata)
{
ZZLog::Error_Log("%s->%s: %s", ShaderCallerName, ShaderHandleName, cgGetErrorString(err));
const char* listing = cgGetLastListing(g_cgcontext);
@ -76,7 +76,7 @@ void HandleCgError(CGcontext ctx, CGerror err, void* appdata)
if (listing != NULL) ZZLog::Debug_Log(" Last listing: %s", listing);
}
bool ZZcgStartUsingShaders() {
bool ZZshStartUsingShaders() {
cgSetErrorHandler(HandleCgError, NULL);
g_cgcontext = cgCreateContext();
@ -130,12 +130,12 @@ bool ZZcgStartUsingShaders() {
}
// Disable CG
void ZZcgGLDisableProfile() {
void ZZshGLDisableProfile() {
cgGLDisableProfile(cgvProf);
cgGLDisableProfile(cgfProf);
}
//Enable CG
void ZZcgGLEnableProfile() {
void ZZshGLEnableProfile() {
cgGLEnableProfile(cgvProf);
cgGLEnableProfile(cgfProf);
}
@ -143,34 +143,34 @@ void ZZcgGLEnableProfile() {
// This is a helper of cgGLSetParameter4fv, made for debugging purposes.
// The name could be any string. We must use it on compilation time, because the erronious handler does not
// return it.
void ZZcgSetParameter4fv(CGparameter param, const float* v, const char* name)
void ZZshSetParameter4fv(ZZshParameter param, const float* v, const char* name)
{
ShaderHandleName = name;
cgGLSetParameter4fv(param, v);
}
// The same function for texture, also to cgGLEnable
void ZZcgGLSetTextureParameter(CGparameter param, GLuint texobj, const char* name) {
void ZZshGLSetTextureParameter(ZZshParameter param, GLuint texobj, const char* name) {
ShaderHandleName = name;
cgGLSetTextureParameter(param, texobj);
cgGLEnableTextureParameter(param);
}
// Used sometimes for color 1.
void ZZcgDefaultOneColor( FRAGMENTSHADER ptr ) {
void ZZshDefaultOneColor( FRAGMENTSHADER ptr ) {
ShaderHandleName = "Set Default One color";
Vector v = Vector ( 1, 1, 1, 1 );
ZZcgSetParameter4fv( ptr.sOneColor, v, "DefaultOne");
ZZshSetParameter4fv( ptr.sOneColor, v, "DefaultOne");
}
void ZZcgSetVertexShader(CGprogram prog) {
void ZZshSetVertexShader(ZZshShader prog) {
if ((prog) != g_vsprog) {
cgGLBindProgram(prog);
g_vsprog = prog;
}
}
void ZZcgSetPixelShader(CGprogram prog) {
void ZZshSetPixelShader(ZZshShader prog) {
if ((prog) != g_psprog) {
cgGLBindProgram(prog);
g_psprog = prog;
@ -234,9 +234,9 @@ void SetupFragmentProgramParameters(FRAGMENTSHADER* pf, int context, int type)
static bool outdated_shaders = false;
void SetupVertexProgramParameters(CGprogram prog, int context)
void SetupVertexProgramParameters(ZZshProgram prog, int context)
{
CGparameter p;
ZZshParameter p;
p = cgGetNamedParameter(prog, "g_fPosXY");

View File

@ -21,10 +21,20 @@
#define __ZEROGS_SHADERS_H__
// I'll need to figure out a way to get rid of this dependency... --arcum42
#include "GS.h"
//#include "GS.h"
#include <Cg/cg.h>
#include <Cg/cgGL.h>
#define ZZshProgram CGprogram
#define ZZshShader CGprogram
#define ZZshShaderLink CGprogram
#define ZZshParameter CGparameter
#define ZZshContext CGcontext
#define ZZshProfile CGprofile
#define ZZshError CGerror
#define pZero 0 // Zero parameter
#define sZero 0 // Zero program
#define NUM_FILTERS 2 // texture filtering
#define NUM_TYPES 5 // types of texture read modes
#define NUM_TEXWRAPS 4 // texture wrapping
@ -87,18 +97,18 @@ struct FRAGMENTSHADER
fTexAlpha2(0), fTexOffset(0), fTexDims(0), fTexBlock(0), fClampExts(0), fTexWrapMode(0),
fRealTexDims(0), fTestBlack(0), fPageOffset(0), fTexAlpha(0) {}
CGprogram prog;
CGparameter sMemory, sFinal, sBitwiseANDX, sBitwiseANDY, sInterlace, sCLUT;
CGparameter sOneColor, sBitBltZ, sInvTexDims;
CGparameter fTexAlpha2, fTexOffset, fTexDims, fTexBlock, fClampExts, fTexWrapMode, fRealTexDims, fTestBlack, fPageOffset, fTexAlpha;
ZZshProgram prog;
ZZshParameter sMemory, sFinal, sBitwiseANDX, sBitwiseANDY, sInterlace, sCLUT;
ZZshParameter sOneColor, sBitBltZ, sInvTexDims;
ZZshParameter fTexAlpha2, fTexOffset, fTexDims, fTexBlock, fClampExts, fTexWrapMode, fRealTexDims, fTestBlack, fPageOffset, fTexAlpha;
#ifdef _DEBUG
string filename;
#endif
void set_uniform_param(CGparameter &var, const char *name)
void set_uniform_param(ZZshParameter &var, const char *name)
{
CGparameter p;
ZZshParameter p;
p = cgGetNamedParameter(prog, name);
if (p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE) var = p;
@ -106,7 +116,7 @@ struct FRAGMENTSHADER
bool set_texture(GLuint texobj, const char *name)
{
CGparameter p;
ZZshParameter p;
p = cgGetNamedParameter(prog, name);
@ -120,9 +130,9 @@ struct FRAGMENTSHADER
return false;
}
bool connect(CGparameter &tex, const char *name)
bool connect(ZZshParameter &tex, const char *name)
{
CGparameter p;
ZZshParameter p;
p = cgGetNamedParameter(prog, name);
@ -135,9 +145,9 @@ struct FRAGMENTSHADER
return false;
}
bool set_texture(CGparameter &tex, const char *name)
bool set_texture(ZZshParameter &tex, const char *name)
{
CGparameter p;
ZZshParameter p;
p = cgGetNamedParameter(prog, name);
@ -153,7 +163,7 @@ struct FRAGMENTSHADER
bool set_shader_const(Vector v, const char *name)
{
CGparameter p;
ZZshParameter p;
p = cgGetNamedParameter(prog, name);
@ -170,20 +180,20 @@ struct FRAGMENTSHADER
struct VERTEXSHADER
{
VERTEXSHADER() : prog(0), sBitBltPos(0), sBitBltTex(0) {}
CGprogram prog;
CGparameter sBitBltPos, sBitBltTex, fBitBltTrans; // vertex shader constants
ZZshProgram prog;
ZZshParameter sBitBltPos, sBitBltTex, fBitBltTrans; // vertex shader constants
};
// ------------------------- Variables -------------------------------
extern u8* s_lpShaderResources;
extern CGprofile cgvProf, cgfProf;
extern ZZshProfile cgvProf, cgfProf;
extern int g_nPixelShaderVer;
extern CGprogram pvs[16];
extern ZZshProgram pvs[16];
extern FRAGMENTSHADER ppsRegular[4], ppsTexture[NUM_SHADERS];
extern FRAGMENTSHADER ppsCRTC[2], ppsCRTC24[2], ppsCRTCTarg[2];
extern CGprogram g_vsprog, g_psprog;
extern CGparameter g_vparamPosXY[2], g_fparamFogColor;
extern ZZshProgram g_vsprog, g_psprog;
extern ZZshParameter g_vparamPosXY[2], g_fparamFogColor;
// ------------------------- Functions -------------------------------
extern const char* ShaderCallerName;
@ -197,15 +207,15 @@ inline void SetHandleName(const char* Name) {
ShaderHandleName = Name;
}
extern bool ZZcgCheckProfilesSupport();
extern bool ZZcgStartUsingShaders();
extern void ZZcgGLDisableProfile();
extern void ZZcgGLEnableProfile();
extern void ZZcgSetParameter4fv(CGparameter param, const float* v, const char* name);
extern void ZZcgGLSetTextureParameter(CGparameter param, GLuint texobj, const char* name);
extern void ZZcgDefaultOneColor( FRAGMENTSHADER ptr );
extern void ZZcgSetVertexShader(CGprogram prog);
extern void ZZcgSetPixelShader(CGprogram prog);
extern bool ZZshCheckProfilesSupport();
extern bool ZZshStartUsingShaders();
extern void ZZshGLDisableProfile();
extern void ZZshGLEnableProfile();
extern void ZZshSetParameter4fv(ZZshParameter param, const float* v, const char* name);
extern void ZZshGLSetTextureParameter(ZZshParameter param, GLuint texobj, const char* name);
extern void ZZshDefaultOneColor( FRAGMENTSHADER ptr );
extern void ZZshSetVertexShader(ZZshShader prog);
extern void ZZshSetPixelShader(ZZshShader prog);
#define SAFE_RELEASE_PROG(x) { if( (x) != NULL ) { cgDestroyProgram(x); x = NULL; } }

View File

@ -40,7 +40,7 @@ static __forceinline int GET_SHADER_INDEX(int type, int texfilter, int texwrap,
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);
}
extern CGcontext g_cgcontext;
extern ZZshContext g_cgcontext;
static __forceinline CGprogram LoadShaderFromType(const char* srcdir, const char* srcfile, int type, int texfilter, int texwrap, int fog, int writedepth, int testaem, int exactcolor, int ps, int context)
{
@ -63,7 +63,7 @@ static __forceinline CGprogram LoadShaderFromType(const char* srcdir, const char
if( ps & SHADER_ACCURATE ) macros.push_back("-DACCURATE_DECOMPRESSION");
macros.push_back(NULL);
CGprogram prog = cgCreateProgramFromFile(g_cgcontext, CG_SOURCE, srcfile, CG_PROFILE_ARBFP1, str, &macros[0]);
ZZshProgram prog = cgCreateProgramFromFile(g_cgcontext, CG_SOURCE, srcfile, CG_PROFILE_ARBFP1, str, &macros[0]);
if( !cgIsProgram(prog) ) {
printf("Failed to load shader %s: \n%s\n", str, cgGetLastListing(g_cgcontext));
return NULL;

View File

@ -127,7 +127,7 @@ inline Vector ZeroGS::CRenderTarget::DefaultBitBltPos()
{
Vector v = Vector(1, -1, 0.5f / (float)RW(fbw), 0.5f / (float)RH(fbh));
v *= 1.0f / 32767.0f;
ZZcgSetParameter4fv(pvsBitBlt.sBitBltPos, v, "g_sBitBltPos");
ZZshSetParameter4fv(pvsBitBlt.sBitBltPos, v, "g_sBitBltPos");
return v;
}
@ -138,7 +138,7 @@ inline Vector ZeroGS::CRenderTarget::DefaultBitBltTex()
// I really sure that -0.5 is correct, because OpenGL have no half-offset
// issue, DirectX known for.
Vector v = Vector(1, -1, 0.5f / (float)RW(fbw), -0.5f / (float)RH(fbh));
ZZcgSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_sBitBltTex");
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_sBitBltTex");
return v;
}
@ -236,11 +236,11 @@ void ZeroGS::CRenderTarget::SetTarget(int fbplocal, const Rect2& scissor, int co
v.y = vposxy.y;
v.z = vposxy.z;
v.w = vposxy.w - dy * 2.0f / (float)fbh;
ZZcgSetParameter4fv(g_vparamPosXY[context], v, "g_fPosXY");
ZZshSetParameter4fv(g_vparamPosXY[context], v, "g_fPosXY");
}
else
{
ZZcgSetParameter4fv(g_vparamPosXY[context], vposxy, "g_fPosXY");
ZZshSetParameter4fv(g_vparamPosXY[context], vposxy, "g_fPosXY");
}
// set render states
@ -433,7 +433,7 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
if (nUpdateTarg)
{
ZZcgGLSetTextureParameter(ppsBaseTexture.sFinal, ittarg->second->ptex, "BaseTexture.final");
ZZshGLSetTextureParameter(ppsBaseTexture.sFinal, ittarg->second->ptex, "BaseTexture.final");
//assert( ittarg->second->fbw == fbw );
int offset = (fbp - ittarg->second->fbp) * 64 / fbw;
@ -446,12 +446,12 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
v.z = 0.25f;
v.w = (float)RH(offset) + 0.25f;
ZZcgSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
// v = DefaultBitBltTex(); Maybe?
ZZcgDefaultOneColor ( ppsBaseTexture );
ZZshDefaultOneColor ( ppsBaseTexture );
ZZcgSetPixelShader(ppsBaseTexture.prog);
ZZshSetPixelShader(ppsBaseTexture.prog);
nUpdateTarg = 0;
}
@ -473,14 +473,14 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
// Fix in r133 -- FFX movies and Gust backgrounds!
//SetTexVariablesInt(0, 0*(s_AAx || s_AAy)?2:0, texframe, false, &ppsBitBlt[!!s_AAx], 1);
SetTexVariablesInt(0, 0, texframe, false, &ppsBitBlt[bit_idx], 1);
ZZcgGLSetTextureParameter(ppsBitBlt[bit_idx].sMemory, vb[0].pmemtarg->ptex->tex, "BitBlt.memory");
ZZshGLSetTextureParameter(ppsBitBlt[bit_idx].sMemory, vb[0].pmemtarg->ptex->tex, "BitBlt.memory");
v = Vector(1, 1, 0.0f, 0.0f);
ZZcgSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
v.x = 1;
v.y = 2;
ZZcgSetParameter4fv(ppsBitBlt[bit_idx].sOneColor, v, "g_fOneColor");
ZZshSetParameter4fv(ppsBitBlt[bit_idx].sOneColor, v, "g_fOneColor");
assert(ptex != 0);
@ -496,10 +496,10 @@ void ZeroGS::CRenderTarget::Update(int context, ZeroGS::CRenderTarget* pdepth)
// render with an AA shader if possible (bilinearly interpolates data)
//cgGLLoadProgram(ppsBitBlt[bit_idx].prog);
ZZcgSetPixelShader(ppsBitBlt[bit_idx].prog);
ZZshSetPixelShader(ppsBitBlt[bit_idx].prog);
}
ZZcgSetVertexShader(pvsBitBlt.prog);
ZZshSetVertexShader(pvsBitBlt.prog);
DrawTriangleArray();
@ -544,22 +544,22 @@ void ZeroGS::CRenderTarget::ConvertTo32()
v.y = (float)RH(16);
v.z = -(float)RW(fbw);
v.w = (float)RH(8);
ZZcgSetParameter4fv(ppsConvert16to32.fTexOffset, v, "g_fTexOffset");
ZZshSetParameter4fv(ppsConvert16to32.fTexOffset, v, "g_fTexOffset");
v.x = (float)RW(8);
v.y = 0;
v.z = 0;
v.w = 0.25f;
ZZcgSetParameter4fv(ppsConvert16to32.fPageOffset, v, "g_fPageOffset");
ZZshSetParameter4fv(ppsConvert16to32.fPageOffset, v, "g_fPageOffset");
v.x = (float)RW(2 * fbw);
v.y = (float)RH(fbh);
v.z = 0;
v.w = 0.0001f * (float)RH(fbh);
ZZcgSetParameter4fv(ppsConvert16to32.fTexDims, v, "g_fTexDims");
ZZshSetParameter4fv(ppsConvert16to32.fTexDims, v, "g_fTexDims");
// v.x = 0;
// ZZcgSetParameter4fv(ppsConvert16to32.fTexBlock, v, "g_fTexBlock");
// ZZshSetParameter4fv(ppsConvert16to32.fTexBlock, v, "g_fTexBlock");
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
SET_STREAM();
@ -569,7 +569,7 @@ void ZeroGS::CRenderTarget::ConvertTo32()
ZeroGS::ResetRenderTarget(1);
BindToSample(&ptex);
ZZcgGLSetTextureParameter(ppsConvert16to32.sFinal, ptex, "Convert 16 to 32.Final");
ZZshGLSetTextureParameter(ppsConvert16to32.sFinal, ptex, "Convert 16 to 32.Final");
fbh /= 2; // have 16 bit surfaces are usually 2x higher
SetViewport();
@ -577,8 +577,8 @@ void ZeroGS::CRenderTarget::ConvertTo32()
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// render with an AA shader if possible (bilinearly interpolates data)
ZZcgSetVertexShader(pvsBitBlt.prog);
ZZcgSetPixelShader(ppsConvert16to32.prog);
ZZshSetVertexShader(pvsBitBlt.prog);
ZZshSetPixelShader(ppsConvert16to32.prog);
DrawTriangleArray();
#ifdef _DEBUG
@ -648,19 +648,19 @@ void ZeroGS::CRenderTarget::ConvertTo16()
v.y = 8.0f / (float)fbh;
v.z = 0.5f * v.x;
v.w = 0.5f * v.y;
ZZcgSetParameter4fv(ppsConvert32to16.fTexOffset, v, "g_fTexOffset");
ZZshSetParameter4fv(ppsConvert32to16.fTexOffset, v, "g_fTexOffset");
v.x = 256.0f / 255.0f;
v.y = 256.0f / 255.0f;
v.z = 0.05f / 256.0f;
v.w = -0.001f / 256.0f;
ZZcgSetParameter4fv(ppsConvert32to16.fPageOffset, v, "g_fPageOffset");
ZZshSetParameter4fv(ppsConvert32to16.fPageOffset, v, "g_fPageOffset");
v.x = (float)RW(fbw);
v.y = (float)RH(2 * fbh);
v.z = 0;
v.w = -0.1f / RH(fbh);
ZZcgSetParameter4fv(ppsConvert32to16.fTexDims, v, "g_fTexDims");
ZZshSetParameter4fv(ppsConvert32to16.fTexDims, v, "g_fTexDims");
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
SET_STREAM();
@ -672,7 +672,7 @@ void ZeroGS::CRenderTarget::ConvertTo16()
BindToSample(&ptex);
ZZcgGLSetTextureParameter(ppsConvert32to16.sFinal, ptex, "Convert 32 to 16");
ZZshGLSetTextureParameter(ppsConvert32to16.sFinal, ptex, "Convert 32 to 16");
// fbh *= 2; // have 16 bit surfaces are usually 2x higher
@ -681,8 +681,8 @@ void ZeroGS::CRenderTarget::ConvertTo16()
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// render with an AA shader if possible (bilinearly interpolates data)
ZZcgSetVertexShader(pvsBitBlt.prog);
ZZcgSetPixelShader(ppsConvert32to16.prog);
ZZshSetVertexShader(pvsBitBlt.prog);
ZZshSetPixelShader(ppsConvert32to16.prog);
DrawTriangleArray();
#ifdef _DEBUG
@ -751,7 +751,7 @@ void ZeroGS::CRenderTarget::_CreateFeedback()
// tex coords, test ffx bikanel island when changing these
/* Vector v = DefaultBitBltPos();
v = Vector ((float)(RW(fbw+4)), (float)(RH(fbh+4)), +0.25f, -0.25f);
ZZcgSetParameter4fv(pvsBitBlt.sBitBltTex, v, "BitBltTex");*/
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "BitBltTex");*/
// tex coords, test ffx bikanel island when changing these
@ -764,8 +764,8 @@ void ZeroGS::CRenderTarget::_CreateFeedback()
v.y = (float)(RH(fbh));
v.z = 0.0f;
v.w = 0.0f;
ZZcgSetParameter4fv(pvsBitBlt.sBitBltTex, v, "BitBlt.Feedback");
ZZcgDefaultOneColor(ppsBaseTexture);
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "BitBlt.Feedback");
ZZshDefaultOneColor(ppsBaseTexture);
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
SET_STREAM();
@ -774,15 +774,15 @@ void ZeroGS::CRenderTarget::_CreateFeedback()
glBindTexture(GL_TEXTURE_RECTANGLE_NV, ptex);
GL_REPORT_ERRORD();
ZZcgGLSetTextureParameter(ppsBaseTexture.sFinal, ptex, "BaseTexture.Feedback");
ZZshGLSetTextureParameter(ppsBaseTexture.sFinal, ptex, "BaseTexture.Feedback");
SetViewport();
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// render with an AA shader if possible (bilinearly interpolates data)
ZZcgSetVertexShader(pvsBitBlt.prog);
ZZcgSetPixelShader(ppsBaseTexture.prog);
ZZshSetVertexShader(pvsBitBlt.prog);
ZZshSetPixelShader(ppsBaseTexture.prog);
DrawTriangleArray();
// restore
@ -977,7 +977,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
// write color and zero out stencil buf, always 0 context!
SetTexVariablesInt(0, 0, texframe, false, &ppsBitBltDepth, 1);
ZZcgGLSetTextureParameter(ppsBitBltDepth.sMemory, vb[0].pmemtarg->ptex->tex, "BitBltDepth");
ZZshGLSetTextureParameter(ppsBitBltDepth.sMemory, vb[0].pmemtarg->ptex->tex, "BitBltDepth");
Vector v = DefaultBitBltPos();
@ -987,7 +987,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
v.y = 2;
v.z = PSMT_IS16Z(psm) ? 1.0f : 0.0f;
v.w = g_filog32;
ZZcgSetParameter4fv(ppsBitBltDepth.sOneColor, v, "g_fOneColor");
ZZshSetParameter4fv(ppsBitBltDepth.sOneColor, v, "g_fOneColor");
Vector vdepth = g_vdepth;
@ -1002,7 +1002,7 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
assert(ppsBitBltDepth.sBitBltZ != 0);
ZZcgSetParameter4fv(ppsBitBltDepth.sBitBltZ, ((255.0f / 256.0f)*vdepth), "g_fBitBltZ");
ZZshSetParameter4fv(ppsBitBltDepth.sBitBltZ, ((255.0f / 256.0f)*vdepth), "g_fBitBltZ");
assert(pdepth != 0);
//GLint w1 = 0;
@ -1027,8 +1027,8 @@ void ZeroGS::CDepthTarget::Update(int context, ZeroGS::CRenderTarget* prndr)
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
SET_STREAM();
ZZcgSetVertexShader(pvsBitBlt.prog);
ZZcgSetPixelShader(ppsBitBltDepth.prog);
ZZshSetVertexShader(pvsBitBlt.prog);
ZZshSetPixelShader(ppsBitBltDepth.prog);
DrawTriangleArray();

View File

@ -51,7 +51,7 @@ extern int g_nFrame, g_nRealFrame;
//-------------------------- Variables
primInfo *prim;
CGprogram g_vsprog = 0, g_psprog = 0; // 2 -- ZZ
ZZshProgram g_vsprog = 0, g_psprog = 0; // 2 -- ZZ
inline u32 FtoDW(float f) { return (*((u32*)&f)); }
@ -82,7 +82,7 @@ PFNGLDRAWBUFFERSPROC glDrawBuffers = NULL;
/////////////////////
// graphics resources
CGparameter g_vparamPosXY[2] = {0}, g_fparamFogColor = 0;
ZZshParameter g_vparamPosXY[2] = {0}, g_fparamFogColor = 0;
bool s_bTexFlush = false;
int s_nLastResolveReset = 0;
@ -340,7 +340,7 @@ extern RasterFont* font_p;
void ZeroGS::DrawText(const char* pstr, int left, int top, u32 color)
{
FUNCLOG
ZZcgGLDisableProfile();
ZZshGLDisableProfile();
Vector v;
v.SetColor(color);
@ -348,7 +348,7 @@ void ZeroGS::DrawText(const char* pstr, int left, int top, u32 color)
//glColor3f(((color >> 16) & 0xff) / 255.0f, ((color >> 8) & 0xff)/ 255.0f, (color & 0xff) / 255.0f);
font_p->printString(pstr, left * 2.0f / (float)nBackbufferWidth - 1, 1 - top * 2.0f / (float)nBackbufferHeight, 0);
ZZcgGLEnableProfile();
ZZshGLEnableProfile();
}
void ZeroGS::ChangeWindowSize(int nNewWidth, int nNewHeight)
@ -481,14 +481,6 @@ void ZeroGS::Prim()
if (curvb.CheckPrim()) Flush(prim->ctxt);
curvb.curprim._val = prim->_val;
// flush the other pipe if sharing the same buffer
// if( vb[prim->ctxt].gsfb.fbp == vb[!prim->ctxt].gsfb.fbp && vb[!prim->ctxt].nCount > 0 )
// {
// assert( vb[prim->ctxt].nCount == 0 );
// Flush(!prim->ctxt);
// }
curvb.curprim.prim = prim->prim;
}
@ -525,31 +517,32 @@ void ZeroGS::RenderCustom(float fAlpha)
DisableAllgl() ;
SetShaderCaller("RenderCustom");
glViewport(0, 0, nBackbufferWidth, nBackbufferHeight);
//glViewport(0, 0, nBackbufferWidth, nBackbufferHeight);
glViewport(0, 0, conf.width, conf.height);
// play custom animation
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
// tex coords
Vector v = Vector(1 / 32767.0f, 1 / 32767.0f, 0, 0);
ZZcgSetParameter4fv(pvsBitBlt.sBitBltPos, v, "g_fBitBltPos");
ZZshSetParameter4fv(pvsBitBlt.sBitBltPos, v, "g_fBitBltPos");
v.x = (float)nLogoWidth;
v.y = (float)nLogoHeight;
ZZcgSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
ZZshSetParameter4fv(pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
v.x = v.y = v.z = v.w = fAlpha;
ZZcgSetParameter4fv(ppsBaseTexture.sOneColor, v, "g_fOneColor");
ZZshSetParameter4fv(ppsBaseTexture.sOneColor, v, "g_fOneColor");
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// inside vhDCb[0]'s target area, so render that region only
ZZcgGLSetTextureParameter(ppsBaseTexture.sFinal, ptexLogo, "Logo");
ZZshGLSetTextureParameter(ppsBaseTexture.sFinal, ptexLogo, "Logo");
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
SET_STREAM();
ZZcgSetVertexShader(pvsBitBlt.prog);
ZZcgSetPixelShader(ppsBaseTexture.prog);
ZZshSetVertexShader(pvsBitBlt.prog);
ZZshSetPixelShader(ppsBaseTexture.prog);
DrawTriangleArray();
// restore
@ -826,11 +819,8 @@ void ZeroGS::SetFogColor(u32 fog)
Vector v;
// set it immediately
// v.x = (gs.fogcol & 0xff) / 255.0f;
// v.y = ((gs.fogcol >> 8) & 0xff) / 255.0f;
// v.z = ((gs.fogcol >> 16) & 0xff) / 255.0f;
v.SetColor(gs.fogcol);
ZZcgSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor");
ZZshSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor");
// }
}
@ -845,7 +835,7 @@ void ZeroGS::SetFogColor(GIFRegFOGCOL* fog)
v.x = fog->FCR / 255.0f;
v.y = fog->FCG / 255.0f;
v.z = fog->FCB / 255.0f;
ZZcgSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor");
ZZshSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor");
}
void ZeroGS::ExtWrite()

View File

@ -34,7 +34,6 @@
#include "GS.h"
#include "CRC.h"
#include "rasterfont.h" // simple font
//#include "ZeroGSShaders/zerogsshaders.h"
using namespace std;