mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 06:34:10 +00:00
Sync NVRHI branch by SP
This commit is contained in:
parent
827bb275d6
commit
fd7802dfb4
62 changed files with 494 additions and 460 deletions
|
@ -1699,7 +1699,7 @@ G_InitNew
|
|||
}
|
||||
}
|
||||
|
||||
G_DoLoadLevel( );
|
||||
G_DoLoadLevel();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ struct default_t
|
|||
int scantranslate; // PC scan code hack
|
||||
int untranslated; // lousy hack
|
||||
|
||||
default_t( ) :
|
||||
default_t() :
|
||||
name( NULL ),
|
||||
location( NULL ),
|
||||
defaultvalue( 0 ),
|
||||
|
|
|
@ -119,7 +119,7 @@ void idCameraView::Restore( idRestoreGame* savefile )
|
|||
idCameraView::Event_SetAttachments
|
||||
================
|
||||
*/
|
||||
void idCameraView::Event_SetAttachments( )
|
||||
void idCameraView::Event_SetAttachments()
|
||||
{
|
||||
SetAttachment( &attachedTo, "attachedTo" );
|
||||
SetAttachment( &attachedView, "attachedView" );
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
void Save( idSaveGame* savefile ) const; // archives object for save game file
|
||||
void Restore( idRestoreGame* savefile ); // unarchives object from save game file
|
||||
|
||||
void Spawn( );
|
||||
void Spawn();
|
||||
virtual void GetViewParms( renderView_t* view );
|
||||
virtual void Stop();
|
||||
|
||||
|
|
|
@ -2158,7 +2158,7 @@ void idEntity::Bind( idEntity* master, bool orientated )
|
|||
|
||||
FinishBind();
|
||||
|
||||
PostBind( );
|
||||
PostBind();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5839,7 +5839,7 @@ void idEntity::ReadGUIFromSnapshot( const idBitMsg& msg )
|
|||
{
|
||||
int state;
|
||||
idUserInterface* gui;
|
||||
state = msg.ReadByte( );
|
||||
state = msg.ReadByte();
|
||||
gui = renderEntity.gui[ 0 ];
|
||||
if( gui && state != mpGUIState )
|
||||
{
|
||||
|
|
|
@ -486,7 +486,7 @@ void idGameLocal::SaveGame( idFile* f, idFile* strings )
|
|||
|
||||
idSaveGame savegame( f, strings, BUILD_NUMBER );
|
||||
|
||||
if( g_flushSave.GetBool( ) == true )
|
||||
if( g_flushSave.GetBool() == true )
|
||||
{
|
||||
// force flushing with each write... for tracking down
|
||||
// save game bugs.
|
||||
|
@ -1112,7 +1112,7 @@ void idGameLocal::LoadMap( const char* mapName, int randseed )
|
|||
idGameLocal::LocalMapRestart
|
||||
===================
|
||||
*/
|
||||
void idGameLocal::LocalMapRestart( )
|
||||
void idGameLocal::LocalMapRestart()
|
||||
{
|
||||
int i, latchSpawnCount;
|
||||
|
||||
|
@ -1218,7 +1218,7 @@ void idGameLocal::MapRestart_f( const idCmdArgs& args )
|
|||
return;
|
||||
}
|
||||
|
||||
gameLocal.MapRestart( );
|
||||
gameLocal.MapRestart();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1097,8 +1097,8 @@ void idGameLocal::ClientProcessReliableMessage( int type, const idBitMsg& msg )
|
|||
{
|
||||
idMultiplayerGame::msg_evt_t msg_evt = ( idMultiplayerGame::msg_evt_t )msg.ReadByte();
|
||||
int parm1, parm2;
|
||||
parm1 = msg.ReadByte( );
|
||||
parm2 = msg.ReadByte( );
|
||||
parm1 = msg.ReadByte();
|
||||
parm2 = msg.ReadByte();
|
||||
mpGame.PrintMessageEvent( msg_evt, parm1, parm2 );
|
||||
break;
|
||||
}
|
||||
|
@ -1132,7 +1132,7 @@ void idGameLocal::ClientProcessReliableMessage( int type, const idBitMsg& msg )
|
|||
}
|
||||
case GAME_RELIABLE_MESSAGE_TOURNEYLINE:
|
||||
{
|
||||
int line = msg.ReadByte( );
|
||||
int line = msg.ReadByte();
|
||||
idPlayer* p = static_cast< idPlayer* >( entities[ GetLocalClientNum() ] );
|
||||
if( !p )
|
||||
{
|
||||
|
|
|
@ -1303,7 +1303,7 @@ void idExplodingBarrel::Killed( idEntity* inflictor, idEntity* attacker, int dam
|
|||
gameLocal.RadiusDamage( GetPhysics()->GetOrigin(), this, attacker, this, this, splash );
|
||||
}
|
||||
|
||||
ExplodingEffects( );
|
||||
ExplodingEffects();
|
||||
|
||||
//FIXME: need to precache all the debris stuff here and in the projectiles
|
||||
const idKeyValue* kv = spawnArgs.MatchPrefix( "def_debris" );
|
||||
|
@ -1520,7 +1520,7 @@ bool idExplodingBarrel::ClientReceiveEvent( int event, int time, const idBitMsg&
|
|||
{
|
||||
if( gameLocal.realClientTime - msg.ReadLong() < spawnArgs.GetInt( "explode_lapse", "1000" ) )
|
||||
{
|
||||
ExplodingEffects( );
|
||||
ExplodingEffects();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1537,7 +1537,7 @@ idMultiplayerGame::FillTourneySlots
|
|||
NOTE: called each frame during warmup to keep the tourney slots filled
|
||||
================
|
||||
*/
|
||||
void idMultiplayerGame::FillTourneySlots( )
|
||||
void idMultiplayerGame::FillTourneySlots()
|
||||
{
|
||||
int i, j, rankmax, rankmaxindex;
|
||||
idEntity* ent;
|
||||
|
@ -1655,7 +1655,7 @@ void idMultiplayerGame::UpdateTourneyLine()
|
|||
idMultiplayerGame::CycleTourneyPlayers
|
||||
================
|
||||
*/
|
||||
void idMultiplayerGame::CycleTourneyPlayers( )
|
||||
void idMultiplayerGame::CycleTourneyPlayers()
|
||||
{
|
||||
int i;
|
||||
idEntity* ent;
|
||||
|
@ -1672,7 +1672,7 @@ void idMultiplayerGame::CycleTourneyPlayers( )
|
|||
currentTourneyPlayer[ 0 ] = lastWinner;
|
||||
}
|
||||
}
|
||||
FillTourneySlots( );
|
||||
FillTourneySlots();
|
||||
// force selected players in/out of the game and update the ranks
|
||||
for( i = 0 ; i < gameLocal.numClients ; i++ )
|
||||
{
|
||||
|
@ -2830,7 +2830,7 @@ void idMultiplayerGame::CheckRespawns( idPlayer* spectator )
|
|||
else if( gameState == WARMUP )
|
||||
{
|
||||
// make sure empty tourney slots get filled first
|
||||
FillTourneySlots( );
|
||||
FillTourneySlots();
|
||||
if( i == currentTourneyPlayer[ 0 ] || i == currentTourneyPlayer[ 1 ] )
|
||||
{
|
||||
p->ServerSpectate( false );
|
||||
|
@ -3631,8 +3631,8 @@ void idMultiplayerGame::ClientReadStartState( const idBitMsg& msg )
|
|||
{
|
||||
// read the state in preparation for reading snapshot updates
|
||||
gameState = ( idMultiplayerGame::gameState_t )msg.ReadByte();
|
||||
matchStartedTime = msg.ReadLong( );
|
||||
startFragLimit = msg.ReadShort( );
|
||||
matchStartedTime = msg.ReadLong();
|
||||
startFragLimit = msg.ReadShort();
|
||||
|
||||
int client;
|
||||
while( ( client = msg.ReadByte() ) != MAX_CLIENTS )
|
||||
|
|
|
@ -583,7 +583,7 @@ public:
|
|||
|
||||
int NumFilenames()
|
||||
{
|
||||
return fileList.Num( );
|
||||
return fileList.Num();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -938,7 +938,7 @@ Scroll
|
|||
deals with scrolling text because we don't have key repeat
|
||||
==============
|
||||
*/
|
||||
void idConsoleLocal::Scroll( )
|
||||
void idConsoleLocal::Scroll()
|
||||
{
|
||||
if( lastKeyEvent == -1 || ( lastKeyEvent + 200 ) > eventLoop->Milliseconds() )
|
||||
{
|
||||
|
|
|
@ -3537,7 +3537,7 @@ idFile* idFileSystemLocal::OpenFileReadFlags( const char* relativePath, int sear
|
|||
}
|
||||
}
|
||||
|
||||
if( fs_debug.GetInteger( ) )
|
||||
if( fs_debug.GetInteger() )
|
||||
{
|
||||
common->Printf( "Can't find %s\n", relativePath );
|
||||
}
|
||||
|
@ -3820,8 +3820,8 @@ void idFileSystemLocal::FindDLL( const char* name, char _dllPath[ MAX_OSPATH ] )
|
|||
sys->DLL_GetFileName( name, dllName, MAX_OSPATH );
|
||||
|
||||
// from executable directory first - this is handy for developement
|
||||
idStr dllPath = Sys_EXEPath( );
|
||||
dllPath.StripFilename( );
|
||||
idStr dllPath = Sys_EXEPath();
|
||||
dllPath.StripFilename();
|
||||
dllPath.AppendPath( dllName );
|
||||
idFile* dllFile = OpenExplicitFileRead( dllPath );
|
||||
|
||||
|
|
|
@ -1245,7 +1245,7 @@ bool ImGui::RadioButton( const char* label, bool active )
|
|||
|
||||
if( g.LogEnabled )
|
||||
{
|
||||
LogRenderedText( &total_bb.Min, active ? "(x)" : "( )" );
|
||||
LogRenderedText( &total_bb.Min, active ? "(x)" : "()" );
|
||||
}
|
||||
if( label_size.x > 0.0f )
|
||||
{
|
||||
|
|
|
@ -974,12 +974,12 @@ static void R_CreateBrdfLutImage( idImage* image, nvrhi::ICommandList* commandLi
|
|||
|
||||
static void R_CreateEnvprobeImage_UAC_lobby_irradiance( idImage* image, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
image->GenerateImage( ( byte* )IMAGE_ENV_UAC_LOBBY_AMB_H_Bytes, IMAGE_ENV_UAC_LOBBY_AMB_H_TEX_WIDTH, IMAGE_ENV_UAC_LOBBY_AMB_H_TEX_HEIGHT, TF_DEFAULT, TR_CLAMP, TD_R11G11B10F, commandList, true, SAMPLE_1, CF_2D_PACKED_MIPCHAIN );
|
||||
image->GenerateImage( ( byte* )IMAGE_ENV_UAC_LOBBY_AMB_H_Bytes, IMAGE_ENV_UAC_LOBBY_AMB_H_TEX_WIDTH, IMAGE_ENV_UAC_LOBBY_AMB_H_TEX_HEIGHT, TF_DEFAULT, TR_CLAMP, TD_R11G11B10F, commandList, false, SAMPLE_1, CF_2D_PACKED_MIPCHAIN );
|
||||
}
|
||||
|
||||
static void R_CreateEnvprobeImage_UAC_lobby_radiance( idImage* image, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
image->GenerateImage( ( byte* )IMAGE_ENV_UAC_LOBBY_SPEC_H_Bytes, IMAGE_ENV_UAC_LOBBY_SPEC_H_TEX_WIDTH, IMAGE_ENV_UAC_LOBBY_SPEC_H_TEX_HEIGHT, TF_DEFAULT, TR_CLAMP, TD_R11G11B10F, commandList, true, SAMPLE_1, CF_2D_PACKED_MIPCHAIN );
|
||||
image->GenerateImage( ( byte* )IMAGE_ENV_UAC_LOBBY_SPEC_H_Bytes, IMAGE_ENV_UAC_LOBBY_SPEC_H_TEX_WIDTH, IMAGE_ENV_UAC_LOBBY_SPEC_H_TEX_HEIGHT, TF_DEFAULT, TR_CLAMP, TD_R11G11B10F, commandList, false, SAMPLE_1, CF_2D_PACKED_MIPCHAIN );
|
||||
}
|
||||
|
||||
// RB end
|
||||
|
|
|
@ -607,9 +607,18 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
|
|||
}
|
||||
const uint vertOffset = ( uint )( vbHandle >> VERTCACHE_OFFSET_SHIFT ) & VERTCACHE_OFFSET_MASK;
|
||||
|
||||
bool changeState = false;
|
||||
|
||||
if( currentVertexOffset != vertOffset )
|
||||
{
|
||||
currentVertexOffset = vertOffset;
|
||||
//changeState = true;
|
||||
}
|
||||
|
||||
if( currentVertexBuffer != ( nvrhi::IBuffer* )vertexBuffer->GetAPIObject() || !r_useStateCaching.GetBool() )
|
||||
{
|
||||
currentVertexBuffer = vertexBuffer->GetAPIObject();
|
||||
changeState = true;
|
||||
}
|
||||
|
||||
// Get index buffer
|
||||
|
@ -631,15 +640,84 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
|
|||
}
|
||||
const uint indexOffset = ( uint )( ibHandle >> VERTCACHE_OFFSET_SHIFT ) & VERTCACHE_OFFSET_MASK;
|
||||
|
||||
if( currentIndexOffset != indexOffset )
|
||||
{
|
||||
currentIndexOffset = indexOffset;
|
||||
//changeState = true;
|
||||
}
|
||||
|
||||
RENDERLOG_PRINTF( "Binding Buffers: %p:%i %p:%i\n", vertexBuffer, vertOffset, indexBuffer, indexOffset );
|
||||
|
||||
if( currentIndexBuffer != ( nvrhi::IBuffer* )indexBuffer->GetAPIObject() || !r_useStateCaching.GetBool() )
|
||||
{
|
||||
currentIndexBuffer = indexBuffer->GetAPIObject();
|
||||
changeState = true;
|
||||
}
|
||||
|
||||
nvrhi::BindingSetDesc bindingSetDesc;
|
||||
GetCurrentBindingLayout( bindingSetDesc );
|
||||
|
||||
|
||||
// RB: for debugging
|
||||
int program = renderProgManager.CurrentProgram();
|
||||
int bindingLayoutType = renderProgManager.BindingLayoutType();
|
||||
|
||||
if( !currentBindingSet || *currentBindingSet->getDesc() != bindingSetDesc )
|
||||
{
|
||||
currentBindingSet = bindingCache.GetOrCreateBindingSet( bindingSetDesc, renderProgManager.BindingLayout() );
|
||||
changeState = true;
|
||||
}
|
||||
|
||||
renderProgManager.CommitConstantBuffer( commandList );
|
||||
|
||||
PipelineKey key{ glStateBits, renderProgManager.CurrentProgram(), viewDef->isMirror, depthBias, slopeScaleBias, currentFrameBuffer };
|
||||
auto pipeline = pipelineCache.GetOrCreatePipeline( key );
|
||||
|
||||
if( currentPipeline != pipeline )
|
||||
{
|
||||
currentPipeline = pipeline;
|
||||
changeState = true;
|
||||
}
|
||||
|
||||
if( changeState )
|
||||
{
|
||||
nvrhi::GraphicsState state;
|
||||
state.bindings = { currentBindingSet };
|
||||
state.indexBuffer = { currentIndexBuffer, nvrhi::Format::R16_UINT, 0 };
|
||||
state.vertexBuffers = { { currentVertexBuffer, 0, 0 } };
|
||||
state.pipeline = pipeline;
|
||||
state.framebuffer = currentFrameBuffer->GetApiObject();
|
||||
|
||||
nvrhi::Viewport viewport{ ( float )currentViewport.x1,
|
||||
( float )currentViewport.x2,
|
||||
( float )currentViewport.y1,
|
||||
( float )currentViewport.y2,
|
||||
currentViewport.zmin,
|
||||
currentViewport.zmax };
|
||||
state.viewport.addViewportAndScissorRect( viewport );
|
||||
|
||||
if( !currentScissor.IsEmpty() )
|
||||
{
|
||||
state.viewport.addScissorRect( nvrhi::Rect( currentScissor.x1, currentScissor.x2, currentScissor.y1, currentScissor.y2 ) );
|
||||
}
|
||||
|
||||
commandList->setGraphicsState( state );
|
||||
}
|
||||
|
||||
nvrhi::DrawArguments args;
|
||||
// FIXME idDrawShadowVert
|
||||
args.startVertexLocation = currentVertexOffset / sizeof( idDrawVert );
|
||||
args.startIndexLocation = currentIndexOffset / sizeof( uint16 );
|
||||
args.vertexCount = surf->numIndexes;
|
||||
commandList->drawIndexed( args );
|
||||
|
||||
// RB: added stats
|
||||
pc.c_drawElements++;
|
||||
pc.c_drawIndexes += surf->numIndexes;
|
||||
}
|
||||
|
||||
void idRenderBackend::GetCurrentBindingLayout( nvrhi::BindingSetDesc& bindingSetDesc )
|
||||
{
|
||||
if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_DEFAULT )
|
||||
{
|
||||
bindingSetDesc
|
||||
|
@ -665,15 +743,10 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
|
|||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 8, ( nvrhi::ITexture* )GetImageAt( 8 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 9, ( nvrhi::ITexture* )GetImageAt( 9 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 10, ( nvrhi::ITexture* )GetImageAt( 10 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 1, ( nvrhi::ISampler* )GetImageAt( 1 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 2, ( nvrhi::ISampler* )GetImageAt( 2 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 3, ( nvrhi::ISampler* )GetImageAt( 3 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 4, ( nvrhi::ISampler* )GetImageAt( 4 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 7, ( nvrhi::ISampler* )GetImageAt( 7 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 8, ( nvrhi::ISampler* )GetImageAt( 8 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 9, ( nvrhi::ISampler* )GetImageAt( 9 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 10, ( nvrhi::ISampler* )GetImageAt( 10 )->GetSampler( samplerCache ) ) );
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, commonPasses.m_AnisotropicWrapSampler ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 1, commonPasses.m_PointWrapSampler ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 2, commonPasses.m_LinearClampSampler ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 3, commonPasses.m_AnisotropicClampEdgeSampler ) );
|
||||
}
|
||||
else if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_DRAW_AO )
|
||||
{
|
||||
|
@ -702,11 +775,8 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
|
|||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 2, ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 3, ( nvrhi::ITexture* )GetImageAt( 3 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 4, ( nvrhi::ITexture* )GetImageAt( 4 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 1, ( nvrhi::ISampler* )GetImageAt( 1 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 2, ( nvrhi::ISampler* )GetImageAt( 2 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 3, ( nvrhi::ISampler* )GetImageAt( 3 )->GetSampler( samplerCache ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 4, ( nvrhi::ISampler* )GetImageAt( 4 )->GetSampler( samplerCache ) ) );
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, commonPasses.m_AnisotropicWrapSampler ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 1, commonPasses.m_LinearClampSampler ) );
|
||||
}
|
||||
else if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_DRAW_INTERACTION_SM )
|
||||
{
|
||||
|
@ -741,49 +811,18 @@ void idRenderBackend::DrawElementsWithCounters( const drawSurf_t* surf )
|
|||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 2, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler( samplerCache ) ) );
|
||||
}
|
||||
else if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_NORMAL_CUBE )
|
||||
{
|
||||
bindingSetDesc
|
||||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, commonPasses.m_LinearWrapSampler ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
common->FatalError( "Invalid binding set %d\n", renderProgManager.BindingLayoutType() );
|
||||
}
|
||||
|
||||
int program = renderProgManager.CurrentProgram();
|
||||
int bindingLayoutType = renderProgManager.BindingLayoutType();
|
||||
|
||||
nvrhi::BindingSetHandle sourceBindingSet = bindingCache.GetOrCreateBindingSet( bindingSetDesc, renderProgManager.BindingLayout() );
|
||||
renderProgManager.CommitConstantBuffer( commandList );
|
||||
|
||||
PipelineKey key{ glStateBits, renderProgManager.CurrentProgram(), viewDef->isMirror, depthBias, slopeScaleBias, currentFrameBuffer };
|
||||
auto pipeline = pipelineCache.GetOrCreatePipeline( key );
|
||||
|
||||
nvrhi::GraphicsState state;
|
||||
state.bindings = { sourceBindingSet };
|
||||
state.indexBuffer = { currentIndexBuffer, nvrhi::Format::R16_UINT, indexOffset };
|
||||
state.vertexBuffers = { { currentVertexBuffer, 0, vertOffset } };
|
||||
state.pipeline = pipeline;
|
||||
state.framebuffer = currentFrameBuffer->GetApiObject();
|
||||
|
||||
nvrhi::Viewport viewport{ ( float )currentViewport.x1,
|
||||
( float )currentViewport.x2,
|
||||
( float )currentViewport.y1,
|
||||
( float )currentViewport.y2,
|
||||
currentViewport.zmin,
|
||||
currentViewport.zmax };
|
||||
state.viewport.addViewportAndScissorRect( viewport );
|
||||
|
||||
if( !currentScissor.IsEmpty() )
|
||||
{
|
||||
state.viewport.addScissorRect( nvrhi::Rect( currentScissor.x1, currentScissor.x2, currentScissor.y1, currentScissor.y2 ) );
|
||||
}
|
||||
|
||||
commandList->setGraphicsState( state );
|
||||
|
||||
nvrhi::DrawArguments args;
|
||||
args.vertexCount = surf->numIndexes;
|
||||
commandList->drawIndexed( args );
|
||||
|
||||
// RB: added stats
|
||||
pc.c_drawElements++;
|
||||
pc.c_drawIndexes += surf->numIndexes;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -829,7 +868,7 @@ void idRenderBackend::GL_EndFrame()
|
|||
|
||||
void idRenderBackend::GL_EndRenderPass()
|
||||
{
|
||||
#if 1//defined( USE_NVRHI )
|
||||
#if 0//defined( USE_NVRHI )
|
||||
commandList->close();
|
||||
deviceManager->GetDevice()->executeCommandList( commandList );
|
||||
|
||||
|
|
|
@ -139,6 +139,7 @@ void idRenderProgManager::LoadShader( shader_t& shader )
|
|||
}
|
||||
|
||||
idList<nvrhi::ShaderConstant> constants;
|
||||
|
||||
for( int i = 0; i < shader.macros.Num(); i++ )
|
||||
{
|
||||
constants.Append( nvrhi::ShaderConstant
|
||||
|
|
|
@ -73,6 +73,10 @@ void CommonRenderPasses::Init( nvrhi::IDevice* device )
|
|||
.setAllAddressModes( nvrhi::SamplerAddressMode::Clamp );
|
||||
m_PointClampSampler = m_Device->createSampler( samplerDesc );
|
||||
|
||||
samplerDesc.setAllAddressModes( nvrhi::SamplerAddressMode::Wrap );
|
||||
m_PointWrapSampler = m_Device->createSampler( samplerDesc );
|
||||
|
||||
samplerDesc.setAllAddressModes( nvrhi::SamplerAddressMode::Clamp );
|
||||
samplerDesc.setAllFilters( true );
|
||||
m_LinearClampSampler = m_Device->createSampler( samplerDesc );
|
||||
|
||||
|
@ -85,6 +89,9 @@ void CommonRenderPasses::Init( nvrhi::IDevice* device )
|
|||
samplerDesc.setMaxAnisotropy( 16 );
|
||||
m_AnisotropicWrapSampler = m_Device->createSampler( samplerDesc );
|
||||
|
||||
samplerDesc.setAllAddressModes( nvrhi::SamplerAddressMode::ClampToEdge );
|
||||
m_AnisotropicClampEdgeSampler = m_Device->createSampler( samplerDesc );
|
||||
|
||||
{
|
||||
unsigned int blackImage = 0xff000000;
|
||||
unsigned int grayImage = 0xff808080;
|
||||
|
|
|
@ -123,10 +123,12 @@ public:
|
|||
nvrhi::TextureHandle m_BlackCubeMapArray;
|
||||
|
||||
nvrhi::SamplerHandle m_PointClampSampler;
|
||||
nvrhi::SamplerHandle m_PointWrapSampler;
|
||||
nvrhi::SamplerHandle m_LinearClampSampler;
|
||||
nvrhi::SamplerHandle m_LinearClampCompareSampler;
|
||||
nvrhi::SamplerHandle m_LinearWrapSampler;
|
||||
nvrhi::SamplerHandle m_AnisotropicWrapSampler;
|
||||
nvrhi::SamplerHandle m_AnisotropicClampEdgeSampler;
|
||||
|
||||
nvrhi::BindingLayoutHandle m_BlitBindingLayout;
|
||||
|
||||
|
|
|
@ -65,18 +65,18 @@ void ForwardShadingPass::Init( nvrhi::DeviceHandle deviceHandle )
|
|||
{
|
||||
device = deviceHandle;
|
||||
|
||||
auto texturedBindingLayoutDesc = nvrhi::BindingLayoutDesc( )
|
||||
auto texturedBindingLayoutDesc = nvrhi::BindingLayoutDesc()
|
||||
.setVisibility( nvrhi::ShaderType::All )
|
||||
.addItem( nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ) )
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) )
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) );
|
||||
|
||||
auto geometrySkinnedBindingLayoutDesc = nvrhi::BindingLayoutDesc( )
|
||||
auto geometrySkinnedBindingLayoutDesc = nvrhi::BindingLayoutDesc()
|
||||
.setVisibility( nvrhi::ShaderType::All )
|
||||
.addItem( nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ) )
|
||||
.addItem( nvrhi::BindingLayoutItem::VolatileConstantBuffer( 1 ) );
|
||||
|
||||
auto geometryBindingLayoutDesc = nvrhi::BindingLayoutDesc( )
|
||||
auto geometryBindingLayoutDesc = nvrhi::BindingLayoutDesc()
|
||||
.setVisibility( nvrhi::ShaderType::All )
|
||||
.addItem( nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ) );
|
||||
|
||||
|
@ -84,17 +84,17 @@ void ForwardShadingPass::Init( nvrhi::DeviceHandle deviceHandle )
|
|||
geometryBindingLayout = device->createBindingLayout( geometryBindingLayoutDesc );
|
||||
pipelineDesc.bindingLayouts = { geometryBindingLayout };
|
||||
|
||||
geometryBindingSetDesc = nvrhi::BindingSetDesc( )
|
||||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer( ) ) );
|
||||
geometryBindingSetDesc = nvrhi::BindingSetDesc()
|
||||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ) );
|
||||
|
||||
samplerCache.Init( deviceHandle.Get( ) );
|
||||
samplerCache.Init( deviceHandle.Get() );
|
||||
|
||||
pipeline = nullptr;
|
||||
}
|
||||
|
||||
void ForwardShadingPass::DrawInteractions( nvrhi::ICommandList* commandList, const viewDef_t* viewDef )
|
||||
{
|
||||
if( r_skipInteractions.GetBool( ) || viewDef->viewLights == NULL )
|
||||
if( r_skipInteractions.GetBool() || viewDef->viewLights == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ void ForwardShadingPass::DrawInteractions( nvrhi::ICommandList* commandList, con
|
|||
|
||||
GL_SelectTexture( 0 );
|
||||
|
||||
const bool useLightDepthBounds = r_useLightDepthBounds.GetBool( ) && !r_useShadowMapping.GetBool( );
|
||||
const bool useLightDepthBounds = r_useLightDepthBounds.GetBool() && !r_useShadowMapping.GetBool();
|
||||
|
||||
Framebuffer* previousFramebuffer = currentFramebuffer;
|
||||
|
||||
|
@ -113,11 +113,11 @@ void ForwardShadingPass::DrawInteractions( nvrhi::ICommandList* commandList, con
|
|||
for( const viewLight_t* vLight = viewDef->viewLights; vLight != NULL; vLight = vLight->next )
|
||||
{
|
||||
// do fogging later
|
||||
if( vLight->lightShader->IsFogLight( ) )
|
||||
if( vLight->lightShader->IsFogLight() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if( vLight->lightShader->IsBlendLight( ) )
|
||||
if( vLight->lightShader->IsBlendLight() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ void ForwardShadingPass::DrawInteractions( nvrhi::ICommandList* commandList, con
|
|||
}
|
||||
|
||||
const idMaterial* lightShader = vLight->lightShader;
|
||||
commandList->beginMarker( lightShader->GetName( ) );
|
||||
commandList->beginMarker( lightShader->GetName() );
|
||||
|
||||
// set the depth bounds for the whole light
|
||||
if( useLightDepthBounds )
|
||||
|
@ -137,20 +137,20 @@ void ForwardShadingPass::DrawInteractions( nvrhi::ICommandList* commandList, con
|
|||
}
|
||||
|
||||
// RB: shadow mapping
|
||||
if( r_useShadowMapping.GetBool( ) )
|
||||
if( r_useShadowMapping.GetBool() )
|
||||
{
|
||||
int side, sideStop;
|
||||
|
||||
if( vLight->parallel )
|
||||
{
|
||||
side = 0;
|
||||
sideStop = r_shadowMapSplits.GetInteger( ) + 1;
|
||||
sideStop = r_shadowMapSplits.GetInteger() + 1;
|
||||
}
|
||||
else if( vLight->pointLight )
|
||||
{
|
||||
if( r_shadowMapSingleSide.GetInteger( ) != -1 )
|
||||
if( r_shadowMapSingleSide.GetInteger() != -1 )
|
||||
{
|
||||
side = r_shadowMapSingleSide.GetInteger( );
|
||||
side = r_shadowMapSingleSide.GetInteger();
|
||||
sideStop = side + 1;
|
||||
}
|
||||
else
|
||||
|
@ -173,20 +173,20 @@ void ForwardShadingPass::DrawInteractions( nvrhi::ICommandList* commandList, con
|
|||
// go back to main render target
|
||||
if( previousFramebuffer != NULL )
|
||||
{
|
||||
previousFramebuffer->Bind( );
|
||||
previousFramebuffer->Bind();
|
||||
}
|
||||
else
|
||||
{
|
||||
Framebuffer::Unbind( );
|
||||
Framebuffer::Unbind();
|
||||
}
|
||||
|
||||
renderProgManager.Unbind( );
|
||||
renderProgManager.Unbind();
|
||||
|
||||
GL_State( GLS_DEFAULT, false );
|
||||
}
|
||||
// RB end
|
||||
|
||||
commandList->endMarker( );
|
||||
commandList->endMarker();
|
||||
}
|
||||
|
||||
// disable stencil shadow test
|
||||
|
@ -201,12 +201,12 @@ void ForwardShadingPass::DrawInteractions( nvrhi::ICommandList* commandList, con
|
|||
GL_DepthBoundsTest( 0.0f, 0.0f );
|
||||
}
|
||||
|
||||
commandList->endMarker( );
|
||||
commandList->endMarker();
|
||||
}
|
||||
|
||||
void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const drawSurf_t* drawSurfs, const viewLight_t* vLight, int side )
|
||||
{
|
||||
if( r_skipShadows.GetBool( ) )
|
||||
if( r_skipShadows.GetBool() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
|
||||
RENDERLOG_PRINTF( "---------- RB_ShadowMapPass( side = %i ) ----------\n", side );
|
||||
|
||||
renderProgManager.BindShader_Depth( );
|
||||
renderProgManager.BindShader_Depth();
|
||||
|
||||
GL_SelectTexture( 0 );
|
||||
|
||||
|
@ -234,21 +234,21 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
// like a no-change-required
|
||||
GL_State( glState | GLS_POLYGON_OFFSET );
|
||||
|
||||
switch( r_shadowMapOccluderFacing.GetInteger( ) )
|
||||
switch( r_shadowMapOccluderFacing.GetInteger() )
|
||||
{
|
||||
case 0:
|
||||
GL_State( ( glStateBits & ~( GLS_CULL_MASK ) ) | GLS_CULL_FRONTSIDED );
|
||||
GL_PolygonOffset( r_shadowMapPolygonFactor.GetFloat( ), r_shadowMapPolygonOffset.GetFloat( ) );
|
||||
GL_PolygonOffset( r_shadowMapPolygonFactor.GetFloat(), r_shadowMapPolygonOffset.GetFloat() );
|
||||
break;
|
||||
|
||||
case 1:
|
||||
GL_State( ( glStateBits & ~( GLS_CULL_MASK ) ) | GLS_CULL_BACKSIDED );
|
||||
GL_PolygonOffset( -r_shadowMapPolygonFactor.GetFloat( ), -r_shadowMapPolygonOffset.GetFloat( ) );
|
||||
GL_PolygonOffset( -r_shadowMapPolygonFactor.GetFloat(), -r_shadowMapPolygonOffset.GetFloat() );
|
||||
break;
|
||||
|
||||
default:
|
||||
GL_State( ( glStateBits & ~( GLS_CULL_MASK ) ) | GLS_CULL_TWOSIDED );
|
||||
GL_PolygonOffset( r_shadowMapPolygonFactor.GetFloat( ), r_shadowMapPolygonOffset.GetFloat( ) );
|
||||
GL_PolygonOffset( r_shadowMapPolygonFactor.GetFloat(), r_shadowMapPolygonOffset.GetFloat() );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -262,12 +262,12 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
|
||||
// original light direction is from surface to light origin
|
||||
idVec3 lightDir = -vLight->lightCenter;
|
||||
if( lightDir.Normalize( ) == 0.0f )
|
||||
if( lightDir.Normalize() == 0.0f )
|
||||
{
|
||||
lightDir[2] = -1.0f;
|
||||
}
|
||||
|
||||
idMat3 rotation = lightDir.ToMat3( );
|
||||
idMat3 rotation = lightDir.ToMat3();
|
||||
//idAngles angles = lightDir.ToAngles();
|
||||
//idMat3 rotation = angles.ToMat3();
|
||||
|
||||
|
@ -283,7 +283,7 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
#endif
|
||||
|
||||
idBounds lightBounds;
|
||||
lightBounds.Clear( );
|
||||
lightBounds.Clear();
|
||||
|
||||
ALIGNTYPE16 frustumCorners_t corners;
|
||||
idRenderMatrix::GetFrustumCorners( corners, vLight->inverseBaseLightProject, bounds_zeroOneCube );
|
||||
|
@ -301,7 +301,7 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
transf[1] /= transf[3];
|
||||
transf[2] /= transf[3];
|
||||
|
||||
lightBounds.AddPoint( transf.ToVec3( ) );
|
||||
lightBounds.AddPoint( transf.ToVec3() );
|
||||
}
|
||||
|
||||
float lightProjectionMatrix[16];
|
||||
|
@ -327,7 +327,7 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
|
||||
// find the bounding box of the current split in the light's clip space
|
||||
idBounds cropBounds;
|
||||
cropBounds.Clear( );
|
||||
cropBounds.Clear();
|
||||
for( int j = 0; j < 8; j++ )
|
||||
{
|
||||
point[0] = splitFrustumCorners.x[j];
|
||||
|
@ -340,7 +340,7 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
transf[1] /= transf[3];
|
||||
transf[2] /= transf[3];
|
||||
|
||||
cropBounds.AddPoint( transf.ToVec3( ) );
|
||||
cropBounds.AddPoint( transf.ToVec3() );
|
||||
}
|
||||
|
||||
// don't let the frustum AABB be bigger than the light AABB
|
||||
|
@ -461,7 +461,7 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
|
||||
// set up 90 degree projection matrix
|
||||
const float zNear = 4;
|
||||
const float fov = r_shadowMapFrustumFOV.GetFloat( );
|
||||
const float fov = r_shadowMapFrustumFOV.GetFloat();
|
||||
|
||||
float ymax = zNear * tan( fov * idMath::PI / 360.0f );
|
||||
float ymin = -ymax;
|
||||
|
@ -505,7 +505,7 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
}
|
||||
else
|
||||
{
|
||||
lightViewRenderMatrix.Identity( );
|
||||
lightViewRenderMatrix.Identity();
|
||||
lightProjectionRenderMatrix = vLight->baseLightProject;
|
||||
|
||||
shadowV[0] = lightViewRenderMatrix;
|
||||
|
@ -520,7 +520,7 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
currentSpace = NULL;
|
||||
|
||||
nvrhi::GraphicsState graphicsState;
|
||||
graphicsState.framebuffer = currentFramebuffer->GetApiObject( );
|
||||
graphicsState.framebuffer = currentFramebuffer->GetApiObject();
|
||||
nvrhi::Viewport viewport;
|
||||
viewport.minX = currentViewport.x1;
|
||||
viewport.minY = currentViewport.y1;
|
||||
|
@ -530,8 +530,8 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
viewport.maxZ = currentViewport.zmax;
|
||||
graphicsState.viewport.addViewportAndScissorRect( viewport );
|
||||
graphicsState.viewport.addScissorRect( nvrhi::Rect( currentScissor.x1, currentScissor.y1, currentScissor.x2, currentScissor.y2 ) );
|
||||
renderProgManager.BindShader_Depth( );
|
||||
auto currentBindingSet = bindingCache.GetOrCreateBindingSet( geometryBindingSetDesc, renderProgManager.BindingLayout( ) );
|
||||
renderProgManager.BindShader_Depth();
|
||||
auto currentBindingSet = bindingCache.GetOrCreateBindingSet( geometryBindingSetDesc, renderProgManager.BindingLayout() );
|
||||
graphicsState.bindings = { currentBindingSet };
|
||||
|
||||
bool stateValid = false;
|
||||
|
@ -553,12 +553,12 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
{
|
||||
assert( drawSurf->shadowVolumeState == SHADOWVOLUME_UNFINISHED || drawSurf->shadowVolumeState == SHADOWVOLUME_DONE );
|
||||
|
||||
uint64 start = Sys_Microseconds( );
|
||||
uint64 start = Sys_Microseconds();
|
||||
while( drawSurf->shadowVolumeState == SHADOWVOLUME_UNFINISHED )
|
||||
{
|
||||
Sys_Yield( );
|
||||
Sys_Yield();
|
||||
}
|
||||
uint64 end = Sys_Microseconds( );
|
||||
uint64 end = Sys_Microseconds();
|
||||
|
||||
// TODO(Stephen): will probably need to change this if we're going to make this multi-threaded.
|
||||
tr.backend.pc.cpuShadowMicroSec += end - start;
|
||||
|
@ -624,13 +624,13 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
if( shader && shader->TestMaterialFlag( MF_POLYGONOFFSET ) )
|
||||
{
|
||||
surfGLState |= GLS_POLYGON_OFFSET;
|
||||
GL_PolygonOffset( r_offsetFactor.GetFloat( ), r_offsetUnits.GetFloat( ) * shader->GetPolygonOffset( ) );
|
||||
GL_PolygonOffset( r_offsetFactor.GetFloat(), r_offsetUnits.GetFloat() * shader->GetPolygonOffset() );
|
||||
}
|
||||
|
||||
if( shader && shader->Coverage( ) == MC_PERFORATED )
|
||||
if( shader && shader->Coverage() == MC_PERFORATED )
|
||||
{
|
||||
// perforated surfaces may have multiple alpha tested stages
|
||||
for( int stage = 0; stage < shader->GetNumStages( ); stage++ )
|
||||
for( int stage = 0; stage < shader->GetNumStages(); stage++ )
|
||||
{
|
||||
const shaderStage_t* pStage = shader->GetStage( stage );
|
||||
|
||||
|
@ -663,7 +663,7 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
// set privatePolygonOffset if necessary
|
||||
if( pStage->privatePolygonOffset )
|
||||
{
|
||||
GL_PolygonOffset( r_offsetFactor.GetFloat( ), r_offsetUnits.GetFloat( ) * pStage->privatePolygonOffset );
|
||||
GL_PolygonOffset( r_offsetFactor.GetFloat(), r_offsetUnits.GetFloat() * pStage->privatePolygonOffset );
|
||||
stageGLState |= GLS_POLYGON_OFFSET;
|
||||
}
|
||||
|
||||
|
@ -671,15 +671,15 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
|
||||
GL_State( stageGLState );
|
||||
idVec4 alphaTestValue( regs[pStage->alphaTestRegister] );
|
||||
renderProgManager.SetRenderParm( RENDERPARM_ALPHA_TEST, alphaTestValue.ToFloatPtr( ) );
|
||||
renderProgManager.SetRenderParm( RENDERPARM_ALPHA_TEST, alphaTestValue.ToFloatPtr() );
|
||||
|
||||
if( drawSurf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_TextureVertexColorSkinned( );
|
||||
renderProgManager.BindShader_TextureVertexColorSkinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_TextureVertexColor( );
|
||||
renderProgManager.BindShader_TextureVertexColor();
|
||||
}
|
||||
|
||||
RB_SetVertexColorParms( SVC_IGNORE );
|
||||
|
@ -695,9 +695,9 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
|
||||
if( imageChanged )
|
||||
{
|
||||
auto bindingSetDesc = nvrhi::BindingSetDesc( )
|
||||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )imageParms[0]->GetTextureID( ) ) )
|
||||
auto bindingSetDesc = nvrhi::BindingSetDesc()
|
||||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )imageParms[0]->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )imageParms[0]->GetSampler( samplerCache ) ) );
|
||||
|
||||
auto currentBindingSet = bindingCache.GetOrCreateBindingSet( bindingSetDesc, renderProgManager.BindingLayout() );
|
||||
|
@ -708,7 +708,7 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
}
|
||||
|
||||
// must render with less-equal for Z-Cull to work properly
|
||||
assert( ( GL_GetCurrentState( ) & GLS_DEPTHFUNC_BITS ) == GLS_DEPTHFUNC_LESS );
|
||||
assert( ( GL_GetCurrentState() & GLS_DEPTHFUNC_BITS ) == GLS_DEPTHFUNC_LESS );
|
||||
|
||||
SetupInputBuffers( drawSurf, graphicsState );
|
||||
|
||||
|
@ -736,7 +736,7 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
// unset privatePolygonOffset if necessary
|
||||
if( pStage->privatePolygonOffset )
|
||||
{
|
||||
GL_PolygonOffset( r_offsetFactor.GetFloat( ), r_offsetUnits.GetFloat( ) * shader->GetPolygonOffset( ) );
|
||||
GL_PolygonOffset( r_offsetFactor.GetFloat(), r_offsetUnits.GetFloat() * shader->GetPolygonOffset() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -745,15 +745,15 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
{
|
||||
if( drawSurf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_DepthSkinned( );
|
||||
renderProgManager.BindShader_DepthSkinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_Depth( );
|
||||
renderProgManager.BindShader_Depth();
|
||||
}
|
||||
|
||||
// must render with less-equal for Z-Cull to work properly
|
||||
assert( ( GL_GetCurrentState( ) & GLS_DEPTHFUNC_BITS ) == GLS_DEPTHFUNC_LESS );
|
||||
assert( ( GL_GetCurrentState() & GLS_DEPTHFUNC_BITS ) == GLS_DEPTHFUNC_LESS );
|
||||
|
||||
SetupInputBuffers( drawSurf, graphicsState );
|
||||
|
||||
|
@ -765,7 +765,7 @@ void ForwardShadingPass::ShadowMapPass( nvrhi::ICommandList* commandList, const
|
|||
|
||||
if( !pipeline )
|
||||
{
|
||||
pipeline = CreateGraphicsPipeline( currentFramebuffer->GetApiObject( ) );
|
||||
pipeline = CreateGraphicsPipeline( currentFramebuffer->GetApiObject() );
|
||||
}
|
||||
|
||||
renderProgManager.CommitConstantBuffer( commandList );
|
||||
|
@ -799,7 +799,7 @@ bool ForwardShadingPass::SetupMaterial( const idMaterial* material, nvrhi::Raste
|
|||
return false;
|
||||
}
|
||||
|
||||
assert( pipeline->getFramebufferInfo( ) == state.framebuffer->getFramebufferInfo( ) );
|
||||
assert( pipeline->getFramebufferInfo() == state.framebuffer->getFramebufferInfo() );
|
||||
|
||||
state.pipeline = pipeline;
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ class ForwardShadingPass : IGeometryPass
|
|||
{
|
||||
public:
|
||||
|
||||
ForwardShadingPass( ) = default;
|
||||
virtual ~ForwardShadingPass( ) = default;
|
||||
ForwardShadingPass() = default;
|
||||
virtual ~ForwardShadingPass() = default;
|
||||
|
||||
void Init( nvrhi::DeviceHandle deviceHandle );
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ void GBufferFillPass::Init( nvrhi::DeviceHandle deviceHandle )
|
|||
#if 0
|
||||
void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSurf_t* const* drawSurfs, int numDrawSurfs, bool fillGbuffer )
|
||||
{
|
||||
Framebuffer* previousFramebuffer = Framebuffer::GetActiveFramebuffer( );
|
||||
Framebuffer* previousFramebuffer = Framebuffer::GetActiveFramebuffer();
|
||||
|
||||
if( numDrawSurfs == 0 )
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
}
|
||||
*/
|
||||
|
||||
if( !fillGbuffer && r_useSSAO.GetBool( ) && r_ssaoDebug.GetBool( ) )
|
||||
if( !fillGbuffer && r_useSSAO.GetBool() && r_ssaoDebug.GetBool() )
|
||||
{
|
||||
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO | GLS_DEPTHMASK | GLS_DEPTHFUNC_ALWAYS );
|
||||
|
||||
|
@ -99,18 +99,18 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
currentSpace = NULL;
|
||||
RB_SetMVP( renderMatrix_identity );
|
||||
|
||||
renderProgManager.BindShader_Texture( );
|
||||
renderProgManager.BindShader_Texture();
|
||||
GL_Color( idVec4( 1 ) );
|
||||
|
||||
GL_SelectTexture( 0 );
|
||||
globalImages->ambientOcclusionImage[0]->Bind( );
|
||||
globalImages->ambientOcclusionImage[0]->Bind();
|
||||
|
||||
DrawElementsWithCounters( &tr.backend.unitSquareSurface );
|
||||
|
||||
renderProgManager.Unbind( );
|
||||
renderProgManager.Unbind();
|
||||
GL_State( GLS_DEFAULT );
|
||||
|
||||
renderProgManager.SetRenderParm( RENDERPARM_ALPHA_TEST, vec4_zero.ToFloatPtr( ) );
|
||||
renderProgManager.SetRenderParm( RENDERPARM_ALPHA_TEST, vec4_zero.ToFloatPtr() );
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -120,14 +120,14 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
|
||||
if( fillGbuffer )
|
||||
{
|
||||
globalFramebuffers.geometryBufferFBO->Bind( );
|
||||
globalFramebuffers.geometryBufferFBO->Bind();
|
||||
|
||||
GL_Clear( true, false, false, 0, 0.0f, 0.0f, 0.0f, 1.0f, false );
|
||||
}
|
||||
|
||||
commandList->setEnableAutomaticBarriers( false );
|
||||
commandList->setResourceStatesForFramebuffer( currentFrameBuffer->GetApiObject( ) );
|
||||
commandList->commitBarriers( );
|
||||
commandList->setResourceStatesForFramebuffer( currentFrameBuffer->GetApiObject() );
|
||||
commandList->commitBarriers();
|
||||
|
||||
// RB: not needed
|
||||
// GL_StartDepthPass( backEnd.viewDef->scissor );
|
||||
|
@ -168,13 +168,13 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
const float energyConservation = 0.95f;
|
||||
|
||||
//ambientColor.Set( energyConservation, energyConservation, energyConservation, 1.0f );
|
||||
float a = r_forceAmbient.GetFloat( );
|
||||
float a = r_forceAmbient.GetFloat();
|
||||
|
||||
ambientColor.Set( a, a, a, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
const float lightScale = r_lightScale.GetFloat( );
|
||||
const float lightScale = r_lightScale.GetFloat();
|
||||
const idVec4 lightColor = colorWhite * lightScale;
|
||||
|
||||
// apply the world-global overbright and tune down specular a bit so we have less fresnel overglow
|
||||
|
@ -182,21 +182,21 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
specularColor = lightColor;// * 0.5f;
|
||||
|
||||
float ambientBoost = 1.0f;
|
||||
if( !r_usePBR.GetBool( ) )
|
||||
if( !r_usePBR.GetBool() )
|
||||
{
|
||||
ambientBoost += r_useSSAO.GetBool( ) ? 0.2f : 0.0f;
|
||||
ambientBoost *= r_useHDR.GetBool( ) ? 1.1f : 1.0f;
|
||||
ambientBoost += r_useSSAO.GetBool() ? 0.2f : 0.0f;
|
||||
ambientBoost *= r_useHDR.GetBool() ? 1.1f : 1.0f;
|
||||
}
|
||||
|
||||
ambientColor.x = r_forceAmbient.GetFloat( ) * ambientBoost;
|
||||
ambientColor.y = r_forceAmbient.GetFloat( ) * ambientBoost;
|
||||
ambientColor.z = r_forceAmbient.GetFloat( ) * ambientBoost;
|
||||
ambientColor.x = r_forceAmbient.GetFloat() * ambientBoost;
|
||||
ambientColor.y = r_forceAmbient.GetFloat() * ambientBoost;
|
||||
ambientColor.z = r_forceAmbient.GetFloat() * ambientBoost;
|
||||
ambientColor.w = 1;
|
||||
}
|
||||
|
||||
renderProgManager.SetRenderParm( RENDERPARM_AMBIENT_COLOR, ambientColor.ToFloatPtr( ) );
|
||||
renderProgManager.SetRenderParm( RENDERPARM_AMBIENT_COLOR, ambientColor.ToFloatPtr() );
|
||||
|
||||
bool useIBL = r_usePBR.GetBool( ) && !fillGbuffer;
|
||||
bool useIBL = r_usePBR.GetBool() && !fillGbuffer;
|
||||
|
||||
// setup renderparms assuming we will be drawing trivial surfaces first
|
||||
RB_SetupForFastPathInteractions( diffuseColor, specularColor );
|
||||
|
@ -208,7 +208,7 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
|
||||
// translucent surfaces don't put anything in the depth buffer and don't
|
||||
// test against it, which makes them fail the mirror clip plane operation
|
||||
if( surfaceMaterial->Coverage( ) == MC_TRANSLUCENT )
|
||||
if( surfaceMaterial->Coverage() == MC_TRANSLUCENT )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
|
||||
// if all stages of a material have been conditioned off, don't do anything
|
||||
int stage = 0;
|
||||
for( ; stage < surfaceMaterial->GetNumStages( ); stage++ )
|
||||
for( ; stage < surfaceMaterial->GetNumStages(); stage++ )
|
||||
{
|
||||
const shaderStage_t* pStage = surfaceMaterial->GetStage( stage );
|
||||
// check the stage enable condition
|
||||
|
@ -227,7 +227,7 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
break;
|
||||
}
|
||||
}
|
||||
if( stage == surfaceMaterial->GetNumStages( ) )
|
||||
if( stage == surfaceMaterial->GetNumStages() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -247,11 +247,11 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
// fill geometry buffer with normal/roughness information
|
||||
if( drawSurf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_SmallGeometryBufferSkinned( );
|
||||
renderProgManager.BindShader_SmallGeometryBufferSkinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_SmallGeometryBuffer( );
|
||||
renderProgManager.BindShader_SmallGeometryBuffer();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -262,11 +262,11 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
// draw Quake 4 style ambient
|
||||
if( drawSurf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_AmbientLightingSkinned( );
|
||||
renderProgManager.BindShader_AmbientLightingSkinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_AmbientLighting( );
|
||||
renderProgManager.BindShader_AmbientLighting();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -280,8 +280,8 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
|
||||
// tranform the view origin into model local space
|
||||
idVec4 localViewOrigin( 1.0f );
|
||||
R_GlobalPointToLocal( drawSurf->space->modelMatrix, viewDef->renderView.vieworg, localViewOrigin.ToVec3( ) );
|
||||
SetVertexParm( RENDERPARM_LOCALVIEWORIGIN, localViewOrigin.ToFloatPtr( ) );
|
||||
R_GlobalPointToLocal( drawSurf->space->modelMatrix, viewDef->renderView.vieworg, localViewOrigin.ToVec3() );
|
||||
SetVertexParm( RENDERPARM_LOCALVIEWORIGIN, localViewOrigin.ToFloatPtr() );
|
||||
|
||||
// RB: if we want to store the normals in world space so we need the model -> world matrix
|
||||
idRenderMatrix modelMatrix;
|
||||
|
@ -336,21 +336,21 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
inter.specularColor[0] = inter.specularColor[1] = inter.specularColor[2] = inter.specularColor[3] = 0;
|
||||
|
||||
// check for the fast path
|
||||
if( surfaceMaterial->GetFastPathBumpImage( ) && !r_skipInteractionFastPath.GetBool( ) )
|
||||
if( surfaceMaterial->GetFastPathBumpImage() && !r_skipInteractionFastPath.GetBool() )
|
||||
{
|
||||
renderLog.OpenBlock( surfaceMaterial->GetName( ), colorMdGrey );
|
||||
renderLog.OpenBlock( surfaceMaterial->GetName(), colorMdGrey );
|
||||
|
||||
inter.bumpImage = surfaceMaterial->GetFastPathBumpImage( );
|
||||
inter.specularImage = surfaceMaterial->GetFastPathSpecularImage( );
|
||||
inter.diffuseImage = surfaceMaterial->GetFastPathDiffuseImage( );
|
||||
inter.bumpImage = surfaceMaterial->GetFastPathBumpImage();
|
||||
inter.specularImage = surfaceMaterial->GetFastPathSpecularImage();
|
||||
inter.diffuseImage = surfaceMaterial->GetFastPathDiffuseImage();
|
||||
|
||||
DrawSingleInteraction( &inter, true, useIBL, false );
|
||||
|
||||
renderLog.CloseBlock( );
|
||||
renderLog.CloseBlock();
|
||||
continue;
|
||||
}
|
||||
|
||||
renderLog.OpenBlock( surfaceMaterial->GetName( ), colorMdGrey );
|
||||
renderLog.OpenBlock( surfaceMaterial->GetName(), colorMdGrey );
|
||||
|
||||
//bool drawSolid = false;
|
||||
|
||||
|
@ -364,7 +364,7 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
bool didDraw = false;
|
||||
|
||||
// perforated surfaces may have multiple alpha tested stages
|
||||
for( stage = 0; stage < surfaceMaterial->GetNumStages( ); stage++ )
|
||||
for( stage = 0; stage < surfaceMaterial->GetNumStages(); stage++ )
|
||||
{
|
||||
const shaderStage_t* surfaceStage = surfaceMaterial->GetStage( stage );
|
||||
|
||||
|
@ -443,8 +443,8 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
|
||||
inter.diffuseImage = surfaceStage->texture.image;
|
||||
inter.vertexColor = surfaceStage->vertexColor;
|
||||
SetupInteractionStage( surfaceStage, surfaceRegs, diffuseColor.ToFloatPtr( ),
|
||||
inter.diffuseMatrix, inter.diffuseColor.ToFloatPtr( ) );
|
||||
SetupInteractionStage( surfaceStage, surfaceRegs, diffuseColor.ToFloatPtr(),
|
||||
inter.diffuseMatrix, inter.diffuseColor.ToFloatPtr() );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -475,8 +475,8 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
}
|
||||
inter.specularImage = surfaceStage->texture.image;
|
||||
inter.vertexColor = surfaceStage->vertexColor;
|
||||
SetupInteractionStage( surfaceStage, surfaceRegs, specularColor.ToFloatPtr( ),
|
||||
inter.specularMatrix, inter.specularColor.ToFloatPtr( ) );
|
||||
SetupInteractionStage( surfaceStage, surfaceRegs, specularColor.ToFloatPtr(),
|
||||
inter.specularMatrix, inter.specularColor.ToFloatPtr() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -497,12 +497,12 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
|
||||
DrawSingleInteraction( &inter, false, useIBL, false );
|
||||
|
||||
renderLog.CloseBlock( );
|
||||
renderLog.CloseBlock();
|
||||
}
|
||||
|
||||
// disable blending
|
||||
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO | GLS_DEPTHMASK | GLS_DEPTHFUNC_EQUAL );
|
||||
SetFragmentParm( RENDERPARM_ALPHA_TEST, vec4_zero.ToFloatPtr( ) );
|
||||
SetFragmentParm( RENDERPARM_ALPHA_TEST, vec4_zero.ToFloatPtr() );
|
||||
|
||||
GL_SelectTexture( 0 );
|
||||
|
||||
|
@ -511,23 +511,23 @@ void GBufferFillPass::RenderView( nvrhi::ICommandList* commandList, const drawSu
|
|||
// go back to main render target
|
||||
if( previousFramebuffer != NULL )
|
||||
{
|
||||
previousFramebuffer->Bind( );
|
||||
previousFramebuffer->Bind();
|
||||
}
|
||||
else
|
||||
{
|
||||
Framebuffer::Unbind( );
|
||||
Framebuffer::Unbind();
|
||||
}
|
||||
}
|
||||
|
||||
renderProgManager.Unbind( );
|
||||
renderProgManager.Unbind();
|
||||
|
||||
renderLog.CloseBlock( );
|
||||
renderLog.CloseMainBlock( );
|
||||
renderLog.CloseBlock();
|
||||
renderLog.CloseMainBlock();
|
||||
}
|
||||
|
||||
nvrhi::GraphicsPipelineHandle GBufferFillPass::CreateGraphicsPipeline( nvrhi::IFramebuffer* framebuffer )
|
||||
{
|
||||
return nvrhi::GraphicsPipelineHandle( );
|
||||
return nvrhi::GraphicsPipelineHandle();
|
||||
}
|
||||
|
||||
void GBufferFillPass::DrawElementsWithCounters( const drawSurf_t* surf )
|
||||
|
@ -550,7 +550,7 @@ void GBufferFillPass::DrawElementsWithCounters( const drawSurf_t* surf )
|
|||
vertexBuffer = &vertexCache.frameData[vertexCache.drawListNum].vertexBuffer;
|
||||
}
|
||||
const uint vertOffset = ( uint )( vbHandle >> VERTCACHE_OFFSET_SHIFT ) & VERTCACHE_OFFSET_MASK;
|
||||
auto currentVertexBuffer = vertexBuffer->GetAPIObject( );
|
||||
auto currentVertexBuffer = vertexBuffer->GetAPIObject();
|
||||
|
||||
// Get index buffer
|
||||
const vertCacheHandle_t ibHandle = surf->indexCache;
|
||||
|
@ -573,11 +573,11 @@ void GBufferFillPass::DrawElementsWithCounters( const drawSurf_t* surf )
|
|||
|
||||
RENDERLOG_PRINTF( "Binding Buffers: %p:%i %p:%i\n", vertexBuffer, vertOffset, indexBuffer, indexOffset );
|
||||
|
||||
auto currentIndexBuffer = ( nvrhi::IBuffer* )indexBuffer->GetAPIObject( );
|
||||
auto currentIndexBuffer = ( nvrhi::IBuffer* )indexBuffer->GetAPIObject();
|
||||
|
||||
if( currentIndexBuffer != ( nvrhi::IBuffer* )indexBuffer->GetAPIObject( ) || !r_useStateCaching.GetBool( ) )
|
||||
if( currentIndexBuffer != ( nvrhi::IBuffer* )indexBuffer->GetAPIObject() || !r_useStateCaching.GetBool() )
|
||||
{
|
||||
currentIndexBuffer = indexBuffer->GetAPIObject( );
|
||||
currentIndexBuffer = indexBuffer->GetAPIObject();
|
||||
}
|
||||
|
||||
if( !pipeline )
|
||||
|
@ -588,48 +588,48 @@ void GBufferFillPass::DrawElementsWithCounters( const drawSurf_t* surf )
|
|||
psoDesc.inputLayout = inputLayout;
|
||||
psoDesc.bindingLayouts = { currentBindingLayout };
|
||||
psoDesc.primType = nvrhi::PrimitiveType::TriangleList;
|
||||
currentRenderState.rasterState.enableScissor( );
|
||||
currentRenderState.rasterState.enableScissor();
|
||||
psoDesc.setRenderState( currentRenderState );
|
||||
|
||||
pipeline = device->createGraphicsPipeline( psoDesc, currentFramebuffer->GetApiObject( ) );
|
||||
pipeline = device->createGraphicsPipeline( psoDesc, currentFramebuffer->GetApiObject() );
|
||||
}
|
||||
|
||||
nvrhi::BindingSetDesc bindingSetDesc;
|
||||
|
||||
if( renderProgManager.BindingLayoutType( ) == BINDING_LAYOUT_DEFAULT )
|
||||
if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_DEFAULT )
|
||||
{
|
||||
bindingSetDesc
|
||||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler( ) ) );
|
||||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler() ) );
|
||||
}
|
||||
else if( renderProgManager.BindingLayoutType( ) == BINDING_LAYOUT_GBUFFER )
|
||||
else if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_GBUFFER )
|
||||
{
|
||||
bindingSetDesc
|
||||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer( ) ) );
|
||||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ) );
|
||||
}
|
||||
else if( renderProgManager.BindingLayoutType( ) == BINDING_LAYOUT_LIGHTGRID )
|
||||
else if( renderProgManager.BindingLayoutType() == BINDING_LAYOUT_LIGHTGRID )
|
||||
{
|
||||
bindingSetDesc
|
||||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 2, ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 3, ( nvrhi::ITexture* )GetImageAt( 3 )->GetTextureID( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 4, ( nvrhi::ITexture* )GetImageAt( 4 )->GetTextureID( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 7, ( nvrhi::ITexture* )GetImageAt( 7 )->GetTextureID( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 8, ( nvrhi::ITexture* )GetImageAt( 8 )->GetTextureID( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 9, ( nvrhi::ITexture* )GetImageAt( 9 )->GetTextureID( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 10, ( nvrhi::ITexture* )GetImageAt( 10 )->GetTextureID( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 1, ( nvrhi::ISampler* )GetImageAt( 1 )->GetSampler( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 2, ( nvrhi::ISampler* )GetImageAt( 2 )->GetSampler( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 3, ( nvrhi::ISampler* )GetImageAt( 3 )->GetSampler( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 4, ( nvrhi::ISampler* )GetImageAt( 4 )->GetSampler( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 7, ( nvrhi::ISampler* )GetImageAt( 7 )->GetSampler( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 8, ( nvrhi::ISampler* )GetImageAt( 8 )->GetSampler( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 9, ( nvrhi::ISampler* )GetImageAt( 9 )->GetSampler( ) ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 10, ( nvrhi::ISampler* )GetImageAt( 10 )->GetSampler( ) ) );
|
||||
.addItem( nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.ConstantBuffer() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 0, ( nvrhi::ITexture* )GetImageAt( 0 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 1, ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 2, ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 3, ( nvrhi::ITexture* )GetImageAt( 3 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 4, ( nvrhi::ITexture* )GetImageAt( 4 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 7, ( nvrhi::ITexture* )GetImageAt( 7 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 8, ( nvrhi::ITexture* )GetImageAt( 8 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 9, ( nvrhi::ITexture* )GetImageAt( 9 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Texture_SRV( 10, ( nvrhi::ITexture* )GetImageAt( 10 )->GetTextureID() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 0, ( nvrhi::ISampler* )GetImageAt( 0 )->GetSampler() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 1, ( nvrhi::ISampler* )GetImageAt( 1 )->GetSampler() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 2, ( nvrhi::ISampler* )GetImageAt( 2 )->GetSampler() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 3, ( nvrhi::ISampler* )GetImageAt( 3 )->GetSampler() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 4, ( nvrhi::ISampler* )GetImageAt( 4 )->GetSampler() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 7, ( nvrhi::ISampler* )GetImageAt( 7 )->GetSampler() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 8, ( nvrhi::ISampler* )GetImageAt( 8 )->GetSampler() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 9, ( nvrhi::ISampler* )GetImageAt( 9 )->GetSampler() ) )
|
||||
.addItem( nvrhi::BindingSetItem::Sampler( 10, ( nvrhi::ISampler* )GetImageAt( 10 )->GetSampler() ) );
|
||||
}
|
||||
|
||||
currentBindingSet = bindingCache.GetOrCreateBindingSet( bindingSetDesc, currentBindingLayout );
|
||||
|
@ -641,7 +641,7 @@ void GBufferFillPass::DrawElementsWithCounters( const drawSurf_t* surf )
|
|||
state.indexBuffer = { currentIndexBuffer, nvrhi::Format::R16_UINT, indexOffset };
|
||||
state.vertexBuffers = { { currentVertexBuffer, 0, vertOffset } };
|
||||
state.pipeline = currentPipeline;
|
||||
state.framebuffer = currentFrameBuffer->GetApiObject( );
|
||||
state.framebuffer = currentFrameBuffer->GetApiObject();
|
||||
|
||||
// TODO(Stephen): use currentViewport instead.
|
||||
nvrhi::Viewport viewport;
|
||||
|
|
|
@ -37,8 +37,8 @@ class GBufferFillPass : IGeometryPass
|
|||
{
|
||||
public:
|
||||
|
||||
GBufferFillPass( ) = default;
|
||||
virtual ~GBufferFillPass( ) = default;
|
||||
GBufferFillPass() = default;
|
||||
virtual ~GBufferFillPass() = default;
|
||||
|
||||
void Init( nvrhi::DeviceHandle deviceHandle );
|
||||
void RenderView( nvrhi::ICommandList* commandList, const drawSurf_t* const* drawSurfs, int numDrawSurfs, bool fillGbuffer );
|
||||
|
|
|
@ -107,10 +107,10 @@ static void RB_LoadShaderTextureMatrix( const float* shaderRegisters, const text
|
|||
texT[3] = matrix[3 * 4 + 1];
|
||||
|
||||
RENDERLOG_PRINTF( "Setting Texture Matrix\n" );
|
||||
renderLog.Indent( );
|
||||
renderLog.Indent();
|
||||
RENDERLOG_PRINTF( "Texture Matrix S : %4.3f, %4.3f, %4.3f, %4.3f\n", texS[0], texS[1], texS[2], texS[3] );
|
||||
RENDERLOG_PRINTF( "Texture Matrix T : %4.3f, %4.3f, %4.3f, %4.3f\n", texT[0], texT[1], texT[2], texT[3] );
|
||||
renderLog.Outdent( );
|
||||
renderLog.Outdent();
|
||||
}
|
||||
|
||||
SetVertexParm( RENDERPARM_TEXTUREMATRIX_S, texS );
|
||||
|
@ -129,23 +129,23 @@ void IGeometryPass::PrepareStageTexturing( const shaderStage_t* pStage, const dr
|
|||
{
|
||||
|
||||
// see if there is also a bump map specified
|
||||
const shaderStage_t* bumpStage = surf->material->GetBumpStage( );
|
||||
const shaderStage_t* bumpStage = surf->material->GetBumpStage();
|
||||
if( bumpStage != NULL )
|
||||
{
|
||||
// per-pixel reflection mapping with bump mapping
|
||||
GL_SelectTexture( 1 );
|
||||
bumpStage->texture.image->Bind( );
|
||||
bumpStage->texture.image->Bind();
|
||||
|
||||
GL_SelectTexture( 0 );
|
||||
|
||||
RENDERLOG_PRINTF( "TexGen: TG_REFLECT_CUBE: Bumpy Environment\n" );
|
||||
if( surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_BumpyEnvironmentSkinned( );
|
||||
renderProgManager.BindShader_BumpyEnvironmentSkinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_BumpyEnvironment( );
|
||||
renderProgManager.BindShader_BumpyEnvironment();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -153,23 +153,23 @@ void IGeometryPass::PrepareStageTexturing( const shaderStage_t* pStage, const dr
|
|||
RENDERLOG_PRINTF( "TexGen: TG_REFLECT_CUBE: Environment\n" );
|
||||
if( surf->jointCache )
|
||||
{
|
||||
renderProgManager.BindShader_EnvironmentSkinned( );
|
||||
renderProgManager.BindShader_EnvironmentSkinned();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderProgManager.BindShader_Environment( );
|
||||
renderProgManager.BindShader_Environment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if( pStage->texture.texgen == TG_SKYBOX_CUBE )
|
||||
{
|
||||
renderProgManager.BindShader_SkyBox( );
|
||||
renderProgManager.BindShader_SkyBox();
|
||||
}
|
||||
else if( pStage->texture.texgen == TG_WOBBLESKY_CUBE )
|
||||
{
|
||||
|
||||
const int* parms = surf->material->GetTexGenRegisters( );
|
||||
const int* parms = surf->material->GetTexGenRegisters();
|
||||
|
||||
float wobbleDegrees = surf->shaderRegisters[parms[0]] * ( idMath::PI / 180.0f );
|
||||
float wobbleSpeed = surf->shaderRegisters[parms[1]] * ( 2.0f * idMath::PI / 60.0f );
|
||||
|
@ -194,7 +194,7 @@ void IGeometryPass::PrepareStageTexturing( const shaderStage_t* pStage, const dr
|
|||
|
||||
// make the second vector exactly perpendicular to the first
|
||||
axis[1] -= ( axis[2] * axis[1] ) * axis[2];
|
||||
axis[1].Normalize( );
|
||||
axis[1].Normalize();
|
||||
|
||||
// construct the third with a cross
|
||||
axis[0].Cross( axis[1], axis[2] );
|
||||
|
@ -221,7 +221,7 @@ void IGeometryPass::PrepareStageTexturing( const shaderStage_t* pStage, const dr
|
|||
transform[2 * 4 + 3] = 0.0f;
|
||||
|
||||
SetVertexParms( RENDERPARM_WOBBLESKY_X, transform, 3 );
|
||||
renderProgManager.BindShader_WobbleSky( );
|
||||
renderProgManager.BindShader_WobbleSky();
|
||||
|
||||
}
|
||||
else if( ( pStage->texture.texgen == TG_SCREEN ) || ( pStage->texture.texgen == TG_SCREEN2 ) )
|
||||
|
@ -236,7 +236,7 @@ void IGeometryPass::PrepareStageTexturing( const shaderStage_t* pStage, const dr
|
|||
R_MatrixMultiply( surf->space->modelViewMatrix, viewDef->projectionMatrix, mat );
|
||||
|
||||
RENDERLOG_PRINTF( "TexGen : %s\n", ( pStage->texture.texgen == TG_SCREEN ) ? "TG_SCREEN" : "TG_SCREEN2" );
|
||||
renderLog.Indent( );
|
||||
renderLog.Indent();
|
||||
|
||||
float plane[4];
|
||||
plane[0] = mat[0 * 4 + 0];
|
||||
|
@ -260,7 +260,7 @@ void IGeometryPass::PrepareStageTexturing( const shaderStage_t* pStage, const dr
|
|||
SetVertexParm( RENDERPARM_TEXGEN_0_Q, plane );
|
||||
RENDERLOG_PRINTF( "TEXGEN_Q = %4.3f, %4.3f, %4.3f, %4.3f\n", plane[0], plane[1], plane[2], plane[3] );
|
||||
|
||||
renderLog.Outdent( );
|
||||
renderLog.Outdent();
|
||||
|
||||
}
|
||||
else if( pStage->texture.texgen == TG_DIFFUSE_CUBE )
|
||||
|
@ -289,7 +289,7 @@ void IGeometryPass::FinishStageTexturing( const shaderStage_t* stage, const draw
|
|||
if( stage->texture.texgen == TG_REFLECT_CUBE )
|
||||
{
|
||||
// see if there is also a bump map specified
|
||||
const shaderStage_t* bumpStage = surf->material->GetBumpStage( );
|
||||
const shaderStage_t* bumpStage = surf->material->GetBumpStage();
|
||||
if( bumpStage != NULL )
|
||||
{
|
||||
// per-pixel reflection mapping with bump mapping
|
||||
|
@ -299,7 +299,7 @@ void IGeometryPass::FinishStageTexturing( const shaderStage_t* stage, const draw
|
|||
{
|
||||
// per-pixel reflection mapping without bump mapping
|
||||
}
|
||||
renderProgManager.Unbind( );
|
||||
renderProgManager.Unbind();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ bool IGeometryPass::GL_State( uint64 stateBits, bool forceGlState )
|
|||
{
|
||||
uint64 diff = stateBits ^ glStateBits;
|
||||
|
||||
if( !r_useStateCaching.GetBool( ) || forceGlState )
|
||||
if( !r_useStateCaching.GetBool() || forceGlState )
|
||||
{
|
||||
// make sure everything is set all the time, so we
|
||||
// can see if our delta checking is screwing up
|
||||
|
@ -331,18 +331,18 @@ bool IGeometryPass::GL_State( uint64 stateBits, bool forceGlState )
|
|||
switch( stateBits & GLS_CULL_BITS )
|
||||
{
|
||||
case GLS_CULL_TWOSIDED:
|
||||
currentRasterState.setCullNone( );
|
||||
currentRasterState.setCullNone();
|
||||
break;
|
||||
|
||||
case GLS_CULL_BACKSIDED:
|
||||
if( viewDef != NULL && viewDef->isMirror )
|
||||
{
|
||||
stateBits |= GLS_MIRROR_VIEW;
|
||||
currentRasterState.setCullFront( );
|
||||
currentRasterState.setCullFront();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentRasterState.setCullBack( );
|
||||
currentRasterState.setCullBack();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -351,11 +351,11 @@ bool IGeometryPass::GL_State( uint64 stateBits, bool forceGlState )
|
|||
if( viewDef != NULL && viewDef->isMirror )
|
||||
{
|
||||
stateBits |= GLS_MIRROR_VIEW;
|
||||
currentRasterState.setCullBack( );
|
||||
currentRasterState.setCullBack();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentRasterState.setCullFront( );
|
||||
currentRasterState.setCullFront();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -458,13 +458,13 @@ bool IGeometryPass::GL_State( uint64 stateBits, bool forceGlState )
|
|||
// Only actually update GL's blend func if blending is enabled.
|
||||
if( srcFactor == nvrhi::BlendFactor::One && dstFactor == nvrhi::BlendFactor::Zero )
|
||||
{
|
||||
renderTarget.disableBlend( );
|
||||
renderTarget.disableBlend();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentBlendState.setAlphaToCoverageEnable( true );
|
||||
nvrhi::BlendState::RenderTarget renderTarget;
|
||||
renderTarget.enableBlend( );
|
||||
renderTarget.enableBlend();
|
||||
renderTarget.setSrcBlend( srcFactor );
|
||||
renderTarget.setDestBlend( dstFactor );
|
||||
}
|
||||
|
@ -477,13 +477,13 @@ bool IGeometryPass::GL_State( uint64 stateBits, bool forceGlState )
|
|||
{
|
||||
if( stateBits & GLS_DEPTHMASK )
|
||||
{
|
||||
currentDepthStencilState.disableDepthWrite( );
|
||||
currentDepthStencilState.disableDepthTest( );
|
||||
currentDepthStencilState.disableDepthWrite();
|
||||
currentDepthStencilState.disableDepthTest();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDepthStencilState.enableDepthWrite( );
|
||||
currentDepthStencilState.enableDepthTest( );
|
||||
currentDepthStencilState.enableDepthWrite();
|
||||
currentDepthStencilState.enableDepthTest();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -524,11 +524,11 @@ bool IGeometryPass::GL_State( uint64 stateBits, bool forceGlState )
|
|||
if( stateBits & GLS_POLYMODE_LINE )
|
||||
{
|
||||
currentRasterState.setFillMode( nvrhi::RasterFillMode::Line );
|
||||
currentRasterState.setCullNone( );
|
||||
currentRasterState.setCullNone();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentRasterState.setCullNone( );
|
||||
currentRasterState.setCullNone();
|
||||
currentRasterState.setFillMode( nvrhi::RasterFillMode::Fill );
|
||||
}
|
||||
}
|
||||
|
@ -540,11 +540,11 @@ bool IGeometryPass::GL_State( uint64 stateBits, bool forceGlState )
|
|||
{
|
||||
if( stateBits & GLS_POLYGON_OFFSET )
|
||||
{
|
||||
currentRasterState.enableQuadFill( );
|
||||
currentRasterState.enableQuadFill();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentRasterState.disableQuadFill( );
|
||||
currentRasterState.disableQuadFill();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -557,13 +557,13 @@ bool IGeometryPass::GL_State( uint64 stateBits, bool forceGlState )
|
|||
{
|
||||
if( ( stateBits & ( GLS_STENCIL_FUNC_BITS | GLS_STENCIL_OP_BITS ) ) != 0 )
|
||||
{
|
||||
currentDepthStencilState.enableStencil( );
|
||||
currentDepthStencilState.enableDepthWrite( );
|
||||
currentDepthStencilState.enableStencil();
|
||||
currentDepthStencilState.enableDepthWrite();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDepthStencilState.disableStencil( );
|
||||
//currentDepthStencilState.disableDepthWrite( );
|
||||
currentDepthStencilState.disableStencil();
|
||||
//currentDepthStencilState.disableDepthWrite();
|
||||
}
|
||||
}
|
||||
if( diff & ( GLS_STENCIL_FUNC_BITS | GLS_STENCIL_FUNC_REF_BITS | GLS_STENCIL_FUNC_MASK_BITS ) )
|
||||
|
@ -722,7 +722,7 @@ void IGeometryPass::GL_BindFramebuffer( Framebuffer* framebuffer )
|
|||
void IGeometryPass::GL_BindGraphicsShader( int shaderIndex )
|
||||
{
|
||||
nvrhi::ShaderHandle shader = renderProgManager.GetShader( shaderIndex );
|
||||
if( shader->getDesc( ).shaderType == nvrhi::ShaderType::Vertex )
|
||||
if( shader->getDesc().shaderType == nvrhi::ShaderType::Vertex )
|
||||
{
|
||||
if( pipelineDesc.VS != shader )
|
||||
{
|
||||
|
@ -732,7 +732,7 @@ void IGeometryPass::GL_BindGraphicsShader( int shaderIndex )
|
|||
pipelineDesc.setVertexShader( shader );
|
||||
}
|
||||
|
||||
if( shader->getDesc( ).shaderType == nvrhi::ShaderType::Pixel )
|
||||
if( shader->getDesc().shaderType == nvrhi::ShaderType::Pixel )
|
||||
{
|
||||
if( pipelineDesc.PS != shader )
|
||||
{
|
||||
|
@ -755,14 +755,14 @@ void IGeometryPass::GL_PolygonOffset( float scale, float bias )
|
|||
|
||||
void IGeometryPass::GL_Viewport( int x, int y, int w, int h )
|
||||
{
|
||||
currentViewport.Clear( );
|
||||
currentViewport.Clear();
|
||||
currentViewport.AddPoint( x, y );
|
||||
currentViewport.AddPoint( x + w, y + h );
|
||||
}
|
||||
|
||||
void IGeometryPass::GL_Scissor( int x, int y, int w, int h )
|
||||
{
|
||||
currentScissor.Clear( );
|
||||
currentScissor.Clear();
|
||||
currentScissor.AddPoint( x, y );
|
||||
currentScissor.AddPoint( x + w, y + h );
|
||||
}
|
||||
|
@ -793,13 +793,13 @@ void IGeometryPass::GL_ClearColor( nvrhi::ICommandList* commandList, int attachm
|
|||
{
|
||||
nvrhi::utils::ClearColorAttachment(
|
||||
commandList,
|
||||
currentFramebuffer->GetApiObject( ),
|
||||
currentFramebuffer->GetApiObject(),
|
||||
attachmentIndex,
|
||||
nvrhi::Color( clearColor.x, clearColor.y, clearColor.z, clearColor.w ) );
|
||||
}
|
||||
|
||||
void IGeometryPass::GL_ClearDepthStencil( nvrhi::ICommandList* commandList )
|
||||
{
|
||||
nvrhi::utils::ClearDepthStencilAttachment( commandList, currentFramebuffer->GetApiObject( ), depthClearValue, stencilClearValue );
|
||||
nvrhi::utils::ClearDepthStencilAttachment( commandList, currentFramebuffer->GetApiObject(), depthClearValue, stencilClearValue );
|
||||
}
|
||||
#endif
|
|
@ -36,7 +36,7 @@ constexpr std::size_t MAX_IMAGE_PARMS = 16;
|
|||
class IGeometryPass
|
||||
{
|
||||
public:
|
||||
virtual ~IGeometryPass( ) = default;
|
||||
virtual ~IGeometryPass() = default;
|
||||
|
||||
virtual void SetupView( nvrhi::ICommandList* commandList, viewDef_t* viewDef ) = 0;
|
||||
virtual bool SetupMaterial( const idMaterial* material, nvrhi::RasterCullMode cullMode, nvrhi::GraphicsState& state ) = 0;
|
||||
|
@ -83,7 +83,7 @@ protected:
|
|||
void GL_ClearColor( nvrhi::ICommandList* commandList, int attachmentIndex = 0 );
|
||||
void GL_ClearDepthStencil( nvrhi::ICommandList* commandList );
|
||||
|
||||
ID_INLINE uint64 GL_GetCurrentState( ) const
|
||||
ID_INLINE uint64 GL_GetCurrentState() const
|
||||
{
|
||||
return glStateBits;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ MipMapGenPass::MipMapGenPass(
|
|||
: m_Device( device )
|
||||
, m_Texture( input )
|
||||
, m_BindingSets( MAX_PASSES )
|
||||
, m_BindingCache( )
|
||||
, m_BindingCache()
|
||||
{
|
||||
assert( m_Texture );
|
||||
|
||||
|
@ -124,7 +124,7 @@ MipMapGenPass::MipMapGenPass(
|
|||
assert( mode >= 0 && mode <= MODE_MINMAX );
|
||||
|
||||
idList<shaderMacro_t> macros;
|
||||
macros.Append( shaderMacro_t( "MODE", std::to_string( mode ).c_str( ) ) );
|
||||
macros.Append( shaderMacro_t( "MODE", std::to_string( mode ).c_str() ) );
|
||||
int index = renderProgManager.FindShader( "builtin/mipmapgen", SHADER_STAGE_COMPUTE, "", macros, true );
|
||||
m_Shader = renderProgManager.GetShader( index );
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ void SsaoPass::CreateBindingSet(
|
|||
nvrhi::BindingSetDesc ComputeBindings;
|
||||
ComputeBindings.bindings =
|
||||
{
|
||||
nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.GetConstantBuffer( ) ),
|
||||
nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.GetConstantBuffer() ),
|
||||
nvrhi::BindingSetItem::ConstantBuffer( 1, m_ConstantBuffer ),
|
||||
nvrhi::BindingSetItem::Texture_SRV( 0, m_DeinterleavedDepth ),
|
||||
nvrhi::BindingSetItem::Texture_SRV( 1, gbufferNormals ),
|
||||
|
@ -211,7 +211,7 @@ void SsaoPass::CreateBindingSet(
|
|||
nvrhi::BindingSetDesc BlurBindings;
|
||||
BlurBindings.bindings =
|
||||
{
|
||||
nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.GetConstantBuffer( ) ),
|
||||
nvrhi::BindingSetItem::ConstantBuffer( 0, renderProgManager.GetConstantBuffer() ),
|
||||
nvrhi::BindingSetItem::ConstantBuffer( 1, m_ConstantBuffer ),
|
||||
nvrhi::BindingSetItem::Texture_SRV( 0, m_DeinterleavedDepth ),
|
||||
nvrhi::BindingSetItem::Texture_SRV( 1, m_DeinterleavedOcclusion ),
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
void GetRenderState( uint64 stateBits, PipelineKey key, nvrhi::RenderState& renderState );
|
||||
|
||||
PipelineCache::PipelineCache( )
|
||||
PipelineCache::PipelineCache()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,10 @@ void PipelineCache::Init( nvrhi::DeviceHandle deviceHandle )
|
|||
device = deviceHandle;
|
||||
}
|
||||
|
||||
void PipelineCache::Clear( )
|
||||
void PipelineCache::Clear()
|
||||
{
|
||||
pipelines.Clear( );
|
||||
pipelineHash.Clear( );
|
||||
pipelines.Clear();
|
||||
pipelineHash.Clear();
|
||||
}
|
||||
|
||||
nvrhi::GraphicsPipelineHandle PipelineCache::GetOrCreatePipeline( const PipelineKey& key )
|
||||
|
@ -42,17 +42,20 @@ nvrhi::GraphicsPipelineHandle PipelineCache::GetOrCreatePipeline( const Pipeline
|
|||
pipelineDesc.primType = nvrhi::PrimitiveType::TriangleList;
|
||||
|
||||
// Set up default state.
|
||||
pipelineDesc.renderState.rasterState.enableScissor( );
|
||||
pipelineDesc.renderState.depthStencilState.enableDepthTest( ).enableDepthWrite( );
|
||||
pipelineDesc.renderState.blendState.targets[0].enableBlend( );
|
||||
//pipelineDesc.renderState.rasterState.enableDepthClip( );
|
||||
pipelineDesc.renderState.rasterState.enableScissor();
|
||||
pipelineDesc.renderState.depthStencilState.enableDepthTest().enableDepthWrite();
|
||||
for( auto& target : pipelineDesc.renderState.blendState.targets )
|
||||
{
|
||||
target.enableBlend();
|
||||
}
|
||||
//pipelineDesc.renderState.rasterState.enableDepthClip();
|
||||
pipelineDesc.renderState.rasterState.depthBias = 0;
|
||||
pipelineDesc.renderState.rasterState.slopeScaledDepthBias = 0;
|
||||
|
||||
// Specialize the state with the state key.
|
||||
GetRenderState( key.state, key, pipelineDesc.renderState );
|
||||
|
||||
auto pipeline = device->createGraphicsPipeline( pipelineDesc, key.framebuffer->GetApiObject( ) );
|
||||
auto pipeline = device->createGraphicsPipeline( pipelineDesc, key.framebuffer->GetApiObject() );
|
||||
|
||||
pipelineHash.Add( h, pipelines.Append( { key, pipeline } ) );
|
||||
|
||||
|
@ -81,18 +84,18 @@ void GetRenderState( uint64 stateBits, PipelineKey key, nvrhi::RenderState& rend
|
|||
switch( stateBits & GLS_CULL_BITS )
|
||||
{
|
||||
case GLS_CULL_TWOSIDED:
|
||||
currentRasterState.setCullNone( );
|
||||
currentRasterState.setCullNone();
|
||||
break;
|
||||
|
||||
case GLS_CULL_BACKSIDED:
|
||||
if( key.mirrored )
|
||||
{
|
||||
stateBits |= GLS_MIRROR_VIEW;
|
||||
currentRasterState.setCullFront( );
|
||||
currentRasterState.setCullFront();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentRasterState.setCullBack( );
|
||||
currentRasterState.setCullBack();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -101,11 +104,11 @@ void GetRenderState( uint64 stateBits, PipelineKey key, nvrhi::RenderState& rend
|
|||
if( key.mirrored )
|
||||
{
|
||||
stateBits |= GLS_MIRROR_VIEW;
|
||||
currentRasterState.setCullBack( );
|
||||
currentRasterState.setCullBack();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentRasterState.setCullFront( );
|
||||
currentRasterState.setCullFront();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -208,12 +211,12 @@ void GetRenderState( uint64 stateBits, PipelineKey key, nvrhi::RenderState& rend
|
|||
// Only actually update GL's blend func if blending is enabled.
|
||||
if( srcFactor == nvrhi::BlendFactor::One && dstFactor == nvrhi::BlendFactor::Zero )
|
||||
{
|
||||
renderTarget.disableBlend( );
|
||||
renderTarget.disableBlend();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentBlendState.setAlphaToCoverageEnable( true );
|
||||
renderTarget.enableBlend( );
|
||||
renderTarget.enableBlend();
|
||||
renderTarget.setSrcBlend( srcFactor );
|
||||
renderTarget.setDestBlend( dstFactor );
|
||||
}
|
||||
|
@ -226,10 +229,10 @@ void GetRenderState( uint64 stateBits, PipelineKey key, nvrhi::RenderState& rend
|
|||
{
|
||||
if( stateBits & GLS_DEPTHMASK )
|
||||
{
|
||||
currentDepthStencilState.disableDepthWrite( );
|
||||
currentDepthStencilState.disableDepthWrite();
|
||||
if( ( stateBits & GLS_DEPTHFUNC_BITS ) == GLS_DEPTHFUNC_ALWAYS )
|
||||
{
|
||||
currentDepthStencilState.disableDepthTest( );
|
||||
currentDepthStencilState.disableDepthTest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +261,7 @@ void GetRenderState( uint64 stateBits, PipelineKey key, nvrhi::RenderState& rend
|
|||
mask = mask & ~nvrhi::ColorMask::Alpha;
|
||||
}
|
||||
|
||||
renderTarget.enableBlend( );
|
||||
renderTarget.enableBlend();
|
||||
renderTarget.setColorWriteMask( mask );
|
||||
}
|
||||
|
||||
|
@ -272,11 +275,11 @@ void GetRenderState( uint64 stateBits, PipelineKey key, nvrhi::RenderState& rend
|
|||
if( stateBits & GLS_POLYMODE_LINE )
|
||||
{
|
||||
currentRasterState.setFillMode( nvrhi::RasterFillMode::Wireframe );
|
||||
//currentRasterState.setCullNone( );
|
||||
//currentRasterState.setCullNone();
|
||||
}
|
||||
else
|
||||
{
|
||||
//currentRasterState.setCullNone( );
|
||||
//currentRasterState.setCullNone();
|
||||
currentRasterState.setFillMode( nvrhi::RasterFillMode::Solid );
|
||||
}
|
||||
}
|
||||
|
@ -307,13 +310,13 @@ void GetRenderState( uint64 stateBits, PipelineKey key, nvrhi::RenderState& rend
|
|||
{
|
||||
if( ( stateBits & ( GLS_STENCIL_FUNC_BITS | GLS_STENCIL_OP_BITS ) ) != 0 )
|
||||
{
|
||||
currentDepthStencilState.enableStencil( );
|
||||
//currentDepthStencilState.enableDepthWrite( );
|
||||
currentDepthStencilState.enableStencil();
|
||||
//currentDepthStencilState.enableDepthWrite();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDepthStencilState.disableStencil( );
|
||||
//currentDepthStencilState.disableDepthWrite( );
|
||||
currentDepthStencilState.disableStencil();
|
||||
//currentDepthStencilState.disableDepthWrite();
|
||||
}
|
||||
}
|
||||
if( diff & ( GLS_STENCIL_FUNC_BITS | GLS_STENCIL_FUNC_REF_BITS | GLS_STENCIL_FUNC_MASK_BITS ) )
|
||||
|
|
|
@ -43,11 +43,11 @@ class PipelineCache
|
|||
{
|
||||
public:
|
||||
|
||||
PipelineCache( );
|
||||
PipelineCache();
|
||||
|
||||
void Init( nvrhi::DeviceHandle deviceHandle );
|
||||
|
||||
void Clear( );
|
||||
void Clear();
|
||||
|
||||
nvrhi::GraphicsPipelineHandle GetOrCreatePipeline( const PipelineKey& key );
|
||||
|
||||
|
|
|
@ -2244,7 +2244,7 @@ void idRenderBackend::AmbientPass( const drawSurf_t* const* drawSurfs, int numDr
|
|||
|
||||
if( fillGbuffer )
|
||||
{
|
||||
commandList->clearTextureFloat( globalImages->currentNormalsImage->GetTextureHandle( ), nvrhi::AllSubresources, nvrhi::Color( 0.f ) );
|
||||
commandList->clearTextureFloat( globalImages->currentNormalsImage->GetTextureHandle(), nvrhi::AllSubresources, nvrhi::Color( 0.f ) );
|
||||
}
|
||||
|
||||
if( !fillGbuffer && r_useSSAO.GetBool() && r_ssaoDebug.GetBool() )
|
||||
|
@ -3430,8 +3430,6 @@ void idRenderBackend::ShadowMapPass( const drawSurf_t* drawSurfs, const viewLigh
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
// FIXME
|
||||
#if defined( USE_NVRHI )
|
||||
if( side < 0 )
|
||||
{
|
||||
|
@ -4830,8 +4828,6 @@ void idRenderBackend::Tonemap( const viewDef_t* _viewDef )
|
|||
|
||||
renderLog.OpenBlock( "Tonemap" );
|
||||
|
||||
commandList->beginMarker( "Tonemap" );
|
||||
|
||||
//postProcessCommand_t* cmd = ( postProcessCommand_t* )data;
|
||||
//const idScreenRect& viewport = cmd->viewDef->viewport;
|
||||
//globalImages->currentRenderImage->CopyFramebuffer( viewport.x1, viewport.y1, viewport.GetWidth(), viewport.GetHeight() );
|
||||
|
@ -4919,7 +4915,6 @@ void idRenderBackend::Tonemap( const viewDef_t* _viewDef )
|
|||
|
||||
GL_State( GLS_DEFAULT );
|
||||
|
||||
commandList->endMarker();
|
||||
renderLog.CloseBlock();
|
||||
}
|
||||
|
||||
|
@ -4982,8 +4977,8 @@ void idRenderBackend::Bloom( const viewDef_t* _viewDef )
|
|||
globalImages->currentRenderImage->CopyFramebuffer( x, y, w, h );
|
||||
commonPasses.BlitTexture(
|
||||
commandList,
|
||||
globalFramebuffers.bloomRenderFBO[0]->GetApiObject( ),
|
||||
globalImages->currentRenderLDR->GetTextureHandle( ),
|
||||
globalFramebuffers.bloomRenderFBO[0]->GetApiObject(),
|
||||
globalImages->currentRenderLDR->GetTextureHandle(),
|
||||
&bindingCache );
|
||||
|
||||
renderProgManager.BindShader_Brightpass();
|
||||
|
@ -5036,7 +5031,7 @@ void idRenderBackend::Bloom( const viewDef_t* _viewDef )
|
|||
int index = ( j + 1 ) % 2;
|
||||
globalFramebuffers.bloomRenderFBO[ index ]->Bind();
|
||||
|
||||
#if defined( USE_NHRI )
|
||||
#if defined( USE_NVRHI )
|
||||
commandList->clearTextureFloat( globalImages->bloomRenderImage[index]->GetTextureHandle(), nvrhi::AllSubresources, nvrhi::Color( 0.f, 0.f, 0.f, 1.f ) );
|
||||
#elif !defined( USE_VULKAN )
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
@ -5048,7 +5043,7 @@ void idRenderBackend::Bloom( const viewDef_t* _viewDef )
|
|||
}
|
||||
|
||||
// add filtered glare back to main context
|
||||
globalFramebuffers.ldrFBO->Bind( );
|
||||
globalFramebuffers.ldrFBO->Bind();
|
||||
|
||||
ResetViewportAndScissorToDefaultCamera( _viewDef );
|
||||
|
||||
|
@ -5439,7 +5434,7 @@ void idRenderBackend::DrawScreenSpaceAmbientOcclusion2( const viewDef_t* _viewDe
|
|||
return;
|
||||
}
|
||||
|
||||
if( r_useSSAO.GetInteger( ) <= 0 || r_useSSAO.GetInteger( ) < 2 )
|
||||
if( r_useSSAO.GetInteger() <= 0 || r_useSSAO.GetInteger() < 2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -290,6 +290,7 @@ private:
|
|||
void DrawFlickerBox();
|
||||
|
||||
void DrawElementsWithCounters( const drawSurf_t* surf );
|
||||
void GetCurrentBindingLayout( nvrhi::BindingSetDesc& bindingSetDesc );
|
||||
void DrawStencilShadowPass( const drawSurf_t* drawSurf, const bool renderZPass );
|
||||
|
||||
void SetColorMappings();
|
||||
|
@ -501,10 +502,10 @@ private:
|
|||
|
||||
idScreenRect currentViewport;
|
||||
nvrhi::BufferHandle currentVertexBuffer;
|
||||
int currentVertexOffset;
|
||||
uint currentVertexOffset;
|
||||
nvrhi::BufferHandle currentIndexBuffer;
|
||||
int currentIndexOffset;
|
||||
//nvrhi::BindingSetHandle currentBindingSet;
|
||||
uint currentIndexOffset;
|
||||
nvrhi::BindingSetHandle currentBindingSet;
|
||||
nvrhi::BindingLayoutHandle currentBindingLayout;
|
||||
nvrhi::GraphicsPipelineHandle currentPipeline;
|
||||
nvrhi::RenderState currentRenderState;
|
||||
|
|
|
@ -848,6 +848,7 @@ enum bindingLayoutType_t
|
|||
BINDING_LAYOUT_DRAW_INTERACTION_SM,
|
||||
BINDING_LAYOUT_DRAW_FOG,
|
||||
BINDING_LAYOUT_POST_PROCESS_CNM,
|
||||
BINDING_LAYOUT_NORMAL_CUBE,
|
||||
BINDING_LAYOUT_TONEMAP,
|
||||
BINDING_LAYOUT_HISTOGRAM,
|
||||
BINDING_LAYOUT_EXPOSURE,
|
||||
|
|
|
@ -191,15 +191,10 @@ void idRenderProgManager::Init( nvrhi::IDevice* _device )
|
|||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 8 ) ) // radiance cube map 1
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 9 ) ) // radiance cube map 2
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 10 ) ) // radiance cube map 3
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) ) // normal sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 1 ) ) // specular sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 2 ) ) // base color sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 3 ) ) // brdf lut sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 4 ) ) // ssao sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 7 ) ) // irradiance sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 8 ) ) // radiance sampler 1
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 9 ) ) // radiance sampler 2
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 10 ) ); // radiance sampler 3
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) ) // (Wrap) Anisotropic sampler: normal sampler & specular sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 1 ) ) // (Wrap) Point sampler: base color sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 2 ) ) // (Clamp) Linear sampler: brdf lut sampler & ssao sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 3 ) ); // (Clamp) Anisotropic sampler: irradiance, radiance 1, 2 and 3.
|
||||
|
||||
bindingLayouts[BINDING_LAYOUT_AMBIENT_LIGHTING_IBL] = device->createBindingLayout( ambientIblLayoutDesc );
|
||||
|
||||
|
@ -232,16 +227,13 @@ void idRenderProgManager::Init( nvrhi::IDevice* _device )
|
|||
auto interactionBindingLayout = nvrhi::BindingLayoutDesc()
|
||||
.setVisibility( nvrhi::ShaderType::All )
|
||||
.addItem( nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ) )
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ) // normal
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 1 ) ) // specular
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 2 ) ) // base color
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 3 ) ) // light falloff
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 4 ) ) // light projection
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) )
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 1 ) )
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 2 ) )
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 3 ) )
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 4 ) );
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ) // normal
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 1 ) ) // specular
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 2 ) ) // base color
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 3 ) ) // light falloff
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 4 ) ) // light projection
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) ) // Linear wrap sampler for the normal/specular/color
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 1 ) ); // Sampler for the light falloff/projection
|
||||
|
||||
bindingLayouts[BINDING_LAYOUT_DRAW_INTERACTION] = device->createBindingLayout( interactionBindingLayout );
|
||||
|
||||
|
@ -277,10 +269,19 @@ void idRenderProgManager::Init( nvrhi::IDevice* _device )
|
|||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ) // current render
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 1 ) ) // normal map
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 2 ) ) // mask
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) ); // Linear sampler
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) ); // Linear sampler
|
||||
|
||||
bindingLayouts[BINDING_LAYOUT_POST_PROCESS_CNM] = device->createBindingLayout( ppFxBindingLayout );
|
||||
|
||||
auto normalCubeBindingLayout = nvrhi::BindingLayoutDesc()
|
||||
.setVisibility( nvrhi::ShaderType::All )
|
||||
.addItem( nvrhi::BindingLayoutItem::VolatileConstantBuffer( 0 ) )
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ) // cube map
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 1 ) ) // normal map
|
||||
.addItem( nvrhi::BindingLayoutItem::Sampler( 0 ) ); // Linear sampler
|
||||
|
||||
bindingLayouts[BINDING_LAYOUT_NORMAL_CUBE] = device->createBindingLayout( normalCubeBindingLayout );
|
||||
|
||||
nvrhi::BindingLayoutDesc tonemapLayout;
|
||||
tonemapLayout.visibility = nvrhi::ShaderType::Pixel;
|
||||
tonemapLayout.bindings =
|
||||
|
|
|
@ -1047,9 +1047,7 @@ private:
|
|||
nvrhi::BindingSetHandle bindingSet;
|
||||
renderProg_t* currentShader;
|
||||
|
||||
#else
|
||||
|
||||
#if defined(USE_VULKAN)
|
||||
#elif defined(USE_VULKAN)
|
||||
struct shader_t
|
||||
{
|
||||
shader_t() :
|
||||
|
@ -1152,7 +1150,6 @@ private:
|
|||
int vertexShaderIndex;
|
||||
int fragmentShaderIndex;
|
||||
};
|
||||
#endif
|
||||
|
||||
void LoadShader( shader_t& shader );
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
|
||||
// *INDENT-OFF*
|
||||
#if TEXTURE_ARRAY
|
||||
Texture2DArray tex : register(t0);
|
||||
Texture2DArray tex : register( t0 );
|
||||
#else
|
||||
Texture2D tex : register(t0);
|
||||
Texture2D tex : register( t0 );
|
||||
#endif
|
||||
SamplerState samp : register(s0);
|
||||
SamplerState samp : register( s0 );
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
|
|
|
@ -39,7 +39,8 @@ struct PS_IN {
|
|||
float4 color : COLOR0;
|
||||
};
|
||||
|
||||
struct PS_OUT {
|
||||
struct PS_OUT
|
||||
{
|
||||
float4 color : SV_Target0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
|
|
@ -37,7 +37,8 @@ struct VS_IN {
|
|||
float4 color2 : COLOR1;
|
||||
};
|
||||
|
||||
struct VS_OUT {
|
||||
struct VS_OUT
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float2 texcoord0 : TEXCOORD0_centroid;
|
||||
float4 texcoord1 : TEXCOORD1;
|
||||
|
|
|
@ -31,11 +31,10 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
// *INDENT-OFF*
|
||||
TextureCube t_CubeMap : register( t0 );
|
||||
Texture2D t_NormalMap : register( t1 );
|
||||
TextureCube t_CubeMap : register(t0);
|
||||
Texture2D t_NormalMap : register(t1);
|
||||
|
||||
SamplerState samp0 : register(s0); // texture 0 is the cube map
|
||||
SamplerState samp1 : register(s1); // normal map
|
||||
|
||||
struct PS_IN {
|
||||
float4 position : VPOS;
|
||||
|
@ -55,7 +54,7 @@ struct PS_OUT {
|
|||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
float4 bump = t_NormalMap.Sample( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;
|
||||
float4 bump = t_NormalMap.Sample( samp0, fragment.texcoord0 ) * 2.0f - 1.0f;
|
||||
// RB begin
|
||||
float3 localNormal;
|
||||
#if defined(USE_NORMAL_FMT_RGB8)
|
||||
|
|
|
@ -49,12 +49,12 @@ struct VS_IN {
|
|||
};
|
||||
|
||||
struct VS_OUT {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
float3 texcoord1 : TEXCOORD1;
|
||||
float3 texcoord2 : TEXCOORD2;
|
||||
float3 texcoord3 : TEXCOORD3;
|
||||
float3 texcoord4 : TEXCOORD4;
|
||||
float4 position : SV_Position;
|
||||
float2 texcoord0 : TEXCOORD0_centroid;
|
||||
float3 texcoord1 : TEXCOORD1_centroid;
|
||||
float3 texcoord2 : TEXCOORD2_centroid;
|
||||
float3 texcoord3 : TEXCOORD3_centroid;
|
||||
float3 texcoord4 : TEXCOORD4_centroid;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
|
|
@ -31,11 +31,13 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
|
||||
uniform sampler2D samp1 : register(s1); // normal map
|
||||
TextureCube t_CubeMap : register( t0 );
|
||||
Texture2D t_NormalMap : register( t1 );
|
||||
|
||||
SamplerState samp0 : register( s0 );
|
||||
|
||||
struct PS_IN {
|
||||
float4 position : VPOS;
|
||||
float4 position : SV_Position;
|
||||
float2 texcoord0 : TEXCOORD0_centroid;
|
||||
float3 texcoord1 : TEXCOORD1_centroid;
|
||||
float3 texcoord2 : TEXCOORD2_centroid;
|
||||
|
@ -45,14 +47,13 @@ struct PS_IN {
|
|||
};
|
||||
|
||||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
float4 color : SV_Target0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;
|
||||
float4 bump = t_NormalMap.Sample( samp0, fragment.texcoord0 ) * 2.0f - 1.0f;
|
||||
|
||||
// RB begin
|
||||
float3 localNormal;
|
||||
|
@ -74,7 +75,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal );
|
||||
reflectionVector = ( reflectionVector * 2.0f ) - globalEye;
|
||||
|
||||
float4 envMap = texCUBE( samp0, reflectionVector );
|
||||
float4 envMap = t_CubeMap.Sample( samp0, reflectionVector );
|
||||
|
||||
result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;
|
||||
}
|
||||
|
|
|
@ -29,13 +29,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "global_inc.hlsl"
|
||||
|
||||
#if USE_GPU_SKINNING
|
||||
|
||||
cbuffer CB :
|
||||
register( b1 )
|
||||
{
|
||||
float4 matrices[408];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// *INDENT-OFF*
|
||||
|
|
|
@ -44,16 +44,10 @@ Texture2D t_RadianceCubeMap1 : register( t8 );
|
|||
Texture2D t_RadianceCubeMap2 : register( t9 );
|
||||
Texture2D t_RadianceCubeMap3 : register( t10 );
|
||||
|
||||
SamplerState samp0 : register(s0); // texture 0 is the per-surface normal map
|
||||
SamplerState samp1 : register(s1); // texture 1 is the per-surface specular or roughness/metallic/AO mixer map
|
||||
SamplerState samp2 : register(s2); // texture 2 is the per-surface baseColor map
|
||||
SamplerState samp3 : register(s3); // texture 3 is the BRDF LUT
|
||||
SamplerState samp4 : register(s4); // texture 4 is SSAO
|
||||
|
||||
SamplerState samp7 : register(s7); // texture 7 is the irradiance cube map
|
||||
SamplerState samp8 : register(s8); // texture 8 is the radiance cube map 1
|
||||
SamplerState samp9 : register(s9); // texture 9 is the radiance cube map 2
|
||||
SamplerState samp10 : register(s10); // texture 10 is the radiance cube map 3
|
||||
SamplerState samp0 : register( s0 ); // (Wrap) Anisotropic sampler: normal sampler & specular sampler
|
||||
SamplerState samp1 : register( s1 ); // (Wrap) Point sampler: base color sampler
|
||||
SamplerState samp2 : register( s2 ); // (Clamp) Linear sampler: brdf lut sampler & ssao sampler
|
||||
SamplerState samp3 : register( s3 ); // (Clamp) Anisotropic sampler: irradiance, radiance 1, 2 and 3.
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
|
@ -135,8 +129,8 @@ bool AABBRayIntersection( float3 b[2], float3 start, float3 dir, out float scale
|
|||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
half4 bumpMap = t_Normal.Sample( samp0, fragment.texcoord0.xy );
|
||||
half4 YCoCG = t_BaseColor.Sample( samp2, fragment.texcoord1.xy );
|
||||
half4 specMapSRGB = t_Specular.Sample( samp1, fragment.texcoord2.xy );
|
||||
half4 YCoCG = t_BaseColor.Sample( samp1, fragment.texcoord1.xy );
|
||||
half4 specMapSRGB = t_Specular.Sample( samp0, fragment.texcoord2.xy );
|
||||
half4 specMap = sRGBAToLinearRGBA( specMapSRGB );
|
||||
|
||||
half3 diffuseMap = sRGBToLinearRGB( ConvertYCoCgToRGB( YCoCG ) );
|
||||
|
@ -244,7 +238,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
float2 screenTexCoord = fragment.position.xy * rpWindowCoord.xy;
|
||||
|
||||
float ao = 1.0;
|
||||
ao = t_Ssao.Sample( samp4, screenTexCoord ).r;
|
||||
ao = t_Ssao.Sample( samp2, screenTexCoord ).r;
|
||||
|
||||
//diffuseColor.rgb *= ao;
|
||||
|
||||
|
@ -372,7 +366,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
float2 atlasCoord = normalizedOctCoordZeroOne + atlasOffset;
|
||||
#endif
|
||||
|
||||
float3 color = t_IrradianceCubeMap.Sample( samp7, atlasCoord, 0 ).rgb;
|
||||
float3 color = t_IrradianceCubeMap.Sample( samp3, atlasCoord, 0 ).rgb;
|
||||
|
||||
if( ( color.r + color.g + color.b ) < 0.0001 )
|
||||
{
|
||||
|
@ -408,9 +402,9 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
normalizedOctCoord = octEncode( reflectionVector );
|
||||
normalizedOctCoordZeroOne = ( normalizedOctCoord + float2( 1.0, 1.0 ) ) * 0.5;
|
||||
|
||||
float3 radiance = t_RadianceCubeMap1.SampleLevel( samp8, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.x;
|
||||
radiance += t_RadianceCubeMap2.SampleLevel( samp9, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.y;
|
||||
radiance += t_RadianceCubeMap3.SampleLevel( samp10, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.z;
|
||||
float3 radiance = t_RadianceCubeMap1.SampleLevel( samp3, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.x;
|
||||
radiance += t_RadianceCubeMap2.SampleLevel( samp3, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.y;
|
||||
radiance += t_RadianceCubeMap3.SampleLevel( samp3, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.z;
|
||||
//radiance = float3( 0.0 );
|
||||
|
||||
// RB: HACK dim down room radiance by better local irradiance brightness
|
||||
|
@ -419,7 +413,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
//float luma = length( irradiance.rgb );
|
||||
//radiance *= ( luma * rpSpecularModifier.x * 3.0 );
|
||||
|
||||
float2 envBRDF = t_BrdfLut.Sample( samp3, float2( max( vDotN, 0.0 ), roughness ) ).rg;
|
||||
float2 envBRDF = t_BrdfLut.Sample( samp2, float2( max( vDotN, 0.0 ), roughness ) ).rg;
|
||||
|
||||
#if 0
|
||||
result.color.rgb = float3( envBRDF.x, envBRDF.y, 0.0 );
|
||||
|
|
|
@ -44,16 +44,10 @@ Texture2D t_RadianceCubeMap1 : register( t8 );
|
|||
Texture2D t_RadianceCubeMap2 : register( t9 );
|
||||
Texture2D t_RadianceCubeMap3 : register( t10 );
|
||||
|
||||
SamplerState samp0 : register(s0); // texture 0 is the per-surface normal map
|
||||
SamplerState samp1 : register(s1); // texture 1 is the per-surface specular or roughness/metallic/AO mixer map
|
||||
SamplerState samp2 : register(s2); // texture 2 is the per-surface baseColor map
|
||||
SamplerState samp3 : register(s3); // texture 3 is the BRDF LUT
|
||||
SamplerState samp4 : register(s4); // texture 4 is SSAO
|
||||
|
||||
SamplerState samp7 : register(s7); // texture 7 is the irradiance cube map
|
||||
SamplerState samp8 : register(s8); // texture 8 is the radiance cube map 1
|
||||
SamplerState samp9 : register(s9); // texture 9 is the radiance cube map 2
|
||||
SamplerState samp10 : register(s10); // texture 10 is the radiance cube map 3
|
||||
SamplerState samp0 : register(s0); // (Wrap) Anisotropic sampler: normal sampler & specular sampler
|
||||
SamplerState samp1 : register(s1); // (Wrap) Point sampler: base color sampler
|
||||
SamplerState samp2 : register(s2); // (Clamp) Linear sampler: brdf lut sampler & ssao sampler
|
||||
SamplerState samp3 : register(s3); // (Clamp) Anisotropic sampler: irradiance, radiance 1, 2 and 3.
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
|
@ -155,8 +149,8 @@ float2 OctTexCoord( float3 worldDir )
|
|||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
half4 bumpMap = t_Normal.Sample( samp0, fragment.texcoord0.xy );
|
||||
half4 YCoCG = t_BaseColor.Sample( samp2, fragment.texcoord1.xy );
|
||||
half4 specMapSRGB = t_Specular.Sample( samp1, fragment.texcoord2.xy );
|
||||
half4 YCoCG = t_BaseColor.Sample( samp1, fragment.texcoord1.xy );
|
||||
half4 specMapSRGB = t_Specular.Sample( samp0, fragment.texcoord2.xy );
|
||||
half4 specMap = sRGBAToLinearRGBA( specMapSRGB );
|
||||
|
||||
half3 diffuseMap = sRGBToLinearRGB( ConvertYCoCgToRGB( YCoCG ) );
|
||||
|
@ -264,14 +258,14 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
float2 screenTexCoord = fragment.position.xy * rpWindowCoord.xy;
|
||||
|
||||
float ao = 1.0;
|
||||
ao = t_Ssao.Sample( samp4, screenTexCoord ).r;
|
||||
ao = t_Ssao.Sample( samp2, screenTexCoord ).r;
|
||||
//diffuseColor.rgb *= ao;
|
||||
|
||||
// evaluate diffuse IBL
|
||||
|
||||
float2 normalizedOctCoordZeroOne = OctTexCoord( globalNormal );
|
||||
|
||||
float3 irradiance = t_IrradianceCubeMap.Sample( samp7, normalizedOctCoordZeroOne ).rgb;
|
||||
float3 irradiance = t_IrradianceCubeMap.Sample( samp2, normalizedOctCoordZeroOne ).rgb;
|
||||
float3 diffuseLight = ( kD * irradiance * diffuseColor ) * ao * ( rpDiffuseModifier.xyz * 1.0 );
|
||||
|
||||
// evaluate specular IBL
|
||||
|
@ -285,12 +279,12 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
|
||||
normalizedOctCoordZeroOne = OctTexCoord( reflectionVector );
|
||||
|
||||
float3 radiance = t_RadianceCubeMap1.SampleLevel( samp8, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.x;
|
||||
radiance += t_RadianceCubeMap2.SampleLevel( samp9, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.y;
|
||||
radiance += t_RadianceCubeMap3.SampleLevel( samp10, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.z;
|
||||
float3 radiance = t_RadianceCubeMap1.SampleLevel( samp3, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.x;
|
||||
radiance += t_RadianceCubeMap2.SampleLevel( samp3, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.y;
|
||||
radiance += t_RadianceCubeMap3.SampleLevel( samp3, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.z;
|
||||
//radiance = float3( 0.0 );
|
||||
|
||||
float2 envBRDF = t_BrdfLut.SampleLevel( samp3, float2( max( vDotN, 0.0 ), roughness ), 0 ).rg;
|
||||
float2 envBRDF = t_BrdfLut.SampleLevel( samp2, float2( max( vDotN, 0.0 ), roughness ), 0 ).rg;
|
||||
|
||||
#if 0
|
||||
result.color.rgb = float3( envBRDF.x, envBRDF.y, 0.0 );
|
||||
|
|
|
@ -39,11 +39,8 @@ Texture2D t_BaseColor : register( t2 );
|
|||
Texture2D t_LightFalloff : register( t3 );
|
||||
Texture2D t_LightProjection : register( t4 );
|
||||
|
||||
SamplerState samp0 : register(s0); // texture 1 is the per-surface normal map
|
||||
SamplerState samp1 : register(s1); // texture 3 is the per-surface specular or roughness/metallic/AO mixer map
|
||||
SamplerState samp2 : register(s2); // texture 2 is the per-surface baseColor map
|
||||
SamplerState samp3 : register(s3); // texture 4 is the light falloff texture
|
||||
SamplerState samp4 : register(s4); // texture 5 is the light projection texture
|
||||
SamplerState AnisotropicWrapSampler : register(s0);
|
||||
SamplerState LinearClampSampler : register( s1 );
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
|
@ -66,11 +63,11 @@ struct PS_OUT
|
|||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
half4 bumpMap = t_Normal.Sample( samp0, fragment.texcoord1.xy );
|
||||
half4 lightFalloff = idtex2Dproj( samp3, t_LightFalloff, fragment.texcoord2 );
|
||||
half4 lightProj = idtex2Dproj( samp4, t_LightProjection, fragment.texcoord3 );
|
||||
half4 YCoCG = t_BaseColor.Sample( samp2, fragment.texcoord4.xy );
|
||||
half4 specMapSRGB = t_Specular.Sample( samp1, fragment.texcoord5.xy );
|
||||
half4 bumpMap = t_Normal.Sample( AnisotropicWrapSampler, fragment.texcoord1.xy );
|
||||
half4 lightFalloff = idtex2Dproj( LinearClampSampler, t_LightFalloff, fragment.texcoord2 );
|
||||
half4 lightProj = idtex2Dproj( LinearClampSampler, t_LightProjection, fragment.texcoord3 );
|
||||
half4 YCoCG = t_BaseColor.Sample( AnisotropicWrapSampler, fragment.texcoord4.xy );
|
||||
half4 specMapSRGB = t_Specular.Sample( AnisotropicWrapSampler, fragment.texcoord5.xy );
|
||||
half4 specMap = sRGBAToLinearRGBA( specMapSRGB );
|
||||
|
||||
half3 lightVector = normalize( fragment.texcoord0.xyz );
|
||||
|
|
|
@ -430,8 +430,6 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
half3 halfAngleVector = normalize( lightVector + viewVector );
|
||||
half hdotN = clamp( dot3( halfAngleVector, localNormal ), 0.0, 1.0 );
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ VALUE_TYPE reduce( float4 a )
|
|||
// *INDENT-OFF*
|
||||
cbuffer c_MipMapgen : register( b0 )
|
||||
{
|
||||
MipmmapGenConstants g_MipMapGen;
|
||||
MipmmapGenConstants g_MipMapGen;
|
||||
};
|
||||
|
||||
RWTexture2D<VALUE_TYPE> u_output[NUM_LODS] : register( u0 );
|
||||
|
@ -119,7 +119,7 @@ groupshared VALUE_TYPE s_ReductionData[GROUP_SIZE][GROUP_SIZE];
|
|||
s_ReductionData[threadIdx.y][threadIdx.x] = value;
|
||||
}
|
||||
|
||||
GroupMemoryBarrierWithGroupSync( );
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
if( all( threadIdx.xy < outGroupSize ) )
|
||||
{
|
||||
|
@ -136,6 +136,6 @@ groupshared VALUE_TYPE s_ReductionData[GROUP_SIZE][GROUP_SIZE];
|
|||
u_output[level - 1][groupIdx.xy * outGroupSize + threadIdx.xy] = value;
|
||||
}
|
||||
|
||||
GroupMemoryBarrierWithGroupSync( );
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
}
|
||||
}
|
|
@ -50,9 +50,10 @@ struct ToneMappingConstants
|
|||
Buffer<uint> t_Histogram : register(t0);
|
||||
RWBuffer<uint> u_Exposure : register(u0);
|
||||
|
||||
cbuffer c_ToneMapping : register(b0)
|
||||
cbuffer c_ToneMapping :
|
||||
register( b0 )
|
||||
{
|
||||
ToneMappingConstants g_ToneMapping;
|
||||
ToneMappingConstants g_ToneMapping;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
// *INDENT-OFF*
|
||||
//
|
||||
// RB: no GPU skinning with ES 2.0
|
||||
#if USE_GPU_SKINNING
|
||||
cbuffer CB : register( b1 )
|
||||
{
|
||||
|
@ -43,7 +42,8 @@ cbuffer CB : register( b1 )
|
|||
#endif
|
||||
// RB end
|
||||
|
||||
struct VS_IN {
|
||||
struct VS_IN
|
||||
{
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float4 normal : NORMAL;
|
||||
|
@ -52,7 +52,8 @@ struct VS_IN {
|
|||
float4 color2 : COLOR1;
|
||||
};
|
||||
|
||||
struct VS_OUT {
|
||||
struct VS_OUT
|
||||
{
|
||||
float4 position : SV_Position;
|
||||
float4 texcoord0 : TEXCOORD0_centroid;
|
||||
float4 texcoord1 : TEXCOORD1_centroid;
|
||||
|
|
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "global_inc.hlsl"
|
||||
|
||||
// RB: no GPU skinning with ES 2.0
|
||||
// *INDENT-OFF*
|
||||
#if USE_GPU_SKINNING
|
||||
cbuffer CB :
|
||||
register( b1 )
|
||||
|
@ -38,8 +39,6 @@ register( b1 )
|
|||
#endif
|
||||
// RB end
|
||||
|
||||
// *INDENT-OFF*
|
||||
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
|
|
@ -58,9 +58,9 @@ public:
|
|||
//Unused methods are stubs
|
||||
void OnBufferStart( void* pBufferContext ) { }
|
||||
void OnLoopEnd( void* pBufferContext ) { }
|
||||
void OnStreamEnd( ) { }
|
||||
void OnStreamEnd() { }
|
||||
void OnVoiceError( void* pBufferContext, HRESULT Error ) { }
|
||||
void OnVoiceProcessingPassEnd( ) { }
|
||||
void OnVoiceProcessingPassEnd() { }
|
||||
void OnVoiceProcessingPassStart( UINT32 BytesRequired ) { }
|
||||
};
|
||||
|
||||
|
|
|
@ -518,7 +518,7 @@ bool idSWFTextInstance::UpdateSubtitle( int time )
|
|||
}
|
||||
}
|
||||
|
||||
if( subNextStartIndex + 1 >= text.Length( ) )
|
||||
if( subNextStartIndex + 1 >= text.Length() )
|
||||
{
|
||||
subForceKillQueued = true;
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ public:
|
|||
}
|
||||
void SubtitleCleanup();
|
||||
float GetTextLength();
|
||||
int GetInputStartChar( )
|
||||
int GetInputStartChar()
|
||||
{
|
||||
return inputTextStartChar;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,10 @@ void DeviceManager::BackBufferResizing()
|
|||
|
||||
void DeviceManager::BackBufferResized()
|
||||
{
|
||||
Framebuffer::ResizeFramebuffers();
|
||||
if( tr.IsInitialized() )
|
||||
{
|
||||
Framebuffer::ResizeFramebuffers();
|
||||
}
|
||||
}
|
||||
|
||||
const DeviceCreationParameters& DeviceManager::GetDeviceParams()
|
||||
|
|
|
@ -519,7 +519,7 @@ int main( int argc, const char** argv )
|
|||
Sys_Printf( "memory consistency checking enabled\n" );
|
||||
#endif
|
||||
|
||||
Posix_EarlyInit( );
|
||||
Posix_EarlyInit();
|
||||
|
||||
if( argc > 1 )
|
||||
{
|
||||
|
@ -530,7 +530,7 @@ int main( int argc, const char** argv )
|
|||
common->Init( 0, NULL, NULL );
|
||||
}
|
||||
|
||||
Posix_LateInit( );
|
||||
Posix_LateInit();
|
||||
|
||||
|
||||
while( 1 )
|
||||
|
|
|
@ -455,7 +455,7 @@ int main( int argc, const char** argv )
|
|||
cmdargv = argv;
|
||||
// DG end
|
||||
|
||||
Posix_EarlyInit( );
|
||||
Posix_EarlyInit();
|
||||
|
||||
if( argc > 1 )
|
||||
{
|
||||
|
@ -466,7 +466,7 @@ int main( int argc, const char** argv )
|
|||
common->Init( 0, NULL, NULL );
|
||||
}
|
||||
|
||||
Posix_LateInit( );
|
||||
Posix_LateInit();
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
|
|
|
@ -286,9 +286,9 @@ double MeasureClockTicks()
|
|||
{
|
||||
double t0, t1;
|
||||
|
||||
t0 = Sys_GetClockTicks( );
|
||||
t0 = Sys_GetClockTicks();
|
||||
Sys_Sleep( 1000 );
|
||||
t1 = Sys_GetClockTicks( );
|
||||
t1 = Sys_GetClockTicks();
|
||||
return t1 - t0;
|
||||
}
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ void Posix_LateInit()
|
|||
//common->Printf( "%d MB Video Memory\n", Sys_GetVideoRam() );
|
||||
//#endif
|
||||
|
||||
//Posix_StartAsyncThread( );
|
||||
//Posix_StartAsyncThread();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -37,13 +37,13 @@ void Posix_QueEvent( sysEventType_t type, int value, int value2, int ptrLength,
|
|||
const char* Posix_Cwd();
|
||||
|
||||
// called first thing. does InitSigs and various things
|
||||
void Posix_EarlyInit( );
|
||||
void Posix_EarlyInit();
|
||||
// called after common has been initialized
|
||||
void Posix_LateInit( );
|
||||
void Posix_LateInit();
|
||||
|
||||
void Posix_InitPThreads( );
|
||||
void Posix_InitSigs( );
|
||||
void Posix_ClearSigs( );
|
||||
void Posix_InitPThreads();
|
||||
void Posix_InitSigs();
|
||||
void Posix_ClearSigs();
|
||||
|
||||
void Posix_Exit( int ret );
|
||||
void Posix_SetExit( int ret ); // override the exit code
|
||||
|
|
|
@ -71,7 +71,7 @@ static char fatalError[ 1024 ];
|
|||
Posix_ClearSigs
|
||||
================
|
||||
*/
|
||||
void Posix_ClearSigs( )
|
||||
void Posix_ClearSigs()
|
||||
{
|
||||
struct sigaction action;
|
||||
int i;
|
||||
|
@ -129,7 +129,7 @@ static void sig_handler( int signum, siginfo_t* info, void* context )
|
|||
Posix_InitSigs
|
||||
================
|
||||
*/
|
||||
void Posix_InitSigs( )
|
||||
void Posix_InitSigs()
|
||||
{
|
||||
struct sigaction action;
|
||||
int i;
|
||||
|
|
|
@ -39,7 +39,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
idChoiceWindow::InitVars
|
||||
============
|
||||
*/
|
||||
void idChoiceWindow::InitVars( )
|
||||
void idChoiceWindow::InitVars()
|
||||
{
|
||||
if( cvarStr.Length() )
|
||||
{
|
||||
|
|
|
@ -186,7 +186,7 @@ void idEditWindow::Draw( int time, float x, float y )
|
|||
|
||||
if( wrap && scroller->GetHigh() > 0.0f )
|
||||
{
|
||||
float lineHeight = GetMaxCharHeight( ) + 5;
|
||||
float lineHeight = GetMaxCharHeight() + 5;
|
||||
rect.y -= scroller->GetValue() * lineHeight;
|
||||
rect.w -= sizeBias;
|
||||
rect.h = ( breaks.Num() + 1 ) * lineHeight;
|
||||
|
@ -629,7 +629,7 @@ void idEditWindow::EnsureCursorVisible()
|
|||
}
|
||||
}
|
||||
}
|
||||
int maxWidth = GetMaxCharWidth( );
|
||||
int maxWidth = GetMaxCharWidth();
|
||||
int left = cursorX - maxWidth;
|
||||
int right = ( cursorX - textRect.w ) + maxWidth;
|
||||
|
||||
|
@ -718,7 +718,7 @@ void idEditWindow::Activate( bool activate, idStr& act )
|
|||
idEditWindow::InitCvar
|
||||
============
|
||||
*/
|
||||
void idEditWindow::InitCvar( )
|
||||
void idEditWindow::InitCvar()
|
||||
{
|
||||
if( cvarStr[0] == '\0' )
|
||||
{
|
||||
|
|
|
@ -663,16 +663,16 @@ void idGuiScript::FixupParms( idWindow* win )
|
|||
rect = *( dynamic_cast<idWinRectangle*>( dest ) );
|
||||
ownerparent->ClientToScreen( &rect );
|
||||
destparent->ScreenToClient( &rect );
|
||||
*v4 = rect.ToVec4( );
|
||||
*v4 = rect.ToVec4();
|
||||
}
|
||||
else
|
||||
{
|
||||
v4->Set( dest->c_str( ) );
|
||||
v4->Set( dest->c_str() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
v4->Set( dest->c_str( ) );
|
||||
v4->Set( dest->c_str() );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -424,7 +424,7 @@ void idSliderWindow::Activate( bool activate, idStr& act )
|
|||
idSliderWindow::InitCvar
|
||||
============
|
||||
*/
|
||||
void idSliderWindow::InitCvar( )
|
||||
void idSliderWindow::InitCvar()
|
||||
{
|
||||
if( cvarStr[0] == '\0' )
|
||||
{
|
||||
|
|
|
@ -249,7 +249,7 @@ void idWindow::CleanUp()
|
|||
}
|
||||
|
||||
// ensure the register list gets cleaned up
|
||||
regList.Reset( );
|
||||
regList.Reset();
|
||||
|
||||
// Cleanup the named events
|
||||
namedEvents.DeleteContents( true );
|
||||
|
@ -529,7 +529,7 @@ void idWindow::Activate( bool activate, idStr& act )
|
|||
int n = ( activate ) ? ON_ACTIVATE : ON_DEACTIVATE;
|
||||
|
||||
// make sure win vars are updated before activation
|
||||
UpdateWinVars( );
|
||||
UpdateWinVars();
|
||||
|
||||
RunScript( n );
|
||||
int c = children.Num();
|
||||
|
@ -693,7 +693,7 @@ void idWindow::RunNamedEvent( const char* eventName )
|
|||
int c;
|
||||
|
||||
// Find and run the event
|
||||
c = namedEvents.Num( );
|
||||
c = namedEvents.Num();
|
||||
for( i = 0; i < c; i ++ )
|
||||
{
|
||||
if( namedEvents[i]->mName.Icmp( eventName ) )
|
||||
|
@ -2580,7 +2580,7 @@ bool idWindow::Parse( idTokenParser* src, bool rebuild )
|
|||
while( token != "}" )
|
||||
{
|
||||
// track what was parsed so we can maintain it for the guieditor
|
||||
src->SetMarker( );
|
||||
src->SetMarker();
|
||||
|
||||
if( token == "windowDef" || token == "animationDef" )
|
||||
{
|
||||
|
@ -2760,7 +2760,7 @@ bool idWindow::Parse( idTokenParser* src, bool rebuild )
|
|||
|
||||
rvNamedEvent* ev = new( TAG_OLD_UI ) rvNamedEvent( token );
|
||||
|
||||
src->SetMarker( );
|
||||
src->SetMarker();
|
||||
|
||||
if( !ParseScript( src, *ev->mEvent ) )
|
||||
{
|
||||
|
@ -2782,7 +2782,7 @@ bool idWindow::Parse( idTokenParser* src, bool rebuild )
|
|||
ev->time = atoi( token.c_str() );
|
||||
|
||||
// reset the mark since we dont want it to include the time
|
||||
src->SetMarker( );
|
||||
src->SetMarker();
|
||||
|
||||
if( !ParseScript( src, *ev->event, &ev->time ) )
|
||||
{
|
||||
|
@ -2805,7 +2805,7 @@ bool idWindow::Parse( idTokenParser* src, bool rebuild )
|
|||
|
||||
// add the float to the editors wrapper dict
|
||||
// Set the marker after the float name
|
||||
src->SetMarker( );
|
||||
src->SetMarker();
|
||||
|
||||
// Read in the float
|
||||
regList.AddReg( work, idRegister::FLOAT, src, this, varf );
|
||||
|
@ -2820,7 +2820,7 @@ bool idWindow::Parse( idTokenParser* src, bool rebuild )
|
|||
|
||||
// set the marker so we can determine what was parsed
|
||||
// set the marker after the vec4 name
|
||||
src->SetMarker( );
|
||||
src->SetMarker();
|
||||
|
||||
// FIXME: how about we add the var to the desktop instead of this window so it won't get deleted
|
||||
// when this window is destoyed which even happens during parsing with simple windows ?
|
||||
|
@ -2839,7 +2839,7 @@ bool idWindow::Parse( idTokenParser* src, bool rebuild )
|
|||
|
||||
// add the float to the editors wrapper dict
|
||||
// set the marker to after the float name
|
||||
src->SetMarker( );
|
||||
src->SetMarker();
|
||||
|
||||
// Parse the float
|
||||
regList.AddReg( work, idRegister::FLOAT, src, this, varf );
|
||||
|
@ -4651,7 +4651,7 @@ Returns the number of children
|
|||
*/
|
||||
int idWindow::GetChildCount()
|
||||
{
|
||||
return drawWindows.Num( );
|
||||
return drawWindows.Num();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -4835,12 +4835,12 @@ bool idWindow::UpdateFromDictionary( idDict& dict )
|
|||
const idKeyValue* kv;
|
||||
int i;
|
||||
|
||||
SetDefaults( );
|
||||
SetDefaults();
|
||||
|
||||
// Clear all registers since they will get recreated
|
||||
regList.Reset( );
|
||||
expressionRegisters.Clear( );
|
||||
ops.Clear( );
|
||||
regList.Reset();
|
||||
expressionRegisters.Clear();
|
||||
ops.Clear();
|
||||
|
||||
for( i = 0; i < dict.GetNumKeyVals(); i ++ )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue