Skip to content

Commit 1514b53

Browse files
committed
Merge branch 'separable_image_sampler' into separable_image_sampler_amortized_lookups. Also cleanup + AoS changes for amortized lookups
2 parents b670a2c + bad473b commit 1514b53

21 files changed

+191
-115
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,6 @@
9696
[submodule "3rdparty/blake"]
9797
path = 3rdparty/blake
9898
url = [email protected]:Devsh-Graphics-Programming/BLAKE3.git
99+
[submodule "3rdparty/imguizmo"]
100+
path = 3rdparty/imguizmo
101+
url = [email protected]:Devsh-Graphics-Programming/ImGuizmo.git

3rdparty/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ if(NBL_BUILD_IMGUI)
292292
else()
293293
target_compile_options(implot PRIVATE -Wall -Wextra -pedantic -Werror -mavx2 -Ofast)
294294
endif()
295+
296+
set(IMGUIZMO_BUILD_EXAMPLE OFF)
297+
add_subdirectory(imguizmo EXCLUDE_FROM_ALL)
295298
endif()
296299

297300
add_library(aesGladman OBJECT
@@ -384,7 +387,7 @@ if (NBL_BUILD_MITSUBA_LOADER)
384387
list(APPEND NBL_3RDPARTY_TARGETS expat)
385388
endif()
386389
if (NBL_BUILD_IMGUI)
387-
list(APPEND NBL_3RDPARTY_TARGETS imgui)
390+
list(APPEND NBL_3RDPARTY_TARGETS imgui implot imguizmo)
388391
endif()
389392
if(ENABLE_HLSL)
390393
list(APPEND NBL_3RDPARTY_TARGETS HLSL)

3rdparty/imguizmo

Submodule imguizmo added at 6f4b219

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ Below are some tasks that are open for contribution. If you start working on a t
5353
- Radix Sort (Vulkan Compute)
5454
- Bitonic Sort (Vulkan Compute)
5555
- Merge Path (Vulkan Compute)
56-
- [GPU flip fluid simulation task idea](https://www.youtube.com/watch?v=okQzAJM7LcE) -> discord [thread](https://discord.com/channels/318590007881236480/374061825454768129/1257988553112027186) for more info
56+
- [GPU flip fluid simulation task idea](https://www.youtube.com/watch?v=okQzAJM7LcE) -> discord [thread](https://discord.com/channels/318590007881236480/374061825454768129/1257988553112027186) for more info
57+
- [Exact Distance Transform on a GPU](https://docs.google.com/document/d/1iUF0ilFbWVWr5JfPtR8D8z7OdmbhUJXK-eoR_7u4-50/edit)
58+
- [Light Scattering Effects Using Epipolar Sampling and 1D Min/Max Binary Trees](https://ubm-twvideo01.s3.amazonaws.com/o1/vault/gdc2013/slides/822368Yusov_Egor_Practical_Implementation_of_Light.pdf)
5759

5860
**[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)**.
5961

include/nbl/asset/ICPUDescriptorSet.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ class NBL_API2 ICPUDescriptorSet final : public IDescriptorSet<ICPUDescriptorSet
9999
virtual ~ICPUDescriptorSet() = default;
100100

101101
private:
102-
static inline IDescriptor::E_CATEGORY getCategoryFromType(const IDescriptor::E_TYPE type)
103-
{
104-
return IDescriptor::GetTypeCategory(type);
105-
}
106102

107103
core::smart_refctd_dynamic_array<ICPUDescriptorSet::SDescriptorInfo> m_descriptorInfos[static_cast<uint32_t>(IDescriptor::E_TYPE::ET_COUNT)];
108104
};

include/nbl/asset/IDescriptorSet.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,23 @@ class IDescriptorSet : public virtual core::IReferenceCounted // TODO: try to re
9595
}
9696
~SDescriptorInfo()
9797
{
98+
if (desc && desc->getTypeCategory() == IDescriptor::EC_IMAGE)
99+
info.combinedImageSampler.sampler = nullptr;
98100
}
99101

100102
inline SDescriptorInfo& operator=(const SDescriptorInfo& other)
101103
{
102104
if (desc and desc->getTypeCategory()==IDescriptor::EC_IMAGE)
103105
info.combinedImageSampler.sampler = nullptr;
104106
desc = other.desc;
105-
const auto type = desc->getTypeCategory();
106-
if (type!=IDescriptor::EC_IMAGE)
107-
info.buffer = other.info.buffer;
108-
else
109-
info.combinedImageSampler = other.info.combinedImageSampler;
107+
if (desc)
108+
{
109+
const auto type = desc->getTypeCategory();
110+
if (type != IDescriptor::EC_IMAGE)
111+
info.buffer = other.info.buffer;
112+
else
113+
info.combinedImageSampler = other.info.combinedImageSampler;
114+
}
110115
return *this;
111116
}
112117
inline SDescriptorInfo& operator=(SDescriptorInfo&& other)

include/nbl/asset/IDescriptorSetLayout.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ class IDescriptorSetLayout : public virtual core::IReferenceCounted // TODO: tr
5757
core::bitflag<E_CREATE_FLAGS> createFlags;
5858
core::bitflag<IShader::E_SHADER_STAGE> stageFlags;
5959
uint32_t count;
60-
// Use this if you want an immutable sampler that is baked into the DS layout itself.
61-
// If its `nullptr` then the sampler used is mutable and can be specified while writing the image descriptor to a binding while updating the DS.
62-
const core::smart_refctd_ptr<sampler_type>* samplers;
60+
// Use this if you want immutable samplers that are baked into the DS layout itself.
61+
// If it's `nullptr` then the samplers used are mutable and can be specified while writing the image descriptor to a binding while updating the DS.
62+
const core::smart_refctd_ptr<sampler_type>* immutableSamplers;
6363
};
6464

6565
// Maps a binding to a local (to descriptor set layout) offset.
@@ -412,13 +412,13 @@ class IDescriptorSetLayout : public virtual core::IReferenceCounted // TODO: tr
412412
{
413413
switch (b.type) {
414414
case IDescriptor::E_TYPE::ET_SAMPLER:
415-
if (b.samplers)
415+
if (b.immutableSamplers)
416416
buildInfo_immutableSamplers.emplace_back(b.binding, b.createFlags, b.stageFlags, b.count);
417417
else
418418
buildInfo_descriptors[size_t(IDescriptor::E_TYPE::ET_SAMPLER)].emplace_back(b.binding, b.createFlags, b.stageFlags, b.count);
419419
break;
420420
case IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER:
421-
if (b.samplers)
421+
if (b.immutableSamplers)
422422
buildInfo_immutableSamplers.emplace_back(b.binding, b.createFlags, b.stageFlags, b.count);
423423
else
424424
buildInfo_mutableSamplers.emplace_back(b.binding, b.createFlags, b.stageFlags, b.count);
@@ -440,13 +440,13 @@ class IDescriptorSetLayout : public virtual core::IReferenceCounted // TODO: tr
440440

441441
for (const auto& b : _bindings)
442442
{
443-
if ((b.type == IDescriptor::E_TYPE::ET_SAMPLER or b.type == IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER) and b.samplers)
443+
if ((b.type == IDescriptor::E_TYPE::ET_SAMPLER or b.type == IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER) and b.immutableSamplers)
444444
{
445445
const auto localOffset = m_immutableSamplerRedirect.getStorageOffset(typename CBindingRedirect::binding_number_t(b.binding)).data;
446446
assert(localOffset != m_immutableSamplerRedirect.Invalid);
447447

448448
auto* dst = m_immutableSamplers->begin() + localOffset;
449-
std::copy_n(b.samplers, b.count, dst);
449+
std::copy_n(b.immutableSamplers, b.count, dst);
450450
}
451451
}
452452
}

include/nbl/asset/asset_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ struct SBasicViewParameters
4444
} PACK_STRUCT;
4545
#include "nbl/nblunpack.h"
4646

47+
static_assert(sizeof(SBasicViewParameters) == sizeof(float) * (4 * 4 + 2 * 3 * 4));
48+
4749
}}
4850

4951
#endif

include/nbl/asset/utils/IVirtualTexture.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ class IVirtualTexture : public core::IReferenceCounted, public IVirtualTextureBa
10491049
bnd.count = _count;
10501050
bnd.stageFlags = asset::IShader::ESS_ALL;
10511051
bnd.type = asset::IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER;
1052-
bnd.samplers = _samplers;
1052+
bnd.immutableSamplers = _samplers;
10531053
};
10541054

10551055
fillBinding(bindings[0], _pgtBinding, 1u, samplers);

0 commit comments

Comments
 (0)