GregMiscellaneous: zzogl-pg:

* Remove support of 16bits pixel. Very slow and same quality that 8 bits.
* Fix a compilation error on debug...


git-svn-id: http://pcsx2.googlecode.com/svn/branches/GregMiscellaneous@3778 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut@gmail.com 2010-09-16 11:18:56 +00:00
parent bee08966dd
commit 337e573c35
7 changed files with 36 additions and 150 deletions

View File

@ -243,8 +243,6 @@ void TransferLocalHost16SZ(void* pbyMem, u32 nQWordSize) {FUNCLOG}
void fill_block(BLOCK b, vector<char>& vBlockData, vector<char>& vBilinearData, int floatfmt)
{
assert( sizeof(b.pageTable) == b.width * b.height * sizeof(b.pageTable[0][0]) );
float* psrcf = (float*)&vBlockData[0] + b.ox + b.oy * BLOCK_TEXWIDTH;
u16* psrcw = NULL;
if (!floatfmt)

View File

@ -170,41 +170,49 @@ struct BLOCK
{
switch (psm) {
case PSMCT32:
assert( sizeof(g_pageTable32) == width * height * sizeof(g_pageTable32[0][0]) );
pageTable = &g_pageTable32[0][0];
blockTable = &g_blockTable32[0][0];
columnTable = &g_columnTable32[0][0];
break;
case PSMT32Z:
assert( sizeof(g_pageTable32Z) == width * height * sizeof(g_pageTable32Z[0][0]) );
pageTable = &g_pageTable32Z[0][0];
blockTable = &g_blockTable32Z[0][0];
columnTable = &g_columnTable32[0][0];
break;
case PSMCT16:
assert( sizeof(g_pageTable16) == width * height * sizeof(g_pageTable16[0][0]) );
pageTable = &g_pageTable16[0][0];
blockTable = &g_blockTable16[0][0];
columnTable = &g_columnTable16[0][0];
break;
case PSMCT16S:
assert( sizeof(g_pageTable16S) == width * height * sizeof(g_pageTable16S[0][0]) );
pageTable = &g_pageTable16S[0][0];
blockTable = &g_blockTable16S[0][0];
columnTable = &g_columnTable16[0][0];
break;
case PSMT16Z:
assert( sizeof(g_pageTable16Z) == width * height * sizeof(g_pageTable16Z[0][0]) );
pageTable = &g_pageTable16Z[0][0];
blockTable = &g_blockTable16Z[0][0];
columnTable = &g_columnTable16[0][0];
break;
case PSMT16SZ:
assert( sizeof(g_pageTable16SZ) == width * height * sizeof(g_pageTable16SZ[0][0]) );
pageTable = &g_pageTable16SZ[0][0];
blockTable = &g_blockTable16SZ[0][0];
columnTable = &g_columnTable16[0][0];
break;
case PSMT8:
assert( sizeof(g_pageTable8) == width * height * sizeof(g_pageTable8[0][0]) );
pageTable = &g_pageTable8[0][0];
blockTable = &g_blockTable8[0][0];
columnTable = &g_columnTable8[0][0];
break;
case PSMT4:
assert( sizeof(g_pageTable4) == width * height * sizeof(g_pageTable4[0][0]) );
pageTable = &g_pageTable4[0][0];
blockTable = &g_blockTable4[0][0];
columnTable = &g_columnTable4[0][0];

View File

@ -75,8 +75,6 @@ map<string, GLbyte> mapGLExtensions;
namespace ZeroGS
{
RenderFormatType g_RenderFormatType = RFT_float16;
extern void KickPoint();
extern void KickLine();
extern void KickTriangle();
@ -271,19 +269,6 @@ inline void ZeroGS::CreateOtherCheck()
if (Max_Texture_Size_NV < 1024)
ZZLog::Error_Log("Could not properly make bitmasks, so some textures will be missed.");
/* Zeydlitz: we don't support 128-bit targets yet. they are slow and weirdo
if( conf.settings() & GAME_32BITTARGS ) {
g_RenderFormatType = RFT_byte8;
ZZLog::Error_Log("Setting 32 bit render target.");
}
else {
if( !IsGLExt("GL_NV_float_buffer") && !IsGLExt("GL_ARB_color_buffer_float") && !IsGLExt("ATI_pixel_format_float") ) {
ZZLog::Error_Log("******\nZZogl: GS WARNING: Floating point render targets not supported, switching to 32bit\nZZogl: *********");
g_RenderFormatType = RFT_byte8;
}
}*/
g_RenderFormatType = RFT_byte8;
#ifdef _WIN32
if (IsGLExt("WGL_EXT_swap_control") || IsGLExt("EXT_swap_control"))
wglSwapIntervalEXT(0);
@ -470,8 +455,6 @@ bool ZeroGS::Create(int _width, int _height)
Destroy(1);
GSStateReset();
g_RenderFormatType = RFT_float16;
if (!Create_Window(_width, _height)) return false;
if (!CreateFillExtensionsMap()) return false;
if (!CreateImportantCheck()) return false;

View File

@ -207,8 +207,6 @@ int icurctx = -1;
extern CRangeManager s_RangeMngr; // manages overwritten memory // zz
void FlushTransferRanges(const tex0Info* ptex); //zz
RenderFormatType GetRenderFormat() { return g_RenderFormatType; } //zz
// use to update the state
void SetTexVariables(int context, FRAGMENTSHADER* pfragment); // zz
void SetTexInt(int context, FRAGMENTSHADER* pfragment, int settexint); // zz
@ -1468,66 +1466,6 @@ inline void AlphaSaveTarget(VB& curvb)
#endif
}
inline void AlphaColorClamping(VB& curvb, const pixTest curtest)
{
// clamp the final colors, when enabled ffx2 credits mess up
//if (gs.colclamp) ZZLog::Error_Log("ColClamp!");
if ((curvb.curprim.abe && bAlphaClamping) && (GetRenderFormat() != RFT_byte8) && !(conf.settings().no_color_clamp)) // if !colclamp, skip
{
//ZZLog::Error_Log("Clamped.");
ResetAlphaVariables();
// if processing the clamping case, make sure can write to the front buffer
glDisable(GL_STENCIL_TEST);
glEnable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
glDisable(GL_DEPTH_TEST);
glDepthMask(0);
glColorMask(1, 1, 1, 0);
if (s_bWriteDepth) ResetRenderTarget(1);
SetShaderCaller("AlphaColorClamping");
ZZshSetPixelShader(ppsOne.prog);
GL_BLEND_RGB(GL_ONE, GL_ONE);
float f;
if (bAlphaClamping & 1) // min
{
f = 0;
ZZshSetParameter4fv(ppsOne.sOneColor, &f, "g_fOneColor");
GL_BLENDEQ_RGB(GL_MAX_EXT);
Draw(curvb);
}
// bios shows white screen
if (bAlphaClamping & 2) // max
{
f = 1;
ZZshSetParameter4fv(ppsOne.sOneColor, &f, "g_fOneColor");
GL_BLENDEQ_RGB(GL_MIN_EXT);
Draw(curvb);
}
if (!curvb.zbuf.zmsk)
{
glDepthMask(1);
if (s_bWriteDepth)
{
assert(curvb.pdepth != NULL);
curvb.pdepth->SetRenderTarget(1);
}
}
if (curvb.test.ate && USEALPHATESTING) glEnable(GL_ALPHA_TEST);
GL_ZTEST(curtest.zte);
}
}
inline void FlushUndoFiter(u32 dwFilterOpts)
{
if (dwFilterOpts)
@ -1585,7 +1523,6 @@ void ZeroGS::Flush(int context)
GL_REPORT_ERRORD();
AlphaColorClamping(curvb, curtest);
FlushUndoFiter(dwFilterOpts);
ppf += curvb.nCount + 0x100000;

View File

@ -61,7 +61,7 @@ u32 TEXDESTROY_THRESH = 16;
// memory size for one row of texture. It depends on width of texture and number of bytes
// per pixel
inline u32 Pitch(int fbw) { return (RW(fbw) * (GetRenderFormat() == RFT_float16 ? 8 : 4)) ; }
inline u32 Pitch(int fbw) { return (RW(fbw) * 4) ; }
// memory size of whole texture. It is number of rows multiplied by memory size of row
inline u32 Tex_Memory_Size(int fbw, int fbh) { return (RH(fbh) * Pitch(fbw)); }
@ -94,8 +94,7 @@ inline bool ZeroGS::CRenderTarget::InitialiseDefaultTexture(u32 *ptr_p, int fbw,
glBindTexture(GL_TEXTURE_RECTANGLE_NV, *ptr_p);
// initialize to default
GLenum texType = (GetRenderFormat() == RFT_float16) ? GL_FLOAT : GL_UNSIGNED_BYTE;
TextureRect(GetRenderTargetFormat(), fbw, fbh, GL_RGBA, texType, NULL);
TextureRect(4, fbw, fbh, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
setRectWrap(GL_CLAMP);
setRectFilters(GL_LINEAR);
@ -3006,8 +3005,6 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
// note that fbp is always aligned on page boundaries
GetRectMemAddress(start, end, psm, 0, 0, fbw, fbh, fbp, fbw);
if (GetRenderFormat() == RFT_byte8)
{
// start the conversion process A8R8G8B8 -> psm
switch (psm)
{
@ -3040,39 +3037,6 @@ void _Resolve(const void* psrc, int fbp, int fbw, int fbh, int psm, u32 fbm, boo
Resolve_32_Bit<u16, u32, dummy_return >(psrc, fbp, fbw, fbh, PSMT16SZ, fbm);
break;
}
}
else // float16
{
switch (psm)
{
case PSMCT32:
case PSMCT24:
RESOLVE_32_BIT(32, u32, Vector_16F, Float16ToARGB);
break;
case PSMCT16:
RESOLVE_32_BIT(16, u16, Vector_16F, Float16ToARGB16);
break;
case PSMCT16S:
RESOLVE_32_BIT(16S, u16, Vector_16F, Float16ToARGB16);
break;
case PSMT32Z:
case PSMT24Z:
RESOLVE_32_BIT(32Z, u32, Vector_16F, Float16ToARGB_Z);
break;
case PSMT16Z:
RESOLVE_32_BIT(16Z, u16, Vector_16F, Float16ToARGB16_Z);
break;
case PSMT16SZ:
RESOLVE_32_BIT(16SZ, u16, Vector_16F, Float16ToARGB16_Z);
break;
}
}
g_MemTargs.ClearRange(start, end);

View File

@ -100,7 +100,6 @@ Vector g_vdepth, vlogz;
// Vector g_vdepth = Vector( 65536.0f*65536.0f, 256.0f*65536.0f, 65536.0f, 256.0f);
extern CRangeManager s_RangeMngr; // manages overwritten memory
GLenum GetRenderTargetFormat() { return GetRenderFormat() == RFT_byte8 ? 4 : g_internalRGBAFloat16Fmt; }
// returns the first and last addresses aligned to a page that cover
void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h, int bp, int bw);

View File

@ -412,7 +412,6 @@ 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;
extern RenderFormatType g_RenderFormatType;
void AddMessage(const char* pstr, u32 ms = 5000);
void DrawText(const char* pstr, int left, int top, u32 color);
@ -476,8 +475,6 @@ bool CheckChangeInClut(u32 highdword, u32 psm); // returns true if clut will cha
// call to load CLUT data (depending on CLD)
void texClutWrite(int ctx);
RenderFormatType GetRenderFormat();
GLenum GetRenderTargetFormat();
int Save(s8* pbydata);
bool Load(s8* pbydata);