Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
skgpu::graphite::VulkanCaps Class Referencefinal

#include <VulkanCaps.h>

Inheritance diagram for skgpu::graphite::VulkanCaps:
skgpu::graphite::Caps

Public Member Functions

 VulkanCaps (const ContextOptions &, const skgpu::VulkanInterface *, VkPhysicalDevice, uint32_t physicalDeviceVersion, const VkPhysicalDeviceFeatures2 *, const skgpu::VulkanExtensions *, Protected)
 
 ~VulkanCaps () override
 
TextureInfo getDefaultSampledTextureInfo (SkColorType, Mipmapped mipmapped, Protected, Renderable) const override
 
TextureInfo getTextureInfoForSampledCopy (const TextureInfo &textureInfo, Mipmapped mipmapped) const override
 
TextureInfo getDefaultCompressedTextureInfo (SkTextureCompressionType, Mipmapped mipmapped, Protected) const override
 
TextureInfo getDefaultMSAATextureInfo (const TextureInfo &singleSampledInfo, Discardable discardable) const override
 
TextureInfo getDefaultDepthStencilTextureInfo (SkEnumBitMask< DepthStencilFlags >, uint32_t sampleCount, Protected) const override
 
TextureInfo getDefaultStorageTextureInfo (SkColorType) const override
 
ImmutableSamplerInfo getImmutableSamplerInfo (const TextureProxy *proxy) const override
 
UniqueKey makeGraphicsPipelineKey (const GraphicsPipelineDesc &, const RenderPassDesc &) const override
 
UniqueKey makeComputePipelineKey (const ComputePipelineDesc &) const override
 
GraphiteResourceKey makeSamplerKey (const SamplerDesc &) const override
 
uint32_t channelMask (const TextureInfo &) const override
 
bool isRenderable (const TextureInfo &) const override
 
bool isStorage (const TextureInfo &) const override
 
void buildKeyForTexture (SkISize dimensions, const TextureInfo &, ResourceType, Shareable, GraphiteResourceKey *) const override
 
bool shouldAlwaysUseDedicatedImageMemory () const
 
bool gpuOnlyBuffersMorePerformant () const
 
bool shouldPersistentlyMapCpuToGpuBuffers () const
 
bool supportsYcbcrConversion () const
 
bool supportsDeviceFaultInfo () const
 
uint32_t maxVertexAttributes () const
 
uint64_t maxUniformBufferRange () const
 
const VkPhysicalDeviceMemoryProperties2physicalDeviceMemoryProperties2 () const
 
bool isTransferSrc (const VulkanTextureInfo &) const
 
bool isTransferDst (const VulkanTextureInfo &) const
 
- Public Member Functions inherited from skgpu::graphite::Caps
virtual ~Caps ()
 
const SkSL::ShaderCapsshaderCaps () const
 
sk_sp< SkCapabilitiescapabilities () const
 
virtual TextureInfo getDefaultSampledTextureInfo (SkColorType, Mipmapped mipmapped, Protected, Renderable) const =0
 
virtual TextureInfo getTextureInfoForSampledCopy (const TextureInfo &textureInfo, Mipmapped mipmapped) const =0
 
virtual TextureInfo getDefaultCompressedTextureInfo (SkTextureCompressionType, Mipmapped mipmapped, Protected) const =0
 
virtual TextureInfo getDefaultMSAATextureInfo (const TextureInfo &singleSampledInfo, Discardable discardable) const =0
 
virtual TextureInfo getDefaultDepthStencilTextureInfo (SkEnumBitMask< DepthStencilFlags >, uint32_t sampleCount, Protected) const =0
 
virtual TextureInfo getDefaultStorageTextureInfo (SkColorType) const =0
 
virtual SkISize getDepthAttachmentDimensions (const TextureInfo &, const SkISize colorAttachmentDimensions) const
 
virtual UniqueKey makeGraphicsPipelineKey (const GraphicsPipelineDesc &, const RenderPassDesc &) const =0
 
virtual UniqueKey makeComputePipelineKey (const ComputePipelineDesc &) const =0
 
virtual GraphiteResourceKey makeSamplerKey (const SamplerDesc &samplerDesc) const
 
virtual ImmutableSamplerInfo getImmutableSamplerInfo (const TextureProxy *) const
 
virtual bool extractGraphicsDescs (const UniqueKey &, GraphicsPipelineDesc *, RenderPassDesc *, const RendererProvider *) const
 
