Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New binding model #71

Open
Try opened this issue Dec 28, 2024 · 0 comments
Open

New binding model #71

Try opened this issue Dec 28, 2024 · 0 comments

Comments

@Try
Copy link
Owner

Try commented Dec 28, 2024

Research ticket for better binding model. As feedback of work on opengothic, it seem descriptor-set based is way to expensive and error-prone: need something convenient+lighter.

Current idea: push-descriptor + bindless-arrays.

layout(binding = L_Ibo,      std430) readonly buffer Ibo  { uint    indexes [];    } ibo[]; // bindless-array
layout(binding = L_Vbo,      std430) readonly buffer Vbo  { float   vertices[];    } vbo[]; // bindless-array
layout(binding = L_Diffuse)          uniform  texture2D textureMain[]; // bindless-array
layout(binding = L_Sampler)          uniform  sampler   samplerMain;   // push-descriptor
layout(binding = L_SceneClr)         uniform  sampler2D sceneColor;    // push-descriptor
layout(binding = L_GDepth  )         uniform  sampler2D gbufferDepth;  // push-descriptor

Possible C++ interface

const DescriptorArray<Texture2D>& texture = ...
cmd.setBinding(L_Diffuse, texture);
cmd.setBinding(L_SceneClr, sceneColor);
cmd.setPipeline(pso);

or

const DescriptorArray<Texture2D>& texture = ...
cmd.binding = BindingTable(); // clear bindings
cmd.binding[L_Diffuse]  = &texture;
cmd.binding[L_SceneClr] = &sceneColor;
cmd.setPipeline(pso);

Metal

Generally 'it just works': bindless-array can be represented as argument-buffer.

DX12

Root-descriptor + Heap-offset:
Root-parameters in DX consists of 64*DWORD (256 bytes of data):
root-descriptor is 2 words long, gives 32 descriptors max (and 16, if reserve 128 bytes for push-constant)
samplers (non-static) has to be in heap, however combination of possible samplers is limited, can push offset for each
array can be allocated in heap, requires 1 DWORD to represent offset

Vulkan

VK_KHR_push_descriptor seem to be closes analog to root-descriptors, and now core in vulkan.
VkPhysicalDevicePushDescriptorProperties::maxPushDescriptors == 32
Bindless data can be moved to other descriptor set (however it will break tooling)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant