zoukankan      html  css  js  c++  java
  • 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)
  • 相关阅读:
    ADO中的多层次数据集,类似于dataset
    工作流的设计
    Socket bind系统调用简要分析
    linux Network Address Translation NAT 转载 还需要整理
    生活20190602
    磁盘空间满的问题
    linux netfilter nat 实现 转载
    Socket 套接字的系统调用
    linux 网络编程 基础
    学习linux,不要找别人了,我有东西要发
  • 原文地址:https://www.cnblogs.com/minggoddess/p/9703728.html
Copyright © 2011-2022 走看看