Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Unified Diff: src/gpu/vk/GrVkCaps.h

Issue 1847963003: Update vulkan format features in caps. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: review nits Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/vk/GrVkCaps.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkCaps.h
diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h
index 5834b151fdef20d93da394d6991eb98dce0c2193..50f5c8fa87a1edbe6f04df4a2b411255852b6331 100644
--- a/src/gpu/vk/GrVkCaps.h
+++ b/src/gpu/vk/GrVkCaps.h
@@ -31,42 +31,48 @@ public:
bool isConfigTexturable(GrPixelConfig config) const override {
SkASSERT(kGrPixelConfigCnt > config);
- return fConfigTextureSupport[config];
+ return SkToBool(ConfigInfo::kTextureable_Flag & fConfigTable[config].fOptimalFlags);
}
bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const override {
SkASSERT(kGrPixelConfigCnt > config);
- return fConfigRenderSupport[config][withMSAA];
+ return SkToBool(ConfigInfo::kRenderable_Flag & fConfigTable[config].fOptimalFlags);
+ }
+
+ bool isConfigTexurableLinearly(GrPixelConfig config) const {
+ SkASSERT(kGrPixelConfigCnt > config);
+ return SkToBool(ConfigInfo::kTextureable_Flag & fConfigTable[config].fLinearFlags);
}
bool isConfigRenderableLinearly(GrPixelConfig config, bool withMSAA) const {
SkASSERT(kGrPixelConfigCnt > config);
- return fConfigLinearRenderSupport[config][withMSAA];
+ return !withMSAA && SkToBool(ConfigInfo::kRenderable_Flag &
+ fConfigTable[config].fLinearFlags);
}
- bool isConfigTexurableLinearly(GrPixelConfig config) const {
+ bool configCanBeDstofBlit(GrPixelConfig config, bool linearTiled) const {
SkASSERT(kGrPixelConfigCnt > config);
- return fConfigLinearTextureSupport[config];
+ const uint16_t& flags = linearTiled ? fConfigTable[config].fLinearFlags :
+ fConfigTable[config].fOptimalFlags;
+ return SkToBool(ConfigInfo::kBlitDst_Flag & flags);
}
- bool canUseGLSLForShaderModule() const {
- return fCanUseGLSLForShaderModule;
+ bool configCanBeSrcofBlit(GrPixelConfig config, bool linearTiled) const {
+ SkASSERT(kGrPixelConfigCnt > config);
+ const uint16_t& flags = linearTiled ? fConfigTable[config].fLinearFlags :
+ fConfigTable[config].fOptimalFlags;
+ return SkToBool(ConfigInfo::kBlitSrc_Flag & flags);
}
- /**
- * Gets an array of legal stencil formats. These formats are not guaranteed to be supported by
- * the driver but are legal VK_TEXTURE_FORMATs.
- */
- const SkTArray<StencilFormat, true>& stencilFormats() const {
- return fStencilFormats;
+ bool canUseGLSLForShaderModule() const {
+ return fCanUseGLSLForShaderModule;
}
/**
- * Gets an array of legal stencil formats. These formats are not guaranteed to be supported by
- * the driver but are legal VK_TEXTURE_FORMATs.
+ * Returns both a supported and most prefered stencil format to use in draws.
*/
- const SkTArray<StencilFormat, true>& linearStencilFormats() const {
- return fLinearStencilFormats;
+ const StencilFormat& preferedStencilFormat() const {
+ return fPreferedStencilFormat;
}
GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fShaderCaps.get()); }
@@ -79,22 +85,30 @@ private:
uint32_t featureFlags);
void initGLSLCaps(const VkPhysicalDeviceProperties&, uint32_t featureFlags);
void initSampleCount(const VkPhysicalDeviceProperties& properties);
- void initConfigRenderableTable(const GrVkInterface* iface, VkPhysicalDevice physDev);
- void initConfigTexturableTable(const GrVkInterface* iface, VkPhysicalDevice physDev);
- void initStencilFormats(const GrVkInterface* iface, VkPhysicalDevice physDev);
- bool fConfigTextureSupport[kGrPixelConfigCnt];
- // For Vulkan we track whether a config is supported linearly (without need for swizzling)
- bool fConfigLinearTextureSupport[kGrPixelConfigCnt];
+ void initConfigTable(const GrVkInterface*, VkPhysicalDevice);
+ void initStencilFormat(const GrVkInterface* iface, VkPhysicalDevice physDev);
+
+ struct ConfigInfo {
+ ConfigInfo() : fOptimalFlags(0), fLinearFlags(0) {}
+
+ void init(const GrVkInterface*, VkPhysicalDevice, VkFormat);
+ static void InitConfigFlags(VkFormatFeatureFlags, uint16_t* flags);
- // The first entry for each config is without msaa and the second is with.
- bool fConfigRenderSupport[kGrPixelConfigCnt][2];
- // The first entry for each config is without msaa and the second is with.
- bool fConfigLinearRenderSupport[kGrPixelConfigCnt][2];
+ enum {
+ kTextureable_Flag = 0x1,
+ kRenderable_Flag = 0x2,
+ kBlitSrc_Flag = 0x4,
+ kBlitDst_Flag = 0x8,
+ };
- SkTArray<StencilFormat, true> fLinearStencilFormats;
- SkTArray<StencilFormat, true> fStencilFormats;
+ uint16_t fOptimalFlags;
+ uint16_t fLinearFlags;
+ };
+ ConfigInfo fConfigTable[kGrPixelConfigCnt];
+
+ StencilFormat fPreferedStencilFormat;
// Tells of if we can pass in straight GLSL string into vkCreateShaderModule
bool fCanUseGLSLForShaderModule;
« no previous file with comments | « no previous file | src/gpu/vk/GrVkCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698