Skip to content

Commit 4747664

Browse files
various minor improvements
1 parent ff741e1 commit 4747664

File tree

8 files changed

+58
-52
lines changed

8 files changed

+58
-52
lines changed

include/nbl/asset/utils/CSPIRVIntrospector.h

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,36 @@ namespace nbl::asset
3333
class NBL_API2 CSPIRVIntrospector : public core::Uncopyable
3434
{
3535
public:
36-
37-
class NBL_API2 CIntrospectionData : public core::IReferenceCounted
36+
static IDescriptor::E_TYPE resType2descType(E_SHADER_RESOURCE_TYPE _t)
3837
{
38+
switch (_t)
39+
{
40+
case ESRT_COMBINED_IMAGE_SAMPLER:
41+
return IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER;
42+
break;
43+
case ESRT_STORAGE_IMAGE:
44+
return IDescriptor::E_TYPE::ET_STORAGE_IMAGE;
45+
break;
46+
case ESRT_UNIFORM_TEXEL_BUFFER:
47+
return IDescriptor::E_TYPE::ET_UNIFORM_TEXEL_BUFFER;
48+
break;
49+
case ESRT_STORAGE_TEXEL_BUFFER:
50+
return IDescriptor::E_TYPE::ET_STORAGE_TEXEL_BUFFER;
51+
break;
52+
case ESRT_UNIFORM_BUFFER:
53+
return IDescriptor::E_TYPE::ET_UNIFORM_BUFFER;
54+
break;
55+
case ESRT_STORAGE_BUFFER:
56+
return IDescriptor::E_TYPE::ET_STORAGE_BUFFER;
57+
break;
58+
default:
59+
break;
60+
}
61+
return IDescriptor::E_TYPE::ET_COUNT;
62+
}
63+
64+
class NBL_API2 CIntrospectionData : public core::IReferenceCounted
65+
{
3966
protected:
4067
~CIntrospectionData();
4168

include/nbl/core/decl/smart_refctd_ptr.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ template< class U, class T >
124124
smart_refctd_ptr<U> smart_refctd_ptr_static_cast(smart_refctd_ptr<T>&& smart_ptr);
125125

126126
template< class U, class T >
127-
smart_refctd_ptr<U> move_and_static_cast(smart_refctd_ptr<T>&& smart_ptr);
127+
smart_refctd_ptr<U> move_and_static_cast(smart_refctd_ptr<T>& smart_ptr);
128+
template< class U, class T >
129+
smart_refctd_ptr<U> move_and_static_cast(smart_refctd_ptr<T>&& smart_ptr) {return move_and_static_cast<U,T>(smart_ptr);}
128130

129131

130132
template< class U, class T >
@@ -133,7 +135,9 @@ template< class U, class T >
133135
smart_refctd_ptr<U> smart_refctd_ptr_dynamic_cast(smart_refctd_ptr<T>&& smart_ptr);
134136

135137
template< class U, class T >
136-
smart_refctd_ptr<U> move_and_dynamic_cast(smart_refctd_ptr<T>&& smart_ptr);
138+
smart_refctd_ptr<U> move_and_dynamic_cast(smart_refctd_ptr<T>& smart_ptr);
139+
template< class U, class T >
140+
smart_refctd_ptr<U> move_and_dynamic_cast(smart_refctd_ptr<T>&& smart_ptr) {return move_and_dynamic_cast<U,T>(smart_ptr);}
137141

138142
} // end namespace nbl::core
139143

include/nbl/core/def/smart_refctd_ptr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ inline smart_refctd_ptr<U> smart_refctd_ptr_static_cast(smart_refctd_ptr<T>&& sm
109109
}
110110

111111
template< class U, class T >
112-
inline smart_refctd_ptr<U> move_and_static_cast(smart_refctd_ptr<T>&& smart_ptr)
112+
inline smart_refctd_ptr<U> move_and_static_cast(smart_refctd_ptr<T>& smart_ptr)
113113
{
114114
return smart_refctd_ptr_static_cast<U,T>(std::move(smart_ptr));
115115
}
@@ -129,7 +129,7 @@ inline smart_refctd_ptr<U> smart_refctd_ptr_dynamic_cast(smart_refctd_ptr<T>&& s
129129
}
130130

131131
template< class U, class T >
132-
inline smart_refctd_ptr<U> move_and_dynamic_cast(smart_refctd_ptr<T>&& smart_ptr)
132+
inline smart_refctd_ptr<U> move_and_dynamic_cast(smart_refctd_ptr<T>& smart_ptr)
133133
{
134134
return smart_refctd_ptr_dynamic_cast<U,T>(std::move(smart_ptr));
135135
}

include/nbl/system/IApplicationFramework.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,6 @@ class IApplicationFramework : public core::IReferenceCounted
7979
return nullptr;
8080
}
8181

82-
IApplicationFramework(
83-
const path& _localInputCWD,
84-
const path& _localOutputCWD,
85-
const path& _sharedInputCWD,
86-
const path& _sharedOutputCWD) :
87-
localInputCWD(_localInputCWD), localOutputCWD(_localOutputCWD), sharedInputCWD(_sharedInputCWD), sharedOutputCWD(_sharedOutputCWD)
88-
{
89-
GlobalsInit();
90-
}
91-
9282
// DEPRECATED
9383
virtual void setSystem(core::smart_refctd_ptr<ISystem>&& system) {}
9484

