MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXNTC / Init

Method Init

libraries/ntc-utils/src/GraphicsDecompressionPass.cpp:19–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17#include <donut/core/log.h>
18
19bool GraphicsDecompressionPass::Init()
20{
21 // Make sure the binding layout exists
22 if (!m_bindingLayout)
23 {
24 nvrhi::VulkanBindingOffsets vulkanBindingOffsets;
25 vulkanBindingOffsets
26 .setConstantBufferOffset(0)
27 .setSamplerOffset(0)
28 .setShaderResourceOffset(0)
29 .setUnorderedAccessViewOffset(0);
30
31 nvrhi::BindingLayoutDesc layoutDesc;
32 layoutDesc
33 .setVisibility(nvrhi::ShaderType::Compute)
34 .setBindingOffsets(vulkanBindingOffsets)
35 .setRegisterSpaceAndDescriptorSet(NTC_BINDING_DECOMPRESSION_INPUT_SPACE)
36 .addItem(nvrhi::BindingLayoutItem::VolatileConstantBuffer(NTC_BINDING_DECOMPRESSION_CONSTANT_BUFFER))
37 .addItem(nvrhi::BindingLayoutItem::Texture_SRV(NTC_BINDING_DECOMPRESSION_LATENT_TEXTURE))
38 .addItem(nvrhi::BindingLayoutItem::RawBuffer_SRV(NTC_BINDING_DECOMPRESSION_WEIGHT_BUFFER))
39 .addItem(nvrhi::BindingLayoutItem::Sampler(NTC_BINDING_DECOMPRESSION_LATENT_SAMPLER));
40
41 m_bindingLayout = m_device->createBindingLayout(layoutDesc);
42
43 if (!m_bindingLayout)
44 return false;
45 }
46
47 // Make sure the bindless layout exists
48 if (!m_bindlessLayout)
49 {
50 nvrhi::BindlessLayoutDesc bindlessLayoutDesc;
51 bindlessLayoutDesc
52 .setVisibility(nvrhi::ShaderType::Compute)
53 .setMaxCapacity(m_descriptorTableSize)
54 .addRegisterSpace(nvrhi::BindingLayoutItem::Texture_UAV(NTC_BINDING_DECOMPRESSION_OUTPUT_SPACE));
55
56 m_bindlessLayout = m_device->createBindlessLayout(bindlessLayoutDesc);
57
58 if (!m_bindlessLayout)
59 return false;
60 }
61
62 // Make sure the descriptor table exists
63 if (!m_descriptorTable)
64 {
65 m_descriptorTable = m_device->createDescriptorTable(m_bindlessLayout);
66 if (!m_descriptorTable)
67 return false;
68
69 m_device->resizeDescriptorTable(m_descriptorTable, m_descriptorTableSize, false);
70 }
71
72 if (!m_latentSampler)
73 {
74 nvrhi::SamplerDesc samplerDesc = nvrhi::SamplerDesc()
75 .setAllAddressModes(nvrhi::SamplerAddressMode::Wrap)
76 .setMagFilter(true)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected