mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- did a bit of cleanup on DFrameBuffer, most notably taking GetCaps out of it.
With the old softpoly renderer and OpenGL 2.x being gone there is no more need for such complex handling, it is now a single function in d_main.cpp.
This commit is contained in:
parent
3ee1aa76c3
commit
5f3e4a5d0e
12 changed files with 45 additions and 102 deletions
|
@ -802,6 +802,36 @@ CVAR (Flag, compat_railing, compatflags2, COMPATF2_RAILING);
|
||||||
|
|
||||||
CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
|
EXTERN_CVAR(Bool, r_drawvoxels)
|
||||||
|
EXTERN_CVAR(Int, gl_tonemap)
|
||||||
|
static uint32_t GetCaps()
|
||||||
|
{
|
||||||
|
ActorRenderFeatureFlags FlagSet;
|
||||||
|
if (!V_IsHardwareRenderer())
|
||||||
|
{
|
||||||
|
FlagSet = RFF_UNCLIPPEDTEX;
|
||||||
|
|
||||||
|
if (V_IsTrueColor())
|
||||||
|
FlagSet |= RFF_TRUECOLOR;
|
||||||
|
else
|
||||||
|
FlagSet |= RFF_COLORMAP;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// describe our basic feature set
|
||||||
|
FlagSet = RFF_FLATSPRITES | RFF_MODELS | RFF_SLOPE3DFLOORS |
|
||||||
|
RFF_TILTPITCH | RFF_ROLLSPRITES | RFF_POLYGONAL | RFF_MATSHADER | RFF_POSTSHADER | RFF_BRIGHTMAP;
|
||||||
|
|
||||||
|
if (gl_tonemap != 5) // not running palette tonemap shader
|
||||||
|
FlagSet |= RFF_TRUECOLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_drawvoxels)
|
||||||
|
FlagSet |= RFF_VOXELS;
|
||||||
|
return (uint32_t)FlagSet;
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// D_Display
|
// D_Display
|
||||||
|
@ -830,7 +860,7 @@ void D_Display ()
|
||||||
cycles.Clock();
|
cycles.Clock();
|
||||||
|
|
||||||
r_UseVanillaTransparency = UseVanillaTransparency(); // [SP] Cache UseVanillaTransparency() call
|
r_UseVanillaTransparency = UseVanillaTransparency(); // [SP] Cache UseVanillaTransparency() call
|
||||||
r_renderercaps = screen->GetCaps(); // [SP] Get the current capabilities of the renderer
|
r_renderercaps = GetCaps(); // [SP] Get the current capabilities of the renderer
|
||||||
|
|
||||||
if (players[consoleplayer].camera == NULL)
|
if (players[consoleplayer].camera == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,7 +63,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetRavenDefaults (bool isHexen);
|
void SetRavenDefaults (bool isHexen);
|
||||||
void ReadCVars (uint32_t flags);
|
void ReadCVars (unsigned flags);
|
||||||
|
|
||||||
bool bModSetup;
|
bool bModSetup;
|
||||||
|
|
||||||
|
|
|
@ -241,23 +241,6 @@ void OpenGLFrameBuffer::RenderTextureView(FCanvasTexture* tex, std::function<voi
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
uint32_t OpenGLFrameBuffer::GetCaps()
|
|
||||||
{
|
|
||||||
if (!V_IsHardwareRenderer())
|
|
||||||
return Super::GetCaps();
|
|
||||||
|
|
||||||
// describe our basic feature set
|
|
||||||
ActorRenderFeatureFlags FlagSet = RFF_FLATSPRITES | RFF_MODELS | RFF_SLOPE3DFLOORS |
|
|
||||||
RFF_TILTPITCH | RFF_ROLLSPRITES | RFF_POLYGONAL | RFF_MATSHADER | RFF_POSTSHADER | RFF_BRIGHTMAP;
|
|
||||||
if (r_drawvoxels)
|
|
||||||
FlagSet |= RFF_VOXELS;
|
|
||||||
|
|
||||||
if (gl_tonemap != 5) // not running palette tonemap shader
|
|
||||||
FlagSet |= RFF_TRUECOLOR;
|
|
||||||
|
|
||||||
return (uint32_t)FlagSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* OpenGLFrameBuffer::DeviceName() const
|
const char* OpenGLFrameBuffer::DeviceName() const
|
||||||
{
|
{
|
||||||
return gl.modelstring;
|
return gl.modelstring;
|
||||||
|
|
|
@ -39,7 +39,6 @@ public:
|
||||||
|
|
||||||
FRenderState* RenderState() override;
|
FRenderState* RenderState() override;
|
||||||
void UpdatePalette() override;
|
void UpdatePalette() override;
|
||||||
uint32_t GetCaps() override;
|
|
||||||
const char* DeviceName() const override;
|
const char* DeviceName() const override;
|
||||||
void SetTextureFilterMode() override;
|
void SetTextureFilterMode() override;
|
||||||
IHardwareTexture *CreateHardwareTexture() override;
|
IHardwareTexture *CreateHardwareTexture() override;
|
||||||
|
|
|
@ -287,22 +287,6 @@ void PolyFrameBuffer::PostProcessScene(bool swscene, int fixedcm, const std::fun
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t PolyFrameBuffer::GetCaps()
|
|
||||||
{
|
|
||||||
if (!V_IsHardwareRenderer())
|
|
||||||
return Super::GetCaps();
|
|
||||||
|
|
||||||
// describe our basic feature set
|
|
||||||
ActorRenderFeatureFlags FlagSet = RFF_FLATSPRITES | RFF_MODELS | RFF_SLOPE3DFLOORS |
|
|
||||||
RFF_TILTPITCH | RFF_ROLLSPRITES | RFF_POLYGONAL | RFF_MATSHADER | RFF_POSTSHADER | RFF_BRIGHTMAP;
|
|
||||||
if (r_drawvoxels)
|
|
||||||
FlagSet |= RFF_VOXELS;
|
|
||||||
|
|
||||||
if (gl_tonemap != 5) // not running palette tonemap shader
|
|
||||||
FlagSet |= RFF_TRUECOLOR;
|
|
||||||
|
|
||||||
return (uint32_t)FlagSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PolyFrameBuffer::SetVSync(bool vsync)
|
void PolyFrameBuffer::SetVSync(bool vsync)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,6 @@ public:
|
||||||
FRenderState* RenderState() override;
|
FRenderState* RenderState() override;
|
||||||
void PrecacheMaterial(FMaterial *mat, int translation) override;
|
void PrecacheMaterial(FMaterial *mat, int translation) override;
|
||||||
void UpdatePalette() override;
|
void UpdatePalette() override;
|
||||||
uint32_t GetCaps() override;
|
|
||||||
void SetTextureFilterMode() override;
|
void SetTextureFilterMode() override;
|
||||||
void TextureFilterChanged() override;
|
void TextureFilterChanged() override;
|
||||||
void BeginFrame() override;
|
void BeginFrame() override;
|
||||||
|
|
|
@ -196,7 +196,7 @@ namespace swrenderer
|
||||||
|
|
||||||
void R_UpdateFuzzPosFrameStart()
|
void R_UpdateFuzzPosFrameStart()
|
||||||
{
|
{
|
||||||
if (r_fuzzscale || V_IsPolyRenderer())
|
if (r_fuzzscale)
|
||||||
{
|
{
|
||||||
static int next_random = 0;
|
static int next_random = 0;
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ namespace swrenderer
|
||||||
|
|
||||||
void R_UpdateFuzzPos(const SpriteDrawerArgs &args)
|
void R_UpdateFuzzPos(const SpriteDrawerArgs &args)
|
||||||
{
|
{
|
||||||
if (!r_fuzzscale && !V_IsPolyRenderer())
|
if (!r_fuzzscale)
|
||||||
{
|
{
|
||||||
int yl = MAX(args.FuzzY1(), 1);
|
int yl = MAX(args.FuzzY1(), 1);
|
||||||
int yh = MIN(args.FuzzY2(), fuzzviewheight);
|
int yh = MIN(args.FuzzY2(), fuzzviewheight);
|
||||||
|
|
|
@ -284,35 +284,6 @@ FTexture *DFrameBuffer::WipeEndScreen()
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// DFrameBuffer :: GetCaps
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_drawvoxels)
|
|
||||||
|
|
||||||
uint32_t DFrameBuffer::GetCaps()
|
|
||||||
{
|
|
||||||
ActorRenderFeatureFlags FlagSet = 0;
|
|
||||||
|
|
||||||
if (V_IsPolyRenderer())
|
|
||||||
FlagSet |= RFF_POLYGONAL | RFF_TILTPITCH | RFF_SLOPE3DFLOORS;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FlagSet |= RFF_UNCLIPPEDTEX;
|
|
||||||
if (r_drawvoxels)
|
|
||||||
FlagSet |= RFF_VOXELS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (V_IsTrueColor())
|
|
||||||
FlagSet |= RFF_TRUECOLOR;
|
|
||||||
else
|
|
||||||
FlagSet |= RFF_COLORMAP;
|
|
||||||
|
|
||||||
return (uint32_t)FlagSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// Calculates the viewport values needed for 2D and 3D operations
|
// Calculates the viewport values needed for 2D and 3D operations
|
||||||
|
@ -455,15 +426,6 @@ FMaterial* DFrameBuffer::CreateMaterial(FGameTexture* tex, int scaleflags)
|
||||||
return new FMaterial(tex, scaleflags);
|
return new FMaterial(tex, scaleflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(_Screen, GetViewWindow)
|
|
||||||
{
|
|
||||||
PARAM_PROLOGUE;
|
|
||||||
if (numret > 0) ret[0].SetInt(viewwindowx);
|
|
||||||
if (numret > 1) ret[1].SetInt(viewwindowy);
|
|
||||||
if (numret > 2) ret[2].SetInt(viewwidth);
|
|
||||||
if (numret > 3) ret[3].SetInt(viewheight);
|
|
||||||
return MIN(numret, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
|
|
@ -102,14 +102,9 @@ inline bool V_IsSoftwareRenderer()
|
||||||
return vid_rendermode < 2;
|
return vid_rendermode < 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool V_IsPolyRenderer()
|
|
||||||
{
|
|
||||||
return vid_rendermode == 2 || vid_rendermode == 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool V_IsTrueColor()
|
inline bool V_IsTrueColor()
|
||||||
{
|
{
|
||||||
return vid_rendermode == 1 || vid_rendermode == 3 || vid_rendermode == 4;
|
return vid_rendermode == 1 || vid_rendermode == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -270,7 +265,6 @@ public:
|
||||||
|
|
||||||
// Report a game restart
|
// Report a game restart
|
||||||
void SetClearColor(int color);
|
void SetClearColor(int color);
|
||||||
virtual uint32_t GetCaps();
|
|
||||||
virtual int Backend() { return 0; }
|
virtual int Backend() { return 0; }
|
||||||
virtual const char* DeviceName() const { return "Unknown"; }
|
virtual const char* DeviceName() const { return "Unknown"; }
|
||||||
virtual void AmbientOccludeScene(float m5) {}
|
virtual void AmbientOccludeScene(float m5) {}
|
||||||
|
|
|
@ -356,23 +356,6 @@ void VulkanFrameBuffer::PostProcessScene(bool swscene, int fixedcm, const std::f
|
||||||
mPostprocess->PostProcessScene(fixedcm, afterBloomDrawEndScene2D);
|
mPostprocess->PostProcessScene(fixedcm, afterBloomDrawEndScene2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t VulkanFrameBuffer::GetCaps()
|
|
||||||
{
|
|
||||||
if (!V_IsHardwareRenderer())
|
|
||||||
return Super::GetCaps();
|
|
||||||
|
|
||||||
// describe our basic feature set
|
|
||||||
ActorRenderFeatureFlags FlagSet = RFF_FLATSPRITES | RFF_MODELS | RFF_SLOPE3DFLOORS |
|
|
||||||
RFF_TILTPITCH | RFF_ROLLSPRITES | RFF_POLYGONAL | RFF_MATSHADER | RFF_POSTSHADER | RFF_BRIGHTMAP;
|
|
||||||
if (r_drawvoxels)
|
|
||||||
FlagSet |= RFF_VOXELS;
|
|
||||||
|
|
||||||
if (gl_tonemap != 5) // not running palette tonemap shader
|
|
||||||
FlagSet |= RFF_TRUECOLOR;
|
|
||||||
|
|
||||||
return (uint32_t)FlagSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* VulkanFrameBuffer::DeviceName() const
|
const char* VulkanFrameBuffer::DeviceName() const
|
||||||
{
|
{
|
||||||
const auto &props = device->PhysicalDevice.Properties;
|
const auto &props = device->PhysicalDevice.Properties;
|
||||||
|
|
|
@ -74,7 +74,6 @@ public:
|
||||||
|
|
||||||
void PrecacheMaterial(FMaterial *mat, int translation) override;
|
void PrecacheMaterial(FMaterial *mat, int translation) override;
|
||||||
void UpdatePalette() override;
|
void UpdatePalette() override;
|
||||||
uint32_t GetCaps() override;
|
|
||||||
const char* DeviceName() const override;
|
const char* DeviceName() const override;
|
||||||
int Backend() override { return 1; }
|
int Backend() override { return 1; }
|
||||||
void SetTextureFilterMode() override;
|
void SetTextureFilterMode() override;
|
||||||
|
|
|
@ -3300,6 +3300,16 @@ DEFINE_ACTION_FUNCTION(DObject, S_ChangeMusic)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(_Screen, GetViewWindow)
|
||||||
|
{
|
||||||
|
PARAM_PROLOGUE;
|
||||||
|
if (numret > 0) ret[0].SetInt(viewwindowx);
|
||||||
|
if (numret > 1) ret[1].SetInt(viewwindowy);
|
||||||
|
if (numret > 2) ret[2].SetInt(viewwidth);
|
||||||
|
if (numret > 3) ret[3].SetInt(viewheight);
|
||||||
|
return MIN(numret, 4);
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue