diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 9820a1bd03..1a1ad19a58 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,17 @@ December 26, 2007 +- Changed the way gamma works for D3DFB: In windowed mode, the display is + drawn to a texture, then that texture is copied to the real back buffer + using a gamma-correcting pixel shader. In fullscreen mode, SetGammaRamp + is used. +- Fixed flashing of vid_fps display when fps > 1000. +- Fixed loading of RGB textures for native 2D mode. +- Changed the first rotozoomer's data because it just became too obvious when + the backdrop is drawn with a full 256 distinct colors available. +- Set the player backdrop to update no more frequently than 35 FPS, so opening + the player setup menu before starting a game won't produce a very fast + moving backdrop. +- Changed the player backdrop into a texture so that it can be drawn like + anything else. - Enhanced TMap so that you can get at the iterator types by accessing them like class members. diff --git a/src/c_console.cpp b/src/c_console.cpp index 70a7507ade..f260d4a203 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -236,7 +236,7 @@ static void maybedrawnow (bool tick, bool force) if (nowtime - lastprinttime > 1 || force) { screen->Lock (false); - C_DrawConsole (); + C_DrawConsole (false); screen->Update (); lastprinttime = nowtime; } @@ -1094,7 +1094,7 @@ void C_SetTicker (unsigned int at, bool forceUpdate) maybedrawnow (true, TickerVisible ? forceUpdate : false); } -void C_DrawConsole () +void C_DrawConsole (bool hw2d) { static int oldbottom = 0; int lines, left, offset; @@ -1138,6 +1138,7 @@ void C_DrawConsole () DTA_DestWidth, screen->GetWidth(), DTA_DestHeight, screen->GetHeight(), DTA_ColorOverlay, conshade, + DTA_Alpha, hw2d ? FRACUNIT*3/4 : FRACUNIT, DTA_Masked, false, TAG_DONE); if (conline && visheight < screen->GetHeight()) diff --git a/src/c_console.h b/src/c_console.h index cc1e06c424..9071b478ca 100644 --- a/src/c_console.h +++ b/src/c_console.h @@ -63,7 +63,7 @@ void AddToConsole (int printlevel, const char *string); int PrintString (int printlevel, const char *string); int VPrintf (int printlevel, const char *format, va_list parms) GCCFORMAT(2); -void C_DrawConsole (void); +void C_DrawConsole (bool hw2d); void C_ToggleConsole (void); void C_FullConsole (void); void C_HideConsole (void); diff --git a/src/d_main.cpp b/src/d_main.cpp index 4cab10cbfc..3488af49ed 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -437,10 +437,11 @@ CVAR (Flag, compat_invisibility,compatflags, COMPATF_INVISIBILITY); // Draw current display, possibly wiping it from the previous // //========================================================================== -CVAR(Bool,test2d,false,0) + void D_Display (bool screenshot) { bool wipe; + bool hw2d; if (nodrawers) return; // for comparative timing / profiling @@ -521,10 +522,12 @@ void D_Display (bool screenshot) wipe = false; } + hw2d = false; + if (testpolymost) { drawpolymosttest(); - C_DrawConsole(); + C_DrawConsole(hw2d); M_Drawer(); } else @@ -533,7 +536,11 @@ void D_Display (bool screenshot) { case GS_FULLCONSOLE: screen->SetBlendingRect(0,0,0,0); - C_DrawConsole (); + if (!screenshot) + { + hw2d = screen->Begin2D(); + } + C_DrawConsole (false); M_Drawer (); if (!screenshot) screen->Update (); @@ -566,6 +573,14 @@ void D_Display (bool screenshot) { AM_Drawer (); } + if (!screenshot && (!wipe || NoWipe)) + { + if ((hw2d = screen->Begin2D())) + { + // Redraw the status bar every frame when using 2D accel + SB_state = screen->GetPageCount(); + } + } if (realviewheight == SCREENHEIGHT && viewactive) { StatusBar->Draw (DrawFSHUD ? HUD_Fullscreen : HUD_None); @@ -581,18 +596,30 @@ void D_Display (bool screenshot) case GS_INTERMISSION: screen->SetBlendingRect(0,0,0,0); + if (!screenshot && (!wipe || NoWipe)) + { + screen->Begin2D(); + } WI_Drawer (); CT_Drawer (); break; case GS_FINALE: screen->SetBlendingRect(0,0,0,0); + if (!screenshot && (!wipe || NoWipe)) + { + screen->Begin2D(); + } F_Drawer (); CT_Drawer (); break; case GS_DEMOSCREEN: screen->SetBlendingRect(0,0,0,0); + if (!screenshot && (!wipe || NoWipe)) + { + screen->Begin2D(); + } D_PageDrawer (); CT_Drawer (); break; @@ -601,10 +628,6 @@ void D_Display (bool screenshot) break; } } - if (!screenshot && (!wipe || NoWipe) && test2d) - { - screen->Begin2D(); - } // draw pause pic if (paused && menuactive == MENU_Off) { @@ -634,10 +657,10 @@ void D_Display (bool screenshot) if (!wipe || screenshot || NoWipe < 0) { - NetUpdate (); // send out any new accumulation + NetUpdate (); // send out any new accumulation // normal update - C_DrawConsole (); // draw console - M_Drawer (); // menu is drawn even on top of everything + C_DrawConsole (hw2d); // draw console + M_Drawer (); // menu is drawn even on top of everything FStat::PrintStat (); if (!screenshot) { @@ -665,7 +688,7 @@ void D_Display (bool screenshot) wipestart = nowtime; screen->Lock (true); done = wipe_ScreenWipe (tics); - C_DrawConsole (); + C_DrawConsole (hw2d); M_Drawer (); // menu is drawn even on top of wipes screen->Update (); // page flip or blit buffer NetUpdate (); diff --git a/src/m_menu.cpp b/src/m_menu.cpp index 15ce9cf852..7fbde744af 100644 --- a/src/m_menu.cpp +++ b/src/m_menu.cpp @@ -84,6 +84,27 @@ struct FSaveGameNode : public Node bool bMissingWads; }; +struct FBackdropTexture : public FTexture +{ +public: + FBackdropTexture(); + + const BYTE *GetColumn(unsigned int column, const Span **spans_out); + const BYTE *GetPixels(); + void Unload(); + bool CheckModified(); + +protected: + BYTE Pixels[144*160]; + static const Span DummySpan[2]; + int LastRenderTic; + + angle_t time1, time2, time3, time4; + angle_t t1ang, t2ang, z1ang, z2ang; + + void Render(); +}; + // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- void M_DrawSlider (int x, int y, float min, float max, float cur); @@ -223,8 +244,8 @@ static const char cursName[8][8] = // graphic names of Strife menu selector static oldmenu_t *currentMenu; // current menudef static oldmenu_t *TopLevelMenu; // The main menu everything hangs off of -static DCanvas *FireScreen; -static BYTE FireRemap[256]; +static FBackdropTexture *FireTexture; +static FRemapTable FireRemap(256); static const char *genders[3] = { "male", "female", "other" }; static FPlayerClass *PlayerClass; @@ -1593,8 +1614,10 @@ void M_NewGame(int choice) PlayerState = GetDefaultByType (PlayerClass->Type)->SeeState; PlayerTics = PlayerState->GetTics(); - if (FireScreen == NULL) - FireScreen = new DSimpleCanvas (144, 160); + if (FireTexture == NULL) + { + FireTexture = new FBackdropTexture; + } M_SetupNextMenu (&ClassMenuDef); } else if (EpiDef.numitems <= 1) @@ -1669,16 +1692,18 @@ static void M_DrawClassMenu () int x = (200-160)*CleanXfac+(SCREENWIDTH>>1); int y = (ClassMenuDef.y-100)*CleanYfac+(SCREENHEIGHT>>1); - if (!FireScreen) + if (!FireTexture) { screen->Clear (x, y, x + 72 * CleanXfac, y + 80 * CleanYfac-1, 0, 0); } else { - FireScreen->Lock (); - M_RenderPlayerBackdrop (); - FireScreen->Unlock (); - screen->DrawPlayerBackdrop (FireScreen, FireRemap, x, y - 1); + screen->DrawTexture (FireTexture, x, y - 1, + DTA_DestWidth, 72 * CleanXfac, + DTA_DestHeight, 80 * CleanYfac, + DTA_Translation, &FireRemap, + DTA_Masked, true, + TAG_DONE); } M_DrawFrame (x, y, 72*CleanXfac, 80*CleanYfac-1); @@ -1988,8 +2013,10 @@ void M_PlayerSetup (void) R_GetPlayerTranslation (players[consoleplayer].userinfo.color, &skins[PlayerSkin], translationtables[TRANSLATION_Players][MAXPLAYERS]); PlayerState = GetDefaultByType (PlayerClass->Type)->SeeState; PlayerTics = PlayerState->GetTics(); - if (FireScreen == NULL) - FireScreen = new DSimpleCanvas (144, 160); + if (FireTexture == NULL) + { + FireTexture = new FBackdropTexture; + } } static void M_PlayerSetupTicker (void) @@ -2089,16 +2116,18 @@ static void M_PlayerSetupDrawer () x = (x-160)*CleanXfac+(SCREENWIDTH>>1); y = (y-100)*CleanYfac+(SCREENHEIGHT>>1); - if (!FireScreen) + if (!FireTexture) { screen->Clear (x, y, x + 72 * CleanXfac, y + 80 * CleanYfac-1, 0, 0); } else { - FireScreen->Lock (); - M_RenderPlayerBackdrop (); - FireScreen->Unlock (); - screen->DrawPlayerBackdrop (FireScreen, FireRemap, x, y - 1); + screen->DrawTexture (FireTexture, x, y - 1, + DTA_DestWidth, 72 * CleanXfac, + DTA_DestHeight, 80 * CleanYfac, + DTA_Translation, &FireRemap, + DTA_Masked, true, + TAG_DONE); } M_DrawFrame (x, y, 72*CleanXfac, 80*CleanYfac-1); @@ -2206,45 +2235,45 @@ static void M_PlayerSetupDrawer () DTA_Clean, true, TAG_DONE); } -// Something cut out from a scan and resized to fit in 32x32. Guess what it is. -static BYTE naru[1024] = +// A 32x32 cloud rendered with Photoshop, plus some other filters +static BYTE pattern1[1024] = { - 11,11,11,11,13,15,18,17,16,16,15,14,11, 7, 6,11,14,12,10,10,12,15,13,11, 8, 8,10,13,14,12, 7,16, - 17,17,14,12,12,15,10,10, 9,10,10, 7, 6, 3, 1, 6, 9, 9, 5, 6,11,13,11, 8, 9,11, 9,11,14,14, 6,12, - 20,19,17,13, 9, 6, 5, 5, 4, 3, 2, 2, 2, 2, 2, 6,12, 8, 1, 1, 7, 6, 6, 9, 2, 9,13,14,15,13, 8,12, - 21,20,19,13, 7, 7,11, 8, 4, 2, 8, 6, 2, 0, 1, 7,13,11, 8, 8, 4, 6, 0,14, 7, 6,18,18,15,14,12, 9, - 19,19,16,12,11,19,14,11, 7, 8,13, 4, 2, 0, 0, 8,14,16,10,14, 5,13, 4,11,14, 6,14,24,19,17,15, 9, - 18,16,14,14,19,26,14,13,10,22,15, 6, 4, 0, 1, 6,14,19,14,14,11,12,10,10,18,11,12,21,21,16,16,17, - 18,14,10,10,26,23, 7,10,15,25,16,11,10, 3, 3, 6,12,21,16,17,15, 9,14, 4,19,13,10,12,14,15,16,17, - 21, 9, 5,15,22,12, 2, 8,17,13,13,15,11, 4, 6, 6,10,19,16, 9,17,11,14, 1,12,14, 7,13, 9,14,16,19, - 22,10, 6,11,14, 5, 4, 7,10, 8,14,14, 7, 4, 5, 5, 5,15,13, 7,10, 7,10, 5, 6,17, 8,13, 7,10,17,20, - 21, 7, 6, 8, 6, 6, 6, 5, 6, 7,16,13, 5,10, 8, 5, 3, 7, 9, 6, 4, 3, 3, 5, 4,14, 8,12, 6, 7,17,21, - 18, 6, 8, 8, 3, 8, 6, 3, 5, 9,17,16, 7,16,11, 4, 5, 4, 8, 7, 2, 3, 0, 4, 4,14, 9, 7, 8, 4,15,22, - 17,11, 9, 8, 4, 8, 5, 4, 5,13,20,18, 7,16,12,10, 3, 3, 4, 9, 4, 7, 3, 5, 4,14,10, 3, 8, 5,15,22, - 18,15,11, 8, 3, 9, 3, 3, 5,11,17,17, 7,17,16,14, 4, 5, 6, 9, 7, 1, 2, 6, 6,14, 9, 3, 6, 8,14,22, - 16,16,11, 6, 4, 8, 1, 1, 9,18,13, 9, 8,18,20,16,11, 6,11, 4, 3, 4, 4, 8, 3,11, 8, 4, 3, 7,11,20, - 13,14, 9, 4,10, 7, 2, 2,12,17,11, 0, 2,13,24,18,16, 7, 2, 1, 3, 0, 0, 6, 4, 8, 7, 4, 2, 4,10,17, - 11,11, 7, 5,14, 6, 3, 2, 6, 5, 8, 8, 8, 3,21,26,15, 4, 3,10,16,11, 7, 0, 1, 8, 8, 3, 3, 3,10,15, - 9,12, 7, 5,13, 3, 3, 1, 1, 5, 8, 9,15,16,10,26,11, 4, 9,13,18,20,18, 0, 0, 6, 9, 4, 2, 3,10,16, - 10,16, 9, 5,11, 3, 5, 0, 2, 7, 8, 9,13,20,13,25,11,10,16,15,16,17,18,11, 0, 6, 9, 4, 0, 3,12,19, - 19,21,11, 5,13, 4, 7, 0, 6,10,11,10,12,18,14,18, 8,16,21,18,18,17,17,15, 1, 3, 9, 5, 6, 1,14,21, - 23,22,14, 6,16, 9, 8, 0, 9,14,14,11,10,15,15,12,11,18,21,20,19,19,17,14, 4, 4, 8, 6,18, 4,15,21, - 22,20,19,11,17,13, 7, 0, 7,17,16,12, 7,11,12,19,20,14,19,18,18,20,17,11, 1, 5, 8, 7,17, 4,15,17, - 18,17,19,16,15,11, 5, 1, 7,21,18,13, 6, 9, 9,15,14, 8,12,16,17,19,17, 9, 4, 3, 6, 7,13, 5,14,13, - 15,17,18,17,12, 8, 5, 4, 8,13,18,14, 8, 6, 8,11, 9, 8, 6, 7, 9, 8, 7,12, 5, 2, 1, 3, 4, 4,10,11, - 16,18,17,16,12, 9, 8, 2, 4,14,10, 8,10,10,13,13, 7, 7,11,12, 9, 8,16,19, 5, 2, 0, 1, 1, 3, 8,10, - 6, 7, 5, 6,10, 9,11,10, 6, 7,14,16,17,17,16,14, 8, 8,11,16,19,20,22,18, 4, 2, 0, 2, 1, 2,10,10, - 12,12,10,11,11,12,13,13,11, 5,16,18,17,18,17,13,10, 7,11,17,22,22,21,14, 2, 3, 1, 3, 2, 6, 7, 9, - 18,18,19,18,13,13,13,12,12, 5, 9,16,16,14,12, 8, 6, 5,10,13,17,23,20, 5, 0, 3, 2, 4, 4, 5,10, 3, - 15,18,21,22,17,12,12,10,10, 3, 2, 7,12, 8, 8, 8, 9,10,13,17, 9,15, 6, 2, 4, 6, 9, 4, 4, 0, 5, 6, - 15,17,21,24,18,13,11, 9, 6, 2, 3, 2, 1, 9,12,11,10,10,13,16, 9, 0,11, 6, 1, 7,10, 6, 7, 5, 5, 6, - 14,15,19,23,19,14,10, 7, 6, 6, 1, 4, 2, 0, 5,10,10, 9,10, 6, 6, 5,13, 8, 2, 5, 8, 4, 8, 8, 5, 5, - 15,14,16,21,17,11, 6, 4, 7, 2, 5, 6, 4, 2, 0, 4, 4, 2, 3, 6, 9, 5,10, 8, 1, 5, 5, 3, 5, 4, 2, 4, - 9, 8,12,16, 9,10, 7, 5, 7, 5, 9, 7, 6, 4, 5, 8, 5, 4, 6, 8, 8, 4, 8, 8, 3, 5, 6, 4, 3, 4, 6, 6, + 5, 9, 7,10, 9,15, 9, 7, 8,10, 5, 3, 5, 7, 9, 8,14, 8, 4, 7, 8, 9, 5, 7,14, 7, 0, 7,13,13, 9, 6, + 2, 7, 9, 7, 7,10, 8, 8,11,10, 6, 7,10, 7, 5, 6, 6, 4, 7,13,15,16,11,15,11, 8, 0, 4,13,22,17,11, + 5, 9, 9, 7, 9,10, 4, 3, 6, 7, 8, 6, 5, 4, 2, 2, 1, 4, 6,11,15,15,14,13,17, 9, 5, 9,11,12,17,20, + 9,16, 9, 8,12,13, 7, 3, 7, 9, 5, 4, 2, 5, 5, 5, 7,11, 6, 7, 6,13,17,10,10, 9,12,17,14,12,16,15, + 15,13, 5, 3, 9,10, 4,10,12,12, 7, 9, 8, 8, 8,10, 7, 6, 5, 5, 5, 6,11, 9, 3,13,16,18,21,16,23,18, + 23,13, 0, 0, 0, 0, 0,12,18,14,15,16,13, 7, 7, 5, 9, 6, 6, 8, 4, 0, 0, 0, 0,14,19,17,14,20,21,25, + 19,20,14,13, 7, 5,13,19,14,13,17,15,14, 7, 3, 5, 6,11, 7, 7, 8, 8,10, 9, 9,18,17,15,14,15,18,16, + 16,29,24,23,18, 9,17,20,11, 5,12,15,15,12, 6, 3, 4, 6, 7,10,13,18,18,19,16,12,17,19,23,16,14,14, + 9,18,20,26,19, 5,18,18,10, 5,12,15,14,17,11, 6,11, 9,10,13,10,20,24,20,21,20,14,18,15,22,20,19, + 0, 6,16,18, 8, 7,15,18,10,13,17,17,13,11,15,11,19,12,13,10, 4,15,19,21,21,24,14, 9,17,20,24,17, + 18,17, 7, 7,16,21,22,15, 5,14,20,14,13,21,13, 8,12,14, 7, 8,11,15,13,11,16,17, 7, 5,12,17,19,14, + 25,23,17,16,23,18,15, 7, 0, 6,11, 6,11,15,11, 7,12, 7, 4,10,16,13, 7, 7,15,13, 9,15,21,14, 5, 0, + 18,22,21,21,21,22,12, 6,14,20,15, 6,10,19,13, 8, 7, 3, 7,12,14,16, 9,12,22,15,12,18,24,19,17, 9, + 0,15,18,21,17,25,14,13,19,21,21,11, 6,13,16,16,12,10,12,11,13,20,14,13,18,13, 9,15,16,25,31,20, + 5,20,24,16, 7,14,14,11,18,19,19, 6, 0, 5,11,14,17,16,19,14,15,21,19,15,14,14, 8, 0, 7,24,18,16, + 9,17,15, 7, 6,14,12, 7,14,16,11, 4, 7, 6,13,16,15,13,12,20,21,20,21,17,18,26,14, 0,13,23,21,11, + 9,12,18,11,15,21,13, 8,13,13,10, 7,13, 8, 8,19,13, 7, 4,15,19,18,14,12,14,15, 8, 6,16,22,22,15, + 9,17,14,19,15,14,15, 9,11, 9, 6, 8,14,13,13,12, 5, 0, 0, 6,12,13, 7, 7, 9, 7, 0,12,21,16,15,18, + 15,16,18,11, 6, 8,15, 9, 2, 0, 5,10,10,16, 9, 0, 4,12,15, 9,12, 9, 7, 7,12, 7, 0, 6,12, 6, 9,13, + 12,19,15,14,11, 7, 8, 9,12,10, 5, 5, 7,12,12,10,14,16,16,11, 8,12,10,12,10, 8,10,10,14,12,16,16, + 16,17,20,22,12,15,12,14,19,11, 6, 5,10,13,17,17,21,19,15, 9, 6, 9,15,18,10,10,18,14,20,15,16,17, + 11,19,19,18,19,14,17,13,12,12, 7,11,18,17,16,15,19,19,10, 2, 0, 8,15,12, 8,11,12,10,19,20,19,19, + 6,14,18,13,13,16,16,12, 5, 8,10,12,10,13,18,12, 9,10, 7, 6, 5,11, 8, 6, 7,13,16,13,10,15,20,14, + 0, 5,12,12, 4, 0, 9,16, 9,10,12, 8, 0, 9,13, 9, 0, 2, 4, 7,10, 6, 7, 3, 4,11,16,18,10,11,21,21, + 16,13,11,15, 8, 0, 5, 9, 8, 7, 6, 3, 0, 9,17, 9, 0, 0, 0, 3, 5, 4, 3, 5, 7,15,16,16,17,14,22,22, + 24,14,15,12, 9, 0, 5,10, 8, 4, 7,12,10,11,12, 7, 6, 8, 6, 5, 7, 8, 8,11,13,10,15,14,12,18,20,16, + 16,17,17,18,12, 9,12,16,10, 5, 6,20,13,15, 8, 4, 8, 9, 8, 7, 9,11,12,17,16,16,11,10, 9,10, 5, 0, + 0,14,18,18,15,16,14, 9,10, 9, 9,15,14,10, 4, 6,10, 8, 8, 7,10, 9,10,16,18,10, 0, 0, 7,12,10, 8, + 0,14,19,14, 9,11,11, 8, 8,10,15, 9,10, 7, 4,10,13, 9, 7, 5, 5, 7, 7, 7,13,13, 5, 5,14,22,18,16, + 0,10,14,10, 3, 6, 5, 6, 8, 9, 8, 9, 5, 9, 8, 9, 6, 8, 8, 8, 1, 0, 0, 0, 9,17,12,12,17,19,20,13, + 6,11,17,11, 5, 5, 8,10, 6, 5, 6, 6, 3, 7, 9, 7, 6, 8,12,10, 4, 8, 6, 6,11,16,16,15,16,17,17,16, + 11, 9,10,10, 5, 6,12,10, 5, 1, 6,10, 5, 3, 3, 5, 4, 7,15,10, 7,13, 7, 8,15,11,15,15,15, 8,11,15, }; // Just a 32x32 cloud rendered with the standard Photoshop filter -static BYTE smoke[1024] = +static BYTE pattern2[1024] = { 9, 9, 8, 8, 8, 8, 6, 6,13,13,11,21,19,21,23,18,23,24,19,19,24,17,18,12, 9,14, 8,12,12, 5, 8, 6, 11,10, 6, 7, 8, 8, 9,13,10,11,17,15,23,22,23,22,20,26,27,26,17,21,20,14,12, 8,11, 8,11, 7, 8, 7, @@ -2280,25 +2309,70 @@ static BYTE smoke[1024] = 7, 7, 0, 5, 1, 6, 7, 9,12, 9,12,21,22,25,24,22,23,25,24,18,24,22,17,13,10, 9,10, 9, 6,11, 6, 5, }; +const FTexture::Span FBackdropTexture::DummySpan[2] = { { 0, 160 }, { 0, 0 } }; + +FBackdropTexture::FBackdropTexture() +{ + Width = 144; + Height = 160; + WidthBits = 8; + HeightBits = 8; + WidthMask = 255; + LastRenderTic = 0; + + time1 = ANGLE_1*180; + time2 = ANGLE_1*56; + time3 = ANGLE_1*99; + time4 = ANGLE_1*1; + t1ang = ANGLE_90; + t2ang = 0; + z1ang = 0; + z2ang = ANGLE_90/2; +} + +bool FBackdropTexture::CheckModified() +{ + return LastRenderTic != gametic; +} + +void FBackdropTexture::Unload() +{ +} + +const BYTE *FBackdropTexture::GetColumn(unsigned int column, const Span **spans_out) +{ + if (LastRenderTic != gametic) + { + Render(); + } + column = clamp(column, 0u, 143u); + if (spans_out != NULL) + { + *spans_out = DummySpan; + } + return Pixels + column*160; +} + +const BYTE *FBackdropTexture::GetPixels() +{ + if (LastRenderTic != gametic) + { + Render(); + } + return Pixels; +} + // This is one plasma and two rotozoomers. I think it turned out quite awesome. -static void M_RenderPlayerBackdrop () +void FBackdropTexture::Render() { BYTE *from; int width, height, pitch; - width = FireScreen->GetWidth(); - height = FireScreen->GetHeight(); - pitch = FireScreen->GetPitch(); + width = 160; + height = 144; + pitch = width; int x, y; - static angle_t time1 = ANGLE_1*180; - static angle_t time2 = ANGLE_1*56; - static angle_t time3 = ANGLE_1*99; - static angle_t time4 = ANGLE_1*1; - static angle_t t1ang = ANGLE_90; - static angle_t t2ang = 0; - static angle_t z1ang = 0; - static angle_t z2ang = ANGLE_90/2; const angle_t a1add = ANGLE_1/2; const angle_t a2add = ANGLE_MAX-ANGLE_1; @@ -2320,7 +2394,7 @@ static void M_RenderPlayerBackdrop () DWORD ux, uy, uc, us; DWORD ltx, lty, lux, luy; - from = FireScreen->GetBuffer (); + from = Pixels; a3 = time3; a4 = time4; @@ -2353,8 +2427,8 @@ static void M_RenderPlayerBackdrop () c1 = finecosine[a1>>ANGLETOFINESHIFT]; c2 = finecosine[a2>>ANGLETOFINESHIFT]; from[x] = ((c1 + c2 + c3 + c4) >> (FRACBITS+3-7)) + 128 // plasma - + naru[(tx>>27)+((ty>>22)&992)] // rotozoomer 1 - + smoke[(ux>>27)+((uy>>22)&992)]; // rotozoomer 2 + + pattern1[(tx>>27)+((ty>>22)&992)] // rotozoomer 1 + + pattern2[(ux>>27)+((uy>>22)&992)]; // rotozoomer 2 tx += tc; ty += ts; ux += uc; @@ -2375,6 +2449,8 @@ static void M_RenderPlayerBackdrop () t2ang += x2add; z1ang += z1add; z2ang += z2add; + + LastRenderTic = gametic; } static void M_ChangeClass (int choice) @@ -3218,10 +3294,10 @@ static void M_ClearSaveStuff () // void M_ClearMenus () { - if (FireScreen) + if (FireTexture) { - delete FireScreen; - FireScreen = NULL; + delete FireTexture; + FireTexture = NULL; } M_ClearSaveStuff (); M_DeactivateMenuInput (); @@ -3436,7 +3512,8 @@ void M_Init (void) { for (i = 0; i < 256; i++) { - FireRemap[i] = ColorMatcher.Pick (i/2+32, 0, i/4); + FireRemap.Remap[i] = ColorMatcher.Pick (i/2+32, 0, i/4); + FireRemap.Palette[i] = PalEntry(i/2+32, 0, i/4); } } else @@ -3444,7 +3521,8 @@ void M_Init (void) // Hexen palette, so Hexen gets a greenish one instead. for (i = 0; i < 256; ++i) { - FireRemap[i] = ColorMatcher.Pick (i/4, i*13/40+7, i/4); + FireRemap.Remap[i] = ColorMatcher.Pick (i/4, i*13/40+7, i/4); + FireRemap.Palette[i] = PalEntry(i/4, i*13/40+7, i/4); } } } diff --git a/src/r_data.h b/src/r_data.h index 075d33e694..169079e9ff 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -89,7 +89,7 @@ public: void Unload (); virtual void SetFrontSkyLayer (); - int CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y); + int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y); protected: BYTE *Pixels; @@ -240,7 +240,7 @@ public: const BYTE *GetPixels (); void Unload (); FTextureFormat GetFormat (); - int CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y); + int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y); bool UseBasePalette(); protected: @@ -304,7 +304,7 @@ protected: void DecompressDXT3 (FWadLump &lump, bool premultiplied, BYTE *tcbuf = NULL); void DecompressDXT5 (FWadLump &lump, bool premultiplied, BYTE *tcbuf = NULL); - int CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y); + int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y); bool UseBasePalette(); friend class FTexture; @@ -320,7 +320,7 @@ public: const BYTE *GetPixels (); void Unload (); FTextureFormat GetFormat (); - int CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y); + int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y); bool UseBasePalette(); protected: @@ -371,7 +371,7 @@ public: void Unload (); FTextureFormat GetFormat (); - int CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y); + int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y); bool UseBasePalette(); protected: @@ -427,7 +427,7 @@ public: void Unload (); FTextureFormat GetFormat (); - int CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y); + int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y); bool UseBasePalette(); protected: diff --git a/src/r_defs.h b/src/r_defs.h index e68e4366ce..d4eca46b58 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -665,7 +665,7 @@ public: // Returns the whole texture, stored in column-major order virtual const BYTE *GetPixels () = 0; - virtual int CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y); + virtual int CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y); virtual bool UseBasePalette(); virtual void Unload () = 0; @@ -739,6 +739,8 @@ protected: static void FlipSquareBlockRemap (BYTE *block, int x, int y, const BYTE *remap); static void FlipNonSquareBlock (BYTE *blockto, const BYTE *blockfrom, int x, int y, int srcpitch); static void FlipNonSquareBlockRemap (BYTE *blockto, const BYTE *blockfrom, int x, int y, const BYTE *remap); + + friend class D3DTex; }; // Texture manager diff --git a/src/r_plane.cpp b/src/r_plane.cpp index fe8ac2e348..93c0ce4df6 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -468,7 +468,7 @@ void R_ClearPlanes (bool fullclear) clearbufshort (floorclip, viewwidth, viewheight); // [RH] clip ceiling to console bottom clearbufshort (ceilingclip, viewwidth, - ConBottom > viewwindowy && !bRenderingToCanvas + !screen->Accel2D && ConBottom > viewwindowy && !bRenderingToCanvas ? ((ConBottom - viewwindowy) >> detailyshift) : 0); lastopening = 0; diff --git a/src/textures/ddstexture.cpp b/src/textures/ddstexture.cpp index dbc19a3889..ab44160e6b 100644 --- a/src/textures/ddstexture.cpp +++ b/src/textures/ddstexture.cpp @@ -737,7 +737,7 @@ void FDDSTexture::DecompressDXT5 (FWadLump &lump, bool premultiplied, BYTE *tcbu // //=========================================================================== -int FDDSTexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y) +int FDDSTexture::CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y) { FWadLump lump = Wads.OpenLumpNum (SourceLump); @@ -763,7 +763,7 @@ int FDDSTexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_heigh } // All formats decompress to RGBA. - screen->CopyPixelDataRGB(buffer, buf_width, buf_height, x, y, TexBuffer, Width, Height, 4, Width*4, CF_RGBA); + screen->CopyPixelDataRGB(buffer, buf_pitch, buf_height, x, y, TexBuffer, Width, Height, 4, Width*4, CF_RGBA); delete [] TexBuffer; return -1; } diff --git a/src/textures/jpegtexture.cpp b/src/textures/jpegtexture.cpp index ec78c8fb79..6e7c642a7e 100644 --- a/src/textures/jpegtexture.cpp +++ b/src/textures/jpegtexture.cpp @@ -332,7 +332,7 @@ void FJPEGTexture::MakeTexture () // //=========================================================================== -int FJPEGTexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y) +int FJPEGTexture::CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y) { PalEntry pe[256]; @@ -375,18 +375,18 @@ int FJPEGTexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_heig switch (cinfo.out_color_space) { case JCS_RGB: - screen->CopyPixelDataRGB(buffer, buf_width, buf_height, x, y, buff, cinfo.output_width, cinfo.output_height, + screen->CopyPixelDataRGB(buffer, buf_pitch, buf_height, x, y, buff, cinfo.output_width, cinfo.output_height, 3, cinfo.output_width * cinfo.output_components, CF_RGB); break; case JCS_GRAYSCALE: for(int i=0;i<256;i++) pe[i]=PalEntry(0,i,i,i); // default to a gray map - screen->CopyPixelData(buffer, buf_width, buf_height, x, y, buff, cinfo.output_width, cinfo.output_height, + screen->CopyPixelData(buffer, buf_pitch, buf_height, x, y, buff, cinfo.output_width, cinfo.output_height, 1, cinfo.output_width, pe); break; case JCS_CMYK: - screen->CopyPixelDataRGB(buffer, buf_width, buf_height, x, y, buff, cinfo.output_width, cinfo.output_height, + screen->CopyPixelDataRGB(buffer, buf_pitch, buf_height, x, y, buff, cinfo.output_width, cinfo.output_height, 4, cinfo.output_width * cinfo.output_components, CF_CMYK); break; diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index b8d97a34c2..3a2853df78 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -379,13 +379,13 @@ void FMultiPatchTexture::CheckForHacks () // //=========================================================================== -int FMultiPatchTexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y) +int FMultiPatchTexture::CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y) { int retv = -1; for(int i=0;iCopyTrueColorPixels(buffer, buf_width, buf_height, + int ret = Parts[i].Texture->CopyTrueColorPixels(buffer, buf_pitch, buf_height, x+Parts[i].OriginX, y+Parts[i].OriginY); if (ret > retv) retv = ret; diff --git a/src/textures/pcxtexture.cpp b/src/textures/pcxtexture.cpp index 5a9e14bce0..d746fd9fd4 100644 --- a/src/textures/pcxtexture.cpp +++ b/src/textures/pcxtexture.cpp @@ -418,7 +418,7 @@ void FPCXTexture::MakeTexture() // //=========================================================================== -int FPCXTexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y) +int FPCXTexture::CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y) { PalEntry pe[256]; PCXHeader header; @@ -472,14 +472,14 @@ int FPCXTexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_heigh lump.Seek(sizeof(header), SEEK_SET); ReadPCX8bits (Pixels, lump, &header); } - screen->CopyPixelData(buffer, buf_width, buf_height, x, y, Pixels, Width, Height, 1, Width, pe); + screen->CopyPixelData(buffer, buf_pitch, buf_height, x, y, Pixels, Width, Height, 1, Width, pe); } else { Pixels = new BYTE[Width*Height * 3]; BYTE * row = buffer; ReadPCX24bits (Pixels, lump, &header, 3); - screen->CopyPixelDataRGB(buffer, buf_width, buf_height, x, y, Pixels, Width, Height, 3, Width*3, CF_RGB); + screen->CopyPixelDataRGB(buffer, buf_pitch, buf_height, x, y, Pixels, Width, Height, 3, Width*3, CF_RGB); } delete [] Pixels; return 0; diff --git a/src/textures/pngtexture.cpp b/src/textures/pngtexture.cpp index a7dfce558f..1e77fda721 100644 --- a/src/textures/pngtexture.cpp +++ b/src/textures/pngtexture.cpp @@ -444,7 +444,7 @@ void FPNGTexture::MakeTexture () // //=========================================================================== -int FPNGTexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y) +int FPNGTexture::CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y) { // Parse pre-IDAT chunks. I skip the CRCs. Is that bad? PalEntry pe[256]; @@ -469,7 +469,9 @@ int FPNGTexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_heigh case MAKE_ID('P','L','T','E'): for(int i=0;i> pe[i].r >> pe[i].g >> pe[i].b; + } break; case MAKE_ID('t','R','N','S'): @@ -496,20 +498,20 @@ int FPNGTexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_heigh { case 0: case 3: - screen->CopyPixelData(buffer, buf_width, buf_height, x, y, Pixels, Width, Height, 1, Width, pe); + screen->CopyPixelData(buffer, buf_pitch, buf_height, x, y, Pixels, Width, Height, 1, Width, pe); break; case 2: - screen->CopyPixelDataRGB(buffer, buf_width, buf_height, x, y, Pixels, Width, Height, 3, pixwidth, CF_RGB); + screen->CopyPixelDataRGB(buffer, buf_pitch, buf_height, x, y, Pixels, Width, Height, 3, pixwidth, CF_RGB); break; case 4: - screen->CopyPixelDataRGB(buffer, buf_width, buf_height, x, y, Pixels, Width, Height, 2, pixwidth, CF_IA); + screen->CopyPixelDataRGB(buffer, buf_pitch, buf_height, x, y, Pixels, Width, Height, 2, pixwidth, CF_IA); transpal = -1; break; case 6: - screen->CopyPixelDataRGB(buffer, buf_width, buf_height, x, y, Pixels, Width, Height, 4, pixwidth, CF_RGBA); + screen->CopyPixelDataRGB(buffer, buf_pitch, buf_height, x, y, Pixels, Width, Height, 4, pixwidth, CF_RGBA); transpal = -1; break; diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 6145fe33cb..830d759e83 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -481,11 +481,11 @@ void FTexture::FillBuffer(BYTE *buff, int pitch, int height, FTextureFormat fmt) // //=========================================================================== -int FTexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y) +int FTexture::CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y) { PalEntry * palette = screen->GetPalette(); palette[0].a=255; // temporarily modify the first color's alpha - screen->CopyPixelData(buffer, buf_width, buf_height, x, y, + screen->CopyPixelData(buffer, buf_pitch, buf_height, x, y, GetPixels(), Width, Height, Height, 1, palette); diff --git a/src/textures/tgatexture.cpp b/src/textures/tgatexture.cpp index 51c257e9f3..4e48fe6950 100644 --- a/src/textures/tgatexture.cpp +++ b/src/textures/tgatexture.cpp @@ -384,7 +384,7 @@ void FTGATexture::MakeTexture () // //=========================================================================== -int FTGATexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_height, int x, int y) +int FTGATexture::CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf_height, int x, int y) { PalEntry pe[256]; FWadLump lump = Wads.OpenLumpNum (SourceLump); @@ -469,7 +469,7 @@ int FTGATexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_heigh switch (hdr.img_type & 7) { case 1: // paletted - screen->CopyPixelData(buffer, buf_width, buf_height, x, y, ptr, Width, Height, step_x, Pitch, pe); + screen->CopyPixelData(buffer, buf_pitch, buf_height, x, y, ptr, Width, Height, step_x, Pitch, pe); break; case 2: // RGB @@ -477,21 +477,21 @@ int FTGATexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_heigh { case 15: case 16: - screen->CopyPixelDataRGB(buffer, buf_width, buf_height, x, y, ptr, Width, Height, step_x, Pitch, CF_RGB555); + screen->CopyPixelDataRGB(buffer, buf_pitch, buf_height, x, y, ptr, Width, Height, step_x, Pitch, CF_RGB555); break; case 24: - screen->CopyPixelDataRGB(buffer, buf_width, buf_height, x, y, ptr, Width, Height, step_x, Pitch, CF_BGR); + screen->CopyPixelDataRGB(buffer, buf_pitch, buf_height, x, y, ptr, Width, Height, step_x, Pitch, CF_BGR); break; case 32: if ((hdr.img_desc&15)!=8) // 32 bits without a valid alpha channel { - screen->CopyPixelDataRGB(buffer, buf_width, buf_height, x, y, ptr, Width, Height, step_x, Pitch, CF_BGR); + screen->CopyPixelDataRGB(buffer, buf_pitch, buf_height, x, y, ptr, Width, Height, step_x, Pitch, CF_BGR); } else { - screen->CopyPixelDataRGB(buffer, buf_width, buf_height, x, y, ptr, Width, Height, step_x, Pitch, CF_BGRA); + screen->CopyPixelDataRGB(buffer, buf_pitch, buf_height, x, y, ptr, Width, Height, step_x, Pitch, CF_BGRA); transval = -1; } break; @@ -506,11 +506,11 @@ int FTGATexture::CopyTrueColorPixels(BYTE * buffer, int buf_width, int buf_heigh { case 8: for(int i=0;i<256;i++) pe[i]=PalEntry(0,i,i,i); // gray map - screen->CopyPixelData(buffer, buf_width, buf_height, x, y, ptr, Width, Height, step_x, Pitch, pe); + screen->CopyPixelData(buffer, buf_pitch, buf_height, x, y, ptr, Width, Height, step_x, Pitch, pe); break; case 16: - screen->CopyPixelDataRGB(buffer, buf_width, buf_height, x, y, ptr, Width, Height, step_x, Pitch, CF_I16); + screen->CopyPixelDataRGB(buffer, buf_pitch, buf_height, x, y, ptr, Width, Height, step_x, Pitch, CF_I16); break; default: diff --git a/src/v_draw.cpp b/src/v_draw.cpp index ef36fd4d6e..fae771e2ac 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -633,52 +633,6 @@ void DCanvas::FillBorder (FTexture *img) } } -// This was in m_menu.cpp but it's better to be here because -// non-software renderers must be able to override it. -void DCanvas::DrawPlayerBackdrop (DCanvas *src, const BYTE *FireRemap, int x, int y) -{ - DCanvas *dest = this; - BYTE *destline, *srcline; - const int destwidth = src->GetWidth() * CleanXfac / 2; - const int destheight = src->GetHeight() * CleanYfac / 2; - const int desty = y; - const int destx = x; - const fixed_t fracxstep = FRACUNIT*2 / CleanXfac; - const fixed_t fracystep = FRACUNIT*2 / CleanYfac; - fixed_t fracx, fracy = 0; - - src->Lock(); - - if (fracxstep == FRACUNIT) - { - for (y = desty; y < desty + destheight; y++, fracy += fracystep) - { - srcline = src->GetBuffer() + (fracy >> FRACBITS) * src->GetPitch(); - destline = dest->GetBuffer() + y * dest->GetPitch() + destx; - - for (x = 0; x < destwidth; x++) - { - destline[x] = FireRemap[srcline[x]]; - } - } - } - else - { - for (y = desty; y < desty + destheight; y++, fracy += fracystep) - { - srcline = src->GetBuffer() + (fracy >> FRACBITS) * src->GetPitch(); - destline = dest->GetBuffer() + y * dest->GetPitch() + destx; - for (x = fracx = 0; x < destwidth; x++, fracx += fracxstep) - { - destline[x] = FireRemap[srcline[fracx >> FRACBITS]]; - } - } - } - - src->Unlock(); -} - - void DCanvas::PUTTRANSDOT (int xx, int yy, int basecolor, int level) { static int oldyy; diff --git a/src/v_video.cpp b/src/v_video.cpp index 0d4609bb78..447988ddd6 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -123,7 +123,7 @@ protected: void MakeTexture(); }; -const FTexture::Span FPaletteTester::DummySpan[2] = { { 0, 24 }, { 0, 0 } }; +const FTexture::Span FPaletteTester::DummySpan[2] = { { 0, 16 }, { 0, 0 } }; int DisplayWidth, DisplayHeight, DisplayBits; @@ -718,7 +718,7 @@ DFrameBuffer::DFrameBuffer (int width, int height) : DSimpleCanvas (width, height) { LastMS = LastSec = FrameCount = LastCount = LastTic = 0; - IsComposited = false; + Accel2D = false; } void DFrameBuffer::DrawRateStuff () @@ -728,7 +728,7 @@ void DFrameBuffer::DrawRateStuff () { DWORD ms = I_MSTime (); DWORD howlong = ms - LastMS; - if (howlong > 0) + if (howlong >= 0) { char fpsbuff[40]; int chars; @@ -893,8 +893,9 @@ void DFrameBuffer::SetBlendingRect (int x1, int y1, int x2, int y2) { } -void DFrameBuffer::Begin2D () +bool DFrameBuffer::Begin2D () { + return false; } FNativeTexture *DFrameBuffer::CreateTexture(FTexture *gametex) @@ -914,20 +915,20 @@ FNativeTexture *DFrameBuffer::CreatePalette(FRemapTable *remap) // //=========================================================================== template -void iCopyColors(unsigned char * pout, const unsigned char * pin, int count, int step) +void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step) { for(int i=0;i, @@ -984,16 +985,16 @@ bool DFrameBuffer::ClipCopyPixelRect(int texwidth, int texheight, int &originx, // True Color texture copy function // //=========================================================================== -void DFrameBuffer::CopyPixelDataRGB(BYTE * buffer, int texwidth, int texheight, int originx, int originy, - const BYTE * patch, int srcwidth, int srcheight, int step_x, int step_y, +void DFrameBuffer::CopyPixelDataRGB(BYTE *buffer, int texpitch, int texheight, int originx, int originy, + const BYTE *patch, int srcwidth, int srcheight, int step_x, int step_y, int ct) { - if (ClipCopyPixelRect(texwidth, texheight, originx, originy, patch, srcwidth, srcheight, step_x, step_y)) + if (ClipCopyPixelRect(texpitch/4, texheight, originx, originy, patch, srcwidth, srcheight, step_x, step_y)) { - buffer+=4*originx + 4*texwidth*originy; + buffer+=4*originx + texpitch*originy; for (int y=0;y(Video)->GoFullscreen (fullscreen)); @@ -242,6 +251,8 @@ D3DFB::D3DFB (int width, int height, bool fullscreen) D3DFB::~D3DFB () { + KillNativeTexs(); + KillNativePals(); ReleaseResources (); if (D3DDevice != NULL) { @@ -302,10 +313,15 @@ bool D3DFB::CreateResources () return false; } if (FAILED(D3DDevice->CreatePixelShader (PlainShaderDef, &PlainShader)) || + FAILED(D3DDevice->CreatePixelShader (PlainStencilDef, &PlainStencilShader)) || FAILED(D3DDevice->CreatePixelShader (DimShaderDef, &DimShader))) { return false; } + if (FAILED(D3DDevice->CreatePixelShader (GammaFixerDef, &GammaFixerShader))) + { + GammaFixerShader = NULL; + } CurPixelShader = NULL; memset(Constant, 0, sizeof(Constant)); if (!CreateFBTexture() || @@ -332,6 +348,11 @@ void D3DFB::ReleaseResources () FBTexture->Release(); FBTexture = NULL; } + if (WindowedRenderTexture != NULL) + { + WindowedRenderTexture->Release(); + WindowedRenderTexture = NULL; + } if (VertexBuffer != NULL) { VertexBuffer->Release(); @@ -362,11 +383,21 @@ void D3DFB::ReleaseResources () PlainShader->Release(); PlainShader = NULL; } + if (PlainStencilShader != NULL) + { + PlainStencilShader->Release(); + PlainStencilShader = NULL; + } if (DimShader != NULL) { DimShader->Release(); DimShader = NULL; } + if (GammaFixerShader != NULL) + { + GammaFixerShader->Release(); + GammaFixerShader = NULL; + } } bool D3DFB::Reset () @@ -379,6 +410,11 @@ bool D3DFB::Reset () FBTexture->Release(); FBTexture = NULL; } + if (WindowedRenderTexture != NULL) + { + WindowedRenderTexture->Release(); + WindowedRenderTexture = NULL; + } if (VertexBuffer != NULL) { VertexBuffer->Release(); @@ -396,6 +432,61 @@ bool D3DFB::Reset () return true; } +//========================================================================== +// +// D3DFB :: KillNativePals +// +// Frees all native palettes. +// +//========================================================================== + +void D3DFB::KillNativePals() +{ + while (Palettes != NULL) + { + delete Palettes; + } +} + +//========================================================================== +// +// D3DFB :: KillNativeTexs +// +// Frees all native textures. +// +//========================================================================== + +void D3DFB::KillNativeTexs() +{ + while (Textures != NULL) + { + delete Textures; + } +} + +//========================================================================== +// +// D3DFB :: KillNativeNonPalettedTexs +// +// Frees all native textures that aren't paletted. +// +//========================================================================== + +void D3DFB::KillNativeNonPalettedTexs() +{ + D3DTex *tex; + D3DTex *next; + + for (tex = Textures; tex != NULL; tex = next) + { + next = tex->Next; + if (tex->GetTexFormat() != D3DFMT_L8) + { + delete tex; + } + } +} + bool D3DFB::CreateFBTexture () { if (FAILED(D3DDevice->CreateTexture (Width, Height, 1, D3DUSAGE_DYNAMIC, D3DFMT_L8, D3DPOOL_DEFAULT, &FBTexture, NULL))) @@ -420,6 +511,13 @@ bool D3DFB::CreateFBTexture () FBWidth = Width; FBHeight = Height; } + if (Windowed && GammaFixerShader) + { + if (FAILED(D3DDevice->CreateTexture (FBWidth, FBHeight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &WindowedRenderTexture, NULL))) + { + WindowedRenderTexture = false; + } + } return true; } @@ -660,6 +758,7 @@ void D3DFB::Update () if (In2D == 2) { DrawRateStuff(); + DoWindowedGamma(); D3DDevice->EndScene(); D3DDevice->Present(NULL, NULL, NULL, NULL); In2D = 0; @@ -684,8 +783,24 @@ void D3DFB::Update () if (NeedGammaUpdate) { + float psgamma[4]; + float igamma; + NeedGammaUpdate = false; - CalcGamma (Gamma, GammaTable); + igamma = 1 / Gamma; + if (!Windowed) + { + D3DGAMMARAMP ramp; + + for (int i = 0; i < 256; ++i) + { + ramp.blue[i] = ramp.green[i] = ramp.red[i] = WORD(65535.f * powf(i / 255.f, igamma)); + } + D3DDevice->SetGammaRamp(0, D3DSGR_CALIBRATE, &ramp); + } + psgamma[2] = psgamma[1] = psgamma[0] = igamma; + psgamma[3] = 1; + D3DDevice->SetPixelShaderConstantF(4, psgamma, 1); NeedPalUpdate = true; } @@ -701,6 +816,7 @@ void D3DFB::Update () PaintToWindow (); if (In2D == 0) { + DoWindowedGamma(); D3DDevice->EndScene(); D3DDevice->Present(NULL, NULL, NULL, NULL); } @@ -767,6 +883,19 @@ void D3DFB::Draw3DPart() D3DDevice->Clear (2, rects, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.f, 0); } D3DDevice->BeginScene(); + OldRenderTarget = NULL; + if (WindowedRenderTexture != NULL) + { + IDirect3DSurface9 *targetsurf; + if (FAILED(WindowedRenderTexture->GetSurfaceLevel(0, &targetsurf)) || + FAILED(D3DDevice->GetRenderTarget(0, &OldRenderTarget)) || + FAILED(D3DDevice->SetRenderTarget(0, targetsurf))) + { + // Setting the render target failed. + OldRenderTarget = NULL; + } + } + SetTexture (0, FBTexture); SetPaletteTexture(PaletteTexture, 256); D3DDevice->SetStreamSource (0, VertexBuffer, 0, sizeof(FBVERTEX)); @@ -782,15 +911,42 @@ void D3DFB::Draw3DPart() { // The screen split up so that only the 3D view is blended. D3DDevice->DrawPrimitive (D3DPT_TRIANGLEFAN, 24, 2); // middle - // The rest is drawn unblended, so reset the shader constant. - static const float FlashZero[2][4] = { { 0, 0, 0, 0 }, { 1, 1, 1, 1 } }; - D3DDevice->SetPixelShaderConstantF (0, FlashZero[0], 2); - memcpy(Constant, FlashZero, sizeof(FlashZero)); + if (!In2D || 1) + { + // The rest is drawn unblended, so reset the shader constant. + static const float FlashZero[2][4] = { { 0, 0, 0, 0 }, { 1, 1, 1, 1 } }; + D3DDevice->SetPixelShaderConstantF (0, FlashZero[0], 2); + memcpy(Constant, FlashZero, sizeof(FlashZero)); - D3DDevice->DrawPrimitive (D3DPT_TRIANGLEFAN, 4, 2); // left - D3DDevice->DrawPrimitive (D3DPT_TRIANGLEFAN, 8, 2); // right - D3DDevice->DrawPrimitive (D3DPT_TRIANGLEFAN, 12, 4); // bottom - D3DDevice->DrawPrimitive (D3DPT_TRIANGLEFAN, 18, 4); // top + D3DDevice->DrawPrimitive (D3DPT_TRIANGLEFAN, 4, 2); // left + D3DDevice->DrawPrimitive (D3DPT_TRIANGLEFAN, 8, 2); // right + D3DDevice->DrawPrimitive (D3DPT_TRIANGLEFAN, 12, 4); // bottom + D3DDevice->DrawPrimitive (D3DPT_TRIANGLEFAN, 18, 4); // top + } + } +} + +//========================================================================== +// +// D3DFB :: DoWindowedGamma +// +// Draws the render target texture to the real back buffer using a gamma- +// correcting pixel shader. +// +//========================================================================== + +void D3DFB::DoWindowedGamma() +{ + if (OldRenderTarget != NULL) + { + D3DDevice->SetRenderTarget(0, OldRenderTarget); + D3DDevice->SetStreamSource(0, VertexBuffer, 0, sizeof(FBVERTEX)); + D3DDevice->SetFVF(D3DFVF_FBVERTEX); + SetTexture(0, WindowedRenderTexture); + SetPixelShader(GammaFixerShader); + SetAlphaBlend(FALSE); + D3DDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2); + OldRenderTarget = NULL; } } @@ -804,9 +960,9 @@ void D3DFB::UploadPalette () BYTE *pix = (BYTE *)lockrect.pBits; for (i = 0; i < 256; ++i, pix += 4) { - pix[0] = GammaTable[SourcePalette[i].b]; - pix[1] = GammaTable[SourcePalette[i].g]; - pix[2] = GammaTable[SourcePalette[i].r]; + pix[0] = SourcePalette[i].b; + pix[1] = SourcePalette[i].g; + pix[2] = SourcePalette[i].r; pix[3] = (i == 0 ? 0 : 255); // To let masked textures work, the first palette entry's alpha is 0. } @@ -909,13 +1065,22 @@ void D3DFB::SetBlendingRect(int x1, int y1, int x2, int y2) // //========================================================================== -D3DTex::D3DTex(FTexture *tex, IDirect3DDevice9 *D3DDevice) +D3DTex::D3DTex(FTexture *tex, D3DFB *fb) { + // Attach to the texture list for the D3DFB + Next = fb->Textures; + if (Next != NULL) + { + Next->Prev = &Next; + } + Prev = &fb->Textures; + fb->Textures = this; + GameTex = tex; Tex = NULL; IsGray = false; - Create(D3DDevice); + Create(fb->D3DDevice); } //========================================================================== @@ -931,6 +1096,17 @@ D3DTex::~D3DTex() Tex->Release(); Tex = NULL; } + // Detach from the texture list + *Prev = Next; + if (Next != NULL) + { + Next->Prev = Prev; + } + // Remove link from the game texture + if (GameTex != NULL) + { + GameTex->Native = NULL; + } } //========================================================================== @@ -1080,6 +1256,15 @@ D3DPal::D3DPal(FRemapTable *remap, D3DFB *fb) { int count; + // Attach to the palette list for the D3DFB + Next = fb->Palettes; + if (Next != NULL) + { + Next->Prev = &Next; + } + Prev = &fb->Palettes; + fb->Palettes = this; + // Palette textures must be 256 entries for Shader Model 1.4 if (fb->SM14) { @@ -1119,6 +1304,17 @@ D3DPal::~D3DPal() Tex->Release(); Tex = NULL; } + // Detach from the palette list + *Prev = Next; + if (Next != NULL) + { + Next->Prev = Prev; + } + // Remove link from the remap table + if (Remap != NULL) + { + Remap->Native = NULL; + } } //========================================================================== @@ -1145,16 +1341,10 @@ bool D3DPal::Update() pal = Remap->Palette; // Should I allow the source palette to specify alpha values? - buff[0] = D3DCOLOR_ARGB(0, - static_cast(screen)->GammaTable[pal[0].r], - static_cast(screen)->GammaTable[pal[0].g], - static_cast(screen)->GammaTable[pal[0].b]); + buff[0] = D3DCOLOR_ARGB(0, pal[0].r, pal[0].g, pal[0].b); for (int i = 1; i < Remap->NumEntries; ++i) { - buff[i] = D3DCOLOR_XRGB( - static_cast(screen)->GammaTable[pal[i].r], - static_cast(screen)->GammaTable[pal[i].g], - static_cast(screen)->GammaTable[pal[i].b]); + buff[i] = D3DCOLOR_XRGB(pal[i].r, pal[i].g, pal[i].b); } Tex->UnlockRect(0); return true; @@ -1169,11 +1359,13 @@ bool D3DPal::Update() // //========================================================================== -void D3DFB::Begin2D() +CVAR(Bool,test2d,true,0) +bool D3DFB::Begin2D() { + if (!test2d) return false; if (In2D) { - return; + return true; } In2D = 1; Update(); @@ -1181,6 +1373,8 @@ void D3DFB::Begin2D() // Set default state for 2D rendering. SetAlphaBlend(TRUE, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); + + return true; } //========================================================================== @@ -1193,7 +1387,7 @@ void D3DFB::Begin2D() FNativeTexture *D3DFB::CreateTexture(FTexture *gametex) { - D3DTex *tex = new D3DTex(gametex, D3DDevice); + D3DTex *tex = new D3DTex(gametex, this); if (tex->Tex == NULL) { delete tex; @@ -1208,8 +1402,6 @@ FNativeTexture *D3DFB::CreateTexture(FTexture *gametex) // // Returns a native texture that contains a palette. // -// Pre: count is a power of 2 -// //========================================================================== FNativeTexture *D3DFB::CreatePalette(FRemapTable *remap) @@ -1379,7 +1571,7 @@ void STACK_ARGS D3DFB::DrawTextureV (FTexture *img, int x, int y, uint32 tags_fi { x0, y1, 0.5f, 1.f, u0, v1 } }; - if (!SetStyle(parms)) + if (!SetStyle(tex, parms)) { return; } @@ -1396,8 +1588,9 @@ void STACK_ARGS D3DFB::DrawTextureV (FTexture *img, int x, int y, uint32 tags_fi // //========================================================================== -bool D3DFB::SetStyle(DrawParms &parms) +bool D3DFB::SetStyle(D3DTex *tex, DrawParms &parms) { + D3DFORMAT fmt = tex->GetTexFormat(); ERenderStyle style = parms.style; D3DBLEND fglevel, bglevel; float alpha; @@ -1476,7 +1669,15 @@ bool D3DFB::SetStyle(DrawParms &parms) { SetAlphaBlend(FALSE); SetColorOverlay(parms.colorOverlay, 1); - SetPaletteTexture(PaletteTexture, 256); + if (fmt == D3DFMT_L8 && !tex->IsGray) + { + SetPaletteTexture(PaletteTexture, 256); + SetPixelShader(PalTexShader); + } + else + { + SetPixelShader(PlainShader); + } } else { @@ -1484,21 +1685,44 @@ bool D3DFB::SetStyle(DrawParms &parms) if (!stencilling) { - if (parms.remap != NULL) + if (fmt == D3DFMT_L8) { - D3DPal *pal = reinterpret_cast(parms.remap->GetNative()); - SetPaletteTexture(pal->Tex, pal->RoundedPaletteSize); + if (parms.remap != NULL) + { + D3DPal *pal = reinterpret_cast(parms.remap->GetNative()); + SetPaletteTexture(pal->Tex, pal->RoundedPaletteSize); + } + else if (tex->IsGray) + { + SetPixelShader(PlainShader); + } + else + { + SetPaletteTexture(PaletteTexture, 256); + } + SetPixelShader(PalTexShader); } else { - SetPaletteTexture(PaletteTexture, 256); + SetPixelShader(PlainShader); } SetColorOverlay(parms.colorOverlay, alpha); } else { - SetConstant(1, RPART(parms.fillcolor)/255.f, GPART(parms.fillcolor)/255.f, BPART(parms.fillcolor)/255.f, alpha); - SetPaletteTexture(StencilPaletteTexture, 256); + SetConstant(1, + RPART(parms.fillcolor)/255.f, + GPART(parms.fillcolor)/255.f, + BPART(parms.fillcolor)/255.f, alpha); + if (fmt == D3DFMT_L8) + { + SetPaletteTexture(StencilPaletteTexture, 256); + SetPixelShader(PalTexShader); + } + else + { + SetPixelShader(PlainStencilShader); + } } } return true; @@ -1591,7 +1815,7 @@ void D3DFB::SetTexture(int tnum, IDirect3DTexture9 *texture) void D3DFB::SetPaletteTexture(IDirect3DTexture9 *texture, int count) { - if (SM14) + if (count == 256 || SM14) { // Shader Model 1.4 only uses 256-color palettes. SetConstant(2, 255 / 256.f, 0.5f / 256.f, 0, 0); diff --git a/src/win32/fb_d3d9_shaders.h b/src/win32/fb_d3d9_shaders.h index 628981206d..827a026daf 100644 --- a/src/win32/fb_d3d9_shaders.h +++ b/src/win32/fb_d3d9_shaders.h @@ -1,7 +1,7 @@ #define HLSL_SOURCE_CODE 0 #define SHADER_ASSEMBLY_CODE 0 -// A paletted texture shader +// A paletted texture shader ------------------------------------------------ #if HLSL_SOURCE_CODE // Technically, Palette only needs to be a sampler1D, but that @@ -114,7 +114,7 @@ const DWORD PalTexShader20Def[] = 0x0000ffff }; -// A texture that doesn't look up colors from a palette. +// A shader that doesn't look up colors from a palette. --------------------- // Can be used for RGB textures. #if HLSL_SOURCE_CODE @@ -172,7 +172,63 @@ const DWORD PlainShaderDef[] = 0xa0e40001, 0xa0e40000, 0x0000ffff }; -// A shader that just returns the value of c1 +// A shader that returns the value of c1 for color -------------------------- +// but keeps the texture's alpha. + +#if HLSL_SOURCE_CODE +sampler2D Image : register(s0); +float4 StencilColor : register(c1); + +float4 main (float2 texCoord : TEXCOORD0) : COLOR +{ + float4 color = tex2D (Image, texCoord); + color.rgb = StencilColor.rgb; + return color; +} +#elif SHADER_ASSEMBLY_CODE +// +// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000 +// +// fxc plainstencil.ps /Tps_1_1 /VnPlainStencilDef /Fh +// +// +// Parameters: +// +// sampler2D Image; +// float4 StencilColor; +// +// +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// StencilColor c1 1 +// Image s0 1 +// + + ps_1_1 + tex t0 + mov r0.xyz, c1 + + mov r0.w, t0.w + +// approximately 2 instruction slots used (1 texture, 1 arithmetic) +#endif + +const DWORD PlainStencilDef[] = +{ + 0xffff0101, 0x002ffffe, 0x42415443, 0x0000001c, 0x00000083, 0xffff0101, + 0x00000002, 0x0000001c, 0x00000100, 0x0000007c, 0x00000044, 0x00000003, + 0x00000001, 0x0000004c, 0x00000000, 0x0000005c, 0x00010002, 0x00020001, + 0x0000006c, 0x00000000, 0x67616d49, 0xabab0065, 0x000c0004, 0x00010001, + 0x00000001, 0x00000000, 0x6e657453, 0x436c6963, 0x726f6c6f, 0xababab00, + 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x315f7370, 0x4d00315f, + 0x6f726369, 0x74666f73, 0x29522820, 0x44334420, 0x53203958, 0x65646168, + 0x6f432072, 0x6c69706d, 0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, + 0xababab00, 0x00000042, 0xb00f0000, 0x00000001, 0x80070000, 0xa0e40001, + 0x40000001, 0x80080000, 0xb0ff0000, 0x0000ffff +}; + +// A shader that just returns the value of c1 ------------------------------- #if HLSL_SOURCE_CODE float4 Color : register(c1); @@ -216,3 +272,70 @@ const DWORD DimShaderDef[] = 0x6c69706d, 0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, 0xababab00, 0x00000001, 0x800f0000, 0xa0e40001, 0x0000ffff }; + +// A shader that just corrects gamma for windowed mode ---------------------- + +#if HLSL_SOURCE_CODE +sampler2D Image : register(s0); +float4 Gamma : register(c4); + +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) D3DX9 Shader Compiler 9.15.779.0000 +// +// fxc gammafixer.ps /Tps_2_0 /VnGammaFixerDef /Fh +// +// +// Parameters: +// +// float4 Gamma; +// sampler2D Image; +// +// +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// Gamma c4 1 +// Image s0 1 +// + + ps_2_0 + dcl t0.xy + dcl_2d s0 + texld r0, t0, s0 + log r0.x, r0.x + log r0.y, r0.y + log r0.z, r0.z + mul r0.xyz, r0, c4 + exp r0.x, r0.x + exp r0.y, r0.y + exp r0.z, r0.z + mov oC0, r0 + +// approximately 9 instruction slots used (1 texture, 8 arithmetic) +#endif + +const DWORD GammaFixerDef[] = +{ + 0xffff0200, 0x002dfffe, 0x42415443, 0x0000001c, 0x0000007b, 0xffff0200, + 0x00000002, 0x0000001c, 0x00000100, 0x00000074, 0x00000044, 0x00040002, + 0x00020001, 0x0000004c, 0x00000000, 0x0000005c, 0x00000003, 0x00000001, + 0x00000064, 0x00000000, 0x6d6d6147, 0xabab0061, 0x00030001, 0x00040001, + 0x00000001, 0x00000000, 0x67616d49, 0xabab0065, 0x000c0004, 0x00010001, + 0x00000001, 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, + 0x29522820, 0x44334420, 0x53203958, 0x65646168, 0x6f432072, 0x6c69706d, + 0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, 0xababab00, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x90000000, 0xa00f0800, 0x03000042, + 0x800f0000, 0xb0e40000, 0xa0e40800, 0x0200000f, 0x80010000, 0x80000000, + 0x0200000f, 0x80020000, 0x80550000, 0x0200000f, 0x80040000, 0x80aa0000, + 0x03000005, 0x80070000, 0x80e40000, 0xa0e40004, 0x0200000e, 0x80010000, + 0x80000000, 0x0200000e, 0x80020000, 0x80550000, 0x0200000e, 0x80040000, + 0x80aa0000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff +}; diff --git a/src/win32/win32iface.h b/src/win32/win32iface.h index 5faa5e215d..f8d119dcb8 100644 --- a/src/win32/win32iface.h +++ b/src/win32/win32iface.h @@ -2,7 +2,7 @@ ** win32iface.h ** **--------------------------------------------------------------------------- -** Copyright 1998-2006 Randy Heit +** Copyright 1998-2008 Randy Heit ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -233,7 +233,7 @@ public: bool PaintToWindow (); void SetVSync (bool vsync); void SetBlendingRect (int x1, int y1, int x2, int y2); - void Begin2D (); + bool Begin2D (); FNativeTexture *CreateTexture (FTexture *gametex); FNativeTexture *CreatePalette (FRemapTable *remap); void STACK_ARGS DrawTextureV (FTexture *img, int x, int y, uint32 tag, va_list tags); @@ -242,10 +242,14 @@ public: HRESULT GetHR (); private: + friend class D3DTex; + friend class D3DPal; + bool CreateResources(); void ReleaseResources(); bool CreateFBTexture(); bool CreatePaletteTexture(); + bool CreateGrayPaletteTexture(); bool CreateStencilPaletteTexture(); bool CreateShadedPaletteTexture(); bool CreateVertexes(); @@ -253,9 +257,13 @@ private: void FillPresentParameters (D3DPRESENT_PARAMETERS *pp, bool fullscreen, bool vsync); bool UploadVertices(); bool Reset(); + void KillNativePals(); + void KillNativeTexs(); + void KillNativeNonPalettedTexs(); void Draw3DPart(); - bool SetStyle(DCanvas::DrawParms &parms); + bool SetStyle(D3DTex *tex, DCanvas::DrawParms &parms); void SetColorOverlay(DWORD color, float alpha); + void DoWindowedGamma(); // State void SetAlphaBlend(BOOL enabled, D3DBLEND srcblend=D3DBLEND(0), D3DBLEND destblend=D3DBLEND(0)); @@ -271,7 +279,6 @@ private: IDirect3DPixelShader9 *CurPixelShader; IDirect3DTexture9 *Texture[2]; - BYTE GammaTable[256]; PalEntry SourcePalette[256]; float FlashConstants[2][4]; PalEntry FlashColor; @@ -289,20 +296,24 @@ private: bool UseBlendingRect; int In2D; bool SM14; + D3DPal *Palettes; + D3DTex *Textures; IDirect3DDevice9 *D3DDevice; IDirect3DVertexBuffer9 *VertexBuffer; IDirect3DTexture9 *FBTexture; + IDirect3DTexture9 *WindowedRenderTexture; IDirect3DTexture9 *PaletteTexture; IDirect3DTexture9 *StencilPaletteTexture; IDirect3DTexture9 *ShadedPaletteTexture; IDirect3DPixelShader9 *PalTexShader; IDirect3DPixelShader9 *PlainShader; + IDirect3DPixelShader9 *PlainStencilShader; IDirect3DPixelShader9 *DimShader; + IDirect3DPixelShader9 *GammaFixerShader; + IDirect3DSurface9 *OldRenderTarget; D3DFB() {} - - friend class D3DPal; }; #if 0