Skip to content

Commit 05ab5bf

Browse files
committed
change ICPUBuffer to corresponding span
1 parent 9d78243 commit 05ab5bf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/nbl/asset/ICPUImage.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ class CFlattenRegionsStreamHashImageFilter : public CMatchedSizeInOutImageFilter
132132
{
133133
auto buffer = getScratchAsBuffer(state->scratch.size);
134134
const auto product = parameters.mipLevels * parameters.arrayLayers;
135-
136-
scratch.hashes = { .offset = 0u, .size = product * sizeof(CState::outHash), .buffer = buffer };
137-
scratch.hashers = { .offset = scratch.hashes.size, .size = product * sizeof(blake3_hasher), .buffer = buffer };
138-
scratch.flatten = { .offset = scratch.hashers.offset + scratch.hashers.size, .size = state->scratch.size - scratch.hashers.size - scratch.hashes.size, .buffer = buffer };
135+
136+
scratch.hashes = { static_cast<CState::hash_t*>(state->scratch.memory), product };
137+
scratch.hashers = { reinterpret_cast<blake3_hasher*>(scratch.hashes.data() + scratch.hashes.size()), product };
138+
scratch.flatten = { .offset = scratch.hashes.size_bytes() + scratch.hashers.size_bytes(), .size = state->scratch.size - scratch.hashers.size_bytes() - scratch.hashes.size_bytes(), .buffer = buffer};
139139
}
140140

141141
const auto isFullyFlatten = scratch.flatten.size == 0ull;
@@ -212,8 +212,8 @@ class CFlattenRegionsStreamHashImageFilter : public CMatchedSizeInOutImageFilter
212212
we stream-hash texels per given mip level & layer
213213
*/
214214

215-
auto* const hashes = reinterpret_cast<CState::hash_t*>(getScratchAsBuffer(scratch.hashes.size, scratch.hashes.offset)->getPointer());
216-
auto* const hashers = reinterpret_cast<blake3_hasher*>(getScratchAsBuffer(scratch.hashers.size, scratch.hashers.offset)->getPointer());
215+
auto* const hashes = scratch.hashes.data();
216+
auto* const hashers = scratch.hashers.data();
217217

218218
auto executePerMipLevel = [&](const uint32_t miplevel)
219219
{
@@ -292,8 +292,8 @@ class CFlattenRegionsStreamHashImageFilter : public CMatchedSizeInOutImageFilter
292292

293293
struct ScratchMap
294294
{
295-
asset::SBufferRange<asset::ICPUBuffer> hashes; // hashes, single hash is obtained from given miplevel & layer, full hash for an image is a hash of this hash buffer
296-
asset::SBufferRange<asset::ICPUBuffer> hashers; // hashers, used to produce a hash
295+
std::span<CState::hash_t> hashes; // hashes, single hash is obtained from given miplevel & layer, full hash for an image is a hash of this hash buffer
296+
std::span<blake3_hasher> hashers; // hashers, used to produce a hash
297297
asset::SBufferRange<asset::ICPUBuffer> flatten; // tightly packed texels from input, no memory gaps
298298
};
299299
};

0 commit comments

Comments
 (0)