- the harmless changes of the failed refactoring of the shader.

This commit is contained in:
Christoph Oelckers 2019-10-06 19:32:35 +02:00
parent e94ed3abf2
commit ef2de97077
11 changed files with 25 additions and 32 deletions

View file

@ -230,7 +230,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
int nFrames = Smacker_GetNumFrames(hSMK); int nFrames = Smacker_GetNumFrames(hSMK);
Smacker_GetPalette(hSMK, palette); Smacker_GetPalette(hSMK, palette);
paletteSetColorTable(kSMKPal, palette); paletteSetColorTable(kSMKPal, palette, true);
videoSetPalette(gBrightness>>2, kSMKPal, 8+2); videoSetPalette(gBrightness>>2, kSMKPal, 8+2);
int nScale; int nScale;
@ -271,7 +271,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
videoClearScreen(0); videoClearScreen(0);
Smacker_GetPalette(hSMK, palette); Smacker_GetPalette(hSMK, palette);
paletteSetColorTable(kSMKPal, palette); paletteSetColorTable(kSMKPal, palette, true);
videoSetPalette(gBrightness >> 2, kSMKPal, 0); videoSetPalette(gBrightness >> 2, kSMKPal, 0);
tileInvalidate(kSMKTile, 0, 1 << 4); // JBF 20031228 tileInvalidate(kSMKTile, 0, 1 << 4); // JBF 20031228
Smacker_GetFrame(hSMK, pFrame); Smacker_GetFrame(hSMK, pFrame);

View file

@ -33,8 +33,16 @@ extern const char *(paletteGetBlendTable) (int32_t blend);
#endif #endif
extern uint32_t PaletteIndexFullbrights[8]; extern uint32_t PaletteIndexFullbrights[8];
#define IsPaletteIndexFullbright(col) (PaletteIndexFullbrights[(col)>>5] & (1u<<((col)&31)))
#define SetPaletteIndexFullbright(col) (PaletteIndexFullbrights[(col)>>5] |= (1u<<((col)&31))) inline bool IsPaletteIndexFullbright(uint8_t col)
{
return (PaletteIndexFullbrights[col >> 5] & (1u << (col & 31)));
}
inline void SetPaletteIndexFullbright(int col)
{
PaletteIndexFullbrights[col >> 5] |= (1u << (col & 31));
}
typedef struct { typedef struct {
uint8_t r, g, b, f; uint8_t r, g, b, f;
@ -49,7 +57,7 @@ extern void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f);
extern void fullscreen_tint_gl_blood(void); extern void fullscreen_tint_gl_blood(void);
extern void videoFadeToBlack(int32_t moreopaquep); extern void videoFadeToBlack(int32_t moreopaquep);
void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uint8_t g, uint8_t b, char noFloorPal); void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uint8_t g, uint8_t b, char noFloorPal);
void paletteSetColorTable(int32_t id, uint8_t const *table); void paletteSetColorTable(int32_t id, uint8_t const *table, bool transient = false);
void paletteFreeColorTable(int32_t id); void paletteFreeColorTable(int32_t id);
void paletteSetBlendTable(int32_t blend, const char *tab); void paletteSetBlendTable(int32_t blend, const char *tab);
void paletteFreeBlendTable(int32_t blend); void paletteFreeBlendTable(int32_t blend);

View file

@ -34,7 +34,7 @@ void polymost_outputGLDebugMessage(uint8_t severity, const char* format, ...);
//void phex(char v, char *s); //void phex(char v, char *s);
void uploadtexture(FHardwareTexture *tex, int32_t doalloc, vec2_t siz, int32_t texfmt, coltype *pic, vec2_t tsiz, int32_t dameth); void uploadtexture(FHardwareTexture *tex, int32_t doalloc, vec2_t siz, int32_t texfmt, coltype *pic, vec2_t tsiz, int32_t dameth);
void uploadbasepalette(int32_t basepalnum); void uploadbasepalette(int32_t basepalnum, bool transient = false);
void uploadpalswap(int32_t palookupnum); void uploadpalswap(int32_t palookupnum);
void polymost_drawsprite(int32_t snum); void polymost_drawsprite(int32_t snum);
void polymost_drawmaskwall(int32_t damaskwallcnt); void polymost_drawmaskwall(int32_t damaskwallcnt);

View file

@ -2165,10 +2165,6 @@ int osdcmd_cvar_set(osdcmdptr_t parm)
fallthrough__; fallthrough__;
case CVAR_INVALIDATEART: case CVAR_INVALIDATEART:
gltexinvalidatetype(INVALIDATE_ART); gltexinvalidatetype(INVALIDATE_ART);
#ifdef POLYMER
if (videoGetRenderMode() == REND_POLYMER)
polymer_texinvalidate();
#endif
break; break;
} }
} }

View file

