Jump to content
  • Advertisement
Sign in to follow this  
grizu

Buffers (Vertex, Index, Constant) In Upload / Default Heaps

This topic is 871 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello forum,
 
I have been a quiet reader for some time now, a lot of questions already have been answered, so thanks :)
I'm just starting with C++ and DirectX12, coming from web development. It's so much fun... ;)
 
One question about buffers. They live in one of two types of heaps: upload, and default.
 
Upload buffers are used for data which changes quite often, so I create one big upload buffer, suballocate as needed and just store offset and size. 
Per object data, dynamic vertices, etc.
 
How about a buffer which lives in a default heap? Can you suballocate the same way? Create one big resource?
Or is management in the default heap always done through methods like CreatePlacedResource, CreateReservedResource, ...?
 
The reason this came up: I try to write small wrapper classes for constant, vertex and index buffers, and I would like the classes to take an argument dynamic/static. I'm not sure how to handle this.
 
Thanks,
Chris

Share this post


Link to post
Share on other sites
Advertisement

Most buffer arguments into the D3D12 API are done via GPU virtual addresses, which can come from a default or upload buffer. There are a couple exceptions, such as copies or buffer SRVs/UAVs, which use the buffer API object and offset/size. In all cases, you should be able to use default and upload buffers identically. The only differences come when you try to Map() them for CPU access (only UPLOAD supports that), and the performance characteristics when accessing them on the GPU.

 

However, for barrier purposes, since the ResourceBarrier API doesn't take a range of a buffer resource, you probably shouldn't suballocate such that you mix read/write and read-only data in the same buffer object. The entire buffer should be able to switch from read -> write or write -> read as a whole.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!