Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhdanNV committed Sep 23, 2024
1 parent ebf92ab commit 8b5d1a5
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ bool result = NRD.Initialize(resourceWidth, resourceHeight, instanceCreationDesc
// INITIALIZATION or RENDER - WRAP NATIVE POINTERS
//=======================================================================================================

// Wrap the command buffer
// Wrap a command buffer
nri::CommandBufferD3D12Desc commandBufferDesc = {};
commandBufferDesc.d3d12CommandList = (ID3D12GraphicsCommandList*)d3d12CommandList;

Expand All @@ -489,31 +489,35 @@ nri::CommandBuffer* nriCommandBuffer = nullptr;
NRI.CreateCommandBufferD3D12(*nriDevice, commandBufferDesc, nriCommandBuffer);

// Wrap required textures (better do it only once on initialization)
nri::TextureTransitionBarrierDesc entryDescs[N] = {};
nri::TextureBarrierDesc entryDescs[N] = {};
nri::Format entryFormat[N] = {};

for (uint32_t i = 0; i < N; i++)
{
nri::TextureTransitionBarrierDesc& entryDesc = entryDescs[i];
nri::TextureBarrierDesc& entryDesc = entryDescs[i];
const MyResource& myResource = GetMyResource(i);

nri::TextureD3D12Desc textureDesc = {};
textureDesc.d3d12Resource = myResource->GetNativePointer();

NRI.CreateTextureD3D12(*nriDevice, textureDesc, (nri::Texture*&)entryDesc.texture );

// You need to specify the current state of the resource here, after denoising NRD can modify
// this state. Application must continue state tracking from this point.
// Useful information:
// SRV = nri::AccessBits::SHADER_RESOURCE, nri::TextureLayout::SHADER_RESOURCE
// UAV = nri::AccessBits::SHADER_RESOURCE_STORAGE, nri::TextureLayout::GENERAL
entryDesc.nextState.accessBits = ConvertResourceStateToAccessBits( myResource->GetCurrentState() );
entryDesc.nextState.layout = ConvertResourceStateToLayout( myResource->GetCurrentState() );
entryDesc.after.access = ConvertResourceStateToAccess( myResource->GetCurrentState() );
entryDesc.after.layout = ConvertResourceStateToLayout( myResource->GetCurrentState() );
}

//=======================================================================================================
// RENDER - DENOISE
//=======================================================================================================

// Must be called once on a frame start
NRD.NewFrame();

// Set common settings
// - for the first time use defaults
// - currently NRD supports only the following view space: X - right, Y - top, Z - forward or backward
Expand Down Expand Up @@ -562,11 +566,11 @@ NRI.DestroyCommandBuffer(*nriCommandBuffer);
// SHUTDOWN - DESTROY
//=======================================================================================================

// Release wrapped device
nri::nriDestroyDevice(*nriDevice);

// Also NRD needs to be recreated on "resize"
NRD.Destroy();

// Release wrapped device
nri::nriDestroyDevice(*nriDevice);
```
Shader part:
Expand Down

0 comments on commit 8b5d1a5

Please sign in to comment.