Merged some smaller cleanups from the SP branch

This commit is contained in:
Robert Beckebans 2022-07-03 11:26:54 +02:00
parent e0e04b4a65
commit cdc39a0294
9 changed files with 13 additions and 35 deletions

View file

@ -87,7 +87,7 @@ void idGuiModel::ReadFromDemo( idDemoFile* demo )
idGuiModel::BeginFrame
================
*/
void idGuiModel::BeginFrame( nvrhi::ICommandList* commandList )
void idGuiModel::BeginFrame()
{
vertexBlock = vertexCache.AllocVertex( NULL, MAX_VERTS );
indexBlock = vertexCache.AllocIndex( NULL, MAX_INDEXES );

View file

@ -56,7 +56,7 @@ public:
void ReadFromDemo( idDemoFile* demo );
// allocates memory for verts and indexes in frame-temporary buffer memory
void BeginFrame( nvrhi::ICommandList* commandList );
void BeginFrame();
void EmitToCurrentView( float modelMatrix[16], bool depthHack );
void EmitFullScreen( textureStage_t* textureStage = nullptr );

View file

@ -324,7 +324,7 @@ static void R_SMAAImage_ResNative( idImage* image, nvrhi::ICommandList* commandL
static void R_AmbientOcclusionImage_ResNative( idImage* image, nvrhi::ICommandList* commandList )
{
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_LINEAR, TR_CLAMP, TD_R8F, nullptr, true );
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_LINEAR, TR_CLAMP, TD_R8F, nullptr, true, true );
}
static void R_GeometryBufferImage_ResNative( idImage* image, nvrhi::ICommandList* commandList )
@ -341,7 +341,7 @@ static void R_SSAOImage_ResHalf( idImage* image, nvrhi::ICommandList* commandLis
static void R_HierarchicalZBufferImage_ResNative( idImage* image, nvrhi::ICommandList* commandList )
{
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_NEAREST_MIPMAP, TR_CLAMP, TD_R32F, nullptr, true );
image->GenerateImage( NULL, renderSystem->GetWidth(), renderSystem->GetHeight(), TF_NEAREST_MIPMAP, TR_CLAMP, TD_R32F, nullptr, true, true );
}
static void R_R8Image_ResNative_Linear( idImage* image, nvrhi::ICommandList* commandList )

View file

@ -99,21 +99,6 @@ int BitsForFormat( textureFormat_t format )
}
}
int BytesPerBlockForFormat( const textureFormat_t& format )
{
switch( format )
{
case FMT_NONE:
return 0;
case FMT_DXT1:
return 8;
case FMT_DXT5:
return 16;
default:
return 1;
}
}
int BlockSizeForFormat( const textureFormat_t& format )
{
switch( format )

View file

@ -347,7 +347,6 @@ void idImage::AllocImage()
return;
}
int compressedSize = 0;
uint originalWidth = opts.width;
uint originalHeight = opts.height;
@ -436,8 +435,6 @@ void idImage::AllocImage()
if( opts.isRenderTarget )
{
//textureDesc.keepInitialState = true;
//textureDesc.setKeepInitialState( true );
textureDesc.setInitialState( nvrhi::ResourceStates::RenderTarget )
.setClearValue( nvrhi::Color( 0.f ) )
.setIsRenderTarget( true )
@ -449,7 +446,7 @@ void idImage::AllocImage()
.setClearValue( nvrhi::Color( 1.f ) );
}
if( opts.format == FMT_R32F || opts.format == FMT_R8 )
if( opts.isUAV )
{
// TODO(Stephen): Probably make this an image option.
// This is a hack to make cszBuffer and ambient occlusion uav work.

View file

@ -209,7 +209,7 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
}
else
{
const uint64 frameNum = ( int )( vbHandle >> VERTCACHE_FRAME_SHIFT ) & VERTCACHE_FRAME_MASK;
const uint64 frameNum = static_cast<uint64>( vbHandle >> VERTCACHE_FRAME_SHIFT ) & VERTCACHE_FRAME_MASK;
if( frameNum != ( ( vertexCache.currentFrame - 1 ) & VERTCACHE_FRAME_MASK ) )
{
idLib::Warning( "RB_DrawElementsWithCounters, vertexBuffer == NULL" );
@ -217,7 +217,7 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
}
vertexBuffer = &vertexCache.frameData[vertexCache.drawListNum].vertexBuffer;
}
const uint vertOffset = ( uint )( vbHandle >> VERTCACHE_OFFSET_SHIFT ) & VERTCACHE_OFFSET_MASK;
const uint vertOffset = static_cast<uint>( vbHandle >> VERTCACHE_OFFSET_SHIFT ) & VERTCACHE_OFFSET_MASK;
bool changeState = false;
@ -243,7 +243,7 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
}
else
{
const uint64 frameNum = ( int )( ibHandle >> VERTCACHE_FRAME_SHIFT ) & VERTCACHE_FRAME_MASK;
const uint64 frameNum = static_cast<uint64>( ibHandle >> VERTCACHE_FRAME_SHIFT ) & VERTCACHE_FRAME_MASK;
if( frameNum != ( ( vertexCache.currentFrame - 1 ) & VERTCACHE_FRAME_MASK ) )
{
idLib::Warning( "RB_DrawElementsWithCounters, indexBuffer == NULL" );
@ -251,7 +251,7 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
}
indexBuffer = &vertexCache.frameData[vertexCache.drawListNum].indexBuffer;
}
const uint indexOffset = ( uint )( ibHandle >> VERTCACHE_OFFSET_SHIFT ) & VERTCACHE_OFFSET_MASK;
const uint indexOffset = static_cast<uint>( ibHandle >> VERTCACHE_OFFSET_SHIFT ) & VERTCACHE_OFFSET_MASK;
if( currentIndexOffset != indexOffset )
{

View file

@ -986,13 +986,9 @@ public:
// the joints buffer should only be bound for vertex programs that use joints
bool ShaderUsesJoints() const
{
#if defined( USE_NVRHI )
// FIXME
return false;
#else
return renderProgs[current].usesJoints;
#endif
return renderProgs[currentIndex].usesJoints;
}
// the rpEnableSkinning render parm should only be set for vertex programs that use it
bool ShaderHasOptionalSkinning() const
{

View file

@ -908,7 +908,7 @@ const emptyCommand_t* idRenderSystemLocal::SwapCommandBuffers_FinishCommandBuffe
}
// prepare the new command buffer
guiModel->BeginFrame( commandList );
guiModel->BeginFrame();
//------------------------------
// Make sure that geometry used by code is present in the buffer cache.

View file

@ -2225,7 +2225,7 @@ void idRenderSystemLocal::ResetGuiModels()
delete guiModel;
guiModel = new( TAG_RENDER ) idGuiModel;
guiModel->Clear();
guiModel->BeginFrame( commandList );
guiModel->BeginFrame();
tr_guiModel = guiModel; // for DeviceContext fast path
}