bool areColorTypeAndTextureInfoCompatible (SkColorType, const TextureInfo &) const
 
virtual uint32_t channelMask (const TextureInfo &) const =0
 
bool isTexturable (const TextureInfo &) const
 
virtual bool isRenderable (const TextureInfo &) const =0
 
virtual bool isStorage (const TextureInfo &) const =0
 
int maxTextureSize () const
 
int defaultMSAASamplesCount () const
 
virtual void buildKeyForTexture (SkISize dimensions, const TextureInfo &, ResourceType, Shareable, GraphiteResourceKey *) const =0
 
const ResourceBindingRequirementsresourceBindingRequirements () const
 
size_t requiredUniformBufferAlignment () const
 
size_t requiredStorageBufferAlignment () const
 
size_t requiredTransferBufferAlignment () const
 
size_t getAlignedTextureDataRowBytes (size_t rowBytes) const
 
virtual bool supportsWritePixels (const TextureInfo &textureInfo) const =0
 
virtual bool supportsReadPixels (const TextureInfo &textureInfo) const =0
 
virtual std::pair< SkColorType, bool > supportedWritePixelsColorType (SkColorType dstColorType, const TextureInfo &dstTextureInfo, SkColorType srcColorType) const =0
 
virtual std::pair< SkColorType, bool > supportedReadPixelsColorType (SkColorType srcColorType, const TextureInfo &srcTextureInfo, SkColorType dstColorType) const =0
 
SkColorType getRenderableColorType (SkColorType) const
 
bool clampToBorderSupport () const
 
bool protectedSupport () const
 
bool semaphoreSupport () const
 
bool allowCpuSync () const
 
bool storageBufferSupport () const
 
bool storageBufferPreferred () const
 
bool drawBufferCanBeMapped () const
 
bool bufferMapsAreAsync () const
 
bool msaaRenderToSingleSampledSupport () const
 
bool computeSupport () const
 
bool supportsAHardwareBufferImages () const
 
skgpu::Swizzle getReadSwizzle (SkColorType, const TextureInfo &) const
 
skgpu::Swizzle getWriteSwizzle (SkColorType, const TextureInfo &) const
 
skgpu::ShaderErrorHandlershaderErrorHandler () const
 
DstReadRequirement getDstReadRequirement () const
 
float minDistanceFieldFontSize () const
 
float glyphsAsPathsFontSize () const
 
size_t glyphCacheTextureMaximumBytes () const
 
int maxPathAtlasTextureSize () const
 
bool allowMultipleAtlasTextures () const
 
bool supportBilerpFromGlyphAtlas () const
 
bool requireOrderedRecordings () const
 
bool fullCompressedUploadSizeMustAlignToBlockDims () const
 
sktext::gpu::SDFTControl getSDFTControl (bool useSDFTForSmallText) const
 
bool setBackendLabels () const
 

Additional Inherited Members

- Protected Member Functions inherited from skgpu::graphite::Caps
 Caps ()
 
void finishInitialization (const ContextOptions &)
 
- Static Protected Member Functions inherited from skgpu::graphite::Caps
static uint32_t SamplesToKey (uint32_t numSamples)
 
- Protected Attributes inherited from skgpu::graphite::Caps
int fMaxTextureSize = 0
 
int fDefaultMSAASamples = 4
 
size_t fRequiredUniformBufferAlignment = 0
 
size_t fRequiredStorageBufferAlignment = 0
 
size_t fRequiredTransferBufferAlignment = 0
 
size_t fTextureDataRowBytesAlignment = 1
 
std::unique_ptr< SkSL::ShaderCapsfShaderCaps
 
bool fClampToBorderSupport = true
 
bool fProtectedSupport = false
 
bool fSemaphoreSupport = false
 
bool fAllowCpuSync = true
 
bool fStorageBufferSupport = false
 
bool fStorageBufferPreferred = false
 
bool fDrawBufferCanBeMapped = true
 
bool fBufferMapsAreAsync = false
 
bool fMSAARenderToSingleSampledSupport = false
 
bool fComputeSupport = false
 
bool fSupportsAHardwareBufferImages = false
 
bool fFullCompressedUploadSizeMustAlignToBlockDims = false
 
ResourceBindingRequirements fResourceBindingReqs
 
ShaderErrorHandlerfShaderErrorHandler = nullptr
 
size_t fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4
 
float fMinDistanceFieldFontSize = 18
 
