From 8ccf552d09418b2912b740d1957cce57ff276d75 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 11 May 2011 04:16:45 +0000 Subject: [PATCH] - Added r_shadercolormaps cvar. Set it to false to disable shaders for fixed colormap effects (e.g. invulnerability). This should only be necessary for SM1.4 cards with buggy drivers. I doubt the problem is very widespread. The one piece of SM1.4 hardware I obtained specifically for testing purposes has no problems using shaders for these effects. SVN r3200 (trunk) --- src/r_main.cpp | 10 +++++++++- src/r_things.cpp | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/r_main.cpp b/src/r_main.cpp index 9e3a23a02..226480009 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -113,6 +113,7 @@ CVAR (String, r_viewsize, "", CVAR_NOSET) CVAR (Int, r_polymost, 0, 0) CVAR (Bool, r_deathcamera, false, CVAR_ARCHIVE) CVAR (Int, r_clearbuffer, 0, 0) +CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE) fixed_t r_BaseVisibility; fixed_t r_WallVisibility; @@ -1259,7 +1260,7 @@ void R_SetupFrame (AActor *actor) if (player->fixedcolormap >= 0 && player->fixedcolormap < (int)SpecialColormaps.Size()) { realfixedcolormap = &SpecialColormaps[player->fixedcolormap]; - if (RenderTarget == screen && (DFrameBuffer *)screen->Accel2D) + if (RenderTarget == screen && (DFrameBuffer *)screen->Accel2D && r_shadercolormaps) { // Render everything fullbright. The copy to video memory will // apply the special colormap, so it won't be restricted to the @@ -1649,6 +1650,13 @@ void R_RenderActorView (AActor *actor, bool dontmaplines) WallMirrors.Clear (); interpolator.RestoreInterpolations (); R_SetupBuffer (); + + // If we don't want shadered colormaps, NULL it now so that the + // copy to the screen does not use a special colormap shader. + if (!r_shadercolormaps) + { + realfixedcolormap = NULL; + } } //========================================================================== diff --git a/src/r_things.cpp b/src/r_things.cpp index e07cfd25f..bd2122ebd 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -68,7 +68,7 @@ extern fixed_t globaluclip, globaldclip; EXTERN_CVAR (Bool, st_scale) CVAR (Int, r_drawfuzz, 1, CVAR_ARCHIVE) - +EXTERN_CVAR(Bool, r_shadercolormaps) // // Sprite rotation 0 is facing the viewer, @@ -2288,7 +2288,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ // If not, then don't bother trying to identify it for // hardware accelerated drawing. if (vis->colormap < SpecialColormaps[0].Colormap || - vis->colormap >= SpecialColormaps[SpecialColormaps.Size()].Colormap) + vis->colormap > SpecialColormaps.Last().Colormap) { noaccel = true; } @@ -2301,6 +2301,13 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ } } } + // If we're drawing with a special colormap, but shaders for them are disabled, do + // not accelerate. + if (!r_shadercolormaps && (vis->colormap >= SpecialColormaps[0].Colormap && + vis->colormap <= SpecialColormaps.Last().Colormap)) + { + noaccel = true; + } // If the main colormap has fixed lights, and this sprite is being drawn with that // colormap, disable acceleration so that the lights can remain fixed. if (!noaccel &&