Updated for latest d3dx12.h (10.0.16299.15)
This commit is contained in:
Родитель
506f1e3582
Коммит
79e328b2fb
|
@ -1882,6 +1882,36 @@ inline bool operator==( const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC&
|
|||
inline bool operator!=( const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& r )
|
||||
{ return !( l == r ); }
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// Requires the Windows 10 Fall Creators Update SDK (16299)
|
||||
#if defined(NTDDI_WIN10_RS3) && (NTDDI_VERSION >= NTDDI_WIN10_RS3)
|
||||
struct CD3DX12_VIEW_INSTANCING_DESC : public D3D12_VIEW_INSTANCING_DESC
|
||||
{
|
||||
CD3DX12_VIEW_INSTANCING_DESC()
|
||||
{}
|
||||
explicit CD3DX12_VIEW_INSTANCING_DESC( const D3D12_VIEW_INSTANCING_DESC& o ) :
|
||||
D3D12_VIEW_INSTANCING_DESC( o )
|
||||
{}
|
||||
explicit CD3DX12_VIEW_INSTANCING_DESC( CD3DX12_DEFAULT )
|
||||
{
|
||||
ViewInstanceCount = 0;
|
||||
pViewInstanceLocations = nullptr;
|
||||
Flags = D3D12_VIEW_INSTANCING_FLAG_NONE;
|
||||
}
|
||||
explicit CD3DX12_VIEW_INSTANCING_DESC(
|
||||
UINT InViewInstanceCount,
|
||||
const D3D12_VIEW_INSTANCE_LOCATION* InViewInstanceLocations,
|
||||
D3D12_VIEW_INSTANCING_FLAGS InFlags)
|
||||
{
|
||||
ViewInstanceCount = InViewInstanceCount;
|
||||
pViewInstanceLocations = InViewInstanceLocations;
|
||||
Flags = InFlags;
|
||||
}
|
||||
~CD3DX12_VIEW_INSTANCING_DESC() {}
|
||||
operator const D3D12_VIEW_INSTANCING_DESC&() const { return *this; }
|
||||
};
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// Row-by-row memcpy
|
||||
inline void MemcpySubresource(
|
||||
|
@ -1965,7 +1995,6 @@ inline UINT64 UpdateSubresources(
|
|||
|
||||
if (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
|
||||
{
|
||||
CD3DX12_BOX SrcBox( UINT( pLayouts[0].Offset ), UINT( pLayouts[0].Offset + pLayouts[0].Footprint.Width ) );
|
||||
pCmdList->CopyBufferRegion(
|
||||
pDestinationResource, 0, pIntermediate, pLayouts[0].Offset, pLayouts[0].Footprint.Width);
|
||||
}
|
||||
|
@ -2204,6 +2233,9 @@ struct CD3DX12_RT_FORMAT_ARRAY : public D3D12_RT_FORMAT_ARRAY
|
|||
//------------------------------------------------------------------------------------------------
|
||||
// Stream Subobjects, i.e. elements of a stream
|
||||
|
||||
struct DefaultSampleMask { operator UINT() { return UINT_MAX; } };
|
||||
struct DefaultSampleDesc { operator DXGI_SAMPLE_DESC() { return DXGI_SAMPLE_DESC{1, 0}; } };
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4324)
|
||||
template <typename InnerStructType, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type, typename DefaultArg = InnerStructType>
|
||||
|
@ -2217,30 +2249,34 @@ public:
|
|||
CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT(InnerStructType const& i) : _Type(Type), _Inner(i) {}
|
||||
CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT& operator=(InnerStructType const& i) { _Inner = i; return *this; }
|
||||
operator InnerStructType() const { return _Inner; }
|
||||
operator InnerStructType&() { return _Inner; }
|
||||
};
|
||||
#pragma warning(pop)
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_PIPELINE_STATE_FLAGS, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS> CD3DX12_PIPELINE_STATE_STREAM_FLAGS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< UINT, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK> CD3DX12_PIPELINE_STATE_STREAM_NODE_MASK;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< ID3D12RootSignature*, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE> CD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_INPUT_LAYOUT_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT> CD3DX12_PIPELINE_STATE_STREAM_INPUT_LAYOUT;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_INDEX_BUFFER_STRIP_CUT_VALUE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_IB_STRIP_CUT_VALUE> CD3DX12_PIPELINE_STATE_STREAM_IB_STRIP_CUT_VALUE;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_PRIMITIVE_TOPOLOGY_TYPE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY> CD3DX12_PIPELINE_STATE_STREAM_PRIMITIVE_TOPOLOGY;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VS> CD3DX12_PIPELINE_STATE_STREAM_VS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_GS> CD3DX12_PIPELINE_STATE_STREAM_GS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_STREAM_OUTPUT_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_STREAM_OUTPUT> CD3DX12_PIPELINE_STATE_STREAM_STREAM_OUTPUT;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_HS> CD3DX12_PIPELINE_STATE_STREAM_HS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DS> CD3DX12_PIPELINE_STATE_STREAM_DS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PS> CD3DX12_PIPELINE_STATE_STREAM_PS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CS> CD3DX12_PIPELINE_STATE_STREAM_CS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< CD3DX12_BLEND_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_BLEND, CD3DX12_DEFAULT> CD3DX12_PIPELINE_STATE_STREAM_BLEND_DESC;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< CD3DX12_DEPTH_STENCIL_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL, CD3DX12_DEFAULT> CD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< CD3DX12_DEPTH_STENCIL_DESC1, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1, CD3DX12_DEFAULT> CD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL1;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< DXGI_FORMAT, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT> CD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL_FORMAT;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< CD3DX12_RASTERIZER_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER, CD3DX12_DEFAULT> CD3DX12_PIPELINE_STATE_STREAM_RASTERIZER;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_RT_FORMAT_ARRAY, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS> CD3DX12_PIPELINE_STATE_STREAM_RENDER_TARGET_FORMATS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< DXGI_SAMPLE_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_DESC> CD3DX12_PIPELINE_STATE_STREAM_SAMPLE_DESC;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< UINT, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_MASK> CD3DX12_PIPELINE_STATE_STREAM_SAMPLE_MASK;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_CACHED_PIPELINE_STATE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CACHED_PSO> CD3DX12_PIPELINE_STATE_STREAM_CACHED_PSO;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_PIPELINE_STATE_FLAGS, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS> CD3DX12_PIPELINE_STATE_STREAM_FLAGS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< UINT, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK> CD3DX12_PIPELINE_STATE_STREAM_NODE_MASK;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< ID3D12RootSignature*, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE> CD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_INPUT_LAYOUT_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT> CD3DX12_PIPELINE_STATE_STREAM_INPUT_LAYOUT;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_INDEX_BUFFER_STRIP_CUT_VALUE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_IB_STRIP_CUT_VALUE> CD3DX12_PIPELINE_STATE_STREAM_IB_STRIP_CUT_VALUE;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_PRIMITIVE_TOPOLOGY_TYPE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY> CD3DX12_PIPELINE_STATE_STREAM_PRIMITIVE_TOPOLOGY;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VS> CD3DX12_PIPELINE_STATE_STREAM_VS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_GS> CD3DX12_PIPELINE_STATE_STREAM_GS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_STREAM_OUTPUT_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_STREAM_OUTPUT> CD3DX12_PIPELINE_STATE_STREAM_STREAM_OUTPUT;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_HS> CD3DX12_PIPELINE_STATE_STREAM_HS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DS> CD3DX12_PIPELINE_STATE_STREAM_DS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PS> CD3DX12_PIPELINE_STATE_STREAM_PS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_SHADER_BYTECODE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CS> CD3DX12_PIPELINE_STATE_STREAM_CS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< CD3DX12_BLEND_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_BLEND, CD3DX12_DEFAULT> CD3DX12_PIPELINE_STATE_STREAM_BLEND_DESC;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< CD3DX12_DEPTH_STENCIL_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL, CD3DX12_DEFAULT> CD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< CD3DX12_DEPTH_STENCIL_DESC1, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1, CD3DX12_DEFAULT> CD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL1;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< DXGI_FORMAT, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT> CD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL_FORMAT;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< CD3DX12_RASTERIZER_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER, CD3DX12_DEFAULT> CD3DX12_PIPELINE_STATE_STREAM_RASTERIZER;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_RT_FORMAT_ARRAY, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS> CD3DX12_PIPELINE_STATE_STREAM_RENDER_TARGET_FORMATS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< DXGI_SAMPLE_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_DESC, DefaultSampleDesc> CD3DX12_PIPELINE_STATE_STREAM_SAMPLE_DESC;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< UINT, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_MASK, DefaultSampleMask> CD3DX12_PIPELINE_STATE_STREAM_SAMPLE_MASK;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_CACHED_PIPELINE_STATE, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CACHED_PSO> CD3DX12_PIPELINE_STATE_STREAM_CACHED_PSO;
|
||||
#if defined(NTDDI_WIN10_RS3) && (NTDDI_VERSION >= NTDDI_WIN10_RS3)
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< CD3DX12_VIEW_INSTANCING_DESC, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING, CD3DX12_DEFAULT> CD3DX12_PIPELINE_STATE_STREAM_VIEW_INSTANCING;
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// Stream Parser Helpers
|
||||
|
@ -2269,6 +2305,9 @@ struct ID3DX12PipelineParserCallbacks
|
|||
virtual void RTVFormatsCb(const D3D12_RT_FORMAT_ARRAY&) {}
|
||||
virtual void SampleDescCb(const DXGI_SAMPLE_DESC&) {}
|
||||
virtual void SampleMaskCb(UINT) {}
|
||||
#if defined(NTDDI_WIN10_RS3) && (NTDDI_VERSION >= NTDDI_WIN10_RS3)
|
||||
virtual void ViewInstancingCb(const D3D12_VIEW_INSTANCING_DESC&) {}
|
||||
#endif
|
||||
virtual void CachedPSOCb(const D3D12_CACHED_PIPELINE_STATE&) {}
|
||||
|
||||
// Error Callbacks
|
||||
|
@ -2278,6 +2317,106 @@ struct ID3DX12PipelineParserCallbacks
|
|||
|
||||
};
|
||||
|
||||
// Requires the Windows 10 Fall Creators Update SDK (16299)
|
||||
#if defined(NTDDI_WIN10_RS3) && (NTDDI_VERSION >= NTDDI_WIN10_RS3)
|
||||
// CD3DX12_PIPELINE_STATE_STREAM1 Works on RS3+ (where there is a new view instancing subobject).
|
||||
// Use CD3DX12_PIPELINE_STATE_STREAM for RS2+ support.
|
||||
struct CD3DX12_PIPELINE_STATE_STREAM1
|
||||
{
|
||||
CD3DX12_PIPELINE_STATE_STREAM1() {}
|
||||
CD3DX12_PIPELINE_STATE_STREAM1(const D3D12_GRAPHICS_PIPELINE_STATE_DESC& Desc)
|
||||
: Flags(Desc.Flags)
|
||||
, NodeMask(Desc.NodeMask)
|
||||
, pRootSignature(Desc.pRootSignature)
|
||||
, InputLayout(Desc.InputLayout)
|
||||
, IBStripCutValue(Desc.IBStripCutValue)
|
||||
, PrimitiveTopologyType(Desc.PrimitiveTopologyType)
|
||||
, VS(Desc.VS)
|
||||
, GS(Desc.GS)
|
||||
, StreamOutput(Desc.StreamOutput)
|
||||
, HS(Desc.HS)
|
||||
, DS(Desc.DS)
|
||||
, PS(Desc.PS)
|
||||
, BlendState(CD3DX12_BLEND_DESC(Desc.BlendState))
|
||||
, DepthStencilState(CD3DX12_DEPTH_STENCIL_DESC1(Desc.DepthStencilState))
|
||||
, DSVFormat(Desc.DSVFormat)
|
||||
, RasterizerState(CD3DX12_RASTERIZER_DESC(Desc.RasterizerState))
|
||||
, RTVFormats(CD3DX12_RT_FORMAT_ARRAY(Desc.RTVFormats, Desc.NumRenderTargets))
|
||||
, SampleDesc(Desc.SampleDesc)
|
||||
, SampleMask(Desc.SampleMask)
|
||||
, CachedPSO(Desc.CachedPSO)
|
||||
, ViewInstancingDesc(CD3DX12_VIEW_INSTANCING_DESC(CD3DX12_DEFAULT()))
|
||||
{}
|
||||
CD3DX12_PIPELINE_STATE_STREAM1(const D3D12_COMPUTE_PIPELINE_STATE_DESC& Desc)
|
||||
: Flags(Desc.Flags)
|
||||
, NodeMask(Desc.NodeMask)
|
||||
, pRootSignature(Desc.pRootSignature)
|
||||
, CS(CD3DX12_SHADER_BYTECODE(Desc.CS))
|
||||
, CachedPSO(Desc.CachedPSO)
|
||||
{}
|
||||
CD3DX12_PIPELINE_STATE_STREAM_FLAGS Flags;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_NODE_MASK NodeMask;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE pRootSignature;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_INPUT_LAYOUT InputLayout;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_IB_STRIP_CUT_VALUE IBStripCutValue;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_PRIMITIVE_TOPOLOGY PrimitiveTopologyType;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_VS VS;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_GS GS;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_STREAM_OUTPUT StreamOutput;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_HS HS;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_DS DS;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_PS PS;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_CS CS;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_BLEND_DESC BlendState;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL1 DepthStencilState;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_DEPTH_STENCIL_FORMAT DSVFormat;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_RASTERIZER RasterizerState;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_RENDER_TARGET_FORMATS RTVFormats;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_SAMPLE_DESC SampleDesc;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_SAMPLE_MASK SampleMask;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_CACHED_PSO CachedPSO;
|
||||
CD3DX12_PIPELINE_STATE_STREAM_VIEW_INSTANCING ViewInstancingDesc;
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC GraphicsDescV0() const
|
||||
{
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC D;
|
||||
D.Flags = this->Flags;
|
||||
D.NodeMask = this->NodeMask;
|
||||
D.pRootSignature = this->pRootSignature;
|
||||
D.InputLayout = this->InputLayout;
|
||||
D.IBStripCutValue = this->IBStripCutValue;
|
||||
D.PrimitiveTopologyType = this->PrimitiveTopologyType;
|
||||
D.VS = this->VS;
|
||||
D.GS = this->GS;
|
||||
D.StreamOutput = this->StreamOutput;
|
||||
D.HS = this->HS;
|
||||
D.DS = this->DS;
|
||||
D.PS = this->PS;
|
||||
D.BlendState = this->BlendState;
|
||||
D.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC1(D3D12_DEPTH_STENCIL_DESC1(this->DepthStencilState));
|
||||
D.DSVFormat = this->DSVFormat;
|
||||
D.RasterizerState = this->RasterizerState;
|
||||
D.NumRenderTargets = D3D12_RT_FORMAT_ARRAY(this->RTVFormats).NumRenderTargets;
|
||||
memcpy(D.RTVFormats, D3D12_RT_FORMAT_ARRAY(this->RTVFormats).RTFormats, sizeof(D.RTVFormats));
|
||||
D.SampleDesc = this->SampleDesc;
|
||||
D.SampleMask = this->SampleMask;
|
||||
D.CachedPSO = this->CachedPSO;
|
||||
return D;
|
||||
}
|
||||
D3D12_COMPUTE_PIPELINE_STATE_DESC ComputeDescV0() const
|
||||
{
|
||||
D3D12_COMPUTE_PIPELINE_STATE_DESC D;
|
||||
D.Flags = this->Flags;
|
||||
D.NodeMask = this->NodeMask;
|
||||
D.pRootSignature = this->pRootSignature;
|
||||
D.CS = this->CS;
|
||||
D.CachedPSO = this->CachedPSO;
|
||||
return D;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
// CD3DX12_PIPELINE_STATE_STREAM works on RS2+ but does not support new subobject(s) added in RS3+.
|
||||
// See CD3DX12_PIPELINE_STATE_STREAM1 for instance.
|
||||
struct CD3DX12_PIPELINE_STATE_STREAM
|
||||
{
|
||||
CD3DX12_PIPELINE_STATE_STREAM() {}
|
||||
|
@ -2371,7 +2510,20 @@ struct CD3DX12_PIPELINE_STATE_STREAM
|
|||
|
||||
struct CD3DX12_PIPELINE_STATE_STREAM_PARSE_HELPER : public ID3DX12PipelineParserCallbacks
|
||||
{
|
||||
#if defined(NTDDI_WIN10_RS3) && (NTDDI_VERSION >= NTDDI_WIN10_RS3)
|
||||
CD3DX12_PIPELINE_STATE_STREAM1 PipelineStream;
|
||||
#else
|
||||
CD3DX12_PIPELINE_STATE_STREAM PipelineStream;
|
||||
#endif
|
||||
CD3DX12_PIPELINE_STATE_STREAM_PARSE_HELPER()
|
||||
: SeenDSS(false)
|
||||
{
|
||||
// Adjust defaults to account for absent members.
|
||||
PipelineStream.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
|
||||
// Depth disabled if no DSV format specified.
|
||||
static_cast<D3D12_DEPTH_STENCIL_DESC1&>(PipelineStream.DepthStencilState).DepthEnable = false;
|
||||
}
|
||||
|
||||
// ID3DX12PipelineParserCallbacks
|
||||
void FlagsCb(D3D12_PIPELINE_STATE_FLAGS Flags) {PipelineStream.Flags = Flags;}
|
||||
|
@ -2388,17 +2540,39 @@ struct CD3DX12_PIPELINE_STATE_STREAM_PARSE_HELPER : public ID3DX12PipelineParser
|
|||
void PSCb(const D3D12_SHADER_BYTECODE& PS) {PipelineStream.PS = PS;}
|
||||
void CSCb(const D3D12_SHADER_BYTECODE& CS) {PipelineStream.CS = CS;}
|
||||
void BlendStateCb(const D3D12_BLEND_DESC& BlendState) {PipelineStream.BlendState = CD3DX12_BLEND_DESC(BlendState);}
|
||||
void DepthStencilStateCb(const D3D12_DEPTH_STENCIL_DESC& DepthStencilState) {PipelineStream.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC1(DepthStencilState);}
|
||||
void DepthStencilState1Cb(const D3D12_DEPTH_STENCIL_DESC1& DepthStencilState) {PipelineStream.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC1(DepthStencilState);}
|
||||
void DSVFormatCb(DXGI_FORMAT DSVFormat) {PipelineStream.DSVFormat = DSVFormat;}
|
||||
void DepthStencilStateCb(const D3D12_DEPTH_STENCIL_DESC& DepthStencilState)
|
||||
{
|
||||
PipelineStream.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC1(DepthStencilState);
|
||||
SeenDSS = true;
|
||||
}
|
||||
void DepthStencilState1Cb(const D3D12_DEPTH_STENCIL_DESC1& DepthStencilState)
|
||||
{
|
||||
PipelineStream.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC1(DepthStencilState);
|
||||
SeenDSS = true;
|
||||
}
|
||||
void DSVFormatCb(DXGI_FORMAT DSVFormat)
|
||||
{
|
||||
PipelineStream.DSVFormat = DSVFormat;
|
||||
if (!SeenDSS && DSVFormat != DXGI_FORMAT_UNKNOWN)
|
||||
{
|
||||
// Re-enable depth for the default state.
|
||||
static_cast<D3D12_DEPTH_STENCIL_DESC1&>(PipelineStream.DepthStencilState).DepthEnable = true;
|
||||
}
|
||||
}
|
||||
void RasterizerStateCb(const D3D12_RASTERIZER_DESC& RasterizerState) {PipelineStream.RasterizerState = CD3DX12_RASTERIZER_DESC(RasterizerState);}
|
||||
void RTVFormatsCb(const D3D12_RT_FORMAT_ARRAY& RTVFormats) {PipelineStream.RTVFormats = RTVFormats;}
|
||||
void SampleDescCb(const DXGI_SAMPLE_DESC& SampleDesc) {PipelineStream.SampleDesc = SampleDesc;}
|
||||
void SampleMaskCb(UINT SampleMask) {PipelineStream.SampleMask = SampleMask;}
|
||||
#if defined(NTDDI_WIN10_RS3) && (NTDDI_VERSION >= NTDDI_WIN10_RS3)
|
||||
void ViewInstancingCb(const D3D12_VIEW_INSTANCING_DESC& ViewInstancingDesc) {PipelineStream.ViewInstancingDesc = CD3DX12_VIEW_INSTANCING_DESC(ViewInstancingDesc);}
|
||||
#endif
|
||||
void CachedPSOCb(const D3D12_CACHED_PIPELINE_STATE& CachedPSO) {PipelineStream.CachedPSO = CachedPSO;}
|
||||
void ErrorBadInputParameter(UINT) {}
|
||||
void ErrorDuplicateSubobject(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE) {}
|
||||
void ErrorUnknownSubobject(UINT) {}
|
||||
|
||||
private:
|
||||
bool SeenDSS;
|
||||
};
|
||||
|
||||
inline D3D12_PIPELINE_STATE_SUBOBJECT_TYPE D3DX12GetBaseSubobjectType(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE SubobjectType)
|
||||
|
@ -2532,6 +2706,12 @@ inline HRESULT D3DX12ParsePipelineStream(const D3D12_PIPELINE_STATE_STREAM_DESC&
|
|||
pCallbacks->FlagsCb(*reinterpret_cast<decltype(CD3DX12_PIPELINE_STATE_STREAM::Flags)*>(pStream));
|
||||
SizeOfSubobject = sizeof(CD3DX12_PIPELINE_STATE_STREAM::Flags);
|
||||
break;
|
||||
#if defined(NTDDI_WIN10_RS3) && (NTDDI_VERSION >= NTDDI_WIN10_RS3)
|
||||
case D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING:
|
||||
pCallbacks->ViewInstancingCb(*reinterpret_cast<decltype(CD3DX12_PIPELINE_STATE_STREAM1::ViewInstancingDesc)*>(pStream));
|
||||
SizeOfSubobject = sizeof(CD3DX12_PIPELINE_STATE_STREAM1::ViewInstancingDesc);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
pCallbacks->ErrorUnknownSubobject(SubobjectType);
|
||||
return E_INVALIDARG;
|
||||
|
|
Загрузка…
Ссылка в новой задаче