float fGlyphsAsPathsFontSize = 324
 
int fMaxPathAtlasTextureSize = 8192
 
bool fAllowMultipleAtlasTextures = true
 
bool fSupportBilerpFromGlyphAtlas = false
 
bool fRequireOrderedRecordings = false
 
bool fSetBackendLabels = false
 

Detailed Description

Definition at line 20 of file VulkanCaps.h.

Constructor & Destructor Documentation

◆ VulkanCaps()

skgpu::graphite::VulkanCaps::VulkanCaps ( const ContextOptions contextOptions,
const skgpu::VulkanInterface vkInterface,
VkPhysicalDevice  physDev,
uint32_t  physicalDeviceVersion,
const VkPhysicalDeviceFeatures2 features,
const skgpu::VulkanExtensions extensions,
Protected  isProtected 
)

Definition at line 35 of file VulkanCaps.cpp.

42 : Caps() {
43 this->init(contextOptions, vkInterface, physDev, physicalDeviceVersion, features, extensions,
44 isProtected);
45}

◆ ~VulkanCaps()

skgpu::graphite::VulkanCaps::~VulkanCaps ( )
override

Definition at line 47 of file VulkanCaps.cpp.

47{}

Member Function Documentation

◆ buildKeyForTexture()

void skgpu::graphite::VulkanCaps::buildKeyForTexture ( SkISize  dimensions,
const TextureInfo info,
ResourceType  type,
Shareable  shareable,
GraphiteResourceKey key 
) const
overridevirtual

Implements skgpu::graphite::Caps.

Definition at line 1473 of file VulkanCaps.cpp.

1477 {
1478 SkASSERT(!dimensions.isEmpty());
1479
1480 const VulkanTextureSpec& vkSpec = info.vulkanTextureSpec();
1481 // We expect that the VkFormat enum is at most a 32-bit value.
1482 static_assert(VK_FORMAT_MAX_ENUM == 0x7FFFFFFF);
1483 // We should either be using a known VkFormat or have a valid ycbcr conversion.
1484 SkASSERT(vkSpec.fFormat != VK_FORMAT_UNDEFINED || vkSpec.fYcbcrConversionInfo.isValid());
1485
1486 uint32_t format = static_cast<uint32_t>(vkSpec.fFormat);
1487 uint32_t samples = SamplesToKey(info.numSamples());
1488 // We don't have to key the number of mip levels because it is inherit in the combination of
1489 // isMipped and dimensions.
1490 bool isMipped = info.mipmapped() == Mipmapped::kYes;
1491 Protected isProtected = info.isProtected();
1492
1493 // Confirm all the below parts of the key can fit in a single uint32_t. The sum of the shift
1494 // amounts in the asserts must be less than or equal to 32. vkSpec.fFlags will go into its
1495 // own 32-bit block.
1496 SkASSERT(samples < (1u << 3)); // sample key is first 3 bits
1497 SkASSERT(static_cast<uint32_t>(isMipped) < (1u << 1)); // isMapped is 4th bit
1498 SkASSERT(static_cast<uint32_t>(isProtected) < (1u << 1)); // isProtected is 5th bit
1499 SkASSERT(vkSpec.fImageTiling < (1u << 1)); // imageTiling is 6th bit
1500 SkASSERT(vkSpec.fSharingMode < (1u << 1)); // sharingMode is 7th bit
1501 SkASSERT(vkSpec.fAspectMask < (1u << 11)); // aspectMask is bits 8 - 19
1502 SkASSERT(vkSpec.fImageUsageFlags < (1u << 12)); // imageUsageFlags are bits 20-32
1503
1504 // We need two uint32_ts for dimensions, 1 for format, and 2 for the rest of the information.
1505 static constexpr int kNum32DataCntNoYcbcr = 2 + 1 + 2;
1506 int num32DataCnt = kNum32DataCntNoYcbcr;
1507
1508 // If a texture w/ an external format is being used, that information must also be appended.
1509 const VulkanYcbcrConversionInfo& ycbcrInfo = info.vulkanTextureSpec().fYcbcrConversionInfo;
1510 num32DataCnt += ycbcrPackaging::numInt32sNeeded(ycbcrInfo);
1511
1512 GraphiteResourceKey::Builder builder(key, type, num32DataCnt, shareable);
1513
1514 int i = 0;
1515 builder[i++] = dimensions.width();
1516 builder[i++] = dimensions.height();
1517
1518 if (ycbcrInfo.isValid()) {
1519 SkASSERT(ycbcrInfo.fFormat != VK_FORMAT_UNDEFINED || ycbcrInfo.fExternalFormat != 0);
1520 bool useExternalFormat = ycbcrInfo.fFormat == VK_FORMAT_UNDEFINED;
1522 if (useExternalFormat) {
1523 builder[i++] = (uint32_t)ycbcrInfo.fExternalFormat;
1524 builder[i++] = (uint32_t)(ycbcrInfo.fExternalFormat >> 32);
1525 } else {
1526 builder[i++] = ycbcrInfo.fFormat;
1527 }
1528 } else {
1529 builder[i++] = format;
1530 }
1531
1532 builder[i++] = (static_cast<uint32_t>(vkSpec.fFlags));
1533 builder[i++] = (samples << 0 ) |
1534 (static_cast<uint32_t>(isMipped) << 3 ) |
1535 (static_cast<uint32_t>(isProtected) << 4 ) |
1536 (static_cast<uint32_t>(vkSpec.fImageTiling) << 5 ) |
1537 (static_cast<uint32_t>(vkSpec.fSharingMode) << 6 ) |
1538 (static_cast<uint32_t>(vkSpec.fAspectMask) << 7 ) |
1539 (static_cast<uint32_t>(vkSpec.fImageUsageFlags) << 19);
1540 SkASSERT(i == num32DataCnt);
1541}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
#define SkASSERT(cond)
Definition: SkAssert.h:116
GLenum type
static uint32_t SamplesToKey(uint32_t numSamples)
Definition: Caps.h:314
uint32_t uint32_t * format
DlVertices::Builder Builder
int numInt32sNeeded(const VulkanYcbcrConversionInfo &conversionInfo)
uint32_t nonFormatInfoAsUInt32(const VulkanYcbcrConversionInfo &conversionInfo)
Protected
Definition: GpuTypes.h:61
bool isEmpty() const
Definition: SkSize.h:31
constexpr int32_t width() const
Definition: SkSize.h:36
constexpr int32_t height() const
Definition: SkSize.h:37
@ VK_FORMAT_UNDEFINED
Definition: vulkan_core.h:1459
@ VK_FORMAT_MAX_ENUM
Definition: vulkan_core.h:1763

