Revert "[graphite] Add Caps::channelMask()"
This reverts commit 8bb23e3b8943a010de83ac6cb27a1aa45253d86f.
Reason for revert: Link issues with Google3
Original change's description:
> [graphite] Add Caps::channelMask()
>
> Bug: b/238756380
> Change-Id: I855a424a1f10a14f521920aabedcaa24404a81ae
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/650956
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
Bug: b/238756380
Change-Id: I5599ca3427c7c0c2a4012131269894d153c33875
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/651757
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
diff --git a/src/gpu/ganesh/mtl/GrMtlUtil.mm b/src/gpu/ganesh/mtl/GrMtlUtil.mm
index ecdf84f..7f30bbf 100644
--- a/src/gpu/ganesh/mtl/GrMtlUtil.mm
+++ b/src/gpu/ganesh/mtl/GrMtlUtil.mm
@@ -230,7 +230,31 @@
}
uint32_t GrMtlFormatChannels(GrMTLPixelFormat mtlFormat) {
- return skgpu::MtlFormatChannels((MTLPixelFormat)mtlFormat);
+ switch (mtlFormat) {
+ case MTLPixelFormatRGBA8Unorm: return kRGBA_SkColorChannelFlags;
+ case MTLPixelFormatR8Unorm: return kRed_SkColorChannelFlag;
+ case MTLPixelFormatA8Unorm: return kAlpha_SkColorChannelFlag;
+ case MTLPixelFormatBGRA8Unorm: return kRGBA_SkColorChannelFlags;
+ case MTLPixelFormatB5G6R5Unorm: return kRGB_SkColorChannelFlags;
+ case MTLPixelFormatRGBA16Float: return kRGBA_SkColorChannelFlags;
+ case MTLPixelFormatR16Float: return kRed_SkColorChannelFlag;
+ case MTLPixelFormatRG8Unorm: return kRG_SkColorChannelFlags;
+ case MTLPixelFormatRGB10A2Unorm: return kRGBA_SkColorChannelFlags;
+ case MTLPixelFormatBGR10A2Unorm: return kRGBA_SkColorChannelFlags;
+ case MTLPixelFormatABGR4Unorm: return kRGBA_SkColorChannelFlags;
+ case MTLPixelFormatRGBA8Unorm_sRGB: return kRGBA_SkColorChannelFlags;
+ case MTLPixelFormatR16Unorm: return kRed_SkColorChannelFlag;
+ case MTLPixelFormatRG16Unorm: return kRG_SkColorChannelFlags;
+ case MTLPixelFormatETC2_RGB8: return kRGB_SkColorChannelFlags;
+#ifdef SK_BUILD_FOR_MAC
+ case MTLPixelFormatBC1_RGBA: return kRGBA_SkColorChannelFlags;
+#endif
+ case MTLPixelFormatRGBA16Unorm: return kRGBA_SkColorChannelFlags;
+ case MTLPixelFormatRG16Float: return kRG_SkColorChannelFlags;
+ case MTLPixelFormatStencil8: return 0;
+
+ default: return 0;
+ }
}
GrColorFormatDesc GrMtlFormatDesc(GrMTLPixelFormat mtlFormat) {
diff --git a/src/gpu/graphite/Caps.h b/src/gpu/graphite/Caps.h
index 92547db..2822c39 100644
--- a/src/gpu/graphite/Caps.h
+++ b/src/gpu/graphite/Caps.h
@@ -75,7 +75,6 @@
virtual UniqueKey makeComputePipelineKey(const ComputePipelineDesc&) const = 0;
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;
diff --git a/src/gpu/graphite/dawn/DawnCaps.cpp b/src/gpu/graphite/dawn/DawnCaps.cpp
index d0f4a04..ab15ce6 100644
--- a/src/gpu/graphite/dawn/DawnCaps.cpp
+++ b/src/gpu/graphite/dawn/DawnCaps.cpp
@@ -50,11 +50,6 @@
DawnCaps::~DawnCaps() = default;
-uint32_t DawnCaps::channelMask(const TextureInfo&) const {
- // TODO(b/238756380): Move GrDawnFormatChannels() to shared loc and use
- return 0;
-}
-
bool DawnCaps::onIsTexturable(const TextureInfo& info) const {
if (!(info.dawnTextureSpec().fUsage & wgpu::TextureUsage::TextureBinding)) {
return false;
diff --git a/src/gpu/graphite/dawn/DawnCaps.h b/src/gpu/graphite/dawn/DawnCaps.h
index e0ff873..d5152c2 100644
--- a/src/gpu/graphite/dawn/DawnCaps.h
+++ b/src/gpu/graphite/dawn/DawnCaps.h
@@ -34,7 +34,6 @@
UniqueKey makeGraphicsPipelineKey(const GraphicsPipelineDesc&,
const RenderPassDesc&) const override;
UniqueKey makeComputePipelineKey(const ComputePipelineDesc&) const override;
- uint32_t channelMask(const TextureInfo&) const override;
bool isRenderable(const TextureInfo&) const override;
void buildKeyForTexture(SkISize dimensions,
const TextureInfo&,
diff --git a/src/gpu/graphite/mtl/MtlCaps.h b/src/gpu/graphite/mtl/MtlCaps.h
index f50b4bf..20217f4 100644
--- a/src/gpu/graphite/mtl/MtlCaps.h
+++ b/src/gpu/graphite/mtl/MtlCaps.h
@@ -45,8 +45,6 @@
bool isMac() const { return fGPUFamily == GPUFamily::kMac; }
bool isApple()const { return fGPUFamily == GPUFamily::kApple; }
- uint32_t channelMask(const TextureInfo&) const override;
-
bool isRenderable(const TextureInfo&) const override;
void buildKeyForTexture(SkISize dimensions,
diff --git a/src/gpu/graphite/mtl/MtlCaps.mm b/src/gpu/graphite/mtl/MtlCaps.mm
index c5e0711..023ebc4 100644
--- a/src/gpu/graphite/mtl/MtlCaps.mm
+++ b/src/gpu/graphite/mtl/MtlCaps.mm
@@ -713,10 +713,6 @@
return pipelineKey;
}
-uint32_t MtlCaps::channelMask(const TextureInfo& info) const {
- return skgpu::MtlFormatChannels((MTLPixelFormat)info.mtlTextureSpec().fFormat);
-}
-
bool MtlCaps::onIsTexturable(const TextureInfo& info) const {
if (!(info.mtlTextureSpec().fUsage & MTLTextureUsageShaderRead)) {
return false;
diff --git a/src/gpu/graphite/vk/VulkanCaps.cpp b/src/gpu/graphite/vk/VulkanCaps.cpp
index a142150..09a68ae 100644
--- a/src/gpu/graphite/vk/VulkanCaps.cpp
+++ b/src/gpu/graphite/vk/VulkanCaps.cpp
@@ -13,7 +13,6 @@
#include "include/gpu/vk/VulkanExtensions.h"
#include "src/gpu/ganesh/TestFormatColorTypeCombination.h"
#include "src/gpu/graphite/vk/VulkanGraphiteUtilsPriv.h"
-#include "src/gpu/vk/VulkanUtilsPriv.h"
#ifdef SK_BUILD_FOR_ANDROID
#include <sys/system_properties.h>
@@ -220,10 +219,6 @@
return info;
}
-uint32_t VulkanCaps::channelMask(const TextureInfo& textureInfo) const {
- return skgpu::VkFormatChannels(textureInfo.vulkanTextureSpec().fFormat);
-}
-
void VulkanCaps::initFormatTable(const skgpu::VulkanInterface* interface,
VkPhysicalDevice physDev,
const VkPhysicalDeviceProperties& properties) {
diff --git a/src/gpu/graphite/vk/VulkanCaps.h b/src/gpu/graphite/vk/VulkanCaps.h
index a5d5028..6756cda 100644
--- a/src/gpu/graphite/vk/VulkanCaps.h
+++ b/src/gpu/graphite/vk/VulkanCaps.h
@@ -41,8 +41,6 @@
const RenderPassDesc&) const override { return {}; }
UniqueKey makeComputePipelineKey(const ComputePipelineDesc&) const override { return {}; }
- uint32_t channelMask(const TextureInfo&) const override;
-
bool isRenderable(const TextureInfo&) const override { return false; }
void buildKeyForTexture(SkISize dimensions,
diff --git a/src/gpu/mtl/MtlUtils.mm b/src/gpu/mtl/MtlUtils.mm
index 6af0ad0..2a3071f 100644
--- a/src/gpu/mtl/MtlUtils.mm
+++ b/src/gpu/mtl/MtlUtils.mm
@@ -8,7 +8,6 @@
#include "src/gpu/mtl/MtlUtilsPriv.h"
#include "include/gpu/ShaderErrorHandler.h"
-#include "src/core/SkImageInfoPriv.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLProgramSettings.h"
#include "src/utils/SkShaderUtils.h"
@@ -92,34 +91,6 @@
}
}
-uint32_t MtlFormatChannels(MTLPixelFormat mtlFormat) {
- switch (mtlFormat) {
- case MTLPixelFormatRGBA8Unorm: return kRGBA_SkColorChannelFlags;
- case MTLPixelFormatR8Unorm: return kRed_SkColorChannelFlag;
- case MTLPixelFormatA8Unorm: return kAlpha_SkColorChannelFlag;
- case MTLPixelFormatBGRA8Unorm: return kRGBA_SkColorChannelFlags;
- case MTLPixelFormatB5G6R5Unorm: return kRGB_SkColorChannelFlags;
- case MTLPixelFormatRGBA16Float: return kRGBA_SkColorChannelFlags;
- case MTLPixelFormatR16Float: return kRed_SkColorChannelFlag;
- case MTLPixelFormatRG8Unorm: return kRG_SkColorChannelFlags;
- case MTLPixelFormatRGB10A2Unorm: return kRGBA_SkColorChannelFlags;
- case MTLPixelFormatBGR10A2Unorm: return kRGBA_SkColorChannelFlags;
- case MTLPixelFormatABGR4Unorm: return kRGBA_SkColorChannelFlags;
- case MTLPixelFormatRGBA8Unorm_sRGB: return kRGBA_SkColorChannelFlags;
- case MTLPixelFormatR16Unorm: return kRed_SkColorChannelFlag;
- case MTLPixelFormatRG16Unorm: return kRG_SkColorChannelFlags;
- case MTLPixelFormatETC2_RGB8: return kRGB_SkColorChannelFlags;
-#ifdef SK_BUILD_FOR_MAC
- case MTLPixelFormatBC1_RGBA: return kRGBA_SkColorChannelFlags;
-#endif
- case MTLPixelFormatRGBA16Unorm: return kRGBA_SkColorChannelFlags;
- case MTLPixelFormatRG16Float: return kRG_SkColorChannelFlags;
- case MTLPixelFormatStencil8: return 0;
-
- default: return 0;
- }
-}
-
// Print the source code for all shaders generated.
#ifdef SK_PRINT_SKSL_SHADERS
static const bool gPrintSKSL = true;
diff --git a/src/gpu/mtl/MtlUtilsPriv.h b/src/gpu/mtl/MtlUtilsPriv.h
index 806b1eb..5d7ff08 100644
--- a/src/gpu/mtl/MtlUtilsPriv.h
+++ b/src/gpu/mtl/MtlUtilsPriv.h
@@ -26,8 +26,6 @@
bool MtlFormatIsStencil(MTLPixelFormat);
bool MtlFormatIsCompressed(MTLPixelFormat);
-uint32_t MtlFormatChannels(MTLPixelFormat);
-
#if defined(SK_DEBUG) || GR_TEST_UTILS
const char* MtlFormatToString(MTLPixelFormat);
#endif