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
// note we override it with default imguis (void*) type
391
391
#include <cstdint>
392
-
#define ImTextureID uint32_t
392
+
393
+
//! Custom "ImTextureID" info struct for Nabla UI backend purposes about resource sampler & texture descriptor binding's array indicies
394
+
struct SImResourceInfo
395
+
{
396
+
//! texture descriptor binding's array index
397
+
uint16_t textureID : 14,
398
+
399
+
//! sampler descriptor binding's array index, note its only meta for the texture for which we define operators to compare to (so you can specify which sampler ID should be used from the binding array)
//! Reserved font atlas indicies for backend textures & samplers descriptor binding's array, any attempt to hook user defined texture ID == FontAtlasTexId will result in undefined behaviour
using COMPOSE_T = nbl::video::StreamingTransientDataBufferST<nbl::core::allocator<uint8_t>>; //! composes memory available for the general purpose allocator to suballocate memory ranges
15
-
using SUBALLOCATOR_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
17
+
//! 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
46
+
structSBindingInfo
47
+
{
48
+
//! descriptor set index for a resource
49
+
uint32_t setIx,
50
+
51
+
//! binding index for a given resource
52
+
bindingIx;
53
+
};
54
+
55
+
//! 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
56
+
enumclassDefaultSamplerIx : uint16_t
36
57
{
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
118
+
structSUpdateParameters
67
119
{
68
120
//! what we pass to ImGuiIO::AddMousePosEvent
69
-
nbl::hlsl::float32_t2 mousePosition,
121
+
hlsl::float32_t2 mousePosition,
70
122
71
123
//! main display size in pixels
72
124
displaySize;
73
125
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
136
//! updates ImGuiIO & records ImGUI *cpu* draw command lists, you have to call it before .render
91
-
boolupdate(constS_UPDATE_PARAMETERS& params);
137
+
boolupdate(constSUpdateParameters& params);
92
138
93
139
//! 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
0 commit comments