diff --git a/plugins/zzogl-pg/opengl/Linux/zzogl-pg/zzogl-pg.cbp b/plugins/zzogl-pg/opengl/Linux/zzogl-pg/zzogl-pg.cbp index d4612a1fca..97cfe70351 100644 --- a/plugins/zzogl-pg/opengl/Linux/zzogl-pg/zzogl-pg.cbp +++ b/plugins/zzogl-pg/opengl/Linux/zzogl-pg/zzogl-pg.cbp @@ -39,6 +39,7 @@ + @@ -80,6 +81,7 @@ + diff --git a/plugins/zzogl-pg/opengl/Mem_Swizzle.h b/plugins/zzogl-pg/opengl/Mem_Swizzle.h index 3c22e4c960..fc7952e37e 100644 --- a/plugins/zzogl-pg/opengl/Mem_Swizzle.h +++ b/plugins/zzogl-pg/opengl/Mem_Swizzle.h @@ -20,175 +20,32 @@ #define MEM_SWIZZLE_H_INCLUDED #include "GS.h" -#include "Mem.h" - +#include "Mem.h" +#include "x86.h" + +extern __forceinline void SwizzleBlock32(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock16(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock8(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock4(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock32u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock16u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock8u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock4u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); + +extern __forceinline void __fastcall SwizzleBlock32_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +extern __forceinline void __fastcall SwizzleBlock24_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +extern __forceinline void __fastcall SwizzleBlock16_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +extern __forceinline void __fastcall SwizzleBlock8_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +extern __forceinline void __fastcall SwizzleBlock4_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); + // special swizzle macros - which I converted to functions. -#ifdef ZEROGS_SSE2 - -static __forceinline void SwizzleBlock32(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock32_sse2(dst, src, pitch, WriteMask); -} - -static __forceinline void SwizzleBlock16(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock16_sse2(dst, src, pitch/*, WriteMask*/); -} -static __forceinline void SwizzleBlock8(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock8_sse2(dst, src, pitch/*, WriteMask*/); -} -static __forceinline void SwizzleBlock4(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock4_sse2(dst, src, pitch/*, WriteMask*/); -} -static __forceinline void SwizzleBlock32u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock32u_sse2(dst, src, pitch, WriteMask); -} -static __forceinline void SwizzleBlock16u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock16u_sse2(dst, src, pitch/*, WriteMask*/); -} -static __forceinline void SwizzleBlock8u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock8u_sse2(dst, src, pitch/*, WriteMask*/); -} -static __forceinline void SwizzleBlock4u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock4u_sse2(dst, src, pitch/*, WriteMask*/); -} -#else - -static __forceinline void SwizzleBlock32(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock32_c(dst, src, pitch, WriteMask); -} - -static __forceinline void SwizzleBlock16(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock16_c(dst, src, pitch/*, WriteMask*/); -} -static __forceinline void SwizzleBlock8(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock8_c(dst, src, pitch/*, WriteMask*/); -} -static __forceinline void SwizzleBlock4(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock4_c(dst, src, pitch/*, WriteMask*/); -} -static __forceinline void SwizzleBlock32u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock32_c(dst, src, pitch, WriteMask); -} -static __forceinline void SwizzleBlock16u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock16_c(dst, src, pitch/*, WriteMask*/); -} -static __forceinline void SwizzleBlock8u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock8_c(dst, src, pitch/*, WriteMask*/); -} -static __forceinline void SwizzleBlock4u(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - SwizzleBlock4_c(dst, src, pitch/*, WriteMask*/); -} - -#endif -static __forceinline void SwizzleBlock24(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - u8* pnewsrc = src; - u32* pblock = tempblock; - - for(int by = 0; by < 7; ++by, pblock += 8, pnewsrc += pitch-24) - { - for(int bx = 0; bx < 8; ++bx, pnewsrc += 3) - { - pblock[bx] = *(u32*)pnewsrc; - } - } - - for(int bx = 0; bx < 7; ++bx, pnewsrc += 3) - { - /* might be 1 byte out of bounds of GS memory */ - pblock[bx] = *(u32*)pnewsrc; - } - - /* do 3 bytes for the last copy */ - *((u8*)pblock+28) = pnewsrc[0]; - *((u8*)pblock+29) = pnewsrc[1]; - *((u8*)pblock+30) = pnewsrc[2]; - SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0x00ffffff); -} - -#define SwizzleBlock24u SwizzleBlock24 - -static __forceinline void SwizzleBlock8H(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - u8* pnewsrc = src; - u32* pblock = tempblock; - - for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) - { - u32 u = *(u32*)pnewsrc; - pblock[0] = u<<24; - pblock[1] = u<<16; - pblock[2] = u<<8; - pblock[3] = u; - u = *(u32*)(pnewsrc+4); - pblock[4] = u<<24; - pblock[5] = u<<16; - pblock[6] = u<<8; - pblock[7] = u; - } - SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0xff000000); -} - -#define SwizzleBlock8Hu SwizzleBlock8H - -static __forceinline void SwizzleBlock4HH(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - u8* pnewsrc = src; - u32* pblock = tempblock; - - for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) - { - u32 u = *(u32*)pnewsrc; - pblock[0] = u<<28; - pblock[1] = u<<24; - pblock[2] = u<<20; - pblock[3] = u<<16; - pblock[4] = u<<12; - pblock[5] = u<<8; - pblock[6] = u<<4; - pblock[7] = u; - } - SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0xf0000000); -} - -#define SwizzleBlock4HHu SwizzleBlock4HH - -static __forceinline void SwizzleBlock4HL(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff) -{ - u8* pnewsrc = src; - u32* pblock = tempblock; - - for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) - { - u32 u = *(u32*)pnewsrc; - pblock[0] = u<<24; - pblock[1] = u<<20; - pblock[2] = u<<16; - pblock[3] = u<<12; - pblock[4] = u<<8; - pblock[5] = u<<4; - pblock[6] = u; - pblock[7] = u>>4; - } - SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0x0f000000); -} - +extern __forceinline void SwizzleBlock24(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock8H(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock4HH(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +extern __forceinline void SwizzleBlock4HL(u8 *dst, u8 *src, int pitch, u32 WriteMask = 0xffffffff); +#define SwizzleBlock24u SwizzleBlock24 +#define SwizzleBlock8Hu SwizzleBlock8H +#define SwizzleBlock4HHu SwizzleBlock4HH #define SwizzleBlock4HLu SwizzleBlock4HL - #endif // MEM_SWIZZLE_H_INCLUDED diff --git a/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj b/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj index 23de8041dd..8ef4c7f73a 100644 --- a/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj +++ b/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj @@ -327,6 +327,10 @@ RelativePath="..\Mem_Tables.cpp" > + + diff --git a/plugins/zzogl-pg/opengl/ZZoglShaders.cpp b/plugins/zzogl-pg/opengl/ZZoglShaders.cpp index 9e20627a19..28f887d5f1 100644 --- a/plugins/zzogl-pg/opengl/ZZoglShaders.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglShaders.cpp @@ -50,126 +50,58 @@ void HandleCgError(CGcontext ctx, CGerror err, void* appdata) DEBUG_LOG(" last listing: %s\n", listing); } -// This is helper of cgGLSetParameter4fv, made for debug purpose. -// Name could be any string. We must use it on compilation time, because erroneus handler does not -// return name -void ZZcgSetParameter4fv(CGparameter param, const float* v, const char* name) { +// This is a helper of cgGLSetParameter4fv, made for debugging purposes. +// The name could be any string. We must use it on compilation time, because the erronious handler does not +// return it. +void ZZcgSetParameter4fv(CGparameter param, const float* v, const char* name) +{ ShaderHandleName = name; cgGLSetParameter4fv(param, v); } -#define SET_UNIFORMPARAM(var, name) { \ - p = cgGetNamedParameter(pf->prog, name); \ - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) \ - pf->var = p; \ -} \ - void SetupFragmentProgramParameters(FRAGMENTSHADER* pf, int context, int type) { // uniform parameters - CGparameter p; + pf->connect(g_fparamFogColor, "g_fFogColor"); - p = cgGetNamedParameter(pf->prog, "g_fFogColor"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) { - cgConnectParameter(g_fparamFogColor, p); - } - - SET_UNIFORMPARAM(sOneColor, "g_fOneColor"); - SET_UNIFORMPARAM(sBitBltZ, "g_fBitBltZ"); - SET_UNIFORMPARAM(sInvTexDims, "g_fInvTexDims"); - SET_UNIFORMPARAM(fTexAlpha2, "fTexAlpha2"); - SET_UNIFORMPARAM(fTexOffset, "g_fTexOffset"); - SET_UNIFORMPARAM(fTexDims, "g_fTexDims"); - SET_UNIFORMPARAM(fTexBlock, "g_fTexBlock"); - SET_UNIFORMPARAM(fClampExts, "g_fClampExts"); - SET_UNIFORMPARAM(fTexWrapMode, "TexWrapMode"); - SET_UNIFORMPARAM(fRealTexDims, "g_fRealTexDims"); - SET_UNIFORMPARAM(fTestBlack, "g_fTestBlack"); - SET_UNIFORMPARAM(fPageOffset, "g_fPageOffset"); - SET_UNIFORMPARAM(fTexAlpha, "fTexAlpha"); + pf->set_uniform_param(pf->sOneColor, "g_fOneColor"); + pf->set_uniform_param(pf->sBitBltZ, "g_fBitBltZ"); + pf->set_uniform_param(pf->sInvTexDims, "g_fInvTexDims"); + pf->set_uniform_param(pf->fTexAlpha2, "fTexAlpha2"); + pf->set_uniform_param(pf->fTexOffset, "g_fTexOffset"); + pf->set_uniform_param(pf->fTexDims, "g_fTexDims"); + pf->set_uniform_param(pf->fTexBlock, "g_fTexBlock"); + pf->set_uniform_param(pf->fClampExts, "g_fClampExts"); + pf->set_uniform_param(pf->fTexWrapMode, "TexWrapMode"); + pf->set_uniform_param(pf->fRealTexDims, "g_fRealTexDims"); + pf->set_uniform_param(pf->fTestBlack, "g_fTestBlack"); + pf->set_uniform_param(pf->fPageOffset, "g_fPageOffset"); + pf->set_uniform_param(pf->fTexAlpha, "fTexAlpha"); // textures - p = cgGetNamedParameter(pf->prog, "g_sBlocks"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) { - cgGLSetTextureParameter(p, ptexBlocks); - cgGLEnableTextureParameter(p); - } + pf->set_texture(ptexBlocks, "g_sBlocks"); // cg parameter usage is wrong, so do it manually - if( type == 3 ) { - p = cgGetNamedParameter(pf->prog, "g_sConv16to32"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) { - cgGLSetTextureParameter(p, ptexConv16to32); - cgGLEnableTextureParameter(p); - } - } - else if( type == 4 ) { - p = cgGetNamedParameter(pf->prog, "g_sConv32to16"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) { - cgGLSetTextureParameter(p, ptexConv32to16); - cgGLEnableTextureParameter(p); - } - } - else { - p = cgGetNamedParameter(pf->prog, "g_sBilinearBlocks"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) { - cgGLSetTextureParameter(p, ptexBilinearBlocks); - cgGLEnableTextureParameter(p); - } + switch(type) + { + case 3: pf->set_texture(ptexConv16to32, "g_sConv16to32"); break; + case 4: pf->set_texture(ptexConv32to16, "g_sConv32to16"); break; + default: pf->set_texture(ptexBilinearBlocks, "g_sBilinearBlocks"); break; } - p = cgGetNamedParameter(pf->prog, "g_sMemory"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) { - //cgGLEnableTextureParameter(p); - pf->sMemory = p; - } - p = cgGetNamedParameter(pf->prog, "g_sSrcFinal"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) { - //cgGLEnableTextureParameter(p); - pf->sFinal = p; - } - p = cgGetNamedParameter(pf->prog, "g_sBitwiseANDX"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) { - //cgGLEnableTextureParameter(p); - pf->sBitwiseANDX = p; - } - p = cgGetNamedParameter(pf->prog, "g_sBitwiseANDY"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) { - //cgGLEnableTextureParameter(p); - pf->sBitwiseANDY = p; - } - p = cgGetNamedParameter(pf->prog, "g_sCLUT"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) { - //cgGLEnableTextureParameter(p); - pf->sCLUT = p; - } - p = cgGetNamedParameter(pf->prog, "g_sInterlace"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) { - //cgGLEnableTextureParameter(p); - pf->sInterlace = p; - } + pf->set_texture(pf->sMemory, "g_sMemory"); + pf->set_texture(pf->sFinal, "g_sSrcFinal"); + pf->set_texture(pf->sBitwiseANDX, "g_sBitwiseANDX"); + pf->set_texture(pf->sBitwiseANDY, "g_sBitwiseANDY"); + pf->set_texture(pf->sCLUT, "g_sCLUT"); + pf->set_texture(pf->sInterlace, "g_sInterlace"); // set global shader constants - p = cgGetNamedParameter(pf->prog, "g_fExactColor"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) { - cgGLSetParameter4fv(p, Vector(0.5f, (g_GameSettings&GAME_EXACTCOLOR)?0.9f/256.0f:0.5f/256.0f, 0,1/255.0f)); - } - - p = cgGetNamedParameter(pf->prog, "g_fBilinear"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) - cgGLSetParameter4fv(p, Vector(-0.2f, -0.65f, 0.9f, 1.0f / 32767.0f )); - - p = cgGetNamedParameter(pf->prog, "g_fZBias"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) - cgGLSetParameter4fv(p, Vector(1.0f/256.0f, 1.0004f, 1, 0.5f)); - - p = cgGetNamedParameter(pf->prog, "g_fc0"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) - cgGLSetParameter4fv(p, Vector(0,1, 0.001f, 0.5f)); - - p = cgGetNamedParameter(pf->prog, "g_fMult"); - if( p != NULL && cgIsParameterUsed(p, pf->prog) == CG_TRUE ) - cgGLSetParameter4fv(p, Vector(1/1024.0f, 0.2f/1024.0f, 1/128.0f, 1/512.0f)); + pf->set_shader_const(Vector(0.5f, (g_GameSettings&GAME_EXACTCOLOR)?0.9f/256.0f:0.5f/256.0f, 0,1/255.0f), "g_fExactColor"); + pf->set_shader_const(Vector(-0.2f, -0.65f, 0.9f, 1.0f / 32767.0f ), "g_fBilinear"); + pf->set_shader_const(Vector(1.0f/256.0f, 1.0004f, 1, 0.5f), "g_fZBias"); + pf->set_shader_const(Vector(0,1, 0.001f, 0.5f), "g_fc0"); + pf->set_shader_const(Vector(1/1024.0f, 0.2f/1024.0f, 1/128.0f, 1/512.0f), "g_fMult"); } void SetupVertexProgramParameters(CGprogram prog, int context) @@ -181,11 +113,13 @@ void SetupVertexProgramParameters(CGprogram prog, int context) cgConnectParameter(g_vparamPosXY[context], p); // Set Z-test, log or no log; - if (g_GameSettings&GAME_NOLOGZ) { - g_vdepth = Vector( 255.0 /256.0f, 255.0/65536.0f, 255.0f/(65535.0f*256.0f), 1.0f/(65536.0f*65536.0f)); + if (g_GameSettings&GAME_NOLOGZ) + { + g_vdepth = Vector( 255.0 /256.0f, 255.0/65536.0f, 255.0f/(65535.0f*256.0f), 1.0f/(65536.0f*65536.0f)); vlogz = Vector( 1.0f, 0.0f, 0.0f, 0.0f); } - else { + else + { g_vdepth = Vector( 256.0f*65536.0f, 65536.0f, 256.0f, 65536.0f*65536.0f); vlogz = Vector( 0.0f, 1.0f, 0.0f, 0.0f); } diff --git a/plugins/zzogl-pg/opengl/x86.cpp b/plugins/zzogl-pg/opengl/x86.cpp index fd21b0734a..f4220dfb5f 100644 --- a/plugins/zzogl-pg/opengl/x86.cpp +++ b/plugins/zzogl-pg/opengl/x86.cpp @@ -29,78 +29,6 @@ #endif // swizzling - -void __fastcall SwizzleBlock32_c(u8* dst, u8* src, int srcpitch, u32 WriteMask) -{ - u32* d = &g_columnTable32[0][0]; - - if(WriteMask == 0xffffffff) - { - for(int j = 0; j < 8; j++, d += 8, src += srcpitch) - for(int i = 0; i < 8; i++) - ((u32*)dst)[d[i]] = ((u32*)src)[i]; - } - else - { - for(int j = 0; j < 8; j++, d += 8, src += srcpitch) - for(int i = 0; i < 8; i++) - ((u32*)dst)[d[i]] = (((u32*)dst)[d[i]] & ~WriteMask) | (((u32*)src)[i] & WriteMask); - } -} - - -void __fastcall SwizzleBlock24_c(u8* dst, u8* src, int srcpitch, u32 WriteMask) -{ - u32* d = &g_columnTable32[0][0]; - - if(WriteMask == 0x00ffffff) - { - for(int j = 0; j < 8; j++, d += 8, src += srcpitch) - for(int i = 0; i < 8; i++) - ((u32*)dst)[d[i]] = ((u32*)src)[i]; - } - else - { - for(int j = 0; j < 8; j++, d += 8, src += srcpitch) - for(int i = 0; i < 8; i++) - ((u32*)dst)[d[i]] = (((u32*)dst)[d[i]] & ~WriteMask) | (((u32*)src)[i] & WriteMask); - } -} - -void __fastcall SwizzleBlock16_c(u8* dst, u8* src, int srcpitch, u32 WriteMask) -{ - u32* d = &g_columnTable16[0][0]; - - for(int j = 0; j < 8; j++, d += 16, src += srcpitch) - for(int i = 0; i < 16; i++) - ((u16*)dst)[d[i]] = ((u16*)src)[i]; -} - -void __fastcall SwizzleBlock8_c(u8* dst, u8* src, int srcpitch, u32 WriteMask) -{ - u32* d = &g_columnTable8[0][0]; - - for(int j = 0; j < 16; j++, d += 16, src += srcpitch) - for(int i = 0; i < 16; i++) - dst[d[i]] = src[i]; -} - -void __fastcall SwizzleBlock4_c(u8* dst, u8* src, int srcpitch, u32 WriteMask) -{ - u32* d = &g_columnTable4[0][0]; - - for(int j = 0; j < 16; j++, d += 32, src += srcpitch) - { - for(int i = 0; i < 32; i++) - { - u32 addr = d[i]; - u8 c = (src[i>>1] >> ((i&1) << 2)) & 0x0f; - u32 shift = (addr&1) << 2; - dst[addr >> 1] = (dst[addr >> 1] & (0xf0 >> shift)) | (c << shift); - } - } -} - #define _FrameSwizzleBlock(type, transfer, transfer16, incsrc) \ /* FrameSwizzleBlock32 */ \ void __fastcall FrameSwizzleBlock32##type##c(u32* dst, u32* src, int srcpitch, u32 WriteMask) \ diff --git a/plugins/zzogl-pg/opengl/x86.h b/plugins/zzogl-pg/opengl/x86.h index ce26a79aeb..b7f3b29d84 100644 --- a/plugins/zzogl-pg/opengl/x86.h +++ b/plugins/zzogl-pg/opengl/x86.h @@ -59,10 +59,10 @@ extern "C" void __fastcall Frame16SwizzleBlock32ZA4_sse2(u32* dst, Vector_16F* s extern "C" void __fastcall Frame16SwizzleBlock16A4_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); extern "C" void __fastcall Frame16SwizzleBlock16ZA4_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask); -extern void __fastcall SwizzleBlock32_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); +/*extern void __fastcall SwizzleBlock32_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff); extern void __fastcall SwizzleBlock16_c(u8* dst, u8* src, int srcpitch); extern void __fastcall SwizzleBlock8_c(u8* dst, u8* src, int srcpitch); -extern void __fastcall SwizzleBlock4_c(u8* dst, u8* src, int srcpitch); +extern void __fastcall SwizzleBlock4_c(u8* dst, u8* src, int srcpitch);*/ // no AA extern void __fastcall FrameSwizzleBlock32_c(u32* dst, u32* src, int srcpitch, u32 WriteMask); diff --git a/plugins/zzogl-pg/opengl/zerogs.h b/plugins/zzogl-pg/opengl/zerogs.h index f8918625e8..5ab6d5a65c 100644 --- a/plugins/zzogl-pg/opengl/zerogs.h +++ b/plugins/zzogl-pg/opengl/zerogs.h @@ -271,6 +271,67 @@ struct FRAGMENTSHADER #ifdef _DEBUG string filename; #endif + void set_uniform_param(CGparameter &var, const char *name) + { + CGparameter p; + p = cgGetNamedParameter(prog, name); + if (p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE) var = p; + } + + bool set_texture(GLuint texobj, const char *name) + { + CGparameter p; + + p = cgGetNamedParameter(prog, name); + if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) + { + cgGLSetTextureParameter(p, texobj); + cgGLEnableTextureParameter(p); + return true; + } + return false; + } + + bool connect(CGparameter &tex, const char *name) + { + CGparameter p; + + p = cgGetNamedParameter(prog, name); + if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) + { + cgConnectParameter(tex, p); + return true; + } + return false; + } + + bool set_texture(CGparameter &tex, const char *name) + { + CGparameter p; + + p = cgGetNamedParameter(prog, name); + if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) + { + //cgGLEnableTextureParameter(p); + tex = p; + return true; + } + return false; + } + + bool set_shader_const(Vector v, const char *name) + { + CGparameter p; + + p = cgGetNamedParameter(prog, name); + + if( p != NULL && cgIsParameterUsed(p, prog) == CG_TRUE ) + { + cgGLSetParameter4fv(p, v); + return true; + } + return false; + } }; struct VERTEXSHADER