Skip to content

Commit 1b7582a

Browse files
committed
Merge branch 'master' into nahim_complex_fft_workgroup
2 parents 6aadeeb + 52a0a8b commit 1b7582a

File tree

11 files changed

+54
-25
lines changed

11 files changed

+54
-25
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Below are some tasks that are open for contribution. If you start working on a t
6060

6161
**[Issues](https://github.com/Devsh-Graphics-Programming/Nabla/issues) also count as free tasks.** We also have old issues from previous generation **[here](https://github.com/buildaworldnet/IrrlichtBAW/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)**.
6262

63-
If you have questions about the list, you can ask directly on our [Discord server](https://discord.gg/SsJzqS23) or open an issue [here](https://github.com/Devsh-Graphics-Programming/Nabla/issues).
63+
If you have questions about the list, you can ask directly on our [Discord server](https://discord.gg/Dx83Cu7suD) or open an issue [here](https://github.com/Devsh-Graphics-Programming/Nabla/issues).
6464

6565
## Pull Request Process
6666

@@ -78,7 +78,7 @@ If you have questions about the list, you can ask directly on our [Discord serve
7878

7979
## Connect with Other Project Contributors
8080

81-
Join our [Discord server](https://discord.gg/SsJzqS23) to connect with other contributors. It's the first place to go for questions and discussions about the project.
81+
Join our [Discord server](https://discord.gg/Dx83Cu7suD) to connect with other contributors. It's the first place to go for questions and discussions about the project.
8282

8383
## License
8484

include/nbl/asset/IDescriptorSetLayout.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ class IDescriptorSetLayout : public virtual core::IReferenceCounted // TODO: tr
4646
enum class E_CREATE_FLAGS : uint8_t
4747
{
4848
ECF_NONE = 0,
49-
ECF_UPDATE_AFTER_BIND_BIT = 1u << 1,
50-
ECF_UPDATE_UNUSED_WHILE_PENDING_BIT = 1u << 2,
51-
ECF_PARTIALLY_BOUND_BIT = 1u << 3,
52-
ECF_VARIABLE_DESCRIPTOR_COUNT_BIT = 1u << 4
49+
ECF_UPDATE_AFTER_BIND_BIT = 1u << 0,
50+
ECF_UPDATE_UNUSED_WHILE_PENDING_BIT = 1u << 1,
51+
ECF_PARTIALLY_BOUND_BIT = 1u << 2,
52+
ECF_VARIABLE_DESCRIPTOR_COUNT_BIT = 1u << 3
5353
};
5454

5555
uint32_t binding;

include/nbl/builtin/hlsl/limits.hlsl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <nbl/builtin/hlsl/type_traits.hlsl>
88
#include <nbl/builtin/hlsl/bit.hlsl>
9+
#include <nbl/builtin/hlsl/macros.h>
910

1011
// C++ headers
1112
#ifndef __HLSL_VERSION
@@ -127,7 +128,7 @@ struct num_base : type_identity<T>
127128
NBL_CONSTEXPR_STATIC_INLINE int32_t float_max_decimal_exponent = 4*S16 + 30*S32 + 232*S64;
128129

129130
NBL_CONSTEXPR_STATIC_INLINE int32_t float_exponent_bits = 8 * size - float_digits - 1;
130-
NBL_CONSTEXPR_STATIC_INLINE int32_t float_max_exponent = 1l << float_exponent_bits;
131+
NBL_CONSTEXPR_STATIC_INLINE int32_t float_max_exponent = 1 << float_exponent_bits;
131132
NBL_CONSTEXPR_STATIC_INLINE int32_t float_min_exponent = 3 - float_max_exponent;
132133
NBL_CONSTEXPR_STATIC_INLINE bool is_bool = is_same<T, bool>::value;
133134

@@ -235,9 +236,9 @@ struct num_traits<float32_t> : num_base<float32_t>
235236
template<>
236237
struct num_traits<float64_t> : num_base<float64_t>
237238
{
238-
NBL_CONSTEXPR_STATIC_INLINE float64_t max = 1.7976931348623158e+308;
239-
NBL_CONSTEXPR_STATIC_INLINE float64_t min = 2.2250738585072014e-308;
240-
NBL_CONSTEXPR_STATIC_INLINE float64_t denorm_min = 4.9406564584124654e-324;
239+
NBL_CONSTEXPR_STATIC_INLINE float64_t max = NBL_FP64_LITERAL(1.7976931348623158e+308);
240+
NBL_CONSTEXPR_STATIC_INLINE float64_t min = NBL_FP64_LITERAL(2.2250738585072014e-308);
241+
NBL_CONSTEXPR_STATIC_INLINE float64_t denorm_min = NBL_FP64_LITERAL(4.9406564584124654e-324);
241242
NBL_CONSTEXPR_STATIC_INLINE uint64_t quiet_NaN = 0x7FF8000000000000ull;
242243
NBL_CONSTEXPR_STATIC_INLINE uint64_t signaling_NaN = 0x7FF0000000000001ull;
243244
NBL_CONSTEXPR_STATIC_INLINE uint64_t infinity = 0x7FF0000000000000ull;

include/nbl/builtin/hlsl/macros.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
}
1818
#endif
1919

20+
#ifdef __HLSL_VERSION // cause DXC is insane
21+
#define NBL_FP64_LITERAL(LIT) LIT##l
22+
#else // and nobody except GCC supports C++23 `f64` suffix on float literals
23+
#define NBL_FP64_LITERAL(LIT) LIT
24+
#endif
25+
2026
// basics
2127
#define NBL_EVAL(...) __VA_ARGS__
2228
#define NBL_CONCAT_IMPL2(X,Y) X ## Y
@@ -159,4 +165,4 @@
159165

160166
#define NBL_FOREACH(WHAT, ... ) NBL_EVAL(NBL_CONCATENATE(NBL_FOREACH_,NBL_VA_ARGS_COUNT(__VA_ARGS__))(WHAT, __VA_ARGS__))
161167

162-
#endif
168+
#endif

include/nbl/video/CVulkanCommon.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,16 @@ inline constexpr VkDescriptorType getVkDescriptorTypeFromDescriptorType(const as
10271027
}
10281028
}
10291029

1030+
inline VkDescriptorBindingFlagBits getVkDescriptorBindingFlagsFrom(const core::bitflag<IGPUDescriptorSetLayout::SBinding::E_CREATE_FLAGS> flags)
1031+
{
1032+
// Wait for C++23
1033+
//static_assert(std::to_underlying(IGPUDescriptorSetLayout::SBinding::E_CREATE_FLAGS::ECF_UPDATE_AFTER_BIND_BIT)==VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT);
1034+
//static_assert(IGPUDescriptorSetLayout::SBinding::E_CREATE_FLAGS::ECF_UPDATE_AFTER_BIND_BIT==VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT);
1035+
//static_assert(IGPUDescriptorSetLayout::SBinding::E_CREATE_FLAGS::ECF_UPDATE_AFTER_BIND_BIT==VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT);
1036+
//static_assert(IGPUDescriptorSetLayout::SBinding::E_CREATE_FLAGS::ECF_UPDATE_AFTER_BIND_BIT==VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT);
1037+
return static_cast<VkDescriptorBindingFlagBits>(flags.value);
1038+
}
1039+
10301040
inline IPhysicalDevice::E_DRIVER_ID getDriverIdFromVkDriverId(const VkDriverId in)
10311041
{
10321042
if(in == VK_DRIVER_ID_AMD_PROPRIETARY) return IPhysicalDevice::E_DRIVER_ID::EDI_AMD_PROPRIETARY;

include/nbl/video/IDescriptorPool.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,14 @@ class NBL_API2 IDescriptorPool : public IBackendObject
102102
switch (type)
103103
{
104104
case asset::IDescriptor::E_TYPE::ET_SAMPLER:
105-
baseAddress = reinterpret_cast<core::smart_refctd_ptr<asset::IDescriptor>*>(m_mutableStandaloneSamplerStorage.get());
105+
baseAddress = reinterpret_cast<core::smart_refctd_ptr<asset::IDescriptor>*>(m_samplerStorage.get());
106106
break;
107107
case asset::IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER:
108-
case asset::IDescriptor::E_TYPE::ET_SAMPLED_IMAGE:
109108
baseAddress = reinterpret_cast<core::smart_refctd_ptr<asset::IDescriptor>*>(m_textureStorage.get());
110109
break;
110+
case asset::IDescriptor::E_TYPE::ET_SAMPLED_IMAGE:
111+
baseAddress = reinterpret_cast<core::smart_refctd_ptr<asset::IDescriptor>*>(m_textureStorage.get()) + m_creationParameters.maxDescriptorCount[static_cast<uint32_t>(asset::IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER)];
112+
break;
111113
case asset::IDescriptor::E_TYPE::ET_STORAGE_IMAGE:
112114
baseAddress = reinterpret_cast<core::smart_refctd_ptr<asset::IDescriptor>*>(m_storageImageStorage.get());
113115
break;
@@ -145,7 +147,7 @@ class NBL_API2 IDescriptorPool : public IBackendObject
145147

146148
inline core::smart_refctd_ptr<IGPUSampler>* getMutableCombinedSamplerStorage() const
147149
{
148-
return reinterpret_cast<core::smart_refctd_ptr<IGPUSampler>*>(m_mutableCombinedSamplerStorage.get());
150+
return reinterpret_cast<core::smart_refctd_ptr<IGPUSampler>*>(m_samplerStorage.get()) + m_creationParameters.maxDescriptorCount[static_cast<uint32_t>(asset::IDescriptor::E_TYPE::ET_SAMPLER)];
149151
}
150152

151153
friend class IGPUDescriptorSet;
@@ -222,8 +224,7 @@ class NBL_API2 IDescriptorPool : public IBackendObject
222224
std::unique_ptr<IGPUDescriptorSet* []> m_allocatedDescriptorSets = nullptr; // This array might be sparse.
223225

224226
std::unique_ptr<core::StorageTrivializer<core::smart_refctd_ptr<video::IGPUImageView>>[]> m_textureStorage;
225-
std::unique_ptr<core::StorageTrivializer<core::smart_refctd_ptr<video::IGPUSampler>>[]> m_mutableCombinedSamplerStorage;
226-
std::unique_ptr<core::StorageTrivializer<core::smart_refctd_ptr<video::IGPUSampler>>[]> m_mutableStandaloneSamplerStorage;
227+
std::unique_ptr<core::StorageTrivializer<core::smart_refctd_ptr<video::IGPUSampler>>[]> m_samplerStorage;
227228
std::unique_ptr<core::StorageTrivializer<core::smart_refctd_ptr<IGPUImageView>>[]> m_storageImageStorage; // storage image | input attachment
228229
std::unique_ptr<core::StorageTrivializer<core::smart_refctd_ptr<IGPUBuffer>>[]> m_UBO_SSBOStorage; // ubo | ssbo | ubo dynamic | ssbo dynamic
229230
std::unique_ptr<core::StorageTrivializer<core::smart_refctd_ptr<IGPUBufferView>>[]> m_UTB_STBStorage; // utb | stb

include/nbl/video/ILogicalDevice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ class NBL_API2 ILogicalDevice : public core::IReferenceCounted, public IDeviceMe
631631
{
632632
if (layout)
633633
{
634+
// TODO: when creating the layouts, cache if they have any update after bindingings, and patch `createInfo.flags` with that here
634635
const auto setCount = setCounts ? *(setCountsIt):1u;
635636
createInfo.maxSets += setCount;
636637
for (uint32_t t=0; t<static_cast<uint32_t>(asset::IDescriptor::E_TYPE::ET_COUNT); ++t)

include/nbl/video/SPhysicalDeviceFeatures.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct SPhysicalDeviceFeatures
7171
bool largePoints = false;
7272

7373
// Some AMD don't support
74-
bool alphaToOne = true;
74+
bool alphaToOne = false;
7575

7676
// [REQUIRE] good device support
7777
//bool multiViewport = true;

src/nbl/video/CVulkanLogicalDevice.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,9 +539,12 @@ core::smart_refctd_ptr<IGPUDescriptorSetLayout> CVulkanLogicalDevice::createDesc
539539
{
540540
std::vector<VkSampler> vk_samplers;
541541
std::vector<VkDescriptorSetLayoutBinding> vk_dsLayoutBindings;
542+
std::vector<VkDescriptorBindingFlags> vk_bindingFlags;
542543
vk_samplers.reserve(maxSamplersCount); // Reserve to avoid resizing and pointer change while iterating
543544
vk_dsLayoutBindings.reserve(bindings.size());
545+
vk_bindingFlags.reserve(bindings.size());
544546

547+
bool updateAfterBindFound = false;
545548
for (const auto& binding : bindings)
546549
{
547550
auto& vkDescSetLayoutBinding = vk_dsLayoutBindings.emplace_back();
@@ -560,13 +563,22 @@ core::smart_refctd_ptr<IGPUDescriptorSetLayout> CVulkanLogicalDevice::createDesc
560563
vk_samplers.push_back(static_cast<const CVulkanSampler*>(binding.immutableSamplers[i].get())->getInternalObject());
561564
vkDescSetLayoutBinding.pImmutableSamplers = vk_samplers.data()+samplerOffset;
562565
}
566+
567+
if (binding.createFlags.hasFlags(IGPUDescriptorSetLayout::SBinding::E_CREATE_FLAGS::ECF_UPDATE_AFTER_BIND_BIT))
568+
updateAfterBindFound = true;
569+
vk_bindingFlags.emplace_back() = getVkDescriptorBindingFlagsFrom(binding.createFlags);
563570
}
564571

565-
VkDescriptorSetLayoutCreateInfo vk_createInfo = { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO };
566-
vk_createInfo.pNext = nullptr; // pNext of interest: VkDescriptorSetLayoutBindingFlagsCreateInfo
567-
vk_createInfo.flags = 0; // Todo(achal): I would need to create a IDescriptorSetLayout::SCreationParams for this
568-
vk_createInfo.bindingCount = vk_dsLayoutBindings.size();
572+
VkDescriptorSetLayoutBindingFlagsCreateInfo vk_bindingFlagsInfo = { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO, nullptr };
573+
VkDescriptorSetLayoutCreateInfo vk_createInfo = { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, &vk_bindingFlagsInfo };
574+
// Todo(achal): I would need to create a IDescriptorSetLayout::SCreationParams for this
575+
// Answer: We don't actually support any extensions/features that would necessitate exposing any other flag than update_after_bind
576+
vk_createInfo.flags = 0;
577+
if (updateAfterBindFound)
578+
vk_createInfo.flags |= VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT;
579+
vk_createInfo.bindingCount = vk_bindingFlagsInfo.bindingCount = vk_dsLayoutBindings.size();
569580
vk_createInfo.pBindings = vk_dsLayoutBindings.data();
581+
vk_bindingFlagsInfo.pBindingFlags = vk_bindingFlags.data();
570582

571583
VkDescriptorSetLayout vk_dsLayout;
572584
if (m_devf.vk.vkCreateDescriptorSetLayout(m_vkdev,&vk_createInfo,nullptr,&vk_dsLayout)==VK_SUCCESS)

0 commit comments

Comments
 (0)