From dc99f1049e91b07c8f8cf7b51ec7507208ef9113 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Mon, 7 Oct 2024 01:00:14 -0700 Subject: [PATCH 1/2] Fix compilation on modern systems --- src/mandelbrot.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mandelbrot.cc b/src/mandelbrot.cc index fe3b0ed..4e4c643 100644 --- a/src/mandelbrot.cc +++ b/src/mandelbrot.cc @@ -82,7 +82,7 @@ class MandelbrotApp { for (const auto &layer_property : layer_props) { std::cerr << " " << layer_property.layerName << "\t\t" << layer_property.description << std::endl; - if (std::string(layer_property.layerName) == kValidationLayer) { + if (std::string{kValidationLayer} == layer_property.layerName) { enabled_layers_.push_back(kValidationLayer); } } @@ -95,7 +95,7 @@ class MandelbrotApp { << std::endl; for (const auto &extension_prop : extension_props) { std::cerr << " " << extension_prop.extensionName << std::endl; - if (std::string(extension_prop.extensionName) == kDebugReportExtension) { + if (std::string{kDebugReportExtension} == extension_prop.extensionName) { enabled_extensions_.push_back(kDebugReportExtension); } } @@ -264,7 +264,8 @@ class MandelbrotApp { auto pipeline_create_info = vk::ComputePipelineCreateInfo(); pipeline_create_info.setStage(shader_stage_create_info) .setLayout(*pipeline_layout_); - pipeline_ = device_->createComputePipelineUnique({}, pipeline_create_info); + pipeline_ = + device_->createComputePipelineUnique({}, pipeline_create_info).value; } void CreateCommandPool() { From 32378c8731691e4b7e1b53426a7e4d84e3c870c1 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Mon, 7 Oct 2024 16:57:27 -0700 Subject: [PATCH 2/2] Compile shader in the build directory --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a215aa3..5cf51ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,3 +10,16 @@ include_directories(${Vulkan_INCLUDE_DIR}) add_executable(mandelbrot src/mandelbrot.cc src/lodepng.cpp src/vulkan_ext.c) target_link_libraries(mandelbrot ${Vulkan_LIBRARY}) + +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/shaders) + +add_custom_target(shader + ALL + DEPENDS shaders/comp.spv +) + +add_custom_command( + OUTPUT shaders/comp.spv + COMMAND glslc ${CMAKE_SOURCE_DIR}/shaders/shader.comp -o shaders/comp.spv + MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/shaders/shader.comp +)