Commit 3f5c8801 authored by Erik Faye-Lund 's avatar Erik Faye-Lund

d3d12: drop entire flags-dance

parent acae5af1
......@@ -1515,7 +1515,7 @@ d3d12_transition_resource_state(struct d3d12_context *ctx,
D3D12_RESOURCE_STATES state)
{
TransitionableResourceState *xres = d3d12_resource_state(res);
ctx->resource_state_manager->TransitionResource(xres, state, SubresourceTransitionFlags_None);
ctx->resource_state_manager->TransitionResource(xres, state);
}
void
......@@ -1536,7 +1536,7 @@ d3d12_transition_subresources_state(struct d3d12_context *ctx,
const uint32_t plane = start_plane + p;
uint32_t subres_id = level + (layer * res->mip_levels) + plane * (res->mip_levels * res->base.array_size);
assert(subres_id < xres->NumSubresources());
ctx->resource_state_manager->TransitionSubresource(xres, subres_id, state, SubresourceTransitionFlags_None);
ctx->resource_state_manager->TransitionSubresource(xres, subres_id, state);
}
}
}
......
......@@ -37,8 +37,6 @@
#include "util/slab.h"
#include "util/u_suballoc.h"
#include "D3D12StateTransitionFlags.h"
#include <d3d12.h>
#define D3D12_GFX_SHADER_STAGES (PIPE_SHADER_TYPES - 1)
......
......@@ -39,7 +39,7 @@ void CDesiredResourceState::UpdateSubresourceState(unsigned SubresourceIndex, Su
assert(SubresourceIndex < m_spSubresourceInfo.size());
if (m_spSubresourceInfo[SubresourceIndex].State == UNKNOWN_RESOURCE_STATE ||
info.State == UNKNOWN_RESOURCE_STATE ||
IsD3D12WriteState(info.State, SubresourceTransitionFlags_None))
IsD3D12WriteState(info.State))
{
m_spSubresourceInfo[SubresourceIndex] = info;
}
......@@ -97,7 +97,7 @@ CCurrentResourceState::CCurrentResourceState(UINT SubresourceCount, bool bSimult
}
//----------------------------------------------------------------------------------------------------------------------------------
D3D12_RESOURCE_STATES CCurrentResourceState::StateIfPromoted(D3D12_RESOURCE_STATES State, UINT SubresourceIndex, SubresourceTransitionFlags Flags)
D3D12_RESOURCE_STATES CCurrentResourceState::StateIfPromoted(D3D12_RESOURCE_STATES State, UINT SubresourceIndex)
{
D3D12_RESOURCE_STATES Result = D3D12_RESOURCE_STATE_COMMON;
......@@ -197,7 +197,7 @@ void ResourceStateManager::ApplyResourceTransitionsPreamble()
}
//----------------------------------------------------------------------------------------------------------------------------------
/*static*/ bool ResourceStateManager::TransitionRequired(D3D12_RESOURCE_STATES CurrentState, D3D12_RESOURCE_STATES& DestinationState, SubresourceTransitionFlags Flags)
/*static*/ bool ResourceStateManager::TransitionRequired(D3D12_RESOURCE_STATES CurrentState, D3D12_RESOURCE_STATES& DestinationState)
{
// An exact match never needs a transition.
if (CurrentState == DestinationState)
......@@ -221,8 +221,7 @@ void ResourceStateManager::ApplyResourceTransitionsPreamble()
// If the transition involves a write state, then the destination should just be the requested destination.
// Otherwise, accumulate read states to minimize future transitions (by triggering the above condition).
if (!IsD3D12WriteState(DestinationState, SubresourceTransitionFlags_None) &&
!IsD3D12WriteState(CurrentState, SubresourceTransitionFlags_None))
if (!IsD3D12WriteState(DestinationState) && !IsD3D12WriteState(CurrentState))
{
DestinationState |= CurrentState;
}
......@@ -269,7 +268,6 @@ void ResourceStateManager::ProcessTransitioningResource(ID3D12Resource* pTransit
// Is this subresource currently being used, or is it just being iterated over?
D3D12_RESOURCE_STATES after = SubresourceDestinationInfo.State;
SubresourceTransitionFlags Flags = SubresourceDestinationInfo.Flags;
if (after == UNKNOWN_RESOURCE_STATE)
{
// This subresource doesn't have any transition requested - move on to the next.
......@@ -283,13 +281,11 @@ void ResourceStateManager::ProcessTransitioningResource(ID3D12Resource* pTransit
after,
TransitionableResourceState,
TransitionDesc,
Flags,
ExecutionId); // throw( bad_alloc )
}
CDesiredResourceState::SubresourceInfo UnknownDestinationState = {};
UnknownDestinationState.State = UNKNOWN_RESOURCE_STATE;
UnknownDestinationState.Flags = SubresourceTransitionFlags_None;
// Update destination states.
// Coalesce destination state to ensure that it's set for the entire resource.
......@@ -305,7 +301,6 @@ void ResourceStateManager::ProcessTransitioningSubresourceExplicit(
D3D12_RESOURCE_STATES after,
TransitionableResourceState& TransitionableResourceState,
D3D12_RESOURCE_BARRIER& TransitionDesc,
SubresourceTransitionFlags Flags,
UINT64 ExecutionId)
{
// Simultaneous access resources currently in the COMMON
......@@ -327,11 +322,11 @@ void ResourceStateManager::ProcessTransitioningSubresourceExplicit(
bool IsPromotion = false;
// If not promotable then StateIfPromoted will be D3D12_RESOURCE_STATE_COMMON
auto StateIfPromoted = CurrentState.StateIfPromoted(after, SubresourceIndex, Flags);
auto StateIfPromoted = CurrentState.StateIfPromoted(after, SubresourceIndex);
if ( D3D12_RESOURCE_STATE_COMMON == StateIfPromoted )
{
if (TransitionRequired(CurrentLogicalState.State, /*inout*/ after, SubresourceDestinationInfo.Flags))
if (TransitionRequired(CurrentLogicalState.State, /*inout*/ after))
{
// Insert a single concrete barrier (for non-simultaneous access resources).
TransitionDesc.Transition.StateBefore = D3D12_RESOURCE_STATES(CurrentLogicalState.State);
......@@ -339,7 +334,7 @@ void ResourceStateManager::ProcessTransitioningSubresourceExplicit(
assert(TransitionDesc.Transition.StateBefore != TransitionDesc.Transition.StateAfter);
m_vResourceBarriers.push_back(TransitionDesc); // throw( bad_alloc )
MayDecay = CurrentState.SupportsSimultaneousAccess() && !IsD3D12WriteState(after, Flags);
MayDecay = CurrentState.SupportsSimultaneousAccess() && !IsD3D12WriteState(after);
IsPromotion = false;
}
}
......@@ -349,7 +344,7 @@ void ResourceStateManager::ProcessTransitioningSubresourceExplicit(
if(after != StateIfPromoted)
{
after = StateIfPromoted;
MayDecay = !IsD3D12WriteState(after, Flags);
MayDecay = !IsD3D12WriteState(after);
IsPromotion = true;
}
}
......@@ -372,16 +367,16 @@ void ResourceStateManager::SubmitResourceTransitions(ID3D12GraphicsCommandList *
}
//----------------------------------------------------------------------------------------------------------------------------------
void ResourceStateManager::TransitionResource(TransitionableResourceState* pResource, D3D12_RESOURCE_STATES State, SubresourceTransitionFlags Flags)
void ResourceStateManager::TransitionResource(TransitionableResourceState* pResource, D3D12_RESOURCE_STATES State)
{
CDesiredResourceState::SubresourceInfo DesiredState = { State, Flags };
CDesiredResourceState::SubresourceInfo DesiredState = { State };
ResourceStateManager::TransitionResource(*pResource, DesiredState);
}
//----------------------------------------------------------------------------------------------------------------------------------
void ResourceStateManager::TransitionSubresource(TransitionableResourceState* pResource, UINT SubresourceIndex, D3D12_RESOURCE_STATES State, SubresourceTransitionFlags Flags)
void ResourceStateManager::TransitionSubresource(TransitionableResourceState* pResource, UINT SubresourceIndex, D3D12_RESOURCE_STATES State)
{
CDesiredResourceState::SubresourceInfo DesiredState = { State, Flags };
CDesiredResourceState::SubresourceInfo DesiredState = { State };
ResourceStateManager::TransitionSubresource(*pResource, SubresourceIndex, DesiredState);
}
......
......@@ -30,8 +30,6 @@
#include "util/list.h"
#include "D3D12StateTransitionFlags.h"
#define UNKNOWN_RESOURCE_STATE (D3D12_RESOURCE_STATES)0x8000u
#define RESOURCE_STATE_VALID_BITS 0x2f3fff
#define RESOURCE_STATE_VALID_INTERNAL_BITS 0x2fffff
......@@ -46,7 +44,7 @@ D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE |
D3D12_RESOURCE_STATE_VIDEO_PROCESS_WRITE;
//---------------------------------------------------------------------------------------------------------------------------------
inline bool IsD3D12WriteState(UINT State, SubresourceTransitionFlags Flags)
inline bool IsD3D12WriteState(UINT State)
{
return (State & RESOURCE_STATE_ALL_WRITE_BITS) != 0;
}
......@@ -67,7 +65,6 @@ public:
struct SubresourceInfo
{
D3D12_RESOURCE_STATES State = UNKNOWN_RESOURCE_STATE;
SubresourceTransitionFlags Flags = SubresourceTransitionFlags_None;
};
private:
......@@ -124,7 +121,7 @@ public:
// Returns the destination state if the current state is promotable.
// Returns D3D12_RESOURCE_STATE_COMMON if not.
D3D12_RESOURCE_STATES StateIfPromoted(D3D12_RESOURCE_STATES State, UINT SubresourceIndex, SubresourceTransitionFlags Flags);
D3D12_RESOURCE_STATES StateIfPromoted(D3D12_RESOURCE_STATES State, UINT SubresourceIndex);
bool AreAllSubresourcesSame() const { return m_bAllSubresourcesSame; }
......@@ -229,13 +226,11 @@ public:
// Transition the entire resource to a particular destination state on a particular command list.
void TransitionResource(TransitionableResourceState* pResource,
D3D12_RESOURCE_STATES State,
SubresourceTransitionFlags Flags = SubresourceTransitionFlags_None);
D3D12_RESOURCE_STATES State);
// Transition a single subresource to a particular destination state.
void TransitionSubresource(TransitionableResourceState* pResource,
UINT SubresourceIndex,
D3D12_RESOURCE_STATES State,
SubresourceTransitionFlags Flags = SubresourceTransitionFlags_None);
D3D12_RESOURCE_STATES State);
// Submit all barriers and queue sync.
void ApplyAllResourceTransitions(ID3D12GraphicsCommandList *pCommandList, UINT64 ExecutionId);
......@@ -283,7 +278,7 @@ private:
private:
// Helpers
static bool TransitionRequired(D3D12_RESOURCE_STATES CurrentState, D3D12_RESOURCE_STATES& DestinationState, SubresourceTransitionFlags Flags);
static bool TransitionRequired(D3D12_RESOURCE_STATES CurrentState, D3D12_RESOURCE_STATES& DestinationState);
void AddCurrentStateUpdate(TransitionableResourceState& Resource,
CCurrentResourceState& CurrentState,
UINT SubresourceIndex,
......@@ -294,7 +289,6 @@ private:
D3D12_RESOURCE_STATES after,
TransitionableResourceState& TransitionableResourceState,
D3D12_RESOURCE_BARRIER& TransitionDesc,
SubresourceTransitionFlags Flags,
UINT64 ExecutionId);
};
......
#ifndef D3D12_TRANSITION_FLAGS_H
#define D3D12_TRANSITION_FLAGS_H
typedef enum _SubresourceTransitionFlags
{
SubresourceTransitionFlags_None = 0,
} SubresourceTransitionFlags;
DEFINE_ENUM_FLAG_OPERATORS(SubresourceTransitionFlags);
#endif // D3D12_TRANSITION_FLAGS_H
\ No newline at end of file
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