11
11
// need Zlib to get this loader
12
12
#ifdef _NBL_COMPILE_WITH_ZLIB_
13
13
#include " zlib/zlib.h"
14
+ #include " zlib/zconf.h"
14
15
15
16
16
17
namespace nbl ::ext::MitsubaLoader
@@ -107,8 +108,7 @@ asset::SAssetBundle CSerializedLoader::loadAsset(system::IFile* _file, const ass
107
108
108
109
constexpr size_t CHUNK = 256 <<10 ;
109
110
using page_t = Page<>;
110
- auto decompressedResource = make_smart_refctd_ptr<adoption_memory_resource<core::vector<page_t >>>(core::vector<page_t >(CHUNK/sizeof (page_t )));
111
- auto & decompressed = decompressedResource->getBacker ();
111
+ auto decompressed = core::vector<page_t >(CHUNK/sizeof (page_t ));
112
112
for (uint32_t i=0 ; i<ctx.meshCount ; i++)
113
113
{
114
114
auto localSize = ctx.meshOffsets ->operator [](i+ctx.meshCount );
@@ -132,7 +132,7 @@ asset::SAssetBundle CSerializedLoader::loadAsset(system::IFile* _file, const ass
132
132
stream.zalloc = (alloc_func)0 ;
133
133
stream.zfree = (free_func)0 ;
134
134
135
- int32_t err = inflateInit2 (&stream, -MAX_WBITS );
135
+ int32_t err = inflateInit (&stream);
136
136
if (err == Z_OK)
137
137
{
138
138
while (err == Z_OK && err != Z_STREAM_END)
@@ -226,9 +226,9 @@ asset::SAssetBundle CSerializedLoader::loadAsset(system::IFile* _file, const ass
226
226
auto geo = make_smart_refctd_ptr<ICPUPolygonGeometry>();
227
227
geo->setIndexing (IPolygonGeometryBase::TriangleList ());
228
228
229
+ // overall cannot adopt memory because `decompressed` contains padding and other attributes we don't adopt
229
230
{
230
- const auto alignment = 0x1ull <<hlsl::findLSB (ptrdiff_t (ptr));
231
- auto view = createView<true >(sourceIsDoubles ? EF_R64G64B64_SFLOAT:EF_R32G32B32_SFLOAT,vertexCount,ptr,smart_refctd_ptr (decompressedResource),alignment);
231
+ auto view = createView (sourceIsDoubles ? EF_R64G64B64_SFLOAT:EF_R32G32B32_SFLOAT,vertexCount,ptr);
232
232
ptr += view.src .actualSize ();
233
233
geo->setPositionView (std::move (view));
234
234
}
@@ -278,8 +278,7 @@ asset::SAssetBundle CSerializedLoader::loadAsset(system::IFile* _file, const ass
278
278
}
279
279
280
280
{
281
- const auto alignment = 0x1ull <<hlsl::findLSB (ptrdiff_t (ptr));
282
- auto view = createView<true >(EF_R32_UINT,triangleCount*3 ,ptr,smart_refctd_ptr (decompressedResource),alignment);
281
+ auto view = createView (EF_R32_UINT,triangleCount*3 ,ptr);
283
282
ptr += view.src .actualSize ();
284
283
geo->setIndexView (std::move (view));
285
284
}
0 commit comments