@@ -57,53 +57,15 @@ class IGPUDescriptorSet : public asset::IDescriptorSet<const IGPUDescriptorSetLa
57
57
inline bool isZombie () const { return (m_pool.get () == nullptr ); }
58
58
59
59
protected:
60
- IGPUDescriptorSet (core::smart_refctd_ptr<const IGPUDescriptorSetLayout>&& _layout, core::smart_refctd_ptr<IDescriptorPool>&& pool, const uint32_t poolOffset, IDescriptorPool::SDescriptorOffsets && offsets);
60
+ IGPUDescriptorSet (core::smart_refctd_ptr<const IGPUDescriptorSetLayout>&& _layout, core::smart_refctd_ptr<IDescriptorPool>&& pool, IDescriptorPool::SStorageOffsets && offsets);
61
61
virtual ~IGPUDescriptorSet ();
62
62
63
63
private:
64
- friend class ILogicalDevice ;
65
-
66
64
inline void incrementVersion () { m_version.fetch_add (1ull ); }
67
65
68
- // TODO(achal): Don't know yet if we want to keep these.
69
- inline void processWrite (const IGPUDescriptorSet::SWriteDescriptorSet& write)
70
- {
71
- assert (write.dstSet == this );
72
-
73
- auto * descriptors = getDescriptors (write.descriptorType , write.binding );
74
- auto * samplers = getMutableSamplers (write.binding );
75
- for (auto j = 0 ; j < write.count ; ++j)
76
- {
77
- descriptors[j] = write.info [j].desc ;
78
-
79
- if (samplers)
80
- samplers[j] = write.info [j].info .image .sampler ;
81
- }
82
- }
83
-
84
- #if 0
85
- inline void processCopy(const IGPUDescriptorSet::SCopyDescriptorSet& copy)
86
- {
87
- assert(copy.dstSet == this);
88
-
89
- for (uint32_t t = 0; t < static_cast<uint32_t>(asset::IDescriptor::E_TYPE::ET_COUNT); ++t)
90
- {
91
- const auto type = static_cast<asset::IDescriptor::E_TYPE>(t);
92
-
93
- auto* srcDescriptors = srcDS->getDescriptors(type, pDescriptorCopies[i].srcBinding);
94
- auto* srcSamplers = srcDS->getMutableSamplers(pDescriptorCopies[i].srcBinding);
95
-
96
- auto* dstDescriptors = dstDS->getDescriptors(type, pDescriptorCopies[i].dstBinding);
97
- auto* dstSamplers = dstDS->getMutableSamplers(pDescriptorCopies[i].dstBinding);
98
-
99
- if (srcDescriptors && dstDescriptors)
100
- std::copy_n(srcDescriptors, pDescriptorCopies[i].count, dstDescriptors);
101
-
102
- if (srcSamplers && dstSamplers)
103
- std::copy_n(srcSamplers, pDescriptorCopies[i].count, dstSamplers);
104
- }
105
- }
106
- #endif
66
+ friend class ILogicalDevice ;
67
+ bool processWrite (const IGPUDescriptorSet::SWriteDescriptorSet& write);
68
+ bool processCopy (const IGPUDescriptorSet::SCopyDescriptorSet& copy);
107
69
108
70
// This assumes that descriptors of a particular type in the set will always be contiguous in pool's storage memory, regardless of which binding in the set they belong to.
109
71
inline core::smart_refctd_ptr<asset::IDescriptor>* getDescriptors (const asset::IDescriptor::E_TYPE type, const uint32_t binding) const
@@ -138,7 +100,7 @@ class IGPUDescriptorSet : public asset::IDescriptorSet<const IGPUDescriptorSetLa
138
100
if (baseAddress == nullptr )
139
101
return nullptr ;
140
102
141
- const auto offset = getDescriptorStorageOffset (type);
103
+ const auto offset = m_storageOffsets. getDescriptorOffset (type);
142
104
if (offset == ~0u )
143
105
return nullptr ;
144
106
@@ -151,21 +113,17 @@ class IGPUDescriptorSet : public asset::IDescriptorSet<const IGPUDescriptorSetLa
151
113
if (baseAddress == nullptr )
152
114
return nullptr ;
153
115
154
- const auto poolOffset = getMutableSamplerStorageOffset ();
155
- if (poolOffset == ~0u )
116
+ const auto offset = m_storageOffsets. getMutableSamplerOffset ();
117
+ if (offset == ~0u )
156
118
return nullptr ;
157
119
158
- return baseAddress + poolOffset ;
120
+ return baseAddress + offset ;
159
121
}
160
122
161
- inline uint32_t getDescriptorStorageOffset (const asset::IDescriptor::E_TYPE type) const { return m_descriptorStorageOffsets.data [static_cast <uint32_t >(type)]; }
162
- inline uint32_t getMutableSamplerStorageOffset () const { return m_descriptorStorageOffsets.data [static_cast <uint32_t >(asset::IDescriptor::E_TYPE::ET_COUNT)]; }
163
-
164
123
std::atomic_uint64_t m_version;
165
124
friend class IDescriptorPool ;
166
125
core::smart_refctd_ptr<IDescriptorPool> m_pool;
167
- uint32_t m_poolOffset;
168
- const IDescriptorPool::SDescriptorOffsets m_descriptorStorageOffsets;
126
+ const IDescriptorPool::SStorageOffsets m_storageOffsets;
169
127
};
170
128
171
129
}
0 commit comments