14
14
namespace nbl ::asset
15
15
{
16
16
17
- class ICPUImage final : public IImage, public IPreHashed
17
+ class NBL_API2 ICPUImage final : public IImage, public IPreHashed
18
18
{
19
19
public:
20
20
inline static core::smart_refctd_ptr<ICPUImage> create (const SCreationParams& _params)
@@ -44,38 +44,7 @@ class ICPUImage final : public IImage, public IPreHashed
44
44
// Having regions specififed to upload is optional!
45
45
inline size_t getDependantCount () const override {return !missingContent ()&&buffer ? 1 :0 ;}
46
46
47
- // !
48
- inline core::blake3_hash_t computeContentHash () const override
49
- {
50
- // TODO: Arek turn this into an image filter maybe?
51
- core::blake3_hasher hasher;
52
- for (auto m=0 ; m<m_creationParams.mipLevels ; m++)
53
- {
54
- const auto blockInfo = getTexelBlockInfo ();
55
- const auto mipExtentInBlocks = blockInfo.convertTexelsToBlocks (getMipSize (m));
56
- core::blake3_hasher levelHasher;
57
- if (missingContent ())
58
- {
59
- const auto zeroLength = blockInfo.getBlockByteSize ()*mipExtentInBlocks[0 ];
60
- auto zeroArray = std::make_unique<uint8_t []>(zeroLength);
61
- for (auto l=0 ; l<m_creationParams.arrayLayers ; l++)
62
- {
63
- // layers could be run in parallel
64
- core::blake3_hasher layerHasher;
65
- for (auto z=0 ; z<mipExtentInBlocks[2 ]; z++)
66
- for (auto y=0 ; y<mipExtentInBlocks[1 ]; y++)
67
- layerHasher.update (zeroArray.get (),zeroLength);
68
- levelHasher << static_cast <core::blake3_hash_t >(layerHasher);
69
- }
70
- }
71
- else
72
- {
73
- _NBL_TODO (); // TODO: Arek
74
- }
75
- levelHasher << static_cast <core::blake3_hash_t >(levelHasher);
76
- }
77
- return static_cast <core::blake3_hash_t >(hasher);
78
- }
47
+ core::blake3_hash_t computeContentHash () const override ;
79
48
80
49
inline bool missingContent () const override
81
50
{
@@ -95,14 +64,14 @@ class ICPUImage final : public IImage, public IPreHashed
95
64
}
96
65
inline const auto * getBuffer () const { return buffer.get (); }
97
66
98
- inline core::SRange <const IImage::SBufferCopy> getRegions () const
67
+ inline std::span <const IImage::SBufferCopy> getRegions () const
99
68
{
100
69
if (regions)
101
70
return {regions->begin (),regions->end ()};
102
- return {nullptr , nullptr };
71
+ return {};
103
72
}
104
73
105
- inline core::SRange <const IImage::SBufferCopy> getRegions (uint32_t mipLevel) const
74
+ inline std::span <const IImage::SBufferCopy> getRegions (uint32_t mipLevel) const
106
75
{
107
76
const IImage::SBufferCopy dummy = { 0ull ,0u ,0u ,{static_cast <E_ASPECT_FLAGS>(0u ),mipLevel,0u ,0u },{},{} };
108
77
auto begin = std::lower_bound (regions->begin (),regions->end (),dummy,mip_order_t ());
0 commit comments