Some improvements to backend texture creation.
This initializes more formats correctly with solid colors and relies
less on GrPixelConfig.
It also includes the changes to get gray8 read pixels working
and almost everything to initialize GL_RGB8 textures with data. Minor
stuff to follow to get RGB8 fully working and update test expectations.
Bug: skia:8962
Bug: skia:6718
Bug: skia:9358
Change-Id: Ic044b4c4badc37f14fb46c898cd3b3c21a6fc7fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251199
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index bdb3c3c..fcc43bd 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -299,6 +299,7 @@
#ifndef SK_IGNORE_GPU_DITHER
static inline int32_t dither_range_type_for_config(GrColorType dstColorType) {
switch (dstColorType) {
+ case GrColorType::kUnknown:
case GrColorType::kGray_8:
case GrColorType::kRGBA_8888:
case GrColorType::kRGB_888x:
@@ -307,12 +308,6 @@
case GrColorType::kRG_1616:
case GrColorType::kRGBA_16161616:
case GrColorType::kRG_F16:
- return 0;
- case GrColorType::kBGR_565:
- return 1;
- case GrColorType::kABGR_4444:
- return 2;
- case GrColorType::kUnknown:
case GrColorType::kRGBA_8888_SRGB:
case GrColorType::kRGBA_1010102:
case GrColorType::kAlpha_F16:
@@ -324,7 +319,16 @@
case GrColorType::kAlpha_16:
case GrColorType::kAlpha_F32xxx:
case GrColorType::kGray_8xxx:
- return -1;
+ case GrColorType::kRGB_888:
+ case GrColorType::kR_8:
+ case GrColorType::kR_16:
+ case GrColorType::kR_F16:
+ case GrColorType::kGray_F16:
+ return 0;
+ case GrColorType::kBGR_565:
+ return 1;
+ case GrColorType::kABGR_4444:
+ return 2;
}
SkUNREACHABLE;
}