From 17f28b24b34553b0d688775a20a55e21c3eb8863 Mon Sep 17 00:00:00 2001 From: "sudonim1@gmail.com" Date: Mon, 11 Jun 2012 00:00:18 +0000 Subject: [PATCH] GSDX: Prodded some offensive code, this isn't meant to affect emulation of any games and it probably won't. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5283 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GSTextureCache.cpp | 26 ++++++++------------------ plugins/GSdx/GSTextureCache.h | 3 --- plugins/GSdx/res/tfx.fx | 15 ++------------- 3 files changed, 10 insertions(+), 34 deletions(-) diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index ed5a49fdb7..34ef8bbf75 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -576,6 +576,7 @@ void GSTextureCache::IncAge() //Fixme: Several issues in here. Not handling depth stencil, pitch conversion doesnt work. GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* dst) { + const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[TEX0.PSM]; Source* src = new Source(m_renderer, TEX0, TEXA, m_temp); int tw = 1 << TEX0.TW; @@ -596,7 +597,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con else src->m_spritehack_t = false; - if(m_paltex && GSLocalMemory::m_psm[TEX0.PSM].pal > 0) + if(m_paltex && psm.pal > 0) { src->m_fmt = FMT_8; @@ -769,26 +770,17 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con case PSM_PSMCT16S: src->m_fmt = FMT_16; break; - case PSM_PSMT8H: - src->m_fmt = FMT_8H; - src->m_palette = m_renderer->m_dev->CreateTexture(256, 1); - break; + // actually if we end up in that side of the function with a paletted format, we're probably already screwed case PSM_PSMT8: - //Not sure, this wasn't handled at all. - //Xenosaga 2 and 3 use it, Tales of Legendia as well. - //It's always used for fog like effects. - src->m_fmt = FMT_8; - src->m_palette = m_renderer->m_dev->CreateTexture(256, 1); - break; + case PSM_PSMT8H: + case PSM_PSMT4: case PSM_PSMT4HL: - src->m_fmt = FMT_4HL; - src->m_palette = m_renderer->m_dev->CreateTexture(256, 1); - break; case PSM_PSMT4HH: - src->m_fmt = FMT_4HH; - src->m_palette = m_renderer->m_dev->CreateTexture(256, 1); + src->m_fmt = FMT_8; break; } + if (psm.pal > 0) + src->m_palette = m_renderer->m_dev->CreateTexture(256, 1); if(tmp != NULL) { @@ -827,8 +819,6 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con return NULL; } - const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[TEX0.PSM]; - if(psm.pal > 0) { memcpy(src->m_clut, (const uint32*)m_renderer->m_mem.m_clut, psm.pal * sizeof(uint32)); diff --git a/plugins/GSdx/GSTextureCache.h b/plugins/GSdx/GSTextureCache.h index 726917048c..744d122808 100644 --- a/plugins/GSdx/GSTextureCache.h +++ b/plugins/GSdx/GSTextureCache.h @@ -34,9 +34,6 @@ public: FMT_32, FMT_24, FMT_16, - FMT_8H, - FMT_4HL, - FMT_4HH, FMT_8, }; diff --git a/plugins/GSdx/res/tfx.fx b/plugins/GSdx/res/tfx.fx index 7327594f13..89e9d7b718 100644 --- a/plugins/GSdx/res/tfx.fx +++ b/plugins/GSdx/res/tfx.fx @@ -2,10 +2,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_8 3 #if SHADER_MODEL >= 0x400 @@ -390,15 +387,7 @@ float4 sample(float2 st, float q) float4x4 c; - if(PS_FMT == FMT_8H) - { - c = sample_4p(sample_4a(uv)); - } - else if(PS_FMT == FMT_4HL || PS_FMT == FMT_4HH) - { - c = sample_4p(fmod(sample_4a(uv), 1.0f / 16)); - } - else if(PS_FMT == FMT_8) + if(PS_FMT == FMT_8) { c = sample_4p(sample_4a(uv)); }