From 5af0217db71d43935f009adb533cedc20a57f63e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Mar 2020 17:23:57 +0200 Subject: [PATCH] - got rid of the software rendering blend tables. --- source/blood/src/screen.cpp | 2 - source/build/include/build.h | 1 - source/build/include/palette.h | 4 - source/build/src/defs.cpp | 15 ---- source/build/src/engine.cpp | 4 - source/build/src/palette.cpp | 85 +------------------ .../static/engine/shaders/glsl/glsurface.fp | 21 ----- .../static/engine/shaders/glsl/glsurface.vp | 13 --- 8 files changed, 2 insertions(+), 143 deletions(-) delete mode 100644 wadsrc/static/engine/shaders/glsl/glsurface.fp delete mode 100644 wadsrc/static/engine/shaders/glsl/glsurface.vp diff --git a/source/blood/src/screen.cpp b/source/blood/src/screen.cpp index b088fe641..6983dd48f 100644 --- a/source/blood/src/screen.cpp +++ b/source/blood/src/screen.cpp @@ -165,7 +165,6 @@ void scrLoadPalette(void) DICTNODE *pTrans = gSysRes.Lookup("TRANS", "TLU"); if (!pTrans) ThrowError("TRANS.TLU not found"); - blendtable[0] = (char*)gSysRes.Lock(pTrans); paletteloaded |= PALETTE_TRANSLUC; palettePostLoadTables(); @@ -241,7 +240,6 @@ void scrInit(void) void scrUnInit(void) { memset(palookup, 0, sizeof(palookup)); - memset(blendtable, 0, sizeof(blendtable)); } diff --git a/source/build/include/build.h b/source/build/include/build.h index 82b5c7e82..31a881fc0 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -541,7 +541,6 @@ EXTERN int16_t numshades; EXTERN char *palookup[MAXPALOOKUPS]; extern uint8_t *basepaltable[MAXBASEPALS]; EXTERN uint8_t paletteloaded; -EXTERN char *blendtable[MAXBLENDTABS]; EXTERN uint8_t whitecol, redcol, blackcol; EXTERN int32_t maxspritesonscreen; diff --git a/source/build/include/palette.h b/source/build/include/palette.h index c858f05e7..7ed31ce19 100644 --- a/source/build/include/palette.h +++ b/source/build/include/palette.h @@ -27,8 +27,6 @@ extern uint8_t curbasepal; -#define paletteGetBlendTable(blend) (blendtable[blend]) - extern uint8_t PaletteIndexFullbrights[32]; @@ -56,8 +54,6 @@ void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uin void paletteSetColorTable(int32_t id, uint8_t const *table, bool transient = false); void paletteFreeColorTable(int32_t id); void paletteFreeColorTables(); -void paletteSetBlendTable(int32_t blend, const char *tab); -void paletteFreeBlendTable(int32_t blend); int32_t paletteSetLookupTable(int32_t palnum, const uint8_t *shtab); void paletteFreeLookupTable(int32_t palnum); diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 6172a7afa..f6c94606f 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -3116,7 +3116,6 @@ static int32_t defsparser(scriptfile *script) break; } - paletteSetBlendTable(id, (char*)blendbuf.Data()); didLoadTransluc = 1; break; } @@ -3132,15 +3131,6 @@ static int32_t defsparser(scriptfile *script) break; } - char const * const sourcetable = blendtable[source]; - if (EDUKE32_PREDICT_FALSE(sourcetable == NULL)) - { - initprintf("Error: blendtable: Source blendtable does not exist on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - - paletteSetBlendTable(id, sourcetable); didLoadTransluc = 1; #ifdef USE_OPENGL @@ -3150,8 +3140,6 @@ static int32_t defsparser(scriptfile *script) } case T_UNDEF: { - paletteFreeBlendTable(id); - didLoadTransluc = 0; if (id == 0) paletteloaded &= ~PALETTE_TRANSLUC; @@ -3382,9 +3370,6 @@ static int32_t defsparser(scriptfile *script) break; } - for (bssize_t i = id0; i <= id1; i++) - paletteFreeBlendTable(i); - if (id0 == 0) paletteloaded &= ~PALETTE_TRANSLUC; } diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index e7a628796..a373b83e7 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -2211,10 +2211,6 @@ void engineUnInit(void) } Bmemset(palookup, 0, sizeof(palookup)); - for (bssize_t i=0; i= MAXBASEPALS ||*/ basepaltable[dapalid] == NULL) dapalid = 0; - paldidchange = (curbasepal != dapalid || basepalreset); curbasepal = dapalid; basepalreset = 0; - dapal = basepaltable[curbasepal]; + auto dapal = basepaltable[curbasepal]; // In-scene brightness mode for RR's thunderstorm. This shouldn't affect the global gamma ramp. if ((videoGetRenderMode() >= REND_POLYMOST) && (flags & Pal_SceneBrightness)) @@ -712,7 +632,6 @@ void videoSetPalette(int dabrightness, int dapalid, ESetPalFlags flags) { r_scenebrightness = 0; } - j = 0; // Assume that the backend can do it. for (i = 0; i < 256; i++) { diff --git a/wadsrc/static/engine/shaders/glsl/glsurface.fp b/wadsrc/static/engine/shaders/glsl/glsurface.fp deleted file mode 100644 index 4c0dc68a6..000000000 --- a/wadsrc/static/engine/shaders/glsl/glsurface.fp +++ /dev/null @@ -1,21 +0,0 @@ -#version 330 - -//s_texture points to an indexed color texture -uniform sampler2D s_texture; -//s_palette is the palette texture -uniform sampler2D s_palette; - -in vec2 v_texCoord; -out vec4 FragColor; - -const float c_paletteScale = 255.0/256.0; -const float c_paletteOffset = 0.5/256.0; - -void main() -{ - vec4 color = texture(s_texture, v_texCoord.xy); - color.r = c_paletteOffset + c_paletteScale*color.r; - color.rgb = texture(s_palette, color.rg).rgb; - - FragColor = color; -} diff --git a/wadsrc/static/engine/shaders/glsl/glsurface.vp b/wadsrc/static/engine/shaders/glsl/glsurface.vp deleted file mode 100644 index 19db847f1..000000000 --- a/wadsrc/static/engine/shaders/glsl/glsurface.vp +++ /dev/null @@ -1,13 +0,0 @@ -#version 330 - -in vec4 i_vertPos; -in vec4 i_texCoord; - -out vec2 v_texCoord; - -void main() -{ - gl_Position = i_vertPos; - v_texCoord = i_texCoord.st; -} -