mirror of https://github.com/PCSX2/pcsx2.git
GregMiscellaneous: zzogl-pg: Continuing to work on zerogs.cpp and zerogs.h.
git-svn-id: http://pcsx2.googlecode.com/svn/branches/GregMiscellaneous@3960 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
4171a67c4d
commit
c544ec7ca6
|
@ -31,8 +31,6 @@ using namespace std;
|
||||||
|
|
||||||
extern float fFPS;
|
extern float fFPS;
|
||||||
|
|
||||||
#define MEMORY_END 0x00400000
|
|
||||||
|
|
||||||
extern int g_LastCRC;
|
extern int g_LastCRC;
|
||||||
|
|
||||||
struct Vector_16F
|
struct Vector_16F
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
#ifndef HOSTMEMORY_H_INCLUDED
|
#ifndef HOSTMEMORY_H_INCLUDED
|
||||||
#define HOSTMEMORY_H_INCLUDED
|
#define HOSTMEMORY_H_INCLUDED
|
||||||
|
|
||||||
|
#include "GLWin.h"
|
||||||
|
|
||||||
|
#define MEMORY_END 0x00400000
|
||||||
|
|
||||||
extern int GPU_TEXWIDTH;
|
extern int GPU_TEXWIDTH;
|
||||||
|
|
||||||
extern u8* g_pBasePS2Mem;
|
extern u8* g_pBasePS2Mem;
|
||||||
|
@ -47,6 +51,32 @@ class GSClut
|
||||||
u8* get_raw(u32 addr);
|
u8* get_raw(u32 addr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ZeroGSInit
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
ZeroGSInit()
|
||||||
|
{
|
||||||
|
const u32 mem_size = MEMORY_END + 0x10000; // leave some room for out of range accesses (saves on the checks)
|
||||||
|
// clear
|
||||||
|
g_pbyGSMemory = (u8*)_aligned_malloc(mem_size, 1024);
|
||||||
|
memset(g_pbyGSMemory, 0, mem_size);
|
||||||
|
|
||||||
|
g_pbyGSClut = (u8*)_aligned_malloc(256 * 8, 1024); // need 512 alignment!
|
||||||
|
memset(g_pbyGSClut, 0, 256*8);
|
||||||
|
memset(&GLWin, 0, sizeof(GLWin));
|
||||||
|
}
|
||||||
|
|
||||||
|
~ZeroGSInit()
|
||||||
|
{
|
||||||
|
_aligned_free(g_pbyGSMemory);
|
||||||
|
g_pbyGSMemory = NULL;
|
||||||
|
|
||||||
|
_aligned_free(g_pbyGSClut);
|
||||||
|
g_pbyGSClut = NULL;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// The size in bytes of x strings (of texture).
|
// The size in bytes of x strings (of texture).
|
||||||
inline int MemorySize(int x)
|
inline int MemorySize(int x)
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,8 +78,6 @@ extern u32 s_stencilfunc, s_stencilref, s_stencilmask;
|
||||||
// global alpha blending settings
|
// global alpha blending settings
|
||||||
extern GLenum g_internalRGBAFloat16Fmt;
|
extern GLenum g_internalRGBAFloat16Fmt;
|
||||||
|
|
||||||
extern const GLenum primtype[8];
|
|
||||||
|
|
||||||
#define SAFE_RELEASE_TEX(x) { if( (x) != 0 ) { glDeleteTextures(1, &(x)); x = 0; } }
|
#define SAFE_RELEASE_TEX(x) { if( (x) != 0 ) { glDeleteTextures(1, &(x)); x = 0; } }
|
||||||
|
|
||||||
// inline for an extremely often used sequence
|
// inline for an extremely often used sequence
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
const u32 g_primmult[8] = { 1, 2, 2, 3, 3, 3, 2, 0xff };
|
const u32 g_primmult[8] = { 1, 2, 2, 3, 3, 3, 2, 0xff };
|
||||||
const u32 g_primsub[8] = { 1, 2, 1, 3, 1, 1, 2, 0 };
|
const u32 g_primsub[8] = { 1, 2, 1, 3, 1, 1, 2, 0 };
|
||||||
|
|
||||||
|
const GLenum primtype[8] = { GL_POINTS, GL_LINES, GL_LINES, GL_TRIANGLES, GL_TRIANGLES, GL_TRIANGLES, GL_TRIANGLES, 0xffffffff };
|
||||||
|
|
||||||
extern float fiTexWidth[2], fiTexHeight[2]; // current tex width and height
|
extern float fiTexWidth[2], fiTexHeight[2]; // current tex width and height
|
||||||
|
|
||||||
DrawFn drawfn[8] = { KickDummy, KickDummy, KickDummy, KickDummy,
|
DrawFn drawfn[8] = { KickDummy, KickDummy, KickDummy, KickDummy,
|
||||||
|
@ -54,6 +56,20 @@ void clear_drawfn()
|
||||||
drawfn[7] = KickDummy;
|
drawfn[7] = KickDummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Still thinking about the best place to put this.
|
||||||
|
// called on a primitive switch
|
||||||
|
void Prim()
|
||||||
|
{
|
||||||
|
FUNCLOG
|
||||||
|
|
||||||
|
VB& curvb = vb[prim->ctxt];
|
||||||
|
|
||||||
|
if (curvb.CheckPrim()) Flush(prim->ctxt);
|
||||||
|
|
||||||
|
curvb.curprim._val = prim->_val;
|
||||||
|
curvb.curprim.prim = prim->prim;
|
||||||
|
}
|
||||||
|
|
||||||
__forceinline void MOVZ(VertexGPU *p, u32 gsz, const VB& curvb)
|
__forceinline void MOVZ(VertexGPU *p, u32 gsz, const VB& curvb)
|
||||||
{
|
{
|
||||||
p->z = (curvb.zprimmask == 0xffff) ? min((u32)0xffff, gsz) : gsz;
|
p->z = (curvb.zprimmask == 0xffff) ? min((u32)0xffff, gsz) : gsz;
|
||||||
|
|
|
@ -222,7 +222,6 @@ void SetContextTarget(int context);
|
||||||
void SetWriteDepth();
|
void SetWriteDepth();
|
||||||
bool IsWriteDepth();
|
bool IsWriteDepth();
|
||||||
void SetDestAlphaTest();
|
void SetDestAlphaTest();
|
||||||
void ResetRenderTarget(int index);
|
|
||||||
|
|
||||||
//------------------ Code
|
//------------------ Code
|
||||||
|
|
||||||
|
@ -1087,6 +1086,8 @@ inline void AlphaSetStencil(bool DoIt)
|
||||||
else glDisable(GL_STENCIL_TEST);
|
else glDisable(GL_STENCIL_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//inline u32 FtoDW(float f) { return (*((u32*)&f)); }
|
||||||
|
|
||||||
inline void AlphaSetDepthTest(VB& curvb, const pixTest curtest, FRAGMENTSHADER* pfragment)
|
inline void AlphaSetDepthTest(VB& curvb, const pixTest curtest, FRAGMENTSHADER* pfragment)
|
||||||
{
|
{
|
||||||
glDepthMask(!curvb.zbuf.zmsk && curtest.zte);
|
glDepthMask(!curvb.zbuf.zmsk && curtest.zte);
|
||||||
|
|
|
@ -69,7 +69,10 @@ extern HINSTANCE hInst;
|
||||||
// Used in a logarithmic Z-test, as (1-o(1))/log(MAX_U32).
|
// Used in a logarithmic Z-test, as (1-o(1))/log(MAX_U32).
|
||||||
const float g_filog32 = 0.999f / (32.0f * logf(2.0f));
|
const float g_filog32 = 0.999f / (32.0f * logf(2.0f));
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
const static char* g_pTexTypes[] = { "32", "tex32", "clut32", "tex32to16", "tex16to8h" };
|
const static char* g_pTexTypes[] = { "32", "tex32", "clut32", "tex32to16", "tex16to8h" };
|
||||||
|
#endif
|
||||||
|
const char* g_pShaders[4] = { "full", "reduced", "accurate", "accurate-reduced" };
|
||||||
|
|
||||||
// ----------------- Global Variables
|
// ----------------- Global Variables
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
#include "GS.h"
|
#include "GS.h"
|
||||||
|
|
||||||
// For output
|
// For output
|
||||||
const static char* g_pShaders[] = { "full", "reduced", "accurate", "accurate-reduced" };
|
|
||||||
|
|
||||||
#define NVIDIA_CG_API
|
#define NVIDIA_CG_API
|
||||||
// --------------------------- API abstraction level --------------------------------
|
// --------------------------- API abstraction level --------------------------------
|
||||||
|
|
||||||
|
@ -58,7 +56,7 @@ 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 };
|
||||||
|
|
||||||
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 don't need to wory about incompatible shaders
|
// We have "compatible" shaders, as RegularFogVS and RegularFogPS. if don't need to wory about incompatible shaders
|
||||||
|
|
|
@ -63,7 +63,6 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
|
||||||
void SetWriteDepth();
|
void SetWriteDepth();
|
||||||
bool IsWriteDepth();
|
bool IsWriteDepth();
|
||||||
bool IsWriteDestAlphaTest();
|
bool IsWriteDestAlphaTest();
|
||||||
void ResetRenderTarget(int index);
|
|
||||||
|
|
||||||
// ------------------------- Useful inlines ------------------------------------
|
// ------------------------- Useful inlines ------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -226,6 +226,7 @@ class CMemoryTarget
|
||||||
int clutsize; // size of the clut array. 0 otherwise
|
int clutsize; // size of the clut array. 0 otherwise
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern const GLenum primtype[8];
|
||||||
|
|
||||||
struct VB
|
struct VB
|
||||||
{
|
{
|
||||||
|
@ -522,6 +523,7 @@ class CRangeManager
|
||||||
extern CRenderTargetMngr s_RTs, s_DepthRTs;
|
extern CRenderTargetMngr s_RTs, s_DepthRTs;
|
||||||
extern CBitwiseTextureMngr s_BitwiseTextures;
|
extern CBitwiseTextureMngr s_BitwiseTextures;
|
||||||
extern CMemoryTargetMngr g_MemTargs;
|
extern CMemoryTargetMngr g_MemTargs;
|
||||||
|
extern CRangeManager s_RangeMngr; // manages overwritten memory
|
||||||
|
|
||||||
//extern u8 s_AAx, s_AAy;
|
//extern u8 s_AAx, s_AAy;
|
||||||
extern Point AA;
|
extern Point AA;
|
||||||
|
@ -634,6 +636,11 @@ static __forceinline void FBTexture(int attach, int id = 0)
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __forceinline void ResetRenderTarget(int index)
|
||||||
|
{
|
||||||
|
FBTexture(index);
|
||||||
|
}
|
||||||
|
|
||||||
static __forceinline void Texture2D(GLint iFormat, GLint width, GLint height, GLenum format, GLenum type, const GLvoid* pixels)
|
static __forceinline void Texture2D(GLint iFormat, GLint width, GLint height, GLenum format, GLenum type, const GLvoid* pixels)
|
||||||
{
|
{
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, iFormat, width, height, 0, format, type, pixels);
|
glTexImage2D(GL_TEXTURE_2D, 0, iFormat, width, height, 0, format, type, pixels);
|
||||||
|
@ -710,7 +717,6 @@ static __forceinline void setRectWrap2(GLint type)
|
||||||
// VB variables
|
// VB variables
|
||||||
extern VB vb[2];
|
extern VB vb[2];
|
||||||
|
|
||||||
|
|
||||||
//------------------------ Inlines -------------------------
|
//------------------------ Inlines -------------------------
|
||||||
|
|
||||||
// Calculate maximum height for target
|
// Calculate maximum height for target
|
||||||
|
|
|
@ -18,65 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//-------------------------- Includes
|
//-------------------------- Includes
|
||||||
#if defined(_WIN32)
|
|
||||||
# include <windows.h>
|
|
||||||
# include "resource.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "GS.h"
|
|
||||||
#include "Mem.h"
|
|
||||||
#include "x86.h"
|
|
||||||
#include "zerogs.h"
|
#include "zerogs.h"
|
||||||
#include "targets.h"
|
|
||||||
#include "GLWin.h"
|
|
||||||
#include "ZZoglShaders.h"
|
|
||||||
#include "ZZKick.h"
|
|
||||||
#include "ZZClut.h"
|
|
||||||
|
|
||||||
//----------------------- Defines
|
|
||||||
|
|
||||||
//-------------------------- Typedefs
|
|
||||||
typedef void (APIENTRYP _PFNSWAPINTERVAL)(int);
|
|
||||||
|
|
||||||
//-------------------------- Extern variables
|
|
||||||
|
|
||||||
extern u32 g_nGenVars, g_nTexVars, g_nAlphaVars, g_nResolve;
|
|
||||||
extern char *libraryName;
|
|
||||||
extern int g_nFrame, g_nRealFrame;
|
|
||||||
|
|
||||||
//extern int s_nFullscreen;
|
|
||||||
//-------------------------- Variables
|
|
||||||
|
|
||||||
primInfo *prim;
|
|
||||||
|
|
||||||
inline u32 FtoDW(float f) { return (*((u32*)&f)); }
|
|
||||||
|
|
||||||
int g_nDepthUpdateCount = 0;
|
|
||||||
|
|
||||||
// Consts
|
|
||||||
const GLenum primtype[8] = { GL_POINTS, GL_LINES, GL_LINES, GL_TRIANGLES, GL_TRIANGLES, GL_TRIANGLES, GL_TRIANGLES, 0xffffffff };
|
|
||||||
static const int PRIMMASK = 0x0e; // for now ignore 0x10 (AA)
|
|
||||||
|
|
||||||
PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT = NULL;
|
|
||||||
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL;
|
|
||||||
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL;
|
|
||||||
PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT = NULL;
|
|
||||||
PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT = NULL;
|
|
||||||
PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT = NULL;
|
|
||||||
PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT = NULL;
|
|
||||||
PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT = NULL;
|
|
||||||
PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT = NULL;
|
|
||||||
PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT = NULL;
|
|
||||||
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT = NULL;
|
|
||||||
PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT = NULL;
|
|
||||||
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT = NULL;
|
|
||||||
PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT = NULL;
|
|
||||||
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = NULL;
|
|
||||||
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL;
|
|
||||||
PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL;
|
|
||||||
PFNGLDRAWBUFFERSPROC glDrawBuffers = NULL;
|
|
||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// graphics resources
|
// graphics resources
|
||||||
|
@ -84,70 +26,17 @@ PFNGLDRAWBUFFERSPROC glDrawBuffers = NULL;
|
||||||
bool s_bTexFlush = false;
|
bool s_bTexFlush = false;
|
||||||
int s_nLastResolveReset = 0;
|
int s_nLastResolveReset = 0;
|
||||||
int s_nResolveCounts[30] = {0}; // resolve counts for last 30 frames
|
int s_nResolveCounts[30] = {0}; // resolve counts for last 30 frames
|
||||||
|
|
||||||
////////////////////
|
|
||||||
// State parameters
|
|
||||||
int nBackbufferWidth, nBackbufferHeight; // ZZ
|
|
||||||
|
|
||||||
// = 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);
|
|
||||||
|
|
||||||
extern CRangeManager s_RangeMngr; // manages overwritten memory
|
|
||||||
|
|
||||||
int s_nNewWidth = -1, s_nNewHeight = -1;
|
int s_nNewWidth = -1, s_nNewHeight = -1;
|
||||||
|
|
||||||
void ProcessMessages();
|
primInfo *prim;
|
||||||
void RenderCustom(float fAlpha); // intro anim
|
////////////////////
|
||||||
|
// State parameters
|
||||||
bool ZZCreate(int width, int height);
|
int nBackbufferWidth, nBackbufferHeight;
|
||||||
|
int g_nDepthUpdateCount = 0;
|
||||||
///////////////////////
|
|
||||||
// Method Prototypes //
|
|
||||||
///////////////////////
|
|
||||||
|
|
||||||
void ResolveInRange(int start, int end);
|
|
||||||
|
|
||||||
void ExtWrite();
|
|
||||||
extern GLuint vboRect;
|
|
||||||
|
|
||||||
void ResetRenderTarget(int index)
|
|
||||||
{
|
|
||||||
FBTexture(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
// does one time only initializing/destruction
|
|
||||||
|
|
||||||
class ZeroGSInit
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
ZeroGSInit()
|
|
||||||
{
|
|
||||||
const u32 mem_size = MEMORY_END + 0x10000; // leave some room for out of range accesses (saves on the checks)
|
|
||||||
// clear
|
|
||||||
g_pbyGSMemory = (u8*)_aligned_malloc(mem_size, 1024);
|
|
||||||
memset(g_pbyGSMemory, 0, mem_size);
|
|
||||||
|
|
||||||
g_pbyGSClut = (u8*)_aligned_malloc(256 * 8, 1024); // need 512 alignment!
|
|
||||||
memset(g_pbyGSClut, 0, 256*8);
|
|
||||||
memset(&GLWin, 0, sizeof(GLWin));
|
|
||||||
}
|
|
||||||
|
|
||||||
~ZeroGSInit()
|
|
||||||
{
|
|
||||||
_aligned_free(g_pbyGSMemory);
|
|
||||||
g_pbyGSMemory = NULL;
|
|
||||||
|
|
||||||
_aligned_free(g_pbyGSClut);
|
|
||||||
g_pbyGSClut = NULL;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static ZeroGSInit s_ZeroGSInit;
|
static ZeroGSInit s_ZeroGSInit;
|
||||||
|
|
||||||
#ifndef GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT
|
// does one time only initializing/destruction
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void HandleGLError()
|
void HandleGLError()
|
||||||
{
|
{
|
||||||
|
@ -328,113 +217,97 @@ void SetAA(int mode)
|
||||||
glPointSize(f);
|
glPointSize(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Prim()
|
//void RenderCustom(float fAlpha)
|
||||||
{
|
//{
|
||||||
FUNCLOG
|
// FUNCLOG
|
||||||
|
// GL_REPORT_ERROR();
|
||||||
VB& curvb = vb[prim->ctxt];
|
//
|
||||||
|
// fAlpha = 1;
|
||||||
if (curvb.CheckPrim()) Flush(prim->ctxt);
|
// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); // switch to the backbuffer
|
||||||
|
//
|
||||||
curvb.curprim._val = prim->_val;
|
// DisableAllgl() ;
|
||||||
curvb.curprim.prim = prim->prim;
|
// SetShaderCaller("RenderCustom");
|
||||||
}
|
//
|
||||||
|
// glViewport(0, 0, nBackbufferWidth, nBackbufferHeight);
|
||||||
extern u32 ptexLogo;
|
//
|
||||||
extern int nLogoWidth, nLogoHeight;
|
// // play custom animation
|
||||||
|
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
void RenderCustom(float fAlpha)
|
//
|
||||||
{
|
// // tex coords
|
||||||
FUNCLOG
|
// float4 v = float4(1 / 32767.0f, 1 / 32767.0f, 0, 0);
|
||||||
GL_REPORT_ERROR();
|
// ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltPos, v, "g_fBitBltPos");
|
||||||
|
// v.x = (float)nLogoWidth;
|
||||||
fAlpha = 1;
|
// v.y = (float)nLogoHeight;
|
||||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); // switch to the backbuffer
|
// ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
|
||||||
|
//
|
||||||
DisableAllgl() ;
|
// v.x = v.y = v.z = v.w = fAlpha;
|
||||||
SetShaderCaller("RenderCustom");
|
// ZZshSetParameter4fv(ppsBaseTexture.prog, ppsBaseTexture.sOneColor, v, "g_fOneColor");
|
||||||
|
//
|
||||||
glViewport(0, 0, nBackbufferWidth, nBackbufferHeight);
|
// if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
|
//
|
||||||
// play custom animation
|
// // inside vhDCb[0]'s target area, so render that region only
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
// ZZshGLSetTextureParameter(ppsBaseTexture.prog, ppsBaseTexture.sFinal, ptexLogo, "Logo");
|
||||||
|
// glBindBuffer(GL_ARRAY_BUFFER, vboRect);
|
||||||
// tex coords
|
//
|
||||||
float4 v = float4(1 / 32767.0f, 1 / 32767.0f, 0, 0);
|
// SET_STREAM();
|
||||||
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltPos, v, "g_fBitBltPos");
|
//
|
||||||
v.x = (float)nLogoWidth;
|
// ZZshSetVertexShader(pvsBitBlt.prog);
|
||||||
v.y = (float)nLogoHeight;
|
// ZZshSetPixelShader(ppsBaseTexture.prog);
|
||||||
ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltTex, v, "g_fBitBltTex");
|
// DrawTriangleArray();
|
||||||
|
//
|
||||||
v.x = v.y = v.z = v.w = fAlpha;
|
// // restore
|
||||||
ZZshSetParameter4fv(ppsBaseTexture.prog, ppsBaseTexture.sOneColor, v, "g_fOneColor");
|
// if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||||
|
//
|
||||||
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
// ProcessMessages();
|
||||||
|
//
|
||||||
// inside vhDCb[0]'s target area, so render that region only
|
// GLWin.SwapGLBuffers();
|
||||||
ZZshGLSetTextureParameter(ppsBaseTexture.prog, ppsBaseTexture.sFinal, ptexLogo, "Logo");
|
//
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vboRect);
|
// glEnable(GL_SCISSOR_TEST);
|
||||||
|
// glEnable(GL_STENCIL_TEST);
|
||||||
SET_STREAM();
|
//
|
||||||
|
// vb[0].bSyncVars = 0;
|
||||||
ZZshSetVertexShader(pvsBitBlt.prog);
|
// vb[1].bSyncVars = 0;
|
||||||
ZZshSetPixelShader(ppsBaseTexture.prog);
|
//
|
||||||
DrawTriangleArray();
|
// GL_REPORT_ERROR();
|
||||||
|
//}
|
||||||
// restore
|
|
||||||
if (conf.wireframe()) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
|
||||||
|
|
||||||
ProcessMessages();
|
|
||||||
|
|
||||||
GLWin.SwapGLBuffers();
|
|
||||||
|
|
||||||
glEnable(GL_SCISSOR_TEST);
|
|
||||||
glEnable(GL_STENCIL_TEST);
|
|
||||||
|
|
||||||
vb[0].bSyncVars = 0;
|
|
||||||
vb[1].bSyncVars = 0;
|
|
||||||
|
|
||||||
GL_REPORT_ERROR();
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// Internal Definitions //
|
// Internal Definitions //
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
|
||||||
int Values[100] = {0, };
|
__forceinline void SetFogColor(float4 v)
|
||||||
|
|
||||||
void SetFogColor(u32 fog)
|
|
||||||
{
|
|
||||||
FUNCLOG
|
|
||||||
|
|
||||||
// Always set the fog color, even if it was already set.
|
|
||||||
// if (gs.fogcol != fog)
|
|
||||||
// {
|
|
||||||
gs.fogcol = fog;
|
|
||||||
|
|
||||||
FlushBoth();
|
|
||||||
|
|
||||||
SetShaderCaller("SetFogColor");
|
|
||||||
float4 v;
|
|
||||||
|
|
||||||
// set it immediately
|
|
||||||
v.SetColor(gs.fogcol);
|
|
||||||
ZZshSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor");
|
|
||||||
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFogColor(GIFRegFOGCOL* fog)
|
|
||||||
{
|
{
|
||||||
FUNCLOG
|
FUNCLOG
|
||||||
|
|
||||||
SetShaderCaller("SetFogColor");
|
SetShaderCaller("SetFogColor");
|
||||||
|
ZZshSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor");
|
||||||
|
}
|
||||||
|
|
||||||
|
__forceinline void SetFogColor(u32 fog)
|
||||||
|
{
|
||||||
|
FUNCLOG
|
||||||
|
|
||||||
|
gs.fogcol = fog;
|
||||||
|
|
||||||
|
FlushBoth();
|
||||||
|
|
||||||
|
float4 v;
|
||||||
|
|
||||||
|
// set it immediately
|
||||||
|
v.SetColor(gs.fogcol);
|
||||||
|
SetFogColor(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
__forceinline void SetFogColor(GIFRegFOGCOL* fog)
|
||||||
|
{
|
||||||
|
FUNCLOG
|
||||||
|
|
||||||
float4 v;
|
float4 v;
|
||||||
|
|
||||||
v.x = fog->FCR / 255.0f;
|
v.x = fog->FCR / 255.0f;
|
||||||
v.y = fog->FCG / 255.0f;
|
v.y = fog->FCG / 255.0f;
|
||||||
v.z = fog->FCB / 255.0f;
|
v.z = fog->FCB / 255.0f;
|
||||||
ZZshSetParameter4fv(g_fparamFogColor, v, "g_fParamFogColor");
|
SetFogColor(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtWrite()
|
void ExtWrite()
|
||||||
|
|
|
@ -25,44 +25,62 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------- Includes
|
// ----------------------------- Includes
|
||||||
//#include <list>
|
|
||||||
//#include <vector>
|
|
||||||
//#include <map>
|
|
||||||
//#include <string>
|
|
||||||
//#include <math.h>
|
|
||||||
|
|
||||||
//#include "ZZGl.h"
|
|
||||||
//#include "CRC.h"
|
|
||||||
//#include "targets.h"
|
|
||||||
#include "PS2Edefs.h"
|
#include "PS2Edefs.h"
|
||||||
// ------------------------ Variables -------------------------
|
// ------------------------ Variables -------------------------
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// State parameters
|
// State parameters
|
||||||
|
|
||||||
#ifdef ZEROGS_DEVBUILD
|
#if defined(_WIN32)
|
||||||
extern char* EFFECT_NAME;
|
# include <windows.h>
|
||||||
extern char* EFFECT_DIR;
|
# include "resource.h"
|
||||||
extern u32 g_nGenVars, g_nTexVars, g_nAlphaVars, g_nResolve;
|
|
||||||
extern bool g_bSaveTrans, g_bUpdateEffect, g_bSaveTex, g_bSaveResolved;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern bool s_bWriteDepth;
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern int nBackbufferWidth, nBackbufferHeight;
|
#include "GS.h"
|
||||||
|
#include "targets.h"
|
||||||
|
#include "GLWin.h"
|
||||||
|
#include "ZZoglShaders.h"
|
||||||
|
#include "ZZClut.h"
|
||||||
|
#include "HostMemory.h"
|
||||||
|
|
||||||
extern float fiTexWidth[2], fiTexHeight[2]; // current tex width and height
|
typedef void (APIENTRYP _PFNSWAPINTERVAL)(int);
|
||||||
|
|
||||||
// Methods //
|
PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT = NULL;
|
||||||
|
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL;
|
||||||
|
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL;
|
||||||
|
PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT = NULL;
|
||||||
|
PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT = NULL;
|
||||||
|
PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT = NULL;
|
||||||
|
PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT = NULL;
|
||||||
|
PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT = NULL;
|
||||||
|
PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT = NULL;
|
||||||
|
PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT = NULL;
|
||||||
|
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT = NULL;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT = NULL;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT = NULL;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT = NULL;
|
||||||
|
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = NULL;
|
||||||
|
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL;
|
||||||
|
PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL;
|
||||||
|
PFNGLDRAWBUFFERSPROC glDrawBuffers = NULL;
|
||||||
|
|
||||||
|
#ifndef GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT
|
||||||
|
#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool ZZCreate(int width, int height);
|
||||||
void ZZGSStateReset();
|
void ZZGSStateReset();
|
||||||
|
|
||||||
|
|
||||||
// flush current vertices, call before setting new registers (the main render method)
|
// flush current vertices, call before setting new registers (the main render method)
|
||||||
void Flush(int context);
|
void Flush(int context);
|
||||||
void FlushBoth();
|
void FlushBoth();
|
||||||
|
|
||||||
// called on a primitive switch
|
//extern u32 ptexLogo;
|
||||||
void Prim();
|
//extern int nLogoWidth, nLogoHeight;
|
||||||
|
//extern GLuint vboRect;
|
||||||
|
//void ProcessMessages();
|
||||||
|
//void RenderCustom(float fAlpha); // intro anim
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue