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
//! Reserved indexes for default backend samplers descriptor binding's array - use only if you created your pipeline layout with createDefaultPipelineLayout. If you need more or custom samplers then create the pipeline layout yourself
16
+
enumclassDefaultSamplerIx : uint16_t
17
+
{
18
+
FONT_ATLAS = FontAtlasSamplerId,
19
+
USER,
20
+
21
+
COUNT,
22
+
};
23
+
24
+
structSMdiBuffer
13
25
{
14
-
using COMPOSE_T = nbl::video::StreamingTransientDataBufferST<nbl::core::allocator<uint8_t>>; //! composes memory available for the general purpose allocator to suballocate memory ranges
15
-
usingSUBALLOCATOR_TRAITS_T = nbl::core::address_allocator_traits<nbl::core::LinearAddressAllocatorST<uint32_t>>;//! traits for MDI buffer suballocator - fills the data given the mdi allocator memory request
26
+
//! composes memory available for the general purpose allocator to suballocate memory ranges
//! for a given pipeline layout we need to know what is intended for UI resources
55
+
structSBindingInfo
36
56
{
37
-
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
38
-
uint32_t count = 0x45u; //! amount of total UI textures (and corresponding samplers)
39
-
40
-
structS_BINDING_REQUEST_INFO//! for a given pipeline layout we need to know what is intended for UI resources
41
-
{
42
-
uint32_t setIx, //! descriptor set index for a resource
43
-
bindingIx; //! binding index for a given resource
44
-
};
45
-
46
-
const S_BINDING_REQUEST_INFO textures = { .setIx = 0u, .bindingIx = 0u }, //! optional, default texture binding request info used if not provided (set & binding index)
47
-
samplers = { .setIx = 0u, .bindingIx = 1u }; //! optional, default sampler binding request info used if not provided (set & binding index)
//! 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)
66
-
structS_UPDATE_PARAMETERS
121
+
structSUpdateParameters
67
122
{
68
123
//! what we pass to ImGuiIO::AddMousePosEvent
69
-
nbl::hlsl::float32_t2 mousePosition,
124
+
hlsl::float32_t2 mousePosition,
70
125
71
126
//! main display size in pixels
72
127
displaySize;
73
128
74
-
//! Nabla events you want to be handled with the backend
//! Nabla ImGUI backend reserves this index for font atlas, any attempt to hook user defined texture within the index will result in undefined behaviour
88
-
staticconstexprauto NBL_FONT_ATLAS_TEX_ID = 0u;
89
-
90
139
//! updates ImGuiIO & records ImGUI *cpu* draw command lists, you have to call it before .render
91
-
boolupdate(constS_UPDATE_PARAMETERS& params);
140
+
boolupdate(constSUpdateParameters& params);
92
141
93
142
//! 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
//! 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
LIST_BUILTIN_RESOURCE(RESOURCES_TO_EMBED"vertex.hlsl") # (*) -> this we could precompile [no resources for which set/binding Ixs could be adjusted] but I'm not going to mix stuff
36
37
LIST_BUILTIN_RESOURCE(RESOURCES_TO_EMBED"fragment.hlsl") # (*) -> but this we could not since we let users to provide external descriptor set layout + ImGUI textures & sampler state set/binding Ixs (for pipeline layout) at runtime
0 commit comments