mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-17 01:31:25 +00:00
- implemented GetCaps() for OpenGL
- renamed RFF_FRAGMENTSHADER to RFF_MATSHADER - D_Display now calls Renderer->GetCaps() and stores it in a global variable for later use.
This commit is contained in:
parent
64deba45a3
commit
9a9fe7c133
6 changed files with 35 additions and 2 deletions
|
@ -527,7 +527,7 @@ enum ActorRenderFeatureFlag
|
|||
RFF_TILTPITCH = 1<<3, // full free-look
|
||||
RFF_ROLLSPRITES = 1<<4, // roll sprites
|
||||
RFF_UNCLIPPEDTEX = 1<<5, // midtex and sprite can render "into" flats and walls
|
||||
RFF_FRAGMENTSHADER = 1<<6, // fragment (material) shaders
|
||||
RFF_MATSHADER = 1<<6, // material shaders
|
||||
RFF_POSTSHADER = 1<<7, // post-process shaders (renderbuffers)
|
||||
RFF_BRIGHTMAP = 1<<8, // brightmaps
|
||||
RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife)
|
||||
|
|
|
@ -247,6 +247,9 @@ bool batchrun; // just run the startup and collect all error messages in a logfi
|
|||
|
||||
cycle_t FrameCycles;
|
||||
|
||||
// [SP] Store the capabilities of the renderer in a global variable, to prevent excessive per-frame processing
|
||||
uint32_t r_renderercaps = 0;
|
||||
|
||||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
|
@ -671,6 +674,7 @@ void D_Display ()
|
|||
cycles.Clock();
|
||||
|
||||
r_UseVanillaTransparency = UseVanillaTransparency(); // [SP] Cache UseVanillaTransparency() call
|
||||
r_renderercaps = Renderer->GetCaps(); // [SP] Get the current capabilities of the renderer
|
||||
|
||||
if (players[consoleplayer].camera == NULL)
|
||||
{
|
||||
|
|
|
@ -64,6 +64,9 @@ bool D_AddFile (TArray<FString> &wadfiles, const char *file, bool check = true,
|
|||
// [RH] Set this to something to draw an icon during the next screen refresh.
|
||||
extern const char *D_DrawIcon;
|
||||
|
||||
// [SP] Store the capabilities of the renderer in a global variable, to prevent excessive per-frame processing
|
||||
extern uint32_t r_renderercaps;
|
||||
|
||||
|
||||
struct WadStuff
|
||||
{
|
||||
|
|
|
@ -84,6 +84,7 @@ EXTERN_CVAR (Bool, cl_capfps)
|
|||
EXTERN_CVAR (Bool, r_deathcamera)
|
||||
EXTERN_CVAR (Float, underwater_fade_scalar)
|
||||
EXTERN_CVAR (Float, r_visibility)
|
||||
EXTERN_CVAR (Bool, gl_legacy_mode)
|
||||
|
||||
extern bool NoInterpolateView;
|
||||
|
||||
|
@ -993,6 +994,7 @@ struct FGLInterface : public FRenderer
|
|||
int GetMaxViewPitch(bool down) override;
|
||||
void SetClearColor(int color) override;
|
||||
void Init() override;
|
||||
uint32_t GetCaps() override;
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1160,6 +1162,29 @@ bool FGLInterface::RequireGLNodes()
|
|||
return true;
|
||||
}
|
||||
|
||||
uint32_t FGLInterface::GetCaps()
|
||||
{
|
||||
// describe our basic feature set
|
||||
ActorRenderFeatureFlags FlagSet = RFF_FLATSPRITES | RFF_MODELS | RFF_SLOPE3DFLOORS |
|
||||
RFF_TILTPITCH | RFF_ROLLSPRITES | RFF_POLYGONAL | RFF_VOXELS;
|
||||
if (gl_legacy_mode)
|
||||
{
|
||||
// legacy mode always has truecolor because palette tonemap is not available
|
||||
FlagSet |= RFF_TRUECOLOR;
|
||||
}
|
||||
else if (!(FGLRenderBuffers::IsEnabled()))
|
||||
{
|
||||
// truecolor is always available when renderbuffers are unavailable because palette tonemap is not possible
|
||||
FlagSet |= RFF_TRUECOLOR | RFF_MATSHADER;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gl_tonemap != 5) // not running palette tonemap shader
|
||||
FlagSet |= RFF_TRUECOLOR;
|
||||
FlagSet |= RFF_MATSHADER | RFF_POSTSHADER;
|
||||
}
|
||||
return (uint32_t)FlagSet;
|
||||
}
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -54,6 +54,7 @@ struct FRenderer
|
|||
virtual void CleanLevelData() {}
|
||||
virtual bool RequireGLNodes() { return false; }
|
||||
|
||||
virtual uint32_t GetCaps() { return 0; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1183,7 +1183,7 @@ enum ActorRenderFeatureFlag
|
|||
RFF_TILTPITCH = 1<<3, // full free-look
|
||||
RFF_ROLLSPRITES = 1<<4, // roll sprites
|
||||
RFF_UNCLIPPEDTEX = 1<<5, // midtex and sprite can render "into" flats and walls
|
||||
RFF_FRAGMENTSHADER = 1<<6, // fragment (material) shaders
|
||||
RFF_MATSHADER = 1<<6, // material shaders
|
||||
RFF_POSTSHADER = 1<<7, // post-process shaders (renderbuffers)
|
||||
RFF_BRIGHTMAP = 1<<8, // brightmaps
|
||||
RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife)
|
||||
|
|
Loading…
Reference in a new issue