mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-25 23:25:41 +00:00
Handle stencil ref and blend factor commands for D3D12
This commit is contained in:
@@ -596,16 +596,86 @@ void WrappedID3D12GraphicsCommandList::RSSetScissorRects(UINT NumRects, const D3
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedID3D12GraphicsCommandList::Serialise_OMSetBlendFactor(const FLOAT BlendFactor[4])
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, CommandList, GetResourceID());
|
||||
|
||||
float factor[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
if(m_State >= WRITING && BlendFactor)
|
||||
memcpy(factor, BlendFactor, sizeof(float) * 4);
|
||||
|
||||
m_pSerialiser->SerialisePODArray<4>("BlendFactor", factor);
|
||||
|
||||
if(m_State < WRITING)
|
||||
m_Cmd->m_LastCmdListID = CommandList;
|
||||
|
||||
if(m_State == EXECUTING)
|
||||
{
|
||||
if(m_Cmd->ShouldRerecordCmd(CommandList) && m_Cmd->InRerecordRange(CommandList))
|
||||
{
|
||||
Unwrap(m_Cmd->RerecordCmdList(CommandList))->OMSetBlendFactor(factor);
|
||||
|
||||
memcpy(m_Cmd->m_RenderState.blendFactor, factor, sizeof(factor));
|
||||
}
|
||||
}
|
||||
else if(m_State == READING)
|
||||
{
|
||||
GetList(CommandList)->OMSetBlendFactor(factor);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedID3D12GraphicsCommandList::OMSetBlendFactor(const FLOAT BlendFactor[4])
|
||||
{
|
||||
D3D12NOTIMP(__PRETTY_FUNCTION_SIGNATURE__);
|
||||
m_pReal->OMSetBlendFactor(BlendFactor);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(SET_BLENDFACTOR);
|
||||
Serialise_OMSetBlendFactor(BlendFactor);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedID3D12GraphicsCommandList::Serialise_OMSetStencilRef(UINT StencilRef)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, CommandList, GetResourceID());
|
||||
SERIALISE_ELEMENT(UINT, ref, StencilRef);
|
||||
|
||||
if(m_State < WRITING)
|
||||
m_Cmd->m_LastCmdListID = CommandList;
|
||||
|
||||
if(m_State == EXECUTING)
|
||||
{
|
||||
if(m_Cmd->ShouldRerecordCmd(CommandList) && m_Cmd->InRerecordRange(CommandList))
|
||||
{
|
||||
Unwrap(m_Cmd->RerecordCmdList(CommandList))->OMSetStencilRef(ref);
|
||||
|
||||
m_Cmd->m_RenderState.stencilRef = ref;
|
||||
}
|
||||
}
|
||||
else if(m_State == READING)
|
||||
{
|
||||
GetList(CommandList)->OMSetStencilRef(ref);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedID3D12GraphicsCommandList::OMSetStencilRef(UINT StencilRef)
|
||||
{
|
||||
D3D12NOTIMP(__PRETTY_FUNCTION_SIGNATURE__);
|
||||
m_pReal->OMSetStencilRef(StencilRef);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(SET_STENCIL);
|
||||
Serialise_OMSetStencilRef(StencilRef);
|
||||
|
||||
m_ListRecord->AddChunk(scope.Get());
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedID3D12GraphicsCommandList::Serialise_SetDescriptorHeaps(
|
||||
|
||||
@@ -304,6 +304,8 @@ void WrappedID3D12CommandQueue::ProcessChunk(uint64_t offset, D3D12ChunkType chu
|
||||
case SET_VBUFFERS: m_ReplayList->Serialise_IASetVertexBuffers(0, 0, NULL); break;
|
||||
case SET_VIEWPORTS: m_ReplayList->Serialise_RSSetViewports(0, NULL); break;
|
||||
case SET_SCISSORS: m_ReplayList->Serialise_RSSetScissorRects(0, NULL); break;
|
||||
case SET_STENCIL: m_ReplayList->Serialise_OMSetStencilRef(0); break;
|
||||
case SET_BLENDFACTOR: m_ReplayList->Serialise_OMSetBlendFactor(NULL); break;
|
||||
case SET_PIPE: m_ReplayList->Serialise_SetPipelineState(NULL); break;
|
||||
case SET_RTVS: m_ReplayList->Serialise_OMSetRenderTargets(0, NULL, FALSE, NULL); break;
|
||||
case SET_DESC_HEAPS: m_ReplayList->Serialise_SetDescriptorHeaps(0, NULL); break;
|
||||
|
||||
@@ -275,6 +275,8 @@ void Serialiser::Serialise(const char *name, D3D12Descriptor &el);
|
||||
D3D12_CHUNK_MACRO(SET_PIPE, "ID3D12GraphicsCommandList::SetPipelineState") \
|
||||
D3D12_CHUNK_MACRO(SET_DESC_HEAPS, "ID3D12GraphicsCommandList::SetDescriptorHeaps") \
|
||||
D3D12_CHUNK_MACRO(SET_RTVS, "ID3D12GraphicsCommandList::OMSetRenderTargets") \
|
||||
D3D12_CHUNK_MACRO(SET_STENCIL, "ID3D12GraphicsCommandList::OMSetStencilRef") \
|
||||
D3D12_CHUNK_MACRO(SET_BLENDFACTOR, "ID3D12GraphicsCommandList::OMSetBlendFactor") \
|
||||
\
|
||||
D3D12_CHUNK_MACRO(SET_GFX_ROOT_TABLE, \
|
||||
"ID3D12GraphicsCommandList::SetGraphicsRootDescriptorTable") \
|
||||
|
||||
@@ -46,6 +46,9 @@ D3D12RenderState::D3D12RenderState()
|
||||
|
||||
topo = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
|
||||
|
||||
stencilRef = 0;
|
||||
RDCEraseEl(blendFactor);
|
||||
|
||||
RDCEraseEl(ibuffer);
|
||||
vbuffers.clear();
|
||||
}
|
||||
@@ -69,6 +72,8 @@ D3D12RenderState &D3D12RenderState::operator=(const D3D12RenderState &o)
|
||||
compute.sigelems = o.compute.sigelems;
|
||||
|
||||
topo = o.topo;
|
||||
stencilRef = o.stencilRef;
|
||||
memcpy(blendFactor, o.blendFactor, sizeof(blendFactor));
|
||||
|
||||
ibuffer = o.ibuffer;
|
||||
vbuffers = o.vbuffers;
|
||||
@@ -90,6 +95,9 @@ void D3D12RenderState::ApplyState(ID3D12GraphicsCommandList *cmd)
|
||||
if(topo != D3D_PRIMITIVE_TOPOLOGY_UNDEFINED)
|
||||
cmd->IASetPrimitiveTopology(topo);
|
||||
|
||||
cmd->OMSetStencilRef(stencilRef);
|
||||
cmd->OMSetBlendFactor(blendFactor);
|
||||
|
||||
if(ibuffer.buf != ResourceId())
|
||||
{
|
||||
D3D12_INDEX_BUFFER_VIEW ib;
|
||||
|
||||
@@ -167,6 +167,8 @@ struct D3D12RenderState
|
||||
ResourceId pipe;
|
||||
|
||||
D3D12_PRIMITIVE_TOPOLOGY topo;
|
||||
UINT stencilRef;
|
||||
float blendFactor[4];
|
||||
|
||||
struct IdxBuffer
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user