Skip to content

Commit 7e086ca

Browse files
Merge branch 'user/kernel/fix-command-buffer-manager' of https://github.com/JeanPhilippeKernel/RendererEngine into user/kernel/fix-command-buffer-manager
2 parents 825a9b4 + 70f32aa commit 7e086ca

File tree

13 files changed

+79
-48
lines changed

13 files changed

+79
-48
lines changed

CMakePresets.json

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"BUILD_SHARED_LIBS": "OFF",
1717
"FETCHCONTENT_QUIET": "OFF",
1818

19+
"FMT_MODULE": "OFF",
1920
"VULKAN_HEADERS_ENABLE_INSTALL": "ON",
2021
"ENTT_INCLUDE_HEADERS": "ON",
2122

@@ -56,9 +57,9 @@
5657
}
5758
},
5859
{
59-
"name": "Windows_x64_Debug",
60+
"name": "Windows_x64_Debug_2022",
6061
"inherits": "BaseOptions",
61-
"displayName": "Windows Visual Studio Debug",
62+
"displayName": "Windows Visual Studio 2022 Debug",
6263
"generator": "Visual Studio 17 2022",
6364
"binaryDir": "Result.Windows.x64.MultiConfig",
6465
"architecture": "x64",
@@ -69,14 +70,28 @@
6970

7071
},
7172
{
72-
"name": "Windows_x64_Release",
73-
"displayName": "Windows Visual Studio Release",
74-
"inherits": "Windows_x64_Debug",
73+
"name": "Windows_x64_Release_2022",
74+
"displayName": "Windows Visual Studio 2022 Release",
75+
"inherits": "Windows_x64_Debug_2022",
7576
"cacheVariables": {
7677
"CMAKE_CONFIGURATION_TYPES": "Release"
7778
}
7879
},
7980

81+
{
82+
"name": "Windows_x64_Debug_2026",
83+
"inherits": "Windows_x64_Debug_2022",
84+
"displayName": "Windows Visual Studio 2026 Debug",
85+
"generator": "Visual Studio 18 2026"
86+
},
87+
88+
{
89+
"name": "Windows_x64_Release_2026",
90+
"inherits": "Windows_x64_Release_2022",
91+
"displayName": "Windows Visual Studio 2026 Release",
92+
"generator": "Visual Studio 18 2026"
93+
},
94+
8095
{
8196
"name": "Darwin_x64_Debug",
8297
"inherits": "BaseOptions",
@@ -146,22 +161,34 @@
146161

147162
"buildPresets": [
148163
{
149-
"name": "Windows_x64_Debug",
150-
"configurePreset": "Windows_x64_Debug",
164+
"name": "Windows_x64_Debug_2022",
165+
"configurePreset": "Windows_x64_Debug_2022",
151166
"configuration": "Debug",
152167
"nativeToolOptions": [
153168
"-nodeReuse:false"
154169
]
155170
},
156171
{
157-
"name": "Windows_x64_Release",
158-
"configurePreset": "Windows_x64_Release",
172+
"name": "Windows_x64_Release_2022",
173+
"configurePreset": "Windows_x64_Release_2022",
159174
"configuration": "Release",
160175
"nativeToolOptions": [
161176
"-nodeReuse:false"
162177
]
163178
},
164179

180+
{
181+
"name": "Windows_x64_Debug_2026",
182+
"inherits": "Windows_x64_Debug_2022",
183+
"configurePreset": "Windows_x64_Debug_2026"
184+
},
185+
186+
{
187+
"name": "Windows_x64_Release_2026",
188+
"inherits": "Windows_x64_Release_2022",
189+
"configurePreset": "Windows_x64_Release_2026"
190+
},
191+
165192
{
166193
"name": "Darwin_x64_Debug",
167194
"configuration": "Debug",

Resources/Shaders/imgui.frag

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#version 460 core
22
#extension GL_EXT_nonuniform_qualifier : require
3-
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : enable
43

54
layout(location = 0) out vec4 fColor;
65
layout(set = 0, binding = 0) uniform sampler2D _unused;
@@ -14,10 +13,7 @@ layout(location = 0) in struct
1413

1514
void main()
1615
{
17-
uint texId = uint(In.TexData.z);
18-
if (texId < 0xFFFFFFFFu)
19-
{
20-
vec4 texVal = texture(TextureArray[nonuniformEXT(texId)], In.TexData.xy);
21-
fColor = In.Color * texVal;
22-
}
23-
}
16+
uint texId = uint(floor(In.TexData.z + 0.5));
17+
vec4 texVal = texture(TextureArray[nonuniformEXT(texId)], In.TexData.xy);
18+
fColor = In.Color * texVal;
19+
}

Resources/Shaders/imgui.vert

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ layout(push_constant) uniform uPushConstant
88
vec2 uScale;
99
vec2 uTranslate;
1010
uint index;
11+
uint _padding;
1112
}
1213
pc;
1314

Scripts/BuildEngine.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ param (
4242
[bool] $VerifyFormatting = $False,
4343

4444
[Parameter(HelpMessage = "VS version use to build, default to 2022")]
45-
[ValidateSet(2022)]
45+
[ValidateSet('2022', '2026')]
4646
[int] $VsVersion = 2022,
4747

4848
[Parameter(HelpMessage = "Build Launcher only")]
@@ -121,6 +121,10 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
121121
# Define CMake Generator arguments
122122
$configName = $systemName, $architecture, $configuration -join "_"
123123

124+
if($IsWindows){
125+
$configName += '_'+$VsVersion
126+
}
127+
124128
$cMakeArguments = " --preset $configName $cMakeCacheVariableOverride"
125129

126130
# CMake Generation process
@@ -130,8 +134,9 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
130134
throw "cmake failed generation for '$cMakeArguments' with exit code '$cMakeProcess.ExitCode'"
131135
}
132136

137+
138+
if ($runBuild) {
133139
# CMake Build Process
134-
#
135140

136141
Write-Host "Building $systemName $architecture $configuration"
137142

@@ -166,6 +171,7 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
166171
if($installProcess.ExitCode -ne 0){
167172
throw "cmake failed to install to '$install_directory'"
168173
}
174+
}
169175
}
170176