@ -708,7 +708,7 @@ void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uin
// //
// setbasepal // setbasepal
// //
void paletteSetColorTable(int32_t id, uint8_t const * const table) void paletteSetColorTable(int32_t id, uint8_t const * const table, bool transient)
{ {
if (basepaltable[id] == NULL) if (basepaltable[id] == NULL)
basepaltable[id] = (uint8_t *) Xmalloc(768); basepaltable[id] = (uint8_t *) Xmalloc(768);
@ -718,7 +718,7 @@ void paletteSetColorTable(int32_t id, uint8_t const * const table)
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST) if (videoGetRenderMode() >= REND_POLYMOST)
{ {
uploadbasepalette(id); uploadbasepalette(id, transient);
} }
#endif #endif
} }
@ -811,6 +811,7 @@ void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags)
g_lastpalettesum = lastpalettesum = newpalettesum; g_lastpalettesum = lastpalettesum = newpalettesum;
#if 0
if (videoGetRenderMode() >= REND_POLYMOST) if (videoGetRenderMode() >= REND_POLYMOST)
{ {
// Only reset the textures if the corresponding preserve flags are clear and // Only reset the textures if the corresponding preserve flags are clear and
@ -826,6 +827,7 @@ void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags)
if (!(flags&8) && doinvalidate) if (!(flags&8) && doinvalidate)
gltexinvalidatetype(INVALIDATE_ART_NON_INDEXED); gltexinvalidatetype(INVALIDATE_ART_NON_INDEXED);
} }
#endif
if ((flags&16)==0) if ((flags&16)==0)
{ {

View file

@ -131,9 +131,6 @@ int32_t r_flatsky = 1;
static float fogresult, fogresult2; static float fogresult, fogresult2;
coltypef fogcol, fogtable[MAXPALOOKUPS]; coltypef fogcol, fogtable[MAXPALOOKUPS];
static GLenum currentActiveTexture = 0;
static uint32_t currentTextureID = 0;
static GLuint quadVertsID = 0; static GLuint quadVertsID = 0;
@ -142,8 +139,6 @@ int32_t r_useindexedcolortextures = -1;
static int32_t lastbasepal = -1; static int32_t lastbasepal = -1;
static FHardwareTexture *paletteTextureIDs[MAXBASEPALS]; static FHardwareTexture *paletteTextureIDs[MAXBASEPALS];
static FHardwareTexture *palswapTextureID = nullptr; static FHardwareTexture *palswapTextureID = nullptr;
//extern char const *polymost1Frag;
//extern char const *polymost1Vert;
static inline float float_trans(uint32_t maskprops, uint8_t blend) static inline float float_trans(uint32_t maskprops, uint8_t blend)
{ {
@ -377,10 +372,6 @@ void polymost_glinit()
{ {
globalflags |= GLOBAL_NO_GL_TILESHADES; // This re-enables the old fading logic without re-adding the r_usetileshades variable. The entire thing will have to be done on a more abstract level anyway. globalflags |= GLOBAL_NO_GL_TILESHADES; // This re-enables the old fading logic without re-adding the r_usetileshades variable. The entire thing will have to be done on a more abstract level anyway.
currentTextureID = 0;
char allPacked = false;
lastbasepal = -1; lastbasepal = -1;
for (int basepalnum = 0; basepalnum < MAXBASEPALS; ++basepalnum) for (int basepalnum = 0; basepalnum < MAXBASEPALS; ++basepalnum)
{ {
@ -696,7 +687,7 @@ void uploadtexture(FHardwareTexture *tex, int32_t doalloc, vec2_t siz, int32_t t
tex->LoadTexture((uint8_t *)pic); tex->LoadTexture((uint8_t *)pic);
} }
void uploadbasepalette(int32_t basepalnum) void uploadbasepalette(int32_t basepalnum, bool transient) // transient palettes are used by movies and should not affect the engine state. All other palettes only get set at game startup.
{ {
if (!basepaltable[basepalnum]) if (!basepaltable[basepalnum])
{ {
@ -1459,11 +1450,6 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
float pc[4]; float pc[4];
#ifdef POLYMER
if (videoGetRenderMode() == REND_POLYMER && pr_artmapping && !(globalflags & GLOBAL_NO_GL_TILESHADES) && polymer_eligible_for_artmap(globalpicnum, pth))
pc[0] = pc[1] = pc[2] = 1.0f;
else
#endif
{ {
polytint_t const & tint = hictinting[globalpal]; polytint_t const & tint = hictinting[globalpal];
float shadeFactor = (pth->flags & PTH_INDEXED) && float shadeFactor = (pth->flags & PTH_INDEXED) &&

View file

@ -465,7 +465,7 @@ int32_t Anim_Play(const char *fn)
goto end_anim; goto end_anim;
} }
paletteSetColorTable(ANIMPAL, ANIM_GetPalette()); paletteSetColorTable(ANIMPAL, ANIM_GetPalette(), true);
// setpalette(0L,256L,tempbuf); // setpalette(0L,256L,tempbuf);
// setbrightness(ud.brightness>>2,tempbuf,2); // setbrightness(ud.brightness>>2,tempbuf,2);

View file

@ -39,8 +39,8 @@
** **
*/ */
#include <memory> #include <memory>
#include "glbackend.h"
#include "glad/glad.h" #include "glad/glad.h"
#include "glbackend.h"
#include "gl_shader.h" #include "gl_shader.h"
#include "zstring.h" #include "zstring.h"

View file

@ -1,6 +1,6 @@
#include <memory> #include <memory>
#include "glbackend.h"
#include "glad/glad.h" #include "glad/glad.h"
#include "glbackend.h"
#include "gl_samplers.h" #include "gl_samplers.h"
#include "gl_shader.h" #include "gl_shader.h"

View file

@ -7,6 +7,7 @@
#include "gl_hwtexture.h" #include "gl_hwtexture.h"
#include "gl_renderstate.h" #include "gl_renderstate.h"
#include "matrix.h" #include "matrix.h"
#include "palentry.h"
class FSamplerManager; class FSamplerManager;
class FShader; class FShader;

View file

@ -499,7 +499,7 @@ int32_t Anim_Play(const char *fn)
goto end_anim; goto end_anim;
} }
paletteSetColorTable(ANIMPAL, ANIM_GetPalette()); paletteSetColorTable(ANIMPAL, ANIM_GetPalette(), true);
// setpalette(0L,256L,tempbuf); // setpalette(0L,256L,tempbuf);
// setbrightness(ud.brightness>>2,tempbuf,2); // setbrightness(ud.brightness>>2,tempbuf,2);