From 98e4c135193809043b5c673dd2848a346076a0f3 Mon Sep 17 00:00:00 2001 From: Mike Stroyan Date: Wed, 28 Sep 2016 09:42:28 -0600 Subject: [PATCH] layers: mark exported functions in layer utils This allows layers to hide many functions that don't need export. --- layers/vk_layer_utils.cpp | 38 +++++++++++++++++++------------------- layers/vk_layer_utils.h | 32 ++++++++++++++++---------------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/layers/vk_layer_utils.cpp b/layers/vk_layer_utils.cpp index c87d1c5..4ad1989 100644 --- a/layers/vk_layer_utils.cpp +++ b/layers/vk_layer_utils.cpp @@ -230,12 +230,12 @@ const std::map vk_format_table = { }; // Return true if format is a depth or stencil format -bool vk_format_is_depth_or_stencil(VkFormat format) { +VK_LAYER_EXPORT bool vk_format_is_depth_or_stencil(VkFormat format) { return (vk_format_is_depth_and_stencil(format) || vk_format_is_depth_only(format) || vk_format_is_stencil_only(format)); } // Return true if format contains depth and stencil information -bool vk_format_is_depth_and_stencil(VkFormat format) { +VK_LAYER_EXPORT bool vk_format_is_depth_and_stencil(VkFormat format) { bool is_ds = false; switch (format) { @@ -251,10 +251,10 @@ bool vk_format_is_depth_and_stencil(VkFormat format) { } // Return true if format is a stencil-only format -bool vk_format_is_stencil_only(VkFormat format) { return (format == VK_FORMAT_S8_UINT); } +VK_LAYER_EXPORT bool vk_format_is_stencil_only(VkFormat format) { return (format == VK_FORMAT_S8_UINT); } // Return true if format is a depth-only format -bool vk_format_is_depth_only(VkFormat format) { +VK_LAYER_EXPORT bool vk_format_is_depth_only(VkFormat format) { bool is_depth = false; switch (format) { @@ -271,7 +271,7 @@ bool vk_format_is_depth_only(VkFormat format) { } // Return true if format is of time UNORM -bool vk_format_is_norm(VkFormat format) { +VK_LAYER_EXPORT bool vk_format_is_norm(VkFormat format) { bool is_norm = false; switch (format) { @@ -346,10 +346,10 @@ bool vk_format_is_norm(VkFormat format) { }; // Return true if format is an integer format -bool vk_format_is_int(VkFormat format) { return (vk_format_is_sint(format) || vk_format_is_uint(format)); } +VK_LAYER_EXPORT bool vk_format_is_int(VkFormat format) { return (vk_format_is_sint(format) || vk_format_is_uint(format)); } // Return true if format is an unsigned integer format -bool vk_format_is_uint(VkFormat format) { +VK_LAYER_EXPORT bool vk_format_is_uint(VkFormat format) { bool is_uint = false; switch (format) { @@ -384,7 +384,7 @@ bool vk_format_is_uint(VkFormat format) { } // Return true if format is a signed integer format -bool vk_format_is_sint(VkFormat format) { +VK_LAYER_EXPORT bool vk_format_is_sint(VkFormat format) { bool is_sint = false; switch (format) { @@ -419,7 +419,7 @@ bool vk_format_is_sint(VkFormat format) { } // Return true if format is a floating-point format -bool vk_format_is_float(VkFormat format) { +VK_LAYER_EXPORT bool vk_format_is_float(VkFormat format) { bool is_float = false; switch (format) { @@ -449,7 +449,7 @@ bool vk_format_is_float(VkFormat format) { } // Return true if format is in the SRGB colorspace -bool vk_format_is_srgb(VkFormat format) { +VK_LAYER_EXPORT bool vk_format_is_srgb(VkFormat format) { bool is_srgb = false; switch (format) { @@ -491,7 +491,7 @@ bool vk_format_is_srgb(VkFormat format) { } // Return true if format is compressed -bool vk_format_is_compressed(VkFormat format) { +VK_LAYER_EXPORT bool vk_format_is_compressed(VkFormat format) { switch (format) { case VK_FORMAT_BC1_RGB_UNORM_BLOCK: case VK_FORMAT_BC1_RGB_SRGB_BLOCK: @@ -554,7 +554,7 @@ bool vk_format_is_compressed(VkFormat format) { } // Return compressed block sizes for block compressed formats -VkExtent2D vk_format_compressed_block_size(VkFormat format) { +VK_LAYER_EXPORT VkExtent2D vk_format_compressed_block_size(VkFormat format) { VkExtent2D block_size = { 1, 1 }; switch (format) { case VK_FORMAT_BC1_RGB_UNORM_BLOCK: @@ -646,7 +646,7 @@ VkExtent2D vk_format_compressed_block_size(VkFormat format) { } // Return format class of the specified format -VkFormatCompatibilityClass vk_format_get_compatibility_class(VkFormat format) { +VK_LAYER_EXPORT VkFormatCompatibilityClass vk_format_get_compatibility_class(VkFormat format) { auto item = vk_format_table.find(format); if (item != vk_format_table.end()) { return item->second.format_class; @@ -655,7 +655,7 @@ VkFormatCompatibilityClass vk_format_get_compatibility_class(VkFormat format) { } // Return size, in bytes, of a pixel of the specified format -size_t vk_format_get_size(VkFormat format) { +VK_LAYER_EXPORT size_t vk_format_get_size(VkFormat format) { auto item = vk_format_table.find(format); if (item != vk_format_table.end()) { return item->second.size; @@ -673,7 +673,7 @@ unsigned int vk_format_get_channel_count(VkFormat format) { } // Perform a zero-tolerant modulo operation -VkDeviceSize vk_safe_modulo(VkDeviceSize dividend, VkDeviceSize divisor) { +VK_LAYER_EXPORT VkDeviceSize vk_safe_modulo(VkDeviceSize dividend, VkDeviceSize divisor) { VkDeviceSize result = 0; if (divisor != 0) { result = dividend % divisor; @@ -690,7 +690,7 @@ static const uint8_t UTF8_THREE_BYTE_MASK = 0xF8; static const uint8_t UTF8_DATA_BYTE_CODE = 0x80; static const uint8_t UTF8_DATA_BYTE_MASK = 0xC0; -VkStringErrorFlags vk_string_validate(const int max_length, const char *utf8) { +VK_LAYER_EXPORT VkStringErrorFlags vk_string_validate(const int max_length, const char *utf8) { VkStringErrorFlags result = VK_STRING_ERROR_NONE; int num_char_bytes = 0; int i, j; @@ -725,7 +725,7 @@ VkStringErrorFlags vk_string_validate(const int max_length, const char *utf8) { } // Utility function for finding a text string in another string -bool white_list(const char *item, const char *list) { +VK_LAYER_EXPORT bool white_list(const char *item, const char *list) { std::string candidate(item); std::string white_list(list); return (white_list.find(candidate) != std::string::npos); @@ -742,8 +742,8 @@ bool white_list(const char *item, const char *list) { // If a vk_layer_settings.txt file is present and an application defines a debug callback, both callbacks // will be active. If no vk_layer_settings.txt file is present, creating an application-defined debug // callback will cause the default callbacks to be unregisterd and removed. -void layer_debug_actions(debug_report_data *report_data, std::vector &logging_callback, - const VkAllocationCallbacks *pAllocator, const char *layer_identifier) { +VK_LAYER_EXPORT void layer_debug_actions(debug_report_data *report_data, std::vector &logging_callback, + const VkAllocationCallbacks *pAllocator, const char *layer_identifier) { VkDebugReportCallbackEXT callback = VK_NULL_HANDLE; diff --git a/layers/vk_layer_utils.h b/layers/vk_layer_utils.h index 43e1b53..0008907 100644 --- a/layers/vk_layer_utils.h +++ b/layers/vk_layer_utils.h @@ -90,8 +90,8 @@ typedef enum VkStringErrorFlagBits { } VkStringErrorFlagBits; typedef VkFlags VkStringErrorFlags; -void layer_debug_actions(debug_report_data* report_data, std::vector &logging_callback, - const VkAllocationCallbacks *pAllocator, const char* layer_identifier); +VK_LAYER_EXPORT void layer_debug_actions(debug_report_data *report_data, std::vector &logging_callback, + const VkAllocationCallbacks *pAllocator, const char *layer_identifier); static inline bool vk_format_is_undef(VkFormat format) { return (format == VK_FORMAT_UNDEFINED); } @@ -104,20 +104,20 @@ static inline bool vk_format_is_color(VkFormat format) { return !(vk_format_is_undef(format) || vk_format_is_depth_or_stencil(format)); } -bool vk_format_is_norm(VkFormat format); -bool vk_format_is_int(VkFormat format); -bool vk_format_is_sint(VkFormat format); -bool vk_format_is_uint(VkFormat format); -bool vk_format_is_float(VkFormat format); -bool vk_format_is_srgb(VkFormat format); -bool vk_format_is_compressed(VkFormat format); -VkExtent2D vk_format_compressed_block_size(VkFormat format); -size_t vk_format_get_size(VkFormat format); -unsigned int vk_format_get_channel_count(VkFormat format); -VkFormatCompatibilityClass vk_format_get_compatibility_class(VkFormat format); -VkDeviceSize vk_safe_modulo(VkDeviceSize dividend, VkDeviceSize divisor); -VkStringErrorFlags vk_string_validate(const int max_length, const char *char_array); -bool white_list(const char *item, const char *whitelist); +VK_LAYER_EXPORT bool vk_format_is_norm(VkFormat format); +VK_LAYER_EXPORT bool vk_format_is_int(VkFormat format); +VK_LAYER_EXPORT bool vk_format_is_sint(VkFormat format); +VK_LAYER_EXPORT bool vk_format_is_uint(VkFormat format); +VK_LAYER_EXPORT bool vk_format_is_float(VkFormat format); +VK_LAYER_EXPORT bool vk_format_is_srgb(VkFormat format); +VK_LAYER_EXPORT bool vk_format_is_compressed(VkFormat format); +VK_LAYER_EXPORT VkExtent2D vk_format_compressed_block_size(VkFormat format); +VK_LAYER_EXPORT size_t vk_format_get_size(VkFormat format); +VK_LAYER_EXPORT unsigned int vk_format_get_channel_count(VkFormat format); +VK_LAYER_EXPORT VkFormatCompatibilityClass vk_format_get_compatibility_class(VkFormat format); +VK_LAYER_EXPORT VkDeviceSize vk_safe_modulo(VkDeviceSize dividend, VkDeviceSize divisor); +VK_LAYER_EXPORT VkStringErrorFlags vk_string_validate(const int max_length, const char *char_array); +VK_LAYER_EXPORT bool white_list(const char *item, const char *whitelist); static inline int u_ffs(int val) { #ifdef WIN32 -- 2.7.4