From d8cd2330100186022dfd0e838064bc725571d27f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Wed, 19 Jul 2023 11:39:48 +0200 Subject: [PATCH] Update in README.md (#1624) --- README.md | 1 + samples/16_Vulkan_1_1/16_Vulkan_1_1.cpp | 2 +- .../EnableValidationWithCallback.cpp | 2 +- samples/PushDescriptors/PushDescriptors.cpp | 6 +++--- samples/SurfaceCapabilities/SurfaceCapabilities.cpp | 13 +------------ 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index eba5c29..648a1d5 100644 --- a/README.md +++ b/README.md @@ -488,6 +488,7 @@ Creating a full featured ```DispatchLoaderDynamic``` is a two- to three-step pro PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress("vkGetInstanceProcAddr"); VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr); ``` +- Note that you need to keep that vk::DynamicLoader alive until after the last call to a vulkan function in your program. For example by making it static, or storing it somewhere globally. 2. initialize it with a vk::Instance to get all the other function pointers: ```c++ vk::Instance instance = vk::createInstance({}, nullptr); diff --git a/samples/16_Vulkan_1_1/16_Vulkan_1_1.cpp b/samples/16_Vulkan_1_1/16_Vulkan_1_1.cpp index 9b0bb06..16c18ea 100644 --- a/samples/16_Vulkan_1_1/16_Vulkan_1_1.cpp +++ b/samples/16_Vulkan_1_1/16_Vulkan_1_1.cpp @@ -42,7 +42,7 @@ int main( int /*argc*/, char ** /*argv*/ ) #if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 ) // initialize the DipatchLoaderDynamic to use - static vk::DynamicLoader dl; + vk::DynamicLoader dl; PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress( "vkGetInstanceProcAddr" ); VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr ); #endif diff --git a/samples/EnableValidationWithCallback/EnableValidationWithCallback.cpp b/samples/EnableValidationWithCallback/EnableValidationWithCallback.cpp index 74af148..d964922 100644 --- a/samples/EnableValidationWithCallback/EnableValidationWithCallback.cpp +++ b/samples/EnableValidationWithCallback/EnableValidationWithCallback.cpp @@ -121,7 +121,7 @@ int main( int /*argc*/, char ** /*argv*/ ) { #if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 ) // initialize the DipatchLoaderDynamic to use - static vk::DynamicLoader dl; + vk::DynamicLoader dl; PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress( "vkGetInstanceProcAddr" ); VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr ); #endif diff --git a/samples/PushDescriptors/PushDescriptors.cpp b/samples/PushDescriptors/PushDescriptors.cpp index ed6cb25..2799956 100644 --- a/samples/PushDescriptors/PushDescriptors.cpp +++ b/samples/PushDescriptors/PushDescriptors.cpp @@ -33,7 +33,7 @@ int main( int /*argc*/, char ** /*argv*/ ) { #if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 ) // initialize the DipatchLoaderDynamic to use - static vk::DynamicLoader dl; + vk::DynamicLoader dl; PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress( "vkGetInstanceProcAddr" ); VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr ); #endif @@ -135,7 +135,7 @@ int main( int /*argc*/, char ** /*argv*/ ) std::make_pair( vertexShaderModule, nullptr ), std::make_pair( fragmentShaderModule, nullptr ), sizeof( texturedCubeData[0] ), - { { vk::Format::eR32G32B32A32Sfloat, 0 }, { vk::Format::eR32G32Sfloat, 16 } }, + { { vk::Format::eR32G32B32A32Sfloat, 0 }, { vk::Format::eR32G32Sfloat, 16 } }, vk::FrontFace::eClockwise, true, pipelineLayout, @@ -158,7 +158,7 @@ int main( int /*argc*/, char ** /*argv*/ ) vk::DescriptorBufferInfo bufferInfo( uniformBufferData.buffer, 0, sizeof( glm::mat4x4 ) ); vk::DescriptorImageInfo imageInfo( textureData.sampler, textureData.imageData->imageView, vk::ImageLayout::eShaderReadOnlyOptimal ); vk::WriteDescriptorSet writeDescriptorSets[2] = { vk::WriteDescriptorSet( {}, 0, 0, vk::DescriptorType::eUniformBuffer, {}, bufferInfo ), - vk::WriteDescriptorSet( {}, 1, 0, vk::DescriptorType::eCombinedImageSampler, imageInfo ) }; + vk::WriteDescriptorSet( {}, 1, 0, vk::DescriptorType::eCombinedImageSampler, imageInfo ) }; // this call is from an extension and needs the dynamic dispatcher !! commandBuffer.pushDescriptorSetKHR( vk::PipelineBindPoint::eGraphics, pipelineLayout, 0, { 2, writeDescriptorSets } ); diff --git a/samples/SurfaceCapabilities/SurfaceCapabilities.cpp b/samples/SurfaceCapabilities/SurfaceCapabilities.cpp index 38e91de..afb1194 100644 --- a/samples/SurfaceCapabilities/SurfaceCapabilities.cpp +++ b/samples/SurfaceCapabilities/SurfaceCapabilities.cpp @@ -50,7 +50,7 @@ int main( int /*argc*/, char ** /*argv*/ ) { // need to initialize the dynamic dispatcher before the very first vulkan call #if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 ) - static vk::DynamicLoader dl; + vk::DynamicLoader dl; PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress( "vkGetInstanceProcAddr" ); VULKAN_HPP_DEFAULT_DISPATCHER.init( vkGetInstanceProcAddr ); #endif @@ -93,7 +93,6 @@ int main( int /*argc*/, char ** /*argv*/ ) .getSurfaceCapabilities2KHR( surfaceData.surface ); vk::SurfaceCapabilitiesKHR const & surfaceCapabilities = surfaceCapabilities2.get().surfaceCapabilities; @@ -117,16 +116,6 @@ int main( int /*argc*/, char ** /*argv*/ ) std::cout << "\n"; } - if ( vk::su::contains( extensionProperties, "VK_EXT_full_screen_exclusive" ) ) - { - vk::SurfaceCapabilitiesFullScreenExclusiveEXT surfaceCapabilitiesFullScreenExclusive = - surfaceCapabilities2.get(); - std::cout << std::string( "\t" ) << "SurfaceCapabilitiesFullScreenExclusiveEXT:\n"; - std::cout << std::string( "\t\t" ) << "fullScreenExclusiveSupported = " << !!surfaceCapabilitiesFullScreenExclusive.fullScreenExclusiveSupported - << "\n"; - std::cout << "\n"; - } - if ( vk::su::contains( extensionProperties, "VK_KHR_surface_protected_capabilities" ) ) { vk::SurfaceProtectedCapabilitiesKHR surfaceProtectedCapabilities = surfaceCapabilities2.get();