#ifndef skgpu_VulkanUtilsPriv_DEFINED
#define skgpu_VulkanUtilsPriv_DEFINED
#include "include/core/SkColor.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkTextureCompressionType.h"
#include "include/gpu/vk/VulkanTypes.h"
#include "include/private/base/SkAssert.h"
#include "include/private/gpu/vk/SkiaVulkan.h"
#include "src/gpu/SkSLToBackend.h"
#include "src/sksl/codegen/SkSLSPIRVCodeGenerator.h"
#ifdef SK_BUILD_FOR_ANDROID
#include <android/hardware_buffer.h>
#endif
#include <cstdint>
#include <string>
#include <cstddef>
namespace SkSL {
enum class ProgramKind : int8_t;
struct ProgramInterface;
struct ProgramSettings;
struct ShaderCaps;
}
namespace skgpu {
class ShaderErrorHandler;
struct VulkanInterface;
struct VulkanBackendContext;
class VulkanExtensions;
inline bool SkSLToSPIRV(const SkSL::ShaderCaps* caps,
const std::string& sksl,
SkSL::ProgramKind programKind,
const SkSL::ProgramSettings& settings,
std::string* spirv,
SkSL::ProgramInterface* outInterface,
ShaderErrorHandler* errorHandler) { … }
static constexpr uint32_t VkFormatChannels(VkFormat vkFormat) { … }
static constexpr size_t VkFormatBytesPerBlock(VkFormat vkFormat) { … }
static constexpr SkTextureCompressionType VkFormatToCompressionType(VkFormat vkFormat) { … }
static constexpr int VkFormatIsStencil(VkFormat format) { … }
static constexpr int VkFormatIsDepth(VkFormat format) { … }
static constexpr int VkFormatStencilBits(VkFormat format) { … }
static constexpr bool VkFormatNeedsYcbcrSampler(VkFormat format) { … }
static constexpr bool SampleCountToVkSampleCount(uint32_t samples,
VkSampleCountFlagBits* vkSamples) { … }
static constexpr bool VkFormatIsCompressed(VkFormat vkFormat) { … }
template<typename T> T* GetExtensionFeatureStruct(const VkPhysicalDeviceFeatures2& features,
VkStructureType type) { … }
void SetupSamplerYcbcrConversionInfo(VkSamplerYcbcrConversionCreateInfo* outInfo,
const VulkanYcbcrConversionInfo& conversionInfo);
static constexpr const char* VkFormatToStr(VkFormat vkFormat) { … }
#ifdef SK_BUILD_FOR_ANDROID
void GetYcbcrConversionInfoFromFormatProps(
VulkanYcbcrConversionInfo* outConversionInfo,
const VkAndroidHardwareBufferFormatPropertiesANDROID& formatProps);
bool GetAHardwareBufferProperties(
VkAndroidHardwareBufferFormatPropertiesANDROID* outHwbFormatProps,
VkAndroidHardwareBufferPropertiesANDROID* outHwbProps,
const skgpu::VulkanInterface*,
const AHardwareBuffer*,
VkDevice);
bool AllocateAndBindImageMemory(skgpu::VulkanAlloc* outVulkanAlloc,
VkImage,
const VkPhysicalDeviceMemoryProperties2&,
const VkAndroidHardwareBufferPropertiesANDROID&,
AHardwareBuffer*,
const skgpu::VulkanInterface*,
VkDevice);
#endif
void InvokeDeviceLostCallback(const skgpu::VulkanInterface* vulkanInterface,
VkDevice vkDevice,
skgpu::VulkanDeviceLostContext faultContext,
skgpu::VulkanDeviceLostProc faultProc,
bool supportsDeviceFaultInfoExtension);
sk_sp<skgpu::VulkanInterface> MakeInterface(const skgpu::VulkanBackendContext&,
const skgpu::VulkanExtensions* extOverride,
uint32_t* physDevVersionOut,
uint32_t* instanceVersionOut);
}
#endif