171177

Tetragrama/Components/DockspaceUIComponent.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace Tetragrama::Components
4040
m_editor_serializer->Initialize(parent->Arena);
4141
m_asset_importer->Initialize(parent->Arena);
4242

43-
m_dockspace_node_flag = ImGuiDockNodeFlags_NoWindowMenuButton | ImGuiDockNodeFlags_PassthruCentralNode;
43+
m_dockspace_node_flag = ImGuiDockNodeFlags_NoWindowMenuButton | static_cast<decltype(ImGuiDockNodeFlags_NoWindowMenuButton)>(ImGuiDockNodeFlags_PassthruCentralNode);
4444
m_window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
4545

4646
auto app = reinterpret_cast<EditorPtr>(ParentLayer->CurrentApp);
@@ -211,7 +211,7 @@ namespace Tetragrama::Components
211211

212212
ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[0]);
213213
ImGui::SetCursorPos(ImVec2(10, ImGui::GetWindowSize().y - 30));
214-
ImGui::TextColored(s_asset_importer_report_msg_color, s_asset_importer_report_msg.c_str());
214+
ImGui::TextColored(s_asset_importer_report_msg_color, "%s", s_asset_importer_report_msg.c_str());
215215
ImGui::PopFont();
216216

217217
ImGui::EndPopup();
@@ -244,7 +244,7 @@ namespace Tetragrama::Components
244244

245245
ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[0]);
246246
ImGui::SetCursorPos(ImVec2(10, wind_size.y - 30));
247-
ImGui::TextColored(s_scene_serializer_log_color, s_scene_serializer_log);
247+
ImGui::TextColored(s_scene_serializer_log_color, "%s", s_scene_serializer_log);
248248
ImGui::PopFont();
249249

250250
ImGui::EndPopup();
@@ -385,7 +385,7 @@ namespace Tetragrama::Components
385385

386386
if (ImGui::BeginPopupModal(str_id, NULL, ImGuiWindowFlags_AlwaysAutoResize))
387387
{
388-
ImGui::Text(fmt::format("You have unsaved changes for your current scene : {}", current_scene->Name).c_str());
388+
ImGui::Text("%s", fmt::format("You have unsaved changes for your current scene : {}", current_scene->Name).c_str());
389389
ImGui::Separator();
390390

391391
if (ImGui::Button("Save", ImVec2(120, 0)))

Tetragrama/Messengers/Messenger.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ namespace Tetragrama::Messengers
141141
// catch (...)
142142
//{
143143
//}
144+
return {};
144145
}
145146

146147
template <typename TRecipient, typename TMessage>

ZEngine/ZEngine/Hardwares/VulkanDevice.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,11 @@ namespace ZEngine::Hardwares
187187
VkPhysicalDeviceDescriptorIndexingProperties indexing_properties = {};
188188
indexing_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES;
189189

