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)
|
ShadowMapFragmentShader(const opengl::GLInfo & _glinfo)
|
||||||
{
|
{
|
||||||
m_part =
|
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 = 0, r32ui) highp uniform readonly uimage2D uZlutImage;\n"
|
||||||
"layout(binding = 1, r32ui) highp uniform readonly uimage2D uTlutImage;\n"
|
"layout(binding = 1, r32ui) highp uniform readonly uimage2D uTlutImage;\n"
|
||||||
#endif
|
|
||||||
"layout(binding = 0) uniform sampler2D uDepthImage; \n"
|
"layout(binding = 0) uniform sampler2D uDepthImage; \n"
|
||||||
"uniform lowp vec4 uFogColor; \n"
|
"uniform lowp vec4 uFogColor; \n"
|
||||||
"OUT lowp vec4 fragColor; \n"
|
"OUT lowp vec4 fragColor; \n"
|
||||||
|
|
|
@ -464,10 +464,10 @@ protected:
|
||||||
depthImageType = GL_FLOAT;
|
depthImageType = GL_FLOAT;
|
||||||
depthImageFormatBytes = 8;
|
depthImageFormatBytes = 8;
|
||||||
|
|
||||||
lutInternalFormat = GL_R16;
|
lutInternalFormat = GL_R32UI;
|
||||||
lutFormat = GL_RED;
|
lutFormat = GL_RED_INTEGER;
|
||||||
lutType = GL_UNSIGNED_SHORT;
|
lutType = GL_UNSIGNED_INT;
|
||||||
lutFormatBytes = 2;
|
lutFormatBytes = 4;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ void PaletteTexture::init()
|
||||||
if (!Context::imageTextures)
|
if (!Context::imageTextures)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats();
|
||||||
|
|
||||||
m_paletteCRC256 = 0;
|
m_paletteCRC256 = 0;
|
||||||
m_pTexture = textureCache().addFrameBufferTexture(false);
|
m_pTexture = textureCache().addFrameBufferTexture(false);
|
||||||
m_pTexture->format = G_IM_FMT_IA;
|
m_pTexture->format = G_IM_FMT_IA;
|
||||||
|
@ -34,15 +36,9 @@ void PaletteTexture::init()
|
||||||
m_pTexture->mirrorT = 0;
|
m_pTexture->mirrorT = 0;
|
||||||
m_pTexture->realWidth = 256;
|
m_pTexture->realWidth = 256;
|
||||||
m_pTexture->realHeight = 1;
|
m_pTexture->realHeight = 1;
|
||||||
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight;
|
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight * fbTexFormats.lutFormatBytes;
|
||||||
#ifdef GLESX
|
|
||||||
m_pTexture->textureBytes *= sizeof(u32);
|
|
||||||
#else
|
|
||||||
m_pTexture->textureBytes *= sizeof(u16);
|
|
||||||
#endif
|
|
||||||
textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes);
|
textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes);
|
||||||
|
|
||||||
const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats();
|
|
||||||
Context::InitTextureParams initParams;
|
Context::InitTextureParams initParams;
|
||||||
initParams.handle = m_pTexture->name;
|
initParams.handle = m_pTexture->name;
|
||||||
initParams.ImageUnit = textureImageUnits::Tlut;
|
initParams.ImageUnit = textureImageUnits::Tlut;
|
||||||
|
@ -99,11 +95,7 @@ void PaletteTexture::update()
|
||||||
|
|
||||||
PixelBufferBinder<PixelWriteBuffer> binder(m_pbuf.get());
|
PixelBufferBinder<PixelWriteBuffer> binder(m_pbuf.get());
|
||||||
u8* ptr = (u8*)m_pbuf->getWriteBuffer(m_pTexture->textureBytes);
|
u8* ptr = (u8*)m_pbuf->getWriteBuffer(m_pTexture->textureBytes);
|
||||||
#ifdef GLESX
|
|
||||||
u32 * palette = (u32*)ptr;
|
u32 * palette = (u32*)ptr;
|
||||||
#else
|
|
||||||
u16 * palette = (u16*)ptr;
|
|
||||||
#endif
|
|
||||||
u16 *src = (u16*)&TMEM[256];
|
u16 *src = (u16*)&TMEM[256];
|
||||||
for (int i = 0; i < 256; ++i)
|
for (int i = 0; i < 256; ++i)
|
||||||
palette[i] = swapword(src[i * 4]);
|
palette[i] = swapword(src[i * 4]);
|
||||||
|
|
|
@ -21,16 +21,10 @@ void ZlutTexture::init()
|
||||||
|
|
||||||
const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats();
|
const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats();
|
||||||
|
|
||||||
const void * zLUT;
|
std::vector<u32> vecZLUT(0x40000);
|
||||||
if (fbTexFormats.lutFormatBytes == 4) {
|
const u16 * const zLUT16 = depthBufferList().getZLUT();
|
||||||
std::vector<u32> vecZLUT(0x40000);
|
for (u32 i = 0; i < 0x40000; ++i)
|
||||||
const u16 * const zLUT16 = depthBufferList().getZLUT();
|
vecZLUT[i] = zLUT16[i];
|
||||||
for (u32 i = 0; i < 0x40000; ++i)
|
|
||||||
vecZLUT[i] = zLUT16[i];
|
|
||||||
zLUT = vecZLUT.data();
|
|
||||||
} else {
|
|
||||||
zLUT = depthBufferList().getZLUT();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pTexture = textureCache().addFrameBufferTexture(false);
|
m_pTexture = textureCache().addFrameBufferTexture(false);
|
||||||
m_pTexture->format = G_IM_FMT_IA;
|
m_pTexture->format = G_IM_FMT_IA;
|
||||||
|
@ -54,7 +48,7 @@ void ZlutTexture::init()
|
||||||
initParams.internalFormat = fbTexFormats.lutInternalFormat;
|
initParams.internalFormat = fbTexFormats.lutInternalFormat;
|
||||||
initParams.format = fbTexFormats.lutFormat;
|
initParams.format = fbTexFormats.lutFormat;
|
||||||
initParams.dataType = fbTexFormats.lutType;
|
initParams.dataType = fbTexFormats.lutType;
|
||||||
initParams.data = zLUT;
|
initParams.data = vecZLUT.data();
|
||||||
gfxContext.init2DTexture(initParams);
|
gfxContext.init2DTexture(initParams);
|
||||||
|
|
||||||
Context::TexParameters setParams;
|
Context::TexParameters setParams;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user