MCPcopy Create free account
hub / github.com/Autodesk/Aurora / initRootSignatures

Method initRootSignatures

Libraries/Aurora/Source/DirectX/PTShaderLibrary.cpp:385–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383}
384
385void PTShaderLibrary::initRootSignatures(int globalTextureCount, int globalSamplerCount)
386{
387 // Specify the global root signature for all shaders. This includes a global static sampler
388 // which shaders can use by default, as well as dynamic samplers per-material.
389 CD3DX12_DESCRIPTOR_RANGE texRange;
390 CD3DX12_DESCRIPTOR_RANGE samplerRange;
391
392 // Create the global root signature.
393 // Must match the root signature data setup in PTRenderer::submitRayDispatch and the GPU
394 // version in GlobalRootSignature.slang.
395 array<CD3DX12_ROOT_PARAMETER, 14> globalRootParameters = {}; // NOLINT(modernize-avoid-c-arrays)
396 globalRootParameters[0].InitAsShaderResourceView(0); // gScene: acceleration structure
397 globalRootParameters[1].InitAsConstants(2, 0); // sampleIndex + seedOffset
398 globalRootParameters[2].InitAsConstantBufferView(1); // gFrameData: per-frame constant buffer
399 globalRootParameters[3].InitAsConstantBufferView(2); // gEnvironmentConstants
400 globalRootParameters[4].InitAsShaderResourceView(1); // gEnvironmentAliasMap
401 texRange.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 2,
402 2); // gEnvironmentLight/BackgroundTexture (starting at t2)
403 CD3DX12_DESCRIPTOR_RANGE globalRootRanges[] = { texRange }; // NOLINT(modernize-avoid-c-arrays)
404 globalRootParameters[5].InitAsDescriptorTable(_countof(globalRootRanges), globalRootRanges);
405 globalRootParameters[6].InitAsConstantBufferView(3); // gGroundPlane
406 globalRootParameters[7].InitAsShaderResourceView(4); // gNullScene: null acceleration structure
407 globalRootParameters[8].InitAsShaderResourceView(
408 5); // gGlobalMaterialConstants: global material constants.
409 globalRootParameters[9].InitAsShaderResourceView(
410 6); // gGlobalInstanceBuffer: global instance data.
411 globalRootParameters[10].InitAsShaderResourceView(
412 7); // gLayerGeometryBuffer: UVs for geometry layers.
413 globalRootParameters[11].InitAsShaderResourceView(
414 8); // gTransformMatrixBuffer: Tranform matrices for all instances.
415
416 texRange.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, globalTextureCount,
417 9); // gGlobalMaterialTextures: Global scene textures.
418 CD3DX12_DESCRIPTOR_RANGE sceneTextureRanges[] = {
419 texRange
420 }; // NOLINT(modernize-avoid-c-arrays)
421 globalRootParameters[12].InitAsDescriptorTable(
422 _countof(sceneTextureRanges), sceneTextureRanges);
423
424 // Sampler descriptors in gGlobalMaterialSamplers array starting at register(s0)
425 samplerRange.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, globalSamplerCount, 0);
426 CD3DX12_DESCRIPTOR_RANGE globalSamplerRanges[] = {
427 samplerRange
428 }; // NOLINT(modernize-avoid-c-arrays)
429 globalRootParameters[13].InitAsDescriptorTable(
430 _countof(globalSamplerRanges), globalSamplerRanges);
431
432 // Create the global root signature object, there are no static samplers (all the samplers
433 // including default sampler are stored in gSamplerArray.)
434 CD3DX12_ROOT_SIGNATURE_DESC globalDesc(
435 static_cast<UINT>(globalRootParameters.size()), globalRootParameters.data(), 0, nullptr);
436 _pGlobalRootSignature = createRootSignature(globalDesc);
437 _pGlobalRootSignature->SetName(L"Global Root Signature");
438
439 // Specify a local root signature for the ray gen shader.
440 // The AOV descriptor count defined here must match the AOV RWTexture2Ds defined in
441 // MainEntryPoints.slang. and the descriptors uploaded to the heap in
442 // PTRenderer::updateOutputResources and PTRenderer::updateDenoisingResources.

Callers

nothing calls this directly

Calls 7

InitAsConstantsMethod · 0.45
InitMethod · 0.45
InitAsDescriptorTableMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected