From bbccf7f0ba50e6171af5e0af46de40606bbeeebe Mon Sep 17 00:00:00 2001 From: Piotr Krygier Date: Fri, 12 Jun 2026 14:11:33 +0200 Subject: [PATCH] Add wrap dependency for vulkan headers Don't expect the vulkan headers to be present on the development system. Instead, download the using meson wrap. Signed-off-by: Piotr Krygier --- graphics/meson.build | 4 ++++ graphics/src/vulkan_base.c | 4 ++-- .../packagefiles/vulkan_headers/meson.build | 15 +++++++++++++++ subprojects/vulkan-headers.wrap | 15 +++++---------- subprojects/vulkan-validationlayers.wrap | 9 --------- utilities/src/file_utils.c | 2 +- 6 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 subprojects/packagefiles/vulkan_headers/meson.build delete mode 100644 subprojects/vulkan-validationlayers.wrap diff --git a/graphics/meson.build b/graphics/meson.build index 8ce2b7b0..cdfffd4d 100644 --- a/graphics/meson.build +++ b/graphics/meson.build @@ -15,6 +15,8 @@ rse_graphics_sources = [ 'src/window.c', ] +vulkan_headers_dep = dependency('VulkanHeaders') + vulkan_dep = dependency('Vulkan') sdl3_dep = dependency('sdl3', version: '>=3.4.0') @@ -32,6 +34,7 @@ rse_graphics_lib = shared_library( rse_graphics_sources, include_directories: ['../'], dependencies: [ + vulkan_headers_dep, vulkan_dep, vma_dep, sdl3_dep, @@ -46,6 +49,7 @@ rse_graphics_lib = shared_library( rse_graphics_lib_dep = declare_dependency( link_with: rse_graphics_lib, dependencies: [ + vulkan_headers_dep, vulkan_dep, vma_dep, glm_dep diff --git a/graphics/src/vulkan_base.c b/graphics/src/vulkan_base.c index e45bcb71..0caf0c77 100644 --- a/graphics/src/vulkan_base.c +++ b/graphics/src/vulkan_base.c @@ -211,14 +211,14 @@ static rse_err_t create_instance(VkInstance* instance) /* Check if selected layers are supported*/ for (i = 0; i < enabled_instance_layers_count; ++i) { - for (j = 0; i < layersCount; ++j) { + for (j = 0; j < layersCount; ++j) { if (strcmp(layer_properties[j].layerName, enabled_instance_layers_names[i]) == 0) { supported = 1; break; } } if (supported == 0) { - SDL_LogCritical(SDL_LOG_CATEGORY_GPU, "Selected layer is not supported: %s", layer_properties[j].layerName); + SDL_LogCritical(SDL_LOG_CATEGORY_GPU, "Selected layer is not supported: %s", enabled_instance_layers_names[i]); return RSE_ERROR_INTERNAL_ERROR; } supported = 0; diff --git a/subprojects/packagefiles/vulkan_headers/meson.build b/subprojects/packagefiles/vulkan_headers/meson.build new file mode 100644 index 00000000..2e563e4a --- /dev/null +++ b/subprojects/packagefiles/vulkan_headers/meson.build @@ -0,0 +1,15 @@ +project( + 'vulkan-headers', + 'c', + license: 'Apache-2.0', + version: '1.4.353', + meson_version: '>=0.56.0', +) + +vulkan_api_xml = files('registry/vk.xml') + +vulkan_headers_dep = declare_dependency( + include_directories: include_directories('include'), +) + +meson.override_dependency('VulkanHeaders', vulkan_headers_dep) \ No newline at end of file diff --git a/subprojects/vulkan-headers.wrap b/subprojects/vulkan-headers.wrap index 6b6944c3..990640c0 100644 --- a/subprojects/vulkan-headers.wrap +++ b/subprojects/vulkan-headers.wrap @@ -1,14 +1,9 @@ [wrap-file] -directory = Vulkan-Headers-1.4.346 -source_url = https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.4.346.tar.gz -source_filename = vulkan-headers-1.4.346.tar.gz -source_hash = 5bb77f5d7b460e255a9e51affc00d64354986b55cf577d8eab28529cad01fc80 -source_fallback_url = https://wrapdb.mesonbuild.com/v2/vulkan-headers_1.4.346-1/get_source/vulkan-headers-1.4.346.tar.gz -patch_filename = vulkan-headers_1.4.346-1_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/vulkan-headers_1.4.346-1/get_patch -patch_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/vulkan-headers_1.4.346-1/vulkan-headers_1.4.346-1_patch.zip -patch_hash = b85cbf6793193b28c5bd80858308b214816e66041b10ec00f0115b19f3a7a60e -wrapdb_version = 1.4.346-1 +directory = Vulkan-Headers-1.4.353 +source_url = https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.4.353.tar.gz +source_filename = vulkan-headers-1.4.353.tar.gz +source_hash = aead572dd86def896eddac84cb31acb4ede28e3ac1ab97439d6ddd1b5a14d38e +patch_directory = vulkan_headers/ [provide] dependency_names = VulkanHeaders diff --git a/subprojects/vulkan-validationlayers.wrap b/subprojects/vulkan-validationlayers.wrap deleted file mode 100644 index d7d2afc0..00000000 --- a/subprojects/vulkan-validationlayers.wrap +++ /dev/null @@ -1,9 +0,0 @@ -[wrap-file] -directory = Vulkan-ValidationLayers-1.2.158 -source_url = https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/v1.2.158.tar.gz -source_filename = vulkan-validationlayers-1.2.158.tar.gz -source_hash = 9d7a6eba2db88b8af6457acce0b638324ca03cde2e9589ae96749114091c6e9e -patch_url = https://wrapdb.mesonbuild.com/v2/vulkan-validationlayers_1.2.158-2/get_patch -patch_filename = vulkan-validationlayers-1.2.158-2-wrap.zip -patch_hash = d38dae45ca6a7124ee8df045a8d5288390ab836b4d28c53234f90baee5c649fc - diff --git a/utilities/src/file_utils.c b/utilities/src/file_utils.c index 5b6a8681..6f180edf 100644 --- a/utilities/src/file_utils.c +++ b/utilities/src/file_utils.c @@ -132,7 +132,7 @@ rse_err_t file_read_bytes(const char* file_name, size_t* bytes_count, unsigned c SDL_LogCritical(SDL_LOG_CATEGORY_APPLICATION, "Failed to open file for read: %s", real_path); ret = RSE_ERROR_INTERNAL_ERROR; - goto file_close; + return ret; } fseek(file, 0, SEEK_END);