2017-09-03 21:17:44 +00:00
|
|
|
/*
|
|
|
|
===========================================================================
|
|
|
|
|
|
|
|
Doom 3 BFG Edition GPL Source Code
|
|
|
|
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
|
|
|
Copyright (C) 2016-2017 Dustin Land
|
2023-03-10 17:03:20 +00:00
|
|
|
Copyright (C) 2017-2023 Robert Beckebans
|
2022-02-21 15:29:53 +00:00
|
|
|
Copyright (C) 2022 Stephen Pridham
|
2017-09-03 21:17:44 +00:00
|
|
|
|
|
|
|
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
|
|
|
|
|
|
|
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
|
|
|
|
|
|
|
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
|
|
|
|
|
|
|
===========================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __RENDERER_BACKEND_H__
|
|
|
|
#define __RENDERER_BACKEND_H__
|
|
|
|
|
2020-05-04 23:21:29 +00:00
|
|
|
#include "RenderLog.h"
|
2017-09-09 12:57:48 +00:00
|
|
|
|
2023-03-10 18:25:56 +00:00
|
|
|
#include "Passes/CommonPasses.h"
|
|
|
|
#include "Passes/MipMapGenPass.h"
|
|
|
|
#include "Passes/SsaoPass.h"
|
|
|
|
#include "Passes/TonemapPass.h"
|
|
|
|
#include "Passes/TemporalAntiAliasingPass.h"
|
|
|
|
|
|
|
|
#include "PipelineCache.h"
|
2022-02-21 15:29:53 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
struct tmu_t
|
|
|
|
{
|
|
|
|
unsigned int current2DMap;
|
|
|
|
unsigned int current2DArray;
|
|
|
|
unsigned int currentCubeMap;
|
|
|
|
};
|
|
|
|
|
2021-05-07 11:14:00 +00:00
|
|
|
const int MAX_MULTITEXTURE_UNITS = 14;
|
2017-09-03 21:17:44 +00:00
|
|
|
|
|
|
|
enum stencilFace_t
|
|
|
|
{
|
|
|
|
STENCIL_FACE_FRONT,
|
|
|
|
STENCIL_FACE_BACK,
|
|
|
|
STENCIL_FACE_NUM
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gfxImpParms_t
|
|
|
|
{
|
|
|
|
int x; // ignored in fullscreen
|
|
|
|
int y; // ignored in fullscreen
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int fullScreen; // 0 = windowed, otherwise 1 based monitor number to go full screen on
|
|
|
|
// -1 = borderless window for spanning multiple displays
|
|
|
|
int displayHz;
|
|
|
|
int multiSamples;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAX_DEBUG_LINES 16384
|
|
|
|
#define MAX_DEBUG_TEXT 512
|
|
|
|
#define MAX_DEBUG_POLYGONS 8192
|
|
|
|
|
|
|
|
struct debugLine_t
|
|
|
|
{
|
|
|
|
idVec4 rgb;
|
|
|
|
idVec3 start;
|
|
|
|
idVec3 end;
|
|
|
|
bool depthTest;
|
|
|
|
int lifeTime;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct debugText_t
|
|
|
|
{
|
|
|
|
idStr text;
|
|
|
|
idVec3 origin;
|
|
|
|
float scale;
|
|
|
|
idVec4 color;
|
|
|
|
idMat3 viewAxis;
|
|
|
|
int align;
|
|
|
|
int lifeTime;
|
|
|
|
bool depthTest;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct debugPolygon_t
|
|
|
|
{
|
|
|
|
idVec4 rgb;
|
|
|
|
idWinding winding;
|
|
|
|
bool depthTest;
|
|
|
|
int lifeTime;
|
|
|
|
};
|
|
|
|
|
|
|
|
void RB_SetMVP( const idRenderMatrix& mvp );
|
|
|
|
void RB_SetVertexColorParms( stageVertexColor_t svc );
|
|
|
|
|
|
|
|
/*
|
|
|
|
===========================================================================
|
|
|
|
|
|
|
|
idRenderBackend
|
|
|
|
|
|
|
|
all state modified by the back end is separated from the front end state
|
|
|
|
|
|
|
|
===========================================================================
|
|
|
|
*/
|
2019-10-28 19:06:10 +00:00
|
|
|
struct ImDrawData;
|
|
|
|
|
2022-02-21 15:29:53 +00:00
|
|
|
class IRenderPass;
|
|
|
|
class ForwardShadingPass;
|
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
class idRenderBackend
|
|
|
|
{
|
|
|
|
friend class Framebuffer;
|
2022-05-13 19:42:00 +00:00
|
|
|
friend class fhImmediateMode;
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
public:
|
|
|
|
idRenderBackend();
|
|
|
|
~idRenderBackend();
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void Init();
|
|
|
|
void Shutdown();
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void ExecuteBackEndCommands( const emptyCommand_t* cmds );
|
|
|
|
void StereoRenderExecuteBackEndCommands( const emptyCommand_t* const allCmds );
|
2018-10-06 15:21:49 +00:00
|
|
|
void GL_BlockingSwapBuffers();
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-10 11:32:44 +00:00
|
|
|
void CheckCVars();
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2022-03-22 10:16:44 +00:00
|
|
|
void ClearCaches();
|
2022-02-21 15:29:53 +00:00
|
|
|
|
2019-10-28 19:06:10 +00:00
|
|
|
static void ImGui_RenderDrawLists( ImDrawData* draw_data );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2023-03-18 13:44:59 +00:00
|
|
|
void DrawElementsWithCounters( const drawSurf_t* surf, bool shadowCounter = false );
|
2022-05-13 19:42:00 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
private:
|
|
|
|
void DrawFlickerBox();
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2022-06-27 17:54:20 +00:00
|
|
|
void GetCurrentBindingLayout( int bindingLayoutType );
|
2017-09-03 21:17:44 +00:00
|
|
|
void ResizeImages();
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void DrawViewInternal( const viewDef_t* viewDef, const int stereoEye );
|
|
|
|
void DrawView( const void* data, const int stereoEye );
|
|
|
|
void CopyRender( const void* data );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2022-02-21 15:29:53 +00:00
|
|
|
void BindVariableStageImage( const textureStage_t* texture, const float* shaderRegisters, nvrhi::ICommandList* commandList );
|
2017-09-03 21:17:44 +00:00
|
|
|
void PrepareStageTexturing( const shaderStage_t* pStage, const drawSurf_t* surf );
|
|
|
|
void FinishStageTexturing( const shaderStage_t* pStage, const drawSurf_t* surf );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void ResetViewportAndScissorToDefaultCamera( const viewDef_t* _viewDef );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void FillDepthBufferGeneric( const drawSurf_t* const* drawSurfs, int numDrawSurfs );
|
|
|
|
void FillDepthBufferFast( drawSurf_t** drawSurfs, int numDrawSurfs );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void T_BlendLight( const drawSurf_t* drawSurfs, const viewLight_t* vLight );
|
|
|
|
void BlendLight( const drawSurf_t* drawSurfs, const drawSurf_t* drawSurfs2, const viewLight_t* vLight );
|
|
|
|
void T_BasicFog( const drawSurf_t* drawSurfs, const idPlane fogPlanes[ 4 ], const idRenderMatrix* inverseBaseLightProject );
|
|
|
|
void FogPass( const drawSurf_t* drawSurfs, const drawSurf_t* drawSurfs2, const viewLight_t* vLight );
|
|
|
|
void FogAllLights();
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void SetupInteractionStage( const shaderStage_t* surfaceStage, const float* surfaceRegs, const float lightColor[4],
|
|
|
|
idVec4 matrix[2], float color[4] );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void DrawInteractions( const viewDef_t* _viewDef );
|
2020-04-16 16:08:50 +00:00
|
|
|
void DrawSingleInteraction( drawInteraction_t* din, bool useFastPath, bool useIBL, bool setInteractionShader );
|
2017-09-03 21:17:44 +00:00
|
|
|
int DrawShaderPasses( const drawSurf_t* const* const drawSurfs, const int numDrawSurfs,
|
|
|
|
const float guiStereoScreenOffset, const int stereoEye );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void RenderInteractions( const drawSurf_t* surfList, const viewLight_t* vLight, int depthFunc, bool performStencilTest, bool useLightDepthBounds );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
// RB
|
|
|
|
void AmbientPass( const drawSurf_t* const* drawSurfs, int numDrawSurfs, bool fillGbuffer );
|
2022-03-14 18:20:23 +00:00
|
|
|
|
2022-03-31 20:07:05 +00:00
|
|
|
void SetupShadowMapMatrices( viewLight_t* vLight, int side, idRenderMatrix& lightProjectionRenderMatrix, idRenderMatrix& lightViewRenderMatrix );
|
|
|
|
void ShadowMapPassFast( const drawSurf_t* drawSurfs, viewLight_t* vLight, int side, bool atlas );
|
|
|
|
void ShadowMapPassPerforated( const drawSurf_t** drawSurfs, int numDrawSurfs, viewLight_t* vLight, int side, const idRenderMatrix& lightProjectionRenderMatrix, const idRenderMatrix& lightViewRenderMatrix );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2022-03-30 09:22:58 +00:00
|
|
|
void ShadowAtlasPass( const viewDef_t* _viewDef );
|
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void StencilShadowPass( const drawSurf_t* drawSurfs, const viewLight_t* vLight );
|
|
|
|
void StencilSelectLight( const viewLight_t* vLight );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2022-04-13 10:35:00 +00:00
|
|
|
void DrawMotionVectors();
|
2022-04-12 16:15:48 +00:00
|
|
|
void TemporalAAPass( const viewDef_t* _viewDef );
|
|
|
|
|
2023-03-10 16:10:25 +00:00
|
|
|
// RB: outdated HDR stuff
|
2017-09-03 21:17:44 +00:00
|
|
|
void Bloom( const viewDef_t* viewDef );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2023-02-08 08:24:23 +00:00
|
|
|
void DrawScreenSpaceAmbientOcclusion( const viewDef_t* _viewDef );
|
|
|
|
void DrawScreenSpaceAmbientOcclusion2( const viewDef_t* _viewDef );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
// Experimental feature
|
|
|
|
void MotionBlur();
|
2023-12-28 13:39:59 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void PostProcess( const void* data );
|
2023-12-28 13:39:59 +00:00
|
|
|
void CRTPostProcess();
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
private:
|
|
|
|
void GL_StartFrame();
|
|
|
|
void GL_EndFrame();
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2018-10-13 12:42:30 +00:00
|
|
|
public:
|
2017-09-09 12:57:48 +00:00
|
|
|
uint64 GL_GetCurrentState() const;
|
2024-10-23 13:41:42 +00:00
|
|
|
idVec2 GetCurrentPixelOffset( int frameIndex ) const;
|
2022-04-12 16:15:48 +00:00
|
|
|
|
2022-05-13 19:42:00 +00:00
|
|
|
nvrhi::ICommandList* GL_GetCommandList() const
|
|
|
|
{
|
|
|
|
return commandList;
|
|
|
|
}
|
|
|
|
|
2018-10-13 12:42:30 +00:00
|
|
|
private:
|
2017-09-03 21:17:44 +00:00
|
|
|
uint64 GL_GetCurrentStateMinusStencil() const;
|
|
|
|
void GL_SetDefaultState();
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void GL_State( uint64 stateBits, bool forceGlState = false );
|
2019-11-08 17:12:37 +00:00
|
|
|
// void GL_SeparateStencil( stencilFace_t face, uint64 stencilBits );
|
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void GL_SelectTexture( int unit );
|
2017-09-10 11:32:44 +00:00
|
|
|
// void GL_BindTexture( idImage* image );
|
|
|
|
|
|
|
|
// void GL_CopyFrameBuffer( idImage* image, int x, int y, int imageWidth, int imageHeight );
|
|
|
|
// void GL_CopyDepthBuffer( idImage* image, int x, int y, int imageWidth, int imageHeight );
|
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
// RB: HDR parm
|
2024-11-26 20:18:42 +00:00
|
|
|
void GL_Clear( bool color, bool depth, bool stencil, byte stencilValue, float r, float g, float b, float a, bool clearHDR = false, bool clearVR = false, const int stereoEye = 0 );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void GL_DepthBoundsTest( const float zmin, const float zmax );
|
|
|
|
void GL_PolygonOffset( float scale, float bias );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void GL_Scissor( int x /* left*/, int y /* bottom */, int w, int h );
|
|
|
|
void GL_Viewport( int x /* left */, int y /* bottom */, int w, int h );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
ID_INLINE void GL_Scissor( const idScreenRect& rect )
|
|
|
|
{
|
|
|
|
GL_Scissor( rect.x1, rect.y1, rect.x2 - rect.x1 + 1, rect.y2 - rect.y1 + 1 );
|
|
|
|
}
|
|
|
|
ID_INLINE void GL_Viewport( const idScreenRect& rect )
|
|
|
|
{
|
|
|
|
GL_Viewport( rect.x1, rect.y1, rect.x2 - rect.x1 + 1, rect.y2 - rect.y1 + 1 );
|
|
|
|
}
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-09 12:57:48 +00:00
|
|
|
ID_INLINE void GL_ViewportAndScissor( int x, int y, int w, int h )
|
|
|
|
{
|
|
|
|
GL_Viewport( x, y, w, h );
|
|
|
|
GL_Scissor( x, y, w, h );
|
|
|
|
}
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-09 12:57:48 +00:00
|
|
|
ID_INLINE void GL_ViewportAndScissor( const idScreenRect& rect )
|
|
|
|
{
|
|
|
|
GL_Viewport( rect );
|
|
|
|
GL_Scissor( rect );
|
|
|
|
}
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void GL_Color( float r, float g, float b, float a );
|
|
|
|
ID_INLINE void GL_Color( float r, float g, float b )
|
|
|
|
{
|
|
|
|
GL_Color( r, g, b, 1.0f );
|
|
|
|
}
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-09 12:57:48 +00:00
|
|
|
ID_INLINE void GL_Color( const idVec3& color )
|
2017-09-03 21:17:44 +00:00
|
|
|
{
|
|
|
|
GL_Color( color[0], color[1], color[2], 1.0f );
|
|
|
|
}
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-09 12:57:48 +00:00
|
|
|
ID_INLINE void GL_Color( const idVec4& color )
|
2017-09-03 21:17:44 +00:00
|
|
|
{
|
|
|
|
GL_Color( color[0], color[1], color[2], color[3] );
|
|
|
|
}
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-09 12:57:48 +00:00
|
|
|
// void GL_Color( float* color );
|
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
void SetBuffer( const void* data );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
private:
|
|
|
|
void DBG_SimpleSurfaceSetup( const drawSurf_t* drawSurf );
|
|
|
|
void DBG_SimpleWorldSetup();
|
2017-09-09 12:57:48 +00:00
|
|
|
void DBG_PolygonClear();
|
2017-09-03 21:17:44 +00:00
|
|
|
void DBG_ShowDestinationAlpha();
|
2017-09-09 12:57:48 +00:00
|
|
|
void DBG_ScanStencilBuffer();
|
|
|
|
void DBG_CountStencilBuffer();
|
2017-09-03 21:17:44 +00:00
|
|
|
void DBG_ColorByStencilBuffer();
|
|
|
|
void DBG_ShowOverdraw();
|
|
|
|
void DBG_ShowIntensity();
|
|
|
|
void DBG_ShowDepthBuffer();
|
|
|
|
void DBG_ShowLightCount();
|
2017-09-09 12:57:48 +00:00
|
|
|
// void DBG_EnterWeaponDepthHack();
|
|
|
|
// void DBG_EnterModelDepthHack( float depth );
|
|
|
|
// void DBG_LeaveDepthHack();
|
2017-09-03 21:17:44 +00:00
|
|
|
void DBG_RenderDrawSurfListWithFunction( drawSurf_t** drawSurfs, int numDrawSurfs );
|
|
|
|
void DBG_ShowSilhouette();
|
|
|
|
void DBG_ShowTris( drawSurf_t** drawSurfs, int numDrawSurfs );
|
|
|
|
void DBG_ShowSurfaceInfo( drawSurf_t** drawSurfs, int numDrawSurfs );
|
|
|
|
void DBG_ShowViewEntitys( viewEntity_t* vModels );
|
|
|
|
void DBG_ShowTexturePolarity( drawSurf_t** drawSurfs, int numDrawSurfs );
|
|
|
|
void DBG_ShowUnsmoothedTangents( drawSurf_t** drawSurfs, int numDrawSurfs );
|
|
|
|
void DBG_ShowTangentSpace( drawSurf_t** drawSurfs, int numDrawSurfs );
|
|
|
|
void DBG_ShowVertexColor( drawSurf_t** drawSurfs, int numDrawSurfs );
|
|
|
|
void DBG_ShowNormals( drawSurf_t** drawSurfs, int numDrawSurfs );
|
|
|
|
void DBG_ShowTextureVectors( drawSurf_t** drawSurfs, int numDrawSurfs );
|
|
|
|
void DBG_ShowDominantTris( drawSurf_t** drawSurfs, int numDrawSurfs );
|
|
|
|
void DBG_ShowEdges( drawSurf_t** drawSurfs, int numDrawSurfs );
|
|
|
|
void DBG_ShowLights();
|
2021-04-13 13:50:46 +00:00
|
|
|
void DBG_ShowLightGrid(); // RB
|
2020-05-17 11:29:18 +00:00
|
|
|
void DBG_ShowViewEnvprobes(); // RB
|
2017-09-09 12:57:48 +00:00
|
|
|
void DBG_ShowShadowMapLODs(); // RB
|
2017-09-03 21:17:44 +00:00
|
|
|
void DBG_ShowPortals();
|
|
|
|
void DBG_ShowDebugText();
|
|
|
|
void DBG_ShowDebugLines();
|
|
|
|
void DBG_ShowDebugPolygons();
|
|
|
|
void DBG_ShowCenterOfProjection();
|
2017-09-09 12:57:48 +00:00
|
|
|
void DBG_ShowLines();
|
2017-09-03 21:17:44 +00:00
|
|
|
void DBG_TestGamma();
|
|
|
|
void DBG_TestGammaBias();
|
|
|
|
void DBG_TestImage();
|
2017-09-09 12:57:48 +00:00
|
|
|
void DBG_ShowShadowMaps(); // RB
|
2017-09-03 21:17:44 +00:00
|
|
|
void DBG_ShowTrace( drawSurf_t** drawSurfs, int numDrawSurfs );
|
|
|
|
void DBG_RenderDebugTools( drawSurf_t** drawSurfs, int numDrawSurfs );
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
public:
|
|
|
|
backEndCounters_t pc;
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
// surfaces used for code-based drawing
|
|
|
|
drawSurf_t unitSquareSurface;
|
|
|
|
drawSurf_t zeroOneCubeSurface;
|
2020-05-20 16:24:45 +00:00
|
|
|
drawSurf_t zeroOneSphereSurface; // RB
|
2017-09-03 21:17:44 +00:00
|
|
|
drawSurf_t testImageSurface;
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2022-03-09 19:40:15 +00:00
|
|
|
float slopeScaleBias;
|
|
|
|
float depthBias;
|
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
private:
|
|
|
|
uint64 glStateBits;
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
const viewDef_t* viewDef;
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
const viewEntity_t* currentSpace; // for detecting when a matrix must change
|
|
|
|
idScreenRect currentScissor; // for scissor clipping, local inside renderView viewport
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
bool currentRenderCopied; // true if any material has already referenced _currentRender
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
idRenderMatrix prevMVP[2]; // world MVP from previous frame for motion blur
|
2022-04-12 16:15:48 +00:00
|
|
|
bool prevViewsValid;
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
// RB begin
|
2022-03-23 19:22:05 +00:00
|
|
|
// TODO remove
|
2017-09-03 21:17:44 +00:00
|
|
|
float hdrAverageLuminance;
|
|
|
|
float hdrMaxLuminance;
|
|
|
|
float hdrTime;
|
|
|
|
float hdrKey;
|
2022-04-01 15:10:53 +00:00
|
|
|
|
|
|
|
// quad-tree for managing tiles within tiled shadow map
|
|
|
|
TileMap tileMap;
|
2019-11-11 19:27:44 +00:00
|
|
|
|
2017-09-03 21:17:44 +00:00
|
|
|
private:
|
2022-04-01 17:19:25 +00:00
|
|
|
idScreenRect stateViewport;
|
|
|
|
idScreenRect stateScissor;
|
|
|
|
|
2022-02-21 15:29:53 +00:00
|
|
|
idScreenRect currentViewport;
|
|
|
|
nvrhi::BufferHandle currentVertexBuffer;
|
2022-03-14 09:00:30 +00:00
|
|
|
uint currentVertexOffset;
|
2022-02-21 15:29:53 +00:00
|
|
|
nvrhi::BufferHandle currentIndexBuffer;
|
2022-03-14 09:00:30 +00:00
|
|
|
uint currentIndexOffset;
|
2022-02-21 15:29:53 +00:00
|
|
|
nvrhi::BindingLayoutHandle currentBindingLayout;
|
2022-06-27 17:54:20 +00:00
|
|
|
nvrhi::IBuffer* currentJointBuffer;
|
|
|
|
uint currentJointOffset;
|
2022-02-21 15:29:53 +00:00
|
|
|
nvrhi::GraphicsPipelineHandle currentPipeline;
|
2022-03-22 10:16:44 +00:00
|
|
|
|
|
|
|
idStaticList<nvrhi::BindingSetHandle, nvrhi::c_MaxBindingLayouts> currentBindingSets;
|
|
|
|
idStaticList<idStaticList<nvrhi::BindingSetDesc, nvrhi::c_MaxBindingLayouts>, NUM_BINDING_LAYOUTS> pendingBindingSetDescs;
|
2022-02-21 15:29:53 +00:00
|
|
|
|
|
|
|
Framebuffer* currentFrameBuffer;
|
2022-03-09 19:40:15 +00:00
|
|
|
Framebuffer* lastFrameBuffer;
|
2022-02-21 15:29:53 +00:00
|
|
|
nvrhi::CommandListHandle commandList;
|
2023-10-17 23:11:42 +00:00
|
|
|
CommonRenderPasses commonPasses;
|
2022-02-21 15:29:53 +00:00
|
|
|
SsaoPass* ssaoPass;
|
|
|
|
MipMapGenPass* hiZGenPass;
|
2022-03-22 10:16:44 +00:00
|
|
|
TonemapPass* toneMapPass;
|
2022-04-12 16:15:48 +00:00
|
|
|
TemporalAntiAliasingPass* taaPass;
|
2022-02-21 15:29:53 +00:00
|
|
|
|
|
|
|
BindingCache bindingCache;
|
|
|
|
SamplerCache samplerCache;
|
|
|
|
PipelineCache pipelineCache;
|
|
|
|
|
|
|
|
nvrhi::InputLayoutHandle inputLayout;
|
|
|
|
|
|
|
|
nvrhi::ShaderHandle vertexShader;
|
|
|
|
nvrhi::ShaderHandle pixelShader;
|
|
|
|
|
2022-11-18 21:39:22 +00:00
|
|
|
int prevBindingLayoutType;
|
|
|
|
|
2022-02-21 15:29:53 +00:00
|
|
|
public:
|
|
|
|
|
2022-03-09 19:40:15 +00:00
|
|
|
void ResetPipelineCache();
|
2022-02-21 15:29:53 +00:00
|
|
|
|
|
|
|
void SetCurrentImage( idImage* image );
|
|
|
|
idImage* GetCurrentImage();
|
|
|
|
idImage* GetImageAt( int index );
|
2022-03-09 19:40:15 +00:00
|
|
|
CommonRenderPasses& GetCommonPasses()
|
|
|
|
{
|
|
|
|
return commonPasses;
|
|
|
|
}
|
2017-09-03 21:17:44 +00:00
|
|
|
};
|
|
|
|
|
2019-10-04 09:56:37 +00:00
|
|
|
#endif
|