◆ channelMask()

uint32_t skgpu::graphite::VulkanCaps::channelMask ( const TextureInfo textureInfo) const
overridevirtual

Implements skgpu::graphite::Caps.

Definition at line 404 of file VulkanCaps.cpp.

404 {
405 return skgpu::VkFormatChannels(textureInfo.vulkanTextureSpec().fFormat);
406}
static constexpr uint32_t VkFormatChannels(VkFormat vkFormat)

◆ getDefaultCompressedTextureInfo()

TextureInfo skgpu::graphite::VulkanCaps::getDefaultCompressedTextureInfo ( SkTextureCompressionType  compression,
Mipmapped  mipmapped,
Protected  isProtected 
) const
overridevirtual

Implements skgpu::graphite::Caps.

Definition at line 291 of file VulkanCaps.cpp.

293 {
294 VkFormat format = format_from_compression(compression);
295 const FormatInfo& formatInfo = this->getFormatInfo(format);
296 static constexpr int defaultSampleCount = 1;
297 if ((isProtected == Protected::kYes && !this->protectedSupport()) ||
298 !formatInfo.isTexturable(VK_IMAGE_TILING_OPTIMAL)) {
299 return {};
300 }
301
302 VulkanTextureInfo info;
303 info.fSampleCount = defaultSampleCount;
304 info.fMipmapped = mipmapped;
305 info.fFlags = (isProtected == Protected::kYes) ? VK_IMAGE_CREATE_PROTECTED_BIT : 0;
306 info.fFormat = format;
307 info.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
308 info.fImageUsageFlags = VK_IMAGE_USAGE_SAMPLED_BIT |
311 info.fSharingMode = VK_SHARING_MODE_EXCLUSIVE;
312 info.fAspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
313
314 return info;
315}
bool protectedSupport() const
Definition: Caps.h:226
@ VK_SHARING_MODE_EXCLUSIVE
Definition: vulkan_core.h:1813
@ VK_IMAGE_CREATE_PROTECTED_BIT
Definition: vulkan_core.h:2320
@ VK_IMAGE_TILING_OPTIMAL
Definition: vulkan_core.h:1767
@ VK_IMAGE_ASPECT_COLOR_BIT
Definition: vulkan_core.h:2238
@ VK_IMAGE_USAGE_TRANSFER_DST_BIT
Definition: vulkan_core.h:2353
@ VK_IMAGE_USAGE_SAMPLED_BIT
Definition: vulkan_core.h:2354
@ VK_IMAGE_USAGE_TRANSFER_SRC_BIT
Definition: vulkan_core.h:2352
VkFormat
Definition: vulkan_core.h:1458

◆ getDefaultDepthStencilTextureInfo()

TextureInfo skgpu::graphite::VulkanCaps::getDefaultDepthStencilTextureInfo ( SkEnumBitMask< DepthStencilFlags flags,
uint32_t  sampleCount,
Protected  isProtected 
) const
overridevirtual

Implements skgpu::graphite::Caps.

Definition at line 355 of file VulkanCaps.cpp.

357 {
358 VkFormat format = this->getFormatFromDepthStencilFlags(flags);
359 const DepthStencilFormatInfo& formatInfo = this->getDepthStencilFormatInfo(format);
360 if ( (isProtected == Protected::kYes && !this->protectedSupport()) ||
361 !formatInfo.isDepthStencilSupported(formatInfo.fFormatProperties.optimalTilingFeatures) ||
362 !formatInfo.fSupportedSampleCounts.isSampleCountSupported(sampleCount)) {
363 return {};
364 }
365
366 VulkanTextureInfo info;
367 info.fSampleCount = sampleCount;
368 info.fMipmapped = Mipmapped::kNo;
369 info.fFlags = (isProtected == Protected::kYes) ? VK_IMAGE_CREATE_PROTECTED_BIT : 0;
370 info.fFormat = format;
371 info.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
372 // TODO: Passing in a discardable flag to this method, and if true, add the TRANSIENT bit.
374 info.fSharingMode = VK_SHARING_MODE_EXCLUSIVE;
375 info.fAspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
376
377 return info;
378}
FlutterSemanticsFlag flags
@ VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
Definition: vulkan_core.h:2357

◆ getDefaultMSAATextureInfo()

TextureInfo skgpu::graphite::VulkanCaps::getDefaultMSAATextureInfo ( const TextureInfo singleSampledInfo,
Discardable  discardable 
) const
overridevirtual

Graphite, unlike ganesh, does not require a dedicated MSAA attachment on every surface. MSAA textures now get resolved within the scope of a render pass, which can be done simply with the color attachment usage flag. So we no longer require transfer src/dst usage flags.

Implements skgpu::graphite::Caps.

Definition at line 317 of file VulkanCaps.cpp.

318 {
319 if (fDefaultMSAASamples <= 1) {
320 return {};
321 }
322
323 const VkFormat singleSpecFormat = singleSampledInfo.vulkanTextureSpec().fFormat;
324 const FormatInfo& formatInfo = this->getFormatInfo(singleSpecFormat);
325 if ((singleSampledInfo.isProtected() == Protected::kYes && !this->protectedSupport()) ||
326 !formatInfo.isRenderable(VK_IMAGE_TILING_OPTIMAL, fDefaultMSAASamples)) {
327 return {};
328 }
329
330 VulkanTextureInfo info;
331 info.fSampleCount = fDefaultMSAASamples;
332 info.fMipmapped = Mipmapped::kNo;
333 info.fFlags = (singleSampledInfo.isProtected() == Protected::kYes) ?
335 info.fFormat = singleSpecFormat;
336 info.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
337
338 /**
339 * Graphite, unlike ganesh, does not require a dedicated MSAA attachment on every surface.
340 * MSAA textures now get resolved within the scope of a render pass, which can be done simply
341 * with the color attachment usage flag. So we no longer require transfer src/dst usage flags.
342 */
344 if (discardable == Discardable::kYes && fSupportsMemorylessAttachments) {
346 }
347
348 info.fImageUsageFlags = flags;
349 info.fSharingMode = VK_SHARING_MODE_EXCLUSIVE;
350 info.fAspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
351
352 return info;
353}
int fDefaultMSAASamples
Definition: Caps.h:357
VkFlags VkImageUsageFlags
Definition: vulkan_core.h:2382
@ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
Definition: vulkan_core.h:2356
@ VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
Definition: vulkan_core.h:2358

◆ getDefaultSampledTextureInfo()

TextureInfo skgpu::graphite::VulkanCaps::getDefaultSampledTextureInfo ( SkColorType  ct,
Mipmapped  mipmapped,
Protected  isProtected,
Renderable  isRenderable 
) const
overridevirtual

Implements skgpu::graphite::Caps.

Definition at line 223 of file VulkanCaps.cpp.

226 {
227 VkFormat format = this->getFormatFromColorType(ct);
228 const FormatInfo& formatInfo = this->getFormatInfo(format);
229 static constexpr int defaultSampleCount = 1;
230 if ((isProtected == Protected::kYes && !this->protectedSupport()) ||
231 !formatInfo.isTexturable(VK_IMAGE_TILING_OPTIMAL) ||
233 !formatInfo.isRenderable(VK_IMAGE_TILING_OPTIMAL, defaultSampleCount)) ) {
234 return {};
235 }
236
237 VulkanTextureInfo info;
238 info.fSampleCount = defaultSampleCount;
239 info.fMipmapped = mipmapped;
240 info.fFlags = (isProtected == Protected::kYes) ? VK_IMAGE_CREATE_PROTECTED_BIT : 0;
241 info.fFormat = format;
242 info.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
243 info.fImageUsageFlags = VK_IMAGE_USAGE_SAMPLED_BIT |
247 // We make all renderable images support being used as input attachment
248 info.fImageUsageFlags = info.fImageUsageFlags |
251 }
252 info.fSharingMode = VK_SHARING_MODE_EXCLUSIVE;
253 info.fAspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
254
255 return info;
256}
bool isRenderable(const TextureInfo &) const override
@ VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
Definition: vulkan_core.h:2359

◆ getDefaultStorageTextureInfo()

TextureInfo skgpu::graphite::VulkanCaps::getDefaultStorageTextureInfo ( SkColorType  colorType) const
overridevirtual

Implements skgpu::graphite::Caps.

Definition at line 380 of file VulkanCaps.cpp.

380 {
381 VkFormat format = this->getFormatFromColorType(colorType);
382 const FormatInfo& formatInfo = this->getFormatInfo(format);
383 if (!formatInfo.isTexturable(VK_IMAGE_TILING_OPTIMAL) ||
384 !formatInfo.isStorage(VK_IMAGE_TILING_OPTIMAL)) {
385 return {};
386 }
387
388 VulkanTextureInfo info;
389 info.fSampleCount = 1;
390 info.fMipmapped = Mipmapped::kNo;
391 info.fFlags = 0;
392 info.fFormat = format;
393 info.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
394 // Storage textures are currently always sampleable from a shader
395 info.fImageUsageFlags = VK_IMAGE_USAGE_STORAGE_BIT |
398 info.fSharingMode = VK_SHARING_MODE_EXCLUSIVE;
399 info.fAspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
400
401 return info;
402}
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
@ VK_IMAGE_USAGE_STORAGE_BIT
Definition: vulkan_core.h:2355

◆ getImmutableSamplerInfo()

ImmutableSamplerInfo skgpu::graphite::VulkanCaps::getImmutableSamplerInfo ( const TextureProxy proxy) const
overridevirtual

Reimplemented from skgpu::graphite::Caps.

Definition at line 1543 of file VulkanCaps.cpp.

1543 {
1544 if (proxy) {
1545 const skgpu::VulkanYcbcrConversionInfo& ycbcrConversionInfo =
1546 proxy->textureInfo().vulkanTextureSpec().fYcbcrConversionInfo;
1547
1548 if (ycbcrConversionInfo.isValid()) {
1549 ImmutableSamplerInfo immutableSamplerInfo;
1550 // ycbcrConversionInfo's fFormat being VK_FORMAT_UNDEFINED indicates we are using an
1551 // external format rather than a known VkFormat.
1552 immutableSamplerInfo.fFormat = ycbcrConversionInfo.fFormat == VK_FORMAT_UNDEFINED
1553 ? ycbcrConversionInfo.fExternalFormat
1554 : ycbcrConversionInfo.fFormat;
1555 immutableSamplerInfo.fNonFormatYcbcrConversionInfo =
1556 ycbcrPackaging::nonFormatInfoAsUInt32(ycbcrConversionInfo);
1557 return immutableSamplerInfo;
1558 }
1559 }
1560
1561 // If the proxy is null or the YCbCr conversion for that proxy is invalid, then return a
1562 // default ImmutableSamplerInfo struct.
1563 return {};
1564}

◆ getTextureInfoForSampledCopy()

TextureInfo skgpu::graphite::VulkanCaps::getTextureInfoForSampledCopy ( const TextureInfo textureInfo,
Mipmapped  mipmapped 
) const
overridevirtual

Implements skgpu::graphite::Caps.

Definition at line 258 of file VulkanCaps.cpp.

259 {
260 VulkanTextureInfo info;
261 if (!textureInfo.getVulkanTextureInfo(&info)) {
262 return {};
263 }
264
265 info.fSampleCount = 1;
266 info.fMipmapped = mipmapped;
267 info.fFlags = (textureInfo.fProtected == Protected::kYes) ? VK_IMAGE_CREATE_PROTECTED_BIT : 0;
268 info.fImageTiling = VK_IMAGE_TILING_OPTIMAL;
271 info.fSharingMode = VK_SHARING_MODE_EXCLUSIVE;
272
273 return info;
274}

◆ gpuOnlyBuffersMorePerformant()

bool skgpu::graphite::VulkanCaps::gpuOnlyBuffersMorePerformant ( ) const
inline

Definition at line 79 of file VulkanCaps.h.

79{ return fGpuOnlyBuffersMorePerformant; }

◆ isRenderable()

bool skgpu::graphite::VulkanCaps::isRenderable ( const TextureInfo texInfo) const
overridevirtual

Implements skgpu::graphite::Caps.

Definition at line 1282 of file VulkanCaps.cpp.

1282 {
1283 VulkanTextureInfo vkInfo;
1284 if (!texInfo.getVulkanTextureInfo(&vkInfo)) {
1285 return false;
1286 }
1287
1288 const FormatInfo& info = this->getFormatInfo(vkInfo.fFormat);
1289 return info.isRenderable(vkInfo.fImageTiling, texInfo.numSamples());
1290}

◆ isStorage()

bool skgpu::graphite::VulkanCaps::isStorage ( const TextureInfo texInfo) const
overridevirtual

Implements skgpu::graphite::Caps.

Definition at line 1292 of file VulkanCaps.cpp.

1292 {
1293 VulkanTextureInfo vkInfo;
1294 if (!texInfo.getVulkanTextureInfo(&vkInfo)) {
1295 return false;
1296 }
1297
1298 const FormatInfo& info = this->getFormatInfo(vkInfo.fFormat);
1299 return info.isStorage(vkInfo.fImageTiling);
1300}

◆ isTransferDst()

bool skgpu::graphite::VulkanCaps::isTransferDst ( const VulkanTextureInfo vkInfo) const

Definition at line 1307 of file VulkanCaps.cpp.

1307 {
1308 const FormatInfo& info = this->getFormatInfo(vkInfo.fFormat);
1309 return info.isTransferDst(vkInfo.fImageTiling);
1310}

◆ isTransferSrc()

bool skgpu::graphite::VulkanCaps::isTransferSrc ( const VulkanTextureInfo vkInfo) const

Definition at line 1302 of file VulkanCaps.cpp.

1302 {
1303 const FormatInfo& info = this->getFormatInfo(vkInfo.fFormat);
1304 return info.isTransferSrc(vkInfo.fImageTiling);
1305}

◆ makeComputePipelineKey()

UniqueKey skgpu::graphite::VulkanCaps::makeComputePipelineKey ( const ComputePipelineDesc ) const
inlineoverridevirtual

Implements skgpu::graphite::Caps.

Definition at line 56 of file VulkanCaps.h.

56{ return {}; }

◆ makeGraphicsPipelineKey()

UniqueKey skgpu::graphite::VulkanCaps::makeGraphicsPipelineKey ( const GraphicsPipelineDesc pipelineDesc,
const RenderPassDesc renderPassDesc 
) const
overridevirtual

Implements skgpu::graphite::Caps.

Definition at line 1422 of file VulkanCaps.cpp.

1423 {
1424 UniqueKey pipelineKey;
1425 {
1428
1429 VulkanRenderPass::VulkanRenderPassMetaData rpMetaData {renderPassDesc};
1430
1431 // Reserve 3 uint32s for the render step id, paint id, and write swizzle.
1432 static constexpr int kUint32sNeededForPipelineInfo = 3;
1433 // The uint32s needed for a RenderPass is variable number, so consult rpMetaData to
1434 // determine how many to reserve.
1435 UniqueKey::Builder builder(&pipelineKey,
1437 kUint32sNeededForPipelineInfo + rpMetaData.fUint32DataCnt,
1438 "GraphicsPipeline");
1439
1440 int idx = 0;
1441 // Add GraphicsPipelineDesc information
1442 builder[idx++] = pipelineDesc.renderStepID();
1443 builder[idx++] = pipelineDesc.paintParamsID().asUInt();
1444 // Add RenderPass info relevant for pipeline creation that's not captured in RenderPass keys
1445 builder[idx++] = renderPassDesc.fWriteSwizzle.asKey();
1446 // Add RenderPassDesc information
1447 VulkanRenderPass::AddRenderPassInfoToKey(rpMetaData, builder, idx, /*compatibleOnly=*/true);
1448
1449 builder.finish();
1450 }
1451
1452 return pipelineKey;
1453}
static Domain GenerateDomain()
Definition: ResourceKey.cpp:27
static void AddRenderPassInfoToKey(VulkanRenderPassMetaData &rpMetaData, ResourceKey::Builder &builder, int &builderIdx, bool compatibleOnly)
static const skgpu::UniqueKey::Domain kGraphicsPipelineDomain
Definition: MtlCaps.mm:895

◆ makeSamplerKey()

GraphiteResourceKey skgpu::graphite::VulkanCaps::makeSamplerKey ( const SamplerDesc samplerDesc) const
overridevirtual

Reimplemented from skgpu::graphite::Caps.

Definition at line 1455 of file VulkanCaps.cpp.

1455 {
1456 GraphiteResourceKey samplerKey;
1457 const SkSpan<const uint32_t>& samplerData = samplerDesc.asSpan();
1458 static const ResourceType kSamplerType = GraphiteResourceKey::GenerateResourceType();
1459 // Non-format ycbcr and sampler information are guaranteed to fit within one uint32, so the size
1460 // of the returned span accurately captures the quantity of uint32s needed whether the sampler
1461 // is immutable or not.
1462 GraphiteResourceKey::Builder builder(&samplerKey, kSamplerType, samplerData.size(),
1464
1465 for (size_t i = 0; i < samplerData.size(); i++) {
1466 builder[i] = samplerData[i];
1467 }
1468
1469 builder.finish();
1470 return samplerKey;
1471}
constexpr size_t size() const
Definition: SkSpan_impl.h:95
uint32_t ResourceType

◆ maxUniformBufferRange()

uint64_t skgpu::graphite::VulkanCaps::maxUniformBufferRange ( ) const
inline

Definition at line 95 of file VulkanCaps.h.

95{ return fMaxUniformBufferRange; }

◆ maxVertexAttributes()

uint32_t skgpu::graphite::VulkanCaps::maxVertexAttributes ( ) const
inline

Definition at line 92 of file VulkanCaps.h.

92 {
93 return fMaxVertexAttributes;
94 }

◆ physicalDeviceMemoryProperties2()

const VkPhysicalDeviceMemoryProperties2 & skgpu::graphite::VulkanCaps::physicalDeviceMemoryProperties2 ( ) const
inline

Definition at line 97 of file VulkanCaps.h.

97 {
98 return fPhysicalDeviceMemoryProperties2;
99 }

◆ shouldAlwaysUseDedicatedImageMemory()

bool skgpu::graphite::VulkanCaps::shouldAlwaysUseDedicatedImageMemory ( ) const
inline

Definition at line 71 of file VulkanCaps.h.

71 {
72 return fShouldAlwaysUseDedicatedImageMemory;
73 }

◆ shouldPersistentlyMapCpuToGpuBuffers()

bool skgpu::graphite::VulkanCaps::shouldPersistentlyMapCpuToGpuBuffers ( ) const
inline

Definition at line 84 of file VulkanCaps.h.

84 {
85 return fShouldPersistentlyMapCpuToGpuBuffers;
86 }

◆ supportsDeviceFaultInfo()

bool skgpu::graphite::VulkanCaps::supportsDeviceFaultInfo ( ) const
inline

Definition at line 90 of file VulkanCaps.h.

90{ return fSupportsDeviceFaultInfo; }

◆ supportsYcbcrConversion()

bool skgpu::graphite::VulkanCaps::supportsYcbcrConversion ( ) const
inline

Definition at line 88 of file VulkanCaps.h.

88{ return fSupportsYcbcrConversion; }

The documentation for this class was generated from the following files: