From bc3759274768b4fa89bab103cec9806a5b0ef5d0 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Mon, 6 Sep 2021 10:32:06 +0200 Subject: [PATCH] Fix release build of samples: suppress warnings about unused variables --- RAII_Samples/11_InitShaders/11_InitShaders.cpp | 10 ++++++++-- RAII_Samples/CopyBlitImage/CopyBlitImage.cpp | 3 ++- samples/11_InitShaders/11_InitShaders.cpp | 10 ++++++++-- samples/CopyBlitImage/CopyBlitImage.cpp | 3 ++- .../CreateDebugUtilsMessenger.cpp | 2 -- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/RAII_Samples/11_InitShaders/11_InitShaders.cpp b/RAII_Samples/11_InitShaders/11_InitShaders.cpp index f83a643..2cd4c0a 100644 --- a/RAII_Samples/11_InitShaders/11_InitShaders.cpp +++ b/RAII_Samples/11_InitShaders/11_InitShaders.cpp @@ -45,14 +45,20 @@ int main( int /*argc*/, char ** /*argv*/ ) glslang::InitializeProcess(); std::vector vertexShaderSPV; - bool ok = vk::su::GLSLtoSPV( vk::ShaderStageFlagBits::eVertex, vertexShaderText_PC_C, vertexShaderSPV ); +#if !defined( NDEBUG ) + bool ok = + #endif + vk::su::GLSLtoSPV( vk::ShaderStageFlagBits::eVertex, vertexShaderText_PC_C, vertexShaderSPV ); assert( ok ); vk::ShaderModuleCreateInfo vertexShaderModuleCreateInfo( {}, vertexShaderSPV ); vk::raii::ShaderModule vertexShaderModule( device, vertexShaderModuleCreateInfo ); std::vector fragmentShaderSPV; - ok = vk::su::GLSLtoSPV( vk::ShaderStageFlagBits::eFragment, fragmentShaderText_C_C, fragmentShaderSPV ); +#if !defined( NDEBUG ) + ok = +#endif + vk::su::GLSLtoSPV( vk::ShaderStageFlagBits::eFragment, fragmentShaderText_C_C, fragmentShaderSPV ); assert( ok ); vk::ShaderModuleCreateInfo fragmentShaderModuleCreateInfo( {}, fragmentShaderSPV ); diff --git a/RAII_Samples/CopyBlitImage/CopyBlitImage.cpp b/RAII_Samples/CopyBlitImage/CopyBlitImage.cpp index af9e531..e5ab34f 100644 --- a/RAII_Samples/CopyBlitImage/CopyBlitImage.cpp +++ b/RAII_Samples/CopyBlitImage/CopyBlitImage.cpp @@ -67,10 +67,11 @@ int main( int /*argc*/, char ** /*argv*/ ) graphicsAndPresentQueueFamilyIndex.second ); /* VULKAN_KEY_START */ - +#if !defined( NDEBUG ) vk::FormatProperties formatProperties = physicalDevice.getFormatProperties( swapChainData.colorFormat ); assert( ( formatProperties.linearTilingFeatures & vk::FormatFeatureFlagBits::eBlitSrc ) && "Format cannot be used as transfer source" ); +#endif vk::raii::Semaphore imageAcquiredSemaphore( device, vk::SemaphoreCreateInfo() ); diff --git a/samples/11_InitShaders/11_InitShaders.cpp b/samples/11_InitShaders/11_InitShaders.cpp index 4a300e6..ed94f98 100644 --- a/samples/11_InitShaders/11_InitShaders.cpp +++ b/samples/11_InitShaders/11_InitShaders.cpp @@ -46,14 +46,20 @@ int main( int /*argc*/, char ** /*argv*/ ) glslang::InitializeProcess(); std::vector vertexShaderSPV; - bool ok = vk::su::GLSLtoSPV( vk::ShaderStageFlagBits::eVertex, vertexShaderText_PC_C, vertexShaderSPV ); +#if !defined( NDEBUG ) + bool ok = +#endif + vk::su::GLSLtoSPV( vk::ShaderStageFlagBits::eVertex, vertexShaderText_PC_C, vertexShaderSPV ); assert( ok ); vk::ShaderModuleCreateInfo vertexShaderModuleCreateInfo( vk::ShaderModuleCreateFlags(), vertexShaderSPV ); vk::ShaderModule vertexShaderModule = device.createShaderModule( vertexShaderModuleCreateInfo ); std::vector fragmentShaderSPV; - ok = vk::su::GLSLtoSPV( vk::ShaderStageFlagBits::eFragment, fragmentShaderText_C_C, fragmentShaderSPV ); +#if !defined( NDEBUG ) + ok = +#endif + vk::su::GLSLtoSPV( vk::ShaderStageFlagBits::eFragment, fragmentShaderText_C_C, fragmentShaderSPV ); assert( ok ); vk::ShaderModuleCreateInfo fragmentShaderModuleCreateInfo( vk::ShaderModuleCreateFlags(), fragmentShaderSPV ); diff --git a/samples/CopyBlitImage/CopyBlitImage.cpp b/samples/CopyBlitImage/CopyBlitImage.cpp index 9a8796e..5ed72af 100644 --- a/samples/CopyBlitImage/CopyBlitImage.cpp +++ b/samples/CopyBlitImage/CopyBlitImage.cpp @@ -68,10 +68,11 @@ int main( int /*argc*/, char ** /*argv*/ ) graphicsAndPresentQueueFamilyIndex.second ); /* VULKAN_KEY_START */ - +#if !defined( NDEBUG ) vk::FormatProperties formatProperties = physicalDevice.getFormatProperties( swapChainData.colorFormat ); assert( ( formatProperties.linearTilingFeatures & vk::FormatFeatureFlagBits::eBlitSrc ) && "Format cannot be used as transfer source" ); +#endif vk::Semaphore imageAcquiredSemaphore = device.createSemaphore( vk::SemaphoreCreateInfo() ); diff --git a/samples/CreateDebugUtilsMessenger/CreateDebugUtilsMessenger.cpp b/samples/CreateDebugUtilsMessenger/CreateDebugUtilsMessenger.cpp index 4d64a07..f8fc3a3 100644 --- a/samples/CreateDebugUtilsMessenger/CreateDebugUtilsMessenger.cpp +++ b/samples/CreateDebugUtilsMessenger/CreateDebugUtilsMessenger.cpp @@ -153,9 +153,7 @@ int main( int /*argc*/, char ** /*argv*/ ) vk::DebugUtilsMessengerEXT debugUtilsMessenger = instance.createDebugUtilsMessengerEXT( vk::DebugUtilsMessengerCreateInfoEXT( {}, severityFlags, messageTypeFlags, &debugMessageFunc ) ); -#if !defined( NDEBUG ) instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger ); -#endif instance.destroy(); /* VULKAN_KEY_END */