Skip to content

Commit 9ee0327

Browse files
committed
update createDefaultPipelineLayout, take logical device instead of whole utilities, update examples_tests submodule
1 parent 2de19f2 commit 9ee0327

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

examples_tests

include/nbl/ext/ImGui/ImGui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class UI final : public core::IReferenceCounted
135135
void setContext(void* imguiContext);
136136

137137
//! creates default pipeline layout for the UI resources, "texturesCount" argument is textures descriptor binding's array size. Samplers are immutable and part of the created layout, SResourceParameters::DefaultSamplerIx::COUNT is the size of the samplers descriptor binding's array
138-
static core::smart_refctd_ptr<video::IGPUPipelineLayout> createDefaultPipelineLayout(video::IUtilities* const utilities, const SResourceParameters::SBindingInfo texturesInfo, const SResourceParameters::SBindingInfo samplersInfo, uint32_t texturesCount = 0x45);
138+
static core::smart_refctd_ptr<video::IGPUPipelineLayout> createDefaultPipelineLayout(video::ILogicalDevice* const device, const SResourceParameters::SBindingInfo texturesInfo, const SResourceParameters::SBindingInfo samplersInfo, uint32_t texturesCount = 0x45);
139139

140140
//! mounts the extension's archive to given system - useful if you want to create your own shaders with common header included
141141
static const core::smart_refctd_ptr<system::IFileArchive> mount(core::smart_refctd_ptr<system::ILogger> logger, system::ISystem* system, const std::string_view archiveAlias = "");

src/nbl/ext/ImGui/ImGui.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ static constexpr SPushConstantRange PushConstantRanges[] =
3232
}
3333
};
3434

35-
smart_refctd_ptr<IGPUPipelineLayout> UI::createDefaultPipelineLayout(IUtilities* const utilities, const SResourceParameters::SBindingInfo texturesInfo, const SResourceParameters::SBindingInfo samplersInfo, uint32_t texturesCount)
35+
smart_refctd_ptr<IGPUPipelineLayout> UI::createDefaultPipelineLayout(ILogicalDevice* const device, const SResourceParameters::SBindingInfo texturesInfo, const SResourceParameters::SBindingInfo samplersInfo, uint32_t texturesCount)
3636
{
37-
if (!utilities)
37+
if (!device)
3838
return nullptr;
3939

4040
if (texturesInfo.bindingIx == samplersInfo.bindingIx)
@@ -53,7 +53,7 @@ smart_refctd_ptr<IGPUPipelineLayout> UI::createDefaultPipelineLayout(IUtilities*
5353
params.TextureWrapV = ISampler::ETC_REPEAT;
5454
params.TextureWrapW = ISampler::ETC_REPEAT;
5555

56-
fontAtlasUISampler = utilities->getLogicalDevice()->createSampler(params);
56+
fontAtlasUISampler = device->createSampler(params);
5757
fontAtlasUISampler->setObjectDebugName("Nabla default ImGUI font UI sampler");
5858
}
5959

@@ -65,7 +65,7 @@ smart_refctd_ptr<IGPUPipelineLayout> UI::createDefaultPipelineLayout(IUtilities*
6565
params.TextureWrapV = ISampler::ETC_CLAMP_TO_EDGE;
6666
params.TextureWrapW = ISampler::ETC_CLAMP_TO_EDGE;
6767

68-
userTexturesSampler = utilities->getLogicalDevice()->createSampler(params);
68+
userTexturesSampler = device->createSampler(params);
6969
userTexturesSampler->setObjectDebugName("Nabla default ImGUI user texture sampler");
7070
}
7171

@@ -96,17 +96,20 @@ smart_refctd_ptr<IGPUPipelineLayout> UI::createDefaultPipelineLayout(IUtilities*
9696
auto layouts = std::to_array<smart_refctd_ptr<IGPUDescriptorSetLayout>>({ nullptr, nullptr, nullptr, nullptr });
9797

9898
if (texturesInfo.setIx == samplersInfo.setIx)
99-
layouts[texturesInfo.setIx] = utilities->getLogicalDevice()->createDescriptorSetLayout({ {textureBinding, samplersBinding} });
99+
layouts[texturesInfo.setIx] = device->createDescriptorSetLayout({ {textureBinding, samplersBinding} });
100100
else
101101
{
102-
layouts[texturesInfo.setIx] = utilities->getLogicalDevice()->createDescriptorSetLayout({ {textureBinding} });
103-
layouts[samplersInfo.setIx] = utilities->getLogicalDevice()->createDescriptorSetLayout({ {samplersBinding} });
102+
layouts[texturesInfo.setIx] = device->createDescriptorSetLayout({ {textureBinding} });
103+
layouts[samplersInfo.setIx] = device->createDescriptorSetLayout({ {samplersBinding} });
104104
}
105105

106-
assert(layouts[texturesInfo.setIx]);
107-
assert(layouts[samplersInfo.setIx]);
106+
if (!layouts[texturesInfo.setIx])
107+
return nullptr;
108+
109+
if (!layouts[samplersInfo.setIx])
110+
return nullptr;
108111

109-
return utilities->getLogicalDevice()->createPipelineLayout(PushConstantRanges, std::move(layouts[0u]), std::move(layouts[1u]), std::move(layouts[2u]), std::move(layouts[3u]));
112+
return device->createPipelineLayout(PushConstantRanges, std::move(layouts[0u]), std::move(layouts[1u]), std::move(layouts[2u]), std::move(layouts[3u]));
110113
}
111114

112115
const smart_refctd_ptr<IFileArchive> UI::mount(smart_refctd_ptr<ILogger> logger, ISystem* system, const std::string_view archiveAlias)

0 commit comments

Comments
 (0)