@@ -131,13 +131,13 @@ namespace nbl::ext::imgui
131
131
smart_refctd_ptr<IGPUDescriptorSetLayout> UI::CreateDescriptorSetLayout ()
132
132
{
133
133
static constexpr int Count = 1 ;
134
- IGPUDescriptorSetLayout::SBinding bindings[1 ] ;
134
+ IGPUDescriptorSetLayout::SBinding bindings[Count] = {} ;
135
135
{
136
136
bindings[0 ].binding = 0 ;
137
137
bindings[0 ].type = asset::IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER;
138
138
bindings[0 ].count = 1 ;
139
139
bindings[0 ].stageFlags = IShader::ESS_FRAGMENT;
140
- bindings[0 ].samplers = &m_fontSampler;
140
+ // bindings[0].samplers = &m_fontSampler;
141
141
};
142
142
return m_device->createDescriptorSetLayout (bindings, bindings + Count);
143
143
}
@@ -164,6 +164,7 @@ namespace nbl::ext::imgui
164
164
// Create Descriptor Set:
165
165
// Original number was 1 , Now it creates as many as swap_chain_image_count
166
166
m_gpuDescriptorSet = m_descriptorPool->createDescriptorSet (descriptorSetLayout);
167
+ assert (m_gpuDescriptorSet);
167
168
168
169
auto pipelineLayout = m_device->createPipelineLayout (
169
170
pushConstantRanges,
@@ -177,7 +178,7 @@ namespace nbl::ext::imgui
177
178
178
179
memcpy (vertCpuBuffer->getPointer (), vertexShaderSpv, vertCpuBuffer->getSize ()); // TODO: Can we avoid this copy ?
179
180
180
- smart_refctd_ptr<ICPUShader> cpuVertShader = make_smart_refctd_ptr<ICPUShader>(std::move (vertCpuBuffer), IShader::ESS_VERTEX, IShader::E_CONTENT_TYPE::ECT_GLSL , " " );
181
+ smart_refctd_ptr<ICPUShader> cpuVertShader = make_smart_refctd_ptr<ICPUShader>(std::move (vertCpuBuffer), IShader::ESS_VERTEX, IShader::E_CONTENT_TYPE::ECT_SPIRV , " " );
181
182
182
183
auto const unSpecVertexShader = m_device->createShader (std::move (cpuVertShader));
183
184
@@ -193,7 +194,7 @@ namespace nbl::ext::imgui
193
194
194
195
memcpy (cpuFragBuffer->getPointer (), fragmentShaderSpv, cpuFragBuffer->getSize ()); // TODO: Can we avoid this copy ?
195
196
196
- smart_refctd_ptr<ICPUShader> cpuFragShader = make_smart_refctd_ptr<ICPUShader>(std::move (cpuFragBuffer), IShader::ESS_FRAGMENT, IShader::E_CONTENT_TYPE::ECT_GLSL , " " );
197
+ smart_refctd_ptr<ICPUShader> cpuFragShader = make_smart_refctd_ptr<ICPUShader>(std::move (cpuFragBuffer), IShader::ESS_FRAGMENT, IShader::E_CONTENT_TYPE::ECT_SPIRV , " " );
197
198
198
199
auto const unSpecFragmentShader = m_device->createShader (std::move (cpuFragShader));
199
200
@@ -436,12 +437,13 @@ namespace nbl::ext::imgui
436
437
void UI::CreateDescriptorPool ()
437
438
{
438
439
static constexpr int TotalSetCount = 1 ;
439
- IDescriptorPool::SCreateInfo createInfo;
440
+ IDescriptorPool::SCreateInfo createInfo = {} ;
440
441
createInfo.maxDescriptorCount [static_cast <uint32_t >(asset::IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER)] = TotalSetCount;
441
442
createInfo.maxSets = 1 ;
442
443
createInfo.flags = IDescriptorPool::E_CREATE_FLAGS::ECF_NONE;
443
444
444
445
m_descriptorPool = m_device->createDescriptorPool (std::move (createInfo));
446
+ assert (m_descriptorPool);
445
447
}
446
448
447
449
// -------------------------------------------------------------------------------------------------
@@ -594,22 +596,15 @@ namespace nbl::ext::imgui
594
596
vertexBuffer = m_device->createBuffer (std::move (vertexCreationParams));
595
597
596
598
video::IDeviceMemoryBacked::SDeviceMemoryRequirements memReq = vertexBuffer->getMemoryReqs ();
597
- memReq.memoryTypeBits &= m_device->getPhysicalDevice ()->getDownStreamingMemoryTypeBits ();
599
+ memReq.memoryTypeBits &= m_device->getPhysicalDevice ()->getUpStreamingMemoryTypeBits ();
598
600
auto memOffset = m_device->allocate (memReq, vertexBuffer.get ());
599
601
assert (memOffset.isValid ());
600
- video::IDeviceMemoryAllocation::MappedMemoryRange range;
601
- {
602
- range.memory = vertexBuffer->getBoundMemory ();
603
- range.offset = 0u ;
604
- range.length = vertexSize;
605
- }
606
- m_device->mapMemory (range, video::IDeviceMemoryAllocation::EMCAF_READ);
607
- assert (vertexBuffer->getBoundMemory ()->isCurrentlyMapped ());
608
602
}
609
603
610
604
IGPUBuffer::SCreationParams indexCreationParams = {};
611
- vertexCreationParams.usage = nbl::core::bitflag (nbl::asset::IBuffer::EUF_VERTEX_BUFFER_BIT) | nbl::asset::IBuffer::EUF_INLINE_UPDATE_VIA_CMDBUF;
612
- vertexCreationParams.size = indexSize;
605
+ indexCreationParams.usage = nbl::core::bitflag (nbl::asset::IBuffer::EUF_VERTEX_BUFFER_BIT) | nbl::asset::IBuffer::EUF_INDEX_BUFFER_BIT
606
+ | nbl::asset::IBuffer::EUF_INLINE_UPDATE_VIA_CMDBUF;
607
+ indexCreationParams.size = indexSize;
613
608
614
609
auto & indexBuffer = m_indexBuffers[frameIndex];
615
610
@@ -618,20 +613,30 @@ namespace nbl::ext::imgui
618
613
indexBuffer = m_device->createBuffer (std::move (indexCreationParams));
619
614
620
615
video::IDeviceMemoryBacked::SDeviceMemoryRequirements memReq = indexBuffer->getMemoryReqs ();
621
- memReq.memoryTypeBits &= m_device->getPhysicalDevice ()->getDownStreamingMemoryTypeBits ();
616
+ memReq.memoryTypeBits &= m_device->getPhysicalDevice ()->getUpStreamingMemoryTypeBits ();
622
617
auto memOffset = m_device->allocate (memReq, indexBuffer.get ());
623
618
assert (memOffset.isValid ());
624
- video::IDeviceMemoryAllocation::MappedMemoryRange range;
619
+ }
620
+
621
+ {
625
622
{
623
+ video::IDeviceMemoryAllocation::MappedMemoryRange range;
624
+ range.memory = vertexBuffer->getBoundMemory ();
625
+ range.offset = 0u ;
626
+ range.length = vertexSize;
627
+ m_device->mapMemory (range, video::IDeviceMemoryAllocation::EMCAF_READ);
628
+ }
629
+ {
630
+ video::IDeviceMemoryAllocation::MappedMemoryRange range;
626
631
range.memory = indexBuffer->getBoundMemory ();
627
632
range.offset = 0u ;
628
633
range.length = indexSize;
634
+ m_device->mapMemory (range, video::IDeviceMemoryAllocation::EMCAF_READ);
629
635
}
630
- m_device-> mapMemory (range, video::IDeviceMemoryAllocation::EMCAF_READ);
636
+
631
637
assert (indexBuffer->getBoundMemory ()->isCurrentlyMapped ());
632
- }
638
+ assert (vertexBuffer-> getBoundMemory ()-> isCurrentlyMapped ());
633
639
634
- {
635
640
auto * vertex_ptr = static_cast <ImDrawVert*>(vertexBuffer->getBoundMemory ()->getMappedPointer ());
636
641
auto * index_ptr = static_cast <ImDrawIdx*>(indexBuffer->getBoundMemory ()->getMappedPointer ());
637
642
0 commit comments