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
update UI shader codegen - allow for even more freedom and gen NBL_TEXTURES_BINDING, NBL_SAMPLER_STATES_BINDING, NBL_RESOURCES_COUNT & NBL_RESOURCES_SET. Validate external descriptor set layout if given (redirects, validate required textures & samplers binding), support generating default one if nullptr passed. Add more comments for API usage, update examples_tests submodule
nbl::video::IGPUDescriptorSetLayout* const descriptorSetLayout = nullptr; //! optional, if not provided then default layout will be created declaring:
35
+
constuint32_t setIx = 0u, // -> following set for ImGUI resources which consists of textures (ImGUI font atlas + optional user provided textures) & corresponding *immutable* samplers
36
+
count = 0x45u, // -> common amount of resources (since for a texture there is a sampler)
37
+
texturesBindingIx = 0u, // -> binding index for textures
38
+
samplersBindingIx = 1u; // -> binding index for samplers
uint32_t subpassIx = 0u; //! optional, default value used if not provided
41
-
nbl::video::IGPUDescriptorSetLayout* const descriptorSetLayout = nullptr; //! optional, default layout used if not provided [STILL TODO, currently its assumed its not nullptr!]
42
-
nbl::video::IGPUPipelineCache* const pipelineCache = nullptr; //! optional, no cache used if not provided
43
-
typename MDI::COMPOSE_T* const streamingMDIBuffer = nullptr; //! optional, default MDI buffer allocated if not provided
44
-
S_RESOURCE_PARAMETERS texturesInfo = { .setIx = 0u, .bindingIx = 0u }, //! optional, default values used if not provided
45
-
samplerStateInfo = { .setIx = 0u, .bindingIx = 1u }; //! optional, default values used if not provided
uint32_t subpassIx = 0u; //! optional, default value used if not provided
51
+
S_RESOURCE_PARAMETERS resources; //! optional, default parameters used if not provided
52
+
nbl::video::IGPUPipelineCache* const pipelineCache = nullptr; //! optional, no cache used if not provided
53
+
typename MDI::COMPOSE_T* const streamingMDIBuffer = nullptr; //! optional, default MDI buffer allocated if not provided
46
54
};
47
55
48
56
//! parameters which may change every frame, used with the .update call to interact with ImGuiIO; we require a very *required* minimum - if you need to cover more IO options simply get the IO with ImGui::GetIO() to customize them (they all have default values you can change before calling the .update)
@@ -89,6 +97,9 @@ class UI final : public core::IReferenceCounted
auto pipelineLayout = createPipelineLayout(m_creationParams.texturesInfo.setIx); //! its okay to take the Ix from textures info because we force user to use the same set for both textures and samplers [also validated at this point]
53
+
auto pipelineLayout = createPipelineLayout(m_creationParams.resources.setIx,
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
+
{
60
+
//! if default descriptor set layout is not provided, we create it here
auto system = smart_refctd_ptr<system::ISystem>(m_creationParams.assetManager->getSystem()); //! proxy the system, we will touch it gently
64
-
auto archive = make_smart_refctd_ptr<nbl::ext::imgui::builtin::CArchive>(smart_refctd_ptr<system::ILogger>(m_creationParams.utilities->getLogger())); //! we should never assume user will mount our internal archive since its the extension and not user's job to do it, hence we mount only to compile our extension sources then unmount the archive
65
-
auto compiler = make_smart_refctd_ptr<CHLSLCompiler>(smart_refctd_ptr(system)); //! note we are out of default logical device's compiler set scope so also a few special steps are required to compile our extension shaders to SPIRV
132
+
auto archive = make_smart_refctd_ptr<nbl::ext::imgui::builtin::CArchive>(smart_refctd_ptr<system::ILogger>(m_creationParams.utilities->getLogger())); //! we should never assume user will mount our internal archive since its the extension and not user's job to do it, hence we mount only to compile our extension sources then unmount the archive
133
+
auto compiler = make_smart_refctd_ptr<CHLSLCompiler>(smart_refctd_ptr(system)); //! note we are out of default logical device's compiler set scope so also a few special steps are required to compile our extension shaders to SPIRV
66
134
auto includeFinder = make_smart_refctd_ptr<IShaderCompiler::CIncludeFinder>(smart_refctd_ptr(system));
67
135
auto includeLoader = includeFinder->getDefaultFileSystemLoader();
m_creationParams.utilities->getLogger()->log("Provided descriptor set layout has no bindings for IDescriptor::E_TYPE::%s, you are required to provide at least single one for default ImGUI Font Atlas texture!", system::ILogger::ELL_ERROR, typeLiteral.data());
m_creationParams.utilities->getLogger()->log("Provided descriptor set layout has IDescriptor::E_TYPE::%s binding for requested `m_creationParams.resources.%s` index but with different binding count!", system::ILogger::ELL_ERROR, typeLiteral.data(), ixLiteral.data());
m_creationParams.utilities->getLogger()->log("Provided descriptor set layout has IDescriptor::E_TYPE::%s binding for requested `m_creationParams.resources.%s` index but doesn't meet stage flags requirements!", system::ILogger::ELL_ERROR, typeLiteral.data(), ixLiteral.data());
if (!create.hasFlags(descriptorType == IDescriptor::E_TYPE::ET_SAMPLED_IMAGE ? m_creationParams.resources.TEXTURES_REQUIRED_CREATE_FLAGS : m_creationParams.resources.SAMPLERS_REQUIRED_CREATE_FLAGS))
724
+
{
725
+
m_creationParams.utilities->getLogger()->log("Provided descriptor set layout has IDescriptor::E_TYPE::%s binding for requested `m_creationParams.resources.%s` index but doesn't meet create flags requirements!", system::ILogger::ELL_ERROR, typeLiteral.data(), ixLiteral.data());
726
+
returnfalse;
727
+
}
728
+
729
+
ok = true;
730
+
break;
731
+
}
732
+
}
733
+
734
+
if (!ok)
735
+
{
736
+
m_creationParams.utilities->getLogger()->log("Provided descriptor set layout has no IDescriptor::E_TYPE::%s binding for requested `m_creationParams.resources.%s` index or it is invalid!", system::ILogger::ELL_ERROR, typeLiteral.data(), ixLiteral.data());
std::make_pair(bool(m_creationParams.texturesInfo.setIx == m_creationParams.samplerStateInfo.setIx), "Invalid `m_creationParams.texturesInfo.setIx` is not equal to `m_creationParams.samplerStateInfo.setIx`!"),
620
-
std::make_pair(bool(m_creationParams.texturesInfo.bindingIx != m_creationParams.samplerStateInfo.bindingIx), "Invalid `m_creationParams.texturesInfo.bindingIx` is equal to `m_creationParams.samplerStateInfo.bindingIx`!")
std::make_pair(bool(m_creationParams.resources.texturesBindingIx != m_creationParams.resources.samplersBindingIx), "Invalid `m_creationParams.resources.texturesBindingIx` is equal to `m_creationParams.resources.samplersBindingIx`!"),
0 commit comments