Sign in to follow this  

Vulkan Is Dynamic Draw Call Batching Still Relevant?

Recommended Posts

Hey, So I wanted to ask a simple question pertaining to dynamic batching , as in dynamically building vertex and index buffers to reduce draw calls. I wanted to know that in the age of Vulkan/DirectX12 , dynamic instancing, and compute shader based culling, is dynamic batching still relevant? I know that Engines such as Unreal Engine does not support dynamic instancing / dynamic batching , and Unity supports both. I'm currently building a somewhat open world game, so efficiency is of the greatest importance. Thanks.

Share this post


Link to post
Share on other sites

Dynamically Batching is still very relevant , it's just that it conflicts with instancing so using both is very difficult.

When working with a lot of unique objects batching holds the advantage, that is why it was popular with linear games. The only rule for batching is that it should share the same material/ shader.

Instancing has the advantage when you need a lot of one object, like grass, that repeat. So it's the one you want to focus on when making openworld games.

 

The best would be to use both, batching for unique locations and instancing for large openworld zones. However making a dynamic batch manager that doesn't conflict with instancing is very difficult and makes a engine difficult to use; Lumberyard is a good example.

Most engines like Unreal 4 instead opt for selective batching, by allowing developers to merge objects by hand.

Share this post


Link to post
Share on other sites

Thank you both for your responses. What I tend to dislike about Unity's approach is that , in my opinion, they can only dynamically batch really small meshes, it also seems that now that they support dynamic instancing, a mesh will use instancing before dynamic batching. Do you have any opinion on mesh merging / vertex pulling in comparison to the older batching techniques?

Share this post


Link to post
Share on other sites

Thank you both for your responses. What I tend to dislike about Unity's approach is that , in my opinion, they can only dynamically batch really small meshes,

That is how it works you have 65 000 vertices per mesh, you can either have 65 000 single vertex meshes or one 65 000 vertices mesh. Unreal has the same limit except it's called the 64k polygon limit.

What it means is that when you load in a mesh more than 64k-65k vertices it will create a new batch. How many batches a game can use depends on the graphics card not the engine.

 

The reason Unity can only batch small meshes is because of UV maps and Smooth groups. A UV seam splits the vertices where it is assigned, in games this matters a lot because a single UV map can add as much as 30%-50% to the vertex count. Smooth groups often add 10%-20% vertices to the count.

So a simple 1000 vertices mesh with a UV map and only one smooth group is more like a 1500- 1800 vertices. And you end up getting a lot less meshes per batch than expected.

 

Do you have any opinion on mesh merging / vertex pulling in comparison to the older batching techniques?

My opinion on vertex pulling and mesh merging is that both are just different ways of batching. The performance gain and downsides is the same as batching.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Forum Statistics

    • Total Topics
      628682
    • Total Posts
      2984206
  • Similar Content

    • By hiya83
      (Posted this in graphics forum too, which was perhaps the wrong forum for it)
      Hey, I was wondering if on mobile development (Android mainly but iOS as well if you know of it), if there is a GPUView equivalent for whole system debugging so we can figure out if the CPU/GPU are being pipelined efficiently, if there are bubbles, etc. Also slightly tangent question, but do mobile GPU's have a DMA engine exposed as a dedicated Transfer Queue for Vulkan?
      Thanks!
    • By hiya83
      Hey, I was wondering if on mobile development (Android mainly but iOS as well if you know of it), if there is a GPUView equivalent for whole system debugging so we can figure out if the CPU/GPU are being pipelined efficiently, if there are bubbles, etc. Also slightly tangent question, but do mobile GPU's have a DMA engine exposed as a dedicated Transfer Queue for Vulkan?
    • By mark_braga
      I am working on a project which needs to share render targets between Vulkan and DirectX12. I have enabled the external memory extension and now allocate the memory for the render targets by adding the VkExportMemoryInfoKHR to the pNext chain of VkMemoryAllocateInfo. Similarly I have added the VkExternalMemoryImageCreateInfo to the pNext chain of VkImageCreateInfo.
      After calling the get win32 handle function, I get some handle pointer which is not null (I assume it is valid).
      VkExternalMemoryImageCreateInfoKHR externalImageInfo = {}; if (gExternalMemoryExtensionKHR) { externalImageInfo.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR; externalImageInfo.pNext = NULL; externalImageInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR | VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR | VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR | VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR | VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR | VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR | VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KH imageCreateInfo.pNext = &externalImageInfo; } vkCreateImage(...); VkExportMemoryAllocateInfoKHR exportInfo = { VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR }; exportInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR | VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR | VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR | VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR | VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR | VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR | VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR; memoryAllocateInfo.pNext = &exportInfo; vkAllocateMemory(...); VkMemoryGetWin32HandleInfoKHR info = { VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR, NULL }; info.memory = pTexture->GetMemory(); info.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR; VkResult res = vkGetMemoryWin32HandleKHR(vulkanDevice, &info, &pTexture->pSharedHandle); ASSERT(VK_SUCCESS == res); Now when I try to call OpenSharedHandle from a D3D12 device, it crashes inside nvwgf2umx.dll with the integer division by zero error.
      I am now lost and have no idea what the other handle types do.
      For example: How do we get the D3D12 resource from the VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR handle?
      I also found some documentation on this link but it doesn't help much.
      https://javadoc.lwjgl.org/org/lwjgl/vulkan/NVExternalMemoryWin32.html
      This is all assuming the extension works as expected since it has made it to the KHR
    • By dwatt
      I am trying to get vulkan on android working and have run into a big issue. I don't see any validation layers available. I have tried linking their libraries into mine but still no layers. I have tried compiling it into a library of my own but the headers for it are all over the place. Unfortunately , google's examples and tutorials are out of date and don't work for me. Any idea what I have to do to get those layers to work?
    • By mark_braga
      It seems like nobody really knows what is the correct behavior after window minimizes in Vulkan.
      I have looked at most of the examples (Sascha Willems, GPUOpen,...) and all of them crash after the window minimize event with the error VK_ERROR_OUT_OF_DATE either with an assertion during acquire image or after calling present. This is because we have to recreate the swap chain.
      I tried this but then Vulkan expects you to provide a swap chain with extents { 0, 0, 0, 0 }, but now if you try to set the viewport or create new image views with extents { 0, 0, 0, 0 }, Vulkan expects you to provide non-zero values. So now I am confused.
      Should we just do nothing after a window minimize event? No rendering, update, ...?
  • Popular Now