diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 0e705371b7..7ceaf593ea 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -1520,7 +1520,7 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer) } } unsigned long end = timeGetTime(); - fprintf(stderr, "The %d frames of the scene was render on %dms\n", frame_number, end - start); + fprintf(stderr, "The %ld frames of the scene was render on %ldms\n", frame_number, end - start); fprintf(stderr, "A means of %fms by frame\n", (float)(end - start)/(float)frame_number); sleep(1); diff --git a/plugins/GSdx/GS.h b/plugins/GSdx/GS.h index 112c991dc3..f4c8a0b029 100644 --- a/plugins/GSdx/GS.h +++ b/plugins/GSdx/GS.h @@ -521,8 +521,8 @@ REG64_(GIFReg, ALPHA) uint8 _PAD2[3]; REG_END2 // opaque => output will be Cs/As - __forceinline bool IsOpaque() const {return (A == B || C == 2 && FIX == 0) && D == 0 || (A == 0 && B == D && C == 2 && FIX == 0x80);} - __forceinline bool IsOpaque(int amin, int amax) const {return (A == B || amax == 0) && D == 0 || A == 0 && B == D && amin == 0x80 && amax == 0x80;} + __forceinline bool IsOpaque() const {return ((A == B || (C == 2 && FIX == 0)) && D == 0) || (A == 0 && B == D && C == 2 && FIX == 0x80);} + __forceinline bool IsOpaque(int amin, int amax) const {return ((A == B || amax == 0) && D == 0) || (A == 0 && B == D && amin == 0x80 && amax == 0x80);} REG_END2 REG64_(GIFReg, BITBLTBUF) diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index 426e49341f..4b286819c8 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -341,14 +341,20 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour if(tex) { + const GSLocalMemory::psm_t &psm = GSLocalMemory::m_psm[context->TEX0.PSM]; + ps_sel.wms = context->CLAMP.WMS; ps_sel.wmt = context->CLAMP.WMT; - ps_sel.fmt = tex->m_fmt; ps_sel.aem = env.TEXA.AEM; ps_sel.tfx = context->TEX0.TFX; ps_sel.tcc = context->TEX0.TCC; ps_sel.ltf = m_filter == 2 ? m_vt.IsLinear() : m_filter; ps_sel.rt = tex->m_target; + if (tex->m_palette) { + const GSLocalMemory::psm_t &cpsm = GSLocalMemory::m_psm[context->TEX0.CPSM]; + ps_sel.fmt = cpsm.fmt | 4; + } else + ps_sel.fmt = psm.fmt; int w = tex->m_texture->GetWidth(); int h = tex->m_texture->GetHeight(); diff --git a/plugins/GSdx/GSThread.h b/plugins/GSdx/GSThread.h index 160bd541cd..ccd755c9ec 100644 --- a/plugins/GSdx/GSThread.h +++ b/plugins/GSdx/GSThread.h @@ -226,7 +226,7 @@ public: } void Set() {pthread_cond_signal(&m_cv);} - bool Wait(IGSLock* l) {pthread_cond_wait(&m_cv, *(GSCondVarLock*)l) == 0;} + bool Wait(IGSLock* l) {pthread_cond_wait(&m_cv, *(GSCondVarLock*)l) == 0; return true;} operator pthread_cond_t* () {return &m_cv;} }; diff --git a/plugins/GSdx/res/tfx.glsl b/plugins/GSdx/res/tfx.glsl index 6dcc2bf93d..91d45d75a3 100644 --- a/plugins/GSdx/res/tfx.glsl +++ b/plugins/GSdx/res/tfx.glsl @@ -5,10 +5,7 @@ #define FMT_32 0 #define FMT_24 1 #define FMT_16 2 -#define FMT_8H 3 -#define FMT_4HL 4 -#define FMT_4HH 5 -#define FMT_8 6 +#define FMT_PAL 4 /* flag bit */ #ifndef VS_BPPZ #define VS_BPPZ 0 @@ -25,7 +22,7 @@ #define PS_FST 0 #define PS_WMS 0 #define PS_WMT 0 -#define PS_FMT FMT_8 +#define PS_FMT FMT_32 #define PS_AEM 0 #define PS_TFX 0 #define PS_TCC 1 @@ -431,27 +428,19 @@ vec4 sample_color(vec2 st, float q) mat4 c; - if(PS_FMT == FMT_8H) - { + if(PS_FMT & FMT_PAL) c = sample_4p(sample_4a(uv)); - } - else if(PS_FMT == FMT_4HL) - { - // FIXME mod and fmod are different when value are negative - c = sample_4p(mod(sample_4a(uv), 1.0f / 16)); - } - else if(PS_FMT == FMT_4HH) - { - // FIXME mod and fmod are different when value are negative - c = sample_4p(mod(sample_4a(uv) * 16, 1.0f / 16)); - } - else if(PS_FMT == FMT_8) - { - c = sample_4p(sample_4a(uv)); - } else - { c = sample_4c(uv); + + // PERF: see the impact of the exansion before/after the interpolation + for (uint i = 0; i < 4; i++) { + if((PS_FMT & ~FMT_PAL) == FMT_16) + { + // FIXME GLSL any only support bvec so try to mix it with notEqual + bvec3 rgb_check = notEqual( t.rgb, vec3(0.0f, 0.0f, 0.0f) ); + t.a = t.a >= 0.5 ? TA.y : ( (PS_AEM == 0) || any(rgb_check) ) ? TA.x : 0.0f; + } } if(PS_LTF != 0) @@ -464,11 +453,7 @@ vec4 sample_color(vec2 st, float q) } } - if(PS_FMT == FMT_32) - { - ; - } - else if(PS_FMT == FMT_24) + if(PS_FMT == FMT_24) { // FIXME GLSL any only support bvec so try to mix it with notEqual bvec3 rgb_check = notEqual( t.rgb, vec3(0.0f, 0.0f, 0.0f) ); diff --git a/plugins/zzogl-pg/opengl/ZZGl.h b/plugins/zzogl-pg/opengl/ZZGl.h index 25e0c9a4f7..de7b0a4335 100644 --- a/plugins/zzogl-pg/opengl/ZZGl.h +++ b/plugins/zzogl-pg/opengl/ZZGl.h @@ -194,7 +194,7 @@ namespace FB static __forceinline void Delete() { if (buf != 0) { - glDeleteFramebuffers(1, &buf); + glDeleteFramebuffersEXT(1, &buf); buf = 0; } }