DX12

CD3DX12_DESCRIPTOR_RANGE1

的baseShaderRegister

用来指定 t0 t1 b0 b1...的index 

t0 srv

b0 constant buffer

u0 uav

这个的名字叫 hlsl bind slot

还有个index 叫 API bind slot 

pCmdList->SetComputeRoot32BitConstant(0,seed); // 0 is the parameter index,--api bind slot

=============

Descriptor GPU资源的描述信息

Descriptor Heaps 

Descriptor Tables

可以快速申请,因为只是标记(memory 地址)

CD3DX12_DESCRIPTOR_RANGE1 DescRange[6]; DescRange[0].Init(D3D12_DESCRIPTOR_RANGE_SRV,6,2); // t2-t7

DescRange[1].Init(D3D12_DESCRIPTOR_RANGE_UAV,4,0); // u0-u3

DescRange[2].Init(D3D12_DESCRIPTOR_RANGE_SAMPLER,2,0); // s0-s1

 

CD3DX12_ROOT_PARAMETER1 RP[7]; RP[0].InitAsConstants(3,2); // 3 constants at b2

RP[1].InitAsDescriptorTable(2,&DescRange[0]); // 2 ranges t2-t7 and u0-u3

 

CD3DX12_STATIC_SAMPLER StaticSamplers[1];

StaticSamplers[0].Init(3, D3D12_FILTER_ANISOTROPIC); // s3

 

CD3DX12_STATIC_SAMPLER StaticSamplers[1];

StaticSamplers[0].Init(3, D3D12_FILTER_ANISOTROPIC); // s3

CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC RootSig(7,RP,1,StaticSamplers);

ID3DBlob* pSerializedRootSig;

CheckHR(D3D12SerializeVersionedRootSignature(&RootSig,pSerializedRootSig));

ID3D12RootSignature* pRootSignature;

hr = CheckHR(pDevice->CreateRootSignature( pSerializedRootSig->GetBufferPointer(),pSerializedRootSig->GetBufferSize(), __uuidof(ID3D12RootSignature), &pRootSignature));

Root Signaatures 包含 root constants, root descriptors,   descriptor tables 三种类型

是shader paramaters

 

REF:

https://docs.microsoft.com/en-us/windows/desktop/direct3d12/descriptor-tables-overview

https://docs.microsoft.com/en-us/windows/desktop/direct3d12/creating-a-root-signature

转载于:https://www.cnblogs.com/minggoddess/p/9703728.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值