8#ifndef GrVkUtil_DEFINED
9#define GrVkUtil_DEFINED
20namespace SkSL {
struct ProgramSettings; }
24#define GR_VK_CALL(IFACE, X) (IFACE)->fFunctions.f##X
28#define GR_VK_LOG_IF_NOT_SUCCESS(GPU, RESULT, X, ...) \
30 if (RESULT != VK_SUCCESS && !GPU->isDeviceLost()) { \
31 SkDebugf("Failed vulkan call. Error: %d, " X "\n", RESULT, ##__VA_ARGS__); \
35#define GR_VK_CALL_RESULT(GPU, RESULT, X) \
37 (RESULT) = GR_VK_CALL(GPU->vkInterface(), X); \
38 SkASSERT(VK_SUCCESS == RESULT || VK_ERROR_DEVICE_LOST == RESULT); \
39 GR_VK_LOG_IF_NOT_SUCCESS(GPU, RESULT, #X); \
40 GPU->checkVkResult(RESULT); \
43#define GR_VK_CALL_RESULT_NOCHECK(GPU, RESULT, X) \
45 (RESULT) = GR_VK_CALL(GPU->vkInterface(), X); \
46 GPU->checkVkResult(RESULT); \
50#define GR_VK_CALL_ERRCHECK(GPU, X) \
51 VkResult SK_MACRO_APPEND_LINE(ret); \
52 GR_VK_CALL_RESULT(GPU, SK_MACRO_APPEND_LINE(ret), X) \
111 const std::string& shaderString,
113 VkShaderModule* shaderModule,
116 std::string* outSPIRV,
120 const std::string& spirv,
122 VkShaderModule* shaderModule,
bool GrVkFormatIsSupported(VkFormat)
bool GrCompileVkShaderModule(GrVkGpu *gpu, const std::string &shaderString, VkShaderStageFlagBits stage, VkShaderModule *shaderModule, VkPipelineShaderStageCreateInfo *stageInfo, const SkSL::ProgramSettings &settings, std::string *outSPIRV, SkSL::Program::Interface *outInterface)
bool GrInstallVkShaderModule(GrVkGpu *gpu, const std::string &spirv, VkShaderStageFlagBits stage, VkShaderModule *shaderModule, VkPipelineShaderStageCreateInfo *stageInfo)
static constexpr GrColorFormatDesc GrVkFormatDesc(VkFormat vkFormat)
@ VK_FORMAT_R16G16B16A16_UNORM
@ VK_FORMAT_R8G8B8A8_SRGB
@ VK_FORMAT_D24_UNORM_S8_UINT
@ VK_FORMAT_B8G8R8A8_UNORM
@ VK_FORMAT_R16G16_SFLOAT
@ VK_FORMAT_B4G4R4A4_UNORM_PACK16
@ VK_FORMAT_R5G6B5_UNORM_PACK16
@ VK_FORMAT_R4G4B4A4_UNORM_PACK16
@ VK_FORMAT_A2B10G10R10_UNORM_PACK32
@ VK_FORMAT_R8G8B8A8_UNORM
@ VK_FORMAT_BC1_RGB_UNORM_BLOCK
@ VK_FORMAT_R16G16B16A16_SFLOAT
@ VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK
@ VK_FORMAT_A2R10G10B10_UNORM_PACK32
@ VK_FORMAT_BC1_RGBA_UNORM_BLOCK
@ VK_FORMAT_B5G6R5_UNORM_PACK16
@ VK_FORMAT_D32_SFLOAT_S8_UINT