Skip to content

New binding model #71

@Try

Description

@Try

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)

TODO:

  • Fix potential bug in setting mip of emulated atomic-imge
  • Metal: residency cache
  • Adjust Dx12 internal shaders
  • Redirect DX samplers into dedicated heap offsets
  • Inline DX12 CBV in root signature
  • Deduplicate pipelineLayouts/root-signatures, and leverage push/descriptor compatibilities more
  • DX: resizable resources heap?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions