Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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/GrVkBackendContext.h"
#include "include/gpu/vk/VulkanExtensions.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 1649 of file GrVkCaps.cpp.

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

◆ backend_format_is_external()

static bool backend_format_is_external ( const GrBackendFormat format)
static

Definition at line 1523 of file GrVkCaps.cpp.

1523 {
1525 SkASSERT(ycbcrInfo);
1526
1527 // All external formats have a valid ycbcrInfo used for sampling and a non zero external format.
1528 if (ycbcrInfo->isValid() && ycbcrInfo->fExternalFormat != 0) {
1529#ifdef SK_DEBUG
1530 VkFormat vkFormat;
1532 SkASSERT(vkFormat == VK_FORMAT_UNDEFINED);
1533#endif
1534 return true;
1535 }
1536 return false;
1537}
#define SkAssertResult(cond)
Definition SkAssert.h:123
#define SkASSERT(cond)
Definition SkAssert.h:116
uint32_t uint32_t * format
SK_API bool AsVkFormat(const GrBackendFormat &, VkFormat *)
SK_API const GrVkYcbcrConversionInfo * GetVkYcbcrConversionInfo(const GrBackendFormat &)
VkFormat
@ VK_FORMAT_UNDEFINED

◆ format_compatibility_class()

static FormatCompatibilityClass format_compatibility_class ( VkFormat  format)
static

Definition at line 107 of file GrVkCaps.cpp.

107 {
108 switch (format) {
116 return FormatCompatibilityClass::k32_4_1;
117
119 return FormatCompatibilityClass::k8_1_1;
120
128 return FormatCompatibilityClass::k16_2_1;
129
132 return FormatCompatibilityClass::k64_8_1;
133
135 return FormatCompatibilityClass::k24_3_1;
136
138 return FormatCompatibilityClass::k10x6_64_6_1;
139
141 return FormatCompatibilityClass::kETC2_RGB_8_16;
142
144 return FormatCompatibilityClass::kBC1_RGB_8_16_1;
145
147 return FormatCompatibilityClass::kBC1_RGBA_8_16;
148
149 default:
150 SK_ABORT("Unsupported VkFormat");
151 }
152}
#define SK_ABORT(message,...)
Definition SkAssert.h:70
@ VK_FORMAT_R16G16B16A16_UNORM
@ VK_FORMAT_R8G8B8A8_SRGB
@ VK_FORMAT_R8G8B8_UNORM
@ VK_FORMAT_B8G8R8A8_UNORM
@ VK_FORMAT_R16G16_SFLOAT
@ VK_FORMAT_B4G4R4A4_UNORM_PACK16
@ VK_FORMAT_R16_SFLOAT
@ VK_FORMAT_R8G8_UNORM
@ VK_FORMAT_R8_UNORM
@ 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_R10X6G10X6B10X6A10X6_UNORM_4PACK16
@ VK_FORMAT_R16_UNORM
@ VK_FORMAT_R16G16B16A16_SFLOAT
@ VK_FORMAT_R16G16_UNORM
@ VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK
@ VK_FORMAT_A2R10G10B10_UNORM_PACK32
@ VK_FORMAT_BC1_RGBA_UNORM_BLOCK
@ VK_FORMAT_B5G6R5_UNORM_PACK16

◆ format_is_srgb()

static bool format_is_srgb ( VkFormat  format)
static

Definition at line 775 of file GrVkCaps.cpp.

775 {
777
778 switch (format) {
780 return true;
781 default:
782 return false;
783 }
784}
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 2060 of file GrVkCaps.cpp.

2060 {
2061 return std::find(array.begin(), array.end(), deviceID) != array.end();
2062}

◆ stencil_format_supported()

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

Definition at line 754 of file GrVkCaps.cpp.

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

Variable Documentation

◆ kVkFormats

constexpr VkFormat kVkFormats[]
staticconstexpr
Initial value:

Definition at line 788 of file GrVkCaps.cpp.