11 #include "vulkan/vulkan.h"
12 #include "VulkanInitializers.hpp"
30 #elif defined(__ANDROID__)
31 #include "VulkanAndroid.h"
32 #include <android/asset_manager.h>
36 #define VK_FLAGS_NONE 0
38 #define DEFAULT_FENCE_TIMEOUT 100000000000
41 #if defined(__ANDROID__)
42 #define VK_CHECK_RESULT(f) \
45 if (res != VK_SUCCESS) \
47 LOGE("Fatal : VkResult is \" %s \" in %s at line %d", vks::tools::errorString(res).c_str(), __FILE__, __LINE__); \
48 assert(res == VK_SUCCESS); \
52 #define VK_CHECK_RESULT(f) \
55 if (res != VK_SUCCESS) \
57 std::cout << "Fatal : VkResult is \"" << vks::tools::errorString(res) << "\" in " << __FILE__ << " at line " << __LINE__ << "\n" << std::flush; \
58 assert(res == VK_SUCCESS); \
63 const std::string getAssetPath();
64 const std::string getShaderBasePath();
71 extern bool errorModeSilent;
74 std::string errorString(VkResult errorCode);
77 std::string physicalDeviceTypeString(VkPhysicalDeviceType type);
81 VkBool32 getSupportedDepthFormat(VkPhysicalDevice physicalDevice, VkFormat *depthFormat);
83 VkBool32 getSupportedDepthStencilFormat(VkPhysicalDevice physicalDevice, VkFormat* depthStencilFormat);
86 VkBool32 formatIsFilterable(VkPhysicalDevice physicalDevice, VkFormat format, VkImageTiling tiling);
88 VkBool32 formatHasStencil(VkFormat format);
92 VkCommandBuffer cmdbuffer,
94 VkImageLayout oldImageLayout,
95 VkImageLayout newImageLayout,
96 VkImageSubresourceRange subresourceRange,
97 uint32_t srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
98 uint32_t dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
99 VkPipelineStageFlags srcStageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
100 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT);
103 VkCommandBuffer cmdbuffer,
105 VkImageAspectFlags aspectMask,
106 VkImageLayout oldImageLayout,
107 VkImageLayout newImageLayout,
108 VkPipelineStageFlags srcStageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
109 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT);
112 void insertImageMemoryBarrier(
113 VkCommandBuffer cmdbuffer,
115 VkAccessFlags srcAccessMask,
116 VkAccessFlags dstAccessMask,
117 VkImageLayout oldImageLayout,
118 VkImageLayout newImageLayout,
119 VkPipelineStageFlags srcStageMask,
120 VkPipelineStageFlags dstStageMask,
121 VkImageSubresourceRange subresourceRange);
124 void exitFatal(
const std::string& message, int32_t exitCode);
125 void exitFatal(
const std::string& message, VkResult resultCode);
128 #if defined(__ANDROID__)
129 VkShaderModule loadShader(AAssetManager* assetManager,
const char *fileName, VkDevice device);
131 VkShaderModule loadShader(
const char *fileName, VkDevice device);
135 bool fileExists(
const std::string &filename);
137 uint32_t alignedSize(uint32_t value, uint32_t alignment);
138 VkDeviceSize alignedVkSize(VkDeviceSize value, VkDeviceSize alignment);