Flutter Engine
The Flutter Engine
Functions | Variables
GrVkCaps.cpp File Reference
#include "src/gpu/ganesh/vk/GrVkCaps.h"
#include <memory>
#include "include/core/SkTextureCompressionType.h"
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrContextOptions.h"
#include "include/gpu/ganesh/vk/GrVkBackendSurface.h"
#include "include/gpu/vk/VulkanBackendContext.h"
#include "include/gpu/vk/VulkanExtensions.h"
#include "include/gpu/vk/VulkanTypes.h"
#include "src/core/SkCompressedDataUtils.h"
#include "src/gpu/KeyBuilder.h"
#include "src/gpu/ganesh/GrBackendUtils.h"
#include "src/gpu/ganesh/GrProgramDesc.h"
#include "src/gpu/ganesh/GrRenderTarget.h"
#include "src/gpu/ganesh/GrRenderTargetProxy.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
#include "src/gpu/ganesh/GrStencilSettings.h"
#include "src/gpu/ganesh/GrUtil.h"
#include "src/gpu/ganesh/SkGr.h"
#include "src/gpu/ganesh/TestFormatColorTypeCombination.h"
#include "src/gpu/ganesh/vk/GrVkGpu.h"
#include "src/gpu/ganesh/vk/GrVkImage.h"
#include "src/gpu/ganesh/vk/GrVkRenderTarget.h"
#include "src/gpu/ganesh/vk/GrVkTexture.h"
#include "src/gpu/ganesh/vk/GrVkUniformHandler.h"
#include "src/gpu/ganesh/vk/GrVkUtil.h"
#include "src/gpu/vk/VulkanInterface.h"
#include "src/gpu/vk/VulkanUtilsPriv.h"

Go to the source code of this file.

Functions

static FormatCompatibilityClass format_compatibility_class (VkFormat format)
 
bool stencil_format_supported (const skgpu::VulkanInterface *interface, VkPhysicalDevice physDev, VkFormat format)
 
static bool format_is_srgb (VkFormat format)
 
static bool backend_format_is_external (const GrBackendFormat &format)
 
static size_t align_to_4 (size_t v)
 
template<size_t N>
static bool intel_deviceID_present (const std::array< uint32_t, N > &array, uint32_t deviceID)
 

Variables

static constexpr VkFormat kVkFormats []
 

Function Documentation

◆ align_to_4()

static size_t align_to_4 ( size_t  v)
inlinestatic

Definition at line 1651 of file GrVkCaps.cpp.

1651 {
1652 switch (v & 0b11) {
1653 // v is already a multiple of 4.
1654 case 0: return v;
1655 // v is a multiple of 2 but not 4.
1656 case 2: return 2 * v;
1657 // v is not a multiple of 2.
1658 default: return 4 * v;
1659 }
1660}

◆ backend_format_is_external()

static bool backend_format_is_external ( const GrBackendFormat format)
static

Definition at line 1524 of file GrVkCaps.cpp.

1524 {
1525 const skgpu::VulkanYcbcrConversionInfo* ycbcrInfo =
1527 SkASSERT(ycbcrInfo);
1528
1529 // All external formats have a valid ycbcrInfo used for sampling and a non zero external format.
1530 if (ycbcrInfo->isValid() && ycbcrInfo->fExternalFormat != 0) {
1531#ifdef SK_DEBUG
1532 VkFormat vkFormat;
1534 SkASSERT(vkFormat == VK_FORMAT_UNDEFINED);
1535#endif
1536 return true;
1537 }
1538 return false;
1539}
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
#define SkASSERT(cond)
Definition: SkAssert.h:116
uint32_t uint32_t * format
SK_API const skgpu::VulkanYcbcrConversionInfo * GetVkYcbcrConversionInfo(const GrBackendFormat &)
SK_API bool AsVkFormat(const GrBackendFormat &, VkFormat *)
VkFormat
Definition: vulkan_core.h:1458
@ VK_FORMAT_UNDEFINED
Definition: vulkan_core.h:1459

◆ format_compatibility_class()

static FormatCompatibilityClass format_compatibility_class ( VkFormat  format)
static

Definition at line 108 of file GrVkCaps.cpp.

