From 495a135c649a4fb18252fafca325ea7f7c561416 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Wed, 19 Feb 2025 07:05:43 +0100 Subject: [PATCH 1/7] Update to latest MacOS image (#1188) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f68ba80c..ebb9866c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,7 +48,7 @@ jobs: build_macOS: name: Build macOS - runs-on: macos-13 + runs-on: macos-latest steps: - uses: actions/checkout@v4 with: From 42fc44114a5ad62a5c99ddfd9b60164096fd3c34 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Fri, 28 Feb 2025 18:02:15 +0100 Subject: [PATCH 2/7] Android changes (#1194) * Update to latest MacOS image * Minor android cleanup Removed no longer required std functionality --- base/VulkanAndroid.cpp | 3 +-- base/VulkanAndroid.h | 12 +----------- .../dynamicrenderingmultisampling.cpp | 11 +++++------ examples/triangle/triangle.cpp | 16 ++++++++-------- examples/trianglevulkan13/trianglevulkan13.cpp | 10 +++++----- 5 files changed, 20 insertions(+), 32 deletions(-) diff --git a/base/VulkanAndroid.cpp b/base/VulkanAndroid.cpp index 0a5470e7..43d8c1c7 100644 --- a/base/VulkanAndroid.cpp +++ b/base/VulkanAndroid.cpp @@ -1,7 +1,7 @@ /* * Android Vulkan function pointer loader * -* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de +* Copyright (C) 2016-2025 by Sascha Willems - www.saschawillems.de * * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) */ @@ -359,7 +359,6 @@ namespace vks jni->DeleteLocalRef(jmessage); androidApp->activity->vm->DetachCurrentThread(); - return; } } } diff --git a/base/VulkanAndroid.h b/base/VulkanAndroid.h index 9db7e82b..f3201bde 100644 --- a/base/VulkanAndroid.h +++ b/base/VulkanAndroid.h @@ -1,7 +1,7 @@ /* * Android Vulkan function pointer prototypes * -* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de +* Copyright (C) 2016-2025 by Sascha Willems - www.saschawillems.de * * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) */ @@ -29,16 +29,6 @@ #include #include -// Missing from the NDK -namespace std -{ - template - std::unique_ptr make_unique(Args&&... args) - { - return std::unique_ptr(new T(std::forward(args)...)); - } -} - // Global reference to android application object extern android_app* androidApp; diff --git a/examples/dynamicrenderingmultisampling/dynamicrenderingmultisampling.cpp b/examples/dynamicrenderingmultisampling/dynamicrenderingmultisampling.cpp index b9837eae..3b904335 100644 --- a/examples/dynamicrenderingmultisampling/dynamicrenderingmultisampling.cpp +++ b/examples/dynamicrenderingmultisampling/dynamicrenderingmultisampling.cpp @@ -40,7 +40,6 @@ public: VkDeviceMemory memory{ VK_NULL_HANDLE }; }; Image renderImage; - Image depthStencilRenderImage; VulkanExample() : VulkanExampleBase() { @@ -67,7 +66,7 @@ public: deviceCreatepNextChain = &enabledDynamicRenderingFeaturesKHR; } - ~VulkanExample() + ~VulkanExample() override { if (device) { vkDestroyPipeline(device, pipeline, nullptr); @@ -160,7 +159,7 @@ public: } // Enable physical device features required for this example - virtual void getEnabledFeatures() + void getEnabledFeatures() override { // Enable anisotropic filtering if supported if (deviceFeatures.samplerAnisotropy) { @@ -174,7 +173,7 @@ public: model.loadFromFile(getAssetPath() + "models/voyager.gltf", vulkanDevice, queue, glTFLoadingFlags); } - void buildCommandBuffers() + void buildCommandBuffers() override { VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo(); @@ -365,7 +364,7 @@ public: memcpy(uniformBuffer.mapped, &uniformData, sizeof(uniformData)); } - void prepare() + void prepare() override { VulkanExampleBase::prepare(); @@ -390,7 +389,7 @@ public: VulkanExampleBase::submitFrame(); } - virtual void render() + void render() override { if (!prepared) return; diff --git a/examples/triangle/triangle.cpp b/examples/triangle/triangle.cpp index 21c4954f..e7619c82 100644 --- a/examples/triangle/triangle.cpp +++ b/examples/triangle/triangle.cpp @@ -6,7 +6,7 @@ * Contrary to the other examples, this one won't make use of helper functions or initializers * Except in a few cases (swap chain setup e.g.) * -* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de +* Copyright (C) 2016-2025 by Sascha Willems - www.saschawillems.de * * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) */ @@ -126,7 +126,7 @@ public: // Values not set here are initialized in the base class constructor } - ~VulkanExample() + ~VulkanExample() override { // Clean up used Vulkan resources // Note: Inherited destructor cleans up resources stored in base class @@ -452,7 +452,7 @@ public: // Create the depth (and stencil) buffer attachments used by our framebuffers // Note: Override of virtual function in the base class and called from within VulkanExampleBase::prepare - void setupDepthStencil() + void setupDepthStencil() override { // Create an optimal image used as the depth stencil attachment VkImageCreateInfo imageCI{}; @@ -502,7 +502,7 @@ public: // Create a frame buffer for each swap chain image // Note: Override of virtual function in the base class and called from within VulkanExampleBase::prepare - void setupFrameBuffer() + void setupFrameBuffer() override { // Create a frame buffer for every image in the swapchain frameBuffers.resize(swapChain.images.size()); @@ -533,7 +533,7 @@ public: // This allows the driver to know up-front what the rendering will look like and is a good opportunity to optimize especially on tile-based renderers (with multiple subpasses) // Using sub pass dependencies also adds implicit layout transitions for the attachment used, so we don't need to add explicit image memory barriers to transform them // Note: Override of virtual function in the base class and called from within VulkanExampleBase::prepare - void setupRenderPass() + void setupRenderPass() override { // This example will use a single render pass with one subpass @@ -622,7 +622,7 @@ public: // Vulkan loads its shaders from an immediate binary representation called SPIR-V // Shaders are compiled offline from e.g. GLSL using the reference glslang compiler // This function loads such a shader from a binary file and returns a shader module structure - VkShaderModule loadSPIRVShader(std::string filename) + VkShaderModule loadSPIRVShader(const std::string& filename) { size_t shaderSize; char* shaderCode{ nullptr }; @@ -886,7 +886,7 @@ public: } - void prepare() + void prepare() override { VulkanExampleBase::prepare(); createSynchronizationPrimitives(); @@ -900,7 +900,7 @@ public: prepared = true; } - virtual void render() + void render() override { if (!prepared) return; diff --git a/examples/trianglevulkan13/trianglevulkan13.cpp b/examples/trianglevulkan13/trianglevulkan13.cpp index 78824c60..462462de 100644 --- a/examples/trianglevulkan13/trianglevulkan13.cpp +++ b/examples/trianglevulkan13/trianglevulkan13.cpp @@ -117,7 +117,7 @@ public: deviceCreatepNextChain = &enabledFeatures; } - ~VulkanExample() + ~VulkanExample() override { // Clean up used Vulkan resources // Note: Inherited destructor cleans up resources stored in base class @@ -381,7 +381,7 @@ public: // Create the depth (and stencil) buffer attachments // While we don't do any depth testing in this sample, having depth testing is very common so it's a good idea to learn it from the very start - void setupDepthStencil() + void setupDepthStencil() override { // Create an optimal tiled image used as the depth stencil attachment VkImageCreateInfo imageCI{ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO }; @@ -428,7 +428,7 @@ public: // Vulkan loads its shaders from an immediate binary representation called SPIR-V // Shaders are compiled offline from e.g. GLSL using the reference glslang compiler // This function loads such a shader from a binary file and returns a shader module structure - VkShaderModule loadSPIRVShader(std::string filename) + VkShaderModule loadSPIRVShader(const std::string& filename) { size_t shaderSize; char* shaderCode{ nullptr }; @@ -661,7 +661,7 @@ public: } - void prepare() + void prepare() override { VulkanExampleBase::prepare(); createSynchronizationPrimitives(); @@ -673,7 +673,7 @@ public: prepared = true; } - virtual void render() override + void render() override { // Use a fence to wait until the command buffer has finished execution before using it again vkWaitForFences(device, 1, &waitFences[currentFrame], VK_TRUE, UINT64_MAX); From 1fd45647d7d4fc5be6363590ec4446f45c804361 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Fri, 28 Feb 2025 18:18:49 +0100 Subject: [PATCH 3/7] Code cleanup Mostly android related --- base/vulkanexamplebase.cpp | 32 +++++++++++++------------------- base/vulkanexamplebase.h | 14 +++++++------- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index 72928549..c45b928e 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -76,7 +76,7 @@ VkResult VulkanExampleBase::createInstance() #endif // Enabled requested instance extensions - if (enabledInstanceExtensions.size() > 0) + if (!enabledInstanceExtensions.empty()) { for (const char * enabledExtension : enabledInstanceExtensions) { @@ -120,7 +120,7 @@ VkResult VulkanExampleBase::createInstance() instanceExtensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); } - if (instanceExtensions.size() > 0) { + if (!instanceExtensions.empty()) { instanceCreateInfo.enabledExtensionCount = (uint32_t)instanceExtensions.size(); instanceCreateInfo.ppEnabledExtensionNames = instanceExtensions.data(); } @@ -316,7 +316,7 @@ void VulkanExampleBase::renderLoop() benchmark.run([=] { render(); }, vulkanDevice->properties); vkDeviceWaitIdle(device); - if (benchmark.filename != "") { + if (!benchmark.filename.empty()) { benchmark.saveResults(); } return; @@ -344,7 +344,7 @@ void VulkanExampleBase::renderLoop() } } #elif defined(VK_USE_PLATFORM_ANDROID_KHR) - while (1) + while (true) { int ident; int events; @@ -353,9 +353,9 @@ void VulkanExampleBase::renderLoop() focused = true; - while ((ident = ALooper_pollOnce(focused ? 0 : -1, NULL, &events, (void**)&source)) > ALOOPER_POLL_TIMEOUT) + while ((ident = ALooper_pollOnce(focused ? 0 : -1, nullptr, &events, (void**)&source)) > ALOOPER_POLL_TIMEOUT) { - if (source != NULL) + if (source != nullptr) { source->process(androidApp, source); } @@ -404,8 +404,6 @@ void VulkanExampleBase::renderLoop() updateOverlay(); - bool updateView = false; - // Check touch state (for movement) if (touchDown) { touchTimer += frameTimer; @@ -422,23 +420,20 @@ void VulkanExampleBase::renderLoop() if (std::abs(gamePadState.axisLeft.x) > deadZone) { camera.rotate(glm::vec3(0.0f, gamePadState.axisLeft.x * 0.5f, 0.0f)); - updateView = true; } if (std::abs(gamePadState.axisLeft.y) > deadZone) { camera.rotate(glm::vec3(gamePadState.axisLeft.y * 0.5f, 0.0f, 0.0f)); - updateView = true; } // Zoom if (std::abs(gamePadState.axisRight.y) > deadZone) { camera.translate(glm::vec3(0.0f, 0.0f, gamePadState.axisRight.y * 0.01f)); - updateView = true; } } else { - updateView = camera.updatePad(gamePadState.axisLeft, gamePadState.axisRight, frameTimer); + camera.updatePad(gamePadState.axisLeft, gamePadState.axisRight, frameTimer); } } } @@ -915,9 +910,9 @@ VulkanExampleBase::~VulkanExampleBase() { vkDestroyRenderPass(device, renderPass, nullptr); } - for (uint32_t i = 0; i < frameBuffers.size(); i++) + for (auto& frameBuffer : frameBuffers) { - vkDestroyFramebuffer(device, frameBuffers[i], nullptr); + vkDestroyFramebuffer(device, frameBuffer, nullptr); } for (auto& shaderModule : shaderModules) @@ -1509,7 +1504,6 @@ int32_t VulkanExampleBase::handleAppInput(struct android_app* app, AInputEvent* { int32_t keyCode = AKeyEvent_getKeyCode((const AInputEvent*)event); int32_t action = AKeyEvent_getAction((const AInputEvent*)event); - int32_t button = 0; if (action == AKEY_EVENT_ACTION_UP) return 0; @@ -1554,7 +1548,7 @@ int32_t VulkanExampleBase::handleAppInput(struct android_app* app, AInputEvent* void VulkanExampleBase::handleAppCommand(android_app * app, int32_t cmd) { - assert(app->userData != NULL); + assert(app->userData != nullptr); VulkanExampleBase* vulkanExample = reinterpret_cast(app->userData); switch (cmd) { @@ -1568,7 +1562,7 @@ void VulkanExampleBase::handleAppCommand(android_app * app, int32_t cmd) break; case APP_CMD_INIT_WINDOW: LOGD("APP_CMD_INIT_WINDOW"); - if (androidApp->window != NULL) + if (androidApp->window != nullptr) { if (vulkanExample->initVulkan()) { vulkanExample->prepare(); @@ -3195,8 +3189,8 @@ void VulkanExampleBase::windowResize() vkDestroyImage(device, depthStencil.image, nullptr); vkFreeMemory(device, depthStencil.memory, nullptr); setupDepthStencil(); - for (uint32_t i = 0; i < frameBuffers.size(); i++) { - vkDestroyFramebuffer(device, frameBuffers[i], nullptr); + for (auto& frameBuffer : frameBuffers) { + vkDestroyFramebuffer(device, frameBuffer, nullptr); } setupFrameBuffer(); diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index 520637c5..2a983f28 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -77,8 +77,8 @@ class VulkanExampleBase { private: std::string getWindowTitle() const; - uint32_t destWidth; - uint32_t destHeight; + uint32_t destWidth{}; + uint32_t destHeight{}; bool resizing = false; void handleMouseMove(int32_t x, int32_t y); void nextFrame(); @@ -122,13 +122,13 @@ protected: // Handle to the device graphics queue that command buffers are submitted to VkQueue queue{ VK_NULL_HANDLE }; // Depth buffer format (selected during Vulkan initialization) - VkFormat depthFormat; + VkFormat depthFormat{VK_FORMAT_UNDEFINED}; // Command buffer pool VkCommandPool cmdPool{ VK_NULL_HANDLE }; /** @brief Pipeline stages used to wait at for graphics queue submissions */ VkPipelineStageFlags submitPipelineStages = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; // Contains command buffers and semaphores to be presented to the queue - VkSubmitInfo submitInfo; + VkSubmitInfo submitInfo{}; // Command buffers used for rendering std::vector drawCmdBuffers; // Global render pass for frame buffer writes @@ -151,7 +151,7 @@ protected: VkSemaphore presentComplete; // Command buffer submission and execution VkSemaphore renderComplete; - } semaphores; + } semaphores{}; std::vector waitFences; bool requiresStencil{ false }; public: @@ -170,7 +170,7 @@ public: vks::Benchmark benchmark; /** @brief Encapsulated physical and logical vulkan device */ - vks::VulkanDevice *vulkanDevice; + vks::VulkanDevice *vulkanDevice{}; /** @brief Example settings that can be changed e.g. by command line arguments */ struct Settings { @@ -234,7 +234,7 @@ public: struct TouchPos { int32_t x; int32_t y; - } touchPos; + } touchPos{}; bool touchDown = false; double touchTimer = 0.0; int64_t lastTapTime = 0; From d68ec09f22a838cefd242794122ac2b945987bac Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sat, 1 Mar 2025 17:27:24 +0100 Subject: [PATCH 4/7] Fi UI scaling on Android Was always using smallest scaling factor due to wrong code ordering --- base/Entrypoints.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base/Entrypoints.h b/base/Entrypoints.h index bd283810..7bbefcf2 100644 --- a/base/Entrypoints.h +++ b/base/Entrypoints.h @@ -3,7 +3,7 @@ * * Platform specific macros for the example main entry points * - * Copyright (C) 2024 by Sascha Willems - www.saschawillems.de + * Copyright (C) 2024-2025 by Sascha Willems - www.saschawillems.de * * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) */ @@ -42,12 +42,12 @@ int APIENTRY WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance VulkanExample *vulkanExample; \ void android_main(android_app* state) \ { \ + androidApp = state; \ + vks::android::getDeviceConfig(); \ vulkanExample = new VulkanExample(); \ state->userData = vulkanExample; \ state->onAppCmd = VulkanExample::handleAppCommand; \ state->onInputEvent = VulkanExample::handleAppInput; \ - androidApp = state; \ - vks::android::getDeviceConfig(); \ vulkanExample->renderLoop(); \ delete(vulkanExample); \ } From 02ed0eebb3f8803d9b99f05782d15eb877d0fdef Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sat, 1 Mar 2025 18:00:58 +0100 Subject: [PATCH 5/7] Add missing asset to host image copy sample Minor code cleanup --- android/examples/hostimagecopy/build.gradle | 5 +++++ examples/hostimagecopy/hostimagecopy.cpp | 23 ++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/android/examples/hostimagecopy/build.gradle b/android/examples/hostimagecopy/build.gradle index c4d9487e..e59aba39 100644 --- a/android/examples/hostimagecopy/build.gradle +++ b/android/examples/hostimagecopy/build.gradle @@ -60,6 +60,11 @@ task copyTask { include 'metalplate01_rgba.ktx' } + copy { + from rootProject.ext.assetPath + 'models' + into 'assets/models' + include 'plane_z.gltf' + } } diff --git a/examples/hostimagecopy/hostimagecopy.cpp b/examples/hostimagecopy/hostimagecopy.cpp index 2dd96c34..a2dfffda 100644 --- a/examples/hostimagecopy/hostimagecopy.cpp +++ b/examples/hostimagecopy/hostimagecopy.cpp @@ -70,7 +70,7 @@ public: deviceCreatepNextChain = &enabledPhysicalDeviceHostImageCopyFeaturesEXT; } - ~VulkanExample() + ~VulkanExample() override { if (device) { destroyTextureImage(texture); @@ -82,7 +82,7 @@ public: } // Enable physical device features required for this example - virtual void getEnabledFeatures() + void getEnabledFeatures() override { // Enable anisotropic filtering if supported if (deviceFeatures.samplerAnisotropy) { @@ -134,7 +134,6 @@ public: texture.height = ktxTexture->baseHeight; texture.mipLevels = ktxTexture->numLevels; ktx_uint8_t *ktxTextureData = ktxTexture_GetData(ktxTexture); - ktx_size_t ktxTextureSize = ktxTexture_GetSize(ktxTexture); const VkFormat imageFormat = VK_FORMAT_R8G8B8A8_UNORM; @@ -271,7 +270,7 @@ public: vkFreeMemory(device, texture.deviceMemory, nullptr); } - void buildCommandBuffers() + void buildCommandBuffers() override { VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo(); @@ -371,11 +370,11 @@ public: VkPipelineMultisampleStateCreateInfo multisampleState = vks::initializers::pipelineMultisampleStateCreateInfo(VK_SAMPLE_COUNT_1_BIT, 0); std::vector dynamicStateEnables = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR }; VkPipelineDynamicStateCreateInfo dynamicState = vks::initializers::pipelineDynamicStateCreateInfo(dynamicStateEnables); - std::array shaderStages; - - // Shaders - shaderStages[0] = loadShader(getShadersPath() + "texture/texture.vert.spv", VK_SHADER_STAGE_VERTEX_BIT); - shaderStages[1] = loadShader(getShadersPath() + "texture/texture.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT); + // Shaders + std::array shaderStages = { + loadShader(getShadersPath() + "texture/texture.vert.spv", VK_SHADER_STAGE_VERTEX_BIT), + loadShader(getShadersPath() + "texture/texture.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT) + }; VkGraphicsPipelineCreateInfo pipelineCreateInfo = vks::initializers::pipelineCreateInfo(pipelineLayout, renderPass, 0); pipelineCreateInfo.pInputAssemblyState = &inputAssemblyState; @@ -413,7 +412,7 @@ public: plane.loadFromFile(getAssetPath() + "models/plane_z.gltf", vulkanDevice, queue, glTFLoadingFlags); } - void prepare() + void prepare() override { VulkanExampleBase::prepare(); @@ -440,7 +439,7 @@ public: VulkanExampleBase::submitFrame(); } - virtual void render() + void render() override { if (!prepared) return; @@ -448,7 +447,7 @@ public: draw(); } - virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay) + void OnUpdateUIOverlay(vks::UIOverlay *overlay) override { if (overlay->header("Settings")) { if (overlay->sliderFloat("LOD bias", &uniformData.lodBias, 0.0f, (float)texture.mipLevels)) { From d14be3b7878281469b28eac293c4e03e5c81459a Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Sun, 9 Mar 2025 07:48:00 -0400 Subject: [PATCH 6/7] Fix a few compiler warnings and startup/validation issues at runtime (#1193) * Add error recovery to trianglevulkan13 and fix missing "override" compiler warnings * Look for vkGetPhysicalDeviceFormatProperties2KHR in hostimagecopy example * Enable fragmentStoresAndAtomics feature to avoid VVL warning in subpasses example --- examples/hostimagecopy/hostimagecopy.cpp | 2 +- examples/subpasses/subpasses.cpp | 2 ++ examples/trianglevulkan13/trianglevulkan13.cpp | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/hostimagecopy/hostimagecopy.cpp b/examples/hostimagecopy/hostimagecopy.cpp index a2dfffda..cad565c5 100644 --- a/examples/hostimagecopy/hostimagecopy.cpp +++ b/examples/hostimagecopy/hostimagecopy.cpp @@ -419,7 +419,7 @@ public: // Get the function pointers required host image copies vkCopyMemoryToImageEXT = reinterpret_cast(vkGetDeviceProcAddr(device, "vkCopyMemoryToImageEXT")); vkTransitionImageLayoutEXT = reinterpret_cast(vkGetDeviceProcAddr(device, "vkTransitionImageLayoutEXT")); - vkGetPhysicalDeviceFormatProperties2 = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2")); + vkGetPhysicalDeviceFormatProperties2 = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2KHR")); loadAssets(); loadTexture(); diff --git a/examples/subpasses/subpasses.cpp b/examples/subpasses/subpasses.cpp index 72ab1109..e28d32d9 100644 --- a/examples/subpasses/subpasses.cpp +++ b/examples/subpasses/subpasses.cpp @@ -99,6 +99,8 @@ public: camera.setRotation(glm::vec3(0.5f, 210.05f, 0.0f)); camera.setPerspective(60.0f, (float)width / (float)height, 0.1f, 256.0f); ui.subpass = 2; + + enabledFeatures.fragmentStoresAndAtomics = VK_TRUE; } ~VulkanExample() diff --git a/examples/trianglevulkan13/trianglevulkan13.cpp b/examples/trianglevulkan13/trianglevulkan13.cpp index 462462de..6fa0a5bc 100644 --- a/examples/trianglevulkan13/trianglevulkan13.cpp +++ b/examples/trianglevulkan13/trianglevulkan13.cpp @@ -140,6 +140,14 @@ public: } } + virtual void getEnabledFeatures() override + { + // Vulkan 1.3 device support is required for this example + if (deviceProperties.apiVersion < VK_API_VERSION_1_3) { + vks::tools::exitFatal("Selected GPU does not support support Vulkan 1.3", VK_ERROR_INCOMPATIBLE_DRIVER); + } + } + // This function is used to request a device memory type that supports all the property flags we request (e.g. device local, host visible) // Upon success it will return the index of the memory type that fits our requested memory properties // This is necessary as implementations can offer an arbitrary number of memory types with different memory properties From e1c962289f33a87beff4f6d14e4c885483c3bd57 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Thu, 13 Mar 2025 18:07:31 +0100 Subject: [PATCH 7/7] Recompile shaders for mesh shading sample with updated shader compilers Fixes validation errors with GLSL and HLSL Fixes triangles not displaying with HLSL Fixes #1196 --- shaders/glsl/meshshader/meshshader.mesh.spv | Bin 3016 -> 3016 bytes shaders/hlsl/meshshader/meshshader.frag.spv | Bin 368 -> 368 bytes shaders/hlsl/meshshader/meshshader.mesh.spv | Bin 2700 -> 2192 bytes shaders/hlsl/meshshader/meshshader.task.spv | Bin 576 -> 448 bytes 4 files changed, 0 insertions(+), 0 deletions(-) diff --git a/shaders/glsl/meshshader/meshshader.mesh.spv b/shaders/glsl/meshshader/meshshader.mesh.spv index b95fc1c9f57912661aad3c28376b1c60fdb7b036..d9dcb786c3ec88981e584ba31655131273f45533 100644 GIT binary patch delta 114 zcmX>henOm+nMs+QfrXKQdm|@1Gp9QPGlM(>0|V1!US|2p4$NGWm6$~)dofE%vI9j0 zfY^h96|900$W{hohsm`-l^d8jCQksWyuvIn`3SQRJ2Qg;P>yNxL+0?!E-WF;jMAHD Ivg@+|0KB~uMF0Q* delta 124 zcmX>henOm+nMs+QfrXKQYa=H+^JE!jnaMuPT>PvI@(d8b4x|Jo2QtgEDg#*#lM|UG zC-*T+P2R)IA?v{aQO5+70jmSj?hMRey-brYGK)?=#>_YQ19J$g0Z@i%vn@+BGo#ez Ine6&306|6)+W-In diff --git a/shaders/hlsl/meshshader/meshshader.frag.spv b/shaders/hlsl/meshshader/meshshader.frag.spv index 93ce5e695fd5d9a5f11517d4cffdfc5c8129af99..6c5341846afea4300869c5138cfd52f5007f3399 100644 GIT binary patch delta 15 Wcmeys^nrv)A5p@s=uals&3sbH21AaElnwB zFhBU`ynX?z^*(Vxk-t^wi|^(t18<&IQ8}R{v#Dz;62BV#(d9{et(mTGZoc}m@@#RY z%57VTGRAXftIsR1kYTfrrJ2fGL{`f_YITcg4fRx*dK-98&L@br zKcBvuNcA>n*ajx38*!c&G0w%ja)Yfg&$#+LdophsL@jNNdDm%S*r<>l(YAxE`c4cHZ6j4r&W@=kL~?D-qR;^bFs37u+2% z-@EDGi);d(r+;6rd#3*VNPEyOKag|lY@zZ&WDgOCkm|-9MtYv-$d4esLl5Xc>(A{+ zk=Bm5ft-7nA@aPt-=Mj2@2cLE^SGNe^m{kwQqTRS<=*2M(tGs*XRPF>BimQ^()|nj z33PYP-ExNpnYI0SwvYY(;x;Fdo^5S^r>q~`-!l0nZlLa2>c&}rm^^zu1?+2-J2|V< zz`or_VVtu&1N24QAbP~Ps}Xk=U0=kVtBZ4oBknx9zK`@~{R=>w`C%K%?Vf#)ICu0S z@XkJS+|BQQ7-+vs$G*=?Aig<$>R&qw+1|NZzv*}c=?s-Cq<)`2aQ$-a)>R)R*L}PSd9e4ldT;;b9!zT+~8vu>hmj~cho-OVzvhTNECtj@vS%b;;q_EtYf>-pW>1_j{0 NSWjL8f7#e`;2%@0bVdLG literal 2700 zcmZ9N`*KrN6o*fnCU}J+EudgciZ`T26f7umDHK~2O@UJJT0@(e#-S#Yq^SSZH*g%s z7w`dOd;y*cN1buT?>pIR=9tr2S?jm%d+ke0`|x^%ukv=Y{jG*^NRJ7q3{{{>e)ZW8$%7{G zRQ`h;lSC*#2N@su*Ob46)_lKEpv>PM(VwNpY*Y#NIC?s~q;s?xE?0$*;#Ljvq zM?>uTXGd@?;bpv?qu;S1%ZfVpY7$x|Z}?d+d|Z!lmqv7>arzbGT$6FTP~=iK8mBJe zwE0D!OH4wYJ_nJXhF75zL@4it`~vUG(eA^*u8R&XPUG+Su0r;yUHlB>7x)0OwE{E# z+~4?VL zdAK_9Oxjy@K{IJ)?qwA(&xtji<5BPnIUn|_y$bgHs2A7ZW03vmKbvHG((c~avwHE1 z2^)WaN-x1{c)Sc(*5?(t^^KVU$60qB)_4`J&iUzo9In55@oNd&Q;lvA6cnqy|=9BE)&Omc`*w0zWd*NM>dk4byPSUFz zwY{5s|8J}0HP2x)ukrdtzW0zLPw=pvPqxq(`?!ED>V(}p;QB5?<~3fwYhmXj^~t`+=zpTh40WNqR1VZqOL zEBvk_Yx|jA%>NOj&iK%Mob=YVe`lob1~J~12IPADy7cLLv;wJLN$2hcvU@3Mlbg%= zYWsbvl;3aP5%td5x9)GIb`$PC${&%>nztbB?(Hgc8+t%Lo`p3?yYI!H^z#W^yWc-x z?PB%jRdz4j?>mtDXuLD>&U^}~{}CVYXGv$@KPBDgN$*_Dbqf9kmos|PDSpK(^9?sjtR6C3Zq0~A%V>SDe|t$PYwS0BR> uPV!JsKCfJ^IqlMu&xP(i`4_Ex6qy`$g`7uaY_|$gUzti1{A&ysbLm`s@ literal 576 zcmY+AO-n*y5QQhNU)hIBwGG2%;4*@!mEb1A2;9mA1zX$%KLY9O~@q99zPtwtNrZQRU?5am4 z-qFgl^!dd?0jOxuZ(d*D90}DD@dv^Znj*Zr%(7KKUENR95h2-4UOuwcO&2L#y}j$) zKYfWkoI71EI