mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
Fix palette tonemap precision and compile error on Intel
This commit is contained in:
parent
4eda5f841e
commit
dc39a006dc
2 changed files with 4 additions and 4 deletions
|
@ -257,7 +257,7 @@ void FGLRenderer::BindTonemapPalette(int texunit)
|
||||||
{
|
{
|
||||||
for (int b = 0; b < 64; b++)
|
for (int b = 0; b < 64; b++)
|
||||||
{
|
{
|
||||||
PalEntry color = GPalette.BaseColors[ColorMatcher.Pick((r << 2) | (r >> 1), (g << 2) | (g >> 1), (b << 2) | (b >> 1))];
|
PalEntry color = GPalette.BaseColors[ColorMatcher.Pick((r << 2) | (r >> 4), (g << 2) | (g >> 4), (b << 2) | (b >> 4))];
|
||||||
int index = ((r * 64 + g) * 64 + b) * 4;
|
int index = ((r * 64 + g) * 64 + b) * 4;
|
||||||
lut[index] = color.r;
|
lut[index] = color.r;
|
||||||
lut[index + 1] = color.g;
|
lut[index + 1] = color.g;
|
||||||
|
|
|
@ -69,15 +69,15 @@ uniform sampler2D PaletteLUT;
|
||||||
|
|
||||||
vec3 Tonemap(vec3 color)
|
vec3 Tonemap(vec3 color)
|
||||||
{
|
{
|
||||||
ivec3 c = ivec3(clamp(color.rgb, vec3(0.0), vec3(1.0)) * 255.0 + 0.5);
|
ivec3 c = ivec3(clamp(color.rgb, vec3(0.0), vec3(1.0)) * 63.0 + 0.5);
|
||||||
int index = ((c.r >> 2) * 64 + (c.g >> 2)) * 64 + (c.b >> 2);
|
int index = (c.r * 64 + c.g) * 64 + c.b;
|
||||||
int tx = index % 512;
|
int tx = index % 512;
|
||||||
int ty = index / 512;
|
int ty = index / 512;
|
||||||
return texelFetch(PaletteLUT, ivec2(tx, ty), 0).rgb;
|
return texelFetch(PaletteLUT, ivec2(tx, ty), 0).rgb;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error "Tonemap mode define is missing"
|
#error Tonemap mode define is missing
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
|
|
Loading…
Reference in a new issue