Fix code style

This commit is contained in:
Wojtek Figat
2020-12-30 11:20:37 +01:00
parent 4ec3e6aed9
commit 4c205be617
56 changed files with 608 additions and 1139 deletions

View File

@@ -144,23 +144,17 @@ void GPUContextDX12::SetResourceState(ResourceOwnerDX12* resource, D3D12_RESOURC
auto& state = resource->State;
if (subresourceIndex == D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES && !state.AreAllSubresourcesSame())
{
// Slow path. Want to transition the entire resource (with multiple subresources). But they aren't in the same state.
// Slow path because we have to transition the entire resource with multiple subresources that aren't in the same state
const uint32 subresourceCount = resource->GetSubresourcesCount();
for (uint32 i = 0; i < subresourceCount; i++)
{
const D3D12_RESOURCE_STATES before = state.GetSubresourceState(i);
// We're not using IsTransitionNeeded() because we do want to transition even if 'after' is a subset of 'before'
// This is so that we can ensure all subresources are in the same state, simplifying future barriers
if (before != after)
{
AddTransitionBarrier(resource, before, after, i);
state.SetSubresourceState(i, after);
}
}
// The entire resource should now be in the after state on this command list
ASSERT(state.CheckResourceState(after));
state.SetResourceState(after);
}

View File

@@ -172,12 +172,8 @@ public:
{
if (sampleCount <= 8)
{
// 0 has better quality (a more even distribution)
// Higher quality levels might be useful for non box filtered AA or when using weighted samples.
return 0;
}
// Not supported.
return 0xffffffff;
}
@@ -187,7 +183,7 @@ public:
#endif
private:
#if PLATFORM_XBOX_SCARLETT
void updateFrameEvents();
#endif

View File

@@ -33,14 +33,11 @@ public:
/// Returns true if resource state transition is needed in order to use resource in given state.
/// </summary>
/// <param name="currentState">The current resource state.</param>
/// <param name="targeState">the destination resource state.</param>
/// <param name="targetState">the destination resource state.</param>
/// <returns>True if need to perform a transition, otherwise false.</returns>
static bool IsTransitionNeeded(D3D12_RESOURCE_STATES currentState, D3D12_RESOURCE_STATES targeState)
static bool IsTransitionNeeded(D3D12_RESOURCE_STATES currentState, D3D12_RESOURCE_STATES targetState)
{
// If 'targeState' is a subset of 'before', then there's no need for a transition
// Note: COMMON is an oddball state that doesn't follow the RESOURE_STATE pattern of
// having exactly one bit set so we need to special case these
return currentState != targeState && ((currentState | targeState) != currentState || targeState == D3D12_RESOURCE_STATE_COMMON);
return currentState != targetState && ((currentState | targetState) != currentState || targetState == D3D12_RESOURCE_STATE_COMMON);
}
};