mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
Added IsBgra() to DCanvas
Changed SWRender output format to be decided by IsBgra()
This commit is contained in:
parent
045bad1b52
commit
05220a7133
24 changed files with 139 additions and 96 deletions
|
@ -33,8 +33,6 @@
|
||||||
// SCREEN WIPE PACKAGE
|
// SCREEN WIPE PACKAGE
|
||||||
//
|
//
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_swtruecolor)
|
|
||||||
|
|
||||||
static int CurrentWipeType;
|
static int CurrentWipeType;
|
||||||
|
|
||||||
static short *wipe_scr_start;
|
static short *wipe_scr_start;
|
||||||
|
@ -385,7 +383,7 @@ static bool (*wipes[])(int) =
|
||||||
// Returns true if the wipe should be performed.
|
// Returns true if the wipe should be performed.
|
||||||
bool wipe_StartScreen (int type)
|
bool wipe_StartScreen (int type)
|
||||||
{
|
{
|
||||||
if (r_swtruecolor)
|
if (screen->IsBgra())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CurrentWipeType = clamp(type, 0, wipe_NUMWIPES - 1);
|
CurrentWipeType = clamp(type, 0, wipe_NUMWIPES - 1);
|
||||||
|
@ -401,7 +399,7 @@ bool wipe_StartScreen (int type)
|
||||||
|
|
||||||
void wipe_EndScreen (void)
|
void wipe_EndScreen (void)
|
||||||
{
|
{
|
||||||
if (r_swtruecolor)
|
if (screen->IsBgra())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (CurrentWipeType)
|
if (CurrentWipeType)
|
||||||
|
@ -420,7 +418,7 @@ bool wipe_ScreenWipe (int ticks)
|
||||||
{
|
{
|
||||||
bool rc;
|
bool rc;
|
||||||
|
|
||||||
if (r_swtruecolor)
|
if (screen->IsBgra())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (CurrentWipeType == wipe_None)
|
if (CurrentWipeType == wipe_None)
|
||||||
|
@ -436,7 +434,7 @@ bool wipe_ScreenWipe (int ticks)
|
||||||
// Final things for the wipe
|
// Final things for the wipe
|
||||||
void wipe_Cleanup()
|
void wipe_Cleanup()
|
||||||
{
|
{
|
||||||
if (r_swtruecolor)
|
if (screen->IsBgra())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (wipe_scr_start != NULL)
|
if (wipe_scr_start != NULL)
|
||||||
|
|
|
@ -96,6 +96,8 @@ EXTERN_CVAR(Bool, ticker )
|
||||||
EXTERN_CVAR(Bool, vid_vsync)
|
EXTERN_CVAR(Bool, vid_vsync)
|
||||||
EXTERN_CVAR(Bool, vid_hidpi)
|
EXTERN_CVAR(Bool, vid_hidpi)
|
||||||
|
|
||||||
|
CVAR(Bool, swtruecolor, false, CVAR_ARCHIVE)
|
||||||
|
|
||||||
CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
{
|
{
|
||||||
extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
||||||
|
@ -199,7 +201,7 @@ public:
|
||||||
virtual EDisplayType GetDisplayType() { return DISPLAY_Both; }
|
virtual EDisplayType GetDisplayType() { return DISPLAY_Both; }
|
||||||
virtual void SetWindowedScale(float scale);
|
virtual void SetWindowedScale(float scale);
|
||||||
|
|
||||||
virtual DFrameBuffer* CreateFrameBuffer(int width, int height, bool fs, DFrameBuffer* old);
|
virtual DFrameBuffer* CreateFrameBuffer(int width, int height, bool bgra, bool fs, DFrameBuffer* old);
|
||||||
|
|
||||||
virtual void StartModeIterator(int bits, bool fullscreen);
|
virtual void StartModeIterator(int bits, bool fullscreen);
|
||||||
virtual bool NextMode(int* width, int* height, bool* letterbox);
|
virtual bool NextMode(int* width, int* height, bool* letterbox);
|
||||||
|
@ -518,7 +520,7 @@ bool CocoaVideo::NextMode(int* const width, int* const height, bool* const lette
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DFrameBuffer* CocoaVideo::CreateFrameBuffer(const int width, const int height, const bool fullscreen, DFrameBuffer* const old)
|
DFrameBuffer* CocoaVideo::CreateFrameBuffer(const int width, const int height, const bool bgra, const bool fullscreen, DFrameBuffer* const old)
|
||||||
{
|
{
|
||||||
PalEntry flashColor = 0;
|
PalEntry flashColor = 0;
|
||||||
int flashAmount = 0;
|
int flashAmount = 0;
|
||||||
|
@ -762,7 +764,7 @@ CocoaVideo* CocoaVideo::GetInstance()
|
||||||
|
|
||||||
|
|
||||||
CocoaFrameBuffer::CocoaFrameBuffer(int width, int height, bool fullscreen)
|
CocoaFrameBuffer::CocoaFrameBuffer(int width, int height, bool fullscreen)
|
||||||
: DFrameBuffer(width, height)
|
: DFrameBuffer(width, height, false)
|
||||||
, m_needPaletteUpdate(false)
|
, m_needPaletteUpdate(false)
|
||||||
, m_gamma(0.0f)
|
, m_gamma(0.0f)
|
||||||
, m_needGammaUpdate(false)
|
, m_needGammaUpdate(false)
|
||||||
|
@ -1064,7 +1066,7 @@ void I_CreateRenderer()
|
||||||
|
|
||||||
DFrameBuffer* I_SetMode(int &width, int &height, DFrameBuffer* old)
|
DFrameBuffer* I_SetMode(int &width, int &height, DFrameBuffer* old)
|
||||||
{
|
{
|
||||||
return Video->CreateFrameBuffer(width, height, fullscreen, old);
|
return Video->CreateFrameBuffer(width, height, swtruecolor, fullscreen, old);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool I_CheckResolution(const int width, const int height, const int bits)
|
bool I_CheckResolution(const int width, const int height, const int bits)
|
||||||
|
|
|
@ -74,7 +74,7 @@ class IVideo
|
||||||
virtual EDisplayType GetDisplayType () = 0;
|
virtual EDisplayType GetDisplayType () = 0;
|
||||||
virtual void SetWindowedScale (float scale) = 0;
|
virtual void SetWindowedScale (float scale) = 0;
|
||||||
|
|
||||||
virtual DFrameBuffer *CreateFrameBuffer (int width, int height, bool fs, DFrameBuffer *old) = 0;
|
virtual DFrameBuffer *CreateFrameBuffer (int width, int height, bool bgra, bool fs, DFrameBuffer *old) = 0;
|
||||||
|
|
||||||
virtual void StartModeIterator (int bits, bool fs) = 0;
|
virtual void StartModeIterator (int bits, bool fs) = 0;
|
||||||
virtual bool NextMode (int *width, int *height, bool *letterbox) = 0;
|
virtual bool NextMode (int *width, int *height, bool *letterbox) = 0;
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
|
|
||||||
EXTERN_CVAR (Bool, ticker)
|
EXTERN_CVAR (Bool, ticker)
|
||||||
EXTERN_CVAR (Bool, fullscreen)
|
EXTERN_CVAR (Bool, fullscreen)
|
||||||
|
EXTERN_CVAR (Bool, swtruecolor)
|
||||||
EXTERN_CVAR (Float, vid_winscale)
|
EXTERN_CVAR (Float, vid_winscale)
|
||||||
|
|
||||||
IVideo *Video;
|
IVideo *Video;
|
||||||
|
@ -128,7 +129,7 @@ DFrameBuffer *I_SetMode (int &width, int &height, DFrameBuffer *old)
|
||||||
fs = fullscreen;
|
fs = fullscreen;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DFrameBuffer *res = Video->CreateFrameBuffer (width, height, fs, old);
|
DFrameBuffer *res = Video->CreateFrameBuffer (width, height, swtruecolor, fs, old);
|
||||||
|
|
||||||
/* Right now, CreateFrameBuffer cannot return NULL
|
/* Right now, CreateFrameBuffer cannot return NULL
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
|
@ -280,6 +281,8 @@ CUSTOM_CVAR (Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CVAR (Bool, swtruecolor, false, CVAR_ARCHIVE)
|
||||||
|
|
||||||
extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
||||||
|
|
||||||
CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
|
|
|
@ -257,7 +257,7 @@ bool SDLVideo::NextMode (int *width, int *height, bool *letterbox)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscreen, DFrameBuffer *old)
|
DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool bgra, bool fullscreen, DFrameBuffer *old)
|
||||||
{
|
{
|
||||||
static int retry = 0;
|
static int retry = 0;
|
||||||
static int owidth, oheight;
|
static int owidth, oheight;
|
||||||
|
@ -335,7 +335,7 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscree
|
||||||
}
|
}
|
||||||
|
|
||||||
++retry;
|
++retry;
|
||||||
fb = static_cast<SDLFB *>(CreateFrameBuffer (width, height, fullscreen, NULL));
|
fb = static_cast<SDLFB *>(CreateFrameBuffer (width, height, bgra, fullscreen, NULL));
|
||||||
}
|
}
|
||||||
retry = 0;
|
retry = 0;
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ void SDLVideo::SetWindowedScale (float scale)
|
||||||
// FrameBuffer implementation -----------------------------------------------
|
// FrameBuffer implementation -----------------------------------------------
|
||||||
|
|
||||||
SDLFB::SDLFB (int width, int height, bool fullscreen, SDL_Window *oldwin)
|
SDLFB::SDLFB (int width, int height, bool fullscreen, SDL_Window *oldwin)
|
||||||
: DFrameBuffer (width, height)
|
: DFrameBuffer (width, height, false)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ class SDLVideo : public IVideo
|
||||||
EDisplayType GetDisplayType () { return DISPLAY_Both; }
|
EDisplayType GetDisplayType () { return DISPLAY_Both; }
|
||||||
void SetWindowedScale (float scale);
|
void SetWindowedScale (float scale);
|
||||||
|
|
||||||
DFrameBuffer *CreateFrameBuffer (int width, int height, bool fs, DFrameBuffer *old);
|
DFrameBuffer *CreateFrameBuffer (int width, int height, bool bgra, bool fs, DFrameBuffer *old);
|
||||||
|
|
||||||
void StartModeIterator (int bits, bool fs);
|
void StartModeIterator (int bits, bool fs);
|
||||||
bool NextMode (int *width, int *height, bool *letterbox);
|
bool NextMode (int *width, int *height, bool *letterbox);
|
||||||
|
|
|
@ -179,7 +179,6 @@ FDynamicColormap ShadeFakeColormap[16];
|
||||||
BYTE identitymap[256];
|
BYTE identitymap[256];
|
||||||
|
|
||||||
EXTERN_CVAR (Int, r_columnmethod)
|
EXTERN_CVAR (Int, r_columnmethod)
|
||||||
EXTERN_CVAR (Bool, r_swtruecolor)
|
|
||||||
|
|
||||||
void R_InitShadeMaps()
|
void R_InitShadeMaps()
|
||||||
{
|
{
|
||||||
|
@ -4129,6 +4128,14 @@ const BYTE *R_GetColumn (FTexture *tex, int col)
|
||||||
// [RH] Initialize the column drawer pointers
|
// [RH] Initialize the column drawer pointers
|
||||||
void R_InitColumnDrawers ()
|
void R_InitColumnDrawers ()
|
||||||
{
|
{
|
||||||
|
// Save a copy when switching to true color mode as the assembly palette drawers might change them
|
||||||
|
static bool pointers_saved = false;
|
||||||
|
static DWORD(*dovline1_saved)();
|
||||||
|
static DWORD(*doprevline1_saved)();
|
||||||
|
static DWORD(*domvline1_saved)();
|
||||||
|
static void(*dovline4_saved)();
|
||||||
|
static void(*domvline4_saved)();
|
||||||
|
|
||||||
if (r_swtruecolor)
|
if (r_swtruecolor)
|
||||||
{
|
{
|
||||||
R_DrawColumnHoriz = R_DrawColumnHorizP_RGBA_C;
|
R_DrawColumnHoriz = R_DrawColumnHorizP_RGBA_C;
|
||||||
|
@ -4201,6 +4208,16 @@ void R_InitColumnDrawers ()
|
||||||
rt_tlaterevsubclamp4cols = rt_tlaterevsubclamp4cols_RGBA_c;
|
rt_tlaterevsubclamp4cols = rt_tlaterevsubclamp4cols_RGBA_c;
|
||||||
rt_initcols = rt_initcols_rgba;
|
rt_initcols = rt_initcols_rgba;
|
||||||
|
|
||||||
|
if (!pointers_saved)
|
||||||
|
{
|
||||||
|
pointers_saved = true;
|
||||||
|
dovline1_saved = dovline1;
|
||||||
|
doprevline1_saved = doprevline1;
|
||||||
|
domvline1_saved = domvline1;
|
||||||
|
dovline4_saved = dovline4;
|
||||||
|
domvline4_saved = domvline4;
|
||||||
|
}
|
||||||
|
|
||||||
dovline1 = vlinec1_RGBA;
|
dovline1 = vlinec1_RGBA;
|
||||||
doprevline1 = vlinec1_RGBA;
|
doprevline1 = vlinec1_RGBA;
|
||||||
dovline4 = vlinec4_RGBA;
|
dovline4 = vlinec4_RGBA;
|
||||||
|
@ -4304,9 +4321,29 @@ void R_InitColumnDrawers ()
|
||||||
rt_tlatesubclamp4cols = rt_tlatesubclamp4cols_c;
|
rt_tlatesubclamp4cols = rt_tlatesubclamp4cols_c;
|
||||||
rt_tlaterevsubclamp4cols = rt_tlaterevsubclamp4cols_c;
|
rt_tlaterevsubclamp4cols = rt_tlaterevsubclamp4cols_c;
|
||||||
rt_initcols = rt_initcols_pal;
|
rt_initcols = rt_initcols_pal;
|
||||||
|
|
||||||
|
if (pointers_saved)
|
||||||
|
{
|
||||||
|
pointers_saved = false;
|
||||||
|
dovline1 = dovline1_saved;
|
||||||
|
doprevline1 = doprevline1_saved;
|
||||||
|
domvline1 = domvline1_saved;
|
||||||
|
dovline4 = dovline4_saved;
|
||||||
|
domvline4 = domvline4_saved;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
colfunc = basecolfunc = R_DrawColumn;
|
||||||
|
fuzzcolfunc = R_DrawFuzzColumn;
|
||||||
|
transcolfunc = R_DrawTranslatedColumn;
|
||||||
|
spanfunc = R_DrawSpan;
|
||||||
|
|
||||||
|
// [RH] Horizontal column drawers
|
||||||
|
hcolfunc_pre = R_DrawColumnHoriz;
|
||||||
|
hcolfunc_post1 = rt_map1col;
|
||||||
|
hcolfunc_post4 = rt_map4cols;
|
||||||
|
}
|
||||||
|
|
||||||
// [RH] Choose column drawers in a single place
|
// [RH] Choose column drawers in a single place
|
||||||
EXTERN_CVAR (Int, r_drawfuzz)
|
EXTERN_CVAR (Int, r_drawfuzz)
|
||||||
EXTERN_CVAR (Bool, r_drawtrans)
|
EXTERN_CVAR (Bool, r_drawtrans)
|
||||||
|
|
|
@ -47,8 +47,6 @@
|
||||||
#include "r_things.h"
|
#include "r_things.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_swtruecolor)
|
|
||||||
|
|
||||||
// I should have commented this stuff better.
|
// I should have commented this stuff better.
|
||||||
//
|
//
|
||||||
// dc_temp is the buffer R_DrawColumnHoriz writes into.
|
// dc_temp is the buffer R_DrawColumnHoriz writes into.
|
||||||
|
|
|
@ -103,7 +103,8 @@ bool r_dontmaplines;
|
||||||
|
|
||||||
CVAR (String, r_viewsize, "", CVAR_NOSET)
|
CVAR (String, r_viewsize, "", CVAR_NOSET)
|
||||||
CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
|
CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
|
||||||
CVAR (Bool, r_swtruecolor, false, CVAR_ARCHIVE)
|
|
||||||
|
bool r_swtruecolor;
|
||||||
|
|
||||||
double r_BaseVisibility;
|
double r_BaseVisibility;
|
||||||
double r_WallVisibility;
|
double r_WallVisibility;
|
||||||
|
@ -398,16 +399,6 @@ void R_InitRenderer()
|
||||||
R_InitPlanes ();
|
R_InitPlanes ();
|
||||||
R_InitShadeMaps();
|
R_InitShadeMaps();
|
||||||
R_InitColumnDrawers ();
|
R_InitColumnDrawers ();
|
||||||
|
|
||||||
colfunc = basecolfunc = R_DrawColumn;
|
|
||||||
fuzzcolfunc = R_DrawFuzzColumn;
|
|
||||||
transcolfunc = R_DrawTranslatedColumn;
|
|
||||||
spanfunc = R_DrawSpan;
|
|
||||||
|
|
||||||
// [RH] Horizontal column drawers
|
|
||||||
hcolfunc_pre = R_DrawColumnHoriz;
|
|
||||||
hcolfunc_post1 = rt_map1col;
|
|
||||||
hcolfunc_post4 = rt_map4cols;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -962,6 +953,13 @@ void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas,
|
||||||
int x, int y, int width, int height, bool dontmaplines)
|
int x, int y, int width, int height, bool dontmaplines)
|
||||||
{
|
{
|
||||||
const bool savedviewactive = viewactive;
|
const bool savedviewactive = viewactive;
|
||||||
|
const bool savedoutputformat = r_swtruecolor;
|
||||||
|
|
||||||
|
if (r_swtruecolor != canvas->IsBgra())
|
||||||
|
{
|
||||||
|
r_swtruecolor = canvas->IsBgra();
|
||||||
|
R_InitColumnDrawers();
|
||||||
|
}
|
||||||
|
|
||||||
viewwidth = width;
|
viewwidth = width;
|
||||||
RenderTarget = canvas;
|
RenderTarget = canvas;
|
||||||
|
@ -980,7 +978,15 @@ void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas,
|
||||||
screen->Lock (true);
|
screen->Lock (true);
|
||||||
R_SetupBuffer ();
|
R_SetupBuffer ();
|
||||||
screen->Unlock ();
|
screen->Unlock ();
|
||||||
|
|
||||||
viewactive = savedviewactive;
|
viewactive = savedviewactive;
|
||||||
|
r_swtruecolor = savedoutputformat;
|
||||||
|
|
||||||
|
if (r_swtruecolor != canvas->IsBgra())
|
||||||
|
{
|
||||||
|
r_swtruecolor = canvas->IsBgra();
|
||||||
|
R_InitColumnDrawers();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -106,6 +106,8 @@ inline uint32_t shade_pal_index(uint32_t index, uint32_t light)
|
||||||
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern bool r_swtruecolor;
|
||||||
|
|
||||||
extern double GlobVis;
|
extern double GlobVis;
|
||||||
|
|
||||||
void R_SetVisibility(double visibility);
|
void R_SetVisibility(double visibility);
|
||||||
|
|
|
@ -61,8 +61,6 @@ CVAR(Bool, r_np2, true, 0)
|
||||||
//CVAR (Int, ty, 8, 0)
|
//CVAR (Int, ty, 8, 0)
|
||||||
//CVAR (Int, tx, 8, 0)
|
//CVAR (Int, tx, 8, 0)
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_swtruecolor)
|
|
||||||
|
|
||||||
#define HEIGHTBITS 12
|
#define HEIGHTBITS 12
|
||||||
#define HEIGHTSHIFT (FRACBITS-HEIGHTBITS)
|
#define HEIGHTSHIFT (FRACBITS-HEIGHTBITS)
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,12 @@ void FSoftwareRenderer::Precache(BYTE *texhitlist, TMap<PClassActor*, bool> &act
|
||||||
|
|
||||||
void FSoftwareRenderer::RenderView(player_t *player)
|
void FSoftwareRenderer::RenderView(player_t *player)
|
||||||
{
|
{
|
||||||
|
if (r_swtruecolor != screen->IsBgra())
|
||||||
|
{
|
||||||
|
r_swtruecolor = screen->IsBgra();
|
||||||
|
R_InitColumnDrawers();
|
||||||
|
}
|
||||||
|
|
||||||
R_RenderActorView (player->mo);
|
R_RenderActorView (player->mo);
|
||||||
// [RH] Let cameras draw onto textures that were visible this frame.
|
// [RH] Let cameras draw onto textures that were visible this frame.
|
||||||
FCanvasTextureInfo::UpdateAll ();
|
FCanvasTextureInfo::UpdateAll ();
|
||||||
|
@ -182,8 +188,7 @@ void FSoftwareRenderer::RemapVoxels()
|
||||||
|
|
||||||
void FSoftwareRenderer::WriteSavePic (player_t *player, FILE *file, int width, int height)
|
void FSoftwareRenderer::WriteSavePic (player_t *player, FILE *file, int width, int height)
|
||||||
{
|
{
|
||||||
#ifdef PALETTEOUTPUT
|
DCanvas *pic = new DSimpleCanvas (width, height, false);
|
||||||
DCanvas *pic = new DSimpleCanvas (width, height);
|
|
||||||
PalEntry palette[256];
|
PalEntry palette[256];
|
||||||
|
|
||||||
// Take a snapshot of the player's view
|
// Take a snapshot of the player's view
|
||||||
|
@ -196,7 +201,6 @@ void FSoftwareRenderer::WriteSavePic (player_t *player, FILE *file, int width, i
|
||||||
pic->Destroy();
|
pic->Destroy();
|
||||||
pic->ObjectFlags |= OF_YesReallyDelete;
|
pic->ObjectFlags |= OF_YesReallyDelete;
|
||||||
delete pic;
|
delete pic;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -313,7 +317,6 @@ void FSoftwareRenderer::CopyStackedViewParameters()
|
||||||
|
|
||||||
void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, int fov)
|
void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, int fov)
|
||||||
{
|
{
|
||||||
#ifdef PALETTEOUTPUT
|
|
||||||
BYTE *Pixels = const_cast<BYTE*>(tex->GetPixels());
|
BYTE *Pixels = const_cast<BYTE*>(tex->GetPixels());
|
||||||
DSimpleCanvas *Canvas = tex->GetCanvas();
|
DSimpleCanvas *Canvas = tex->GetCanvas();
|
||||||
|
|
||||||
|
@ -337,7 +340,6 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
|
||||||
tex->SetUpdated();
|
tex->SetUpdated();
|
||||||
fixedcolormap = savecolormap;
|
fixedcolormap = savecolormap;
|
||||||
realfixedcolormap = savecm;
|
realfixedcolormap = savecm;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -98,7 +98,6 @@ EXTERN_CVAR (Bool, st_scale)
|
||||||
EXTERN_CVAR(Bool, r_shadercolormaps)
|
EXTERN_CVAR(Bool, r_shadercolormaps)
|
||||||
EXTERN_CVAR(Int, r_drawfuzz)
|
EXTERN_CVAR(Int, r_drawfuzz)
|
||||||
EXTERN_CVAR(Bool, r_deathcamera);
|
EXTERN_CVAR(Bool, r_deathcamera);
|
||||||
EXTERN_CVAR(Bool, r_swtruecolor)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sprite rotation 0 is facing the viewer,
|
// Sprite rotation 0 is facing the viewer,
|
||||||
|
|
|
@ -103,7 +103,7 @@ const BYTE *FCanvasTexture::GetPixels ()
|
||||||
|
|
||||||
void FCanvasTexture::MakeTexture ()
|
void FCanvasTexture::MakeTexture ()
|
||||||
{
|
{
|
||||||
Canvas = new DSimpleCanvas (Width, Height);
|
Canvas = new DSimpleCanvas (Width, Height, false);
|
||||||
Canvas->Lock ();
|
Canvas->Lock ();
|
||||||
GC::AddSoftRoot(Canvas);
|
GC::AddSoftRoot(Canvas);
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,6 @@ extern "C" short spanend[MAXHEIGHT];
|
||||||
|
|
||||||
CVAR (Bool, hud_scale, false, CVAR_ARCHIVE);
|
CVAR (Bool, hud_scale, false, CVAR_ARCHIVE);
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_swtruecolor)
|
|
||||||
|
|
||||||
// For routines that take RGB colors, cache the previous lookup in case there
|
// For routines that take RGB colors, cache the previous lookup in case there
|
||||||
// are several repetitions with the same color.
|
// are several repetitions with the same color.
|
||||||
static int LastPal = -1;
|
static int LastPal = -1;
|
||||||
|
@ -1019,7 +1017,7 @@ void DCanvas::PUTTRANSDOT (int xx, int yy, int basecolor, int level)
|
||||||
oldyyshifted = yy * GetPitch();
|
oldyyshifted = yy * GetPitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_swtruecolor)
|
if (IsBgra())
|
||||||
{
|
{
|
||||||
uint32_t *spot = (uint32_t*)GetBuffer() + oldyyshifted + xx;
|
uint32_t *spot = (uint32_t*)GetBuffer() + oldyyshifted + xx;
|
||||||
|
|
||||||
|
@ -1091,7 +1089,7 @@ void DCanvas::DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32 real
|
||||||
{
|
{
|
||||||
swapvalues (x0, x1);
|
swapvalues (x0, x1);
|
||||||
}
|
}
|
||||||
if (r_swtruecolor)
|
if (IsBgra())
|
||||||
{
|
{
|
||||||
uint32_t *spot = (uint32_t*)GetBuffer() + y0*GetPitch() + x0;
|
uint32_t *spot = (uint32_t*)GetBuffer() + y0*GetPitch() + x0;
|
||||||
for (int i = 0; i <= deltaX; i++)
|
for (int i = 0; i <= deltaX; i++)
|
||||||
|
@ -1104,7 +1102,7 @@ void DCanvas::DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32 real
|
||||||
}
|
}
|
||||||
else if (deltaX == 0)
|
else if (deltaX == 0)
|
||||||
{ // vertical line
|
{ // vertical line
|
||||||
if (r_swtruecolor)
|
if (IsBgra())
|
||||||
{
|
{
|
||||||
uint32_t *spot = (uint32_t*)GetBuffer() + y0*GetPitch() + x0;
|
uint32_t *spot = (uint32_t*)GetBuffer() + y0*GetPitch() + x0;
|
||||||
int pitch = GetPitch();
|
int pitch = GetPitch();
|
||||||
|
@ -1127,7 +1125,7 @@ void DCanvas::DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32 real
|
||||||
}
|
}
|
||||||
else if (deltaX == deltaY)
|
else if (deltaX == deltaY)
|
||||||
{ // diagonal line.
|
{ // diagonal line.
|
||||||
if (r_swtruecolor)
|
if (IsBgra())
|
||||||
{
|
{
|
||||||
uint32_t *spot = (uint32_t*)GetBuffer() + y0*GetPitch() + x0;
|
uint32_t *spot = (uint32_t*)GetBuffer() + y0*GetPitch() + x0;
|
||||||
int advance = GetPitch() + xDir;
|
int advance = GetPitch() + xDir;
|
||||||
|
@ -1295,7 +1293,7 @@ void DCanvas::Clear (int left, int top, int right, int bottom, int palcolor, uin
|
||||||
palcolor = PalFromRGB(color);
|
palcolor = PalFromRGB(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_swtruecolor)
|
if (IsBgra())
|
||||||
{
|
{
|
||||||
uint32_t *dest = (uint32_t*)Buffer + top * Pitch + left;
|
uint32_t *dest = (uint32_t*)Buffer + top * Pitch + left;
|
||||||
x = right - left;
|
x = right - left;
|
||||||
|
@ -1502,7 +1500,7 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
||||||
//
|
//
|
||||||
void DCanvas::DrawBlock (int x, int y, int _width, int _height, const BYTE *src) const
|
void DCanvas::DrawBlock (int x, int y, int _width, int _height, const BYTE *src) const
|
||||||
{
|
{
|
||||||
if (r_swtruecolor)
|
if (IsBgra())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int srcpitch = _width;
|
int srcpitch = _width;
|
||||||
|
@ -1531,7 +1529,7 @@ void DCanvas::DrawBlock (int x, int y, int _width, int _height, const BYTE *src)
|
||||||
//
|
//
|
||||||
void DCanvas::GetBlock (int x, int y, int _width, int _height, BYTE *dest) const
|
void DCanvas::GetBlock (int x, int y, int _width, int _height, BYTE *dest) const
|
||||||
{
|
{
|
||||||
if (r_swtruecolor)
|
if (IsBgra())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const BYTE *src;
|
const BYTE *src;
|
||||||
|
|
|
@ -65,8 +65,6 @@
|
||||||
#include "menu/menu.h"
|
#include "menu/menu.h"
|
||||||
#include "r_data/voxels.h"
|
#include "r_data/voxels.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_swtruecolor)
|
|
||||||
|
|
||||||
FRenderer *Renderer;
|
FRenderer *Renderer;
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS (DCanvas)
|
IMPLEMENT_ABSTRACT_CLASS (DCanvas)
|
||||||
|
@ -83,7 +81,7 @@ class DDummyFrameBuffer : public DFrameBuffer
|
||||||
DECLARE_CLASS (DDummyFrameBuffer, DFrameBuffer);
|
DECLARE_CLASS (DDummyFrameBuffer, DFrameBuffer);
|
||||||
public:
|
public:
|
||||||
DDummyFrameBuffer (int width, int height)
|
DDummyFrameBuffer (int width, int height)
|
||||||
: DFrameBuffer (0, 0)
|
: DFrameBuffer (0, 0, false)
|
||||||
{
|
{
|
||||||
Width = width;
|
Width = width;
|
||||||
Height = height;
|
Height = height;
|
||||||
|
@ -208,13 +206,14 @@ DCanvas *DCanvas::CanvasChain = NULL;
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
DCanvas::DCanvas (int _width, int _height)
|
DCanvas::DCanvas (int _width, int _height, bool _bgra)
|
||||||
{
|
{
|
||||||
// Init member vars
|
// Init member vars
|
||||||
Buffer = NULL;
|
Buffer = NULL;
|
||||||
LockCount = 0;
|
LockCount = 0;
|
||||||
Width = _width;
|
Width = _width;
|
||||||
Height = _height;
|
Height = _height;
|
||||||
|
Bgra = _bgra;
|
||||||
|
|
||||||
// Add to list of active canvases
|
// Add to list of active canvases
|
||||||
Next = CanvasChain;
|
Next = CanvasChain;
|
||||||
|
@ -366,7 +365,7 @@ void DCanvas::Dim (PalEntry color, float damount, int x1, int y1, int w, int h)
|
||||||
|
|
||||||
gap = Pitch - w;
|
gap = Pitch - w;
|
||||||
|
|
||||||
if (r_swtruecolor)
|
if (IsBgra())
|
||||||
{
|
{
|
||||||
uint32_t *spot = (uint32_t*)Buffer + x1 + y1*Pitch;
|
uint32_t *spot = (uint32_t*)Buffer + x1 + y1*Pitch;
|
||||||
|
|
||||||
|
@ -448,7 +447,7 @@ void DCanvas::GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &colo
|
||||||
Lock(true);
|
Lock(true);
|
||||||
buffer = GetBuffer();
|
buffer = GetBuffer();
|
||||||
pitch = GetPitch();
|
pitch = GetPitch();
|
||||||
color_type = r_swtruecolor ? SS_BGRA : SS_PAL;
|
color_type = IsBgra() ? SS_BGRA : SS_PAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -761,8 +760,8 @@ void DCanvas::CalcGamma (float gamma, BYTE gammalookup[256])
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
DSimpleCanvas::DSimpleCanvas (int width, int height)
|
DSimpleCanvas::DSimpleCanvas (int width, int height, bool bgra)
|
||||||
: DCanvas (width, height)
|
: DCanvas (width, height, bgra)
|
||||||
{
|
{
|
||||||
// Making the pitch a power of 2 is very bad for performance
|
// Making the pitch a power of 2 is very bad for performance
|
||||||
// Try to maximize the number of cache lines that can be filled
|
// Try to maximize the number of cache lines that can be filled
|
||||||
|
@ -799,8 +798,9 @@ DSimpleCanvas::DSimpleCanvas (int width, int height)
|
||||||
Pitch = width + MAX(0, CPU.DataL1LineSize - 8);
|
Pitch = width + MAX(0, CPU.DataL1LineSize - 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemBuffer = new BYTE[Pitch * height * 4];
|
int bytes_per_pixel = bgra ? 4 : 1;
|
||||||
memset (MemBuffer, 0, Pitch * height * 4);
|
MemBuffer = new BYTE[Pitch * height * bytes_per_pixel];
|
||||||
|
memset (MemBuffer, 0, Pitch * height * bytes_per_pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -869,8 +869,8 @@ void DSimpleCanvas::Unlock ()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
DFrameBuffer::DFrameBuffer (int width, int height)
|
DFrameBuffer::DFrameBuffer (int width, int height, bool bgra)
|
||||||
: DSimpleCanvas (width, height)
|
: DSimpleCanvas (width, height, bgra)
|
||||||
{
|
{
|
||||||
LastMS = LastSec = FrameCount = LastCount = LastTic = 0;
|
LastMS = LastSec = FrameCount = LastCount = LastTic = 0;
|
||||||
Accel2D = false;
|
Accel2D = false;
|
||||||
|
@ -927,7 +927,7 @@ void DFrameBuffer::DrawRateStuff ()
|
||||||
// Buffer can be NULL if we're doing hardware accelerated 2D
|
// Buffer can be NULL if we're doing hardware accelerated 2D
|
||||||
if (buffer != NULL)
|
if (buffer != NULL)
|
||||||
{
|
{
|
||||||
if (r_swtruecolor)
|
if (IsBgra())
|
||||||
{
|
{
|
||||||
uint32_t *buffer32 = (uint32_t*)buffer;
|
uint32_t *buffer32 = (uint32_t*)buffer;
|
||||||
buffer32 += (GetHeight() - 1) * GetPitch();
|
buffer32 += (GetHeight() - 1) * GetPitch();
|
||||||
|
|
|
@ -185,7 +185,7 @@ class DCanvas : public DObject
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS (DCanvas, DObject)
|
DECLARE_ABSTRACT_CLASS (DCanvas, DObject)
|
||||||
public:
|
public:
|
||||||
DCanvas (int width, int height);
|
DCanvas (int width, int height, bool bgra);
|
||||||
virtual ~DCanvas ();
|
virtual ~DCanvas ();
|
||||||
|
|
||||||
// Member variable access
|
// Member variable access
|
||||||
|
@ -193,6 +193,7 @@ public:
|
||||||
inline int GetWidth () const { return Width; }
|
inline int GetWidth () const { return Width; }
|
||||||
inline int GetHeight () const { return Height; }
|
inline int GetHeight () const { return Height; }
|
||||||
inline int GetPitch () const { return Pitch; }
|
inline int GetPitch () const { return Pitch; }
|
||||||
|
inline bool IsBgra() const { return Bgra; }
|
||||||
|
|
||||||
virtual bool IsValid ();
|
virtual bool IsValid ();
|
||||||
|
|
||||||
|
@ -267,6 +268,7 @@ protected:
|
||||||
int Height;
|
int Height;
|
||||||
int Pitch;
|
int Pitch;
|
||||||
int LockCount;
|
int LockCount;
|
||||||
|
bool Bgra;
|
||||||
|
|
||||||
bool ClipBox (int &left, int &top, int &width, int &height, const BYTE *&src, const int srcpitch) const;
|
bool ClipBox (int &left, int &top, int &width, int &height, const BYTE *&src, const int srcpitch) const;
|
||||||
void DrawTextureV(FTexture *img, double x, double y, uint32 tag, va_list tags) = delete;
|
void DrawTextureV(FTexture *img, double x, double y, uint32 tag, va_list tags) = delete;
|
||||||
|
@ -289,7 +291,7 @@ class DSimpleCanvas : public DCanvas
|
||||||
{
|
{
|
||||||
DECLARE_CLASS (DSimpleCanvas, DCanvas)
|
DECLARE_CLASS (DSimpleCanvas, DCanvas)
|
||||||
public:
|
public:
|
||||||
DSimpleCanvas (int width, int height);
|
DSimpleCanvas (int width, int height, bool bgra);
|
||||||
~DSimpleCanvas ();
|
~DSimpleCanvas ();
|
||||||
|
|
||||||
bool IsValid ();
|
bool IsValid ();
|
||||||
|
@ -327,7 +329,7 @@ class DFrameBuffer : public DSimpleCanvas
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS (DFrameBuffer, DSimpleCanvas)
|
DECLARE_ABSTRACT_CLASS (DFrameBuffer, DSimpleCanvas)
|
||||||
public:
|
public:
|
||||||
DFrameBuffer (int width, int height);
|
DFrameBuffer (int width, int height, bool bgra);
|
||||||
|
|
||||||
// Force the surface to use buffered output if true is passed.
|
// Force the surface to use buffered output if true is passed.
|
||||||
virtual bool Lock (bool buffered) = 0;
|
virtual bool Lock (bool buffered) = 0;
|
||||||
|
|
|
@ -187,7 +187,6 @@ EXTERN_CVAR (Float, Gamma)
|
||||||
EXTERN_CVAR (Bool, vid_vsync)
|
EXTERN_CVAR (Bool, vid_vsync)
|
||||||
EXTERN_CVAR (Float, transsouls)
|
EXTERN_CVAR (Float, transsouls)
|
||||||
EXTERN_CVAR (Int, vid_refreshrate)
|
EXTERN_CVAR (Int, vid_refreshrate)
|
||||||
EXTERN_CVAR (Bool, r_swtruecolor)
|
|
||||||
|
|
||||||
extern IDirect3D9 *D3D;
|
extern IDirect3D9 *D3D;
|
||||||
|
|
||||||
|
@ -243,8 +242,8 @@ CVAR(Bool, vid_hwaalines, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
D3DFB::D3DFB (UINT adapter, int width, int height, bool fullscreen)
|
D3DFB::D3DFB (UINT adapter, int width, int height, bool bgra, bool fullscreen)
|
||||||
: BaseWinFB (width, height)
|
: BaseWinFB (width, height, bgra)
|
||||||
{
|
{
|
||||||
D3DPRESENT_PARAMETERS d3dpp;
|
D3DPRESENT_PARAMETERS d3dpp;
|
||||||
|
|
||||||
|
@ -766,7 +765,7 @@ void D3DFB::KillNativeTexs()
|
||||||
|
|
||||||
bool D3DFB::CreateFBTexture ()
|
bool D3DFB::CreateFBTexture ()
|
||||||
{
|
{
|
||||||
FBFormat = r_swtruecolor ? D3DFMT_A8R8G8B8 : D3DFMT_L8;
|
FBFormat = IsBgra() ? D3DFMT_A8R8G8B8 : D3DFMT_L8;
|
||||||
|
|
||||||
if (FAILED(D3DDevice->CreateTexture(Width, Height, 1, D3DUSAGE_DYNAMIC, FBFormat, D3DPOOL_DEFAULT, &FBTexture, NULL)))
|
if (FAILED(D3DDevice->CreateTexture(Width, Height, 1, D3DUSAGE_DYNAMIC, FBFormat, D3DPOOL_DEFAULT, &FBTexture, NULL)))
|
||||||
{
|
{
|
||||||
|
@ -1307,7 +1306,7 @@ void D3DFB::Draw3DPart(bool copy3d)
|
||||||
SUCCEEDED(FBTexture->LockRect (0, &lockrect, NULL, D3DLOCK_DISCARD))) ||
|
SUCCEEDED(FBTexture->LockRect (0, &lockrect, NULL, D3DLOCK_DISCARD))) ||
|
||||||
SUCCEEDED(FBTexture->LockRect (0, &lockrect, &texrect, 0)))
|
SUCCEEDED(FBTexture->LockRect (0, &lockrect, &texrect, 0)))
|
||||||
{
|
{
|
||||||
if (r_swtruecolor && FBFormat == D3DFMT_A8R8G8B8)
|
if (IsBgra() && FBFormat == D3DFMT_A8R8G8B8)
|
||||||
{
|
{
|
||||||
if (lockrect.Pitch == Pitch * sizeof(uint32_t) && Pitch == Width)
|
if (lockrect.Pitch == Pitch * sizeof(uint32_t) && Pitch == Width)
|
||||||
{
|
{
|
||||||
|
@ -1325,7 +1324,7 @@ void D3DFB::Draw3DPart(bool copy3d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!r_swtruecolor && FBFormat == D3DFMT_L8)
|
else if (!IsBgra() && FBFormat == D3DFMT_L8)
|
||||||
{
|
{
|
||||||
if (lockrect.Pitch == Pitch && Pitch == Width)
|
if (lockrect.Pitch == Pitch && Pitch == Width)
|
||||||
{
|
{
|
||||||
|
@ -1377,7 +1376,7 @@ void D3DFB::Draw3DPart(bool copy3d)
|
||||||
memset(Constant, 0, sizeof(Constant));
|
memset(Constant, 0, sizeof(Constant));
|
||||||
SetAlphaBlend(D3DBLENDOP(0));
|
SetAlphaBlend(D3DBLENDOP(0));
|
||||||
EnableAlphaTest(FALSE);
|
EnableAlphaTest(FALSE);
|
||||||
if (r_swtruecolor)
|
if (IsBgra())
|
||||||
SetPixelShader(Shaders[SHADER_NormalColor]);
|
SetPixelShader(Shaders[SHADER_NormalColor]);
|
||||||
else
|
else
|
||||||
SetPixelShader(Shaders[SHADER_NormalColorPal]);
|
SetPixelShader(Shaders[SHADER_NormalColorPal]);
|
||||||
|
@ -1398,7 +1397,7 @@ void D3DFB::Draw3DPart(bool copy3d)
|
||||||
realfixedcolormap->ColorizeStart[1]/2, realfixedcolormap->ColorizeStart[2]/2, 0);
|
realfixedcolormap->ColorizeStart[1]/2, realfixedcolormap->ColorizeStart[2]/2, 0);
|
||||||
color1 = D3DCOLOR_COLORVALUE(realfixedcolormap->ColorizeEnd[0]/2,
|
color1 = D3DCOLOR_COLORVALUE(realfixedcolormap->ColorizeEnd[0]/2,
|
||||||
realfixedcolormap->ColorizeEnd[1]/2, realfixedcolormap->ColorizeEnd[2]/2, 1);
|
realfixedcolormap->ColorizeEnd[1]/2, realfixedcolormap->ColorizeEnd[2]/2, 1);
|
||||||
if (r_swtruecolor)
|
if (IsBgra())
|
||||||
SetPixelShader(Shaders[SHADER_SpecialColormap]);
|
SetPixelShader(Shaders[SHADER_SpecialColormap]);
|
||||||
else
|
else
|
||||||
SetPixelShader(Shaders[SHADER_SpecialColormapPal]);
|
SetPixelShader(Shaders[SHADER_SpecialColormapPal]);
|
||||||
|
@ -1412,7 +1411,7 @@ void D3DFB::Draw3DPart(bool copy3d)
|
||||||
CalcFullscreenCoords(verts, Accel2D, false, color0, color1);
|
CalcFullscreenCoords(verts, Accel2D, false, color0, color1);
|
||||||
D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX));
|
D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX));
|
||||||
}
|
}
|
||||||
if (r_swtruecolor)
|
if (IsBgra())
|
||||||
SetPixelShader(Shaders[SHADER_NormalColor]);
|
SetPixelShader(Shaders[SHADER_NormalColor]);
|
||||||
else
|
else
|
||||||
SetPixelShader(Shaders[SHADER_NormalColorPal]);
|
SetPixelShader(Shaders[SHADER_NormalColorPal]);
|
||||||
|
|
|
@ -60,9 +60,7 @@
|
||||||
|
|
||||||
// TYPES -------------------------------------------------------------------
|
// TYPES -------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef USE_OBSOLETE_DDRAW
|
|
||||||
IMPLEMENT_CLASS(DDrawFB)
|
IMPLEMENT_CLASS(DDrawFB)
|
||||||
#endif
|
|
||||||
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||||
|
|
||||||
|
@ -120,10 +118,8 @@ cycle_t BlitCycles;
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef USE_OBSOLETE_DDRAW
|
|
||||||
|
|
||||||
DDrawFB::DDrawFB (int width, int height, bool fullscreen)
|
DDrawFB::DDrawFB (int width, int height, bool fullscreen)
|
||||||
: BaseWinFB (width, height)
|
: BaseWinFB (width, height, false)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1330,7 +1326,6 @@ void DDrawFB::Blank ()
|
||||||
PrimarySurf->Blt (NULL, NULL, NULL, DDBLT_COLORFILL, &blitFX);
|
PrimarySurf->Blt (NULL, NULL, NULL, DDBLT_COLORFILL, &blitFX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
ADD_STAT (blit)
|
ADD_STAT (blit)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
|
|
||||||
EXTERN_CVAR (Bool, ticker)
|
EXTERN_CVAR (Bool, ticker)
|
||||||
EXTERN_CVAR (Bool, fullscreen)
|
EXTERN_CVAR (Bool, fullscreen)
|
||||||
|
EXTERN_CVAR (Bool, swtruecolor)
|
||||||
EXTERN_CVAR (Float, vid_winscale)
|
EXTERN_CVAR (Float, vid_winscale)
|
||||||
|
|
||||||
CVAR(Int, win_x, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CVAR(Int, win_x, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
@ -146,7 +147,7 @@ DFrameBuffer *I_SetMode (int &width, int &height, DFrameBuffer *old)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DFrameBuffer *res = Video->CreateFrameBuffer (width, height, fs, old);
|
DFrameBuffer *res = Video->CreateFrameBuffer (width, height, swtruecolor, fs, old);
|
||||||
|
|
||||||
/* Right now, CreateFrameBuffer cannot return NULL
|
/* Right now, CreateFrameBuffer cannot return NULL
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
|
@ -310,6 +311,8 @@ void I_RestoreWindowedPos ()
|
||||||
MoveWindow (Window, winx, winy, winw, winh, TRUE);
|
MoveWindow (Window, winx, winy, winw, winh, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CVAR (Bool, swtruecolor, false, CVAR_ARCHIVE)
|
||||||
|
|
||||||
extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
||||||
|
|
||||||
CUSTOM_CVAR (Bool, fullscreen, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
CUSTOM_CVAR (Bool, fullscreen, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
||||||
|
|
|
@ -45,7 +45,7 @@ class IVideo
|
||||||
virtual EDisplayType GetDisplayType () = 0;
|
virtual EDisplayType GetDisplayType () = 0;
|
||||||
virtual void SetWindowedScale (float scale) = 0;
|
virtual void SetWindowedScale (float scale) = 0;
|
||||||
|
|
||||||
virtual DFrameBuffer *CreateFrameBuffer (int width, int height, bool fs, DFrameBuffer *old) = 0;
|
virtual DFrameBuffer *CreateFrameBuffer (int width, int height, bool bgra, bool fs, DFrameBuffer *old) = 0;
|
||||||
|
|
||||||
virtual void StartModeIterator (int bits, bool fs) = 0;
|
virtual void StartModeIterator (int bits, bool fs) = 0;
|
||||||
virtual bool NextMode (int *width, int *height, bool *letterbox) = 0;
|
virtual bool NextMode (int *width, int *height, bool *letterbox) = 0;
|
||||||
|
|
|
@ -70,7 +70,7 @@ class Win32Video : public IVideo
|
||||||
EDisplayType GetDisplayType () { return DISPLAY_Both; }
|
EDisplayType GetDisplayType () { return DISPLAY_Both; }
|
||||||
void SetWindowedScale (float scale);
|
void SetWindowedScale (float scale);
|
||||||
|
|
||||||
DFrameBuffer *CreateFrameBuffer (int width, int height, bool fs, DFrameBuffer *old);
|
DFrameBuffer *CreateFrameBuffer (int width, int height, bool bgra, bool fs, DFrameBuffer *old);
|
||||||
|
|
||||||
void StartModeIterator (int bits, bool fs);
|
void StartModeIterator (int bits, bool fs);
|
||||||
bool NextMode (int *width, int *height, bool *letterbox);
|
bool NextMode (int *width, int *height, bool *letterbox);
|
||||||
|
@ -121,7 +121,7 @@ class BaseWinFB : public DFrameBuffer
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(BaseWinFB, DFrameBuffer)
|
DECLARE_ABSTRACT_CLASS(BaseWinFB, DFrameBuffer)
|
||||||
public:
|
public:
|
||||||
BaseWinFB (int width, int height) : DFrameBuffer (width, height), Windowed (true) {}
|
BaseWinFB (int width, int height, bool bgra) : DFrameBuffer (width, height, bgra), Windowed (true) {}
|
||||||
|
|
||||||
bool IsFullscreen () { return !Windowed; }
|
bool IsFullscreen () { return !Windowed; }
|
||||||
virtual void Blank () = 0;
|
virtual void Blank () = 0;
|
||||||
|
@ -142,7 +142,6 @@ protected:
|
||||||
BaseWinFB() {}
|
BaseWinFB() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef USE_OBSOLETE_DDRAW
|
|
||||||
class DDrawFB : public BaseWinFB
|
class DDrawFB : public BaseWinFB
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(DDrawFB, BaseWinFB)
|
DECLARE_CLASS(DDrawFB, BaseWinFB)
|
||||||
|
@ -224,13 +223,12 @@ private:
|
||||||
|
|
||||||
DDrawFB() {}
|
DDrawFB() {}
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
class D3DFB : public BaseWinFB
|
class D3DFB : public BaseWinFB
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(D3DFB, BaseWinFB)
|
DECLARE_CLASS(D3DFB, BaseWinFB)
|
||||||
public:
|
public:
|
||||||
D3DFB (UINT adapter, int width, int height, bool fullscreen);
|
D3DFB (UINT adapter, int width, int height, bool bgra, bool fullscreen);
|
||||||
~D3DFB ();
|
~D3DFB ();
|
||||||
|
|
||||||
bool IsValid ();
|
bool IsValid ();
|
||||||
|
|
|
@ -222,6 +222,13 @@ bool Win32Video::InitD3D9 ()
|
||||||
// Enumerate available display modes.
|
// Enumerate available display modes.
|
||||||
FreeModes ();
|
FreeModes ();
|
||||||
#ifndef PALETTEOUTPUT // To do: remove this again (AddD3DModes fails when there are too many modes available for videomenu to display)
|
#ifndef PALETTEOUTPUT // To do: remove this again (AddD3DModes fails when there are too many modes available for videomenu to display)
|
||||||
|
|
||||||
|
AddMode(320, 200, 8, 200, 0);
|
||||||
|
AddMode(320, 240, 8, 240, 0);
|
||||||
|
AddMode(640, 480, 8, 480, 0);
|
||||||
|
AddMode(800, 600, 8, 600, 0);
|
||||||
|
AddMode(1024, 768, 8, 768, 0);
|
||||||
|
|
||||||
AddMode(1920, 1080, 8, 1440, 0); // 1080p
|
AddMode(1920, 1080, 8, 1440, 0); // 1080p
|
||||||
AddMode(1920*2, 1080*2, 8, 1440, 0); // 4k
|
AddMode(1920*2, 1080*2, 8, 1440, 0); // 4k
|
||||||
AddMode(2560, 1440, 8, 1440, 0); // 27" classic
|
AddMode(2560, 1440, 8, 1440, 0); // 27" classic
|
||||||
|
@ -636,7 +643,7 @@ bool Win32Video::NextMode (int *width, int *height, bool *letterbox)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DFrameBuffer *Win32Video::CreateFrameBuffer (int width, int height, bool fullscreen, DFrameBuffer *old)
|
DFrameBuffer *Win32Video::CreateFrameBuffer (int width, int height, bool bgra, bool fullscreen, DFrameBuffer *old)
|
||||||
{
|
{
|
||||||
static int retry = 0;
|
static int retry = 0;
|
||||||
static int owidth, oheight;
|
static int owidth, oheight;
|
||||||
|
@ -652,7 +659,8 @@ DFrameBuffer *Win32Video::CreateFrameBuffer (int width, int height, bool fullscr
|
||||||
BaseWinFB *fb = static_cast<BaseWinFB *> (old);
|
BaseWinFB *fb = static_cast<BaseWinFB *> (old);
|
||||||
if (fb->Width == width &&
|
if (fb->Width == width &&
|
||||||
fb->Height == height &&
|
fb->Height == height &&
|
||||||
fb->Windowed == !fullscreen)
|
fb->Windowed == !fullscreen &&
|
||||||
|
fb->Bgra == bgra)
|
||||||
{
|
{
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
@ -667,13 +675,9 @@ DFrameBuffer *Win32Video::CreateFrameBuffer (int width, int height, bool fullscr
|
||||||
flashAmount = 0;
|
flashAmount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_OBSOLETE_DDRAW
|
|
||||||
fb = new D3DFB(m_Adapter, width, height, fullscreen);
|
|
||||||
LOG1("New fb created @ %p\n", fb);
|
|
||||||
#else
|
|
||||||
if (D3D != NULL)
|
if (D3D != NULL)
|
||||||
{
|
{
|
||||||
fb = new D3DFB (m_Adapter, width, height, fullscreen);
|
fb = new D3DFB (m_Adapter, width, height, bgra, fullscreen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -738,10 +742,9 @@ DFrameBuffer *Win32Video::CreateFrameBuffer (int width, int height, bool fullscr
|
||||||
}
|
}
|
||||||
|
|
||||||
++retry;
|
++retry;
|
||||||
fb = static_cast<DDrawFB *>(CreateFrameBuffer (width, height, fullscreen, NULL));
|
fb = static_cast<DDrawFB *>(CreateFrameBuffer (width, height, bgra, fullscreen, NULL));
|
||||||
}
|
}
|
||||||
retry = 0;
|
retry = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
fb->SetFlash (flashColor, flashAmount);
|
fb->SetFlash (flashColor, flashAmount);
|
||||||
return fb;
|
return fb;
|
||||||
|
|
|
@ -661,7 +661,7 @@ OptionMenu "VideoOptions"
|
||||||
Option "$DSPLYMNU_VSYNC", "vid_vsync", "OnOff"
|
Option "$DSPLYMNU_VSYNC", "vid_vsync", "OnOff"
|
||||||
Option "$DSPLYMNU_CAPFPS", "cl_capfps", "OffOn"
|
Option "$DSPLYMNU_CAPFPS", "cl_capfps", "OffOn"
|
||||||
Option "$DSPLYMNU_COLUMNMETHOD", "r_columnmethod", "ColumnMethods"
|
Option "$DSPLYMNU_COLUMNMETHOD", "r_columnmethod", "ColumnMethods"
|
||||||
Option "$DSPLYMNU_TRUECOLOR", "r_swtruecolor", "OnOff"
|
Option "$DSPLYMNU_TRUECOLOR", "swtruecolor", "OnOff"
|
||||||
|
|
||||||
StaticText " "
|
StaticText " "
|
||||||
Option "$DSPLYMNU_WIPETYPE", "wipetype", "Wipes"
|
Option "$DSPLYMNU_WIPETYPE", "wipetype", "Wipes"
|
||||||
|
|
Loading…
Reference in a new issue