Progress on PSP paletted textures
Some checks failed
Build Dusk / run-tests (push) Failing after 19s
Build Dusk / build-linux (push) Failing after 17s
Build Dusk / build-psp (push) Failing after 21s
Build Dusk / build-gamecube (push) Failing after 19s
Build Dusk / build-wii (push) Failing after 15s

This commit is contained in:
2026-03-27 08:04:34 -05:00
parent 407620387d
commit 933949cc19
9 changed files with 60 additions and 38 deletions

View File

@@ -18,6 +18,7 @@ errorret_t textureInitGL(
const texturedata_t data
) {
glGenTextures(1, &texture->id);
errorChain(errorGLCheck());
glBindTexture(GL_TEXTURE_2D, texture->id);
errorChain(errorGLCheck());
@@ -27,11 +28,12 @@ errorret_t textureInitGL(
GL_TEXTURE_2D, 0, format, width, height, 0,
format, GL_UNSIGNED_BYTE, (void*)data.rgbaColors
);
errorChain(errorGLCheck());
break;
case TEXTURE_FORMAT_PALETTE:
assertNotNull(data.paletted.indices, "Palette indices cannot be NULL");
assertNotNull(data.paletted.palette, "Palette colors cannot be NULL");
texture->palette = data.paletted.palette;
#ifdef DUSK_OPENGL_LEGACY
glTexImage2D(
GL_TEXTURE_2D,
@@ -40,12 +42,13 @@ errorret_t textureInitGL(
0, GL_COLOR_INDEX8_EXT,
GL_UNSIGNED_BYTE, (void*)data.paletted.indices
);
errorChain(errorGLCheck());
glColorTableEXT(
GL_TEXTURE_2D, GL_RGBA, data.paletted.palette->count, GL_RGBA,
GL_UNSIGNED_BYTE, (const void*)data.paletted.palette->colors
GL_TEXTURE_2D, GL_RGBA, texture->palette->count, GL_RGBA,
GL_UNSIGNED_BYTE, (const void*)texture->palette->colors
);
errorChain(errorGLCheck());
#else
// For modern systems we send to only the R channel and the shader does
// the rest.
@@ -54,7 +57,6 @@ errorret_t textureInitGL(
GL_RED, GL_UNSIGNED_BYTE, (void*)data.paletted.indices
);
errorChain(errorGLCheck());
texture->palette = data.paletted.palette;
#endif
break;
@@ -65,8 +67,11 @@ errorret_t textureInitGL(
errorChain(errorGLCheck());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
errorChain(errorGLCheck());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
errorChain(errorGLCheck());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
errorChain(errorGLCheck());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
errorChain(errorGLCheck());