mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Change format for zLUT and palette image textures.
It is now the same as for GLES 3.
This commit is contained in:
parent
dc35b3a0fe
commit
f832894965
|
@ -56,13 +56,8 @@ namespace glsl {
|
|||
ShadowMapFragmentShader(const opengl::GLInfo & _glinfo)
|
||||
{
|
||||
m_part =
|
||||
#ifndef GLESX
|
||||
"layout(binding = 0, r16ui) uniform readonly uimage2D uZlutImage;\n"
|
||||
"layout(binding = 1, r16ui) uniform readonly uimage2D uTlutImage;\n"
|
||||
#else
|
||||
"layout(binding = 0, r32ui) highp uniform readonly uimage2D uZlutImage;\n"
|
||||
"layout(binding = 1, r32ui) highp uniform readonly uimage2D uTlutImage;\n"
|
||||
#endif
|
||||
"layout(binding = 0) uniform sampler2D uDepthImage; \n"
|
||||
"uniform lowp vec4 uFogColor; \n"
|
||||
"OUT lowp vec4 fragColor; \n"
|
||||
|
|
|
@ -464,10 +464,10 @@ protected:
|
|||
depthImageType = GL_FLOAT;
|
||||
depthImageFormatBytes = 8;
|
||||
|
||||
lutInternalFormat = GL_R16;
|
||||
lutFormat = GL_RED;
|
||||
lutType = GL_UNSIGNED_SHORT;
|
||||
lutFormatBytes = 2;
|
||||
lutInternalFormat = GL_R32UI;
|
||||
lutFormat = GL_RED_INTEGER;
|
||||
lutType = GL_UNSIGNED_INT;
|
||||
lutFormatBytes = 4;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ void PaletteTexture::init()
|
|||
if (!Context::imageTextures)
|
||||
return;
|
||||
|
||||
const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats();
|
||||
|
||||
m_paletteCRC256 = 0;
|
||||
m_pTexture = textureCache().addFrameBufferTexture(false);
|
||||
m_pTexture->format = G_IM_FMT_IA;
|
||||
|
@ -34,15 +36,9 @@ void PaletteTexture::init()
|
|||
m_pTexture->mirrorT = 0;
|
||||
m_pTexture->realWidth = 256;
|
||||
m_pTexture->realHeight = 1;
|
||||
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight;
|
||||
#ifdef GLESX
|
||||
m_pTexture->textureBytes *= sizeof(u32);
|
||||
#else
|
||||
m_pTexture->textureBytes *= sizeof(u16);
|
||||
#endif
|
||||
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight * fbTexFormats.lutFormatBytes;
|
||||
textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes);
|
||||
|
||||
const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats();
|
||||
Context::InitTextureParams initParams;
|
||||
initParams.handle = m_pTexture->name;
|
||||
initParams.ImageUnit = textureImageUnits::Tlut;
|
||||
|
@ -99,11 +95,7 @@ void PaletteTexture::update()
|
|||
|
||||
PixelBufferBinder<PixelWriteBuffer> binder(m_pbuf.get());
|
||||
u8* ptr = (u8*)m_pbuf->getWriteBuffer(m_pTexture->textureBytes);
|
||||
#ifdef GLESX
|
||||
u32 * palette = (u32*)ptr;
|
||||
#else
|
||||
u16 * palette = (u16*)ptr;
|
||||
#endif
|
||||
u16 *src = (u16*)&TMEM[256];
|
||||
for (int i = 0; i < 256; ++i)
|
||||
palette[i] = swapword(src[i * 4]);
|
||||
|
|
|
@ -21,16 +21,10 @@ void ZlutTexture::init()
|
|||
|
||||
const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats();
|
||||
|
||||
const void * zLUT;
|
||||
if (fbTexFormats.lutFormatBytes == 4) {
|
||||
std::vector<u32> vecZLUT(0x40000);
|
||||
const u16 * const zLUT16 = depthBufferList().getZLUT();
|
||||
for (u32 i = 0; i < 0x40000; ++i)
|
||||
vecZLUT[i] = zLUT16[i];
|
||||
zLUT = vecZLUT.data();
|
||||
} else {
|
||||
zLUT = depthBufferList().getZLUT();
|
||||
}
|
||||
std::vector<u32> vecZLUT(0x40000);
|
||||
const u16 * const zLUT16 = depthBufferList().getZLUT();
|
||||
for (u32 i = 0; i < 0x40000; ++i)
|
||||
vecZLUT[i] = zLUT16[i];
|
||||
|
||||
m_pTexture = textureCache().addFrameBufferTexture(false);
|
||||
m_pTexture->format = G_IM_FMT_IA;
|
||||
|
@ -54,7 +48,7 @@ void ZlutTexture::init()
|
|||
initParams.internalFormat = fbTexFormats.lutInternalFormat;
|
||||
initParams.format = fbTexFormats.lutFormat;
|
||||
initParams.dataType = fbTexFormats.lutType;
|
||||
initParams.data = zLUT;
|
||||
initParams.data = vecZLUT.data();
|
||||
gfxContext.init2DTexture(initParams);
|
||||
|
||||
Context::TexParameters setParams;
|
||||
|
|
Loading…
Reference in New Issue
Block a user