Chromium Code Reviews| Index: src/gpu/vk/GrVkCaps.h |
| diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h |
| index 5834b151fdef20d93da394d6991eb98dce0c2193..ad57eb45cfb5856393d6919aa7b49fe49803a624 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].fOptimimalFlags); |
| } |
| bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const override { |
| SkASSERT(kGrPixelConfigCnt > config); |
| - return fConfigRenderSupport[config][withMSAA]; |
| + return SkToBool(ConfigInfo::kRenderable_Flag & fConfigTable[config].fOptimimalFlags); |
| + } |
| + |
| + 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].fOptimimalFlags; |
| + 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].fOptimimalFlags; |
| + 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() : fOptimimalFlags(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 fOptimimalFlags; |
|
jvanverth1
2016/04/01 13:30:20
fOptimalFlags
egdaniel
2016/04/01 16:59:01
Done.
|
| + uint16_t fLinearFlags; |
| + }; |
| + ConfigInfo fConfigTable[kGrPixelConfigCnt]; |
| + |
| + StencilFormat fPreferedStencilFormat; |
| // Tells of if we can pass in straight GLSL string into vkCreateShaderModule |
| bool fCanUseGLSLForShaderModule; |