fix some warnings (errors) on release build.

This commit is contained in:
asuessenbach 2020-10-20 09:55:19 +02:00
parent 32c994335a
commit 2e95313c1d
6 changed files with 25 additions and 7 deletions

View File

@ -11456,6 +11456,7 @@ namespace std
{ {
#ifdef VULKAN_HPP_NO_EXCEPTIONS #ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore(message); ignore(message);
ignore(successCodes); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() ); VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
#else #else
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() ) if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
@ -11471,6 +11472,7 @@ namespace std
{ {
#ifdef VULKAN_HPP_NO_EXCEPTIONS #ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore(message); ignore(message);
ignore(successCodes); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() ); VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
#else #else
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() ) if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
@ -11508,6 +11510,7 @@ namespace std
{ {
# ifdef VULKAN_HPP_NO_EXCEPTIONS # ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore( message ); ignore( message );
ignore(successCodes); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() ); VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
# else # else
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() ) if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
@ -11544,6 +11547,7 @@ namespace std
{ {
# ifdef VULKAN_HPP_NO_EXCEPTIONS # ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore( message ); ignore( message );
ignore(successCodes); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() ); VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
# else # else
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() ) if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )

View File

@ -91,8 +91,10 @@ namespace vk
std::string const & shaderText ) std::string const & shaderText )
{ {
std::vector<unsigned int> shaderSPV; std::vector<unsigned int> shaderSPV;
bool ok = GLSLtoSPV( shaderStage, shaderText, shaderSPV ); if ( !GLSLtoSPV( shaderStage, shaderText, shaderSPV ) )
assert( ok ); {
throw std::runtime_error( "Could not convert glsl shader to spir-v -> terminating" );
}
return device->createShaderModuleUnique( vk::ShaderModuleCreateInfo( vk::ShaderModuleCreateFlags(), shaderSPV ) ); return device->createShaderModuleUnique( vk::ShaderModuleCreateInfo( vk::ShaderModuleCreateFlags(), shaderSPV ) );
} }

View File

@ -1016,7 +1016,7 @@ namespace vk
MonochromeImageGenerator::MonochromeImageGenerator( std::array<unsigned char, 3> const & rgb ) : m_rgb( rgb ) {} MonochromeImageGenerator::MonochromeImageGenerator( std::array<unsigned char, 3> const & rgb ) : m_rgb( rgb ) {}
void MonochromeImageGenerator::operator()( void * data, vk::Extent2D & extent ) const void MonochromeImageGenerator::operator()( void * data, vk::Extent2D const & extent ) const
{ {
// fill in with the monochrome color // fill in with the monochrome color
unsigned char * pImageMemory = static_cast<unsigned char *>( data ); unsigned char * pImageMemory = static_cast<unsigned char *>( data );
@ -1041,10 +1041,10 @@ namespace vk
assert( m_channels == 4 ); assert( m_channels == 4 );
} }
void PixelsImageGenerator::operator()( void * data, vk::Extent2D & extent ) const void PixelsImageGenerator::operator()( void * data, vk::Extent2D const & extent ) const
{ {
assert( extent == m_extent ); assert( extent == m_extent );
memcpy( data, m_pixels, m_extent.width * m_extent.height * m_channels ); memcpy( data, m_pixels, extent.width * extent.height * m_channels );
} }
TextureData::TextureData( vk::PhysicalDevice const & physicalDevice, TextureData::TextureData( vk::PhysicalDevice const & physicalDevice,

View File

@ -245,7 +245,7 @@ namespace vk
public: public:
MonochromeImageGenerator( std::array<unsigned char, 3> const & rgb ); MonochromeImageGenerator( std::array<unsigned char, 3> const & rgb );
void operator()( void * data, vk::Extent2D & extent ) const; void operator()( void * data, vk::Extent2D const & extent ) const;
private: private:
std::array<unsigned char, 3> const & m_rgb; std::array<unsigned char, 3> const & m_rgb;
@ -256,7 +256,7 @@ namespace vk
public: public:
PixelsImageGenerator( vk::Extent2D const & extent, size_t channels, unsigned char const * pixels ); PixelsImageGenerator( vk::Extent2D const & extent, size_t channels, unsigned char const * pixels );
void operator()( void * data, vk::Extent2D & extent ) const; void operator()( void * data, vk::Extent2D const & extent ) const;
private: private:
vk::Extent2D m_extent; vk::Extent2D m_extent;

View File

@ -15,6 +15,14 @@
// VulkanHpp Samples : Hash // VulkanHpp Samples : Hash
// Compile test on using std::hash on handles // Compile test on using std::hash on handles
#if defined( _MSC_VER )
# pragma warning( disable : 4189 ) // local variable is initialized but not referenced
#elif defined( __GNUC__ )
# pragma GCC diagnostic ignored "-Wunused-variable"
#else
// unknow compiler... just ignore the warnings for yourselves ;)
#endif
#include "vulkan/vulkan.hpp" #include "vulkan/vulkan.hpp"
#include <iostream> #include <iostream>

View File

@ -16696,6 +16696,7 @@ namespace VULKAN_HPP_NAMESPACE
{ {
#ifdef VULKAN_HPP_NO_EXCEPTIONS #ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore( message ); ignore( message );
ignore( successCodes ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() ); VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
#else #else
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() ) if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
@ -16712,6 +16713,7 @@ namespace VULKAN_HPP_NAMESPACE
{ {
#ifdef VULKAN_HPP_NO_EXCEPTIONS #ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore( message ); ignore( message );
ignore( successCodes ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() ); VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
#else #else
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() ) if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
@ -16750,6 +16752,7 @@ namespace VULKAN_HPP_NAMESPACE
{ {
# ifdef VULKAN_HPP_NO_EXCEPTIONS # ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore( message ); ignore( message );
ignore( successCodes ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() ); VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
# else # else
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() ) if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
@ -16786,6 +16789,7 @@ namespace VULKAN_HPP_NAMESPACE
{ {
# ifdef VULKAN_HPP_NO_EXCEPTIONS # ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore( message ); ignore( message );
ignore( successCodes ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() ); VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
# else # else
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() ) if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )