From b8eb530a0d72c50bb88951ed25579c9575c20e2a Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 20 Sep 2009 03:50:05 +0000 Subject: [PATCH] - Fixed: Wall drawing handled fixed light levels improperly (but did not completely ignore them, either). - Separated light level fixing out of player_t's fixedcolormap parameter. Using a fixed light level (e.g. PowerTorch) will no longer wipe out colored lighting. - Moved the blending rectangle drawing into a separate discrete stage, since doing it while copying the 3D view window to the display now blends underneath the weapon instead of on top of it. - Consolidated the special colormaps into a single 2D table. - Tweaked the special colormaps slightly to make the true color results more closely match the paletted approximations. - fb_d3d9_shaders.h was getting unwieldy, so I moved the shaders out of the executable and into zdoom.pk3. Shaders are still precompiled so I don't need to pull in a dependancy on D3DX. - Added a few more shaders to accomodate drawing weapons with all the in-game lighting models. These are accessed with the new DrawTexture tags DTA_SpecialColormap and DTA_ColormapStyle. - Player weapon sprites are now drawn using Direct3D and receive all the benefits thereof. SVN r1858 (trunk) --- docs/rh-log.txt | 21 + src/d_main.cpp | 2 + src/d_player.h | 3 +- src/g_game.cpp | 3 +- src/g_shared/a_artifacts.cpp | 24 +- src/p_mobj.cpp | 3 +- src/p_user.cpp | 26 +- src/r_blend.h | 4 +- src/r_draw.cpp | 2 +- src/r_main.cpp | 38 +- src/r_main.h | 7 +- src/r_plane.cpp | 4 +- src/r_segs.cpp | 51 +- src/r_things.cpp | 216 +++-- src/r_things.h | 1 + src/textures/multipatchtexture.cpp | 8 +- src/v_draw.cpp | 10 + src/v_palette.cpp | 108 +-- src/v_palette.h | 37 +- src/v_video.cpp | 14 + src/v_video.h | 10 +- src/win32/fb_d3d9.cpp | 340 ++++++-- src/win32/fb_d3d9_shaders.h | 665 --------------- src/win32/fb_d3d9_wipe.cpp | 10 +- src/win32/win32iface.h | 48 +- wadsrc/static/shaders/d3d/build.bat | 10 + wadsrc/static/shaders/d3d/shaders.ps | 116 +++ wadsrc/static/shaders/d3d/sm14/BurnWipe.pso | Bin 0 -> 228 bytes .../shaders/d3d/sm14/InGameColormap.pso | Bin 0 -> 208 bytes .../shaders/d3d/sm14/InGameColormapDesat.pso | Bin 0 -> 320 bytes .../shaders/d3d/sm14/InGameColormapInv.pso | Bin 0 -> 268 bytes .../d3d/sm14/InGameColormapInvDesat.pso | Bin 0 -> 336 bytes .../shaders/d3d/sm14/InGameColormapPal.pso | Bin 0 -> 336 bytes .../d3d/sm14/InGameColormapPalDesat.pso | Bin 0 -> 432 bytes .../shaders/d3d/sm14/InGameColormapPalInv.pso | Bin 0 -> 380 bytes .../d3d/sm14/InGameColormapPalInvDesat.pso | Bin 0 -> 448 bytes .../static/shaders/d3d/sm14/NormalColor.pso | Bin 0 -> 180 bytes .../shaders/d3d/sm14/NormalColorInv.pso | Bin 0 -> 240 bytes .../shaders/d3d/sm14/NormalColorPal.pso | Bin 0 -> 308 bytes .../shaders/d3d/sm14/NormalColorPalInv.pso | Bin 0 -> 352 bytes wadsrc/static/shaders/d3d/sm14/RedToAlpha.pso | Bin 0 -> 212 bytes .../static/shaders/d3d/sm14/RedToAlphaInv.pso | Bin 0 -> 256 bytes .../shaders/d3d/sm14/SpecialColormap.pso | Bin 0 -> 248 bytes .../shaders/d3d/sm14/SpecialColormapInv.pso | Bin 0 -> 264 bytes .../shaders/d3d/sm14/SpecialColormapPal.pso | Bin 0 -> 372 bytes .../d3d/sm14/SpecialColormapPalInv.pso | Bin 0 -> 388 bytes .../static/shaders/d3d/sm14/VertexColor.pso | Bin 0 -> 116 bytes wadsrc/static/shaders/d3d/sm14/build.bat | 27 + wadsrc/static/shaders/d3d/sm20/BurnWipe.pso | Bin 0 -> 300 bytes .../shaders/d3d/sm20/GammaCorrection.pso | Bin 0 -> 328 bytes .../shaders/d3d/sm20/InGameColormap.pso | Bin 0 -> 256 bytes .../shaders/d3d/sm20/InGameColormapDesat.pso | Bin 0 -> 368 bytes .../shaders/d3d/sm20/InGameColormapInv.pso | Bin 0 -> 316 bytes .../d3d/sm20/InGameColormapInvDesat.pso | Bin 0 -> 384 bytes .../shaders/d3d/sm20/InGameColormapPal.pso | Bin 0 -> 396 bytes .../d3d/sm20/InGameColormapPalDesat.pso | Bin 0 -> 492 bytes .../shaders/d3d/sm20/InGameColormapPalInv.pso | Bin 0 -> 440 bytes .../d3d/sm20/InGameColormapPalInvDesat.pso | Bin 0 -> 508 bytes .../static/shaders/d3d/sm20/NormalColor.pso | Bin 0 -> 252 bytes .../shaders/d3d/sm20/NormalColorInv.pso | Bin 0 -> 312 bytes .../shaders/d3d/sm20/NormalColorPal.pso | Bin 0 -> 392 bytes .../shaders/d3d/sm20/NormalColorPalInv.pso | Bin 0 -> 436 bytes wadsrc/static/shaders/d3d/sm20/RedToAlpha.pso | Bin 0 -> 272 bytes .../static/shaders/d3d/sm20/RedToAlphaInv.pso | Bin 0 -> 328 bytes .../shaders/d3d/sm20/SpecialColormap.pso | Bin 0 -> 300 bytes .../shaders/d3d/sm20/SpecialColormapInv.pso | Bin 0 -> 316 bytes .../shaders/d3d/sm20/SpecialColormapPal.pso | Bin 0 -> 424 bytes .../d3d/sm20/SpecialColormapPalInv.pso | Bin 0 -> 440 bytes .../static/shaders/d3d/sm20/VertexColor.pso | Bin 0 -> 124 bytes wadsrc/static/shaders/d3d/sm20/build.bat | 27 + wadsrc/static/shaders/d3d/sm30/BurnWipe.pso | Bin 0 -> 300 bytes .../shaders/d3d/sm30/GammaCorrection.pso | Bin 0 -> 328 bytes .../shaders/d3d/sm30/InGameColormap.pso | Bin 0 -> 256 bytes .../shaders/d3d/sm30/InGameColormapDesat.pso | Bin 0 -> 368 bytes .../shaders/d3d/sm30/InGameColormapInv.pso | Bin 0 -> 316 bytes .../d3d/sm30/InGameColormapInvDesat.pso | Bin 0 -> 384 bytes .../shaders/d3d/sm30/InGameColormapPal.pso | Bin 0 -> 396 bytes .../d3d/sm30/InGameColormapPalDesat.pso | Bin 0 -> 492 bytes .../shaders/d3d/sm30/InGameColormapPalInv.pso | Bin 0 -> 440 bytes .../d3d/sm30/InGameColormapPalInvDesat.pso | Bin 0 -> 508 bytes .../static/shaders/d3d/sm30/NormalColor.pso | Bin 0 -> 240 bytes .../shaders/d3d/sm30/NormalColorInv.pso | Bin 0 -> 300 bytes .../shaders/d3d/sm30/NormalColorPal.pso | Bin 0 -> 380 bytes .../shaders/d3d/sm30/NormalColorPalInv.pso | Bin 0 -> 424 bytes wadsrc/static/shaders/d3d/sm30/RedToAlpha.pso | Bin 0 -> 240 bytes .../static/shaders/d3d/sm30/RedToAlphaInv.pso | Bin 0 -> 300 bytes .../shaders/d3d/sm30/SpecialColormap.pso | Bin 0 -> 300 bytes .../shaders/d3d/sm30/SpecialColormapInv.pso | Bin 0 -> 316 bytes .../shaders/d3d/sm30/SpecialColormapPal.pso | Bin 0 -> 424 bytes .../d3d/sm30/SpecialColormapPalInv.pso | Bin 0 -> 440 bytes .../static/shaders/d3d/sm30/VertexColor.pso | Bin 0 -> 124 bytes wadsrc/static/shaders/d3d/sm30/build.bat | 27 + zdoom.vcproj | 758 +++++++++--------- 93 files changed, 1260 insertions(+), 1360 deletions(-) delete mode 100644 src/win32/fb_d3d9_shaders.h create mode 100644 wadsrc/static/shaders/d3d/build.bat create mode 100644 wadsrc/static/shaders/d3d/shaders.ps create mode 100644 wadsrc/static/shaders/d3d/sm14/BurnWipe.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/InGameColormap.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/InGameColormapDesat.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/InGameColormapInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/InGameColormapInvDesat.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/InGameColormapPal.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/InGameColormapPalDesat.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/InGameColormapPalInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/InGameColormapPalInvDesat.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/NormalColor.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/NormalColorInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/NormalColorPal.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/NormalColorPalInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/RedToAlpha.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/RedToAlphaInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/SpecialColormap.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/SpecialColormapInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/SpecialColormapPal.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/SpecialColormapPalInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/VertexColor.pso create mode 100644 wadsrc/static/shaders/d3d/sm14/build.bat create mode 100644 wadsrc/static/shaders/d3d/sm20/BurnWipe.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/GammaCorrection.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/InGameColormap.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/InGameColormapDesat.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/InGameColormapInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/InGameColormapInvDesat.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/InGameColormapPal.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/InGameColormapPalDesat.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/InGameColormapPalInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/InGameColormapPalInvDesat.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/NormalColor.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/NormalColorInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/NormalColorPal.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/NormalColorPalInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/RedToAlpha.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/RedToAlphaInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/SpecialColormap.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/SpecialColormapInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/SpecialColormapPal.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/SpecialColormapPalInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/VertexColor.pso create mode 100644 wadsrc/static/shaders/d3d/sm20/build.bat create mode 100644 wadsrc/static/shaders/d3d/sm30/BurnWipe.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/GammaCorrection.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/InGameColormap.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/InGameColormapDesat.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/InGameColormapInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/InGameColormapInvDesat.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/InGameColormapPal.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/InGameColormapPalDesat.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/InGameColormapPalInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/InGameColormapPalInvDesat.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/NormalColor.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/NormalColorInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/NormalColorPal.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/NormalColorPalInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/RedToAlpha.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/RedToAlphaInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/SpecialColormap.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/SpecialColormapInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/SpecialColormapPal.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/SpecialColormapPalInv.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/VertexColor.pso create mode 100644 wadsrc/static/shaders/d3d/sm30/build.bat diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 4130b31486..f934e63cf6 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,24 @@ +September 19, 2009 +- Fixed: Wall drawing handled fixed light levels improperly (but did not + completely ignore them, either). +- Separated light level fixing out of player_t's fixedcolormap parameter. + Using a fixed light level (e.g. PowerTorch) will no longer wipe out + colored lighting. +- Moved the blending rectangle drawing into a separate discrete stage, since + doing it while copying the 3D view window to the display now blends + underneath the weapon instead of on top of it. +- Consolidated the special colormaps into a single 2D table. +- Tweaked the special colormaps slightly to make the true color results more + closely match the paletted approximations. +- fb_d3d9_shaders.h was getting unwieldy, so I moved the shaders out of the + executable and into zdoom.pk3. Shaders are still precompiled so I don't need + to pull in a dependancy on D3DX. +- Added a few more shaders to accomodate drawing weapons with all the in-game + lighting models. These are accessed with the new DrawTexture tags + DTA_SpecialColormap and DTA_ColormapStyle. +- Player weapon sprites are now drawn using Direct3D and receive all the + benefits thereof. + September 17, 2009 (Changes by Graf Zahl) - Fixed: Unmorphing while invulnerable was blocked. - Various cleanup changes. diff --git a/src/d_main.cpp b/src/d_main.cpp index 7c0a13aca4..6221c72981 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -681,6 +681,8 @@ void D_Display () SB_state = screen->GetPageCount(); BorderNeedRefresh = screen->GetPageCount(); } + R_DrawRemainingPlayerSprites(); + screen->DrawBlendingRect(); if (automapactive) { int saved_ST_Y = ST_Y; diff --git a/src/d_player.h b/src/d_player.h index 7c7becbe3a..fa936b5522 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -303,7 +303,8 @@ public: TObjPtr poisoner; // NULL for non-player actors TObjPtr attacker; // who did damage (NULL for floors) int extralight; // so gun flashes light up areas - int fixedcolormap; // can be set to REDCOLORMAP, etc. + short fixedcolormap; // can be set to REDCOLORMAP, etc. + short fixedlightlevel; pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc) int morphTics; // player is a chicken/pig if > 0 BYTE MorphedPlayerClass; // [MH] (for SBARINFO) class # for this player instance when morphed diff --git a/src/g_game.cpp b/src/g_game.cpp index 8555db2c49..43587bb084 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1195,7 +1195,8 @@ void G_PlayerFinishLevel (int player, EFinishLevelType mode, bool resetinventory p->mo->RenderStyle = STYLE_Normal; p->mo->alpha = FRACUNIT; p->extralight = 0; // cancel gun flashes - p->fixedcolormap = 0; // cancel ir goggles + p->fixedcolormap = NOFIXEDCOLORMAP; // cancel ir goggles + p->fixedlightlevel = -1; p->damagecount = 0; // no palette changes p->bonuscount = 0; p->poisoncount = 0; diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 147511f55e..5b7f016cf8 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -205,7 +205,7 @@ void APowerup::DoEffect () (BlendColor == GREENCOLOR && Owner->player->fixedcolormap == GREENCOLORMAP) || (BlendColor == BLUECOLOR && Owner->player->fixedcolormap == BLUECOLORMAP)) { - Owner->player->fixedcolormap = 0; + Owner->player->fixedcolormap = NOFIXEDCOLORMAP; } } } @@ -471,7 +471,7 @@ void APowerInvulnerable::EndEffect () if (Owner->player != NULL) { - Owner->player->fixedcolormap = 0; + Owner->player->fixedcolormap = NOFIXEDCOLORMAP; } } @@ -711,7 +711,7 @@ int APowerInvisibility::AlterWeaponSprite (vissprite_t *vis) if ((vis->alpha < TRANSLUC25 && special1 > 0) || (vis->alpha == 0)) { vis->alpha = clamp((OPAQUE - Strength), 0, OPAQUE); - vis->colormap = InverseColormap; + vis->colormap = SpecialColormaps[INVERSECOLORMAP]; } return -1; // This item is valid so another one shouldn't reset the translucency } @@ -830,11 +830,11 @@ void APowerLightAmp::DoEffect () { if (EffectTics > BLINKTHRESHOLD || (EffectTics & 8)) { - Owner->player->fixedcolormap = 1; + Owner->player->fixedlightlevel = 1; } else { - Owner->player->fixedcolormap = 0; + Owner->player->fixedlightlevel = -1; } } } @@ -849,7 +849,7 @@ void APowerLightAmp::EndEffect () { if (Owner != NULL && Owner->player != NULL && Owner->player->fixedcolormap < NUMCOLORMAPS) { - Owner->player->fixedcolormap = 0; + Owner->player->fixedlightlevel = -1; } } @@ -894,22 +894,22 @@ void APowerTorch::DoEffect () { if (NewTorch != 0) { - if (Owner->player->fixedcolormap + NewTorchDelta > 7 - || Owner->player->fixedcolormap + NewTorchDelta < 1 - || NewTorch == Owner->player->fixedcolormap) + if (Owner->player->fixedlightlevel + NewTorchDelta > 7 + || Owner->player->fixedlightlevel + NewTorchDelta < 0 + || NewTorch == Owner->player->fixedlightlevel) { NewTorch = 0; } else { - Owner->player->fixedcolormap += NewTorchDelta; + Owner->player->fixedlightlevel += NewTorchDelta; } } else { NewTorch = (pr_torch() & 7) + 1; - NewTorchDelta = (NewTorch == Owner->player->fixedcolormap) ? - 0 : ((NewTorch > Owner->player->fixedcolormap) ? 1 : -1); + NewTorchDelta = (NewTorch == Owner->player->fixedlightlevel) ? + 0 : ((NewTorch > Owner->player->fixedlightlevel) ? 1 : -1); } } } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 3f1874199d..b070adef11 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3899,7 +3899,8 @@ APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer) p->MorphStyle = 0; p->MorphExitFlash = NULL; p->extralight = 0; - p->fixedcolormap = 0; + p->fixedcolormap = NOFIXEDCOLORMAP; + p->fixedlightlevel = -1; p->viewheight = mobj->ViewHeight; p->inconsistant = 0; p->attacker = NULL; diff --git a/src/p_user.cpp b/src/p_user.cpp index 703b37867e..014d837d42 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2508,9 +2508,27 @@ void player_t::Serialize (FArchive &arc) << poisoncount << poisoner << attacker - << extralight - << fixedcolormap - << morphTics + << extralight; + if (SaveVersion < 1858) + { + int fixedmap; + arc << fixedmap; + fixedcolormap = NOFIXEDCOLORMAP; + fixedlightlev = -1; + if (fixedmap >= NUMCOLORMAPS) + { + fixedcolormap = fixedmap - NUMCOLORMAPS; + } + else if (fixedmap > 0) + { + fixedlightlev = fixedmap; + } + } + else + { + arc << fixedcolormap << fixedlightlev; + } + arc << morphTics << MorphedPlayerClass << MorphStyle << MorphExitFlash @@ -2532,7 +2550,7 @@ void player_t::Serialize (FArchive &arc) << ConversationPC << ConversationNPCAngle << ConversationFaceTalker; - + for (i = 0; i < MAXPLAYERS; i++) arc << frags[i]; for (i = 0; i < NUMPSPRITES; i++) diff --git a/src/r_blend.h b/src/r_blend.h index fbc478c121..132d09507e 100644 --- a/src/r_blend.h +++ b/src/r_blend.h @@ -114,10 +114,10 @@ union FRenderStyle BYTE DestAlpha; // Of ERenderAlpha type BYTE Flags; }; - DWORD AsDWORD; + uint32 AsDWORD; inline FRenderStyle &operator= (ERenderStyle legacy); - operator DWORD() const { return AsDWORD; } + operator uint32() const { return AsDWORD; } bool operator==(const FRenderStyle &o) const { return AsDWORD == o.AsDWORD; } void CheckFuzz(); bool IsVisible(fixed_t alpha) const throw(); diff --git a/src/r_draw.cpp b/src/r_draw.cpp index c9bb8fbec2..12cf3c51fc 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -2205,7 +2205,7 @@ ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation, hcolfunc_post4 = rt_shaded4cols; dc_color = fixedcolormap ? fixedcolormap[APART(color)] : basecolormap->Maps[APART(color)]; dc_colormap = (basecolormap = &ShadeFakeColormap[16-alpha])->Maps; - if (fixedlightlev && !fixedcolormap) + if (fixedlightlev >= 0 && fixedcolormap == NULL) { dc_colormap += fixedlightlev; } diff --git a/src/r_main.cpp b/src/r_main.cpp index d20ec9670f..00dfe83531 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -1159,45 +1159,23 @@ void R_SetupFrame (AActor *actor) } fixedcolormap = NULL; - fixedlightlev = 0; + fixedlightlev = -1; - if (player != NULL && camera == player->mo && player->fixedcolormap) + if (player != NULL && camera == player->mo) { - if (player->fixedcolormap < NUMCOLORMAPS) + if (player->fixedcolormap >= 0 && player->fixedcolormap < NUM_SPECIALCOLORMAPS) { - fixedlightlev = player->fixedcolormap*256; - fixedcolormap = NormalLight.Maps; + fixedcolormap = SpecialColormaps[player->fixedcolormap]; } - else switch (player->fixedcolormap) + else if (player->fixedlightlevel >= 0 && player->fixedlightlevel < NUMCOLORMAPS) { - case INVERSECOLORMAP: - fixedcolormap = InverseColormap; - break; - - case REDCOLORMAP: - fixedcolormap = RedColormap; - break; - - case GREENCOLORMAP: - fixedcolormap = GreenColormap; - break; - - case BLUECOLORMAP: - fixedcolormap = BlueColormap; - break; - - case GOLDCOLORMAP: - fixedcolormap = GoldColormap; - break; - - default: - break; + fixedlightlev = player->fixedlightlevel * 256; } } // [RH] Inverse light for shooting the Sigil - else if (extralight == INT_MIN) + if (fixedcolormap == NULL && extralight == INT_MIN) { - fixedcolormap = InverseColormap; + fixedcolormap = SpecialColormaps[INVERSECOLORMAP]; extralight = 0; } diff --git a/src/r_main.h b/src/r_main.h index 0952219fe0..f6948a545e 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -30,6 +30,7 @@ #include "d_player.h" #include "r_data.h" #include "r_state.h" +#include "v_palette.h" // @@ -88,12 +89,6 @@ extern bool r_dontmaplines; // 16 discrete light levels. The terminology I use is borrowed from Build. // -#define INVERSECOLORMAP 32 -#define GOLDCOLORMAP 33 -#define REDCOLORMAP 34 -#define GREENCOLORMAP 35 -#define BLUECOLORMAP 36 - // The size of a single colormap, in bits #define COLORMAPSHIFT 8 diff --git a/src/r_plane.cpp b/src/r_plane.cpp index b2dc9ac406..69af40223b 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -1407,7 +1407,7 @@ void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool masked) planeheight = abs (FixedMul (pl->height.d, -pl->height.ic) - viewz); GlobVis = FixedDiv (r_FloorVisibility, planeheight); - if (fixedlightlev) + if (fixedlightlev >= 0) ds_colormap = basecolormap->Maps + fixedlightlev, plane_shade = false; else if (fixedcolormap) ds_colormap = fixedcolormap, plane_shade = false; @@ -1545,7 +1545,7 @@ void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool masked) if (pl->height.c > 0) planelightfloat = -planelightfloat; - if (fixedlightlev) + if (fixedlightlev >= 0) ds_colormap = basecolormap->Maps + fixedlightlev, plane_shade = false; else if (fixedcolormap) ds_colormap = fixedcolormap, plane_shade = false; diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 7fb5800c9c..e58d042abe 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -154,7 +154,7 @@ CVAR(Bool, r_fogboundary, true, 0) inline bool IsFogBoundary (sector_t *front, sector_t *back) { - return r_fogboundary && !fixedcolormap && front->ColorMap->Fade && + return r_fogboundary && fixedcolormap == NULL && front->ColorMap->Fade && front->ColorMap->Fade != back->ColorMap->Fade && (front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum); } @@ -179,7 +179,7 @@ static void BlastMaskedColumn (void (*blastfunc)(const BYTE *pixels, const FText if (maskedtexturecol[dc_x] != FIXED_MAX) { // calculate lighting - if (!fixedcolormap) + if (fixedcolormap == NULL && fixedlightlev < 0) { dc_colormap = basecolormap->Maps + (GETPALOOKUP (rw_light, wallshade) << COLORMAPSHIFT); } @@ -298,9 +298,9 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2) } } - if (fixedlightlev) + if (fixedlightlev >= 0) dc_colormap = basecolormap->Maps + fixedlightlev; - else if (fixedcolormap) + else if (fixedcolormap != NULL) dc_colormap = fixedcolormap; if (!(curline->linedef->flags & ML_WRAP_MIDTEX) && @@ -453,7 +453,8 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t x = x1; //while ((umost[x] > dmost[x]) && (x <= x2)) x++; - if (fixedcolormap) + bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0); + if (fixed) { palookupoffse[0] = dc_colormap; palookupoffse[1] = dc_colormap; @@ -470,7 +471,7 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t assert (y1ve[0] < viewheight); assert (y2ve[0] <= viewheight); - if (!fixedcolormap) + if (!fixed) { // calculate lighting dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT); } @@ -505,7 +506,7 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t continue; } - if (!fixedcolormap) + if (!fixed) { for (z = 0; z < 4; ++z) { @@ -563,7 +564,7 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t assert (y1ve[0] < viewheight); assert (y2ve[0] <= viewheight); - if (!fixedcolormap) + if (!fixed) { // calculate lighting dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT); } @@ -700,7 +701,8 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixe x = startx = x1; p = x + dc_destorg; - if (fixedcolormap) + bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0); + if (fixed) { palookupoffse[0] = dc_colormap; palookupoffse[1] = dc_colormap; @@ -715,7 +717,7 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixe y2ve[0] = dwal[x];//min(dwal[x],dmost[x]); if (y2ve[0] <= y1ve[0]) continue; - if (!fixedcolormap) + if (!fixed) { // calculate lighting dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT); } @@ -748,7 +750,7 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixe continue; } - if (!fixedcolormap) + if (!fixed) { for (z = 0; z < 4; ++z) { @@ -804,7 +806,7 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixe y2ve[0] = dwal[x]; if (y2ve[0] <= y1ve[0]) continue; - if (!fixedcolormap) + if (!fixed) { // calculate lighting dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT); } @@ -872,7 +874,8 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, x = startx = x1; p = x + dc_destorg; - if (fixedcolormap) + bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0); + if (fixed) { palookupoffse[0] = dc_colormap; palookupoffse[1] = dc_colormap; @@ -887,7 +890,7 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, y2ve[0] = dwal[x];//min(dwal[x],dmost[x]); if (y2ve[0] <= y1ve[0]) continue; - if (!fixedcolormap) + if (!fixed) { // calculate lighting dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT); } @@ -920,7 +923,7 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, continue; } - if (!fixedcolormap) + if (!fixed) { for (z = 0; z < 4; ++z) { @@ -979,7 +982,7 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, y2ve[0] = dwal[x]; if (y2ve[0] <= y1ve[0]) continue; - if (!fixedcolormap) + if (!fixed) { // calculate lighting dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT); } @@ -1016,9 +1019,9 @@ void R_RenderSegLoop () fixed_t xscale, yscale; fixed_t xoffset = rw_offset; - if (fixedlightlev) + if (fixedlightlev >= 0) dc_colormap = basecolormap->Maps + fixedlightlev; - else if (fixedcolormap) + else if (fixedcolormap != NULL) dc_colormap = fixedcolormap; // clip wall to the floor and ceiling @@ -1087,7 +1090,7 @@ void R_RenderSegLoop () { rw_offset = rw_offset_mid; } - if (fixedlightlev || fixedcolormap || !frontsector->ExtraLights) + if (fixedcolormap != NULL || !frontsector->ExtraLights) { wallscan (x1, x2-1, walltop, wallbottom, swall, lwall, yscale); } @@ -1126,7 +1129,7 @@ void R_RenderSegLoop () { rw_offset = rw_offset_top; } - if (fixedlightlev || fixedcolormap || !frontsector->ExtraLights) + if (fixedcolormap != NULL || !frontsector->ExtraLights) { wallscan (x1, x2-1, walltop, wallupper, swall, lwall, yscale); } @@ -1168,7 +1171,7 @@ void R_RenderSegLoop () { rw_offset = rw_offset_bottom; } - if (fixedlightlev || fixedcolormap || !frontsector->ExtraLights) + if (fixedcolormap != NULL || !frontsector->ExtraLights) { wallscan (x1, x2-1, walllower, wallbottom, swall, lwall, yscale); } @@ -1434,7 +1437,7 @@ void R_NewWall (bool needlights) PrepWall (swall, lwall, sidedef->TexelLength * lwallscale); - if (!fixedcolormap) + if (fixedcolormap == NULL && fixedlightlev < 0) { wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, frontsector->lightlevel) + r_actualextralight); @@ -2421,9 +2424,9 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper, bool calclighting = false; rw_light = rw_lightleft + (x1 - WallSX1) * rw_lightstep; - if (fixedlightlev) + if (fixedlightlev >= 0) dc_colormap = basecolormap->Maps + fixedlightlev; - else if (fixedcolormap) + else if (fixedcolormap != NULL) dc_colormap = fixedcolormap; else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT)) dc_colormap = basecolormap->Maps; diff --git a/src/r_things.cpp b/src/r_things.cpp index ffc9ed3dd7..552241be20 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -50,6 +50,7 @@ #include "r_plane.h" #include "r_segs.h" #include "v_palette.h" +#include "r_translate.h" extern fixed_t globaluclip, globaldclip; @@ -74,6 +75,10 @@ fixed_t pspritexiscale; fixed_t sky1scale; // [RH] Sky 1 scale factor fixed_t sky2scale; // [RH] Sky 2 scale factor +vissprite_t *VisPSprites[NUMPSPRITES]; +int VisPSpritesX1[NUMPSPRITES]; +FDynamicColormap *VisPSpritesBaseColormap[NUMPSPRITES]; + static int spriteshade; TArray ParticlesInSubsec; @@ -1430,50 +1435,40 @@ void R_ProjectSprite (AActor *thing, int fakeside) if (vis->RenderStyle.Flags & STYLEF_FadeToBlack) { if (invertcolormap) - { - // Fade to white + { // Fade to white mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(255,255,255), mybasecolormap->Desaturate); invertcolormap = false; } else - { - // Fade to black + { // Fade to black mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(0,0,0), mybasecolormap->Desaturate); } } // get light level - if (fixedlightlev) - { - if (invertcolormap) - { - mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate); - } - vis->colormap = mybasecolormap->Maps + fixedlightlev; - } - else if (fixedcolormap) - { - // fixed map + if (fixedcolormap != NULL) + { // fixed map vis->colormap = fixedcolormap; } - else if (!foggy && ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT))) - { - // full bright - if (invertcolormap) - { - mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate); - } - vis->colormap = mybasecolormap->Maps; - } else { - // diminished light if (invertcolormap) { mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate); } - vis->colormap = mybasecolormap->Maps + (GETPALOOKUP ( - (fixed_t)DivScale12 (r_SpriteVisibility, tz), spriteshade) << COLORMAPSHIFT); + if (fixedlightlev >= 0) + { + vis->colormap = mybasecolormap->Maps + fixedlightlev; + } + else if (!foggy && ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT))) + { // full bright + vis->colormap = mybasecolormap->Maps; + } + else + { // diminished light + vis->colormap = mybasecolormap->Maps + (GETPALOOKUP ( + (fixed_t)DivScale12 (r_SpriteVisibility, tz), spriteshade) << COLORMAPSHIFT); + } } } @@ -1522,7 +1517,10 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ WORD flip; FTexture* tex; vissprite_t* vis; - vissprite_t avis; + static vissprite_t avis[NUMPSPRITES]; + bool noaccel; + + assert(pspnum >= 0 && pspnum < NUMPSPRITES); // decide which patch to use if ( (unsigned)psp->state->sprite >= (unsigned)sprites.Size ()) @@ -1550,7 +1548,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ tx -= tex->GetScaledLeftOffset() << FRACBITS; x1 = (centerxfrac + FixedMul (tx, pspritexscale)) >>FRACBITS; - + VisPSpritesX1[pspnum] = x1; // off the right side if (x1 > viewwidth) @@ -1564,7 +1562,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ return; // store information in a vissprite - vis = &avis; + vis = &avis[pspnum]; vis->renderflags = owner->renderflags; vis->floorclip = 0; @@ -1619,6 +1617,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ if (vis->x1 > x1) vis->startfrac += vis->xiscale*(vis->x1-x1); + noaccel = false; if (pspnum <= ps_flash) { vis->alpha = owner->alpha; @@ -1639,67 +1638,92 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ if (vis->RenderStyle.Flags & STYLEF_FadeToBlack) { if (invertcolormap) - { - // Fade to white + { // Fade to white mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(255,255,255), mybasecolormap->Desaturate); invertcolormap = false; } else - { - // Fade to black + { // Fade to black mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(0,0,0), mybasecolormap->Desaturate); } } - if (fixedlightlev) - { - if (invertcolormap) - { - mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate); - } - vis->colormap = mybasecolormap->Maps + fixedlightlev; - } - else if (fixedcolormap) - { - // fixed color + if (fixedcolormap != NULL) + { // fixed color vis->colormap = fixedcolormap; } - else if (!foggy && psp->state->GetFullbright()) - { - // full bright - if (invertcolormap) - { - mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate); - } - vis->colormap = mybasecolormap->Maps; // [RH] use basecolormap - } else { - // local light if (invertcolormap) { mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate); } - vis->colormap = mybasecolormap->Maps + (GETPALOOKUP (0, spriteshade) << COLORMAPSHIFT); + if (fixedlightlev >= 0) + { + vis->colormap = mybasecolormap->Maps + fixedlightlev; + } + else if (!foggy && psp->state->GetFullbright()) + { // full bright + vis->colormap = mybasecolormap->Maps; // [RH] use basecolormap + } + else + { // local light + vis->colormap = mybasecolormap->Maps + (GETPALOOKUP (0, spriteshade) << COLORMAPSHIFT); + } } if (camera->Inventory != NULL) { + lighttable_t *oldcolormap = vis->colormap; camera->Inventory->AlterWeaponSprite (vis); + if (vis->colormap != oldcolormap) + { + // The colormap has changed. Is it one we can easily identify? + // If not, then don't bother trying to identify it for + // hardware accelerated drawing. + if (vis->colormap < SpecialColormaps[0] || vis->colormap >= SpecialColormaps[NUM_SPECIALCOLORMAPS]) + { + noaccel = true; + } + // Has the basecolormap changed? If so, we can't hardware accelerate it, + // since we don't know what it is anymore. + else if (vis->colormap < mybasecolormap->Maps || + vis->colormap >= mybasecolormap->Maps + NUMCOLORMAPS*256) + { + noaccel = true; + } + } } + VisPSpritesBaseColormap[pspnum] = mybasecolormap; } else { + VisPSpritesBaseColormap[pspnum] = basecolormap; vis->RenderStyle = STYLE_Normal; } - + + // Check for hardware-assisted 2D. If it's available, and this sprite is not + // fuzzy, don't draw it until after the switch to 2D mode. + if (!noaccel && RenderTarget == screen && (DFrameBuffer *)screen->Accel2D) + { + FRenderStyle style = vis->RenderStyle; + style.CheckFuzz(); + if (style.BlendOp != STYLEOP_Fuzz) + { + VisPSprites[pspnum] = vis; + return; + } + } R_DrawVisSprite (vis); } +//========================================================================== // // R_DrawPlayerSprites // +//========================================================================== + void R_DrawPlayerSprites (void) { int i; @@ -1708,7 +1732,7 @@ void R_DrawPlayerSprites (void) sector_t* sec; static sector_t tempsec; int floorlight, ceilinglight; - + if (!r_drawplayersprites || !camera->player || (players[consoleplayer].cheats & CF_CHASECAM)) @@ -1766,6 +1790,80 @@ void R_DrawPlayerSprites (void) } } +//========================================================================== +// +// R_DrawRemainingPlayerSprites +// +// Called from D_Display to draw sprites that were not drawn by +// R_DrawPlayerSprites(). +// +//========================================================================== + +void R_DrawRemainingPlayerSprites() +{ + for (int i = 0; i < NUMPSPRITES; ++i) + { + vissprite_t *vis; + + vis = VisPSprites[i]; + VisPSprites[i] = NULL; + + if (vis != NULL) + { + FDynamicColormap *colormap = VisPSpritesBaseColormap[i]; + bool flip = vis->xiscale < 0; + FSpecialColormapParameters *special = NULL; + PalEntry overlay = 0; + FColormapStyle colormapstyle; + bool usecolormapstyle = false; + + if (vis->colormap >= SpecialColormaps[0] && vis->colormap < SpecialColormaps[NUM_SPECIALCOLORMAPS]) + { + ptrdiff_t specialmap = (vis->colormap - SpecialColormaps[0]) >> 8; + if (SpecialColormapParms[specialmap].Inverted) + { + vis->RenderStyle.Flags ^= STYLEF_InvertSource; + } + special = &SpecialColormapParms[specialmap]; + } + else if (colormap->Color == PalEntry(255,255,255) && + colormap->Desaturate == 0) + { + overlay = colormap->Fade; + overlay.a = BYTE(((vis->colormap - colormap->Maps) >> 8) * 255 / NUMCOLORMAPS); + } + else + { + usecolormapstyle = true; + colormapstyle.Color = colormap->Color; + colormapstyle.Fade = colormap->Fade; + colormapstyle.Desaturate = colormap->Desaturate; + colormapstyle.FadeLevel = ((vis->colormap - colormap->Maps) >> 8) / float(NUMCOLORMAPS); + } + screen->DrawTexture(vis->pic, + viewwindowx + VisPSpritesX1[i], + viewwindowy + viewheight/2 - MulScale32(vis->texturemid, vis->yscale) - 1, + DTA_DestWidth, FixedMul(vis->pic->GetWidth(), vis->xscale), + DTA_DestHeight, FixedMul(vis->pic->GetHeight(), vis->yscale), + DTA_Translation, TranslationToTable(vis->Translation), + DTA_FlipX, flip, + DTA_TopOffset, 0, + DTA_LeftOffset, 0, + DTA_ClipLeft, viewwindowx, + DTA_ClipTop, viewwindowy, + DTA_ClipRight, viewwindowx + viewwidth, + DTA_ClipBottom, viewwindowy + viewheight, + DTA_Alpha, vis->alpha, + DTA_RenderStyle, vis->RenderStyle, + DTA_FillColor, vis->FillColor, + DTA_SpecialColormap, special, + DTA_ColorOverlay, overlay, + DTA_ColormapStyle, usecolormapstyle ? &colormapstyle : NULL, + TAG_DONE); + } + } +} + @@ -2423,7 +2521,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade, vis->floorclip = 0; vis->heightsec = heightsec; - if (fixedlightlev) + if (fixedlightlev >= 0) { vis->colormap = map + fixedlightlev; } diff --git a/src/r_things.h b/src/r_things.h index a3614c0637..9ae796ce90 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -102,6 +102,7 @@ void R_InitSprites (); void R_DeinitSprites (); void R_ClearSprites (); void R_DrawMasked (); +void R_DrawRemainingPlayerSprites (); void R_ClipVisSprite (vissprite_t *vis, int xl, int xh); diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 2079f2448b..86bab74f81 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -426,16 +426,16 @@ BYTE *GetBlendMap(PalEntry blend, BYTE *blendwork) switch (blend.a==0 ? blend.r : -1) { case BLEND_INVERSEMAP: - return InverseColormap; + return SpecialColormaps[INVERSECOLORMAP]; case BLEND_GOLDMAP: - return GoldColormap; + return SpecialColormaps[GOLDCOLORMAP]; case BLEND_REDMAP: - return RedColormap; + return SpecialColormaps[REDCOLORMAP]; case BLEND_GREENMAP: - return GreenColormap; + return SpecialColormaps[GREENCOLORMAP]; case BLEND_ICEMAP: return TranslationToTable(TRANSLATION(TRANSLATION_Standard, 7))->Remap; diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 659a2f5026..90fb4befff 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -341,6 +341,8 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l parms->style.BlendOp = 255; // Dummy "not set" value parms->masked = true; parms->bilinear = false; + parms->specialcolormap = NULL; + parms->colormapstyle = NULL; parms->x = x << FRACBITS; parms->y = y << FRACBITS; @@ -580,6 +582,14 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l case DTA_RenderStyle: parms->style.AsDWORD = va_arg (tags, DWORD); break; + + case DTA_SpecialColormap: + parms->specialcolormap = va_arg (tags, FSpecialColormapParameters *); + break; + + case DTA_ColormapStyle: + parms->colormapstyle = va_arg (tags, FColormapStyle *); + break; } tag = va_arg (tags, DWORD); } diff --git a/src/v_palette.cpp b/src/v_palette.cpp index 921093433e..d0d50efaa3 100644 --- a/src/v_palette.cpp +++ b/src/v_palette.cpp @@ -61,15 +61,29 @@ extern "C" { FDynamicColormap NormalLight; } FPalette GPalette; -BYTE InverseColormap[256]; -BYTE GoldColormap[256]; -// [BC] New Skulltag colormaps. -BYTE RedColormap[256]; -BYTE GreenColormap[256]; -BYTE BlueColormap[256]; +BYTE SpecialColormaps[NUM_SPECIALCOLORMAPS][256]; BYTE DesaturateColormap[31][256]; -static void FreeSpecialLights();; +FSpecialColormapParameters SpecialColormapParms[NUM_SPECIALCOLORMAPS] = +{ + // Doom invulnerability is an inverted grayscale. + // Strife uses it when firing the Sigil + { { 1, 1, 1 }, true }, + + // Heretic invulnerability is a golden shade. + { { 1.5, 0.75, 0 }, false }, + + // [BC] Build the Doomsphere colormap. It is red! + { { 1.5, 0, 0 }, false }, + + // [BC] Build the Guardsphere colormap. It's a greenish-white kind of thing. + { { 1.25, 1.5, 1 }, false }, + + // Build a blue colormap. + { { 0, 0, 1.5 }, false }, +}; + +static void FreeSpecialLights(); FColorMatcher ColorMatcher; @@ -385,66 +399,30 @@ void InitPalette () // NormalLight.Maps is set by R_InitColormaps() // build special maps (e.g. invulnerability) - int intensity; + double intensity; - // Doom invulnerability is an inverted grayscale. - // Strife uses it when firing the Sigil - shade = InverseColormap; - - for (c = 0; c < 256; c++) + for (int i = 0; i < countof(SpecialColormapParms); ++i) { - intensity = (65535 - - (GPalette.BaseColors[c].r * 77 + - GPalette.BaseColors[c].g * 143 + - GPalette.BaseColors[c].b * 37)) >> 8; - shade[c] = ColorMatcher.Pick (intensity, intensity, intensity); - } + double r, g, b; + bool inv; - // Heretic invulnerability is a golden shade. - shade = GoldColormap; - - for (c = 0; c < 256; c++) - { - intensity = GPalette.BaseColors[c].r * 77 + - GPalette.BaseColors[c].g * 143 + - GPalette.BaseColors[c].b * 37; - shade[c] = ColorMatcher.Pick ( - MIN (255, (intensity+intensity/2)>>8), intensity>>8, 0); - } - - // [BC] Build the Doomsphere colormap. It is red! - shade = RedColormap; - for (c = 0; c < 256; c++) - { - intensity = ((GPalette.BaseColors[c].r * 77 + - GPalette.BaseColors[c].g * 143 + - GPalette.BaseColors[c].b * 37)); - shade[c] = ColorMatcher.Pick ( - MIN( 255, ( intensity + ( intensity / 2 )) >> 8 ), 0, 0 ); - } - - // [BC] Build the Guardsphere colormap. It's a greenish-white kind of thing. - shade = GreenColormap; - for (c = 0; c < 256; c++) - { - intensity = GPalette.BaseColors[c].r * 77 + - GPalette.BaseColors[c].g * 143 + - GPalette.BaseColors[c].b * 37; - shade[c] = ColorMatcher.Pick ( - MIN( 255, ( intensity + ( intensity / 2 )) >> 8 ), - MIN( 255, ( intensity + ( intensity / 2 )) >> 8 ), - intensity>>8 ); - } - - // Build a blue colormap. - shade = BlueColormap; - for (c = 0; c < 256; c++) - { - intensity = ((GPalette.BaseColors[c].r * 77 + - GPalette.BaseColors[c].g * 143 + - GPalette.BaseColors[c].b * 37)); - shade[c] = ColorMatcher.Pick (0, 0, - MIN( 255, ( intensity + ( intensity / 2 )) >> 8 )); + shade = SpecialColormaps[i]; + r = SpecialColormapParms[i].Colorize[0]; + g = SpecialColormapParms[i].Colorize[1]; + b = SpecialColormapParms[i].Colorize[2]; + inv = SpecialColormapParms[i].Inverted; + for (c = 0; c < 256; c++) + { + intensity = (GPalette.BaseColors[c].r * 77 + + GPalette.BaseColors[c].g * 143 + + GPalette.BaseColors[c].b * 37) / 256.0; + if (inv) + { + intensity = 255 - intensity; + } + shade[c] = ColorMatcher.Pick( + MIN(255, int(intensity*r)), MIN(255, int(intensity*g)), MIN(255, int(intensity*b))); + } } // desaturated colormaps @@ -453,7 +431,7 @@ void InitPalette () shade = DesaturateColormap[m]; for (c = 0; c < 256; c++) { - intensity = (GPalette.BaseColors[c].r * 77 + + int intensity = (GPalette.BaseColors[c].r * 77 + GPalette.BaseColors[c].g * 143 + GPalette.BaseColors[c].b * 37) / 255; diff --git a/src/v_palette.h b/src/v_palette.h index e723ba5c28..160ef6ceac 100644 --- a/src/v_palette.h +++ b/src/v_palette.h @@ -79,18 +79,41 @@ struct FDynamicColormap FDynamicColormap *Next; }; -extern BYTE InverseColormap[256]; -extern BYTE GoldColormap[256]; -// [BC] New Skulltag colormaps. -extern BYTE RedColormap[256]; -extern BYTE GreenColormap[256]; -extern BYTE BlueColormap[256]; +// For hardware-accelerated weapon sprites in colored sectors +struct FColormapStyle +{ + PalEntry Color; + PalEntry Fade; + int Desaturate; + float FadeLevel; +}; + +// Special colormaps, like invulnerability. +enum +{ + NOFIXEDCOLORMAP = -1, + INVERSECOLORMAP, + GOLDCOLORMAP, + REDCOLORMAP, // [BC] New Skulltag colormaps. + GREENCOLORMAP, + BLUECOLORMAP, + + NUM_SPECIALCOLORMAPS +}; +struct FSpecialColormapParameters +{ + float Colorize[3]; + bool Inverted; +}; +extern FSpecialColormapParameters SpecialColormapParms[NUM_SPECIALCOLORMAPS]; +extern BYTE SpecialColormaps[NUM_SPECIALCOLORMAPS][256]; + + extern BYTE DesaturateColormap[31][256]; extern FPalette GPalette; extern "C" { extern FDynamicColormap NormalLight; } - // The color overlay to use for depleted items #define DIM_OVERLAY MAKEARGB(170,0,0,0) diff --git a/src/v_video.cpp b/src/v_video.cpp index 304a8ee445..a89e270fb8 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1099,6 +1099,20 @@ bool DFrameBuffer::Begin2D (bool copy3d) return false; } +//========================================================================== +// +// DFrameBuffer :: DrawBlendingRect +// +// In hardware 2D modes, the blending rect needs to be drawn separately +// from transferring the 3D scene to video memory, because the weapon +// sprite is drawn on top of that. +// +//========================================================================== + +void DFrameBuffer::DrawBlendingRect() +{ +} + //========================================================================== // // DFrameBuffer :: CreateTexture diff --git a/src/v_video.h b/src/v_video.h index c6857d55a4..6d9a6ee96b 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -101,6 +101,8 @@ enum DTA_RenderStyle, // same as render style for actors DTA_ColorOverlay, // DWORD: ARGB to overlay on top of image; limited to black for software DTA_BilinearFilter, // bool: apply bilinear filtering to the image + DTA_SpecialColormap,// pointer to FSpecialColormapParameters (likely to be forever hardware-only) + DTA_ColormapStyle, // pointer to FColormapStyle (hardware-only) // For DrawText calls: DTA_TextLen, // stop after this many characters, even if \0 not hit @@ -225,6 +227,8 @@ public: INTBOOL masked; INTBOOL bilinear; FRenderStyle style; + struct FSpecialColormapParameters *specialcolormap; + struct FColormapStyle *colormapstyle; }; protected: @@ -349,12 +353,16 @@ public: // Begin 2D drawing operations. This is like Update, but it doesn't end // the scene, and it doesn't present the image yet. If you are going to // be covering the entire screen with 2D elements, then pass false to - // avoid copying the software bufferer to the screen. + // avoid copying the software buffer to the screen. // Returns true if hardware-accelerated 2D has been entered, false if not. virtual bool Begin2D(bool copy3d); // DrawTexture calls after Begin2D use native textures. + // Draws the blending rectangle over the viewwindow if in hardware- + // accelerated 2D mode. + virtual void DrawBlendingRect(); + // Create a native texture from a game texture. virtual FNativeTexture *CreateTexture(FTexture *gametex, bool wrapping); diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index 6eb7da66fe..a81c2ca7cf 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -68,6 +68,7 @@ #include "win32iface.h" #include "doomstat.h" #include "v_palette.h" +#include "w_wad.h" // MACROS ------------------------------------------------------------------ @@ -168,6 +169,7 @@ enum BQF_WrapUV = 16, BQF_InvertSource = 32, BQF_DisableAlphaTest= 64, + BQF_Desaturated = 128, }; // Shaders for a buffered quad @@ -176,7 +178,9 @@ enum BQS_PalTex, BQS_Plain, BQS_RedToAlpha, - BQS_ColorOnly + BQS_ColorOnly, + BQS_SpecialColormap, + BQS_InGameColormap, }; // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- @@ -207,7 +211,35 @@ extern cycle_t BlitCycles; // PRIVATE DATA DEFINITIONS ------------------------------------------------ -#include "fb_d3d9_shaders.h" +const char *const D3DFB::ShaderNames[D3DFB::NUM_SHADERS] = +{ + "NormalColor.pso", + "NormalColorPal.pso", + "NormalColorInv.pso", + "NormalColorPalInv.pso", + + "RedToAlpha.pso", + "RedToAlphaInv.pso", + + "VertexColor.pso", + + "SpecialColormap.pso", + "SpecialColormapInv.pso", + "SpecialColorMapPal.pso", + "SpecialColorMapPalInv.pso", + + "InGameColormap.pso", + "InGameColormapDesat.pso", + "InGameColormapInv.pso", + "InGameColormapInvDesat.pso", + "InGameColormapPal.pso", + "InGameColormapPalDesat.pso", + "InGameColormapPalInv.pso", + "InGameColormapPalInvDesat.pso", + + "BurnWipe.pso", + "GammaCorrection.pso", +}; // PUBLIC DATA DEFINITIONS ------------------------------------------------- @@ -221,6 +253,12 @@ CVAR(Bool, vid_hwaalines, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // CODE -------------------------------------------------------------------- +//========================================================================== +// +// D3DFB - Constructor +// +//========================================================================== + D3DFB::D3DFB (int width, int height, bool fullscreen) : BaseWinFB (width, height) { @@ -236,15 +274,10 @@ D3DFB::D3DFB (int width, int height, bool fullscreen) ScreenshotSurface = NULL; FinalWipeScreen = NULL; PaletteTexture = NULL; - PalTexShader = NULL; - InvPalTexShader = NULL; - PalTexBilinearShader = NULL; - PlainShader = NULL; - InvPlainShader = NULL; - RedToAlphaShader = NULL; - ColorOnlyShader = NULL; - GammaFixerShader = NULL; - BurnShader = NULL; + for (int i = 0; i < NUM_SHADERS; ++i) + { + Shaders[i] = NULL; + } FBFormat = D3DFMT_UNKNOWN; PalFormat = D3DFMT_UNKNOWN; VSync = vid_vsync; @@ -350,6 +383,12 @@ D3DFB::D3DFB (int width, int height, bool fullscreen) } } +//========================================================================== +// +// D3DFB - Destructor +// +//========================================================================== + D3DFB::~D3DFB () { ReleaseResources(); @@ -357,8 +396,15 @@ D3DFB::~D3DFB () delete[] QuadExtra; } +//========================================================================== +// +// D3DFB :: SetInitialState +// // Called after initial device creation and reset, when everything is set // to D3D's defaults. +// +//========================================================================== + void D3DFB::SetInitialState() { AlphaBlendEnabled = FALSE; @@ -398,9 +444,9 @@ void D3DFB::SetInitialState() D3DDevice->SetGammaRamp(0, 0, &ramp); } - // Used by the inverse color shaders - float ones[4] = { 1, 1, 1, 1 }; - D3DDevice->SetPixelShaderConstantF(6, ones, 1); + // This constant is used for grayscaling weights (.xyz) and color inversion (.w) + float weights[4] = { 77/256.f, 143/256.f, 37/256.f, 1 }; + D3DDevice->SetPixelShaderConstantF(PSCONST_Weights, weights, 1); // D3DRS_ALPHATESTENABLE defaults to FALSE // D3DRS_ALPHAREF defaults to 0 @@ -410,6 +456,12 @@ void D3DFB::SetInitialState() CurBorderColor = 0; } +//========================================================================== +// +// D3DFB :: FillPresentParameters +// +//========================================================================== + void D3DFB::FillPresentParameters (D3DPRESENT_PARAMETERS *pp, bool fullscreen, bool vsync) { memset (pp, 0, sizeof(*pp)); @@ -427,7 +479,13 @@ void D3DFB::FillPresentParameters (D3DPRESENT_PARAMETERS *pp, bool fullscreen, b } } -bool D3DFB::CreateResources () +//========================================================================== +// +// D3DFB :: CreateResources +// +//========================================================================== + +bool D3DFB::CreateResources() { Packs = NULL; if (!Windowed) @@ -444,56 +502,28 @@ bool D3DFB::CreateResources () LOG2 ("Resize window to %dx%d\n", sizew, sizeh); VidResizing = true; // Make sure the window has a border in windowed mode - SetWindowLong (Window, GWL_STYLE, WS_VISIBLE|WS_OVERLAPPEDWINDOW); - if (GetWindowLong (Window, GWL_EXSTYLE) & WS_EX_TOPMOST) + SetWindowLong(Window, GWL_STYLE, WS_VISIBLE|WS_OVERLAPPEDWINDOW); + if (GetWindowLong(Window, GWL_EXSTYLE) & WS_EX_TOPMOST) { // Direct3D 9 will apparently add WS_EX_TOPMOST to fullscreen windows, // and removing it is a little tricky. Using SetWindowLongPtr to clear it // will not do the trick, but sending the window behind everything will. - SetWindowPos (Window, HWND_BOTTOM, 0, 0, sizew, sizeh, + SetWindowPos(Window, HWND_BOTTOM, 0, 0, sizew, sizeh, SWP_DRAWFRAME | SWP_NOCOPYBITS | SWP_NOMOVE); - SetWindowPos (Window, HWND_TOP, 0, 0, 0, 0, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(Window, HWND_TOP, 0, 0, 0, 0, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE); } else { - SetWindowPos (Window, NULL, 0, 0, sizew, sizeh, + SetWindowPos(Window, NULL, 0, 0, sizew, sizeh, SWP_DRAWFRAME | SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOZORDER); } - I_RestoreWindowedPos (); + I_RestoreWindowedPos(); VidResizing = false; } - SM14 = false; - if (FAILED(D3DDevice->CreatePixelShader (PalTexShader20Def, &PalTexShader)) && - (SM14 = true, FAILED(D3DDevice->CreatePixelShader (PalTexShader14Def, &PalTexShader)))) + if (!LoadShaders()) { return false; } - if (FAILED(D3DDevice->CreatePixelShader (InvPalTexShader20Def, &InvPalTexShader)) && - (SM14 = true, FAILED(D3DDevice->CreatePixelShader (InvPalTexShader14Def, &InvPalTexShader)))) - { - return false; - } - if (FAILED(D3DDevice->CreatePixelShader (PlainShaderDef, &PlainShader)) || - FAILED(D3DDevice->CreatePixelShader (InvPlainShaderDef, &InvPlainShader)) || - FAILED(D3DDevice->CreatePixelShader (RedToAlphaDef, &RedToAlphaShader)) || - FAILED(D3DDevice->CreatePixelShader (ColorOnlyDef, &ColorOnlyShader))) - { - return false; - } - if (FAILED(D3DDevice->CreatePixelShader (GammaFixerDef, &GammaFixerShader))) - { -// Cannot print during screen creation. -// Printf ("Using Shader Model 1.4: Windowed mode gamma will not work.\n"); - GammaFixerShader = NULL; - } - if (FAILED(D3DDevice->CreatePixelShader(PalTexBilinearDef, &PalTexBilinearShader))) - { - PalTexBilinearShader = PalTexShader; - } - if (FAILED(D3DDevice->CreatePixelShader (BurnShaderDef, &BurnShader))) - { - BurnShader = NULL; - } if (!CreateFBTexture() || !CreatePaletteTexture()) { @@ -506,6 +536,62 @@ bool D3DFB::CreateResources () return true; } +//========================================================================== +// +// D3DFB :: LoadShaders +// +// Returns true if all required shaders were loaded. (Gamma and burn wipe +// are the only ones not considered "required".) +// +//========================================================================== + +bool D3DFB::LoadShaders() +{ + static const char *const models[] = { "30/", "20/", "14/" }; + FString shaderdir, shaderpath; + int model, i, lump; + + // We determine the best available model simply by trying them all in + // order of decreasing preference. + for (model = 0; model < countof(models); ++model) + { + shaderdir = "shaders/d3d/sm"; + shaderdir += models[model]; + for (i = 0; i < NUM_SHADERS; ++i) + { + shaderpath = shaderdir; + shaderpath += ShaderNames[i]; + lump = Wads.CheckNumForFullName(shaderpath); + if (lump >= 0) + { + FMemLump data = Wads.ReadLump(lump); + if (FAILED(D3DDevice->CreatePixelShader((DWORD *)data.GetMem(), &Shaders[i])) && + i != SHADER_GammaCorrection && i != SHADER_BurnWipe) + { + break; + } + } + } + if (i == NUM_SHADERS) + { // Success! + SM14 = (model == countof(models) - 1); + return true; + } + // Failure. Release whatever managed to load (which is probably nothing.) + for (i = 0; i < NUM_SHADERS; ++i) + { + SAFE_RELEASE( Shaders[i] ); + } + } + return false; +} + +//========================================================================== +// +// D3DFB :: ReleaseResources +// +//========================================================================== + void D3DFB::ReleaseResources () { I_SaveWindowedPos (); @@ -515,22 +601,10 @@ void D3DFB::ReleaseResources () SAFE_RELEASE( ScreenshotSurface ); SAFE_RELEASE( ScreenshotTexture ); SAFE_RELEASE( PaletteTexture ); - if (PalTexBilinearShader != NULL) + for (int i = 0; i < NUM_SHADERS; ++i) { - if (PalTexBilinearShader != PalTexShader) - { - PalTexBilinearShader->Release(); - } - PalTexBilinearShader = NULL; + SAFE_RELEASE( Shaders[i] ); } - SAFE_RELEASE( PalTexShader ); - SAFE_RELEASE( InvPalTexShader ); - SAFE_RELEASE( PlainShader ); - SAFE_RELEASE( InvPlainShader ); - SAFE_RELEASE( RedToAlphaShader ); - SAFE_RELEASE( ColorOnlyShader ); - SAFE_RELEASE( GammaFixerShader ); - SAFE_RELEASE( BurnShader ); if (ScreenWipe != NULL) { delete ScreenWipe; @@ -545,7 +619,14 @@ void D3DFB::ReleaseResources () GatheringWipeScreen = false; } +//========================================================================== +// +// D3DFB :: ReleaseDefaultPoolItems +// // Free resources created with D3DPOOL_DEFAULT. +// +//========================================================================== + void D3DFB::ReleaseDefaultPoolItems() { SAFE_RELEASE( FBTexture ); @@ -563,6 +644,12 @@ void D3DFB::ReleaseDefaultPoolItems() SAFE_RELEASE( IndexBuffer ); } +//========================================================================== +// +// D3DFB :: Reset +// +//========================================================================== + bool D3DFB::Reset () { D3DPRESENT_PARAMETERS d3dpp; @@ -881,7 +968,7 @@ void D3DFB::Update () } psgamma[2] = psgamma[1] = psgamma[0] = igamma; psgamma[3] = 1; - D3DDevice->SetPixelShaderConstantF(7, psgamma, 1); + D3DDevice->SetPixelShaderConstantF(PSCONST_Gamma, psgamma, 1); } if (NeedPalUpdate) @@ -971,7 +1058,7 @@ void D3DFB::Draw3DPart(bool copy3d) D3DDevice->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, vid_hwaalines); assert(OldRenderTarget == NULL); if (TempRenderTexture != NULL && - ((Windowed && GammaFixerShader && TempRenderTexture != FinalWipeScreen) || GatheringWipeScreen || PixelDoubling)) + ((Windowed && Shaders[SHADER_GammaCorrection] && TempRenderTexture != FinalWipeScreen) || GatheringWipeScreen || PixelDoubling)) { IDirect3DSurface9 *targetsurf; if (SUCCEEDED(TempRenderTexture->GetSurfaceLevel(0, &targetsurf))) @@ -989,7 +1076,7 @@ void D3DFB::Draw3DPart(bool copy3d) SetTexture (0, FBTexture); SetPaletteTexture(PaletteTexture, 256, BorderColor); - SetPixelShader(PalTexShader); + SetPixelShader(Shaders[SHADER_NormalColorPal]); D3DDevice->SetFVF (D3DFVF_FBVERTEX); memset(Constant, 0, sizeof(Constant)); SetAlphaBlend(D3DBLENDOP(0)); @@ -997,7 +1084,18 @@ void D3DFB::Draw3DPart(bool copy3d) if (copy3d) { FBVERTEX verts[4]; - CalcFullscreenCoords(verts, Accel2D, false, FlashColor0, FlashColor1); + D3DCOLOR color0, color1; + if (Accel2D) + { + color0 = 0; + color1 = 0xFFFFFFF; + } + else + { + color0 = FlashColor0; + color1 = FlashColor1; + } + CalcFullscreenCoords(verts, Accel2D, false, color0, color1); D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX)); } } @@ -1039,7 +1137,7 @@ void D3DFB::DoWindowedGamma() D3DDevice->SetRenderTarget(0, OldRenderTarget); D3DDevice->SetFVF(D3DFVF_FBVERTEX); SetTexture(0, TempRenderTexture); - SetPixelShader((Windowed && GammaFixerShader != NULL) ? GammaFixerShader : PlainShader); + SetPixelShader(Shaders[(Windowed && Shaders[SHADER_GammaCorrection]) ? SHADER_GammaCorrection : SHADER_NormalColor]); SetAlphaBlend(D3DBLENDOP(0)); EnableAlphaTest(FALSE); D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX)); @@ -2148,6 +2246,23 @@ bool D3DFB::Begin2D(bool copy3d) return true; } +//========================================================================== +// +// D3DFB :: DrawBlendingRect +// +// Call after Begin2D to blend the 3D view. +// +//========================================================================== + +void D3DFB::DrawBlendingRect() +{ + if (!In2D || !Accel2D) + { + return; + } + Dim(FlashColor, FlashAmount / 256.f, viewwindowx, viewwindowy, viewwidth, viewheight); +} + //========================================================================== // // D3DFB :: CreateTexture @@ -2278,7 +2393,7 @@ void D3DFB::EndLineBatch() VertexBuffer->Unlock(); if (VertexPos > 0) { - SetPixelShader(ColorOnlyShader); + SetPixelShader(Shaders[SHADER_VertexColor]); SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); D3DDevice->SetStreamSource(0, VertexBuffer, 0, sizeof(FBVERTEX)); D3DDevice->DrawPrimitive(D3DPT_LINELIST, 0, VertexPos / 2); @@ -2357,7 +2472,7 @@ void D3DFB::DrawPixel(int x, int y, int palcolor, uint32 color) float(x), float(y), 0, 1, color }; EndBatch(); // Draw out any batched operations. - SetPixelShader(ColorOnlyShader); + SetPixelShader(Shaders[SHADER_VertexColor]); SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); D3DDevice->DrawPrimitiveUP(D3DPT_POINTLIST, 1, &pt, sizeof(FBVERTEX)); } @@ -2845,26 +2960,39 @@ void D3DFB::EndQuadBatch() // Set the pixel shader if (quad->ShaderNum == BQS_PalTex) { - if (!(quad->Flags & BQF_Bilinear)) - { - SetPixelShader((quad->Flags & BQF_InvertSource) ? InvPalTexShader : PalTexShader); - } - else - { - SetPixelShader(PalTexBilinearShader); - } + SetPixelShader(Shaders[(quad->Flags & BQF_InvertSource) ? + SHADER_NormalColorPalInv : SHADER_NormalColorPal]); } else if (quad->ShaderNum == BQS_Plain) { - SetPixelShader((quad->Flags & BQF_InvertSource) ? InvPlainShader : PlainShader); + SetPixelShader(Shaders[(quad->Flags & BQF_InvertSource) ? + SHADER_NormalColorInv : SHADER_NormalColor]); } else if (quad->ShaderNum == BQS_RedToAlpha) { - SetPixelShader(RedToAlphaShader); + SetPixelShader(Shaders[(quad->Flags & BQF_InvertSource) ? + SHADER_RedToAlphaInv : SHADER_RedToAlpha]); } else if (quad->ShaderNum == BQS_ColorOnly) { - SetPixelShader(ColorOnlyShader); + SetPixelShader(Shaders[SHADER_VertexColor]); + } + else if (quad->ShaderNum == BQS_SpecialColormap) + { + int select; + + select = !!(quad->Flags & BQF_InvertSource); + select |= !!(quad->Flags & BQF_Paletted) << 1; + SetPixelShader(Shaders[SHADER_SpecialColormap + select]); + } + else if (quad->ShaderNum == BQS_InGameColormap) + { + int select; + + select = !!(quad->Flags & BQF_Desaturated); + select |= !!(quad->Flags & BQF_InvertSource) << 1; + select |= !!(quad->Flags & BQF_Paletted) << 2; + SetPixelShader(Shaders[SHADER_InGameColormap + select]); } // Set the texture clamp addressing mode @@ -2983,7 +3111,47 @@ bool D3DFB::SetStyle(D3DTex *tex, DrawParms &parms, D3DCOLOR &color0, D3DCOLOR & SetColorOverlay(parms.colorOverlay, alpha, color0, color1); - if (style.Flags & STYLEF_ColorIsFixed) + if (parms.specialcolormap != NULL) + { // Emulate an invulnerability or similar colormap. + if (style.Flags & STYLEF_InvertSource) + { + quad.Flags |= BQF_InvertSource; + } + if (fmt == D3DFMT_L8) + { + quad.Flags |= BQF_GamePalette; + } + quad.ShaderNum = BQS_SpecialColormap; + color0 = D3DCOLOR_COLORVALUE(parms.specialcolormap->Colorize[0]/2, + parms.specialcolormap->Colorize[1]/2, parms.specialcolormap->Colorize[2]/2, 1); + color1 = 0; + } + else if (parms.colormapstyle != NULL) + { // Emulate the fading from an in-game colormap (colorized, faded, and desaturated) + if (style.Flags & STYLEF_InvertSource) + { + quad.Flags |= BQF_InvertSource; + } + if (fmt == D3DFMT_L8) + { + quad.Flags |= BQF_GamePalette; + } + if (parms.colormapstyle->Desaturate != 0) + { + quad.Flags |= BQF_Desaturated; + } + quad.ShaderNum = BQS_InGameColormap; + color0 = D3DCOLOR_ARGB(parms.colormapstyle->Desaturate, + parms.colormapstyle->Color.r, + parms.colormapstyle->Color.g, + parms.colormapstyle->Color.b); + double fadelevel = parms.colormapstyle->FadeLevel; + color1 = D3DCOLOR_ARGB(DWORD((1 - fadelevel) * 255), + DWORD(parms.colormapstyle->Fade.r * fadelevel), + DWORD(parms.colormapstyle->Fade.g * fadelevel), + DWORD(parms.colormapstyle->Fade.b * fadelevel)); + } + else if (style.Flags & STYLEF_ColorIsFixed) { if (style.Flags & STYLEF_InvertSource) { // Since the source color is a constant, we can invert it now @@ -3187,7 +3355,7 @@ void D3DFB::SetPaletteTexture(IDirect3DTexture9 *texture, int count, D3DCOLOR bo if (SM14) { // Shader Model 1.4 only uses 256-color palettes. - SetConstant(2, 1.f, 0.5f / 256.f, 0, 0); + SetConstant(PSCONST_PaletteMod, 1.f, 0.5f / 256.f, 0, 0); if (border_color != 0 && CurBorderColor != border_color) { CurBorderColor = border_color; @@ -3208,13 +3376,14 @@ void D3DFB::SetPaletteTexture(IDirect3DTexture9 *texture, int count, D3DCOLOR bo // The constant register c2 is used to hold the multiplier in the // x part and the adder in the y part. float fcount = 1 / float(count); - SetConstant(2, pc * fcount, pal * fcount, 0, 0); + SetConstant(PSCONST_PaletteMod, pc * fcount, pal * fcount, 0, 0); } SetTexture(1, texture); } void D3DFB::SetPalTexBilinearConstants(PackingTexture *tex) { +#if 0 float con[8]; // Don't bother doing anything if the constants won't be used. @@ -3233,4 +3402,5 @@ void D3DFB::SetPalTexBilinearConstants(PackingTexture *tex) con[7] = con[3]; D3DDevice->SetPixelShaderConstantF(3, con, 2); +#endif } diff --git a/src/win32/fb_d3d9_shaders.h b/src/win32/fb_d3d9_shaders.h deleted file mode 100644 index 2e72926140..0000000000 --- a/src/win32/fb_d3d9_shaders.h +++ /dev/null @@ -1,665 +0,0 @@ -#define HLSL_SOURCE_CODE 0 -#define SHADER_ASSEMBLY_CODE 0 - -// A paletted texture shader ------------------------------------------------ - -#if HLSL_SOURCE_CODE -sampler2D Image : register(s0); -sampler1D Palette : register(s1); -float4 PaletteMod : register(c2); - -float4 main (float2 texCoord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR -{ - float index = tex2D (Image, texCoord).x; - index = index * PaletteMod.x + PaletteMod.y; - float4 rgb = tex1D (Palette, index); - return Flash + rgb * InvFlash; -} -#elif SHADER_ASSEMBLY_CODE -// -// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000 -// -// fxc paltex.ps /Tps_1_4 /LD /VnPalTexShader14Def /Fhpaltex.h -// -// -// Parameters: -// -// sampler2D Image; -// sampler1D Palette; -// float4 PaletteMod; -// -// -// Registers: -// -// Name Reg Size -// ------------ ----- ---- -// PaletteMod c2 1 -// Image s0 1 -// Palette s1 1 -// - - ps_1_4 - texld r0, t0 - mad r0.xy, r0.x, c2.x, c2.y - phase - texld r1, r0 - mad r0, r1, v1, v0 - -// approximately 4 instruction slots used (2 texture, 2 arithmetic) -#endif - -const DWORD PalTexShader14Def[] = -{ - 0xffff0104, 0x0039fffe, 0x42415443, 0x0000001c, 0x000000ab, 0xffff0104, - 0x00000003, 0x0000001c, 0x00000100, 0x000000a4, 0x00000058, 0x00000003, - 0x00000001, 0x00000060, 0x00000000, 0x00000070, 0x00010003, 0x00000001, - 0x00000078, 0x00000000, 0x00000088, 0x00020002, 0x00020001, 0x00000094, - 0x00000000, 0x67616d49, 0xabab0065, 0x000c0004, 0x00010001, 0x00000001, - 0x00000000, 0x656c6150, 0x00657474, 0x000b0004, 0x00010001, 0x00000001, - 0x00000000, 0x656c6150, 0x4d657474, 0xab00646f, 0x00030001, 0x00040001, - 0x00000001, 0x00000000, 0x315f7370, 0x4d00345f, 0x6f726369, 0x74666f73, - 0x29522820, 0x44334420, 0x53203958, 0x65646168, 0x6f432072, 0x6c69706d, - 0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, 0xababab00, 0x00000042, - 0x800f0000, 0xb0e40000, 0x00000004, 0x80030000, 0x80000000, 0xa0000002, - 0xa0550002, 0x0000fffd, 0x00000042, 0x800f0001, 0x80e40000, 0x00000004, - 0x800f0000, 0x80e40001, 0x90e40001, 0x90e40000, 0x0000ffff -}; - -#if SHADER_ASSEMBLY_CODE - ps_2_0 - dcl t0.xy - dcl v0 - dcl v1 - dcl_2d s0 - dcl_2d s1 - texld r0, t0, s0 - mad r0.xy, r0.x, c2.x, c2.y - texld r0, r0, s1 - mov r1, v1 - mad r0, r0, r1, v0 - mov oC0, r0 - -// approximately 6 instruction slots used (2 texture, 4 arithmetic) -#endif - -const DWORD PalTexShader20Def[] = -{ - 0xffff0200, 0x0039fffe, 0x42415443, 0x0000001c, 0x000000ab, 0xffff0200, - 0x00000003, 0x0000001c, 0x00000100, 0x000000a4, 0x00000058, 0x00000003, - 0x00000001, 0x00000060, 0x00000000, 0x00000070, 0x00010003, 0x00000001, - 0x00000078, 0x00000000, 0x00000088, 0x00020002, 0x00020001, 0x00000094, - 0x00000000, 0x67616d49, 0xabab0065, 0x000c0004, 0x00010001, 0x00000001, - 0x00000000, 0x656c6150, 0x00657474, 0x000b0004, 0x00010001, 0x00000001, - 0x00000000, 0x656c6150, 0x4d657474, 0xab00646f, 0x00030001, 0x00040001, - 0x00000001, 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, - 0x29522820, 0x44334420, 0x53203958, 0x65646168, 0x6f432072, 0x6c69706d, - 0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, 0xababab00, 0x0200001f, - 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, - 0x80000000, 0x900f0001, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f, - 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, - 0x04000004, 0x80030000, 0x80000000, 0xa0000002, 0xa0550002, 0x03000042, - 0x800f0000, 0x80e40000, 0xa0e40801, 0x02000001, 0x800f0001, 0x90e40001, - 0x04000004, 0x800f0000, 0x80e40000, 0x80e40001, 0x90e40000, 0x02000001, - 0x800f0800, 0x80e40000, 0x0000ffff -}; - -// An inverted paletted texture shader -------------------------------------- - -#if HLSL_SOURCE_CODE -sampler2D Image : register(s0); -sampler1D Palette : register(s1); -float4 PaletteMod : register(c2); -float4 White : register(c6); // Preloaded with (1,1,1,0) - -float4 main (float2 texCoord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR -{ - float index = tex2D (Image, texCoord).x; - index = index * PaletteMod.x + PaletteMod.y; - float4 rgb = tex1D (Palette, index); - rgb.xyz = White.xyz - rgb.xyz; - return Flash + rgb * InvFlash; -} -#elif SHADER_ASSEMBLY_CODE -// -// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000 -// -// fxc paltex.ps /Tps_1_4 /LD /VnInvPalTexShader14Def /Fhinvpaltex.h -// -// -// Parameters: -// -// sampler2D Image; -// sampler1D Palette; -// float4 PaletteMod; -// float4 White; -// -// -// Registers: -// -// Name Reg Size -// ------------ ----- ---- -// PaletteMod c2 1 -// White c6 1 -// Image s0 1 -// Palette s1 1 -// - - ps_1_4 - texld r0, t0 - mad r0.xy, r0.x, c2.x, c2.y - phase - texld r1, r0 - add r1.xyz, -r1, c6 - mad r0, r1, v1, v0 - -// approximately 5 instruction slots used (2 texture, 3 arithmetic) -#endif - -const DWORD InvPalTexShader14Def[] = -{ - 0xffff0104, 0x003ffffe, 0x42415443, 0x0000001c, 0x000000c5, 0xffff0104, - 0x00000004, 0x0000001c, 0x00000100, 0x000000be, 0x0000006c, 0x00000003, - 0x00000001, 0x00000074, 0x00000000, 0x00000084, 0x00010003, 0x00000001, - 0x0000008c, 0x00000000, 0x0000009c, 0x00020002, 0x00020001, 0x000000a8, - 0x00000000, 0x000000b8, 0x00060002, 0x00020001, 0x000000a8, 0x00000000, - 0x67616d49, 0xabab0065, 0x000c0004, 0x00010001, 0x00000001, 0x00000000, - 0x656c6150, 0x00657474, 0x000b0004, 0x00010001, 0x00000001, 0x00000000, - 0x656c6150, 0x4d657474, 0xab00646f, 0x00030001, 0x00040001, 0x00000001, - 0x00000000, 0x74696857, 0x73700065, 0x345f315f, 0x63694d00, 0x6f736f72, - 0x28207466, 0x44202952, 0x39584433, 0x61685320, 0x20726564, 0x706d6f43, - 0x72656c69, 0x312e3920, 0x37372e35, 0x30302e39, 0xab003030, 0x00000042, - 0x800f0000, 0xb0e40000, 0x00000004, 0x80030000, 0x80000000, 0xa0000002, - 0xa0550002, 0x0000fffd, 0x00000042, 0x800f0001, 0x80e40000, 0x00000002, - 0x80070001, 0x81e40001, 0xa0e40006, 0x00000004, 0x800f0000, 0x80e40001, - 0x90e40001, 0x90e40000, 0x0000ffff -}; - -#if SHADER_ASSEMBLY_CODE - ps_2_0 - dcl t0.xy - dcl v0 - dcl v1 - dcl_2d s0 - dcl_2d s1 - texld r0, t0, s0 - mad r0.xy, r0.x, c2.x, c2.y - texld r0, r0, s1 - add r0.xyz, -r0, c6 - mov r1, v1 - mad r0, r0, r1, v0 - mov oC0, r0 - -// approximately 7 instruction slots used (2 texture, 5 arithmetic) -#endif - -const DWORD InvPalTexShader20Def[] = -{ - 0xffff0200, 0x003ffffe, 0x42415443, 0x0000001c, 0x000000c5, 0xffff0200, - 0x00000004, 0x0000001c, 0x20000100, 0x000000be, 0x0000006c, 0x00000003, - 0x00020001, 0x00000074, 0x00000000, 0x00000084, 0x00010003, 0x00060001, - 0x0000008c, 0x00000000, 0x0000009c, 0x00020002, 0x000a0001, 0x000000a8, - 0x00000000, 0x000000b8, 0x00060002, 0x001a0001, 0x000000a8, 0x00000000, - 0x67616d49, 0xabab0065, 0x000c0004, 0x00010001, 0x00000001, 0x00000000, - 0x656c6150, 0x00657474, 0x000b0004, 0x00010001, 0x00000001, 0x00000000, - 0x656c6150, 0x4d657474, 0xab00646f, 0x00030001, 0x00040001, 0x00000001, - 0x00000000, 0x74696857, 0x73700065, 0x305f325f, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39312e39, 0x3934392e, 0x3131322e, 0xabab0031, 0x0200001f, - 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, - 0x80000000, 0x900f0001, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f, - 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, - 0x04000004, 0x80030000, 0x80000000, 0xa0000002, 0xa0550002, 0x03000042, - 0x800f0000, 0x80e40000, 0xa0e40801, 0x03000002, 0x80070000, 0x81e40000, - 0xa0e40006, 0x02000001, 0x800f0001, 0x90e40001, 0x04000004, 0x800f0000, - 0x80e40000, 0x80e40001, 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, - 0x0000ffff -}; - -// A paletted texture shader that does bilinear filtering ------------------- - -#if HLSL_SOURCE_CODE -sampler2D Image : register(s0); -sampler2D Palette : register(s1); -float4 PaletteMod : register(c2); - -//#define texture_size_x 512.0f -//#define texture_size_y 256.0f -//#define texel_size_x 1.0f / 512.0f -//#define texel_size_y 1.0f / 256.0f - -// texture_size_x, texture_size_y, 0, texel_size_x -float4 size_a : register(c3); - -// 0, texel_size_y, texel_size_y, texel_size_x -float4 size_b : register(c4); - -float4 main (float2 texCoord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR -{ - float2 f = frac (texCoord.xy * size_a/*float2(texture_size_x, texture_size_y)*/); - - float4 t00 = tex2D(Image, texCoord); - float4 t10 = tex2D(Image, texCoord + size_a.wz/*float2(texel_size_x, 0)*/); - - t00.x = t00.x * PaletteMod.x + PaletteMod.y; - t10.x = t10.x * PaletteMod.x + PaletteMod.y; - - float4 c00 = tex2D(Palette, t00); - float4 c10 = tex2D(Palette, t10); - - float4 cA = lerp(c00, c10, f.x); - - float4 t01 = tex2D(Image, texCoord + size_b.xy/*float2(0, texel_size_y)*/); - float4 t11 = tex2D(Image, texCoord + size_b.wz/*float2(texel_size_x, texel_size_y)*/); - - t01.x = t01.x * PaletteMod.x + PaletteMod.y; - t11.x = t11.x * PaletteMod.x + PaletteMod.y; - - float4 c01 = tex2D(Palette, t01); - float4 c11 = tex2D(Palette, t11); - - float4 cB = lerp(c01, c11, f.x); - - return Flash + lerp(cA, cB, f.y) * InvFlash; -} -#elif SHADER_ASSEMBLY_CODE -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.19.949.2111 -// -// fxc paltex_bilinear.ps /Tps_2_0 /VnPalTexBilinearDef /Fhpaltex_bilinear.h -// -// -// Parameters: -// -// sampler2D Image; -// sampler2D Palette; -// float4 PaletteMod; -// float4 size_a; -// float4 size_b; -// -// -// Registers: -// -// Name Reg Size -// ------------ ----- ---- -// PaletteMod c2 1 -// size_a c3 1 -// size_b c4 1 -// Image s0 1 -// Palette s1 1 -// - - ps_2_0 - dcl t0.xy - dcl v0 - dcl v1 - dcl_2d s0 - dcl_2d s1 - add r0.xy, t0, c4 - add r1.xy, t0, c4.wzyx - add r2.xy, t0, c3.wzyx - texld r0, r0, s0 - texld r1, r1, s0 - texld r2, r2, s0 - texld r3, t0, s0 - mad r0.x, r0.x, c2.x, c2.y - mad r1.x, r1.x, c2.x, c2.y - mad r2.x, r2.x, c2.x, c2.y - mad r3.x, r3.x, c2.x, c2.y - texld r0, r0, s1 - texld r1, r1, s1 - texld r2, r2, s1 - texld r3, r3, s1 - mul r4.xy, t0, c3 - frc r4.xy, r4 - lrp r5, r4.x, r1, r0 - lrp r0, r4.x, r2, r3 - lrp r1, r4.y, r5, r0 - mov r0, v1 - mad r0, r1, r0, v0 - mov oC0, r0 - -// approximately 23 instruction slots used (8 texture, 15 arithmetic) -#endif - -const DWORD PalTexBilinearDef[] = -{ - 0xffff0200, 0x0042fffe, 0x42415443, 0x0000001c, 0x000000d1, 0xffff0200, - 0x00000005, 0x0000001c, 0x20000100, 0x000000ca, 0x00000080, 0x00000003, - 0x00020001, 0x00000088, 0x00000000, 0x00000098, 0x00010003, 0x00060001, - 0x00000088, 0x00000000, 0x000000a0, 0x00020002, 0x000a0001, 0x000000ac, - 0x00000000, 0x000000bc, 0x00030002, 0x000e0001, 0x000000ac, 0x00000000, - 0x000000c3, 0x00040002, 0x00120001, 0x000000ac, 0x00000000, 0x67616d49, - 0xabab0065, 0x000c0004, 0x00010001, 0x00000001, 0x00000000, 0x656c6150, - 0x00657474, 0x656c6150, 0x4d657474, 0xab00646f, 0x00030001, 0x00040001, - 0x00000001, 0x00000000, 0x657a6973, 0x7300615f, 0x5f657a69, 0x73700062, - 0x305f325f, 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, 0x204c534c, - 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x39312e39, 0x3934392e, - 0x3131322e, 0xabab0031, 0x0200001f, 0x80000000, 0xb0030000, 0x0200001f, - 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0x900f0001, 0x0200001f, - 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000002, - 0x80030000, 0xb0e40000, 0xa0e40004, 0x03000002, 0x80030001, 0xb0e40000, - 0xa01b0004, 0x03000002, 0x80030002, 0xb0e40000, 0xa01b0003, 0x03000042, - 0x800f0000, 0x80e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0x80e40001, - 0xa0e40800, 0x03000042, 0x800f0002, 0x80e40002, 0xa0e40800, 0x03000042, - 0x800f0003, 0xb0e40000, 0xa0e40800, 0x04000004, 0x80010000, 0x80000000, - 0xa0000002, 0xa0550002, 0x04000004, 0x80010001, 0x80000001, 0xa0000002, - 0xa0550002, 0x04000004, 0x80010002, 0x80000002, 0xa0000002, 0xa0550002, - 0x04000004, 0x80010003, 0x80000003, 0xa0000002, 0xa0550002, 0x03000042, - 0x800f0000, 0x80e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0x80e40001, - 0xa0e40801, 0x03000042, 0x800f0002, 0x80e40002, 0xa0e40801, 0x03000042, - 0x800f0003, 0x80e40003, 0xa0e40801, 0x03000005, 0x80030004, 0xb0e40000, - 0xa0e40003, 0x02000013, 0x80030004, 0x80e40004, 0x04000012, 0x800f0005, - 0x80000004, 0x80e40001, 0x80e40000, 0x04000012, 0x800f0000, 0x80000004, - 0x80e40002, 0x80e40003, 0x04000012, 0x800f0001, 0x80550004, 0x80e40005, - 0x80e40000, 0x02000001, 0x800f0000, 0x90e40001, 0x04000004, 0x800f0000, - 0x80e40001, 0x80e40000, 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, - 0x0000ffff -}; - -// A shader that doesn't look up colors from a palette. --------------------- -// Can be used for RGB textures. - -#if HLSL_SOURCE_CODE -sampler2D Image : register(s0); - -float4 main (float2 texCoord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR -{ - float4 index = tex2D (Image, texCoord); - return Flash + index * InvFlash; -} -#elif SHADER_ASSEMBLY_CODE -// -// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000 -// -// fxc plain.ps /Tps_1_1 /LD /VnPlainShaderDef /Fhplain.h -// -// -// Parameters: -// -// sampler2D Image; -// -// -// Registers: -// -// Name Reg Size -// ------------ ----- ---- -// Image s0 1 -// - - ps_1_1 - tex t0 - mad r0, t0, v1, v0 - -// approximately 2 instruction slots used (1 texture, 1 arithmetic) -#endif - -const DWORD PlainShaderDef[] = -{ - 0xffff0101, 0x0022fffe, 0x42415443, 0x0000001c, 0x0000004f, 0xffff0101, - 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000003, - 0x00000001, 0x00000038, 0x00000000, 0x67616d49, 0xabab0065, 0x000c0004, - 0x00010001, 0x00000001, 0x00000000, 0x315f7370, 0x4d00315f, 0x6f726369, - 0x74666f73, 0x29522820, 0x44334420, 0x53203958, 0x65646168, 0x6f432072, - 0x6c69706d, 0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, 0xababab00, - 0x00000042, 0xb00f0000, 0x00000004, 0x800f0000, 0xb0e40000, 0x90e40001, - 0x90e40000, 0x0000ffff -}; - -// A shader that inverts the source's colors -------------------------------- - -#if HLSL_SOURCE_CODE -sampler2D Image : register(s0); -float4 White : register(c6); // Preloaded with (1,1,1,0) - -float4 main (float2 texCoord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR -{ - float4 rgb = tex2D (Image, texCoord); - rgb.xyz = White.xyz - rgb.xyz; - return Flash + rgb * InvFlash; -} -#elif SHADER_ASSEMBLY_CODE -// -// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000 -// -// fxc plain.ps /Tps_1_1 /LD /VnInvPlainShaderDef /Fhinvplain.h -// -// -// Parameters: -// -// sampler2D Image; -// float4 White; -// -// -// Registers: -// -// Name Reg Size -// ------------ ----- ---- -// White c6 1 -// Image s0 1 -// - - ps_1_1 - tex t0 - add t0.xyz, -t0, c6 - mad r0, t0, v1, v0 - -// approximately 3 instruction slots used (1 texture, 2 arithmetic) -#endif - -const DWORD InvPlainShaderDef[] = -{ - 0xffff0101, 0x002dfffe, 0x42415443, 0x0000001c, 0x0000007b, 0xffff0101, - 0x00000002, 0x0000001c, 0x00000100, 0x00000074, 0x00000044, 0x00000003, - 0x00000001, 0x0000004c, 0x00000000, 0x0000005c, 0x00060002, 0x00020001, - 0x00000064, 0x00000000, 0x67616d49, 0xabab0065, 0x000c0004, 0x00010001, - 0x00000001, 0x00000000, 0x74696857, 0xabab0065, 0x00030001, 0x00040001, - 0x00000001, 0x00000000, 0x315f7370, 0x4d00315f, 0x6f726369, 0x74666f73, - 0x29522820, 0x44334420, 0x53203958, 0x65646168, 0x6f432072, 0x6c69706d, - 0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, 0xababab00, 0x00000042, - 0xb00f0000, 0x00000002, 0xb0070000, 0xb1e40000, 0xa0e40006, 0x00000004, - 0x800f0000, 0xb0e40000, 0x90e40001, 0x90e40000, 0x0000ffff -}; - -// A shader that copies the red component to the alpha component ------------ - -#if HLSL_SOURCE_CODE -sampler2D Image : register(s0); - -float4 main (float2 texCoord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR -{ - float4 color = tex2D (Image, texCoord); - color.a = color.r; - return Flash + color * InvFlash; -} -#elif SHADER_ASSEMBLY_CODE -// -// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000 -// -// fxc redtoalpha.ps /Tps_1_4 /LD /VnRedToAlphaDef /Fhredtoalpha.h -// -// -// Parameters: -// -// sampler2D Image; -// -// -// Registers: -// -// Name Reg Size -// ------------ ----- ---- -// Image s0 1 -// - - ps_1_4 - texld r0, t0 - mad r1.xyz, r0, v1, v0 - + mad r1.w, r0.x, v1.w, v0.w - mov r0, r1 - -// approximately 3 instruction slots used (1 texture, 2 arithmetic) -#endif - -const DWORD RedToAlphaDef[] = -{ - 0xffff0104, 0x0022fffe, 0x42415443, 0x0000001c, 0x0000004f, 0xffff0104, - 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000003, - 0x00000001, 0x00000038, 0x00000000, 0x67616d49, 0xabab0065, 0x000c0004, - 0x00010001, 0x00000001, 0x00000000, 0x315f7370, 0x4d00345f, 0x6f726369, - 0x74666f73, 0x29522820, 0x44334420, 0x53203958, 0x65646168, 0x6f432072, - 0x6c69706d, 0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, 0xababab00, - 0x00000042, 0x800f0000, 0xb0e40000, 0x00000004, 0x80070001, 0x80e40000, - 0x90e40001, 0x90e40000, 0x40000004, 0x80080001, 0x80000000, 0x90ff0001, - 0x90ff0000, 0x00000001, 0x800f0000, 0x80e40001, 0x0000ffff -}; - -// A shader that just returns the first color component from the vertex ----- - -#if HLSL_SOURCE_CODE -float4 main (float4 color : COLOR0) : COLOR -{ - return color; -} -#elif SHADER_ASSEMBLY_CODE -// -// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000 -// -// fxc coloronlyshader.ps /Tps_1_1 /LD /VnColorOnlyDef /Fhcoloronly.h -// - ps_1_1 - mov r0, v0 - -// approximately 1 instruction slot used -#endif - -const DWORD ColorOnlyDef[] = -{ - 0xffff0101, 0x0017fffe, 0x42415443, 0x0000001c, 0x00000023, 0xffff0101, - 0x00000000, 0x00000000, 0x00000100, 0x0000001c, 0x315f7370, 0x4d00315f, - 0x6f726369, 0x74666f73, 0x29522820, 0x44334420, 0x53203958, 0x65646168, - 0x6f432072, 0x6c69706d, 0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, - 0xababab00, 0x00000001, 0x800f0000, 0x90e40000, 0x0000ffff -}; - -// A shader that just corrects gamma for windowed mode ---------------------- - -#if HLSL_SOURCE_CODE -sampler2D Image : register(s0); -float4 Gamma : register(c7); - -float4 main (float2 texCoord : TEXCOORD0) : COLOR -{ - float4 color = tex2D (Image, texCoord); - color.xyz = pow(color.xyz, Gamma.xyz); - return color; -} -#elif SHADER_ASSEMBLY_CODE -// -// Generated by Microsoft (R) HLSL Shader Compiler 9.19.949.2111 -// -// fxc gammafixer.ps /Tps_2_0 /VnGammaFixerDef /Fhgammafixer.h -// -// -// Parameters: -// -// float4 Gamma; -// sampler2D Image; -// -// -// Registers: -// -// Name Reg Size -// ------------ ----- ---- -// Gamma c7 1 -// Image s0 1 -// - - ps_2_0 - dcl t0.xy - dcl_2d s0 - texld r0, t0, s0 - log r1.x, r0.x - log r1.y, r0.y - log r1.z, r0.z - mul r1.xyz, r1, c7 - exp r0.x, r1.x - exp r0.y, r1.y - exp r0.z, r1.z - mov oC0, r0 - -// approximately 9 instruction slots used (1 texture, 8 arithmetic) -#endif - -const DWORD GammaFixerDef[] = -{ - 0xffff0200, 0x002cfffe, 0x42415443, 0x0000001c, 0x0000007b, 0xffff0200, - 0x00000002, 0x0000001c, 0x20000100, 0x00000074, 0x00000044, 0x00070002, - 0x001e0001, 0x0000004c, 0x00000000, 0x0000005c, 0x00000003, 0x00020001, - 0x00000064, 0x00000000, 0x6d6d6147, 0xabab0061, 0x00030001, 0x00040001, - 0x00000001, 0x00000000, 0x67616d49, 0xabab0065, 0x000c0004, 0x00010001, - 0x00000001, 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, - 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, - 0x2e392072, 0x392e3931, 0x322e3934, 0x00313131, 0x0200001f, 0x80000000, - 0xb0030000, 0x0200001f, 0x90000000, 0xa00f0800, 0x03000042, 0x800f0000, - 0xb0e40000, 0xa0e40800, 0x0200000f, 0x80010001, 0x80000000, 0x0200000f, - 0x80020001, 0x80550000, 0x0200000f, 0x80040001, 0x80aa0000, 0x03000005, - 0x80070001, 0x80e40001, 0xa0e40007, 0x0200000e, 0x80010000, 0x80000001, - 0x0200000e, 0x80020000, 0x80550001, 0x0200000e, 0x80040000, 0x80aa0001, - 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff -}; - -// The shader used by the burn effect screen wipe --------------------------- - -#if HLSL_SOURCE_CODE -sampler2D NewScreen : register(s0); -sampler2D Burn : register(s1); - -float4 main (float2 coord[2] : TEXCOORD0) : COLOR -{ - float4 color = tex2D(NewScreen, coord[0]); - float4 alpha = tex2D(Burn, coord[1]); - color.a = alpha.r * 2; - return color; -} -#elif SHADER_ASSEMBLY_CODE -// -// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000 -// -// fxc burn.ps /Tps_1_4 /VnBurnShaderDef /Fhburn.h /LD -// -// -// Parameters: -// -// sampler2D Burn; -// sampler2D NewScreen; -// -// -// Registers: -// -// Name Reg Size -// ------------ ----- ---- -// NewScreen s0 1 -// Burn s1 1 -// - - ps_1_4 - texld r0, t0 - texld r1, t1 - add r0.w, r1.x, r1.x - + mov r0.xyz, r0 - -// approximately 3 instruction slots used (2 texture, 1 arithmetic) -#endif - -const DWORD BurnShaderDef[] = -{ - 0xffff0104, 0x0029fffe, 0x42415443, 0x0000001c, 0x0000006d, 0xffff0104, - 0x00000002, 0x0000001c, 0x00000100, 0x00000066, 0x00000044, 0x00010003, - 0x00000001, 0x0000004c, 0x00000000, 0x0000005c, 0x00000003, 0x00000001, - 0x0000004c, 0x00000000, 0x6e727542, 0xababab00, 0x000c0004, 0x00010001, - 0x00000001, 0x00000000, 0x5377654e, 0x65657263, 0x7370006e, 0x345f315f, - 0x63694d00, 0x6f736f72, 0x28207466, 0x44202952, 0x39584433, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x312e3920, 0x37372e35, 0x30302e39, - 0xab003030, 0x00000042, 0x800f0000, 0xb0e40000, 0x00000042, 0x800f0001, - 0xb0e40001, 0x00000002, 0x80080000, 0x80000001, 0x80000001, 0x40000001, - 0x80070000, 0x80e40000, 0x0000ffff -}; diff --git a/src/win32/fb_d3d9_wipe.cpp b/src/win32/fb_d3d9_wipe.cpp index a6adab9ee7..699407b85f 100644 --- a/src/win32/fb_d3d9_wipe.cpp +++ b/src/win32/fb_d3d9_wipe.cpp @@ -164,7 +164,7 @@ bool D3DFB::WipeStartScreen(int type) // Create another texture to copy the final wipe screen to so // we can still gamma correct the wipe. Since this is just for // gamma correction, it's okay to fail (though not desirable.) - if (PixelDoubling || (GammaFixerShader != NULL && Windowed)) + if (PixelDoubling || (Shaders[SHADER_GammaCorrection] != NULL && Windowed)) { if (SUCCEEDED(TempRenderTexture->GetSurfaceLevel(0, &tsurf))) { @@ -384,7 +384,7 @@ bool D3DFB::Wiper_Crossfade::Run(int ticks, D3DFB *fb) fb->D3DDevice->SetFVF(D3DFVF_FBVERTEX); fb->SetTexture(0, fb->FinalWipeScreen); fb->SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); - fb->SetPixelShader(fb->PlainShader); + fb->SetPixelShader(fb->Shaders[SHADER_NormalColor]); fb->D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX)); return Clock >= 32; @@ -442,7 +442,7 @@ bool D3DFB::Wiper_Melt::Run(int ticks, D3DFB *fb) fb->D3DDevice->SetFVF(D3DFVF_FBVERTEX); fb->SetTexture(0, fb->FinalWipeScreen); fb->SetAlphaBlend(D3DBLENDOP(0)); - fb->SetPixelShader(fb->PlainShader); + fb->SetPixelShader(fb->Shaders[SHADER_NormalColor]); fb->D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX)); int i, dy; @@ -504,7 +504,7 @@ D3DFB::Wiper_Burn::Wiper_Burn(D3DFB *fb) Density = 4; BurnTime = 0; memset(BurnArray, 0, sizeof(BurnArray)); - if (fb->BurnShader == NULL || FAILED(fb->D3DDevice->CreateTexture(WIDTH, HEIGHT, 1, + if (fb->Shaders[SHADER_BurnWipe] == NULL || FAILED(fb->D3DDevice->CreateTexture(WIDTH, HEIGHT, 1, D3DUSAGE_DYNAMIC, D3DFMT_L8, D3DPOOL_DEFAULT, &BurnTexture, NULL))) { BurnTexture = NULL; @@ -593,7 +593,7 @@ bool D3DFB::Wiper_Burn::Run(int ticks, D3DFB *fb) fb->SetTexture(0, fb->FinalWipeScreen); fb->SetTexture(1, BurnTexture); fb->SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); - fb->SetPixelShader(fb->BurnShader); + fb->SetPixelShader(fb->Shaders[SHADER_BurnWipe]); fb->D3DDevice->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); if (fb->SM14) { diff --git a/src/win32/win32iface.h b/src/win32/win32iface.h index 2c6440c2c3..59741597a7 100644 --- a/src/win32/win32iface.h +++ b/src/win32/win32iface.h @@ -244,6 +244,7 @@ public: void ReleaseScreenshotBuffer(); void SetBlendingRect (int x1, int y1, int x2, int y2); bool Begin2D (bool copy3d); + void DrawBlendingRect (); FNativeTexture *CreateTexture (FTexture *gametex, bool wrapping); FNativePalette *CreatePalette (FRemapTable *remap); void STACK_ARGS DrawTextureV (FTexture *img, int x, int y, uint32 tag, va_list tags); @@ -290,9 +291,49 @@ private: PackingTexture *Texture; }; + enum + { + PSCONST_PaletteMod = 2, + PSCONST_Weights = 6, + PSCONST_Gamma = 7, + }; + enum + { + SHADER_NormalColor, + SHADER_NormalColorPal, + SHADER_NormalColorInv, + SHADER_NormalColorPalInv, + + SHADER_RedToAlpha, + SHADER_RedToAlphaInv, + + SHADER_VertexColor, + + SHADER_SpecialColormap, + SHADER_SpecialColormapInv, + SHADER_SpecialColorMapPal, + SHADER_SpecialColorMapPalInv, + + SHADER_InGameColormap, + SHADER_InGameColormapDesat, + SHADER_InGameColormapInv, + SHADER_InGameColormapInvDesat, + SHADER_InGameColormapPal, + SHADER_InGameColormapPalDesat, + SHADER_InGameColormapPalInv, + SHADER_InGameColormapPalInvDesat, + + SHADER_BurnWipe, + SHADER_GammaCorrection, + + NUM_SHADERS + }; + static const char *const ShaderNames[NUM_SHADERS]; + void SetInitialState(); bool CreateResources(); void ReleaseResources(); + bool LoadShaders(); bool CreateFBTexture(); bool CreatePaletteTexture(); bool CreateGrayPaletteTexture(); @@ -386,12 +427,7 @@ private: int QuadBatchPos; enum { BATCH_None, BATCH_Quads, BATCH_Lines } BatchType; - IDirect3DPixelShader9 *PalTexShader, *PalTexBilinearShader, *InvPalTexShader; - IDirect3DPixelShader9 *PlainShader, *InvPlainShader; - IDirect3DPixelShader9 *RedToAlphaShader; - IDirect3DPixelShader9 *ColorOnlyShader; - IDirect3DPixelShader9 *GammaFixerShader; - IDirect3DPixelShader9 *BurnShader; + IDirect3DPixelShader9 *Shaders[NUM_SHADERS]; IDirect3DSurface9 *OldRenderTarget; IDirect3DTexture9 *InitialWipeScreen, *FinalWipeScreen; diff --git a/wadsrc/static/shaders/d3d/build.bat b/wadsrc/static/shaders/d3d/build.bat new file mode 100644 index 0000000000..ced04cd770 --- /dev/null +++ b/wadsrc/static/shaders/d3d/build.bat @@ -0,0 +1,10 @@ +cd sm14 +call build.bat + +cd ..\sm20 +call build.bat + +cd ..\sm30 +call build.bat + +cd .. diff --git a/wadsrc/static/shaders/d3d/shaders.ps b/wadsrc/static/shaders/d3d/shaders.ps new file mode 100644 index 0000000000..cf2899dccd --- /dev/null +++ b/wadsrc/static/shaders/d3d/shaders.ps @@ -0,0 +1,116 @@ +sampler2D Image : register(s0); +sampler1D Palette : register(s1); + +float4 PaletteMod : register(c2); +float4 Weights : register(c6); // RGB->Gray weighting { 77/256.0, 143/256.0, 37/256.0, 1 } +float4 Gamma : register(c7); + +float4 TextureLookup(float2 tex_coord) +{ +#if PALTEX + float index = tex2D(Image, tex_coord).x; + index = index * PaletteMod.x + PaletteMod.y; + return tex1D(Palette, index); +#else + return tex2D(Image, tex_coord); +#endif +} + +float4 Invert(float4 rgb) +{ +#if INVERT + rgb.rgb = Weights.www - rgb.xyz; +#endif + return rgb; +} + +float Grayscale(float4 rgb) +{ + return dot(rgb.rgb, Weights.rgb); +} + +float4 SampleTexture(float2 tex_coord) +{ + return Invert(TextureLookup(tex_coord)); +} + +// Normal color calculation for most drawing modes. + +float4 NormalColor(float2 tex_coord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR +{ + return Flash + SampleTexture(tex_coord) * InvFlash; +} + +// Copy the red channel to the alpha channel. Pays no attention to palettes. + +float4 RedToAlpha(float2 tex_coord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR +{ + float4 color = Invert(tex2D(Image, tex_coord)); + color.a = color.r; + return Flash + color * InvFlash; +} + +// Just return the value of c0. + +float4 VertexColor(float4 color : COLOR0) : COLOR +{ + return color; +} + +// Emulate one of the special colormaps. (Invulnerability, gold, etc.) + +float4 SpecialColormap(float2 tex_coord : TEXCOORD0, float4 icolor : COLOR0) : COLOR +{ + // We can't store values greater than 1.0 in a color register, so we multiply + // intensity by 2 and expect the caller to divide icolor by 2. + float4 color = SampleTexture(tex_coord); + float intensity = 2 * Grayscale(color); + color.rgb = icolor.rgb * intensity; + return color; +} + +// In-game colormap effect: fade to a particular color and multiply by another, with +// optional desaturation of the original color. Desaturation is packed into color.a. +// Fade level is packed int fade.a. Fade.rgb has been premultiplied by alpha. +float4 InGameColormap(float2 tex_coord : TEXCOORD0, float4 color : COLOR0, float4 fade : COLOR1) : COLOR +{ + float4 rgb = SampleTexture(tex_coord); + + // Desaturate +#if DESAT + float3 intensity; + float invdesat; + intensity.rgb = Grayscale(rgb) * color.a; + invdesat = Weights.w - color.a; + rgb.rgb = intensity + rgb * invdesat; +#endif + + // Fade + rgb.rgb = rgb.rgb * fade.aaa + fade.rgb; + + // Shade + rgb.rgb = rgb.rgb * color.rgb; + return rgb; +} + +// Windowed gamma correction. + +float4 GammaCorrection(float2 tex_coord : TEXCOORD0) : COLOR +{ + float4 color = tex2D(Image, tex_coord); + color.rgb = pow(color.rgb, Gamma.rgb); + return color; +} + +// The burn wipe effect. + +sampler2D NewScreen : register(s0); +sampler2D Burn : register(s1); + +float4 BurnWipe(float2 coord[2] : TEXCOORD0) : COLOR +{ + float4 color = tex2D(NewScreen, coord[0]); + float4 alpha = tex2D(Burn, coord[1]); + color.a = alpha.r * 2; + return color; +} diff --git a/wadsrc/static/shaders/d3d/sm14/BurnWipe.pso b/wadsrc/static/shaders/d3d/sm14/BurnWipe.pso new file mode 100644 index 0000000000000000000000000000000000000000..566e518b0d37c8cdce0d201ce8e040b181bb3a4a GIT binary patch literal 228 zcmZQ!{Qv*oe@zDG5Jx8&1_p*)AZ7uIF#%~1pMjBqAq_~m05LO=1LQLJ05J%}05LNV zBa1ne7UeOlUcH)yfd{M_BnJY1spY}RMX9NI352p8?4508$1(%nac&SO94d@XSq2Pi0uW znuUP}s0;)lprAP3Fy4g0H#4~?zc@dwL_s4+Q^Cd9CBjl6I3qD7wMfA^Ker$=2gtD0 zGc?sRH@DO?00N*4F4xEGCTod1_uTP4xrfo23DXv R15h3)-T+iH;s1XI1^~oKEj$1K literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm14/InGameColormapDesat.pso b/wadsrc/static/shaders/d3d/sm14/InGameColormapDesat.pso new file mode 100644 index 0000000000000000000000000000000000000000..2bafecca0f56d2eae3937a69541cd54e375c17f0 GIT binary patch literal 320 zcmX|*F>b;@5Jms4Hx5N4E#H*d~N@#u8ZA?Di#|;2Klp>SN#zO!JlTTTd#f;g+nv$^DBC#(CFg_xzRTERWlLaB(Kl=^TEu z@Z9de9S%LW!{8J7xLjRNf#PQVD^O#te{JY%jb4_%NNp6?mxq_orYBSM03NfD0k%8Dy;?fP~}{xv#{StZPLWC@^Bc`#8YpxCwk@nM9es zKHpmSVX#kP>Kq~e{wZF!)*Vd3?Kz60U1HXzb<=ITOWU07H=chso#=Q94{U6!)wOy( y+iJ4-L^k|fT}grGL;qKxsQYUH>Mnm;;F$`j8<{{KC^4hbJm+9u&$)9`3U~uhBsC2H literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm14/InGameColormapInvDesat.pso b/wadsrc/static/shaders/d3d/sm14/InGameColormapInvDesat.pso new file mode 100644 index 0000000000000000000000000000000000000000..286c765e2ff9e188e6ea0e67fea53af9c1cfd62c GIT binary patch literal 336 zcmYL@Jx;?w5QX2a7n1^s3sATu1r`yY$X$NiL<$WcL4g!S#3Yu89L4U^m>ZZIq<51; z?KxQ9*eIFR)9m+VW@n9Z?$_O5{4yL}0oYN7o@N$?0t%*>@>;}{S>m12@Y$lVXdGa& zo-Y&BwZR2_Ic>Zq>2g)%WREgOf0NI8vwJ+IAKNU?K8xV`sT;(1@mmx;ujY$n8;rB{ zCjH_i3VRP>zaNFS46dk0&C{19U=Q+Ng%0oT$A{aK2O8&6`xfr7?y;_6OCNTB_Rk)i j%v6S~*ssXaBmT*=;#Ufm!T{}_Qr4mH^Ljil12@#JY-iW9sAsz8HVo+Zs z;8Wz=JHU8Ve3YF&D)f`s&3)iHyRLxGgKeJ#Z$o=`agKhW`m$$NfL;*FMAm literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm14/InGameColormapPalDesat.pso b/wadsrc/static/shaders/d3d/sm14/InGameColormapPalDesat.pso new file mode 100644 index 0000000000000000000000000000000000000000..57892bae134e19a79b78442a4a2771ed8c9ea4fb GIT binary patch literal 432 zcmZusKTE?v9DSFbv7q1=aLA}ju&9)5we8|iDE>jW5^QV(DJe}pKn6#LxI1JNvN$@r z`9<)^&M9~xI}9*_ zM=^+J(&4Ab7wZ6T)^q=O=c{lLp{_M{ZG&_OrePB0c?6A}|NKchN3HB%HTPTGMDb#o zXIN*m-s}XE_->PC>3!}UTpW7itlFxF*pS9MQbw6Dm@hN$&%BpriEb@J<}}) z7{QAG>Xi<-6#eE2@Znke54&6@^AvThvF|6y4ACUXQ)5zS?ES~b#SFFbU)4NsbeCrH zg({mI}&GJ&gqTg FykG4mM^yj- literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm14/InGameColormapPalInvDesat.pso b/wadsrc/static/shaders/d3d/sm14/InGameColormapPalInvDesat.pso new file mode 100644 index 0000000000000000000000000000000000000000..7a3850318dc753577d73927889a46965d178c7d0 GIT binary patch literal 448 zcmZusJxjw-6g~McEhzX095U(>EGi{iY`ZuViXZ4!ij8d`C8fy^c!Hxt+#NCsSsWeR z{3H1r`aJhV5WyP`_ug|)&b`mIwEof&hL@*Lt-*Z!e)=)N3*|@4cH6R)bMk73TqtOQ68FV>!)|1 j<)552p8?4508$1(%nac&SO94d@XSq2Pi0uW znuUP}s0;)lprAP3Fy4g0H#4~?zc@dwL_s4+Q^Cd9CBjl6I3qD7wMfA^Ker$=2gtD0 qGc?sRH@DO?00N*Nat(|OPbL7xC;b17xl5QOLK>p4m9Nml707-ai=yJHiD%}&_uMqz{EdDE89u((p2BS9rxr%4)%fT%&ca3pJTaN$C3Ki~vQi+q5^mBKZa zmUj7({D!V?_A0@*JZ9$Yo7o+$ocnQ?7~WqEjsfgQO-(aO4F!BLWMr!;VHpK4WQzt` z@G1iFMg}~JeD@0Q>9zJB?Ru3g4C-3r$WM?Nf}12W)*5IW{-=-gIcnu!)x2-;VA93X z7FZY4-t-*fbhgQh{K_238ZpIvC08{}c)wcu0qu@QFGe0O5_Rnp&s_E%SE!=X>*0JXoqsu{- literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm14/RedToAlpha.pso b/wadsrc/static/shaders/d3d/sm14/RedToAlpha.pso new file mode 100644 index 0000000000000000000000000000000000000000..07e43e9f22749cdeea0af49fe4c992dd41b4680c GIT binary patch literal 212 zcmZQ!{Qv*oe52p8?4508$1(%nac&SO94d@XSq2Pi0uW znuUP}s0;)lprAP3Fy4g0H#4~?zc@dwL_s4+Q^Cd9CBjl6I3qD7wMfA^Ker$=2gtD0 zGc?sRH@DO?00N*3{NHi=?OqF2Sx@Cpcn&C>_1TK R{{)D={2(E00479Ez|%2 literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm14/RedToAlphaInv.pso b/wadsrc/static/shaders/d3d/sm14/RedToAlphaInv.pso new file mode 100644 index 0000000000000000000000000000000000000000..5f87a11cdec594f4b5cccb43f30b38ece61d8316 GIT binary patch literal 256 zcmX|*!4APd7=&kQgM-8iIP}Otqd}xMv=<2%Bpf6n6iqa3v^SS}1CQX|i-+ObUho&K$$BB4n+e@!rjS7o=eo& z>+_qHADqrU3@At(qFP6+NF|O$1x@;*!2318GCl=9s!BtL zdO0=reiVd7PFW>t|31xK!<}FqowFoQE(Pyz2HY7t2a9jRljmoAk;G|qC1dHvR5wja p9}(z8W&c)pOW^%#lV@m4UpDc6)^}wVWdoQ2t&&09>HQ%D@C9VBFeCr~ literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm14/SpecialColormapInv.pso b/wadsrc/static/shaders/d3d/sm14/SpecialColormapInv.pso new file mode 100644 index 0000000000000000000000000000000000000000..db027196e6d6775fb8c513f821f5a78467e68a26 GIT binary patch literal 264 zcmX|5y$ZrW7|YdKI|#mjLq{Dfii&jer;DJA3OWcPTD725Y&VxWx%vq1U3{oMhi9$@ zbA)`!g}YA|QhsFvqs3rY1#l;IW*Sv_2q2=kWFfbhP!-ms27?t1`z!&*m+jF*lISQi zS0~5P^N*(}q%V;AKfi{X)~180zq7KB{e?`$hVn!GZsi=1L-^8!{oh;i$EXj3dkq>FDZc^ZOSvb literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm14/SpecialColormapPal.pso b/wadsrc/static/shaders/d3d/sm14/SpecialColormapPal.pso new file mode 100644 index 0000000000000000000000000000000000000000..3cd83924c732fd1e169e9bdd96a8ddc8db544d59 GIT binary patch literal 372 zcmZusu}T9$6r8=RNkAb#U~#23he0J=7n3v=fuIrX!eQ3r;KGI6e!v!jjfEdzaiwsL zrKO!ea=)SL>|P}}%kbWt9cJH3VeO9{Vm!YX9Rm0wB{j+FW(eSuB_mtS2+iv7NVaI8 z1m^9Xp4>9Pm9MxZur)TP@+_}Q90U?|WrfPG@#OS5Osdo6Q* E0jBOmWdHyG literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm14/SpecialColormapPalInv.pso b/wadsrc/static/shaders/d3d/sm14/SpecialColormapPalInv.pso new file mode 100644 index 0000000000000000000000000000000000000000..8cd7bc2608db187186e5fdb0bd77e1ea2d637ce8 GIT binary patch literal 388 zcmZusu}T9$6r8=Rmji|TfW?*C90rweT};wg1Vjzmg~Oc5!G#OC{eTq&8w)?c;!5Ef zOG`U{c*pGJd0932r{qaL|Y zJq+elRGt?>`?3BBi%kIHxW zIxn^e?qk@Q*?q&pQ0k(dFq#eh2LRs$=oxHU;|zSUjR_ON*F>Ow)|@a2fq{)SSpG5n zL{StCwCZiS+IWpm;WCY5J-nao_K_ELG2JfHWS^`LPUr2>nFL|rgqy`GPMuNmvD?0r z3|#No9rQidd+GJi=B13!ct!co<;HVZ_RpW63%OsPYiEM06sxMWz~=v|1U17DRCj@1xlM`1qmf+(Pgzz3+YD9t`LHM6$}w|=Vp9^K0?;I@uB89 zoSrec!{L7S+_^Is(wLiRV>o>uJOVgUpeLDZjT3NS`k*9S2s|OOKI4a~QG%VhH5i|1 zmZi8{1Umu_RmNAAt`_tiH0aq=#&(~C$t%9svt7Q=mk0l4-10}!B=RS}>3p&Chk3SL zZwUP$d<**BFbI2{4xa5gfZ_(%ivLjeioty)kG{U5t_zR%_#11ek|jB=*dd?Q17`$W fC7_iHT{Q1+3)WC2OLAPXLq6M{x8^DqPGeJ@wPhduJi3TB{VN6ytk9X%IUN0Rj=IVUscHeqi7mH}0 zCimp@uzRb%Jqy>Ny}s-Y$J7pz_!eC$e8(F({?K#0@nC=soB2Y*;Srs~<3mD300x}n<@@Bnb&{ryF#tyT-lSv7D03?nwC;$Ke literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/InGameColormapDesat.pso b/wadsrc/static/shaders/d3d/sm20/InGameColormapDesat.pso new file mode 100644 index 0000000000000000000000000000000000000000..78ba2c4ac5999400902f54394ae67f49fc78620b GIT binary patch literal 368 zcmYLD%}T>S7@SRFx(6Y55zNto1PN8_(bj{7cxeSMLMb-30ZU4go0s(s;v3}NOCM^V z!*zDW^jn5+X1<^O;2HB{t}uSSADsjEBtXw&vKn7N&GbO{gn);P*~Tm3A*6SPrE`GE zX0gh#-v>CQZ{J_Mqz;D&On)a@vm{vso6;){AAni^t_= zTYQiVlk_$j-lR!-HyGf;ehnyIbvW{<`R4*1Zy=*~J6he9tOsOD2f{K1^~5@(Jl}{HT0~=UhbH zW0(iKw+mH>m#AYf@Ab<7t^}B=B8}{Y0VnBGuN6O)?4pl4T96zKT>pUr)_sz zj_q`sO;qG+;Kr+-e_e>bT7mi1F$^>5XXl&jPoFT-gu|MGg7o)1M4|(_^a@f!#N;@a R&3rQUG2>1n`{O1A@CN&kIurl^ literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/InGameColormapInvDesat.pso b/wadsrc/static/shaders/d3d/sm20/InGameColormapInvDesat.pso new file mode 100644 index 0000000000000000000000000000000000000000..8387b5b80b51b6f0fcb75b24ad7bd89ff69e620c GIT binary patch literal 384 zcmYLD%}T>S7@Xb2bPq!ABABBE2@s51D2E~H!tZM#5c&jmp;@! zhwJQW>$eQw%zQulK^pUIt}uMQADjdDBtTCxS&c1FF+C6-As~@5+ju1;0(xhdI|mr8 zW{V8FosU!c_Wj07mM@l7N$nB-(O;L-WO|LK{B2W|#d{T9j=RxgI!U9+ayHL4(Xd#p z^AD1KoZQC!n>*Ew;F8JLQ6uMgU5LDn1c_HgSTAz zPNtN1xVT{}23)zb2tc$wsR0tbix@o_pwE#?J>_dk|xX3^{n(78Pgu11qlFnNjR$vPOOt8B5P=!elo*gucLsMqb{M6U%D+<5z|-EyY|{!W+h z{Ho=pP!G)4efBn6cunPiE5l}vfYU6vn@s#u!w{E`k|#2@0(-oCSV|=SL>P9 zA`!6gq6zRuZ*U9j;JslVnptG~8+JVprXkAG#GY0VP47(*hglZF#O{B5kW5eteX7ZN zz3#(kI?GZl(y>22!615ACTa4RxktCh?p1%-cZaiJ5-#0dGG9b7gO2B)d7V?=^UvFD z9I7h=IbXB>i=E;(7TClEY-iQ*LNM;?Z*e$VtzlOy3h|o^=JM5oT=5@G-j_LY)>t3u z8EWPNRW3NQrDwL;Gt$h~xvgUhmDT`MT`DVhR<3kwMh!A*6-r0wzKVSn8Q*2s=ST_s E04{`B=Kufz literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/InGameColormapPalInv.pso b/wadsrc/static/shaders/d3d/sm20/InGameColormapPalInv.pso new file mode 100644 index 0000000000000000000000000000000000000000..acdd60934ebb4dd951699dbf5cb176a32265d1c3 GIT binary patch literal 440 zcmZvYu}Z^G6o&ts#5AaoT?8}g5+qcylh`f_Er?YdOR%vGq@*-?fD{}Z@&FDQ3t2ik zy7?k`4zGW1Q+4nrKmR#j&N=tyLX+}KUZQt@)jb68NrB9u)j5{H2Q8v>N&SBX_!*jv7tFFanZ?%S16}&gTI&)+kT4;FqTayXakm~}i fx@T!Zs-8L*s3@7!^BpyJ!&pbgGg@k&OiJJzjIB*< literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/InGameColormapPalInvDesat.pso b/wadsrc/static/shaders/d3d/sm20/InGameColormapPalInvDesat.pso new file mode 100644 index 0000000000000000000000000000000000000000..f9adfebdfd5a699dc5c0aec9162563770536fa4f GIT binary patch literal 508 zcmZutF-yZx5dK~o)1X3k5zMGdkWj@=V!J4`AlBkof{ksUC8fy^NWsw|?hYM=EFB%) z{3Gvo`25~$tcx!kclX_W-(3!tQs3$lo%^fyA%HI$h}m>H#}fFYo6>4D0Sg(ue$TWT z5djA;1_9paEq(&Kc(1SzgE_g}Tm{nzLgx>f{W_k-2Mf*TfE_(FFTBLtDYwxt_DZs7Z`kh1L$#lQ%%dqmj}B#QO`_69zJcP~Da&(StpRNw9} z^Zo5CR3V;X0B^f+djQr1SW`$c#{=+5W1>SSP%$UVSjPKvgu2$yWnG?6r1{R?jj_5O zvLsJVcXPNInSKxkW_Z~jqs;V@IKAE|9Lt_r&eXQ-`DB7Vo%upRr{=GX@~aj6bP3(4 j-1nCZ&bJNpwxYkvnL+1 literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/NormalColorInv.pso b/wadsrc/static/shaders/d3d/sm20/NormalColorInv.pso new file mode 100644 index 0000000000000000000000000000000000000000..e18767e87b2a0751847781eb9020fd432c854e56 GIT binary patch literal 312 zcmYLEy$ZrG7`(=!9fa;8*ik`>6cru)85HWGf{P%cRSQbRc5~4;=p%G@@uB)0#!E#_ zIPSjt@+B7tDPOXV!MxWm1Go~PCrGNs9f(LnB1dQtaLH;d34uJl61JHGj8E&mhsQ%l zk-plWwebA?AqrXN2>s`u!h($ literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/NormalColorPal.pso b/wadsrc/static/shaders/d3d/sm20/NormalColorPal.pso new file mode 100644 index 0000000000000000000000000000000000000000..68a1f3fac03b91f32637b6e13418ea9733dbd30f GIT binary patch literal 392 zcmZus%SyvQ6g@KuQdGzf2xh69Afc6ZX}eKqL9Bwi8rrCZmV`D7m*dXmEc}2h+-1{` z%6D`;GmVc$?{GQip8Fg~W45M?!TnYL1VBXxHIHCpyaQi^N4nJnB%X-Ya=J%F-~ew< z0X~S5Pv8)rjdrt4UQ$$*k7HLY8vQm|q(za!$I(80l+92Hx4~zAXZd;(PcAT;PgmJG zdoIGWyYujRI39-M*JPHi!a=so=L?cv6kkTYP8`MEb{nVmEI{$%%^wf+4;T358m*vg zbS=pH?&|@2>kV3U>4PW3V+_TirNqPk8YNi6dnIQofm-kCUB8X(9BuR5W4SU0_y(t| BLqPxl literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/NormalColorPalInv.pso b/wadsrc/static/shaders/d3d/sm20/NormalColorPalInv.pso new file mode 100644 index 0000000000000000000000000000000000000000..8276561f0ca5015b62818d119d61837dcf3dafc2 GIT binary patch literal 436 zcmZvYKTE?v7{;GVLM$p|7r~6W1PN8_B({q}3t|<=5^QV(DJe}pKnjiy`2Y?X3t2ik zy7@)&IXs`c#_Hf*Uf$<^_x{PfFr@sFm+0MJbq@i2(m-a>sWXT41XSw4Acxg`n>0u{g}F*J#xx=f=IVnd|gkSRZOAo*;naYO5htp-%ITP literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/RedToAlpha.pso b/wadsrc/static/shaders/d3d/sm20/RedToAlpha.pso new file mode 100644 index 0000000000000000000000000000000000000000..cd74d5586649502f99a1b0f90346e166ff820302 GIT binary patch literal 272 zcmYLDI|{-;6r8L9QwX_$VC=LB5~9S?*hEkSwHMK-0VQHQK)k^o!9IZy2KYwayBI}bqDEbxcb&4Ox9nh& ztj}qdZZA%2)^?)teC*8kt4(}%hUxK?97y`E*K_+_&-DV|M}x`SkTdE2=eGQE13xZd u*|+fZC7b^84y(K|U(k~qD5VLQ0#$vdXN@1tA_p}^R8qg;u3XTg6z~KbNHoX* literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/RedToAlphaInv.pso b/wadsrc/static/shaders/d3d/sm20/RedToAlphaInv.pso new file mode 100644 index 0000000000000000000000000000000000000000..1aeadb9fb3156940f409752b6904e5e73b268672 GIT binary patch literal 328 zcmYLD&1%9x7@Yi|ITUg)h32SGLJ2C((b$7RylA19f=Ep@(2$Vi<|V#C9>Kd8A1cq` zI=gB0TZV6DzHfI2x)2xfg2~4?cml8|Ku>3r8V8_cdnXJ+gN~40))%3pL+=qAnRuWtPg|c+yxo-rwLzFSKPy(=>J{_&J5P)Br*wLYzB3J%p|jkrH&O0P(j<$2 zNqpBEx&F{|y|=*t&+==aVyg3<+x0)!aN{*B`xvPBHusw|tmeqehK8=xhYrM_wy2>r Zb92S6G&Hpd25!0Bm#Ed;Qtwql09R%3J4pZl literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/SpecialColormap.pso b/wadsrc/static/shaders/d3d/sm20/SpecialColormap.pso new file mode 100644 index 0000000000000000000000000000000000000000..b708ae7b4680588969f11f6bf62bd00392983c6c GIT binary patch literal 300 zcmYLDy^6v>7@Vw8Qwa8QU`hoE5^|#D=@lo$Mg*@*J+S ztLV23^TY7%2O;H6b}*WM4L<<<5nv`r%HtnMNZ&+>Fd*QQ)hr2t3bO{bIswMV^)A5W zVxq=ey~iwqaJNrl`VwKj@>9HWS6xiP%{hvr-^6ZB+xCw?^X=Jwy$#OxC_0|P1I55` zd(Pm~b=uUDY8LWCf)F;>3DXy@J+@d#NDW6tQQL zJG)x@mf_9J+u3~(QeNZ>CZD766M!EA^aPvII08A_8(|U#1Oj$dOG3b+*TP0Sz(>5^ zhB%!Xc%-k+wH9Ht-Q^jzNi^<$nyvg*7t`qLkYves?zU$g_dS>g?tHi2ga>z$#A&oA z8G3%-8@~FUKj`)FtiA>cZgu|Wc6s9^oMtuFD>r$kKEtUi222CC(nkxja}^n9(3N;oSBlo;JYecND2G`2GKYA literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/SpecialColormapPal.pso b/wadsrc/static/shaders/d3d/sm20/SpecialColormapPal.pso new file mode 100644 index 0000000000000000000000000000000000000000..5985d0ba5cc60ec1053c8aaea0a447af136182bb GIT binary patch literal 424 zcmZutKTE?v9DSF>G^o&B1T*RqBvi4J*e(h!h*ca*u(1uKq%`>e5gZ-z0UR<4Svq#? z<`>E5@O*d1KZAF9y!U(e?su1iA?1fWNB{Psw-4Z*06mMOYCHiOQcReHfPsvx#xr5k z5wP*19pII0a0+bWt?|~{v+3>qcvtga8ltK!?CK7p$zBI>m}Ma>?EL2slL;!JPqn!I zHSWV`I?GZl(y>22#xQzVCTa4RxraAL?&V-Ka7VLX5-#0-GG9b7Mc4CBz3z$c`DdLD z4%C%_oPV?W)vcn@1)O&Itp#;YKSi7QdIhI0`BwZ)*2vkYG;sGflM7}X1_T_nC$~{E ZqiT^0NR2Jsvqi1$Q5R%`=jyzaz$ZzSNxuL9 literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/SpecialColormapPalInv.pso b/wadsrc/static/shaders/d3d/sm20/SpecialColormapPalInv.pso new file mode 100644 index 0000000000000000000000000000000000000000..eb523d2ef6d720ca38532cd04e7119265aff3dad GIT binary patch literal 440 zcmZvYF-yZh7>3_VViHv7E`k|#2@t;_kDMlgQ3)?I!EvJqPq{^g94ewQ0G_z?+giLQUV5Y#(F$a zCW(NJXH9??MuSse8?Oy})66E@`(anJa1x;`E$r$YL{obmCQ+V8u(0zVAEaZHLZ51J z{d?R;@no83m}jG4bc{j#ut>A?G4~E{j=anMuvE@6Pk`6ocf)Uzz@#a zZ5-5B1|#H@~s^DAkGnqqjqr$-5-x?`cLv9KK+}NQ8yFb)CoqE89Q;7` IlL;Uj0C&tCv;Y7A literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm20/build.bat b/wadsrc/static/shaders/d3d/sm20/build.bat new file mode 100644 index 0000000000..e424d92a77 --- /dev/null +++ b/wadsrc/static/shaders/d3d/sm20/build.bat @@ -0,0 +1,27 @@ +fxc ..\shaders.ps /Tps_2_0 /O3 /ENormalColor -DPALTEX=0 -DINVERT=0 /FoNormalColor.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /ENormalColor -DPALTEX=0 -DINVERT=1 /FoNormalColorInv.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /ENormalColor -DPALTEX=1 -DINVERT=0 /FoNormalColorPal.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /ENormalColor -DPALTEX=1 -DINVERT=1 /FoNormalColorPalInv.pso + +fxc ..\shaders.ps /Tps_2_0 /O3 /ERedToAlpha -DINVERT=0 /FoRedToAlpha.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /ERedToAlpha -DINVERT=1 /FoRedToAlphaInv.pso + +fxc ..\shaders.ps /Tps_2_0 /O3 /EVertexColor /FoVertexColor.pso + +fxc ..\shaders.ps /Tps_2_0 /O3 /ESpecialColormap -DPALTEX=0 -DINVERT=0 /FoSpecialColormap.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /ESpecialColormap -DPALTEX=0 -DINVERT=1 /FoSpecialColormapInv.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /ESpecialColormap -DPALTEX=1 -DINVERT=0 /FoSpecialColormapPal.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /ESpecialColormap -DPALTEX=1 -DINVERT=1 /FoSpecialColormapPalInv.pso + +fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=0 -DDESAT=0 /FoInGameColormap.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=0 -DDESAT=1 /FoInGameColormapDesat.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=1 -DDESAT=0 /FoInGameColormapInv.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=1 -DDESAT=1 /FoInGameColormapInvDesat.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=0 -DDESAT=0 /FoInGameColormapPal.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=0 -DDESAT=1 /FoInGameColormapPalDesat.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=1 -DDESAT=0 /FoInGameColormapPalInv.pso +fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=1 -DDESAT=1 /FoInGameColormapPalInvDesat.pso + +fxc ..\shaders.ps /Tps_2_0 /O3 /EBurnWipe /FoBurnWipe.pso + +fxc ..\shaders.ps /Tps_2_0 /O3 /EGammaCorrection /FoGammaCorrection.pso diff --git a/wadsrc/static/shaders/d3d/sm30/BurnWipe.pso b/wadsrc/static/shaders/d3d/sm30/BurnWipe.pso new file mode 100644 index 0000000000000000000000000000000000000000..0626821f7af6148b52f2b7a71675461cde675000 GIT binary patch literal 300 zcmZ8b%MQU%6r9_7bRqEr5?!*;NIk+*Sy+^XT1rHykf2h8o%#cxVBg>Bcev(yY@D0P znKN_ly#rm!r>vkm?l=ViR|3>DHZ|i0T-bVq4#AUwt8~_c&gt+l%Cxl?s5eyM^=ceZd9wF=TS~NYulS$S11+GkE%7hIAHH6A%tf>-Zu#+f*F^SVO z#^YhIW5A+xOw)M3rEj4^PaPenOVoFIDJ z^!=dg_d9_f^xAFIxlS1n+~BU5x832m`S7)pOTS=Ub1gI?*hiIq^Q-WEUsQPv^stWaRn-chvV?e;5R40kR4d+*BG~Cl{#wxhN#; sFXxsL%6?3~C)w(jy$}j9y(7#!2e@C& z76rE32#56L`(4jPxmY$ebx1^i{<@xCPA~9KzHX|zdTWx?$Ft-vpXAA8Ihz-oWK^xz zm~Vvd_wO2R=&e^ zHj%z%cr&wa_q_*Q%By_A?DJ#V2k=LLo?ucM1&}e#37ya&;4`cECImY49yxI5OB5>~8oniEJGdu$DL4cZM@HsX>&2UQugn&fG=+6rw5m7tD>{kKq zm(zKU?KZ?db^o>JIWOjmx?&y>;h(;$CKr=)JQT0%vMS%|_~h|4zRSj0JYGy^`8pnz z%T@7CGDy;^WN?`#>2<%4V~*YdG`BLI?~x1iIxe*AIHwz^Uc>ireW4?`M!H9Q=SBddqM1 zJ6zvxgLrV3VcxuXvoixn>u=q|@cw#m0-&aYoWo#pd;nX9N4ntz3Qvs2GP*-XaEN!y z0H2JCPte9!!`-gp*93L#;@GOC;qT&QlIICr9R0_S(>ZFf6I|B!mThJivvZ6W&+BxP zzT`n?au(c-rlVl`7SEG)Ficn3VoA^sqpPrg8HG`=+r=r@Isgi8TpHXa7PJ~Hg@SJ} zr?{k5^QV(DJe}pAc98^>D@z)LVm!b zH-9AG;X1nw>cLGOZ{Fw-(B|h0erGR&SFzDo`4Uwm}RmA3}ozTJ+n+Q z0ybVW1H7^ud<0r}Yq)pK+2r?W$WlPAdz^WeUNyCK$$R8$&=2$h z_2cqaGtLDy%%;aSrwcl7LNY@?$Om}HQOFN? z^yZKBJ6vBjK|Hv-!@PMjZ+3TJDD|x_F}%MT902&Dft*QK$JhX$bTQ4K2}or0^?IQh zWCSd{Y6f_tm)rtfytmwk<}7mizue6-n1`q;6MMRYXlrkSILxvTCU*bh$H@$p(6^e* zH|sHs=8G)FDxIEAPcV+2)=8Q?XYSG6v3ot5jNHj0n1yS1m@HROOwjlIbFY8qd;UeQ zheJMj2gv!GqQ+fffliA>F5zg*+X~oDS=ZE95D)ZN9BQ}BZA;FLM=%C;C?y{L)UYpW l$a9pPTC=gBO8!H_wi&Cu(d!)bs*vo?{k5^QV(DJg9}U<)2StalGN3jG0( z-u#jLgcsM@Bc0Wh1X4H^C%{0H~rIQ`^0bh zXRQ|YIr0V|c^hSLomikzVIi#wvzvn3$c)BdK}^7B5z>Lq1oU%`)b4X$^b>(Pvt2 literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm30/NormalColor.pso b/wadsrc/static/shaders/d3d/sm30/NormalColor.pso new file mode 100644 index 0000000000000000000000000000000000000000..b0e385fb77008c90344faf0486381faf93aa6f2e GIT binary patch literal 240 zcmXX=%L;-}6dWHxMBonu*{(Jc_Q00q#=r=wy+}_XQLGQBKe(UZ-rw>&y3H-mVVF7R z4tEX=DL--m|FB&30Bi|xr;*f*HxQ7q4OXMIm)>Zm h2(+zo^*hO;zvf(*%-89suNEd?(xcw^#}7hE;0qihE|vfQ literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm30/NormalColorInv.pso b/wadsrc/static/shaders/d3d/sm30/NormalColorInv.pso new file mode 100644 index 0000000000000000000000000000000000000000..8dfc542fa04f07ed90f01e6a1f4cbfddb0efa2d8 GIT binary patch literal 300 zcmX|6!D_-#5S+ZEHi(eB2+h%g1c|ojQSCt?y);5Eg%C7qz>r{a>qY+{pOCx1mGAI% zUX<=**x6zC?JRUDZ*qXedN%I?_$5G1FsT|BpkVqSbV7rG$E@Oq5NJ{BV%sRdDhc-y zu2%yc>gwI&JBs&*B4@1=#=oBB!6+EwGv1uiJlz#`|LfIWdcJ4-hj1I6>_wVn@sVWe zxbM#N&2`+#c#IdWege*PRVv;l*I+%kb`}rL?IldBnm6_>_SdZIiuduHXH{QXkQIFj U&U3CV4bY(3^zzSIp_CH%19IUufB*mh literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm30/NormalColorPal.pso b/wadsrc/static/shaders/d3d/sm30/NormalColorPal.pso new file mode 100644 index 0000000000000000000000000000000000000000..d813d66146e2d42173593ea21b2c1e0a10ca4373 GIT binary patch literal 380 zcmZusJx{_=6g~H~8UiH!115CTr7;BwjKHD^Bt|rG!$zu*K-xeDN8A`Y_yany^>6ie z_&o2~!NL1-bI(2Z+>ZxG>u){4ILC)& zfFq;g6EyKvb9dY5Jw{o&Xj`?^{C%{Evn+;-)_?pgS)vrX!Dao|(*2^lxW;V#x=Z%S zTjpOrT=}=t`P84UqGi1EC&@NlZwQ7#*bjy`VGs^_J#={18F1jmxxr0hfmdTWs2X!i zj)qqljln`ZwqN(yTd`IZE_gD8IoO9n;pvZtbE)CIit|~oa;tCHe(tP{=UM|lbe}** literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm30/NormalColorPalInv.pso b/wadsrc/static/shaders/d3d/sm30/NormalColorPalInv.pso new file mode 100644 index 0000000000000000000000000000000000000000..8ad0334958bf2e3fc34c479eeeafe912de36c721 GIT binary patch literal 424 zcmZut!AiqG6r4?BELF%|1as6&kXXf@#P(vL1+j|9671RrQc{|HKnor{JvP7xLqgbufQ6hOrokB?3)Ur@!m#>%yS6`d;jU9bc#xtt`5(C z)}xGP^E|^co19HfF^Zp7X_h|c{_)+3e={5p{qa1S%9Y@Uqjv z5wE-htofQk^ESDF*Ko168qRJ7T3)F=nhWxt8H>l%!!>Og-MA)+m$$z5$nfNb&#x literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm30/RedToAlpha.pso b/wadsrc/static/shaders/d3d/sm30/RedToAlpha.pso new file mode 100644 index 0000000000000000000000000000000000000000..749ad1aba9d383ae9d8ea0fbb7f8a4bcfe4b6bfb GIT binary patch literal 240 zcmXX=%L;-}6dWHxMBonu8MLU4h&|9{wlOGzY%fywfWpW=!2ZBbaPM#V9o^=Z=P=Bi zbB8+znh+l`z;eIvdjPfsxKl`S#v2GoHlYy;RJdeWt9yJ-P*pm*+{^ygBa0@Hjm`D& zOtbX#GDo|y8LY##8D8RJ@-&y}{c*ifc$PD_yqRM;?sSSiptgXVNrluMY6V84m0WE! jQwp?=(*K=g&|h<|OXjQe(^nTdpwq**A^)f)3L$_m5u+{E literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm30/RedToAlphaInv.pso b/wadsrc/static/shaders/d3d/sm30/RedToAlphaInv.pso new file mode 100644 index 0000000000000000000000000000000000000000..600de5c801659544c2fd5258173e572dc8bed055 GIT binary patch literal 300 zcmX|6!D_-#5S+ZEK}5)13eCZT1ql*ksmE#$72-t;y%a<=CILgl8q@ehC4SS{J)U0p`gj z3~;#^=ulVh9zQ`GMtR0sCyamnn5{?aAr|rWlxFEZxBJUi`^#VX_A1)!f|ETp>IJcK*S=F?$Z?V5-U01x1=cu}OHX$qe V6rAT=T^gXlR@2KrYlTuu;09FDHOK$} literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm30/SpecialColormap.pso b/wadsrc/static/shaders/d3d/sm30/SpecialColormap.pso new file mode 100644 index 0000000000000000000000000000000000000000..d815257d5288b04648629ce9e941633dfc908c17 GIT binary patch literal 300 zcmX|6ONzok6s#nUX+&^82xh4uL82qN^s|_OxKY845Q1hjFcLA@xrsOM2-$nBoMYPR z7JNf8E36^JClw@JE1}$s`;nAY+;m7Gc1I&n)ppn6RlmV^=G{e7_9? zoX-tBQI~g(br6S9mXcdUhJSLTlgx0Bkqo literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm30/SpecialColormapPal.pso b/wadsrc/static/shaders/d3d/sm30/SpecialColormapPal.pso new file mode 100644 index 0000000000000000000000000000000000000000..fbd9c32306859fc0216e75e32535820675bf3b2c GIT binary patch literal 424 zcmZut!AiqG5Ph4(G*qE?5zJ99L1Gnq65ESH3t|0%it1ic_U4|-=|5MFe< zIONDXK*7H$HEt6Nv<&78CA?0hd5r~e->jlTeZyQ+aaa5VV-yrs79Rd+*ozv^)M!mp fxM(WQZo%^yD_z6YZt8Up&SJxBF{kHfN~M4wz*9!Q literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm30/SpecialColormapPalInv.pso b/wadsrc/static/shaders/d3d/sm30/SpecialColormapPalInv.pso new file mode 100644 index 0000000000000000000000000000000000000000..9c57af2dc3a7b5219f280fcf14138274f6260295 GIT binary patch literal 440 zcmZut!AiqG5Ph4(G*qE?5zJ99L1Gnq65ES~7Q`wZOR%vGq@*$OrV0qmUo) z*qc9+?{Iy)t>VGm4D;sAo7u_0l=4enqxW#rJp%Aa138OM#aICwx|n9t1Po;K>b%lS zG6FWIlBSJVJve;=Tv>2+xXFL`>CFs&4i literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm30/VertexColor.pso b/wadsrc/static/shaders/d3d/sm30/VertexColor.pso new file mode 100644 index 0000000000000000000000000000000000000000..46e56db6bc6d0029d4431d67cdba3e8894f1312a GIT binary patch literal 124 zcmZQz{{R2qe=!E<5Jx8&1_lOYAZ7rHfhaI&WMBY^7Zk@E#~U#CW+oTq7w4yyC};#} zDtPz=`zQowB&MVmDLCin7G&lC8J2oRW_p&UMtVjTCMFE>3=B+M3=9nn4Ez%qfouj2 LejxkF1dt5?dG8&; literal 0 HcmV?d00001 diff --git a/wadsrc/static/shaders/d3d/sm30/build.bat b/wadsrc/static/shaders/d3d/sm30/build.bat new file mode 100644 index 0000000000..d0edc16b78 --- /dev/null +++ b/wadsrc/static/shaders/d3d/sm30/build.bat @@ -0,0 +1,27 @@ +fxc ..\shaders.ps /Tps_3_0 /O3 /ENormalColor -DPALTEX=0 -DINVERT=0 /FoNormalColor.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /ENormalColor -DPALTEX=0 -DINVERT=1 /FoNormalColorInv.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /ENormalColor -DPALTEX=1 -DINVERT=0 /FoNormalColorPal.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /ENormalColor -DPALTEX=1 -DINVERT=1 /FoNormalColorPalInv.pso + +fxc ..\shaders.ps /Tps_3_0 /O3 /ERedToAlpha -DINVERT=0 /FoRedToAlpha.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /ERedToAlpha -DINVERT=1 /FoRedToAlphaInv.pso + +fxc ..\shaders.ps /Tps_3_0 /O3 /EVertexColor /FoVertexColor.pso + +fxc ..\shaders.ps /Tps_3_0 /O3 /ESpecialColormap -DPALTEX=0 -DINVERT=0 /FoSpecialColormap.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /ESpecialColormap -DPALTEX=0 -DINVERT=1 /FoSpecialColormapInv.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /ESpecialColormap -DPALTEX=1 -DINVERT=0 /FoSpecialColormapPal.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /ESpecialColormap -DPALTEX=1 -DINVERT=1 /FoSpecialColormapPalInv.pso + +fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=0 -DDESAT=0 /FoInGameColormap.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=0 -DDESAT=1 /FoInGameColormapDesat.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=1 -DDESAT=0 /FoInGameColormapInv.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=1 -DDESAT=1 /FoInGameColormapInvDesat.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=0 -DDESAT=0 /FoInGameColormapPal.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=0 -DDESAT=1 /FoInGameColormapPalDesat.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=1 -DDESAT=0 /FoInGameColormapPalInv.pso +fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=1 -DDESAT=1 /FoInGameColormapPalInvDesat.pso + +fxc ..\shaders.ps /Tps_3_0 /O3 /EBurnWipe /FoBurnWipe.pso + +fxc ..\shaders.ps /Tps_3_0 /O3 /EGammaCorrection /FoGammaCorrection.pso diff --git a/zdoom.vcproj b/zdoom.vcproj index 9350909795..71cd5eaf09 100644 --- a/zdoom.vcproj +++ b/zdoom.vcproj @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - @@ -1868,6 +1860,14 @@ Outputs="$(IntDir)/$(InputName).obj" /> + + + @@ -1936,10 +1936,6 @@ RelativePath=".\src\win32\fb_d3d9.cpp" > - - @@ -2032,6 +2028,10 @@ RelativePath=".\src\win32\resource.h" > + + @@ -2057,6 +2057,14 @@ Outputs="$(IntDir)\$(InputName).obj" /> + + + @@ -2067,14 +2075,6 @@ Outputs="$(IntDir)\$(InputName).obj" /> - - - + + + - - - + + + @@ -5379,14 +5387,6 @@ AdditionalIncludeDirectories="src\win32;$(NoInherit)" /> - - - @@ -5665,7 +5665,7 @@ />