108 {
109 switch (format) {
117 return FormatCompatibilityClass::k32_4_1;
118
120 return FormatCompatibilityClass::k8_1_1;
121
129 return FormatCompatibilityClass::k16_2_1;
130
133 return FormatCompatibilityClass::k64_8_1;
134
136 return FormatCompatibilityClass::k24_3_1;
137
139 return FormatCompatibilityClass::k10x6_64_6_1;
140
142 return FormatCompatibilityClass::kETC2_RGB_8_16;
143
145 return FormatCompatibilityClass::kBC1_RGB_8_16_1;
146
148 return FormatCompatibilityClass::kBC1_RGBA_8_16;
149
150 default:
151 SK_ABORT("Unsupported VkFormat");
152 }
153}
#define SK_ABORT(message,...)
Definition: SkAssert.h:70
@ VK_FORMAT_R16G16B16A16_UNORM
Definition: vulkan_core.h:1550
@ VK_FORMAT_R8G8B8A8_SRGB
Definition: vulkan_core.h:1502
@ VK_FORMAT_R8G8B8_UNORM
Definition: vulkan_core.h:1482
@ VK_FORMAT_B8G8R8A8_UNORM
Definition: vulkan_core.h:1503
@ VK_FORMAT_R16G16_SFLOAT
Definition: vulkan_core.h:1542
@ VK_FORMAT_B4G4R4A4_UNORM_PACK16
Definition: vulkan_core.h:1462
@ VK_FORMAT_R16_SFLOAT
Definition: vulkan_core.h:1535
@ VK_FORMAT_R8G8_UNORM
Definition: vulkan_core.h:1475
@ VK_FORMAT_R8_UNORM
Definition: vulkan_core.h:1468
@ VK_FORMAT_R5G6B5_UNORM_PACK16
Definition: vulkan_core.h:1463
@ VK_FORMAT_R4G4B4A4_UNORM_PACK16
Definition: vulkan_core.h:1461
@ VK_FORMAT_A2B10G10R10_UNORM_PACK32
Definition: vulkan_core.h:1523
@ VK_FORMAT_R8G8B8A8_UNORM
Definition: vulkan_core.h:1496
@ VK_FORMAT_BC1_RGB_UNORM_BLOCK
Definition: vulkan_core.h:1590
@ VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16
Definition: vulkan_core.h:1653
@ VK_FORMAT_R16_UNORM
Definition: vulkan_core.h:1529
@ VK_FORMAT_R16G16B16A16_SFLOAT
Definition: vulkan_core.h:1556
@ VK_FORMAT_R16G16_UNORM
Definition: vulkan_core.h:1536
@ VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK
Definition: vulkan_core.h:1606
@ VK_FORMAT_A2R10G10B10_UNORM_PACK32
Definition: vulkan_core.h:1517
@ VK_FORMAT_BC1_RGBA_UNORM_BLOCK
Definition: vulkan_core.h:1592
@ VK_FORMAT_B5G6R5_UNORM_PACK16
Definition: vulkan_core.h:1464

◆ format_is_srgb()

static bool format_is_srgb ( VkFormat  format)
static

Definition at line 776 of file GrVkCaps.cpp.

776 {
778
779 switch (format) {
781 return true;
782 default:
783 return false;
784 }
785}
bool GrVkFormatIsSupported(VkFormat format)
Definition: GrVkUtil.cpp:21

◆ intel_deviceID_present()

template<size_t N>
static bool intel_deviceID_present ( const std::array< uint32_t, N > &  array,
uint32_t  deviceID 
)
static

Definition at line 2066 of file GrVkCaps.cpp.

2066 {
2067 return std::find(array.begin(), array.end(), deviceID) != array.end();
2068}
int find(T *array, int N, T item)

◆ stencil_format_supported()

bool stencil_format_supported ( const skgpu::VulkanInterface interface,
VkPhysicalDevice  physDev,
VkFormat  format 
)

Definition at line 755 of file GrVkCaps.cpp.

757 {
758 VkFormatProperties props;
759 memset(&props, 0, sizeof(VkFormatProperties));
760 GR_VK_CALL(interface, GetPhysicalDeviceFormatProperties(physDev, format, &props));
762}
#define GR_VK_CALL(IFACE, X)
Definition: GrVkUtil.h:24
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35
VkFormatFeatureFlags optimalTilingFeatures
Definition: vulkan_core.h:3014
@ VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT
Definition: vulkan_core.h:2268

Variable Documentation

◆ kVkFormats

constexpr VkFormat kVkFormats[]
staticconstexpr