zzogl: painfully merge the zzogl-dev branch

* new memory management
* asm was replaced by intrinsic
* new GLSL backend (AMD only) Cmake is probably broken anyway with the 2 plugins...
* and lots of others stuff that I forgot about it ;)


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5166 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut
2012-04-19 21:22:08 +00:00
parent 8fcadb3616
commit e3c741bb2a
47 changed files with 7412 additions and 5710 deletions
+8
View File
@@ -8,6 +8,7 @@
# Use soundtouch internal lib: -DFORCE_INTERNAL_SOUNDTOUCH=TRUE
# Use zlib internal lib: -DFORCE_INTERNAL_ZLIB=TRUE
# Use sdl1.3 internal lib: -DFORCE_INTERNAL_SDL=TRUE # Not supported yet
# Use GLSL API(else NVIDIA_CG): -DGLSL_API=TRUE
### GCC optimization options
# control C flags : -DUSER_CMAKE_C_FLAGS="cflags"
@@ -183,3 +184,10 @@ if(PACKAGE_MODE)
# Compile all source codes with these 2 defines
add_definitions(-DPLUGIN_DIR_COMPILATION=${PLUGIN_DIR} -DGAMEINDEX_DIR_COMPILATION=${GAMEINDEX_DIR})
endif(PACKAGE_MODE)
#-------------------------------------------------------------------------------
# Select nvidia cg shader api by default
#-------------------------------------------------------------------------------
if(NOT DEFINED FORCE_INTERNAL_SOUNDTOUCH)
set(GLSL_API FALSE)
endif(NOT DEFINED FORCE_INTERNAL_SOUNDTOUCH)
+3 -1
View File
@@ -53,7 +53,9 @@ if(NOT FORCE_INTERNAL_ZLIB)
endif(NOT FORCE_INTERNAL_ZLIB)
## Use pcsx2 package to find module
include(FindCg)
if(NOT GLSL_API)
include(FindCg)
endif(NOT GLSL_API)
include(FindGlew)
include(FindLibc)
include(FindPortAudio)
+9 -5
View File
@@ -6,11 +6,15 @@ set(msg_dep_pcsx2 "check these libraries -> wxWidgets (>=2.8.10), gtk2 (>=
set(msg_dep_cdvdiso "check these libraries -> bzip2 (>=1.0.5), gtk2 (>=2.16)")
set(msg_dep_zerogs "check these libraries -> glew (>=1.5), opengl, X11, nvidia-cg-toolkit (>=2.1)")
set(msg_dep_gsdx "check these libraries -> opengl, X11, pcsx2 SDL")
set(msg_dep_zzogl "check these libraries -> glew (>=1.5), jpeg (>=6.2), opengl, X11, nvidia-cg-toolkit (>=2.1), pcsx2 common libs")
set(msg_dep_onepad "check these libraries -> sdl (>=1.2)")
set(msg_dep_zeropad "check these libraries -> sdl (>=1.2)")
set(msg_dep_spu2x "check these libraries -> soundtouch (>=1.5), alsa, portaudio (>=1.9), pcsx2 common libs")
set(msg_dep_zerospu2 "check these libraries -> soundtouch (>=1.5), alsa")
if(GLSP_API)
set(msg_dep_zzogl "check these libraries -> glew (>=1.5), jpeg (>=6.2), opengl, X11, pcsx2 common libs")
else(GLSP_API)
set(msg_dep_zzogl "check these libraries -> glew (>=1.5), jpeg (>=6.2), opengl, X11, nvidia-cg-toolkit (>=2.1), pcsx2 common libs")
endif(GLSP_API)
#-------------------------------------------------------------------------------
# Pcsx2 core & common libs
@@ -153,17 +157,17 @@ endif(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND)
# requires: -GLEW
# -OpenGL
# -X11
# -CG
# -CG (only with cg build
# -JPEG
# -common_libs
#---------------------------------------
if(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND AND JPEG_FOUND AND common_libs)
if((GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND JPEG_FOUND AND common_libs) AND (CG_FOUND OR GLSL_API))
set(zzogl TRUE)
else(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND AND JPEG_FOUND AND common_libs)
else((GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND JPEG_FOUND AND common_libs) AND (CG_FOUND OR GLSL_API))
set(zzogl FALSE)
message(STATUS "Skip build of zzogl: miss some dependencies")
message(STATUS "${msg_dep_zzogl}")
endif(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND AND JPEG_FOUND AND common_libs)
endif((GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND JPEG_FOUND AND common_libs) AND (CG_FOUND OR GLSL_API))
#---------------------------------------
#---------------------------------------
+1 -1
View File
@@ -27,7 +27,7 @@
<Project filename="plugins/zerospu2/Linux/ZeroSPU2.cbp">
<Depends filename="3rdparty/SoundTouch/SoundTouch.cbp" />
</Project>
<Project filename="plugins/zzogl-pg/opengl/Linux/zzogl-pg/zzogl-pg.cbp" />
<Project filename="plugins/zzogl-pg/opengl/Linux/zzogl-pg/zzogl-pg.cbp" active="1" />
<Project filename="plugins/GSdx/GSdx.gcc.cbp" active="1" />
<Project filename="3rdparty/SDL-1.3.0-5387/SDL-1.3/SDL-1.3.cbp" />
</Workspace>
+28 -15
View File
@@ -45,6 +45,14 @@ if(CMAKE_BUILD_TYPE STREQUAL Release)
add_definitions(${CommonFlags} ${OptimizationFlags} -W)
endif(CMAKE_BUILD_TYPE STREQUAL Release)
# Select the shader API
if(GLSL_API)
add_definitions(-DGLSL_API)
else(GLSL_API)
add_definitions(-DNVIDIA_CG_API)
endif(GLSL_API)
# zzogl sources
set(zzoglSources
GifTransfer.cpp
@@ -54,17 +62,17 @@ set(zzoglSources
GSmain.cpp
HostMemory.cpp
Mem.cpp
# memcpy_amd.cpp
Mem_Swizzle.cpp
Mem_Tables.cpp
Profile.cpp
rasterfont.cpp
NewRegs.cpp
Regs.cpp
targets.cpp
x86.cpp
zerogs.cpp
zpipe.cpp
ZZDepthTargets.cpp
ZZMemoryTargets.cpp
ZZRenderTargets.cpp
ZZClut.cpp
ZZHacks.cpp
ZZKeyboard.cpp
@@ -74,8 +82,10 @@ set(zzoglSources
ZZoglCRTC.cpp
ZZoglFlush.cpp
ZZoglFlushHack.cpp
ZZoglMem.cpp
ZZoglSave.cpp
ZZoglShaders.cpp
ZZoglShadersGLSL.cpp
ZZoglShoots.cpp
ZZoglVB.cpp
)
@@ -94,7 +104,6 @@ set(zzoglHeaders
Mem_Transmit.h
Profile.h
rasterfont.h
NewRegs.h
Regs.h
targets.h
Util.h
@@ -102,21 +111,19 @@ set(zzoglHeaders
zerogs.h
zpipe.h
ZZClut.h
ZZoglFlush.h
ZZGl.h
ZZHacks.h
ZZoglDrawing.h
ZZLog.h
ZZoglCRTC.h
ZZoglMath.h
ZZoglMem.h
ZZoglShaders.h
ZZoglShoots.h
ZZoglVB.h
)
# zzogl S sources
set(zzoglSSources
x86-32.S)
# zzogl shader sources
set(zzoglShaderSources
ctx0/ps2hw_ctx.fx
@@ -131,9 +138,6 @@ set(zzoglLinuxSources
set(zzoglLinuxHeaders
Linux/Linux.h)
# change language of .S-files to c++
set_source_files_properties(${zzoglSSources} PROPERTIES LANGUAGE CXX)
# add additional include directories
include_directories(.
Linux)
@@ -142,7 +146,6 @@ include_directories(.
add_library(${Output} SHARED
${zzoglSources}
${zzoglHeaders}
${zzoglSSources}
${zzoglShaderSources}
${zzoglLinuxSources}
${zzoglLinuxHeaders})
@@ -154,7 +157,9 @@ set_target_properties(${Output} PROPERTIES COMPILE_DEFINITIONS USE_GSOPEN2)
target_link_libraries(${Output} Utilities)
# link target with Cg
target_link_libraries(${Output} ${CG_LIBRARIES})
if(NOT GLSP_API)
target_link_libraries(${Output} ${CG_LIBRARIES})
endif(NOT GLSP_API)
# link target with glew
target_link_libraries(${Output} ${GLEW_LIBRARY})
@@ -183,10 +188,18 @@ endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
if(PACKAGE_MODE)
install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR})
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${PLUGIN_DIR})
if(GLSL_API)
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.glsl DESTINATION ${PLUGIN_DIR})
else(GLSL_API)
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${PLUGIN_DIR})
endif(GLSL_API)
else(PACKAGE_MODE)
install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
if(GLSL_API)
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.glsl DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
else(GLSL_API)
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
endif(GLSL_API)
endif(PACKAGE_MODE)
################################### Replay Loader
+11
View File
@@ -198,13 +198,24 @@ void GLWindow::CreateContextGL()
GLXFBConfig *framebuffer_config = glXChooseFBConfig(glDisplay, DefaultScreen(glDisplay), NULL, &fbcount);
if (!framebuffer_config or !fbcount) return;
#if 1
// At least create a 3.0 context with compatibility profile
int attribs[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
// GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
0
};
#else
// Create a 3.2 core context without compatibility profile
int attribs[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 2,
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
0
};
#endif
GLXContext context_temp = glXCreateContextAttribsARB(glDisplay, framebuffer_config[0], NULL, true, attribs);
if (context_temp) {
ZZLog::Error_Log("Create a 3.0 opengl context");
+71 -21
View File
@@ -21,7 +21,7 @@
#define __GS_H__
#define USE_OLD_REGS
#define ZZNORMAL_MEMORY
#include "Util.h"
#include "GifTransfer.h"
@@ -39,6 +39,8 @@ extern float fFPS;
extern int g_LastCRC;
#define VB_NUMBUFFERS 512 // number of vbo buffer allocated
struct Vector_16F
{
u16 x, y, z, w;
@@ -132,21 +134,22 @@ extern GSconf conf;
// PSM values
// PSM types == Texture Storage Format
enum PSM_value
{
PSMCT32 = 0, // 00 0000
PSMCT24 = 1, // 00 0001
PSMCT16 = 2, // 00 0010
PSMCT16S = 10, // 00 1010
PSMT8 = 19, // 01 0011
PSMT4 = 20, // 01 0100
PSMT8H = 27, // 01 1011
PSMT4HL = 36, // 10 0100
PSMT4HH = 44, // 10 1100
PSMT32Z = 48, // 11 0000
PSMT24Z = 49, // 11 0001
PSMT16Z = 50, // 11 0010
PSMT16SZ = 58, // 11 1010
enum PSM_value{
PSMCT32 = 0, // 000000
PSMCT24 = 1, // 000001
PSMCT16 = 2, // 000010
PSMCT16S = 10, // 001010
PSMT8 = 19, // 010011
PSMT4 = 20, // 010100
PSMT8H = 27, // 011011
PSMT4HL = 36, // 100100
PSMT4HH = 44, // 101100
PSMT32Z = 48, // 110000
PSMT24Z = 49, // 110001
PSMT16Z = 50, // 110010
PSMT16SZ = 58, // 111010
PSMT_BAD_PSM = 63 // for every unknown psm.
};
// Check target bit mode. PSMCT32 and 32Z return 0, 24 and 24Z - 1
@@ -461,7 +464,6 @@ typedef struct
{
u16 aem;
u8 ta[2];
float fta[2];
} texaInfo;
typedef struct
@@ -503,6 +505,14 @@ typedef struct
int fba;
} fbaInfo;
enum transfer_types
{
XFER_HOST_TO_LOCAL = 0,
XFER_LOCAL_TO_HOST = 1,
XFER_LOCAL_TO_LOCAL = 2,
XFER_DEACTIVATED = 3
};
typedef struct
{
Vertex gsvertex[4]; // circular buffer that contains the vertex
@@ -537,15 +547,20 @@ typedef struct
texaInfo texa;
trxposInfo trxpos, trxposnew;
int imageWtemp, imageHtemp;
int imageTransfer;
int imageWnew, imageHnew, imageX, imageY, imageEndX, imageEndY;
bool transferring;
Point image, imageEnd;
Size imageNew, imageTemp;
pathInfo path[4];
GIFRegDIMX dimx;
GSMemory mem;
GSClut clut_buffer;
// Subject to change.
int vsync, interlace;
int primNext(int inc = 1)
{
// Note: ArraySize(gsvertex) == 2^n => modulo is replaced by an and instruction
@@ -615,7 +630,7 @@ static __forceinline u32 RGBA16to32(u16 c)
(((c) & 0x8000) ? 0xff000000 : 0);
}
#if 0
#ifndef ZZNORMAL_MEMORY
// converts float16 [0,1] to BYTE [0,255] (assumes value is in range, otherwise will take lower 8bits)
// f is a u16
static __forceinline u16 Float16ToBYTE(u16 f)
@@ -984,4 +999,39 @@ inline void CluttingForFlushedTex(tex0Info* tex0, u32 Data, int ictx)
#define CPSM_CSA_BITMASK 0x1f780000
#define CPSM_CSA_NOTMASK 0xe0870000
// I'll find a good place for these later.
extern PSM_value PSM_value_Table[64];
extern bool allowed_psm[256]; // in ZZoglMem.cpp.cpp
inline void FillAlowedPsnTable() {
allowed_psm[PSMCT32] = true;
allowed_psm[PSMCT24] = true;
allowed_psm[PSMCT16] = true;
allowed_psm[PSMCT16S] = true;
allowed_psm[PSMT8] = true;
allowed_psm[PSMT4] = true;
allowed_psm[PSMT8H] = true;
allowed_psm[PSMT4HH] = true;
allowed_psm[PSMT4HL] = true;
allowed_psm[PSMT32Z] = true;
allowed_psm[PSMT24Z] = true;
allowed_psm[PSMT16Z] = true;
allowed_psm[PSMT16SZ] = true;
PSM_value_Table[PSMCT32] = PSMCT32;
PSM_value_Table[PSMCT24] = PSMCT24;
PSM_value_Table[PSMCT16] = PSMCT16;
PSM_value_Table[PSMCT16S] = PSMCT16S;
PSM_value_Table[PSMT8] = PSMT8;
PSM_value_Table[PSMT4] = PSMT4;
PSM_value_Table[PSMT8H] = PSMT8H;
PSM_value_Table[PSMT4HH] = PSMT4HH;
PSM_value_Table[PSMT4HL] = PSMT4HL;
PSM_value_Table[PSMT32Z] = PSMT32Z;
PSM_value_Table[PSMT24Z] = PSMT24Z;
PSM_value_Table[PSMT16Z] = PSMT16Z;
PSM_value_Table[PSMT16SZ] = PSMT16SZ;
};
#endif
+41 -28
View File
@@ -22,6 +22,7 @@
#include "Profile.h"
#include "GLWin.h"
#include "ZZoglFlushHack.h"
#include "ZZoglShaders.h"
using namespace std;
@@ -82,7 +83,7 @@ extern int ZZSave(s8* pbydata);
extern bool ZZLoad(s8* pbydata);
// switches the render target to the real target, flushes the current render targets and renders the real image
extern void RenderCRTC(int interlace);
extern void RenderCRTC();
#if defined(_WIN32) && defined(_DEBUG)
HANDLE g_hCurrentThread = NULL;
@@ -91,37 +92,37 @@ HANDLE g_hCurrentThread = NULL;
extern int VALIDATE_THRESH;
extern u32 TEXDESTROY_THRESH;
u32 CALLBACK PS2EgetLibType()
EXPORT_C_(u32) PS2EgetLibType()
{
return PS2E_LT_GS;
}
char* CALLBACK PS2EgetLibName()
EXPORT_C_(char*) PS2EgetLibName()
{
return libraryName;
}
u32 CALLBACK PS2EgetLibVersion2(u32 type)
EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
{
return (zgsversion << 16) | (zgsrevision << 8) | zgsbuild | (zgsminor << 24);
}
void CALLBACK GSsetBaseMem(void* pmem)
EXPORT_C_(void) GSsetBaseMem(void* pmem)
{
g_pBasePS2Mem = (u8*)pmem;
}
void CALLBACK GSsetSettingsDir(const char* dir)
EXPORT_C_(void) GSsetSettingsDir(const char* dir)
{
s_strIniPath = (dir == NULL) ? wxString(L"inis") : wxString(dir, wxConvFile);
}
void CALLBACK GSsetLogDir(const char* dir)
EXPORT_C_(void) GSsetLogDir(const char* dir)
{
ZZLog::SetDir(dir);
}
void CALLBACK GSsetGameCRC(int crc, int options)
EXPORT_C_(void) GSsetGameCRC(int crc, int options)
{
// build a list of function pointer for GetSkipCount (SkipDraw)
static GetSkipCount GSC_list[NUMBER_OF_TITLES];
@@ -217,7 +218,7 @@ void CALLBACK GSsetGameCRC(int crc, int options)
ListHacks();
}
void CALLBACK GSsetFrameSkip(int frameskip)
EXPORT_C_(void) GSsetFrameSkip(int frameskip)
{
FUNCLOG
s_frameskipping |= frameskip;
@@ -232,7 +233,7 @@ void CALLBACK GSsetFrameSkip(int frameskip)
}
}
void CALLBACK GSreset()
EXPORT_C_(void) GSreset()
{
FUNCLOG
@@ -242,11 +243,11 @@ void CALLBACK GSreset()
gs.prac = 1;
prim = &gs._prim[0];
gs.imageTransfer = -1;
gs.transferring = false;
gs.q = 1;
}
void CALLBACK GSgifSoftReset(u32 mask)
EXPORT_C_(void) GSgifSoftReset(u32 mask)
{
FUNCLOG
@@ -254,11 +255,11 @@ void CALLBACK GSgifSoftReset(u32 mask)
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.transferring = false;
gs.q = 1;
}
s32 CALLBACK GSinit()
EXPORT_C_(s32) GSinit()
{
FUNCLOG
@@ -281,7 +282,7 @@ __forceinline void InitMisc()
ResetRegs();
}
s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread)
EXPORT_C_(s32) GSopen(void *pDsp, char *Title, int multithread)
{
FUNCLOG
@@ -337,32 +338,34 @@ EXPORT_C_(s32) GSopen2( void* pDsp, u32 flags )
}
#endif
void CALLBACK GSshutdown()
EXPORT_C_(void) GSshutdown()
{
FUNCLOG
ZZLog::Close();
}
void CALLBACK GSclose()
EXPORT_C_(void) GSclose()
{
FUNCLOG
ZZDestroy();
GLWin.CloseWindow();
// Free alocated memory. We could close plugin without closing pcsx2, so we SHOULD free all allocated resources
ZZshExitCleaning();
SaveStateFile = NULL;
SaveStateExists = true; // default value
g_LastCRC = 0;
}
void CALLBACK GSirqCallback(void (*callback)())
EXPORT_C_(void) GSirqCallback(void (*callback)())
{
FUNCLOG
GSirq = callback;
}
void CALLBACK GSwriteCSR(u32 write)
EXPORT_C_(void) GSwriteCSR(u32 write)
{
FUNCLOG
@@ -373,7 +376,7 @@ void CALLBACK GSwriteCSR(u32 write)
#define access _access
#endif
void CALLBACK GSchangeSaveState(int newstate, const char* filename)
EXPORT_C_(void) GSchangeSaveState(int newstate, const char* filename)
{
FUNCLOG
@@ -428,7 +431,7 @@ static bool get_snapshot_filename(char *filename, char* path, const char* extens
return true;
}
void CALLBACK GSmakeSnapshot(char *path)
EXPORT_C_(void) GSmakeSnapshot(char *path)
{
FUNCLOG
@@ -474,7 +477,16 @@ static __forceinline void SetGSTitle()
GLWin.SetTitle(strtitle);
}
void CALLBACK GSvsync(int interlace)
// This isn't implemented for some reason? Adding a field for it for the moment, till I get a chance to look closer.
EXPORT_C_(void) GSsetVsync(int enabled)
{
FUNCLOG
ZZLog::Debug_Log("Setting VSync to 0x%x.", enabled);
gs.vsync = enabled;
}
EXPORT_C_(void) GSvsync(int current_interlace)
{
FUNCLOG
@@ -506,8 +518,9 @@ void CALLBACK GSvsync(int interlace)
g_nRealFrame++;
// !interlace? Hmmm... Fixme.
RenderCRTC(!interlace);
// The value passed seems to either be 0 or 0x2000, and we want 0 or 1. Perhaps !! would be better...
gs.interlace = !current_interlace;
RenderCRTC();
GLWin.ProcessEvents();
@@ -559,7 +572,7 @@ void CALLBACK GSvsync(int interlace)
}
void CALLBACK GSreadFIFO(u64 *pMem)
EXPORT_C_(void) GSreadFIFO(u64 *pMem)
{
FUNCLOG
@@ -571,7 +584,7 @@ void CALLBACK GSreadFIFO(u64 *pMem)
TransferLocalHost((u32*)pMem, 1);
}
void CALLBACK GSreadFIFO2(u64 *pMem, int qwc)
EXPORT_C_(void) GSreadFIFO2(u64 *pMem, int qwc)
{
FUNCLOG
@@ -583,7 +596,7 @@ void CALLBACK GSreadFIFO2(u64 *pMem, int qwc)
TransferLocalHost((u32*)pMem, qwc);
}
int CALLBACK GSsetupRecording(int start, void* pData)
EXPORT_C_(int) GSsetupRecording(int start, void* pData)
{
FUNCLOG
@@ -595,7 +608,7 @@ int CALLBACK GSsetupRecording(int start, void* pData)
return 1;
}
s32 CALLBACK GSfreeze(int mode, freezeData *data)
EXPORT_C_(s32) GSfreeze(int mode, freezeData *data)
{
FUNCLOG
+30 -26
View File
@@ -27,7 +27,7 @@ static int path1_count = 0;
static int nPath3Hack = 0;
void CALLBACK GSgetLastTag(u64* ptag)
EXPORT_C_(void) GSgetLastTag(u64* ptag)
{
FUNCLOG
@@ -165,32 +165,36 @@ template<int index> void _GSgifTransfer(const u32 *pMem, u32 size)
{
int len = min(size, path->nloop);
//ZZLog::Error_Log("GIF_FLG_IMAGE(%d)=%d", gs.imageTransfer, len);
switch (gs.imageTransfer)
if (gs.transferring)
{
case 0:
TransferHostLocal(pMem, len * 4);
break;
switch (gs.imageTransfer)
{
case XFER_HOST_TO_LOCAL:
TransferHostLocal(pMem, len * 4);
break;
case 1:
// This can't happen; downloads can not be started or performed as part of
// a GIFtag operation. They're an entirely separate process that can only be
// done through the ReverseFIFO transfer (aka ReadFIFO). --air
assert(0);
//TransferLocalHost(pMem, len);
break;
case XFER_LOCAL_TO_HOST:
// This can't happen; downloads can not be started or performed as part of
// a GIFtag operation. They're an entirely separate process that can only be
// done through the ReverseFIFO transfer (aka ReadFIFO). --air
assert(0);
//TransferLocalHost(pMem, len);
break;
case 2:
//TransferLocalLocal();
break;
case XFER_LOCAL_TO_LOCAL:
//TransferLocalLocal();
break;
case 3:
//assert(0);
break;
case XFER_DEACTIVATED:
//assert(0);
break;
default:
//assert(0);
break;
default:
//assert(0);
break;
}
}
pMem += len * 4;
@@ -236,7 +240,7 @@ template<int index> void _GSgifTransfer(const u32 *pMem, u32 size)
}
}
void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr)
EXPORT_C_(void) GSgifTransfer1(u32 *pMem, u32 addr)
{
FUNCLOG
@@ -250,7 +254,7 @@ void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr)
_GSgifTransfer<0>((u32*)((u8*)pMem + addr), (0x4000 - addr) / 16);
}
void CALLBACK GSgifTransfer2(u32 *pMem, u32 size)
EXPORT_C_(void) GSgifTransfer2(u32 *pMem, u32 size)
{
FUNCLOG
@@ -259,7 +263,7 @@ void CALLBACK GSgifTransfer2(u32 *pMem, u32 size)
_GSgifTransfer<1>(const_cast<u32*>(pMem), size);
}
void CALLBACK GSgifTransfer3(u32 *pMem, u32 size)
EXPORT_C_(void) GSgifTransfer3(u32 *pMem, u32 size)
{
FUNCLOG
@@ -268,7 +272,7 @@ void CALLBACK GSgifTransfer3(u32 *pMem, u32 size)
_GSgifTransfer<2>(const_cast<u32*>(pMem), size);
}
void CALLBACK GSgifTransfer(const u32 *pMem, u32 size)
EXPORT_C_(void) GSgifTransfer(const u32 *pMem, u32 size)
{
FUNCLOG
+140 -98
View File
@@ -18,8 +18,6 @@
*/
#include "GS.h"
#include <Cg/cg.h>
#include <Cg/cgGL.h>
#include <stdlib.h>
#include "Mem.h"
@@ -117,14 +115,14 @@ void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h
if (PSMT_ISZTEX(psm))
{
// Somehow, I doubt this code is right. I'll have to look into it. For the moment, I'm keeping it the
// way it was. --arcum42
// This still needs an eye kept on it.
const BLOCK& b = m_Blocks[psm];
bw = (bw + b.width - 1) / b.width;
start = bp * 256 + ((y / b.height) * bw + (x / b.width)) * 0x2000;
end = bp * 256 + (((y + h - 1) / b.height) * bw + (x + w + b.width - 1) / b.width) * 0x2000;
const int x2 = x + w + b.width - 1;
const int y2 = y + h - 1;
bw = bw / b.width;
start = (bp + ((y / b.height) * bw + (x / b.width)) * 0x20) * 0x100;
end = (bp + ((y2 / b.height) * bw + (x2 / b.width)) * 0x20) * 0x100;
return;
}
@@ -139,46 +137,101 @@ void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h
}
else
{
// This is what it used to do, which doesn't seem right.
// Keeping it for reference, in case removing it breaks anything.
start /= 2;
end /= 2;
}
}
// Same as GetRectMemAddress, except that we know x & y are zero, so it's simplified a bit.
void GetRectMemAddressZero(int& start, int& end, int psm, int w, int h, int bp, int bw)
{
FUNCLOG
u32 bits = 0;
if (m_Blocks[psm].bpp == 0)
{
ZZLog::Error_Log("ZeroGS: Bad psm 0x%x.", psm);
start = 0;
end = MEMORY_END;
return;
}
if (PSMT_ISZTEX(psm))
{
// This still needs an eye kept on it.
const BLOCK& b = m_Blocks[psm];
const int x2 = w + b.width - 1;
const int y2 = h - 1;
bw = bw / b.width;
start = bp * 0x100;
end = (bp + ((y2 / b.height) * bw + (x2 / b.width)) * 0x20) * 0x100;
return;
}
//int newx = ((x + w - 1 + 31) & ~31) - 1;
//int newy = ((y + h - 1 + 15) & ~15) - 1;
//start = getPixelAddress4(x, y, bp, bw) / 2;
//end = (getPixelAddress4(max(newx, x), max(newy, y), bp, bw) + 2) / 2;
bits = PSMT_BITS_NUM(psm);
start = getPixelFun[psm](0, 0, bp, bw);
end = getPixelFun[psm](w - 1, h - 1, bp, bw) + 1;
if (bits > 0)
{
start *= bits;
end *= bits;
}
else
{
start /= 2;
end /= 2;
}
}
void GetRectMemAddress(int& start, int& end, int psm, Point p, Size s, int bp, int bw)
{
GetRectMemAddress(start, end, psm, p.x, p.y, s.w, s.h, bp, bw);
}
void GetRectMemAddress(int& start, int& end, int psm, int x, int y, Size s, int bp, int bw)
{
GetRectMemAddress(start, end, psm, x, y, s.w, s.h, bp, bw);
}
void GetRectMemAddressZero(int& start, int& end, int psm, Size s, int bp, int bw)
{
GetRectMemAddressZero(start, end, psm, s.w, s.h, bp, bw);
}
void InitTransferHostLocal()
{
FUNCLOG
#if defined(_DEBUG)
// Xenosaga 1.
if (gs.trxpos.dx + gs.imageWnew > gs.dstbuf.bw)
ZZLog::Debug_Log("Transfer error, width exceeded. (0x%x > 0X%x)", gs.trxpos.dx + gs.imageWnew, gs.dstbuf.bw);
if (gs.trxpos.dx + gs.imageNew.w > gs.dstbuf.bw)
ZZLog::Debug_Log("Transfer error, width exceeded. (0x%x > 0X%x)", gs.trxpos.dx + gs.imageNew.w, gs.dstbuf.bw);
#endif
//bool bHasFlushed = false;
gs.imageX = gs.trxpos.dx;
gs.imageY = gs.trxpos.dy;
gs.image.x = gs.trxpos.dx;
gs.image.y = gs.trxpos.dy;
gs.imageEndX = gs.imageX + gs.imageWnew;
gs.imageEndY = gs.imageY + gs.imageHnew;
gs.imageEnd.x = gs.image.x + gs.imageNew.w;
gs.imageEnd.y = gs.image.y + gs.imageNew.h;
assert(gs.imageEndX < 2048 && gs.imageEndY < 2048);
assert(gs.imageEnd.x < 2048 && gs.imageEnd.y < 2048);
// This needs to be looked in to, since psm should *not* be 63.
// hack! viewful joe
if (gs.dstbuf.psm == 63) gs.dstbuf.psm = 0;
if (gs.dstbuf.psm == 63)
{
ZZLog::WriteLn("gs.dstbuf.psm set to 0!");
gs.dstbuf.psm = 0;
}
int start, end;
GetRectMemAddress(start, end, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw);
GetRectMemAddress(start, end, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageNew, gs.dstbuf.bp, gs.dstbuf.bw);
if (end > MEMORY_END)
{
@@ -189,7 +242,7 @@ void InitTransferHostLocal()
// MEMORY_END is 0x400000...
ZZLog::Warn_Log("Init host local out of bounds! (end == 0x%x)", end);
//gs.imageTransfer = -1;
//gs.transferring = false;
end = MEMORY_END;
}
@@ -198,17 +251,18 @@ void InitTransferHostLocal()
if (vb[0].nCount > 0) Flush(0);
if (vb[1].nCount > 0) Flush(1);
//ZZLog::Prim_Log("trans: bp:%x x:%x y:%x w:%x h:%x\n", gs.dstbuf.bp, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew);
//ZZLog::Prim_Log("trans: bp:%x x:%x y:%x w:%x h:%x\n", gs.dstbuf.bp, gs.trxpos.dx, gs.trxpos.dy, gs.imageNew.w, gs.imageNew.h);
}
void TransferHostLocal(const void* pbyMem, u32 nQWordSize)
{
FUNCLOG
int start, end;
GetRectMemAddress(start, end, gs.dstbuf.psm, gs.imageX, gs.imageY, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw);
int start = -1, end = -1;
GetRectMemAddress(start, end, gs.dstbuf.psm, gs.image, gs.imageNew, gs.dstbuf.bp, gs.dstbuf.bw);
if ((start == -1) || (end == -1)) ZZLog::WriteLn("start == %d, end == %d", start, end);
assert(start < gs_imageEnd);
end = gs_imageEnd;
@@ -272,8 +326,8 @@ void TransferHostLocal(const void* pbyMem, u32 nQWordSize)
{
tex0Info t;
t.tbp0 = gs.dstbuf.bp;
t.tw = gs.imageWnew;
t.th = gs.imageHnew;
t.tw = gs.imageNew.w;
t.th = gs.imageNew.h;
t.tbw = gs.dstbuf.bw;
t.psm = gs.dstbuf.psm;
SaveTex(&t, 0);
@@ -285,24 +339,24 @@ void TransferHostLocal(const void* pbyMem, u32 nQWordSize)
void InitTransferLocalHost()
{
FUNCLOG
assert(gs.trxpos.sx + gs.imageWnew <= 2048 && gs.trxpos.sy + gs.imageHnew <= 2048);
assert(gs.trxpos.sx + gs.imageNew.w <= 2048 && gs.trxpos.sy + gs.imageNew.h <= 2048);
#if defined(_DEBUG)
if (gs.trxpos.sx + gs.imageWnew > gs.srcbuf.bw)
ZZLog::Debug_Log("Transfer error, width exceeded. (0x%x > 0x%x)", gs.trxpos.sx + gs.imageWnew, gs.srcbuf.bw);
if (gs.trxpos.sx + gs.imageNew.w > gs.srcbuf.bw)
ZZLog::Debug_Log("Transfer error, width exceeded. (0x%x > 0x%x)", gs.trxpos.sx + gs.imageNew.w, gs.srcbuf.bw);
#endif
gs.imageX = gs.trxpos.sx;
gs.imageY = gs.trxpos.sy;
gs.image.x = gs.trxpos.sx;
gs.image.y = gs.trxpos.sy;
gs.imageEndX = gs.imageX + gs.imageWnew;
gs.imageEndY = gs.imageY + gs.imageHnew;
gs.imageEnd.x = gs.image.x + gs.imageNew.w;
gs.imageEnd.y = gs.image.y + gs.imageNew.h;
s_vTransferCache.resize(0);
int start, end;
GetRectMemAddress(start, end, gs.srcbuf.psm, gs.trxpos.sx, gs.trxpos.sy, gs.imageWnew, gs.imageHnew, gs.srcbuf.bp, gs.srcbuf.bw);
GetRectMemAddress(start, end, gs.srcbuf.psm, gs.trxpos.sx, gs.trxpos.sy, gs.imageNew, gs.srcbuf.bp, gs.srcbuf.bw);
ResolveInRange(start, end);
}
@@ -316,16 +370,16 @@ void TransferLocalHost(void* pbyMem, u32 nQWordSize, int& x, int& y, u8 *pstart)
T* pbuf = (T*)pbyMem;
u32 nSize = nQWordSize * 16 / sizeof(T);
for (; i < gs.imageEndY; ++i)
for (; i < gs.imageEnd.y; ++i)
{
for (; j < gs.imageEndX && nSize > 0; ++j, --nSize)
for (; j < gs.imageEnd.x && nSize > 0; ++j, --nSize)
{
*pbuf++ = rp(pstart, j % 2048, i % 2048, gs.srcbuf.bw);
}
if (j >= gs.imageEndX)
if (j >= gs.imageEnd.x)
{
assert(j == gs.imageEndX);
assert(j == gs.imageEnd.x);
j = gs.trxpos.sx;
}
else
@@ -344,9 +398,9 @@ void TransferLocalHost_24(void* pbyMem, u32 nQWordSize, int& x, int& y, u8 *psta
u8* pbuf = (u8*)pbyMem;
u32 nSize = nQWordSize * 16 / 3;
for (; i < gs.imageEndY; ++i)
for (; i < gs.imageEnd.y; ++i)
{
for (; j < gs.imageEndX && nSize > 0; ++j, --nSize)
for (; j < gs.imageEnd.x && nSize > 0; ++j, --nSize)
{
u32 p = rp(pstart, j % 2048, i % 2048, gs.srcbuf.bw);
pbuf[0] = (u8)p;
@@ -355,9 +409,9 @@ void TransferLocalHost_24(void* pbyMem, u32 nQWordSize, int& x, int& y, u8 *psta
pbuf += 3;
}
if (j >= gs.imageEndX)
if (j >= gs.imageEnd.x)
{
assert(j == gs.imageEndX);
assert(j == gs.imageEnd.x);
j = gs.trxpos.sx;
}
else
@@ -372,34 +426,34 @@ void TransferLocalHost_24(void* pbyMem, u32 nQWordSize, int& x, int& y, u8 *psta
void TransferLocalHost(void* pbyMem, u32 nQWordSize)
{
FUNCLOG
assert(gs.imageTransfer == 1);
assert(gs.imageTransfer == XFER_LOCAL_TO_HOST);
u8* pstart = g_pbyGSMemory + 256 * gs.srcbuf.bp;
switch(PSMT_BITMODE(gs.srcbuf.psm))
{
case 0:
TransferLocalHost<u32>(pbyMem, nQWordSize, gs.imageY, gs.imageX, pstart);
break;
case 1:
TransferLocalHost_24(pbyMem, nQWordSize, gs.imageY, gs.imageX, pstart);
break;
case 2:
TransferLocalHost<u16>(pbyMem, nQWordSize, gs.imageY, gs.imageX, pstart);
break;
case 3:
TransferLocalHost<u8>(pbyMem, nQWordSize, gs.imageY, gs.imageX, pstart);
break;
default:
assert(0);
break;
case 0:
TransferLocalHost<u32>(pbyMem, nQWordSize, gs.image.y, gs.image.x, pstart);
break;
case 1:
TransferLocalHost_24(pbyMem, nQWordSize, gs.image.y, gs.image.x, pstart);
break;
case 2:
TransferLocalHost<u16>(pbyMem, nQWordSize, gs.image.y, gs.image.x, pstart);
break;
case 3:
TransferLocalHost<u8>(pbyMem, nQWordSize, gs.image.y, gs.image.x, pstart);
break;
default:
assert(0);
break;
}
if (gs.imageY >= gs.imageEndY)
if (gs.image.y >= gs.imageEnd.y)
{
ZZLog::Error_Log("gs.imageY >= gs.imageEndY!");
assert(gs.imageY == gs.imageEndY);
gs.imageTransfer = -1;
ZZLog::Error_Log("gs.image.y >= gs.imageEnd.y!");
assert(gs.image.y == gs.imageEnd.y);
gs.transferring = false;
}
}
@@ -411,11 +465,11 @@ __forceinline void _TransferLocalLocal()
u8* pSrcBuf = g_pbyGSMemory + gs.srcbuf.bp * 256;
u8* pDstBuf = g_pbyGSMemory + gs.dstbuf.bp * 256;
u32 widthlimit = 4;
u32 maxX = gs.trxpos.sx + gs.imageWnew;
u32 maxY = gs.trxpos.sy + gs.imageHnew;
u32 maxX = gs.trxpos.sx + gs.imageNew.w;
u32 maxY = gs.trxpos.sy + gs.imageNew.h;
if (PSMT_BITMODE(gs.srcbuf.psm) == 0) widthlimit = 2;
if ((gs.imageWnew & widthlimit) != 0) return;
if ((gs.imageNew.w & widthlimit) != 0) return;
for(u32 i = gs.trxpos.sy, i2 = gs.trxpos.dy; i < maxY; i++, i2++)
{
@@ -447,10 +501,10 @@ __forceinline void _TransferLocalLocal_4()
_getPixelAddress_0 gdp = getPixelFun_0[gs.dstbuf.psm];
u8* pSrcBuf = g_pbyGSMemory + gs.srcbuf.bp * 256;
u8* pDstBuf = g_pbyGSMemory + gs.dstbuf.bp * 256;
u32 maxX = gs.trxpos.sx + gs.imageWnew;
u32 maxY = gs.trxpos.sy + gs.imageHnew;
u32 maxX = gs.trxpos.sx + gs.imageNew.w;
u32 maxY = gs.trxpos.sy + gs.imageNew.h;
assert((gs.imageWnew % 8) == 0);
assert((gs.imageNew.w % 8) == 0);
for(u32 i = gs.trxpos.sy, i2 = gs.trxpos.dy; i < maxY; ++i, ++i2)
{
@@ -498,21 +552,21 @@ void TransferLocalLocal()
FUNCLOG
//ZZLog::Error_Log("I'z in your code, transferring your memory...");
assert(gs.imageTransfer == 2);
assert(gs.trxpos.sx + gs.imageWnew < 2048 && gs.trxpos.sy + gs.imageHnew < 2048);
assert(gs.trxpos.dx + gs.imageWnew < 2048 && gs.trxpos.dy + gs.imageHnew < 2048);
assert(gs.imageTransfer == XFER_LOCAL_TO_LOCAL);
assert(gs.trxpos.sx + gs.imageNew.w < 2048 && gs.trxpos.sy + gs.imageNew.h < 2048);
assert(gs.trxpos.dx + gs.imageNew.w < 2048 && gs.trxpos.dy + gs.imageNew.h < 2048);
assert((gs.srcbuf.psm&0x7) == (gs.dstbuf.psm&0x7));
if (gs.trxpos.sx + gs.imageWnew > gs.srcbuf.bw)
ZZLog::Debug_Log("Transfer error, src width exceeded.(0x%x > 0x%x)", gs.trxpos.sx + gs.imageWnew, gs.srcbuf.bw);
if (gs.trxpos.sx + gs.imageNew.w > gs.srcbuf.bw)
ZZLog::Debug_Log("Transfer error, src width exceeded.(0x%x > 0x%x)", gs.trxpos.sx + gs.imageNew.w, gs.srcbuf.bw);
if (gs.trxpos.dx + gs.imageWnew > gs.dstbuf.bw)
ZZLog::Debug_Log("Transfer error, dst width exceeded.(0x%x > 0x%x)", gs.trxpos.dx + gs.imageWnew, gs.dstbuf.bw);
if (gs.trxpos.dx + gs.imageNew.w > gs.dstbuf.bw)
ZZLog::Debug_Log("Transfer error, dst width exceeded.(0x%x > 0x%x)", gs.trxpos.dx + gs.imageNew.w, gs.dstbuf.bw);
int srcstart, srcend, dststart, dstend;
GetRectMemAddress(srcstart, srcend, gs.srcbuf.psm, gs.trxpos.sx, gs.trxpos.sy, gs.imageWnew, gs.imageHnew, gs.srcbuf.bp, gs.srcbuf.bw);
GetRectMemAddress(dststart, dstend, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw);
GetRectMemAddress(srcstart, srcend, gs.srcbuf.psm, gs.trxpos.sx, gs.trxpos.sy, gs.imageNew, gs.srcbuf.bp, gs.srcbuf.bw);
GetRectMemAddress(dststart, dstend, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageNew, gs.dstbuf.bp, gs.dstbuf.bw);
// resolve the targs
ResolveInRange(srcstart, srcend);
@@ -547,15 +601,15 @@ void TransferLocalLocal()
{
tex0Info t;
t.tbp0 = gs.dstbuf.bp;
t.tw = gs.imageWnew;
t.th = gs.imageHnew;
t.tw = gs.imageNew.w;
t.th = gs.imageNew.h;
t.tbw = gs.dstbuf.bw;
t.psm = gs.dstbuf.psm;
SaveTex(&t, 0);
t.tbp0 = gs.srcbuf.bp;
t.tw = gs.imageWnew;
t.th = gs.imageHnew;
t.tw = gs.imageNew.w;
t.th = gs.imageNew.h;
t.tbw = gs.srcbuf.bw;
t.psm = gs.srcbuf.psm;
SaveTex(&t, 0);
@@ -563,16 +617,4 @@ void TransferLocalLocal()
#endif
}
__forceinline void TerminateLocalHost()
{
FUNCLOG
//ZZLog::Error_Log("Terminate Local Host!");
}
__forceinline void TerminateHostLocal()
{
FUNCLOG
gs.imageTransfer = -1;
}
+4 -4
View File
@@ -96,7 +96,10 @@ inline u8* _MemoryAddress(int x)
}
extern void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h, int bp, int bw);
extern void GetRectMemAddress(int& start, int& end, int psm, Point p, Size s, int bp, int bw);
extern void GetRectMemAddress(int& start, int& end, int psm, int x, int y, Size s, int bp, int bw);
extern void GetRectMemAddressZero(int& start, int& end, int psm, int w, int h, int bp, int bw);
extern void GetRectMemAddressZero(int& start, int& end, int psm, Size s, int bp, int bw);
// called when trxdir is accessed. If host is involved, transfers memory to temp buffer byTransferBuf.
// Otherwise performs the transfer. TODO: Perhaps divide the transfers into chunks?
@@ -108,7 +111,4 @@ extern void TransferLocalHost(void* pbyMem, u32 nQWordSize);
extern void TransferLocalLocal();
extern void TerminateLocalHost();
extern void TerminateHostLocal();
#endif // HOSTMEMORY_H_INCLUDED
+4 -4
View File
@@ -35,7 +35,7 @@ extern bool THR_bCtrl;
static map<string, confOptsStruct> mapConfOpts;
static gameHacks tempHacks;
void CALLBACK GSkeyEvent(keyEvent *ev)
EXPORT_C_(void) GSkeyEvent(keyEvent *ev)
{
static bool bAlt = false;
@@ -450,7 +450,7 @@ void DisplayDialog()
gtk_widget_destroy(dialog);
}
void CALLBACK GSconfigure()
EXPORT_C_(void) GSconfigure()
{
char strcurdir[256];
getcwd(strcurdir, 256);
@@ -484,12 +484,12 @@ void SysMessage(const char *fmt, ...)
gtk_widget_destroy(dialog);
}
void CALLBACK GSabout()
EXPORT_C_(void) GSabout()
{
SysMessage("ZZOgl PG: by Zeydlitz (PG version worked on by arcum42, gregory, and the pcsx2 development team). Based off of ZeroGS, by zerofrog.");
}
s32 CALLBACK GStest()
EXPORT_C_(s32) GStest()
{
return 0;
}
@@ -16,11 +16,14 @@
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add option="-I/opt/cg/include" />
<Add option="-L/opt/cg/lib" />
<Add option="-DZEROGS_DEVBUILD" />
<Add option="-D_DEBUG" />
</Compiler>
<Linker>
<Add library="../../../../../deps/debug/libUtilities.a" />
<Add library="Cg" />
</Linker>
</Target>
<Target title="Devel">
@@ -33,12 +36,15 @@
<Compiler>
<Add option="-O2" />
<Add option="-g" />
<Add option="-I/opt/cg/include" />
<Add option="-L/opt/cg/lib" />
<Add option="-W" />
<Add option="-DZEROGS_DEVBUILD" />
<Add option="-DNDEBUG" />
</Compiler>
<Linker>
<Add library="../../../../../deps/release/libUtilities.a" />
<Add library="Cg" />
</Linker>
</Target>
<Target title="Release">
@@ -50,10 +56,69 @@
<Option createStaticLib="1" />
<Compiler>
<Add option="-O2" />
<Add option="-I/opt/cg/include" />
<Add option="-L/opt/cg/lib" />
<Add option="-W" />
<Add option="-DRELEASE_TO_PUBLIC" />
<Add option="-DNDEBUG" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="../../../../../deps/release/libUtilities.a" />
<Add library="Cg" />
</Linker>
</Target>
<Target title="GLSL - Debug">
<Option output="../../../../../bin/plugins/ZZOgl-PG-GLSL-dbg.so" prefix_auto="0" extension_auto="0" />
<Option object_output="obj/Debug/" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add option="-DZEROGS_DEVBUILD" />
<Add option="-D_DEBUG" />
<Add option="-DGLSL_API" />
</Compiler>
<Linker>
<Add library="../../../../../deps/debug/libUtilities.a" />
</Linker>
</Target>
<Target title="GLSL - Devel">
<Option output="../../../../../bin/plugins/ZZOgl-PG-GLSL-dev" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-O2" />
<Add option="-g" />
<Add option="-W" />
<Add option="-DZEROGS_DEVBUILD" />
<Add option="-DNDEBUG" />
<Add option="-DGLSL_API" />
</Compiler>
<Linker>
<Add library="../../../../../deps/release/libUtilities.a" />
</Linker>
</Target>
<Target title="GLSL - Release">
<Option output="../../../../../bin/plugins/ZZOgl-PG-GLSL" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-O2" />
<Add option="-W" />
<Add option="-DRELEASE_TO_PUBLIC" />
<Add option="-DNDEBUG" />
<Add option="-DGLSL_API" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="../../../../../deps/release/libUtilities.a" />
@@ -68,8 +133,6 @@
<Add option="-Wno-unused-value" />
<Add option="-Wunused-variable" />
<Add option="-m32" />
<Add option="-I/opt/cg/include" />
<Add option="-L/opt/cg/lib" />
<Add option="-msse2" />
<Add option="-fno-regmove" />
<Add option="-fno-strict-aliasing" />
@@ -96,10 +159,10 @@
<Add library="z" />
<Add library="dl" />
<Add library="stdc++" />
<Add library="Cg" />
</Linker>
<ExtraCommands>
<Add after="cp $(PROJECT_DIR)/../../ps2hw.dat $(TARGET_OUTPUT_DIR)/" />
<Add after="cp $(PROJECT_DIR)/../../ps2hw.glsl $(TARGET_OUTPUT_DIR)/" />
<Mode after="always" />
</ExtraCommands>
<Unit filename="../../CRC.h" />
@@ -121,8 +184,6 @@
<Unit filename="../../Mem_Swizzle.h" />
<Unit filename="../../Mem_Tables.cpp" />
<Unit filename="../../Mem_Transmit.h" />
<Unit filename="../../NewRegs.cpp" />
<Unit filename="../../NewRegs.h" />
<Unit filename="../../Profile.cpp" />
<Unit filename="../../Profile.h" />
<Unit filename="../../Regs.cpp" />
@@ -147,24 +208,29 @@
</Unit>
<Unit filename="../../ZZClut.cpp" />
<Unit filename="../../ZZClut.h" />
<Unit filename="../../ZZDepthTargets.cpp" />
<Unit filename="../../ZZGl.h" />
<Unit filename="../../ZZHacks.cpp" />
<Unit filename="../../ZZHacks.h" />
<Unit filename="../../ZZKeyboard.cpp" />
<Unit filename="../../ZZLog.cpp" />
<Unit filename="../../ZZLog.h" />
<Unit filename="../../ZZMemoryTargets.cpp" />
<Unit filename="../../ZZRenderTargets.cpp" />
<Unit filename="../../ZZoglCRTC.cpp" />
<Unit filename="../../ZZoglCRTC.h" />
<Unit filename="../../ZZoglCreate.cpp" />
<Unit filename="../../ZZoglDrawing.cpp" />
<Unit filename="../../ZZoglDrawing.h" />
<Unit filename="../../ZZoglFlush.cpp" />
<Unit filename="../../ZZoglFlush.h" />
<Unit filename="../../ZZoglFlushHack.cpp" />
<Unit filename="../../ZZoglFlushHack.h" />
<Unit filename="../../ZZoglMath.h" />
<Unit filename="../../ZZoglSave.cpp" />
<Unit filename="../../ZZoglShaders.cpp" />
<Unit filename="../../ZZoglShaders.h" />
<Unit filename="../../ZZoglShadersGLSL.cpp" />
<Unit filename="../../ZZoglShoots.cpp" />
<Unit filename="../../ZZoglShoots.h" />
<Unit filename="../../ZZoglVB.cpp" />
+36 -32
View File
@@ -25,9 +25,11 @@
#include "Mem_Transmit.h"
#include "Mem_Swizzle.h"
#ifdef ZEROGS_SSE2
#include <emmintrin.h>
#include <immintrin.h>
#endif
#ifdef ZZNORMAL_MEMORY
BLOCK m_Blocks[0x40]; // do so blocks are indexable
PCSX2_ALIGNED16(u32 tempblock[64]);
@@ -53,41 +55,41 @@ u8* pstart;
template <class T>
static __forceinline const T* AlignOnBlockBoundry(TransferData data, TransferFuncts fun, Point alignedPt, int& endY, const T* pbuf)
{
bool bCanAlign = ((MOD_POW2(gs.trxpos.dx, data.blockwidth) == 0) && (gs.imageX == gs.trxpos.dx) &&
bool bCanAlign = ((MOD_POW2(gs.trxpos.dx, data.blockwidth) == 0) && (gs.image.x == gs.trxpos.dx) &&
(alignedPt.y > endY) && (alignedPt.x > gs.trxpos.dx));
if ((gs.imageEndX - gs.trxpos.dx) % data.widthlimit)
if ((gs.imageEnd.x - gs.trxpos.dx) % data.widthlimit)
{
/* hack */
int testwidth = (int)nSize -
(gs.imageEndY - gs.imageY) * (gs.imageEndX - gs.trxpos.dx)
+ (gs.imageX - gs.trxpos.dx);
(gs.imageEnd.y - gs.image.y) * (gs.imageEnd.x - gs.trxpos.dx)
+ (gs.image.x - gs.trxpos.dx);
if ((testwidth <= data.widthlimit) && (testwidth >= -data.widthlimit))
{
/* don't transfer */
/*ZZLog::Debug_Log("Bad texture %s: %d %d %d", #psm, gs.trxpos.dx, gs.imageEndX, nQWordSize);*/
/*ZZLog::Debug_Log("Bad texture %s: %d %d %d", #psm, gs.trxpos.dx, gs.imageEnd.x, nQWordSize);*/
//ZZLog::Error_Log("Bad texture: testwidth = %d; data.widthlimit = %d", testwidth, data.widthlimit);
gs.imageTransfer = -1;
gs.transferring = false;
}
bCanAlign = false;
}
/* first align on block boundary */
if (MOD_POW2(gs.imageY, data.blockheight) || !bCanAlign)
if (MOD_POW2(gs.image.y, data.blockheight) || !bCanAlign)
{
u32 transwidth;
if (!bCanAlign)
endY = gs.imageEndY; /* transfer the whole image */
endY = gs.imageEnd.y; /* transfer the whole image */
else
assert(endY < gs.imageEndY); /* part of alignment condition */
assert(endY < gs.imageEnd.y); /* part of alignment condition */
if (((gs.imageEndX - gs.trxpos.dx) % data.widthlimit) || ((gs.imageEndX - gs.imageX) % data.widthlimit))
if (((gs.imageEnd.x - gs.trxpos.dx) % data.widthlimit) || ((gs.imageEnd.x - gs.image.x) % data.widthlimit))
{
/* transmit with a width of 1 */
transwidth = (1 + (DSTPSM == PSMT4));
transwidth = (1 + (gs.dstbuf.psm == PSMT4));
}
else
{
@@ -98,7 +100,7 @@ static __forceinline const T* AlignOnBlockBoundry(TransferData data, TransferFun
if (pbuf == NULL) return NULL;
if (nSize == 0 || tempY == gs.imageEndY) return NULL;
if (nSize == 0 || tempY == gs.imageEnd.y) return NULL;
}
return pbuf;
@@ -112,14 +114,14 @@ static __forceinline const T* TransferAligningToBlocks(TransferData data, Transf
_SwizzleBlock swizzle;
/* can align! */
pitch = gs.imageEndX - gs.trxpos.dx;
pitch = gs.imageEnd.x - gs.trxpos.dx;
area = pitch * data.blockheight;
fracX = gs.imageEndX - alignedPt.x;
fracX = gs.imageEnd.x - alignedPt.x;
/* on top of checking whether pbuf is aligned, make sure that the width is at least aligned to its limits (due to bugs in pcsx2) */
bAligned = !((uptr)pbuf & 0xf) && (TransPitch(pitch, data.transfersize) & 0xf) == 0;
if (bAligned || ((DSTPSM == PSMCT24) || (DSTPSM == PSMT8H) || (DSTPSM == PSMT4HH) || (DSTPSM == PSMT4HL)))
if (bAligned || ((gs.dstbuf.psm == PSMCT24) || (gs.dstbuf.psm == PSMT8H) || (gs.dstbuf.psm == PSMT4HH) || (gs.dstbuf.psm == PSMT4HL)))
swizzle = (fun.Swizzle);
else
swizzle = (fun.Swizzle_u);
@@ -140,7 +142,7 @@ static __forceinline const T* TransferAligningToBlocks(TransferData data, Transf
#endif
/* transfer the rest */
if (alignedPt.x < gs.imageEndX)
if (alignedPt.x < gs.imageEnd.x)
{
pbuf = TransmitHostLocalX<T>(data.psm, fun.wp, data.widthlimit, data.blockheight, alignedPt.x, pbuf);
@@ -161,19 +163,19 @@ static __forceinline const T* TransferAligningToBlocks(TransferData data, Transf
static __forceinline int FinishTransfer(TransferData data, int nLeftOver)
{
if (tempY >= gs.imageEndY)
if (tempY >= gs.imageEnd.y)
{
assert(gs.imageTransfer == -1 || tempY == gs.imageEndY);
gs.imageTransfer = -1;
assert( gs.transferring == false || tempY == gs.imageEnd.y);
gs.transferring = false;
/*int start, end;
GetRectMemAddress(start, end, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw);
GetRectMemAddress(start, end, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageNew, gs.dstbuf.bp, gs.dstbuf.bw);
g_MemTargs.ClearRange(start, end);*/
}
else
{
/* update new params */
gs.imageY = tempY;
gs.imageX = tempX;
gs.image.y = tempY;
gs.image.x = tempX;
}
return (nSize * TransPitch(2, data.transfersize) + nLeftOver) / 2;
@@ -182,23 +184,23 @@ static __forceinline int FinishTransfer(TransferData data, int nLeftOver)
template <class T>
static __forceinline int RealTransfer(u32 psm, const void* pbyMem, u32 nQWordSize)
{
assert(gs.imageTransfer == 0);
assert(gs.imageTransfer == XFER_HOST_TO_LOCAL);
TransferData data = tData[psm];
TransferFuncts fun(psm);
pstart = g_pbyGSMemory + gs.dstbuf.bp * 256;
const T* pbuf = (const T*)pbyMem;
const int tp2 = TransPitch(2, data.transfersize);
int nLeftOver = (nQWordSize * 4 * 2) % tp2;
tempY = gs.imageY;
tempX = gs.imageX;
tempY = gs.image.y;
tempX = gs.image.x;
Point alignedPt;
nSize = (nQWordSize * 4 * 2) / tp2;
nSize = min(nSize, gs.imageWnew * gs.imageHnew);
nSize = min(nSize, gs.imageNew.w * gs.imageNew.h);
int endY = ROUND_UPPOW2(gs.imageY, data.blockheight);
alignedPt.y = ROUND_DOWNPOW2(gs.imageEndY, data.blockheight);
alignedPt.x = ROUND_DOWNPOW2(gs.imageEndX, data.blockwidth);
int endY = ROUND_UPPOW2(gs.image.y, data.blockheight);
alignedPt.y = ROUND_DOWNPOW2(gs.imageEnd.y, data.blockheight);
alignedPt.x = ROUND_DOWNPOW2(gs.imageEnd.x, data.blockwidth);
pbuf = AlignOnBlockBoundry<T>(data, fun, alignedPt, endY, pbuf);
@@ -210,12 +212,12 @@ static __forceinline int RealTransfer(u32 psm, const void* pbyMem, u32 nQWordSiz
if (TransPitch(nSize, data.transfersize) / 4 > 0)
{
pbuf = TransmitHostLocalY<T>(psm, fun.wp, data.widthlimit, gs.imageEndY, pbuf);
pbuf = TransmitHostLocalY<T>(psm, fun.wp, data.widthlimit, gs.imageEnd.y, pbuf);
if (pbuf == NULL) return FinishTransfer(data, nLeftOver);
/* sometimes wrong sizes are sent (tekken tag) */
assert(gs.imageTransfer == -1 || TransPitch(nSize, data.transfersize) / 4 <= 2);
assert(gs.transferring == false || TransPitch(nSize, data.transfersize) / 4 <= 2);
}
return FinishTransfer(data, nLeftOver);
@@ -382,3 +384,5 @@ void BLOCK::FillBlocks(vector<char>& vBlockData, vector<char>& vBilinearData, in
m_Blocks[PSMT4] = b;
m_Blocks[PSMT4].SetFun(PSMT4);
}
#endif
+13 -1
View File
@@ -32,7 +32,13 @@ static __forceinline int MOD_POW2(int val, int base) { return ((val)&(base - 1))
const int BLOCK_TEXWIDTH = 128;
const int BLOCK_TEXHEIGHT = 512;
extern PCSX2_ALIGNED16(u32 tempblock[64]);
// PSM is u6 value, so we MUST guarantee, that we don't crush on incorrect psm.
#define MAX_PSM 64
#define TABLE_WIDTH 8
#ifndef ZZNORMAL_MEMORY
#include "ZZoglMem.h"
#endif
typedef u32(*_getPixelAddress)(int x, int y, u32 bp, u32 bw);
typedef u32(*_getPixelAddress_0)(int x, int y, u32 bw);
@@ -54,6 +60,7 @@ extern _SwizzleBlock swizzleBlockUnFun[64];
extern _TransferHostLocal TransferHostLocalFun[64];
extern _TransferLocalHost TransferLocalHostFun[64];
// Both of the following structs should probably be local class variables or in a namespace,
// but this works for the moment.
@@ -68,6 +75,9 @@ struct TransferData
u32 psm;
};
#ifdef ZZNORMAL_MEMORY
extern PCSX2_ALIGNED16(u32 tempblock[64]);
struct TransferFuncts
{
_writePixel_0 wp;
@@ -500,6 +510,8 @@ static __forceinline u32 readPixel16SZ_0(const void* pmem, int x, int y, u32 bw)
///////////////
#endif
extern int TransferHostLocal32(const void* pbyMem, u32 nQWordSize);
extern int TransferHostLocal32Z(const void* pbyMem, u32 nQWordSize);
extern int TransferHostLocal24(const void* pbyMem, u32 nQWordSize);
+1 -29
View File
@@ -21,15 +21,11 @@
#include "Mem.h"
#include "Mem_Swizzle.h"
#ifdef ZEROGS_SSE2
#include <emmintrin.h>
#include <immintrin.h>
#endif
// WARNING a sfence instruction must be call after SwizzleBlock sse2 function
// Current port of the ASM function to intrinsic
#define INTRINSIC_PORT_16
#define INTRINSIC_PORT_8
#define INTRINSIC_PORT_4
#ifdef ZEROGS_SSE2
static const __aligned16 u32 mask_24b_H[4] = {0xFF000000, 0x0000FFFF, 0xFF000000, 0x0000FFFF};
static const __aligned16 u32 mask_24b_L[4] = {0x00FFFFFF, 0x00000000, 0x00FFFFFF, 0x00000000};
@@ -501,29 +497,17 @@ __forceinline void SwizzleBlock24(u8 *dst, u8 *src, int pitch)
__forceinline void SwizzleBlock16(u8 *dst, u8 *src, int pitch)
{
#ifdef INTRINSIC_PORT_16
SwizzleBlock16_sse2_I<true>(dst, src, pitch);
#else
SwizzleBlock16_sse2(dst, src, pitch);
#endif
}
__forceinline void SwizzleBlock8(u8 *dst, u8 *src, int pitch)
{
#ifdef INTRINSIC_PORT_8
SwizzleBlock8_sse2_I<true>(dst, src, pitch);
#else
SwizzleBlock8_sse2(dst, src, pitch);
#endif
}
__forceinline void SwizzleBlock4(u8 *dst, u8 *src, int pitch)
{
#ifdef INTRINSIC_PORT_4
SwizzleBlock4_sse2_I<true>(dst, src, pitch);
#else
SwizzleBlock4_sse2(dst, src, pitch);
#endif
}
__forceinline void SwizzleBlock32u(u8 *dst, u8 *src, int pitch)
@@ -533,29 +517,17 @@ __forceinline void SwizzleBlock32u(u8 *dst, u8 *src, int pitch)
__forceinline void SwizzleBlock16u(u8 *dst, u8 *src, int pitch)
{
#ifdef INTRINSIC_PORT_16
SwizzleBlock16_sse2_I<false>(dst, src, pitch);
#else
SwizzleBlock16u_sse2(dst, src, pitch);
#endif
}
__forceinline void SwizzleBlock8u(u8 *dst, u8 *src, int pitch)
{
#ifdef INTRINSIC_PORT_8
SwizzleBlock8_sse2_I<false>(dst, src, pitch);
#else
SwizzleBlock8u_sse2(dst, src, pitch);
#endif
}
__forceinline void SwizzleBlock4u(u8 *dst, u8 *src, int pitch)
{
#ifdef INTRINSIC_PORT_4
SwizzleBlock4_sse2_I<false>(dst, src, pitch);
#else
SwizzleBlock4u_sse2(dst, src, pitch);
#endif
}
__forceinline void SwizzleBlock8H(u8 *dst, u8 *src, int pitch)
+86
View File
@@ -250,6 +250,92 @@ u32 g_pageTable16SZ[64][64];
u32 g_pageTable8[64][128];
u32 g_pageTable4[128][128];
//maximum PSM is 58, so our arrays have 58 + 1 = 59 elements
// This table is used for fasr access to memory storage data. Field meaning is following:
// 0 -- the number (1 << [psm][0]) is number of pixels per storage format. It's 0 if stored 1 pixel, 1 for 2 pixels (16-bit), 2 for 4 pixels (PSMT8) and 3 for 8 (PSMT4)
// 5 -- is 3 - [psm][0]. Just for speed
// 3, 4 -- size-1 of pageTable for psm. It used to clump x, y otside boundaries.
// 1, 2 -- the number (1 << [psm][1]) and (1 << [psm[2]]) is also size of pageTable. So [psm][3] = (1 << [psm][1]) - 1
// Also note, that [psm][1] = 5 + ([psm][0] + 1) / 2, and [psm][2] = 6 + [psm][0] / 2.
// 6 -- pixel mask, (1 << [psm][5]) - 1, if be used to word, it leave only bytes for pixel formay
// 7 -- starting position of data in word, PSMT8H, 4HL, 4HH are stored data not from the begining.
u32 ZZ_DT[MAX_PSM][TABLE_WIDTH] = {
{0, 5, 6, 31, 63, 3, 0xffffffff, 0}, // 0 PSMCT32
{0, 5, 6, 31, 63, 3, 0x00ffffff, 0}, // 1 PSMCT24
{1, 6, 6, 63, 63, 2, 0x0000ffff, 0}, // 2 PSMCT16
{0, }, // 3
{0, }, // 4
{0, }, // 5
{0, }, // 6
{0, }, // 7
{0, }, // 8
{0, }, // 9
{1, 6, 6, 63, 63, 2, 0x0000ffff, 0}, // 10 PSMCT16S
{0, }, // 11
{0, }, // 12
{0, }, // 13
{0, }, // 14
{0, }, // 15
{0, }, // 16
{0, }, // 17
{0, }, // 18
{2, 6, 7, 63, 127, 1, 0x000000ff, 0}, // 19 PSMT8
{3, 7, 7, 127, 127, 0, 0x0000000f, 0}, // 20 PSMT4
{0, }, // 21
{0, }, // 22
{0, }, // 23
{0, }, // 24
{0, }, // 25
{0, }, // 26
{0, 5, 6, 31, 63, 3, 0x000000ff, 24}, // 27 PSMT8H
{0, }, // 28
{0, }, // 29
{0, }, // 30
{0, }, // 31
{0, }, // 32
{0, }, // 33
{0, }, // 34
{0, }, // 35
{0, 5, 6, 31, 63, 3, 0x0000000f, 24}, // 36 PSMT4HL
{0, }, // 37
{0, }, // 38
{0, }, // 39
{0, }, // 40
{0, }, // 41
{0, }, // 42
{0, }, // 43
{0, 5, 6, 31, 63, 3, 0x0000000f, 28}, // 44 PSMT4HH
{0, }, // 45
{0, }, // 46
{0, }, // 47
{0, 5, 6, 31, 63, 3, 0xffffffff, 0}, // 48 PSMCT32Z
{0, 5, 6, 31, 63, 3, 0x00ffffff, 0}, // 49 PSMCT24Z
{1, 6, 6, 63, 63, 2, 0x0000ffff, 0}, // 50 PSMCT16Z
{0, }, // 51
{0, }, // 52
{0, }, // 53
{0, }, // 54
{0, }, // 55
{0, }, // 56
{0, }, // 57
{1, 6, 6, 63, 63, 2, 0x0000ffff, 0}, // 58 PSMCT16SZ
{0, }, // 59
{0, }, // 60
{0, }, // 61
{0, }, // 62
{0, }, // 63
};
//maxium PSM is 58, so our arrays have 58 + 1 = 59 elements
u32** g_pageTable[MAX_PSM] = {NULL,};
u32** g_blockTable[MAX_PSM] = {NULL, };
u32** g_columnTable[MAX_PSM] = {NULL, };
u32 g_pageTable2[MAX_PSM][127][127] = {0, };
u32** g_pageTableNew[MAX_PSM] = {NULL,};
/* PSM reference array
{ 32, 24, 16, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, 16S, NULL, NULL, NULL, NULL, NULL,
+23 -24
View File
@@ -23,7 +23,6 @@
#include "GS.h"
#include "Mem.h"
#define DSTPSM gs.dstbuf.psm
extern int tempX, tempY;
extern int pitch, area, fracX;
extern int nSize;
@@ -37,13 +36,13 @@ static __forceinline const T *TransmitHostLocalY_(_writePixel_0 wp, s32 widthlim
{
assert((nSize % widthlimit) == 0 && widthlimit <= 4);
if ((gs.imageEndX - gs.trxpos.dx) % widthlimit)
if ((gs.imageEnd.x - gs.trxpos.dx) % widthlimit)
{
// ZZLog::GS_Log("Bad Transmission! %d %d, psm: %d", gs.trxpos.dx, gs.imageEndX, DSTPSM);
// ZZLog::GS_Log("Bad Transmission! %d %d, psm: %d", gs.trxpos.dx, gs.imageEnd.x, gs.dstbuf.psm);
for (; tempY < endY; ++tempY)
{
for (; tempX < gs.imageEndX && nSize > 0; tempX += 1, nSize -= 1, buf += 1)
for (; tempX < gs.imageEnd.x && nSize > 0; tempX += 1, nSize -= 1, buf += 1)
{
/* write as many pixel at one time as possible */
wp(pstart, tempX % 2048, tempY % 2048, buf[0], gs.dstbuf.bw);
@@ -53,7 +52,7 @@ static __forceinline const T *TransmitHostLocalY_(_writePixel_0 wp, s32 widthlim
for (; tempY < endY; ++tempY)
{
for (; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit, buf += widthlimit)
for (; tempX < gs.imageEnd.x && nSize > 0; tempX += widthlimit, nSize -= widthlimit, buf += widthlimit)
{
/* write as many pixel at one time as possible */
@@ -77,14 +76,14 @@ static __forceinline const T *TransmitHostLocalY_(_writePixel_0 wp, s32 widthlim
}
}
if (tempX >= gs.imageEndX)
if (tempX >= gs.imageEnd.x)
{
assert(tempX == gs.imageEndX);
assert(tempX == gs.imageEnd.x);
tempX = gs.trxpos.dx;
}
else
{
assert(gs.imageTransfer == -1 || nSize*sizeof(T) / 4 == 0);
assert(gs.transferring == false || nSize*sizeof(T) / 4 == 0);
return NULL;
}
}
@@ -96,24 +95,24 @@ static __forceinline const T *TransmitHostLocalY_(_writePixel_0 wp, s32 widthlim
template <class T>
static __forceinline const T *TransmitHostLocalY_24(_writePixel_0 wp, s32 widthlimit, int endY, const T *buf)
{
if (widthlimit != 8 || ((gs.imageEndX - gs.trxpos.dx) % widthlimit))
if (widthlimit != 8 || ((gs.imageEnd.x - gs.trxpos.dx) % widthlimit))
{
//ZZLog::GS_Log("Bad Transmission! %d %d, psm: %d", gs.trxpos.dx, gs.imageEndX, DSTPSM);
//ZZLog::GS_Log("Bad Transmission! %d %d, psm: %d", gs.trxpos.dx, gs.imageEnd.x, gs.dstbuf.psm);
for (; tempY < endY; ++tempY)
{
for (; tempX < gs.imageEndX && nSize > 0; tempX += 1, nSize -= 1, buf += 3)
for (; tempX < gs.imageEnd.x && nSize > 0; tempX += 1, nSize -= 1, buf += 3)
{
wp(pstart, tempX % 2048, tempY % 2048, *(u32*)(buf), gs.dstbuf.bw);
}
if (tempX >= gs.imageEndX)
if (tempX >= gs.imageEnd.x)
{
assert(gs.imageTransfer == -1 || tempX == gs.imageEndX);
assert(gs.transferring == false || tempX == gs.imageEnd.x);
tempX = gs.trxpos.dx;
}
else
{
assert(gs.imageTransfer == -1 || nSize == 0);
assert(gs.transferring == false || nSize == 0);
return NULL;
}
}
@@ -124,7 +123,7 @@ static __forceinline const T *TransmitHostLocalY_24(_writePixel_0 wp, s32 widthl
for (; tempY < endY; ++tempY)
{
for (; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit, buf += 3 * widthlimit)
for (; tempX < gs.imageEnd.x && nSize > 0; tempX += widthlimit, nSize -= widthlimit, buf += 3 * widthlimit)
{
if (nSize < widthlimit) return NULL;
@@ -140,9 +139,9 @@ static __forceinline const T *TransmitHostLocalY_24(_writePixel_0 wp, s32 widthl
wp(pstart, (tempX + 7) % 2048, tempY % 2048, *(u32*)(buf + 21), gs.dstbuf.bw);
}
if (tempX >= gs.imageEndX)
if (tempX >= gs.imageEnd.x)
{
assert(gs.imageTransfer == -1 || tempX == gs.imageEndX);
assert(gs.transferring == false || tempX == gs.imageEnd.x);
tempX = gs.trxpos.dx;
}
else
@@ -155,7 +154,7 @@ static __forceinline const T *TransmitHostLocalY_24(_writePixel_0 wp, s32 widthl
nSize = 0;
}
assert(gs.imageTransfer == -1 || nSize == 0);
assert(gs.transferring == false || nSize == 0);
return NULL;
}
@@ -171,7 +170,7 @@ static __forceinline const T *TransmitHostLocalY_4(_writePixel_0 wp, s32 widthli
{
for (; tempY < endY; ++tempY)
{
for (; tempX < gs.imageEndX && nSize > 0; tempX += widthlimit, nSize -= widthlimit)
for (; tempX < gs.imageEnd.x && nSize > 0; tempX += widthlimit, nSize -= widthlimit)
{
/* write as many pixel at one time as possible */
wp(pstart, tempX % 2048, tempY % 2048, *buf&0x0f, gs.dstbuf.bw);
@@ -200,13 +199,13 @@ static __forceinline const T *TransmitHostLocalY_4(_writePixel_0 wp, s32 widthli
}
}
if (tempX >= gs.imageEndX)
if (tempX >= gs.imageEnd.x)
{
tempX = gs.trxpos.dx;
}
else
{
assert(gs.imageTransfer == -1 || (nSize / 32) == 0);
assert(gs.transferring == false || (nSize / 32) == 0);
return NULL;
}
}
@@ -238,7 +237,7 @@ static __forceinline const T *TransmitHostLocalX_(_writePixel_0 wp, u32 widthlim
{
for (u32 tempi = 0; tempi < blockheight; ++tempi)
{
for (tempX = startX; tempX < gs.imageEndX; tempX++, buf++)
for (tempX = startX; tempX < gs.imageEnd.x; tempX++, buf++)
{
wp(pstart, tempX % 2048, (tempY + tempi) % 2048, buf[0], gs.dstbuf.bw);
}
@@ -255,7 +254,7 @@ static __forceinline const T *TransmitHostLocalX_24(_writePixel_0 wp, u32 widthl
{
for (u32 tempi = 0; tempi < blockheight; ++tempi)
{
for (tempX = startX; tempX < gs.imageEndX; tempX++, buf += 3)
for (tempX = startX; tempX < gs.imageEnd.x; tempX++, buf += 3)
{
wp(pstart, tempX % 2048, (tempY + tempi) % 2048, *(u32*)buf, gs.dstbuf.bw);
}
@@ -272,7 +271,7 @@ static __forceinline const T *TransmitHostLocalX_4(_writePixel_0 wp, u32 widthli
{
for (u32 tempi = 0; tempi < blockheight; ++tempi)
{
for (tempX = startX; tempX < gs.imageEndX; tempX += 2, buf++)
for (tempX = startX; tempX < gs.imageEnd.x; tempX += 2, buf++)
{
wp(pstart, tempX % 2048, (tempY + tempi) % 2048, buf[0]&0x0f, gs.dstbuf.bw);
wp(pstart, (tempX + 1) % 2048, (tempY + tempi) % 2048, buf[0] >> 4, gs.dstbuf.bw);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More