Open Try opened 2 years ago
TODO, for DX12:
pDescriptorHeaps[0]==nullptr
)error: number of textures with read_write access exceeds maximum supported (8)
apparently undocumented. MoltenVK allows 500k, if argument buffer tier 2 is supported(why?) and 8 otherwise
New Mac/iOS feature to track residency of resources: https://developer.apple.com/documentation/metal/resource_fundamentals/simplifying_gpu_resource_management_with_residency_sets?language=objc
According to apple:
You don’t need to call the following methods for any allocation in a residency set that you associate with the command buffer: useResource
, useHeap
Bindless is quite messy in every api, so need to design nice top-level api with reasonable underlying implementation.
GLSL
GLSL is main language in Tempest, so dedicated section is must. GLSL features 2 ways:
Engine-side
Doesn't fit the engine perfectly - need to add support for sampler and textures(non-combined) on top of it.
Vulkan
Caps-list:
VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT
can be used (in theory), but only for the very last binding in descriptor set, what doesn't fit GLSL side. Alternatively, it's sufficient to useVK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT
with very-large descriptor array. Size of array has to be defined in C++ upfront, atVkDescriptorSetLayout
creation. Current implementation of Tempest can recreateVkDescriptorSetLayout
andVkDescriptorSet
on a go, if preallocated array is not big enough. But it also requires reallocation ofVkPipeline
, at runtime, based of descriptor set size - this is hard to implement without extra performance cost.VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT
- useless by itself, but there is a special behavior for this type of descriptors in spec:maxPerStageDescriptorUpdateAfterBindSamplers = 500,000+ maxPerStageDescriptorUpdateAfterBindUniformBuffers = 12+ maxPerStageDescriptorUpdateAfterBindStorageBuffers = 500,000+ maxPerStageDescriptorUpdateAfterBindSampledImages = 500,000+ maxPerStageDescriptorUpdateAfterBindStorageImages = 500,000+ maxPerStageDescriptorUpdateAfterBindAccelerationStructures = 500,000+
maxDescriptorSetUpdateAfterBindSamplers = 500,000+ maxDescriptorSetUpdateAfterBindUniformBuffers = 72+ // n × PerStage maxDescriptorSetUpdateAfterBindStorageBuffers = 500,000+ maxDescriptorSetUpdateAfterBindSampledImages = 500,000+ maxDescriptorSetUpdateAfterBindStorageImages = 500,000+ maxDescriptorSetUpdateAfterBindAccelerationStructures = 500,000+
VkPhysicalDeviceLimits::maxPerStageDescriptorSamplers = 16+; VkPhysicalDeviceLimits::maxPerStageDescriptorUniformBuffers = 12+; VkPhysicalDeviceLimits::maxPerStageDescriptorStorageBuffers = 4+; VkPhysicalDeviceLimits::maxPerStageDescriptorSampledImages = 16+; VkPhysicalDeviceLimits::maxPerStageDescriptorStorageImages = 4+; VkPhysicalDeviceLimits::maxPerStageResources = 128^2+;
VkPhysicalDeviceLimits::maxDescriptorSetSamplers = 96^8+; VkPhysicalDeviceLimits::maxDescriptorSetUniformBuffers = 72^8+; VkPhysicalDeviceLimits::maxDescriptorSetStorageBuffers = 24^8+; VkPhysicalDeviceLimits::maxDescriptorSetSampledImages = 96^8+; VkPhysicalDeviceLimits::maxDescriptorSetStorageImages = 24^8+;
// error: more than one unbounded resource (ssbo and tex) in space 0 ByteAddressBuffer ssbo[] : register(t1, space0); Texture2D tex[] : register(t0, space0);
SamplerState _tex_sampler[] : register(s0, space0);
RWTexture2D ret : register(u2, space0);
maxUAV = 500'000; // ssbo + tlas + imageStore maxTextures = 500'000; maxSamplers = 2048; // can skip maxUbo - hard in vulkan and not very usefull // combined image consumes both Texture and Samplers limits