• 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.3dgep.com/learning-directx-12-3/

    https://docs.microsoft.com/en-us/windows/win32/direct3d12/descriptors

    https://docs.microsoft.com/en-us/windows/win32/direct3d12/descriptors-overview

    descriptors包含srv uav cbv sampler等资源

    bind的时候是用descriptor来bind的

    这东西就相当于metal的 argument buffer/argument table

    https://docs.microsoft.com/en-us/windows/win32/direct3d12/copying-descriptors

    descriptor copy是一个走cpu timeline的操作

    但source不能对gpu可见 dest可以对cpu gpu都可见

    所以cpu copy descriptor的时候 要等gpu把这些资源用完

    https://docs.microsoft.com/en-us/windows/win32/direct3d12/resource-binding-flow-of-control

    resource类型

    • Constant buffer view (CBV)
    • Unordered access view (UAV)
    • Shader resource view (SRV)
    • Samplers
    • Render Target View (RTV)
    • Depth Stencil View (DSV)
    • Index Buffer View (IBV)
    • Vertex Buffer View (VBV)
    • Stream Output View (SOV)
  • 相关阅读:
    单点登录的实现原理
    Entity Framework添加记录时获取自增ID值
    linq to entity查询,日期格式化
    Linq之GroupBy用法
    IIS HTTPS CA
    CallContext和多线程
    windows平台 culture name 详细列表
    如何在WCF中集成unity
    .NET MVC 依赖注入 来龙去脉
    apache虚拟主机安装注意事项
  • 原文地址:https://www.cnblogs.com/minggoddess/p/9703728.html
Copyright © 2020-2023  润新知