gsdx-ogl: fix paltex on opengl

RT uses as palette must use the alpha channel

Palette texture uses the red channel
This commit is contained in:
Gregory Hainaut 2015-05-30 19:01:09 +02:00
parent 2f2ae2bc89
commit d301848848
3 changed files with 5 additions and 1 deletions

View File

@ -518,7 +518,8 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
bilinear = false; bilinear = false;
ps_sel.fmt = cpsm.fmt | 4; ps_sel.fmt = cpsm.fmt | 4;
ps_sel.ifmt = (context->TEX0.PSM == 0x1B) ? 3 ps_sel.ifmt = !tex->m_alpha_palette ? 0
: (context->TEX0.PSM == 0x1B) ? 3
: (context->TEX0.PSM == 0x24) ? 2 : (context->TEX0.PSM == 0x24) ? 2
: (context->TEX0.PSM == 0x2C) ? 1 : (context->TEX0.PSM == 0x2C) ? 1
: 0; : 0;

View File

@ -756,6 +756,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
bool linear = true; bool linear = true;
if (psm.pal > 0) { if (psm.pal > 0) {
src->m_palette = m_renderer->m_dev->CreateTexture(256, 1); src->m_palette = m_renderer->m_dev->CreateTexture(256, 1);
src->m_alpha_palette = true;
// Palette is used to interpret the alpha channel of the RT as an index. // Palette is used to interpret the alpha channel of the RT as an index.
// Star Ocean 3 uses it to emulate a stencil buffer. // Star Ocean 3 uses it to emulate a stencil buffer.
// It is a very bad idea to force bilinear filtering on it. // It is a very bad idea to force bilinear filtering on it.
@ -906,6 +907,7 @@ void GSTextureCache::Surface::Update()
GSTextureCache::Source::Source(GSRenderer* r, const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, uint8* temp) GSTextureCache::Source::Source(GSRenderer* r, const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, uint8* temp)
: Surface(r, temp) : Surface(r, temp)
, m_palette(NULL) , m_palette(NULL)
, m_alpha_palette(false)
, m_initpalette(true) , m_initpalette(true)
, m_target(false) , m_target(false)
, m_complete(false) , m_complete(false)

View File

@ -57,6 +57,7 @@ public:
public: public:
GSTexture* m_palette; GSTexture* m_palette;
bool m_alpha_palette; // in opengl palette value is either in red or alpha channel
bool m_initpalette; bool m_initpalette;
uint32 m_valid[MAX_PAGES]; // each uint32 bits map to the 32 blocks of that page uint32 m_valid[MAX_PAGES]; // each uint32 bits map to the 32 blocks of that page
uint32* m_clut; uint32* m_clut;