190-
VkPhysicalDeviceProperties physical_device_properties;
191-
VkPhysicalDeviceProperties2 physical_device_properties2 = {};
192-
physical_device_properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
193-
physical_device_properties2.pNext = &indexing_properties;
190+
VkPhysicalDeviceProperties2 physical_device_properties = {};
191+
physical_device_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
192+
physical_device_properties.pNext = &indexing_properties;
194193

195-
vkGetPhysicalDeviceProperties(physical_device, &physical_device_properties);
196-
vkGetPhysicalDeviceProperties2(physical_device, &physical_device_properties2);
194+
vkGetPhysicalDeviceProperties2(physical_device, &physical_device_properties);
197195

198196
VkPhysicalDeviceDescriptorIndexingFeatures descriptor_indexing_features = {};
199197
descriptor_indexing_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES;
@@ -202,7 +200,7 @@ namespace ZEngine::Hardwares
202200
physical_device_feature.pNext = &descriptor_indexing_features;
203201
vkGetPhysicalDeviceFeatures2(physical_device, &physical_device_feature);
204202

205-
if (/*(physical_device_feature.geometryShader == VK_TRUE) && (physical_device_feature.samplerAnisotropy == VK_TRUE) && */ ((physical_device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) || (physical_device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU)))
203+
if (/*(physical_device_feature.geometryShader == VK_TRUE) && (physical_device_feature.samplerAnisotropy == VK_TRUE) && */ ((physical_device_properties.properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) || (physical_device_properties.properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU)))
206204
{
207205
PhysicalDevice = physical_device;
208206
PhysicalDeviceProperties = physical_device_properties;
@@ -304,16 +302,12 @@ namespace ZEngine::Hardwares
304302
device_create_info.pQueueCreateInfos = queue_create_info_collection.data();
305303
device_create_info.enabledExtensionCount = static_cast<uint32_t>(requested_device_extension_layer_name_collection.size());
306304
device_create_info.ppEnabledExtensionNames = (requested_device_extension_layer_name_collection.size() > 0) ? requested_device_extension_layer_name_collection.data() : nullptr;
307-
device_create_info.pEnabledFeatures = nullptr;
308305

309306
VkPhysicalDeviceDescriptorIndexingFeatures physical_device_descriptor_indexing_features = {};
310307
physical_device_descriptor_indexing_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES;
311308
VkPhysicalDeviceFeatures2 device_features_2 = {};
312309
device_features_2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
313-
device_features_2.features.drawIndirectFirstInstance = PhysicalDeviceFeature.features.drawIndirectFirstInstance;
314-
device_features_2.features.multiDrawIndirect = PhysicalDeviceFeature.features.multiDrawIndirect;
315-
device_features_2.features.samplerAnisotropy = PhysicalDeviceFeature.features.samplerAnisotropy;
316-
device_features_2.features.shaderInt64 = PhysicalDeviceFeature.features.shaderInt64;
310+
device_features_2.features = PhysicalDeviceFeature.features;
317311

318312
if (PhysicalDeviceSupportSampledImageBindless || PhysicalDeviceSupportStorageBufferBindless)
319313
{
@@ -696,22 +690,22 @@ namespace ZEngine::Hardwares
696690

697691
VKAPI_ATTR VkBool32 VKAPI_CALL VulkanDevice::__debugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void* pUserData)
698692
{
699-
if ((messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)
693+
if ((messageSeverity & static_cast<decltype(messageSeverity)>(VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)) == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)
700694
{
701695
ZENGINE_CORE_ERROR("{}", pCallbackData->pMessage)
702696
}
703697

704-
if ((messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) == VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT)
698+
if ((messageSeverity & static_cast<decltype(messageSeverity)>(VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT)) == VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT)
705699
{
706700
ZENGINE_CORE_WARN("{}", pCallbackData->pMessage)
707701
}
708702

709-
if ((messageSeverity & VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT) == VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT)
703+
if ((messageSeverity & static_cast<decltype(messageSeverity)>(VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT)) == VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT)
710704
{
711705
ZENGINE_CORE_WARN("{}", pCallbackData->pMessage)
712706
}
713707

714-
if ((messageSeverity & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) == VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT)
708+
if ((messageSeverity & static_cast<decltype(messageSeverity)>(VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT)) == VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT)
715709
{
716710
ZENGINE_CORE_WARN("{}", pCallbackData->pMessage)
717711
}
@@ -936,6 +930,8 @@ namespace ZEngine::Hardwares
936930
dst_access_mask = VK_ACCESS_INDIRECT_COMMAND_READ_BIT;
937931
dst_pipeline_stage = VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT;
938932
break;
933+
case UNKNOWN:
934+
break;
939935
}
940936

941937
VkBufferMemoryBarrier bufMemBarrier2 = {VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER};
@@ -999,7 +995,7 @@ namespace ZEngine::Hardwares
999995
sampler_create_info.addressModeV = VK_SAMPLER_ADDRESS_MODE_REPEAT;
1000996
sampler_create_info.addressModeW = VK_SAMPLER_ADDRESS_MODE_REPEAT;
1001997
sampler_create_info.anisotropyEnable = PhysicalDeviceFeature.features.samplerAnisotropy;
1002-
sampler_create_info.maxAnisotropy = PhysicalDeviceFeature.features.samplerAnisotropy ? PhysicalDeviceProperties.limits.maxSamplerAnisotropy : 1.0f;
998+
sampler_create_info.maxAnisotropy = PhysicalDeviceFeature.features.samplerAnisotropy ? PhysicalDeviceProperties.properties.limits.maxSamplerAnisotropy : 1.0f;
1003999
sampler_create_info.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
10041000
sampler_create_info.unnormalizedCoordinates = VK_FALSE;
10051001
sampler_create_info.compareEnable = VK_FALSE;
@@ -1237,6 +1233,8 @@ namespace ZEngine::Hardwares
12371233
vkFreeDescriptorSets(LogicalDevice, reinterpret_cast<VkDescriptorPool>(res_handle.Data1), 1, &ds);
12381234
break;
12391235
}
1236+
case DeviceResourceType::RESOURCE_COUNT:
1237+
break;
12401238
}
12411239

