mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-11 18:17:16 +00:00
Check for D3D12 hardware feature support even if interface is available
This commit is contained in:
@@ -280,6 +280,12 @@ bool WrappedID3D12GraphicsCommandList2::Serialise_OMSetDepthBounds(SerialiserTyp
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_pDevice->GetOpts2().DepthBoundsTestSupported == 0)
|
||||
{
|
||||
RDCERR("Can't replay OMSetDepthBounds without device support");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
m_Cmd->m_LastCmdListID = GetResourceManager()->GetOriginalID(GetResID(pCommandList));
|
||||
@@ -526,6 +532,12 @@ bool WrappedID3D12GraphicsCommandList2::Serialise_SetViewInstanceMask(Serialiser
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_pDevice->GetOpts3().ViewInstancingTier == D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED)
|
||||
{
|
||||
RDCERR("Can't replay SetViewInstanceMask without device support");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
m_Cmd->m_LastCmdListID = GetResourceManager()->GetOriginalID(GetResID(pCommandList));
|
||||
|
||||
@@ -4304,7 +4304,7 @@ bool WrappedID3D12GraphicsCommandList2::Serialise_ExecuteIndirect(
|
||||
|
||||
m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].crackedLists.push_back(list);
|
||||
|
||||
m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].state.ApplyState(list);
|
||||
m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].state.ApplyState(m_pDevice, list);
|
||||
}
|
||||
|
||||
// perform indirect draw, but from patched buffer. It will be patched between the above list
|
||||
|
||||
@@ -148,6 +148,9 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara
|
||||
m_StructuredFile = &m_StoredStructuredData;
|
||||
|
||||
RDCEraseEl(m_D3D12Opts);
|
||||
RDCEraseEl(m_D3D12Opts1);
|
||||
RDCEraseEl(m_D3D12Opts2);
|
||||
RDCEraseEl(m_D3D12Opts3);
|
||||
|
||||
m_pDevice1 = NULL;
|
||||
m_pDevice2 = NULL;
|
||||
@@ -162,7 +165,20 @@ WrappedID3D12Device::WrappedID3D12Device(ID3D12Device *realDevice, D3D12InitPara
|
||||
m_DescriptorIncrements[i] =
|
||||
m_pDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE(i));
|
||||
|
||||
m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &m_D3D12Opts, sizeof(m_D3D12Opts));
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
hr = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &m_D3D12Opts,
|
||||
sizeof(m_D3D12Opts));
|
||||
RDCASSERTEQUAL(hr, S_OK);
|
||||
hr = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS1, &m_D3D12Opts1,
|
||||
sizeof(m_D3D12Opts1));
|
||||
RDCASSERTEQUAL(hr, S_OK);
|
||||
hr = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS2, &m_D3D12Opts2,
|
||||
sizeof(m_D3D12Opts2));
|
||||
RDCASSERTEQUAL(hr, S_OK);
|
||||
hr = m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS3, &m_D3D12Opts3,
|
||||
sizeof(m_D3D12Opts3));
|
||||
RDCASSERTEQUAL(hr, S_OK);
|
||||
}
|
||||
|
||||
// refcounters implicitly construct with one reference, but we don't start with any soft
|
||||
@@ -2843,7 +2859,7 @@ void WrappedID3D12Device::ReplayLog(uint32_t startEventID, uint32_t endEventID,
|
||||
{
|
||||
ID3D12GraphicsCommandList2 *list = cmd.m_OutsideCmdList = GetNewList();
|
||||
|
||||
cmd.m_RenderState.ApplyState(list);
|
||||
cmd.m_RenderState.ApplyState(this, list);
|
||||
}
|
||||
|
||||
ReplayStatus status = ReplayStatus::Succeeded;
|
||||
|
||||
@@ -364,6 +364,9 @@ private:
|
||||
WrappedIDXGISwapChain4 *m_LastSwap;
|
||||
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS m_D3D12Opts;
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS1 m_D3D12Opts1;
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS2 m_D3D12Opts2;
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS3 m_D3D12Opts3;
|
||||
UINT m_DescriptorIncrements[D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES];
|
||||
|
||||
template <typename SerialiserType>
|
||||
@@ -385,6 +388,10 @@ public:
|
||||
return m_DescriptorIncrements[type];
|
||||
}
|
||||
|
||||
const D3D12_FEATURE_DATA_D3D12_OPTIONS &GetOpts() { return m_D3D12Opts; }
|
||||
const D3D12_FEATURE_DATA_D3D12_OPTIONS1 &GetOpts1() { return m_D3D12Opts1; }
|
||||
const D3D12_FEATURE_DATA_D3D12_OPTIONS2 &GetOpts2() { return m_D3D12Opts2; }
|
||||
const D3D12_FEATURE_DATA_D3D12_OPTIONS3 &GetOpts3() { return m_D3D12Opts3; }
|
||||
void RemoveQueue(WrappedID3D12CommandQueue *queue);
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -210,7 +210,7 @@ struct D3D12QuadOverdrawCallback : public D3D12DrawcallCallback
|
||||
// as we're changing the root signature, we need to reapply all elements,
|
||||
// so just apply all state
|
||||
if(cmd)
|
||||
rs.ApplyState(cmd);
|
||||
rs.ApplyState(m_pDevice, cmd);
|
||||
}
|
||||
|
||||
bool PostDraw(uint32_t eid, ID3D12GraphicsCommandList2 *cmd)
|
||||
@@ -222,7 +222,7 @@ struct D3D12QuadOverdrawCallback : public D3D12DrawcallCallback
|
||||
m_pDevice->GetQueue()->GetCommandData()->m_RenderState = m_PrevState;
|
||||
|
||||
RDCASSERT(cmd);
|
||||
m_pDevice->GetQueue()->GetCommandData()->m_RenderState.ApplyState(cmd);
|
||||
m_pDevice->GetQueue()->GetCommandData()->m_RenderState.ApplyState(m_pDevice, cmd);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
|
||||
list = GetDebugManager()->ResetDebugList();
|
||||
|
||||
rs.ApplyState(list);
|
||||
rs.ApplyState(m_pDevice, list);
|
||||
|
||||
list->SetPipelineState(pipe);
|
||||
|
||||
@@ -461,7 +461,7 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
|
||||
list = GetDebugManager()->ResetDebugList();
|
||||
|
||||
rs.ApplyState(list);
|
||||
rs.ApplyState(m_pDevice, list);
|
||||
|
||||
list->SetPipelineState(pipe);
|
||||
|
||||
@@ -830,7 +830,7 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
{
|
||||
list = GetDebugManager()->ResetDebugList();
|
||||
|
||||
rs.ApplyState(list);
|
||||
rs.ApplyState(m_pDevice, list);
|
||||
|
||||
list->SetPipelineState(pipe);
|
||||
|
||||
@@ -919,7 +919,7 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
list->ResourceBarrier(1, &sobarr);
|
||||
}
|
||||
|
||||
rs.ApplyState(list);
|
||||
rs.ApplyState(m_pDevice, list);
|
||||
|
||||
list->SetPipelineState(pipe);
|
||||
|
||||
@@ -975,7 +975,7 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
{
|
||||
list = GetDebugManager()->ResetDebugList();
|
||||
|
||||
rs.ApplyState(list);
|
||||
rs.ApplyState(m_pDevice, list);
|
||||
|
||||
list->SetPipelineState(pipe);
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ ResourceId D3D12RenderState::GetDSVID() const
|
||||
return dsv.GetResResourceId();
|
||||
}
|
||||
|
||||
void D3D12RenderState::ApplyState(ID3D12GraphicsCommandList2 *cmd) const
|
||||
void D3D12RenderState::ApplyState(WrappedID3D12Device *dev, ID3D12GraphicsCommandList2 *cmd) const
|
||||
{
|
||||
D3D12_COMMAND_LIST_TYPE type = cmd->GetType();
|
||||
|
||||
@@ -96,10 +96,12 @@ void D3D12RenderState::ApplyState(ID3D12GraphicsCommandList2 *cmd) const
|
||||
|
||||
if(GetWrapped(cmd)->GetReal1())
|
||||
{
|
||||
cmd->OMSetDepthBounds(depthBoundsMin, depthBoundsMax);
|
||||
if(dev->GetOpts2().DepthBoundsTestSupported)
|
||||
cmd->OMSetDepthBounds(depthBoundsMin, depthBoundsMax);
|
||||
|
||||
// safe to set this - if the pipeline has view instancing disabled, it will do nothing
|
||||
cmd->SetViewInstanceMask(viewInstMask);
|
||||
if(dev->GetOpts3().ViewInstancingTier != D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED)
|
||||
cmd->SetViewInstanceMask(viewInstMask);
|
||||
}
|
||||
|
||||
if(ibuffer.buf != ResourceId())
|
||||
|
||||
@@ -46,7 +46,7 @@ struct D3D12RenderState
|
||||
D3D12RenderState() = default;
|
||||
D3D12RenderState &operator=(const D3D12RenderState &o);
|
||||
|
||||
void ApplyState(ID3D12GraphicsCommandList2 *list) const;
|
||||
void ApplyState(WrappedID3D12Device *dev, ID3D12GraphicsCommandList2 *list) const;
|
||||
void ApplyComputeRootElements(ID3D12GraphicsCommandList2 *cmd) const;
|
||||
void ApplyGraphicsRootElements(ID3D12GraphicsCommandList2 *cmd) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user