|
|
|
@@ -332,98 +332,7 @@ D3D11RenderState::D3D11RenderState(WrappedID3D11DeviceContext *context)
|
|
|
|
|
{
|
|
|
|
|
RDCEraseMem(this, sizeof(D3D11RenderState));
|
|
|
|
|
|
|
|
|
|
// IA
|
|
|
|
|
context->IAGetInputLayout(&IA.Layout);
|
|
|
|
|
context->IAGetPrimitiveTopology(&IA.Topo);
|
|
|
|
|
context->IAGetVertexBuffers(0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT, IA.VBs,
|
|
|
|
|
(UINT *)IA.Strides, (UINT *)IA.Offsets);
|
|
|
|
|
context->IAGetIndexBuffer(&IA.IndexBuffer, &IA.IndexFormat, &IA.IndexOffset);
|
|
|
|
|
|
|
|
|
|
// VS
|
|
|
|
|
context->VSGetShaderResources(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, VS.SRVs);
|
|
|
|
|
context->VSGetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, VS.Samplers);
|
|
|
|
|
context->VSGetShader((ID3D11VertexShader **)&VS.Object, VS.Instances, &VS.NumInstances);
|
|
|
|
|
|
|
|
|
|
// DS
|
|
|
|
|
context->DSGetShaderResources(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, DS.SRVs);
|
|
|
|
|
context->DSGetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, DS.Samplers);
|
|
|
|
|
context->DSGetShader((ID3D11DomainShader **)&DS.Object, DS.Instances, &DS.NumInstances);
|
|
|
|
|
|
|
|
|
|
// HS
|
|
|
|
|
context->HSGetShaderResources(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, HS.SRVs);
|
|
|
|
|
context->HSGetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, HS.Samplers);
|
|
|
|
|
context->HSGetShader((ID3D11HullShader **)&HS.Object, HS.Instances, &HS.NumInstances);
|
|
|
|
|
|
|
|
|
|
// GS
|
|
|
|
|
context->GSGetShaderResources(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, GS.SRVs);
|
|
|
|
|
context->GSGetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, GS.Samplers);
|
|
|
|
|
context->GSGetShader((ID3D11GeometryShader **)&GS.Object, GS.Instances, &GS.NumInstances);
|
|
|
|
|
|
|
|
|
|
context->SOGetTargets(D3D11_SO_BUFFER_SLOT_COUNT, SO.Buffers);
|
|
|
|
|
|
|
|
|
|
// RS
|
|
|
|
|
context->RSGetState(&RS.State);
|
|
|
|
|
RDCEraseEl(RS.Viewports);
|
|
|
|
|
RS.NumViews = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
|
|
|
|
|
context->RSGetViewports(&RS.NumViews, RS.Viewports);
|
|
|
|
|
RDCEraseEl(RS.Scissors);
|
|
|
|
|
RS.NumScissors = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
|
|
|
|
|
context->RSGetScissorRects(&RS.NumScissors, RS.Scissors);
|
|
|
|
|
|
|
|
|
|
// CS
|
|
|
|
|
context->CSGetShaderResources(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, CS.SRVs);
|
|
|
|
|
if(context->IsFL11_1())
|
|
|
|
|
context->CSGetUnorderedAccessViews(0, D3D11_1_UAV_SLOT_COUNT, CSUAVs);
|
|
|
|
|
else
|
|
|
|
|
context->CSGetUnorderedAccessViews(0, D3D11_PS_CS_UAV_REGISTER_COUNT, CSUAVs);
|
|
|
|
|
context->CSGetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, CS.Samplers);
|
|
|
|
|
context->CSGetShader((ID3D11ComputeShader **)&CS.Object, CS.Instances, &CS.NumInstances);
|
|
|
|
|
|
|
|
|
|
// PS
|
|
|
|
|
context->PSGetShaderResources(0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, PS.SRVs);
|
|
|
|
|
context->PSGetSamplers(0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, PS.Samplers);
|
|
|
|
|
context->PSGetShader((ID3D11PixelShader **)&PS.Object, PS.Instances, &PS.NumInstances);
|
|
|
|
|
|
|
|
|
|
context->VSGetConstantBuffers1(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT,
|
|
|
|
|
VS.ConstantBuffers, VS.CBOffsets, VS.CBCounts);
|
|
|
|
|
context->DSGetConstantBuffers1(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT,
|
|
|
|
|
DS.ConstantBuffers, DS.CBOffsets, DS.CBCounts);
|
|
|
|
|
context->HSGetConstantBuffers1(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT,
|
|
|
|
|
HS.ConstantBuffers, HS.CBOffsets, HS.CBCounts);
|
|
|
|
|
context->GSGetConstantBuffers1(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT,
|
|
|
|
|
GS.ConstantBuffers, GS.CBOffsets, GS.CBCounts);
|
|
|
|
|
context->CSGetConstantBuffers1(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT,
|
|
|
|
|
CS.ConstantBuffers, CS.CBOffsets, CS.CBCounts);
|
|
|
|
|
context->PSGetConstantBuffers1(0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT,
|
|
|
|
|
PS.ConstantBuffers, PS.CBOffsets, PS.CBCounts);
|
|
|
|
|
|
|
|
|
|
// OM
|
|
|
|
|
context->OMGetBlendState(&OM.BlendState, OM.BlendFactor, &OM.SampleMask);
|
|
|
|
|
context->OMGetDepthStencilState(&OM.DepthStencilState, &OM.StencRef);
|
|
|
|
|
|
|
|
|
|
ID3D11RenderTargetView *tmpViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT];
|
|
|
|
|
context->OMGetRenderTargets(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, tmpViews, NULL);
|
|
|
|
|
|
|
|
|
|
OM.UAVStartSlot = 0;
|
|
|
|
|
for(int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
|
|
|
|
|
{
|
|
|
|
|
if(tmpViews[i] != NULL)
|
|
|
|
|
{
|
|
|
|
|
OM.UAVStartSlot = i + 1;
|
|
|
|
|
SAFE_RELEASE(tmpViews[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(context->IsFL11_1())
|
|
|
|
|
context->OMGetRenderTargetsAndUnorderedAccessViews(
|
|
|
|
|
OM.UAVStartSlot, OM.RenderTargets, &OM.DepthView, OM.UAVStartSlot,
|
|
|
|
|
D3D11_1_UAV_SLOT_COUNT - OM.UAVStartSlot, OM.UAVs);
|
|
|
|
|
else
|
|
|
|
|
context->OMGetRenderTargetsAndUnorderedAccessViews(
|
|
|
|
|
OM.UAVStartSlot, OM.RenderTargets, &OM.DepthView, OM.UAVStartSlot,
|
|
|
|
|
D3D11_PS_CS_UAV_REGISTER_COUNT - OM.UAVStartSlot, OM.UAVs);
|
|
|
|
|
|
|
|
|
|
context->GetPredication(&Predicate, &PredicateValue);
|
|
|
|
|
CopyState(*context->GetCurrentPipelineState());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void D3D11RenderState::Clear()
|
|
|
|
|