12421240
DirtyResources.Remove(handle);
@@ -2085,7 +2083,7 @@ namespace ZEngine::Hardwares
20852083

20862084
void Image2DBuffer::Dispose()
20872085
{
2088-
if (this && m_buffer_image)
2086+
if (m_buffer_image)
20892087
{
20902088
Device->EnqueueBufferImageForDeletion(m_buffer_image);
20912089
m_buffer_image = {};
@@ -2223,6 +2221,8 @@ namespace ZEngine::Hardwares
22232221
dst_access_mask = VK_ACCESS_INDIRECT_COMMAND_READ_BIT;
22242222
dst_pipeline_stage = VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT;
22252223
break;
2224+
case UNKNOWN:
2225+
break;
22262226
}
22272227

22282228
auto command_buffer_info = m_device->CommandBufferMgr->GetInstantCommandBuffer(Rendering::QueueType::GRAPHIC_QUEUE, (m_device->SwapchainPtr->CurrentFrame == nullptr ? 0u : m_device->SwapchainPtr->CurrentFrame->Index), 0, 2, true);

ZEngine/ZEngine/Hardwares/VulkanDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ namespace ZEngine::Hardwares
589589
VkSurfaceKHR Surface = VK_NULL_HANDLE;
590590
VkSurfaceFormatKHR SurfaceFormat = {};
591591
VkPresentModeKHR PresentMode = {};
592-
VkPhysicalDeviceProperties PhysicalDeviceProperties = {};
592+
VkPhysicalDeviceProperties2 PhysicalDeviceProperties = {};
593593
VkPhysicalDeviceDescriptorIndexingProperties PhysicalDeviceDescriptorIndexingProperties = {};
594594
VkDevice LogicalDevice = VK_NULL_HANDLE;
595595
VkPhysicalDevice PhysicalDevice = VK_NULL_HANDLE;

ZEngine/ZEngine/Helpers/HandleManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ namespace ZEngine::Helpers
1818
template <typename T>
1919
struct Handle
2020
{
21-
uint32_t Index = UINT32_MAX;
21+
uint64_t Index = UINT64_MAX;
2222

2323
bool Valid() const
2424
{
25-
return Index != UINT32_MAX;
25+
return Index != UINT64_MAX;
2626
}
2727

2828
operator bool() const

ZEngine/ZEngine/Rendering/Renderers/ImGUIRenderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace ZEngine::Rendering::Renderers
4444

4545
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
4646
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
47-
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
47+
// io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
4848

4949
auto& style = ImGui::GetStyle();
5050
style.WindowBorderSize = 0.f;

0 commit comments

Comments
 (0)