Cleanup of RenderSystem.h

This commit is contained in:
Robert Beckebans 2023-03-10 18:39:53 +01:00
parent cf9f430d1c
commit f8faac469a
13 changed files with 24 additions and 108 deletions

View file

@ -424,7 +424,7 @@ void idRenderModelOverlay::CreateOverlay( const idRenderModel* model, const idPl
} }
// RB: added check wether GPU skinning is available at all // RB: added check wether GPU skinning is available at all
if( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() && glConfig.gpuSkinningAvailable ) if( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() )
{ {
R_OverlayPointCullSkinned( cullBits.Ptr(), texCoordS.Ptr(), texCoordT.Ptr(), localTextureAxis, tri->verts, tri->numVerts, tri->staticModelWithJoints->jointsInverted ); R_OverlayPointCullSkinned( cullBits.Ptr(), texCoordS.Ptr(), texCoordT.Ptr(), localTextureAxis, tri->verts, tri->numVerts, tri->staticModelWithJoints->jointsInverted );
} }

View file

@ -1688,7 +1688,7 @@ void idRenderModelGLTF::UpdateSurface( const struct renderEntity_s* ent, const i
idList<int> jointIds; idList<int> jointIds;
if( r_useGPUSkinning.GetBool() && glConfig.gpuSkinningAvailable ) if( r_useGPUSkinning.GetBool() )
{ {
if( tri->verts != NULL && tri->verts != verts ) if( tri->verts != NULL && tri->verts != verts )
{ {

View file

@ -530,7 +530,7 @@ void idMD5Mesh::UpdateSurface( const struct renderEntity_s* ent, const idJointMa
tri->numVerts = deformInfo->numOutputVerts; tri->numVerts = deformInfo->numOutputVerts;
// RB: added check wether GPU skinning is available at all // RB: added check wether GPU skinning is available at all
if( r_useGPUSkinning.GetBool() && glConfig.gpuSkinningAvailable ) if( r_useGPUSkinning.GetBool() )
{ {
if( tri->verts != NULL && tri->verts != deformInfo->verts ) if( tri->verts != NULL && tri->verts != deformInfo->verts )
{ {

View file

@ -2191,7 +2191,6 @@ idRenderBackend::idRenderBackend()
memset( &glConfig, 0, sizeof( glConfig ) ); memset( &glConfig, 0, sizeof( glConfig ) );
glConfig.gpuSkinningAvailable = true;
glConfig.uniformBufferOffsetAlignment = 256; glConfig.uniformBufferOffsetAlignment = 256;
glConfig.timerQueryAvailable = true; glConfig.timerQueryAvailable = true;
} }

View file

@ -585,11 +585,11 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
builtinShaders[builtins[i].index] = i; builtinShaders[builtins[i].index] = i;
if( builtins[i].requireGPUSkinningSupport && !glConfig.gpuSkinningAvailable ) //if( builtins[i].requireGPUSkinningSupport && !glConfig.gpuSkinningAvailable )
{ //{
// RB: don't try to load shaders that would break the GLSL compiler in the OpenGL driver // RB: don't try to load shaders that would break the GLSL compiler in the OpenGL driver
continue; // continue;
} //}
int vIndex = -1; int vIndex = -1;
if( builtins[i].stages & SHADER_STAGE_VERTEX ) if( builtins[i].stages & SHADER_STAGE_VERTEX )
@ -628,7 +628,6 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
uniforms.SetNum( RENDERPARM_TOTAL, vec4_zero ); uniforms.SetNum( RENDERPARM_TOTAL, vec4_zero );
if( glConfig.gpuSkinningAvailable )
{ {
renderProgs[builtinShaders[BUILTIN_TEXTURE_VERTEXCOLOR_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_TEXTURE_VERTEXCOLOR_SKINNED]].usesJoints = true;
renderProgs[builtinShaders[BUILTIN_INTERACTION_SKINNED]].usesJoints = true; renderProgs[builtinShaders[BUILTIN_INTERACTION_SKINNED]].usesJoints = true;

View file

@ -1073,6 +1073,8 @@ void idRenderSystemLocal::CaptureRenderToFile( const char* fileName, bool fixAlp
RenderCommandBuffers( frameData->cmdHead ); RenderCommandBuffers( frameData->cmdHead );
// TODO implement for NVRHI
#if !defined( USE_VULKAN ) && !defined( USE_NVRHI ) #if !defined( USE_VULKAN ) && !defined( USE_NVRHI )
glReadBuffer( GL_BACK ); glReadBuffer( GL_BACK );

View file

@ -3,7 +3,7 @@
Doom 3 BFG Edition GPL Source Code Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2013-2016 Robert Beckebans Copyright (C) 2013-2023 Robert Beckebans
Copyright (C) 2014-2016 Kot in Action Creative Artel Copyright (C) 2014-2016 Kot in Action Creative Artel
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -78,7 +78,6 @@ enum stereoDepthType_t
STEREO_DEPTH_TYPE_FAR STEREO_DEPTH_TYPE_FAR
}; };
enum graphicsVendor_t enum graphicsVendor_t
{ {
VENDOR_NVIDIA, VENDOR_NVIDIA,
@ -87,23 +86,6 @@ enum graphicsVendor_t
VENDOR_APPLE // SRS - Added support for Apple GPUs VENDOR_APPLE // SRS - Added support for Apple GPUs
}; };
// RB: similar to Q3A - allow separate codepaths between OpenGL 3.x, OpenGL ES versions
enum graphicsDriverType_t
{
GLDRV_OPENGL3X, // best for development with legacy OpenGL tools
GLDRV_OPENGL32_COMPATIBILITY_PROFILE,
GLDRV_OPENGL32_CORE_PROFILE, // best for shipping to PC
GLDRV_OPENGL_ES2,
GLDRV_OPENGL_ES3,
GLDRV_OPENGL_MESA, // fear this, it is probably the best to disable GPU skinning and run shaders in GLSL ES 1.0
GLDRV_OPENGL_MESA_CORE_PROFILE,
GLDRV_VULKAN,
GLDRV_NVRHI_DX12,
GLDRV_NVRHI_VULKAN,
};
#define ID_MSAA 0 #define ID_MSAA 0
enum antiAliasingMode_t enum antiAliasingMode_t
@ -184,19 +166,12 @@ struct glconfig_t
{ {
graphicsVendor_t vendor; graphicsVendor_t vendor;
const char* renderer_string; // int maxTextureSize; // TODO
const char* vendor_string; // int maxTextureCoords; // TODO
const char* version_string; // int maxTextureImageUnits; // TODO
const char* extensions_string;
int maxTextureSize; // queried from GL
int maxTextureCoords;
int maxTextureImageUnits;
int uniformBufferOffsetAlignment; int uniformBufferOffsetAlignment;
float maxTextureAnisotropy;
bool timerQueryAvailable; bool timerQueryAvailable;
bool gpuSkinningAvailable;
stereo3DMode_t stereo3Dmode; stereo3DMode_t stereo3Dmode;
int nativeScreenWidth; // this is the native screen width resolution of the renderer int nativeScreenWidth; // this is the native screen width resolution of the renderer
@ -215,56 +190,6 @@ struct glconfig_t
float physicalScreenWidthInCentimeters; float physicalScreenWidthInCentimeters;
float pixelAspect; float pixelAspect;
#if !defined(USE_NVRHI)
graphicsDriverType_t driverType;
const char* wgl_extensions_string;
const char* shading_language_string;
float glVersion; // atof( version_string )
int colorBits;
int depthBits;
int stencilBits;
bool multitextureAvailable;
bool directStateAccess;
bool textureCompressionAvailable;
bool anisotropicFilterAvailable;
bool textureLODBiasAvailable;
bool seamlessCubeMapAvailable;
bool vertexBufferObjectAvailable;
bool mapBufferRangeAvailable;
bool vertexArrayObjectAvailable;
bool drawElementsBaseVertexAvailable;
bool fragmentProgramAvailable;
bool glslAvailable;
bool uniformBufferAvailable;
bool twoSidedStencilAvailable;
bool depthBoundsTestAvailable;
bool syncAvailable;
bool occlusionQueryAvailable;
bool debugOutputAvailable;
bool swapControlTearAvailable;
bool gremedyStringMarkerAvailable;
bool khronosDebugAvailable;
bool vertexHalfFloatAvailable;
bool framebufferObjectAvailable;
int maxRenderbufferSize;
int maxColorAttachments;
// bool framebufferPackedDepthStencilAvailable;
bool framebufferBlitAvailable;
#if !defined(USE_VULKAN)
GLuint global_vao;
#endif
#endif
}; };

View file

@ -1610,15 +1610,6 @@ void GfxInfo_f( const idCmdArgs& args )
renderSystem->GetPhysicalScreenWidthInCentimeters(), renderSystem->GetPhysicalScreenWidthInCentimeters() / 2.54f renderSystem->GetPhysicalScreenWidthInCentimeters(), renderSystem->GetPhysicalScreenWidthInCentimeters() / 2.54f
* sqrt( ( float )( 16 * 16 + 9 * 9 ) ) / 16.0f ); * sqrt( ( float )( 16 * 16 + 9 * 9 ) ) / 16.0f );
} }
if( glConfig.gpuSkinningAvailable )
{
common->Printf( S_COLOR_GREEN "GPU skeletal animation available\n" );
}
else
{
common->Printf( S_COLOR_RED "GPU skeletal animation not available (slower CPU path active)\n" );
}
} }
/* /*

View file

@ -335,7 +335,7 @@ R_SetupDrawSurfJoints
void R_SetupDrawSurfJoints( drawSurf_t* drawSurf, const srfTriangles_t* tri, const idMaterial* shader, nvrhi::ICommandList* commandList ) void R_SetupDrawSurfJoints( drawSurf_t* drawSurf, const srfTriangles_t* tri, const idMaterial* shader, nvrhi::ICommandList* commandList )
{ {
// RB: added check whether GPU skinning is available at all // RB: added check whether GPU skinning is available at all
if( tri->staticModelWithJoints == NULL || !r_useGPUSkinning.GetBool() || !glConfig.gpuSkinningAvailable ) if( tri->staticModelWithJoints == NULL || !r_useGPUSkinning.GetBool() )
{ {
drawSurf->jointCache = 0; drawSurf->jointCache = 0;
return; return;
@ -734,7 +734,7 @@ void R_AddSingleModel( viewEntity_t* vEntity )
const bool surfaceDirectlyVisible = modelIsVisible && !idRenderMatrix::CullBoundsToMVP( vEntity->mvp, tri->bounds ); const bool surfaceDirectlyVisible = modelIsVisible && !idRenderMatrix::CullBoundsToMVP( vEntity->mvp, tri->bounds );
// RB: added check whether GPU skinning is available at all // RB: added check whether GPU skinning is available at all
const bool gpuSkinned = ( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() && glConfig.gpuSkinningAvailable ); const bool gpuSkinned = ( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() );
// RB end // RB end
//-------------------------- //--------------------------

View file

@ -88,7 +88,7 @@ static drawSurf_t* R_AutospriteDeform( drawSurf_t* surf )
} }
// RB: added check wether GPU skinning is available at all // RB: added check wether GPU skinning is available at all
const idJointMat* joints = ( srcTri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() && glConfig.gpuSkinningAvailable ) ? srcTri->staticModelWithJoints->jointsInverted : NULL; const idJointMat* joints = ( srcTri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() ) ? srcTri->staticModelWithJoints->jointsInverted : NULL;
// RB end // RB end
idVec3 leftDir; idVec3 leftDir;
@ -185,7 +185,7 @@ static drawSurf_t* R_TubeDeform( drawSurf_t* surf )
} }
// RB: added check wether GPU skinning is available at all // RB: added check wether GPU skinning is available at all
const idJointMat* joints = ( srcTri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() && glConfig.gpuSkinningAvailable ) ? srcTri->staticModelWithJoints->jointsInverted : NULL; const idJointMat* joints = ( srcTri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() ) ? srcTri->staticModelWithJoints->jointsInverted : NULL;
// RB end // RB end
// we need the view direction to project the minor axis of the tube // we need the view direction to project the minor axis of the tube
@ -659,7 +659,7 @@ static void AddTriangleToIsland_r( const srfTriangles_t* tri, int triangleNum, b
island->numTris++; island->numTris++;
// RB: added check wether GPU skinning is available at all // RB: added check wether GPU skinning is available at all
const idJointMat* joints = ( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() && glConfig.gpuSkinningAvailable ) ? tri->staticModelWithJoints->jointsInverted : NULL; const idJointMat* joints = ( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() ) ? tri->staticModelWithJoints->jointsInverted : NULL;
// RB end // RB end
// recurse into all neighbors // recurse into all neighbors
@ -749,7 +749,7 @@ static drawSurf_t* R_EyeballDeform( drawSurf_t* surf )
} }
// RB: added check wether GPU skinning is available at all // RB: added check wether GPU skinning is available at all
const idJointMat* joints = ( srcTri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() && glConfig.gpuSkinningAvailable ) ? srcTri->staticModelWithJoints->jointsInverted : NULL; const idJointMat* joints = ( srcTri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() ) ? srcTri->staticModelWithJoints->jointsInverted : NULL;
// RB end // RB end
// the srfTriangles_t are in frame memory and will be automatically disposed of // the srfTriangles_t are in frame memory and will be automatically disposed of
@ -882,7 +882,7 @@ static drawSurf_t* R_ParticleDeform( drawSurf_t* surf, bool useArea, nvrhi::ICom
float* sourceTriAreas = NULL; float* sourceTriAreas = NULL;
// RB: added check wether GPU skinning is available at all // RB: added check wether GPU skinning is available at all
const idJointMat* joints = ( ( srcTri->staticModelWithJoints != NULL ) && r_useGPUSkinning.GetBool() && glConfig.gpuSkinningAvailable ) ? srcTri->staticModelWithJoints->jointsInverted : NULL; const idJointMat* joints = ( ( srcTri->staticModelWithJoints != NULL ) && r_useGPUSkinning.GetBool() ) ? srcTri->staticModelWithJoints->jointsInverted : NULL;
// RB end // RB end
if( useArea ) if( useArea )

View file

@ -71,7 +71,7 @@ void R_SurfaceToTextureAxis( const srfTriangles_t* tri, idVec3& origin, idVec3 a
// determine the world S and T vectors from the first drawSurf triangle // determine the world S and T vectors from the first drawSurf triangle
// RB: added check wether GPU skinning is available at all // RB: added check wether GPU skinning is available at all
const idJointMat* joints = ( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() && glConfig.gpuSkinningAvailable ) ? tri->staticModelWithJoints->jointsInverted : NULL; const idJointMat* joints = ( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() ) ? tri->staticModelWithJoints->jointsInverted : NULL;
// RB end // RB end
const idVec3 aXYZ = idDrawVert::GetSkinnedDrawVertPosition( tri->verts[ tri->indexes[0] ], joints ); const idVec3 aXYZ = idDrawVert::GetSkinnedDrawVertPosition( tri->verts[ tri->indexes[0] ], joints );

View file

@ -122,7 +122,7 @@ bool R_PreciseCullSurface( const drawSurf_t* drawSurf, idBounds& ndcBounds )
ndcBounds.Clear(); ndcBounds.Clear();
// RB: added check wether GPU skinning is available at all // RB: added check wether GPU skinning is available at all
const idJointMat* joints = ( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() && glConfig.gpuSkinningAvailable ) ? tri->staticModelWithJoints->jointsInverted : NULL; const idJointMat* joints = ( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() ) ? tri->staticModelWithJoints->jointsInverted : NULL;
// RB end // RB end
for( int i = 0; i < tri->numVerts; i++ ) for( int i = 0; i < tri->numVerts; i++ )

View file

@ -620,7 +620,7 @@ localTrace_t R_LocalTrace( const idVec3& start, const idVec3& end, const float r
byte totalOr = 0; byte totalOr = 0;
// RB: added check wether GPU skinning is available at all // RB: added check wether GPU skinning is available at all
const idJointMat* joints = ( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() && glConfig.gpuSkinningAvailable ) ? tri->staticModelWithJoints->jointsInverted : NULL; const idJointMat* joints = ( tri->staticModelWithJoints != NULL && r_useGPUSkinning.GetBool() ) ? tri->staticModelWithJoints->jointsInverted : NULL;
// RB end // RB end
if( joints != NULL ) if( joints != NULL )