Skip to content

Commit 4b17133

Browse files
mostly stylistic fixes
1 parent bd74b8c commit 4b17133

File tree

4 files changed

+58
-17
lines changed

4 files changed

+58
-17
lines changed

include/nbl/system/CColoredStdoutLoggerWin32.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
#define _NBL_SYSTEM_C_COLORFUL_STDOUT_LOGGER_WIN32_INCLUDED_
33

44
#include "nbl/system/IThreadsafeLogger.h"
5-
//instead of #include <Windows.h>
6-
#include "nbl/system/DefaultFuncPtrLoader.h"
7-
8-
#ifdef _NBL_PLATFORM_WINDOWS_
95

106
namespace nbl::system
117
{
8+
#ifdef _NBL_PLATFORM_WINDOWS_
9+
//instead of #include <Windows.h>
10+
#include "nbl/system/DefaultFuncPtrLoader.h"
1211

1312
class CColoredStdoutLoggerWin32 : public IThreadsafeLogger
1413
{
@@ -62,7 +61,7 @@ class CColoredStdoutLoggerWin32 : public IThreadsafeLogger
6261
}
6362
};
6463

65-
}
6664
#endif
65+
}
6766

6867
#endif

include/nbl/system/ICancellableAsyncQueueDispatcher.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef __NBL_I_CANCELLABLE_ASYNC_QUEUE_DISPATCHER_H_INCLUDED__
2-
#define __NBL_I_CANCELLABLE_ASYNC_QUEUE_DISPATCHER_H_INCLUDED__
1+
#ifndef _NBL_I_CANCELLABLE_ASYNC_QUEUE_DISPATCHER_H_INCLUDED_
2+
#define _NBL_I_CANCELLABLE_ASYNC_QUEUE_DISPATCHER_H_INCLUDED_
33

44
#include "nbl/system/IAsyncQueueDispatcher.h"
55
#include "nbl/system/SReadWriteSpinLock.h"

include/nbl/video/utilities/IGPUObjectFromAssetConverter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,7 @@ inline created_gpu_object_array<asset::ICPUDescriptorSet> IGPUObjectFromAssetCon
18011801
auto gpuImgViews = getGPUObjectsFromAssets<asset::ICPUImageView>(cpuImgViews.data(), cpuImgViews.data()+cpuImgViews.size(), _params);
18021802
auto gpuSamplers = getGPUObjectsFromAssets<asset::ICPUSampler>(cpuSamplers.data(), cpuSamplers.data()+cpuSamplers.size(), _params);
18031803

1804-
uint32_t dsCounts[] = { assetCount };
1804+
uint32_t dsCounts[] = {static_cast<uint32_t>(assetCount)};
18051805
auto dsPool = _params.device->createDescriptorPoolForDSLayouts(IDescriptorPool::ECF_NONE,&gpuLayouts->begin()->get(),&gpuLayouts->end()->get(), dsCounts);
18061806

18071807
core::vector<IGPUDescriptorSet::SWriteDescriptorSet> writes(maxWriteCount);

src/nbl/system/IFileArchive.cpp

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,58 @@
11
#include "nbl/system/IFileArchive.h"
2-
#include "nbl/system/IFileViewAllocator.h"
3-
namespace nbl::system
2+
3+
4+
using namespace nbl;
5+
using namespace nbl::system;
6+
7+
8+
core::SRange<const IFileArchive::SListEntry> IFileArchive::listAssets(const path& asset_path) const
49
{
5-
void IFileArchive::setFlagsVectorSize(size_t fileCount)
10+
// TODO: use something from ISystem for this?
11+
constexpr auto isSubDir = [](path p, path root) -> bool
612
{
7-
assert(!m_filesBuffer && !m_fileFlags);
8-
m_filesBuffer = (std::byte*)_NBL_ALIGNED_MALLOC(fileCount * SIZEOF_INNER_ARCHIVE_FILE, ALIGNOF_INNER_ARCHIVE_FILE);
9-
m_fileFlags = (std::atomic_flag*)_NBL_ALIGNED_MALLOC(fileCount * sizeof(std::atomic_flag), alignof(std::atomic_flag));
10-
for (int i = 0; i < fileCount; i++)
13+
while (p != path())
1114
{
12-
m_fileFlags[i].clear();
15+
if (p==root)
16+
return true;
17+
p = p.parent_path();
1318
}
14-
memset(m_filesBuffer, 0, fileCount * SIZEOF_INNER_ARCHIVE_FILE);
19+
return false;
20+
};
21+
22+
const IFileArchive::SListEntry* begin = nullptr;
23+
const IFileArchive::SListEntry* end = nullptr;
24+
for (auto& entry : m_items)
25+
{
26+
if (isSubDir(entry.pathRelativeToArchive, asset_path))
27+
{
28+
if (begin)
29+
end = &entry;
30+
else
31+
begin = &entry;
32+
}
33+
else if (end)
34+
break;
1535
}
36+
return {begin,end};
37+
38+
/*
39+
// future, cause lower/upper bound don't work like that
40+
auto begin = std::lower_bound(m_items.begin(), m_items.end(),asset_path);
41+
if (begin!=m_items.end())
42+
{
43+
auto end = std::upper_bound(begin,m_items.end(),asset_path);
44+
if (begin==end)
45+
return {&(*begin),&(*end)};
46+
}
47+
return {nullptr,nullptr};
48+
*/
49+
}
50+
51+
52+
core::smart_refctd_ptr<IFileArchive> IArchiveLoader::createArchive(core::smart_refctd_ptr<IFile>&& file, const std::string_view& password) const
53+
{
54+
if (!(file->getFlags()&IFile::ECF_READ))
55+
return nullptr;
56+
57+
return createArchive_impl(std::move(file),password);
1658
}

0 commit comments

Comments
 (0)