@@ -101,7 +91,18 @@ class IApplicationFramework : public core::IReferenceCounted
10191
virtual bool keepRunning() = 0;
10292

10393
protected:
104-
~IApplicationFramework() {}
94+
IApplicationFramework(
95+
const path& _localInputCWD,
96+
const path& _localOutputCWD,
97+
const path& _sharedInputCWD,
98+
const path& _sharedOutputCWD) :
99+
localInputCWD(_localInputCWD), localOutputCWD(_localOutputCWD), sharedInputCWD(_sharedInputCWD), sharedOutputCWD(_sharedOutputCWD)
100+
{
101+
GlobalsInit();
102+
}
103+
// need this one for skipping the whole constructor chain
104+
IApplicationFramework() = default;
105+
virtual ~IApplicationFramework() {}
105106

106107
// DEPRECATED
107108
virtual void onAppInitialized_impl() {assert(false);}

include/nbl/video/ILogicalDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class NBL_API2 ILogicalDevice : public core::IReferenceCounted, public IDeviceMe
4545
constexpr static inline uint8_t MaxQueuesInFamily = 63;
4646

4747
IGPUQueue::E_CREATE_FLAGS flags = IGPUQueue::ECF_NONE;
48-
uint8_t familyIndex = ~0u;
48+
uint8_t familyIndex = 0xff;
4949
uint8_t count = 0;
5050
std::array<float,MaxQueuesInFamily> priorities = []()->auto{
5151
std::array<float,MaxQueuesInFamily> retval;retval.fill(IGPUQueue::DEFAULT_QUEUE_PRIORITY);return retval;

include/nbl/video/utilities/IGPUObjectFromAssetConverter.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,14 @@ class IGPUObjectFromAssetConverter
106106
core::smart_refctd_ptr<IGPUEvent>* event = nullptr;
107107
};
108108

109-
//! Required not null
109+
//! Required not null if an ICPUImage or ICPUBuffer needs converting
110110
IUtilities* utilities = nullptr;
111+
//! Required not null
111112
ILogicalDevice* device = nullptr;
112113
//! Required not null
113114
asset::IAssetManager* assetManager = nullptr;
114115
IGPUPipelineCache* pipelineCache = nullptr;
115116

116-
IPhysicalDevice::SLimits limits;
117-
118117
uint32_t finalQueueFamIx = 0u;
119118

120119
// @sadiuk put here more parameters if needed
@@ -466,13 +465,15 @@ auto IGPUObjectFromAssetConverter::create(const asset::ICPUBuffer** const _begin
466465
const auto assetCount = std::distance(_begin, _end);
467466
auto res = core::make_refctd_dynamic_array<created_gpu_object_array<asset::ICPUBuffer> >(assetCount);
468467

468+
const auto& limits = _params.device->getPhysicalDevice()->getLimits();
469+
469470
const uint64_t alignment =
470471
std::max<uint64_t>(
471-
std::max<uint64_t>(_params.limits.bufferViewAlignment, _params.limits.minSSBOAlignment),
472-
std::max<uint64_t>(_params.limits.minUBOAlignment, _NBL_SIMD_ALIGNMENT)
472+
std::max<uint64_t>(limits.bufferViewAlignment,limits.minSSBOAlignment),
473+
std::max<uint64_t>(limits.minUBOAlignment, _NBL_SIMD_ALIGNMENT)
473474
);
474475

475-
const uint64_t maxBufferSize = _params.limits.maxBufferSize;
476+
const uint64_t maxBufferSize = limits.maxBufferSize;
476477
auto out = res->begin();
477478
auto firstInBlock = out;
478479
auto newBlock = [&]() -> auto

src/nbl/asset/utils/CSPIRVIntrospector.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -102,33 +102,6 @@ bool CSPIRVIntrospector::introspectAllShaders(core::smart_refctd_ptr<const CIntr
102102
return true;
103103
}
104104

105-
static IDescriptor::E_TYPE resType2descType(E_SHADER_RESOURCE_TYPE _t)
106-
{
107-
switch (_t)
108-
{
109-
case ESRT_COMBINED_IMAGE_SAMPLER:
110-
return IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER;
111-
break;
112-
case ESRT_STORAGE_IMAGE:
113-
return IDescriptor::E_TYPE::ET_STORAGE_IMAGE;
114-
break;
115-
case ESRT_UNIFORM_TEXEL_BUFFER:
116-
return IDescriptor::E_TYPE::ET_UNIFORM_TEXEL_BUFFER;
117-
break;
118-
case ESRT_STORAGE_TEXEL_BUFFER:
119-
return IDescriptor::E_TYPE::ET_STORAGE_TEXEL_BUFFER;
120-
break;
121-
case ESRT_UNIFORM_BUFFER:
122-
return IDescriptor::E_TYPE::ET_UNIFORM_BUFFER;
123-
break;
124-
case ESRT_STORAGE_BUFFER:
125-
return IDescriptor::E_TYPE::ET_STORAGE_BUFFER;
126-
break;
127-
default:
128-
break;
129-
}
130-
return IDescriptor::E_TYPE::ET_COUNT;
131-
}
132105

133106
template<E_SHADER_RESOURCE_TYPE restype>
134107
static std::pair<bool, IImageView<ICPUImage>::E_TYPE> imageInfoFromResource(const SShaderResource<restype>& _res)

0 commit comments

Comments
 (0)