Experimental: Add R_16 and RG_1616 to Ganesh
This is to support the P016 and P010 YUV formats. Initially, only Vulkan and GL support these formats.
Change-Id: Ie9609e59c12528079f8d379359ddb9bac85b6a29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218546
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrDataUtils.cpp b/src/gpu/GrDataUtils.cpp
index d6c787e..b835245 100644
--- a/src/gpu/GrDataUtils.cpp
+++ b/src/gpu/GrDataUtils.cpp
@@ -262,6 +262,21 @@
sk_memset64((uint64_t *) dest, rgbaHalf, width * height);
break;
}
+ // Experimental (for P016 and P010)
+ case kR_16_GrPixelConfig: {
+ uint16_t r16 = SkScalarRoundToInt(colorf.fR * 65535.0f);
+ sk_memset16((uint16_t*) dest, r16, width * height);
+ break;
+ }
+ case kRG_1616_GrPixelConfig: {
+ uint16_t r16 = SkScalarRoundToInt(colorf.fR * 65535.0f);
+ uint16_t g16 = SkScalarRoundToInt(colorf.fG * 65535.0f);
+
+ uint32_t rg1616 = r16 << 16 | g16;
+
+ sk_memset32((uint32_t*) dest, rg1616, width * height);
+ break;
+ }
default:
return false;
break;