Skip to content

Commit 1e710bf

Browse files
committed
Minor warning fixes, cross platform extension fix
1 parent f1ebcc2 commit 1e710bf

7 files changed

Lines changed: 29 additions & 20 deletions

File tree

src/app/editor/editor.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,12 @@ static bool drawViewportWindow(
396396
if (!vkrt || !status || !runtime) return false;
397397

398398
ImGuiWindowClass viewportWindowClass = {0};
399-
viewportWindowClass.DockNodeFlagsOverrideSet = ImGuiDockNodeFlags_NoTabBar |
400-
ImGuiDockNodeFlags_NoUndocking |
401-
ImGuiDockNodeFlags_NoWindowMenuButton |
402-
ImGuiDockNodeFlags_NoCloseButton;
399+
viewportWindowClass.DockNodeFlagsOverrideSet = (ImGuiDockNodeFlags)(
400+
ImGuiDockNodeFlags_NoTabBar |
401+
ImGuiDockNodeFlags_NoUndocking |
402+
ImGuiDockNodeFlags_NoWindowMenuButton |
403+
ImGuiDockNodeFlags_NoCloseButton
404+
);
403405
ImGui_SetNextWindowClass(&viewportWindowClass);
404406

405407
ImGui_PushStyleVarImVec2(ImGuiStyleVar_WindowPadding, (ImVec2){0.0f, 0.0f});

src/app/editor/inspector/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void formatByteSize(uint64_t bytes, char* out, size_t outSize) {
9090
if (!out || outSize == 0) return;
9191

9292
static const char* symbols[] = {"B", "KB", "MB", "GB"};
93-
double _bytes = bytes;
93+
double _bytes = (double)bytes;
9494
int index;
9595

9696
for (index = 0; index < 3; index++) {

src/app/render/sequencer.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#define VKRT_MKDIR(path) mkdir(path, 0755)
2020
#endif
2121

22-
static const float kRenderSequenceMinStep = 0.0001f;
23-
static const float kRenderSequenceDefaultStep = 0.05f;
2422
static const float kMicrosecondsPerSecond = 1000000.0f;
2523
static const uint32_t kMinimumFramesForEta = 2u;
2624
enum {

src/core/api/lifecycle.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ static inline void logStepTime(const char* stepName, uint64_t startTime) {
2727
LOG_TRACE("%s in %.3f ms", stepName, (double)(getMicroseconds() - startTime) / 1e3);
2828
}
2929

30+
static inline uint32_t defaultWindowExtentFromDisplay(uint32_t displayExtent) {
31+
return displayExtent > 1u ? (uint32_t)(((uint64_t)displayExtent * 4u) / 5u) : 1u;
32+
}
33+
3034
static uint32_t g_glfwInitRefCount = 0u;
3135

3236
static VKRT_Result acquireGLFW(void) {
@@ -307,8 +311,8 @@ VKRT_Result VKRT_initWithCreateInfo(VKRT* vkrt, const VKRT_CreateInfo* createInf
307311

308312
uint32_t width = createInfo->startFullscreen ? displayWidth : createInfo->width;
309313
uint32_t height = createInfo->startFullscreen ? displayHeight : createInfo->height;
310-
if (width == 0) width = createInfo->startMaximized ? displayWidth : (displayWidth > 1u ? displayWidth * 0.8 : 1u);
311-
if (height == 0) height = createInfo->startMaximized ? displayHeight : (displayHeight > 1u ? displayHeight * 0.8 : 1u);
314+
if (width == 0) width = createInfo->startMaximized ? displayWidth : defaultWindowExtentFromDisplay(displayWidth);
315+
if (height == 0) height = createInfo->startMaximized ? displayHeight : defaultWindowExtentFromDisplay(displayHeight);
312316
if (width == 0) width = VKRT_DEFAULT_WIDTH;
313317
if (height == 0) height = VKRT_DEFAULT_HEIGHT;
314318
if (vkrt->runtime.headless) {

src/core/runtime/device.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const char* requiredDeviceExtensions[NUM_REQ_EXTENSIONS] = {
1818
};
1919

2020
const char* optionalDeviceExtensions[NUM_OPT_EXTENSIONS] = {
21-
VK_NV_RAY_TRACING_INVOCATION_REORDER_EXTENSION_NAME
21+
VK_EXT_RAY_TRACING_INVOCATION_REORDER_EXTENSION_NAME
2222
};
2323

2424
const uint32_t requiredDeviceExtensionBits[NUM_REQ_EXTENSIONS] = {
@@ -440,8 +440,8 @@ VKRT_Result createLogicalDevice(VKRT* vkrt) {
440440
deviceRayTracingPipelineFeatures.rayTracingPipelineTraceRaysIndirect = VK_FALSE;
441441
deviceRayTracingPipelineFeatures.rayTraversalPrimitiveCulling = VK_FALSE;
442442

443-
VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV supportedReorderFeatures = {0};
444-
supportedReorderFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV;
443+
VkPhysicalDeviceRayTracingInvocationReorderFeaturesEXT supportedReorderFeatures = {0};
444+
supportedReorderFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_EXT;
445445
if (extensionSupport.availableMask & DEVICE_EXTENSION_RAY_TRACING_INVOCATION_REORDER_BIT) {
446446
VkPhysicalDeviceRayTracingPipelineFeaturesKHR supportedRayTracingPipelineFeatures = {0};
447447
supportedRayTracingPipelineFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR;
@@ -452,8 +452,8 @@ VKRT_Result createLogicalDevice(VKRT* vkrt) {
452452
supportedFeatures.pNext = &supportedRayTracingPipelineFeatures;
453453
vkGetPhysicalDeviceFeatures2(vkrt->core.physicalDevice, &supportedFeatures);
454454

455-
VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV reorderProperties = {0};
456-
reorderProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_PROPERTIES_NV;
455+
VkPhysicalDeviceRayTracingInvocationReorderPropertiesEXT reorderProperties = {0};
456+
reorderProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_PROPERTIES_EXT;
457457

458458
VkPhysicalDeviceProperties2 supportedProperties = {0};
459459
supportedProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
@@ -464,8 +464,8 @@ VKRT_Result createLogicalDevice(VKRT* vkrt) {
464464
vkrt->core.serMaxShaderBindingTableRecordIndex = 0u;
465465
}
466466

467-
VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV deviceReorderFeatures = {0};
468-
deviceReorderFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV;
467+
VkPhysicalDeviceRayTracingInvocationReorderFeaturesEXT deviceReorderFeatures = {0};
468+
deviceReorderFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_EXT;
469469
deviceReorderFeatures.pNext = &deviceAccelerationStructureFeatures;
470470
deviceReorderFeatures.rayTracingInvocationReorder = VK_TRUE;
471471

@@ -546,15 +546,15 @@ VKRT_Result createLogicalDevice(VKRT* vkrt) {
546546
(extensionSupport.availableMask & DEVICE_EXTENSION_RAY_TRACING_INVOCATION_REORDER_BIT)) {
547547
LOG_INFO(
548548
" Optional extension %s was available but disabled by request",
549-
VK_NV_RAY_TRACING_INVOCATION_REORDER_EXTENSION_NAME
549+
VK_EXT_RAY_TRACING_INVOCATION_REORDER_EXTENSION_NAME
550550
);
551551
}
552552

553553
if ((extensionSupport.availableMask & DEVICE_EXTENSION_RAY_TRACING_INVOCATION_REORDER_BIT) &&
554554
!supportedReorderFeatures.rayTracingInvocationReorder) {
555555
LOG_INFO(
556556
" Optional extension %s was loaded but its feature is unsupported, so it was not enabled",
557-
VK_NV_RAY_TRACING_INVOCATION_REORDER_EXTENSION_NAME
557+
VK_EXT_RAY_TRACING_INVOCATION_REORDER_EXTENSION_NAME
558558
);
559559
}
560560

src/core/utility/io.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ static FILE* fopen_exe_relative(const char* relpath, const char* mode) {
101101
size_t dirlen = strlen(buf);
102102
snprintf(buf + dirlen, sizeof buf - dirlen, "/%s", relpath);
103103

104+
#if defined(_WIN32)
105+
FILE* file = NULL;
106+
return fopen_s(&file, buf, mode) == 0 ? file : NULL;
107+
#else
104108
return fopen(buf, mode);
109+
#endif
105110
}
106111

107112
static int pathExists(const char* path) {

src/shaders/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ foreach shader_program : shader_programs
3636
endif
3737

3838
if 'ser' in shader_features
39-
shader_capabilities += ['-capability', 'spvShaderInvocationReorderNV']
40-
shader_extra_args += ['-DVKRT_SER_ENABLED']
39+
shader_capabilities += ['-capability', 'spvShaderInvocationReorderEXT']
40+
shader_extra_args += ['-DVKRT_SER_ENABLED', '-warnings-disable', '41012']
4141
endif
4242

4343
shader_target = custom_target(

0 commit comments

Comments
 (0)