0

There is an nice idea that; while GPU is rendering your last frame, you handle your current frame's gameplay and physics calculations with CPU to eliminate wasting cpu time.

My understanding is that, RootSignatures are objects that holds connections of d3d resources, and your CommandLists are allocated with CommandAllocator and at the end you add all your Lists inside a CommandQueue and order the GPU to execute those CommandLists.

Since i can not (or should not) use a d3d object (like CommandList) while it is being processed inside GPU (executed), do i have to have a secondary CommandList.

My first question is do i have to double the resources i have for the secondary frame?

and second question is, how RootSignature holds what connected to what exactly, because the examples and samples i look from the internet, doesnt show much stuff, its like RootSignature is a very passive object, that you dont referred to it too much although it suppose to hold a lot of information

(i am sending an image to show my understanding of how to approach frames in modern apis, i hope image shows up, and please check the image and correct me)

enter image description here

Ibrahim Ozdemir
  • 613
  • 1
  • 5
  • 18

1 Answers1

2

If the resources are unchanged from frame-to-frame, then you just reuse them. If you have specific dependencies on the resources (such as being written by a previous frame), then you use Resource Barriers to make sure they synchronize correctly.

If the resources are dynamic and change each frame (like Constant Buffers), then you will need to keep a number of them 'in-flight' until the GPU is done with them--typically 2 or three frames. This is generally done with fences. See DirectX Tool Kit's LinearAllocator .cpp / .h for an example implementation.

The RootSignature describes how data & resources bound at the moment map to the active shader. They are basically the 'shared header' between the CPU and GPU programming models.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81