Skip to content

Commit 50281c6

Browse files
author
kevyuu
committed
Remove computeDependants interface
1 parent 046a334 commit 50281c6

22 files changed

+0
-358
lines changed

include/nbl/asset/IAsset.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,6 @@ class IAsset : virtual public core::IReferenceCounted
175175
});
176176
}
177177

178-
virtual core::unordered_set<const IAsset*> computeDependants() const = 0;
179-
180-
virtual core::unordered_set<IAsset*> computeDependants() = 0;
181-
182178
virtual bool valid() const
183179
{
184180
//TODO(kevinyu): Temporary set this to true to make changes compile. Will revisit this later for each asset

include/nbl/asset/ICPUAccelerationStructure.h

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,6 @@ class ICPUBottomLevelAccelerationStructure final : public IPreHashed, public IBo
136136
}
137137

138138

139-
// Do not report anything as a dependant, we'll simply drop the data instead of discarding its contents
140-
inline core::unordered_set<const IAsset*> computeDependants() const override
141-
{
142-
return {};
143-
}
144-
145-
inline core::unordered_set<IAsset*> computeDependants() override
146-
{
147-
return {};
148-
}
149-
150139
inline core::blake3_hash_t computeContentHash() const override
151140
{
152141
if (missingContent())
@@ -272,16 +261,6 @@ class ICPUTopLevelAccelerationStructure final : public IAsset, public ITopLevelA
272261
//
273262
ICPUTopLevelAccelerationStructure() = default;
274263

275-
inline core::unordered_set<const IAsset*> computeDependants() const override
276-
{
277-
return computeDependantsImpl(this);
278-
}
279-
280-
inline core::unordered_set<IAsset*> computeDependants() override
281-
{
282-
return computeDependantsImpl(this);
283-
}
284-
285264
//
286265
inline auto& getBuildRangeInfo()
287266
{
@@ -381,16 +360,6 @@ class ICPUTopLevelAccelerationStructure final : public IAsset, public ITopLevelA
381360
hlsl::acceleration_structures::top_level::BuildRangeInfo m_buildRangeInfo;
382361
core::bitflag<BUILD_FLAGS> m_buildFlags = BUILD_FLAGS::PREFER_FAST_BUILD_BIT;
383362

384-
template <typename Self>
385-
requires(std::same_as<std::remove_cv_t<Self>, ICPUTopLevelAccelerationStructure>)
386-
static auto computeDependantsImpl(Self* self) {
387-
using asset_ptr_t = std::conditional_t<std::is_const_v<Self>, const IAsset*, IAsset*>;
388-
core::unordered_set<asset_ptr_t> dependants;
389-
for (const auto& instance : *self->m_instances)
390-
dependants.insert(instance.getBase().blas.get());
391-
return dependants;
392-
}
393-
394363
inline virtual void visitDependentsImpl(std::function<bool(const IAsset*)> visit) const override
395364
{
396365
for (const auto& instance : *m_instances)

include/nbl/asset/ICPUAnimationLibrary.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,8 @@ class ICPUAnimationLibrary final : public IAnimationLibrary<ICPUBuffer>, public
9696
constexpr static inline auto AssetType = ET_ANIMATION_LIBRARY;
9797
inline E_TYPE getAssetType() const override { return AssetType; }
9898

99-
inline core::unordered_set<const IAsset*> computeDependants() const override
100-
{
101-
return computeDependantsImpl(this);
102-
}
103-
104-
inline core::unordered_set<IAsset*> computeDependants() override
105-
{
106-
return computeDependantsImpl(this);
107-
}
108-
10999
private:
110100

111-
template <typename Self>
112-
requires(std::same_as<std::remove_cv_t<Self>, ICPUAnimationLibrary>)
113-
static auto computeDependantsImpl(Self* self) {
114-
using asset_ptr_t = std::conditional_t<std::is_const_v<Self>, const IAsset*, IAsset*>;
115-
return core::unordered_set<asset_ptr_t>{ self->m_keyframeStorageBinding.buffer.get(), self->m_timestampStorageBinding.buffer.get(), self->m_animationStorageRange.buffer.get() };
116-
}
117-
118101
virtual void visitDependentsImpl(std::function<bool(const IAsset*)> visit) const override
119102
{
120103
if (!visit(m_keyframeStorageBinding.buffer.get())) return;

include/nbl/asset/ICPUBuffer.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,6 @@ class ICPUBuffer final : public asset::IBuffer, public IPreHashed
7575
constexpr static inline auto AssetType = ET_BUFFER;
7676
inline IAsset::E_TYPE getAssetType() const override final { return AssetType; }
7777

78-
inline core::unordered_set<const IAsset*> computeDependants() const override
79-
{
80-
return {};
81-
}
82-
83-
inline core::unordered_set<IAsset*> computeDependants() override
84-
{
85-
return {};
86-
}
87-
8878
inline core::blake3_hash_t computeContentHash() const override
8979
{
9080
core::blake3_hasher hasher;

include/nbl/asset/ICPUBufferView.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,6 @@ class ICPUBufferView : public IBufferView<ICPUBuffer>, public IAsset
2828
constexpr static inline auto AssetType = ET_BUFFER_VIEW;
2929
inline IAsset::E_TYPE getAssetType() const override { return AssetType; }
3030

31-
32-
inline core::unordered_set<const IAsset*> computeDependants() const override
33-
{
34-
return computeDependantsImpl(this);
35-
}
36-
37-
inline core::unordered_set<IAsset*> computeDependants() override
38-
{
39-
return computeDependantsImpl(this);
40-
}
41-
4231
ICPUBuffer* getUnderlyingBuffer()
4332
{
4433
assert(isMutable());
@@ -61,12 +50,6 @@ class ICPUBufferView : public IBufferView<ICPUBuffer>, public IAsset
6150
virtual ~ICPUBufferView() = default;
6251

6352
private:
64-
template <typename Self>
65-
requires(std::same_as<std::remove_cv_t<Self>, ICPUBufferView>)
66-
static auto computeDependantsImpl(Self* self) {
67-
using asset_ptr_t = std::conditional_t<std::is_const_v<Self>, const IAsset*, IAsset*>;
68-
return core::unordered_set<asset_ptr_t>{ self->m_buffer.get() };
69-
}
7053

7154
inline virtual void visitDependentsImpl(std::function<bool(const IAsset*)> visit) const override
7255
{

include/nbl/asset/ICPUComputePipeline.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,6 @@ class ICPUComputePipeline final : public ICPUPipeline<IComputePipeline<ICPUPipel
2828

2929
constexpr static inline auto AssetType = ET_COMPUTE_PIPELINE;
3030
inline E_TYPE getAssetType() const override { return AssetType; }
31-
32-
//!
33-
inline core::unordered_set<const IAsset*> computeDependants() const override
34-
{
35-
return computeDependantsImpl(this);
36-
}
37-
38-
inline core::unordered_set<IAsset*> computeDependants() override
39-
{
40-
return computeDependantsImpl(this);
41-
}
4231

4332
inline std::span<const SShaderSpecInfo> getSpecInfos(hlsl::ShaderStage stage) const override
4433
{
@@ -98,13 +87,6 @@ class ICPUComputePipeline final : public ICPUPipeline<IComputePipeline<ICPUPipel
9887
explicit ICPUComputePipeline(ICPUPipelineLayout* layout):
9988
base_t(layout, {})
10089
{}
101-
102-
template <typename Self>
103-
requires(std::same_as<std::remove_cv_t<Self>, ICPUComputePipeline>)
104-
static auto computeDependantsImpl(Self* self) {
105-
using asset_ptr_t = std::conditional_t<std::is_const_v<Self>, const IAsset*, IAsset*>;
106-
return core::unordered_set<asset_ptr_t>{ self->m_layout.get(), self->m_specInfo.shader.get() };
107-
}
10890

10991
virtual void visitDependentsImpl(std::function<bool(const IAsset*)> visit) const override
11092
{

include/nbl/asset/ICPUDescriptorSet.h

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ class NBL_API2 ICPUDescriptorSet final : public IDescriptorSet<ICPUDescriptorSet
7777

7878
core::smart_refctd_ptr<IAsset> clone(uint32_t _depth = ~0u) const override;
7979

80-
core::unordered_set<const IAsset*> computeDependants() const override;
81-
core::unordered_set<IAsset*> computeDependants() override;
82-
8380
protected:
8481
virtual ~ICPUDescriptorSet() = default;
8582

@@ -88,46 +85,6 @@ class NBL_API2 ICPUDescriptorSet final : public IDescriptorSet<ICPUDescriptorSet
8885

8986
core::smart_refctd_dynamic_array<ICPUDescriptorSet::SDescriptorInfo> m_descriptorInfos[static_cast<uint32_t>(IDescriptor::E_TYPE::ET_COUNT)];
9087

91-
template <typename Self>
92-
requires(std::same_as<std::remove_cv_t<Self>, ICPUDescriptorSet>)
93-
static auto computeDependantsImpl(Self* self) {
94-
using asset_ptr_t = std::conditional_t<std::is_const_v<Self>, const IAsset*, IAsset*>;
95-
96-
using cpu_buffer_ptr_t = std::conditional_t<std::is_const_v<Self>, const ICPUBuffer*, ICPUBuffer*>;
97-
using cpu_sampler_ptr_t = std::conditional_t<std::is_const_v<Self>, const ICPUSampler*, ICPUSampler*>;
98-
using cpu_image_view_ptr_t = std::conditional_t<std::is_const_v<Self>, const ICPUImageView*, ICPUImageView*>;
99-
using cpu_buffer_view_ptr_t = std::conditional_t<std::is_const_v<Self>, const ICPUBufferView*, ICPUBufferView*>;
100-
using cpu_tlas_ptr_t = std::conditional_t<std::is_const_v<Self>, const ICPUTopLevelAccelerationStructure*, ICPUTopLevelAccelerationStructure*>;
101-
102-
core::unordered_set<asset_ptr_t> dependants = { self->m_layout.get() };
103-
for (auto i = 0u; i < static_cast<uint32_t>(IDescriptor::E_TYPE::ET_COUNT); i++)
104-
{
105-
if (!self->m_descriptorInfos[i]) continue;
106-
const auto size = self->m_descriptorInfos[i]->size();
107-
for (auto desc_i = 0u; desc_i < size; desc_i++)
108-
{
109-
auto* desc = self->m_descriptorInfos[i]->operator[](desc_i).desc.get();
110-
if (!desc) continue;
111-
switch (IDescriptor::GetTypeCategory(static_cast<IDescriptor::E_TYPE>(i)))
112-
{
113-
case IDescriptor::EC_BUFFER:
114-
dependants.insert(static_cast<cpu_buffer_ptr_t>(desc));
115-
case IDescriptor::EC_SAMPLER:
116-
dependants.insert(static_cast<cpu_sampler_ptr_t>(desc));
117-
case IDescriptor::EC_IMAGE:
118-
dependants.insert(static_cast<cpu_image_view_ptr_t>(desc));
119-
case IDescriptor::EC_BUFFER_VIEW:
120-
dependants.insert(static_cast<cpu_buffer_view_ptr_t>(desc));
121-
case IDescriptor::EC_ACCELERATION_STRUCTURE:
122-
dependants.insert(static_cast<cpu_tlas_ptr_t>(desc));
123-
default:
124-
break;
125-
}
126-
}
127-
}
128-
return dependants;
129-
}
130-
13188
virtual void visitDependentsImpl(std::function<bool(const IAsset*)> visit) const override
13289
{
13390
for (auto i = 0u; i < static_cast<uint32_t>(IDescriptor::E_TYPE::ET_COUNT); i++)

include/nbl/asset/ICPUDescriptorSetLayout.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,33 +57,11 @@ class ICPUDescriptorSetLayout : public IDescriptorSetLayout<ICPUSampler>, public
5757
constexpr static inline auto AssetType = ET_DESCRIPTOR_SET_LAYOUT;
5858
inline E_TYPE getAssetType() const override { return AssetType; }
5959

60-
core::unordered_set<const IAsset*> computeDependants() const override
61-
{
62-
return computeDependantsImpl(this);
63-
}
64-
65-
core::unordered_set<IAsset*> computeDependants() override
66-
{
67-
return computeDependantsImpl(this);
68-
}
69-
7060
protected:
7161
virtual ~ICPUDescriptorSetLayout() = default;
7262

7363

7464
private:
75-
template <typename Self>
76-
requires(std::same_as<std::remove_cv_t<Self>, ICPUDescriptorSetLayout>)
77-
static auto computeDependantsImpl(Self* self) {
78-
using asset_ptr_t = std::conditional_t<std::is_const_v<Self>, const IAsset*, IAsset*>;
79-
core::unordered_set<asset_ptr_t> dependants;
80-
if (!self->m_immutableSamplers) return dependants;
81-
for (const auto& sampler: *self->m_immutableSamplers)
82-
{
83-
dependants.insert(sampler.get());
84-
}
85-
return dependants;
86-
}
8765

8866
inline virtual void visitDependentsImpl(std::function<bool(const IAsset*)> visit) const override
8967
{

include/nbl/asset/ICPUGraphicsPipeline.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ class ICPUGraphicsPipeline final : public ICPUPipeline<IGraphicsPipeline<ICPUPip
2929
constexpr static inline auto AssetType = ET_GRAPHICS_PIPELINE;
3030
inline E_TYPE getAssetType() const override { return AssetType; }
3131

32-
inline core::unordered_set<const IAsset*> computeDependants() const override
33-
{
34-
return computeDependantsImpl(this);
35-
}
36-
37-
inline core::unordered_set<IAsset*> computeDependants() override
38-
{
39-
return computeDependantsImpl(this);
40-
}
41-
4232
inline const SCachedCreationParams& getCachedCreationParams() const
4333
{
4434
return pipeline_base_t::getCachedCreationParams();
@@ -124,16 +114,6 @@ class ICPUGraphicsPipeline final : public ICPUPipeline<IGraphicsPipeline<ICPUPip
124114
return static_cast<hlsl::ShaderStage>(hlsl::ShaderStage::ESS_VERTEX + index);
125115
}
126116

127-
template <typename Self>
128-
requires(std::same_as<std::remove_cv_t<Self>, ICPUGraphicsPipeline>)
129-
static auto computeDependantsImpl(Self* self) {
130-
using asset_ptr_t = std::conditional_t<std::is_const_v<Self>, const IAsset*, IAsset*>;
131-
core::unordered_set<asset_ptr_t> dependants = { self->m_layout.get(), self->m_renderpass.get()};
132-
for (const auto& info : self->m_specInfos)
133-
if (info.shader) dependants.insert(info.shader.get());
134-
return dependants;
135-
}
136-
137117
inline core::smart_refctd_ptr<base_t> clone_impl(core::smart_refctd_ptr<ICPUPipelineLayout>&& layout, uint32_t depth) const override final
138118
{
139119
auto* newPipeline = new ICPUGraphicsPipeline(layout.get(), m_renderpass.get());

include/nbl/asset/ICPUImage.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,6 @@ class NBL_API2 ICPUImage final : public IImage, public IPreHashed
4545
constexpr static inline auto AssetType = ET_IMAGE;
4646
inline IAsset::E_TYPE getAssetType() const override { return AssetType; }
4747

48-
// Do not report buffer as dependant, as we will simply drop it instead of discarding its contents!
49-
inline core::unordered_set<const IAsset*> computeDependants() const override
50-
{
51-
return {};
52-
}
53-
54-
inline core::unordered_set<IAsset*> computeDependants() override
55-
{
56-
return {};
57-
}
58-
5948
core::blake3_hash_t computeContentHash() const override;
6049

6150
// Having regions specififed to upload is optional! So to have content missing we must have regions but no buffer content

0 commit comments

Comments
 (0)