-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTODO.txt
29 lines (26 loc) · 2.74 KB
/
TODO.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Submit all graphic elements instead of one by one.
More cache friendly
Allow to allocate only once
MLP said :
There are a lot of possible patterns depending on the lifetime of the data and how often you need to update those constant buffers.
Like Jesse said you really don't want to be calling CreateCommittedResource on your critical since that will allocate memory.
So allocating in advance is a better way to go for sure. You can also have middle-ground options: for example you can pre-allocate a large buffer up-front,
and then sub-allocate from that buffer as-needed to grab "chunks" of memory to use as a constant buffer.
In game engines it's quite common to have a system where you have a large buffer, and every frame you reset it back to 0.
Then you can fill it up with temporary data (that only lasts for the current frame) by simply advancing the start pointer.
This can let you freely grab a bit of memory for each draw, without necessarily having to associate a single persistent allocation with every possible draw.
btw if you want some examples I have a Buffer type in my little framework that basically wraps a persistent buffer allocation, which is good for these cases:
* The buffer data is static, and only uploaded once when created
* The buffer is only written to by the GPU and never updated from the CPU
* The buffer is occasionally updated from the CPU (in this case it actually allocated two buffers behind the scenes that it can swap between)
https://github.com/TheRealMJP/DXRPathTracer/blob/master/SampleFramework12/v1.02/Graphics/GraphicsTypes.h#L81
Then for "fire-and-forget" cases where you don't want to allocate ahead-of-time and just want some memory to use for the current frame, I have single function for grabbing a piece of memory from a big per-frame temporary buffer:
https://github.com/TheRealMJP/DXRPathTracer/blob/master/SampleFramework12/v1.02/Graphics/DX12_Upload.h#L49
And then I have a helper function for constant buffers that takes a struct, grabs a piece of temp buffer memory, copies the struct data into the buffer, and then binds it as a root CBV using the 64-bit GPU virtual address:
https://github.com/TheRealMJP/DXRPathTracer/blob/master/SampleFramework12/v1.02/Graphics/DX12_Helpers.h#L188
Lights views are updated at every frame even when empty. bad.
Add the posibility to remove component.
Add depth stencil / render target / texture creation.
Add view(a.k.a descriptor?) creation.
Add shader creation : Handle<Shader> CreateShader(const dString& path); at first it just creates shader without asking anything, but in the long run I would like to have some kind of system that verify if the shader has already been compiled.
Add pipeline creation. Ultimately I would like to have precached pipeline.