GregMiscellaneous: zzogl-pg: zerogs.h is now only included by zerogs.cpp.

git-svn-id: http://pcsx2.googlecode.com/svn/branches/GregMiscellaneous@3937 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-10-18 11:24:40 +00:00
parent 4e1b13766e
commit b0cd667fd6
35 changed files with 171 additions and 136 deletions

View File

@ -855,4 +855,5 @@ public:
#endif
#endif

View File

@ -67,5 +67,6 @@ class GLWindow
extern GLWindow GLWin;
extern void ChangeWindowSize(int nNewWidth, int nNewHeight);
#endif // GLWIN_H_INCLUDED

View File

@ -18,7 +18,6 @@
*/
#include "GS.h"
#include "zerogs.h"
#include "GLWin.h"
#ifdef GL_WIN32_WINDOW

View File

@ -19,7 +19,6 @@
#include "Util.h"
#include "GLWin.h"
#include "zerogs.h"
#ifdef GL_X11_WINDOW

View File

@ -362,6 +362,8 @@ union tex_0_info
#define TEX_HIGHLIGHT2 3
bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height);
extern void SaveTex(tex0Info* ptex, int usevid);
extern char* NamedSaveTex(tex0Info* ptex, int usevid);
typedef struct
{

View File

@ -34,7 +34,6 @@ using namespace std;
#include "Profile.h"
#include "GLWin.h"
#include "zerogs.h"
#include "targets.h"
#include "ZZoglShaders.h"
#include "ZZoglFlushHack.h"
@ -88,6 +87,12 @@ extern int g_nPixelShaderVer, g_nFrameRender, g_nFramesSkipped;
extern void ProcessEvents();
extern void WriteAA();
extern void WriteBilinear();
extern void ZZDestroy();
extern bool ZZCreate(int width, int height);
extern void ZZGSStateReset();
// switches the render target to the real target, flushes the current render targets and renders the real image
void RenderCRTC(int interlace);
extern int VALIDATE_THRESH;
extern u32 TEXDESTROY_THRESH;
@ -296,12 +301,30 @@ void CALLBACK GSsetFrameSkip(int frameskip)
void CALLBACK GSreset()
{
ZZGSReset();
FUNCLOG
memset(&gs, 0, sizeof(gs));
ZZGSStateReset();
gs.prac = 1;
prim = &gs._prim[0];
gs.nTriFanVert = -1;
gs.imageTransfer = -1;
gs.q = 1;
}
void CALLBACK GSgifSoftReset(u32 mask)
{
ZZGSSoftReset(mask);
FUNCLOG
if (mask & 1) memset(&gs.path[0], 0, sizeof(gs.path[0]));
if (mask & 2) memset(&gs.path[1], 0, sizeof(gs.path[1]));
if (mask & 4) memset(&gs.path[2], 0, sizeof(gs.path[2]));
gs.imageTransfer = -1;
gs.q = 1;
gs.nTriFanVert = -1;
}
s32 CALLBACK GSinit()
@ -382,7 +405,7 @@ void CALLBACK GSclose()
{
FUNCLOG
ZZDestroy(1);
ZZDestroy();
GLWin.CloseWindow();
SaveStateFile = NULL;

View File

@ -19,7 +19,6 @@
#include "GS.h"
#include "Mem.h"
#include "zerogs.h"
#include "GifTransfer.h"
#ifdef _DEBUG

View File

@ -24,9 +24,11 @@
#include <stdlib.h>
#include "Mem.h"
#include "x86.h"
#include "zerogs.h"
#include "targets.h"
// flush current vertices, call before setting new registers (the main render method)
extern void Flush(int context);
u8* g_pbyGSMemory = NULL; // 4Mb GS system mem
void GSMemory::init()

View File

@ -24,7 +24,6 @@
#include "GS.h"
#include "Linux.h"
#include "zerogs.h"
#include "GLWin.h"
#include <map>

View File

@ -19,7 +19,6 @@
#include "GS.h"
#include "Mem.h"
#include "zerogs.h"
#include "targets.h"
#include "x86.h"

View File

@ -22,7 +22,6 @@
#include "NewRegs.h"
#include "PS2Etypes.h"
#include "zerogs.h"
#include "targets.h"
#ifdef USE_OLD_REGS

View File

@ -23,8 +23,6 @@
#ifdef USE_OLD_REGS
#include "Regs.h"
#else
bool CheckChangeInClut(u32 highdword, u32 psm); // returns true if clut will change after this tex0 op
enum GIF_REG
{
@ -778,7 +776,20 @@ REG_SET_END
extern void WriteTempRegs();
extern void SetFrameSkip(bool skip);
extern void ResetRegs();
extern void ResetRegs();
extern void SetTexFlush();
extern void SetFogColor(u32 fog);
extern void SetFogColor(GIFRegFOGCOL* fog);
extern bool CheckChangeInClut(u32 highdword, u32 psm); // returns true if clut will change after this tex0 op
// flush current vertices, call before setting new registers (the main render method)
void Flush(int context);
void FlushBoth();
// called on a primitive switch
void Prim();
#endif
#endif // NEWREGS_H_INCLUDED

View File

@ -25,6 +25,7 @@
#include <string>
#include <map>
#include "Profile.h"
#include "Util.h"
using namespace std;

View File

@ -20,7 +20,7 @@
#ifndef PROFILE_H_INCLUDED
#define PROFILE_H_INCLUDED
#include "zerogs.h"
#include "Util.h"
#if !defined(ZEROGS_DEVBUILD)
#define g_bWriteProfile 0

View File

@ -22,7 +22,6 @@
#include "Regs.h"
#include "PS2Etypes.h"
#include "zerogs.h"
#include "targets.h"
#include "ZZKick.h"

View File

@ -23,8 +23,6 @@
#ifdef USE_OLD_REGS
bool CheckChangeInClut(u32 highdword, u32 psm); // returns true if clut will change after this tex0 op
enum GIF_REG
{
GIF_REG_PRIM = 0x00,
@ -948,6 +946,19 @@ REG_END
extern void WriteTempRegs();
extern void SetFrameSkip(bool skip);
extern void ResetRegs();
extern void SetTexFlush();
extern void SetFogColor(u32 fog);
extern void SetFogColor(GIFRegFOGCOL* fog);
extern bool CheckChangeInClut(u32 highdword, u32 psm); // returns true if clut will change after this tex0 op
// flush current vertices, call before setting new registers (the main render method)
void Flush(int context);
void FlushBoth();
// called on a primitive switch
void Prim();
#else
#include "NewRegs.h"
#endif

View File

@ -366,6 +366,13 @@ extern char *SysLibError(); // Gets previous error loading sysbols
extern void SysCloseLibrary(void *lib); // Closes Library
extern void SysMessage(const char *fmt, ...);
#ifdef ZEROGS_DEVBUILD
extern char* EFFECT_NAME;
extern char* EFFECT_DIR;
extern u32 g_nGenVars, g_nTexVars, g_nAlphaVars, g_nResolve;
extern bool g_bSaveTrans, g_bUpdateEffect, g_bSaveTex, g_bSaveResolved;
#endif
#ifdef __LINUX__
#include "Utilities/MemcpyFast.h"
#define memcpy_amd memcpy_fast

View File

@ -36,6 +36,7 @@ extern bool THR_bShift, SaveStateExists;
const char* s_aa[5] = { "AA none |", "AA 2x |", "AA 4x |", "AA 8x |", "AA 16x |" };
const char* pbilinear[] = { "off", "normal", "forced" };
extern void SetAA(int mode);
void ProcessBilinear()
{
@ -255,6 +256,9 @@ void WriteBilinear()
}
#ifdef _WIN32
extern void ChangeDeviceSize(int nNewWidth, int nNewHeight);
void ProcessEvents()
{
MSG msg;

View File

@ -18,11 +18,13 @@
*/
#include "ZZKick.h"
#include "zerogs.h"
#include "targets.h"
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 };
extern float fiTexWidth[2], fiTexHeight[2]; // current tex width and height
DrawFn drawfn[8] = { KickDummy, KickDummy, KickDummy, KickDummy,
KickDummy, KickDummy, KickDummy, KickDummy
};

View File

@ -23,6 +23,8 @@
#include "Util.h"
#include <cstring>
extern void HandleGLError();
//Logging for errors that are called often should have a time counter.
#ifdef __LINUX__
static u32 __attribute__((unused)) lasttime = 0;
@ -168,9 +170,6 @@ extern void DrawText(const char* pstr, int left, int top, u32 color);
extern void __LogToConsole(const char *fmt, ...);
extern void ZZAddMessage(const char* pstr, u32 ms = 5000);
extern void SetAA(int mode);
extern bool ZZCreate(int width, int height);
extern void ZZDestroy(bool bD3D);
extern void StartCapture();
extern void StopCapture();

View File

@ -25,7 +25,9 @@
#include "GLWin.h"
#include "ZZoglShaders.h"
#include "ZZoglShoots.h"
#include "ZZKick.h"
#include "rasterfont.h" // simple font
#include <math.h>
//------------------ Defines
#if !defined(ZEROGS_DEVBUILD)
@ -49,6 +51,11 @@ vector<u32> s_vecTempTextures; // temporary textures, released at the end of
extern bool g_bMakeSnapshot;
extern string strSnapshot;
extern void ExtWrite();
extern void ZZDestroy();
extern void ChangeDeviceSize(int nNewWidth, int nNewHeight);
extern GLuint vboRect;
// Adjusts vertex shader BitBltPos vector v to preserve aspect ratio. It used to emulate 4:3 or 16:9.
void AdjustTransToAspect(float4& v)
{
@ -175,6 +182,8 @@ inline void FrameObtainDispinfo(u32 bInterlace, tex0Info* dispinfo)
}
}
extern bool s_bWriteDepth;
// Something should be done before Renderering the picture.
inline void RenderStartHelper(u32 bInterlace)
{
@ -677,6 +686,27 @@ inline void AfterRenderMadeSnapshoot()
g_bMakeSnapshot = false;
}
// call to destroy video resources
void ZZReset()
{
FUNCLOG
s_RTs.ResolveAll();
s_DepthRTs.ResolveAll();
vb[0].nCount = 0;
vb[1].nCount = 0;
memset(s_nResolveCounts, 0, sizeof(s_nResolveCounts));
s_nLastResolveReset = 0;
icurctx = -1;
g_vsprog = g_psprog = 0;
ZZGSStateReset();
ZZDestroy();
clear_drawfn();
}
// If needed reset
inline void AfterRendererResizeWindow()
{

View File

@ -22,7 +22,6 @@
#include <stdlib.h>
#include "zerogs.h"
#include "targets.h"
#define INTERLACE_COUNT (bInterlace && interlace == (conf.interlace))
@ -62,6 +61,9 @@ extern void FlushTransferRanges(const tex0Info* ptex);
extern void ProcessMessages();
void AdjustTransToAspect(float4& v);
void ZZGSStateReset();
extern int nBackbufferWidth, nBackbufferHeight;
// Interlace texture is lazy 1*(height) array of 1 and 0.
// If its height (named s_nInterlaceTexWidth here) is hanging we must redo
// the texture.

View File

@ -22,7 +22,6 @@
//------------------ Includes
#include "GS.h"
#include "Mem.h"
#include "zerogs.h"
#include "GLWin.h"
#include "ZZoglShaders.h"
@ -88,6 +87,9 @@ inline bool CreateImportantCheck();
inline void CreateOtherCheck();
inline bool CreateOpenShadersFile();
void ZZGSStateReset();
extern int nBackbufferWidth, nBackbufferHeight;
//------------------ Dummies
#ifdef _WIN32
void __stdcall glBlendFuncSeparateDummy(GLenum e1, GLenum e2, GLenum e3, GLenum e4)
@ -158,9 +160,12 @@ u32 ptexConv32to16 = 0;
int g_nDepthBias = 0;
extern void Delete_Avi_Capture();
extern void ZZDestroy();
extern void SetAA(int mode);
//------------------ Code
///< returns true if the the opengl extension is supported
bool IsGLExt(const char* szTargetExtension)
{
return mapGLExtensions.find(string(szTargetExtension)) != mapGLExtensions.end();
@ -444,7 +449,7 @@ bool ZZCreate(int _width, int _height)
bool bSuccess = true;
int i;
ZZDestroy(1);
ZZDestroy();
ZZGSStateReset();
if (!Create_Window(_width, _height)) return false;
@ -777,7 +782,7 @@ bool ZZCreate(int _width, int _height)
}
}
void ZZDestroy(bool bD3D)
void ZZDestroy()
{
Delete_Avi_Capture();

View File

@ -23,10 +23,10 @@
#include "GS.h"
#include "Mem.h"
#include "zerogs.h"
#include "targets.h"
#include "ZZoglFlushHack.h"
#include "ZZoglShaders.h"
#include <math.h>
//------------------ Defines
#ifndef ZEROGS_DEVBUILD
@ -144,6 +144,7 @@ static u32 s_ptexNextSet[2] = {0}; // ZZ
extern vector<u32> s_vecTempTextures; // temporary textures, released at the end of every frame
extern bool s_bTexFlush;
extern int g_nCurVBOIndex;
bool s_bWriteDepth = false;
bool s_bDestAlphaTest = false;
int s_ClutResolve = 0; // ZZ
@ -192,6 +193,7 @@ int s_nWireframeCount = 0;
VB vb[2];
float fiTexWidth[2], fiTexHeight[2]; // current tex width and height
extern vector<GLuint> g_vboBuffers; // VBOs for all drawing commands
//u8 s_AAx = 0, s_AAy = 0; // if AAy is set, then AAx has to be set
Point AA = {0,0};
@ -217,6 +219,11 @@ inline void ProcessFBA(const VB& curvb, ZZshParameter sOneColor); // zz
void SetContextTarget(int context);
void SetWriteDepth();
bool IsWriteDepth();
void SetDestAlphaTest();
void ResetRenderTarget(int index);
//------------------ Code
inline float AlphaReferedValue(int aref)

View File

@ -27,7 +27,6 @@
#define ZZOGL_FLUSH_HACK_H_INCLUDED
#include "GS.h"
#include "zerogs.h"
#include "targets.h"
extern int g_SkipFlushFrame;

View File

@ -26,6 +26,7 @@
#endif
#include <assert.h>
#include "Pcsx2Defs.h"
//#define ZZ_MMATH

View File

@ -20,9 +20,9 @@
// Save and Load.
//------------------ Includes
#include "zerogs.h"
#include "targets.h"
extern void ZZGSStateReset();
//----------------------- Defines
#define VBSAVELIMIT ((u32)((u8*)&vb[0].nNextFrameHeight-(u8*)&vb[0]))
@ -44,6 +44,9 @@ char *libraryNameX = "ZeroGS Playground OpenGL ";
extern char *libraryName;
extern u32 s_uTex1Data[2][2], s_uClampData[2];
void SetFogColor(u32 fog);
void SetFogColor(GIFRegFOGCOL* fog);
int ZZSave(s8* pbydata)
{
if (pbydata == NULL)
@ -86,6 +89,7 @@ int ZZSave(s8* pbydata)
}
extern u32 s_uFramebuffer;
extern int g_nCurVBOIndex;
bool ZZLoad(s8* pbydata)
{

View File

@ -21,10 +21,10 @@
// ZZogl Shader manipulation functions.
//------------------- Includes
#include "zerogs.h"
#include "ZZoglShaders.h"
#include "zpipe.h"
#include <math.h>
#include <map>
#ifdef _WIN32
# include "Win32.h"
@ -101,6 +101,7 @@ extern u32 ptexBilinearBlocks;
extern u32 ptexConv32to16;
inline bool LoadEffects();
extern bool s_bWriteDepth;
struct SHADERHEADER
{

View File

@ -29,6 +29,10 @@
// Just bitmask for different type of shaders
#define SHADER_REDUCED 1 // equivalent to ps2.0
#define SHADER_ACCURATE 2 // for older cards with less accurate math (ps2.x+)
#include "ZZoglMath.h"
#include "GS.h"
// For output
const static char* g_pShaders[] = { "full", "reduced", "accurate", "accurate-reduced" };

View File

@ -27,7 +27,6 @@
#endif
#include <stdlib.h>
#include "zerogs.h"
#include "targets.h"
#include "Mem.h"
#include "ZZoglShoots.h"
@ -44,9 +43,12 @@ extern "C"
#define HAVE_BOOLEAN
#endif
#include "jpeglib.h" // This library want to be after zerogs.h
#include "jpeglib.h"
}
extern int nBackbufferWidth, nBackbufferHeight;
//------------------ Defines
#define TGA_FILE_NAME_MAX_LENGTH 20
#define MAX_NUMBER_SAVED_TGA 200

View File

@ -21,10 +21,10 @@
// VB stands for Visual Buffer, as I think
//------------------- Includes
#include "zerogs.h"
#include "targets.h"
#include "GS.h"
#include "Mem.h"
extern float fiTexWidth[2], fiTexHeight[2]; // current tex width and height
// ----------------- Defines
#define MINMAX_SHIFT 3

View File

@ -23,10 +23,10 @@
#include "Mem.h"
#include "x86.h"
#include "zerogs.h"
#include "targets.h"
#include "ZZoglShaders.h"
#include "Clut.h"
#include <math.h>
#ifdef ZEROGS_SSE2
#include <emmintrin.h>
@ -60,6 +60,10 @@ int VALIDATE_THRESH = 8;
u32 TEXDESTROY_THRESH = 16;
void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, bool mode);
void SetWriteDepth();
bool IsWriteDepth();
bool IsWriteDestAlphaTest();
void ResetRenderTarget(int index);
// ------------------------- Useful inlines ------------------------------------

View File

@ -22,6 +22,10 @@
#define TARGET_VIRTUAL_KEY 0x80000000
#include "PS2Edefs.h"
#include <list>
#include <map>
#include "GS.h"
#include "ZZGl.h"
#ifndef GL_TEXTURE_RECTANGLE
#define GL_TEXTURE_RECTANGLE GL_TEXTURE_RECTANGLE_NV

View File

@ -95,11 +95,12 @@ int nBackbufferWidth, nBackbufferHeight; // ZZ
extern CRangeManager s_RangeMngr; // manages overwritten memory
int s_nNewWidth = -1, s_nNewHeight = -1;
void ChangeDeviceSize(int nNewWidth, int nNewHeight);
void ProcessMessages();
void RenderCustom(float fAlpha); // intro anim
bool ZZCreate(int width, int height);
///////////////////////
// Method Prototypes //
///////////////////////
@ -107,6 +108,7 @@ void RenderCustom(float fAlpha); // intro anim
void ResolveInRange(int start, int end);
void ExtWrite();
extern GLuint vboRect;
void ResetRenderTarget(int index)
{
@ -237,54 +239,6 @@ void ZZGSStateReset()
vb[1].ictx = 1;
}
void ZZReset()
{
FUNCLOG
s_RTs.ResolveAll();
s_DepthRTs.ResolveAll();
vb[0].nCount = 0;
vb[1].nCount = 0;
memset(s_nResolveCounts, 0, sizeof(s_nResolveCounts));
s_nLastResolveReset = 0;
icurctx = -1;
g_vsprog = g_psprog = 0;
ZZGSStateReset();
ZZDestroy(0);
clear_drawfn();
}
void ZZGSReset()
{
FUNCLOG
memset(&gs, 0, sizeof(gs));
ZZGSStateReset();
gs.prac = 1;
prim = &gs._prim[0];
gs.nTriFanVert = -1;
gs.imageTransfer = -1;
gs.q = 1;
}
void ZZGSSoftReset(u32 mask)
{
FUNCLOG
if (mask & 1) memset(&gs.path[0], 0, sizeof(gs.path[0]));
if (mask & 2) memset(&gs.path[1], 0, sizeof(gs.path[1]));
if (mask & 4) memset(&gs.path[2], 0, sizeof(gs.path[2]));
gs.imageTransfer = -1;
gs.q = 1;
gs.nTriFanVert = -1;
}
void ChangeWindowSize(int nNewWidth, int nNewHeight)
{
FUNCLOG

View File

@ -25,17 +25,16 @@
#endif
// ----------------------------- Includes
#include <list>
#include <vector>
#include <map>
#include <string>
#include <math.h>
#include "ZZGl.h"
#include "GS.h"
#include "CRC.h"
#include "targets.h"
//#include <list>
//#include <vector>
//#include <map>
//#include <string>
//#include <math.h>
//#include "ZZGl.h"
//#include "CRC.h"
//#include "targets.h"
#include "PS2Edefs.h"
// ------------------------ Variables -------------------------
//////////////////////////
@ -48,60 +47,22 @@ extern u32 g_nGenVars, g_nTexVars, g_nAlphaVars, g_nResolve;
extern bool g_bSaveTrans, g_bUpdateEffect, g_bSaveTex, g_bSaveResolved;
#endif
extern int g_nPixelShaderVer;
extern bool s_bWriteDepth;
extern int nBackbufferWidth, nBackbufferHeight;
extern float fiTexWidth[2], fiTexHeight[2]; // current tex width and height
extern vector<GLuint> g_vboBuffers; // VBOs for all drawing commands
extern GLuint vboRect;
extern int g_nCurVBOIndex;
void ChangeWindowSize(int nNewWidth, int nNewHeight);
void SetChangeDeviceSize(int nNewWidth, int nNewHeight);
void ChangeDeviceSize(int nNewWidth, int nNewHeight);
void SetAA(int mode);
void SetCRC(int crc);
void ReloadEffects();
// Methods //
bool IsGLExt(const char* szTargetExtension); ///< returns true if the the opengl extension is supported
inline bool Create_Window(int _width, int _height);
bool ZZCreate(int width, int height);
void ZZDestroy(bool bD3D);
void ZZReset(); // call to destroy video resources
void ZZGSStateReset();
void ZZGSReset();
void ZZGSSoftReset(u32 mask);
void HandleGLError();
// flush current vertices, call before setting new registers (the main render method)
void Flush(int context);
void FlushBoth();
// called on a primitive switch
void Prim();
void SetTexFlush();
// flush current vertices, call before setting new registers (the main render method)
void Flush(int context);
void FlushBoth();
void ExtWrite();
void SetWriteDepth();
bool IsWriteDepth();
void SetDestAlphaTest();
bool IsWriteDestAlphaTest();
void SetFogColor(u32 fog);
void SetFogColor(GIFRegFOGCOL* fog);
void SaveTex(tex0Info* ptex, int usevid);
char* NamedSaveTex(tex0Info* ptex, int usevid);
// switches the render target to the real target, flushes the current render targets and renders the real image
void RenderCRTC(int interlace);
void ResetRenderTarget(int index);
#endif