Commit cfb3fe53 authored by Erik Faye-Lund 's avatar Erik Faye-Lund

d3d12: remove unused flags from resource-state manager

These flags are never set, so let's simplify the logic a bit here.
parent 212b25b1
...@@ -101,13 +101,11 @@ D3D12_RESOURCE_STATES CCurrentResourceState::StateIfPromoted(D3D12_RESOURCE_STAT ...@@ -101,13 +101,11 @@ D3D12_RESOURCE_STATES CCurrentResourceState::StateIfPromoted(D3D12_RESOURCE_STAT
{ {
D3D12_RESOURCE_STATES Result = D3D12_RESOURCE_STATE_COMMON; D3D12_RESOURCE_STATES Result = D3D12_RESOURCE_STATE_COMMON;
if((Flags & SubresourceTransitionFlags_ForceExplicitState) != SubresourceTransitionFlags_ForceExplicitState && ( if (m_bSimultaneousAccess || !!(State & (
m_bSimultaneousAccess ||
!!(State & (
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE | D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE |
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE | D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE |
D3D12_RESOURCE_STATE_COPY_SOURCE | D3D12_RESOURCE_STATE_COPY_SOURCE |
D3D12_RESOURCE_STATE_COPY_DEST)))) D3D12_RESOURCE_STATE_COPY_DEST)))
{ {
auto CurState = GetLogicalSubresourceState(SubresourceIndex); auto CurState = GetLogicalSubresourceState(SubresourceIndex);
...@@ -207,12 +205,6 @@ void ResourceStateManager::ApplyResourceTransitionsPreamble() ...@@ -207,12 +205,6 @@ void ResourceStateManager::ApplyResourceTransitionsPreamble()
return false; return false;
} }
// Not an exact match, but an exact match required, so do the transition.
if ((Flags & SubresourceTransitionFlags_StateMatchExact) != SubresourceTransitionFlags_None)
{
return true;
}
if ( if (
CurrentState == D3D12_RESOURCE_STATE_COMMON || CurrentState == D3D12_RESOURCE_STATE_COMMON ||
DestinationState == D3D12_RESOURCE_STATE_COMMON) DestinationState == D3D12_RESOURCE_STATE_COMMON)
...@@ -377,8 +369,6 @@ void ResourceStateManager::ProcessTransitioningSubresourceExplicit( ...@@ -377,8 +369,6 @@ void ResourceStateManager::ProcessTransitioningSubresourceExplicit(
bool MayDecay = false; bool MayDecay = false;
bool IsPromotion = false; bool IsPromotion = false;
bool bQueueStateUpdate = (SubresourceDestinationInfo.Flags & SubresourceTransitionFlags_NotUsedInCommandListIfNoStateChange) == SubresourceTransitionFlags_None;
// If not promotable then StateIfPromoted will be D3D12_RESOURCE_STATE_COMMON // If not promotable then StateIfPromoted will be D3D12_RESOURCE_STATE_COMMON
auto StateIfPromoted = CurrentState.StateIfPromoted(after, SubresourceIndex, Flags); auto StateIfPromoted = CurrentState.StateIfPromoted(after, SubresourceIndex, Flags);
...@@ -394,7 +384,6 @@ void ResourceStateManager::ProcessTransitioningSubresourceExplicit( ...@@ -394,7 +384,6 @@ void ResourceStateManager::ProcessTransitioningSubresourceExplicit(
MayDecay = CurrentState.SupportsSimultaneousAccess() && !IsD3D12WriteState(after, Flags); MayDecay = CurrentState.SupportsSimultaneousAccess() && !IsD3D12WriteState(after, Flags);
IsPromotion = false; IsPromotion = false;
bQueueStateUpdate = true;
} }
} }
else else
...@@ -405,18 +394,14 @@ void ResourceStateManager::ProcessTransitioningSubresourceExplicit( ...@@ -405,18 +394,14 @@ void ResourceStateManager::ProcessTransitioningSubresourceExplicit(
after = StateIfPromoted; after = StateIfPromoted;
MayDecay = !IsD3D12WriteState(after, Flags); MayDecay = !IsD3D12WriteState(after, Flags);
IsPromotion = true; IsPromotion = true;
bQueueStateUpdate = true;
} }
} }
if (bQueueStateUpdate) CCurrentResourceState::LogicalState NewLogicalState{after, ExecutionId, IsPromotion, MayDecay};
{ AddCurrentStateUpdate(TransitionableResourceState,
CCurrentResourceState::LogicalState NewLogicalState{after, ExecutionId, IsPromotion, MayDecay}; CurrentState,
AddCurrentStateUpdate(TransitionableResourceState, TransitionDesc.Transition.Subresource,
CurrentState, NewLogicalState);
TransitionDesc.Transition.Subresource,
NewLogicalState);
}
} }
//---------------------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------------------
......
...@@ -48,8 +48,7 @@ D3D12_RESOURCE_STATE_VIDEO_PROCESS_WRITE; ...@@ -48,8 +48,7 @@ D3D12_RESOURCE_STATE_VIDEO_PROCESS_WRITE;
//--------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------
inline bool IsD3D12WriteState(UINT State, SubresourceTransitionFlags Flags) inline bool IsD3D12WriteState(UINT State, SubresourceTransitionFlags Flags)
{ {
return (State & RESOURCE_STATE_ALL_WRITE_BITS) != 0 || return (State & RESOURCE_STATE_ALL_WRITE_BITS) != 0;
(Flags & SubresourceTransitionFlags_ForceExplicitState) != SubresourceTransitionFlags_None;
} }
inline bool SupportsSimultaneousAccess(const D3D12_RESOURCE_DESC &desc) inline bool SupportsSimultaneousAccess(const D3D12_RESOURCE_DESC &desc)
......
...@@ -5,9 +5,6 @@ typedef enum _SubresourceTransitionFlags ...@@ -5,9 +5,6 @@ typedef enum _SubresourceTransitionFlags
{ {
SubresourceTransitionFlags_None = 0, SubresourceTransitionFlags_None = 0,
SubresourceTransitionFlags_TransitionPreDraw = 1, SubresourceTransitionFlags_TransitionPreDraw = 1,
SubresourceTransitionFlags_StateMatchExact = 4,
SubresourceTransitionFlags_ForceExplicitState = 8,
SubresourceTransitionFlags_NotUsedInCommandListIfNoStateChange = 0x10,
} SubresourceTransitionFlags; } SubresourceTransitionFlags;
DEFINE_ENUM_FLAG_OPERATORS(SubresourceTransitionFlags); DEFINE_ENUM_FLAG_OPERATORS(SubresourceTransitionFlags);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment