You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
allow for full UI resources setup freedom, exchange descriptor set layout with pipeline layout in the creation parameters, update examples_tests submodule
Copy file name to clipboardExpand all lines: include/nbl/ext/ImGui/ImGui.h
+13-7Lines changed: 13 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -33,11 +33,17 @@ class UI final : public core::IReferenceCounted
33
33
{
34
34
structS_RESOURCE_PARAMETERS
35
35
{
36
-
nbl::video::IGPUDescriptorSetLayout* const descriptorSetLayout = nullptr; //! optional, if not provided then default layout will be created declaring:
37
-
constuint32_t setIx = 0u, // -> following set for ImGUI resources which consists of textures (ImGUI font atlas + optional user provided textures) & corresponding *immutable* samplers
38
-
count = 0x45u, // -> common amount of resources (since for a texture there is a sampler)
39
-
texturesBindingIx = 0u, // -> binding index for textures
40
-
samplersBindingIx = 1u; // -> binding index for samplers
36
+
nbl::video::IGPUPipelineLayout* const pipelineLayout = nullptr; //! optional, default layout used if not provided declaring required UI resources such as textures (required font atlas + optional user defined textures) & corresponding samplers
37
+
uint32_t count = 0x45u; //! amount of total UI textures (and corresponding samplers)
38
+
39
+
structS_BINDING_REQUEST_INFO//! for a given pipeline layout we need to know what is intended for UI resources
40
+
{
41
+
uint32_t setIx, //! descriptor set index for a resource
42
+
bindingIx; //! binding index for a given resource
43
+
};
44
+
45
+
const S_BINDING_REQUEST_INFO textures = { .setIx = 0u, .bindingIx = 0u }, //! optional, default texture binding request info used if not provided (set & binding index)
46
+
samplers = { .setIx = 0u, .bindingIx = 1u }; //! optional, default sampler binding request info used if not provided (set & binding index)
//! updates mapped mdi buffer & records *gpu* draw command, you are required to bind UI's graphics pipeline & descriptor sets before calling this function - use getPipeline() to get the pipeline & getCreationParameters() to get info about your set resources
Copy file name to clipboardExpand all lines: src/nbl/ext/ImGui/ImGui.cpp
+85-87Lines changed: 85 additions & 87 deletions
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,6 @@ namespace nbl::ext::imgui
22
22
{
23
23
voidUI::createPipeline()
24
24
{
25
-
// Constants: we are using 'vec2 offset' and 'vec2 scale' instead of a full 3d projection matrix
26
25
SPushConstantRange pushConstantRanges[] =
27
26
{
28
27
{
@@ -32,87 +31,77 @@ namespace nbl::ext::imgui
32
31
}
33
32
};
34
33
35
-
auto createPipelineLayout = [&](constuint32_t setIx, core::smart_refctd_ptr<IGPUDescriptorSetLayout> descriptorSetLayout) -> core::smart_refctd_ptr<IGPUPipelineLayout>
34
+
auto pipelineLayout = m_creationParams.resources.pipelineLayout ? smart_refctd_ptr<IGPUPipelineLayout>(m_creationParams.resources.pipelineLayout) /* provided? good, at this point its validated and we just use it */ :
35
+
[&]() -> smart_refctd_ptr<IGPUPipelineLayout>
36
36
{
37
-
switch (setIx)
37
+
//! if default pipeline layout is not provided, we create it here given your request binding info with certain constraints about samplers - they are immutable separate and part of the default layout
if (m_creationParams.resources.descriptorSetLayout)
57
-
return smart_refctd_ptr<IGPUDescriptorSetLayout>(m_creationParams.resources.descriptorSetLayout); // provided? good we just use it, we are validated at this point
58
-
else
59
52
{
60
-
//! if default descriptor set layout is not provided, we create it here
m_creationParams.utilities->getLogger()->log("Provided descriptor set layout for IDescriptor::E_TYPE::%s is nullptr!", system::ILogger::ELL_ERROR, typeLiteral.data());
std::make_pair(bool(m_creationParams.resources.texturesBindingIx != m_creationParams.resources.samplersBindingIx), "Invalid `m_creationParams.resources.texturesBindingIx` is equal to `m_creationParams.resources.samplersBindingIx`!"),
std::make_pair(bool(m_creationParams.resources.textures.bindingIx != m_creationParams.resources.samplers.bindingIx), "Invalid `m_creationParams.resources.textures.bindingIx` is equal to `m_creationParams.resources.samplers.bindingIx`!"),
Copy file name to clipboardExpand all lines: src/nbl/ext/ImGui/shaders/common.hlsl
-3Lines changed: 0 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,3 @@
1
-
// temporary, maybe we should ask user for it and the layout BUT only for sampler + texture binding IDs + set IDs they belong to and size of the texture array?
0 commit comments