From a7a2324f14eda784b48d7ac53d5772b4fc7bcf3f Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Tue, 8 Feb 2022 10:34:38 -0500 Subject: [PATCH] Reland "Add kR8_unorm_SkColorType" This is a reland of 3225c8cc46890bbd0ecf8893db204ee77ecb28a1 Original change's description: > Add kR8_unorm_SkColorType > > Change-Id: I97b5bc7f90715664f233ca7b7c41c0ecbfc29ac4 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505679 > Reviewed-by: Michael Ludwig > Reviewed-by: Greg Daniel > Commit-Queue: Brian Osman Change-Id: I73fa17625d57e0e58da1b70e2e59ba200383cfe7 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506460 Bot-Commit: Rubber Stamper Commit-Queue: Brian Osman --- dm/DM.cpp | 1 + docs/examples/unexpected_setAlphaType.cpp | 1 + gm/bitmapcopy.cpp | 1 + include/core/SkImageInfo.h | 3 +- include/private/GrTypesPriv.h | 10 ++++++- include/private/SkImageInfoPriv.h | 10 +++++-- infra/bots/gen_tasks_logic/dm_flags.go | 2 +- infra/bots/tasks.json | 4 +-- src/core/SkConvertPixels.cpp | 3 +- src/core/SkImageInfo.cpp | 2 ++ src/core/SkMipmap.cpp | 1 + src/core/SkPixmap.cpp | 6 ++++ src/core/SkRasterPipeline.cpp | 9 ++++++ src/core/SkRasterPipeline.h | 2 ++ src/core/SkRasterPipelineBlitter.cpp | 25 +++++++++++----- src/core/SkVM.cpp | 5 ++-- src/core/SkVMBlitter.cpp | 24 +++++++++++----- src/gpu/GrDataUtils.cpp | 10 ++++++- src/gpu/GrSwizzle.cpp | 3 ++ src/gpu/SkGr.cpp | 1 + src/gpu/d3d/GrD3DCaps.cpp | 9 +++++- src/gpu/gl/GrGLCaps.cpp | 35 ++++++++++++++++++++++- src/gpu/mtl/GrMtlCaps.mm | 8 +++++- src/gpu/vk/GrVkCaps.cpp | 10 ++++++- src/images/SkPngEncoder.cpp | 1 + src/opts/SkRasterPipeline_opts.h | 27 +++++++++++++++++ src/shaders/SkImageShader.cpp | 3 ++ tests/BackendAllocationTest.cpp | 1 + tests/ReadWritePixelsGpuTest.cpp | 2 ++ tools/HashAndEncode.cpp | 10 +++++++ tools/ToolUtils.cpp | 2 ++ tools/flags/CommonFlagsConfig.cpp | 4 +++ 32 files changed, 206 insertions(+), 29 deletions(-) diff --git a/dm/DM.cpp b/dm/DM.cpp index 55d57da2a7..9179327485 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -989,6 +989,7 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi if (FLAGS_cpu) { SINK("g8", RasterSink, kGray_8_SkColorType); + SINK("r8", RasterSink, kR8_unorm_SkColorType); SINK("565", RasterSink, kRGB_565_SkColorType); SINK("4444", RasterSink, kARGB_4444_SkColorType); SINK("8888", RasterSink, kN32_SkColorType); diff --git a/docs/examples/unexpected_setAlphaType.cpp b/docs/examples/unexpected_setAlphaType.cpp index 8c3daf2298..a87701779e 100644 --- a/docs/examples/unexpected_setAlphaType.cpp +++ b/docs/examples/unexpected_setAlphaType.cpp @@ -36,6 +36,7 @@ static const char* colortype_name(SkColorType ct) { case kR16G16_unorm_SkColorType: return "R16G16_unorm"; case kR16G16_float_SkColorType: return "R16G16_float"; case kR16G16B16A16_unorm_SkColorType: return "R16G16B16A16_unorm"; + case kR8_unorm_SkColorType: return "R8_unorm"; } SkASSERT(false); return "unexpected colortype"; diff --git a/gm/bitmapcopy.cpp b/gm/bitmapcopy.cpp index f3f3820ca9..8e3368dae0 100644 --- a/gm/bitmapcopy.cpp +++ b/gm/bitmapcopy.cpp @@ -49,6 +49,7 @@ static const char* color_type_name(SkColorType colorType) { case kR16G16_float_SkColorType: return "R16G16_float"; case kR16G16B16A16_unorm_SkColorType: return "R16G16B16A16_unorm"; case kSRGBA_8888_SkColorType: return "SRGBA_8888"; + case kR8_unorm_SkColorType: return "R8_unorm"; } return ""; } diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h index 99b65e8751..c48e99fb4c 100644 --- a/include/core/SkImageInfo.h +++ b/include/core/SkImageInfo.h @@ -92,8 +92,9 @@ enum SkColorType : int { // and alpha kSRGBA_8888_SkColorType, + kR8_unorm_SkColorType, - kLastEnum_SkColorType = kSRGBA_8888_SkColorType, //!< last valid value + kLastEnum_SkColorType = kR8_unorm_SkColorType, //!< last valid value #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) kN32_SkColorType = kBGRA_8888_SkColorType,//!< native 32-bit BGRA encoding diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h index fb00c2e7fd..7c9c44c287 100644 --- a/include/private/GrTypesPriv.h +++ b/include/private/GrTypesPriv.h @@ -603,6 +603,7 @@ enum class GrColorType { kAlpha_8xxx, kAlpha_F32xxx, kGray_8xxx, + kR_8xxx, // Types used to initialize backend textures. kRGB_888, @@ -640,12 +641,13 @@ static constexpr SkColorType GrColorTypeToSkColorType(GrColorType ct) { case GrColorType::kAlpha_8xxx: return kUnknown_SkColorType; case GrColorType::kAlpha_F32xxx: return kUnknown_SkColorType; case GrColorType::kGray_8xxx: return kUnknown_SkColorType; + case GrColorType::kR_8xxx: return kUnknown_SkColorType; case GrColorType::kAlpha_16: return kA16_unorm_SkColorType; case GrColorType::kRG_1616: return kR16G16_unorm_SkColorType; case GrColorType::kRGBA_16161616: return kR16G16B16A16_unorm_SkColorType; case GrColorType::kRG_F16: return kR16G16_float_SkColorType; case GrColorType::kRGB_888: return kUnknown_SkColorType; - case GrColorType::kR_8: return kUnknown_SkColorType; + case GrColorType::kR_8: return kR8_unorm_SkColorType; case GrColorType::kR_16: return kUnknown_SkColorType; case GrColorType::kR_F16: return kUnknown_SkColorType; case GrColorType::kGray_F16: return kUnknown_SkColorType; @@ -679,6 +681,7 @@ static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct) { case kA16_float_SkColorType: return GrColorType::kAlpha_F16; case kR16G16_float_SkColorType: return GrColorType::kRG_F16; case kR16G16B16A16_unorm_SkColorType: return GrColorType::kRGBA_16161616; + case kR8_unorm_SkColorType: return GrColorType::kR_8; } SkUNREACHABLE; } @@ -705,6 +708,7 @@ static constexpr uint32_t GrColorTypeChannelFlags(GrColorType ct) { case GrColorType::kAlpha_8xxx: return kAlpha_SkColorChannelFlag; case GrColorType::kAlpha_F32xxx: return kAlpha_SkColorChannelFlag; case GrColorType::kGray_8xxx: return kGray_SkColorChannelFlag; + case GrColorType::kR_8xxx: return kRed_SkColorChannelFlag; case GrColorType::kAlpha_16: return kAlpha_SkColorChannelFlag; case GrColorType::kRG_1616: return kRG_SkColorChannelFlags; case GrColorType::kRGBA_16161616: return kRGBA_SkColorChannelFlags; @@ -855,6 +859,8 @@ static constexpr GrColorFormatDesc GrGetColorTypeDesc(GrColorType ct) { return GrColorFormatDesc::MakeAlpha(32, GrColorTypeEncoding::kFloat); case GrColorType::kGray_8xxx: return GrColorFormatDesc::MakeGray(8, GrColorTypeEncoding::kUnorm); + case GrColorType::kR_8xxx: + return GrColorFormatDesc::MakeR(8, GrColorTypeEncoding::kUnorm); case GrColorType::kAlpha_16: return GrColorFormatDesc::MakeAlpha(16, GrColorTypeEncoding::kUnorm); case GrColorType::kRG_1616: @@ -931,6 +937,7 @@ static constexpr size_t GrColorTypeBytesPerPixel(GrColorType ct) { case GrColorType::kAlpha_8xxx: return 4; case GrColorType::kAlpha_F32xxx: return 16; case GrColorType::kGray_8xxx: return 4; + case GrColorType::kR_8xxx: return 4; case GrColorType::kAlpha_16: return 2; case GrColorType::kRG_1616: return 4; case GrColorType::kRGBA_16161616: return 8; @@ -1045,6 +1052,7 @@ static constexpr const char* GrColorTypeToStr(GrColorType ct) { case GrColorType::kAlpha_8xxx: return "kAlpha_8xxx"; case GrColorType::kAlpha_F32xxx: return "kAlpha_F32xxx"; case GrColorType::kGray_8xxx: return "kGray_8xxx"; + case GrColorType::kR_8xxx: return "kR_8xxx"; case GrColorType::kAlpha_16: return "kAlpha_16"; case GrColorType::kRG_1616: return "kRG_1616"; case GrColorType::kRGBA_16161616: return "kRGBA_16161616"; diff --git a/include/private/SkImageInfoPriv.h b/include/private/SkImageInfoPriv.h index 5e4abb82c1..70b9d715f0 100644 --- a/include/private/SkImageInfoPriv.h +++ b/include/private/SkImageInfoPriv.h @@ -35,6 +35,7 @@ static inline uint32_t SkColorTypeChannelFlags(SkColorType ct) { case kR16G16_float_SkColorType: return kRG_SkColorChannelFlags; case kR16G16B16A16_unorm_SkColorType: return kRGBA_SkColorChannelFlags; case kSRGBA_8888_SkColorType: return kRGBA_SkColorChannelFlags; + case kR8_unorm_SkColorType: return kRed_SkColorChannelFlag; } SkUNREACHABLE; } @@ -71,6 +72,7 @@ static int SkColorTypeShiftPerPixel(SkColorType ct) { case kR16G16_float_SkColorType: return 2; case kR16G16B16A16_unorm_SkColorType: return 3; case kSRGBA_8888_SkColorType: return 2; + case kR8_unorm_SkColorType: return 0; } SkUNREACHABLE; } @@ -110,11 +112,14 @@ static inline bool SkColorTypeIsNormalized(SkColorType ct) { case kA16_float_SkColorType: /*subtle... alpha is always [0,1]*/ case kR16G16_unorm_SkColorType: case kR16G16B16A16_unorm_SkColorType: - case kSRGBA_8888_SkColorType: return true; + case kSRGBA_8888_SkColorType: + case kR8_unorm_SkColorType: + return true; case kRGBA_F16_SkColorType: case kRGBA_F32_SkColorType: - case kR16G16_float_SkColorType: return false; + case kR16G16_float_SkColorType: + return false; } SkUNREACHABLE; } @@ -137,6 +142,7 @@ static inline int SkColorTypeMaxBitsPerChannel(SkColorType ct) { case kGray_8_SkColorType: case kR8G8_unorm_SkColorType: case kSRGBA_8888_SkColorType: + case kR8_unorm_SkColorType: return 8; case kRGBA_1010102_SkColorType: diff --git a/infra/bots/gen_tasks_logic/dm_flags.go b/infra/bots/gen_tasks_logic/dm_flags.go index 39770e42a1..8caecca7bc 100644 --- a/infra/bots/gen_tasks_logic/dm_flags.go +++ b/infra/bots/gen_tasks_logic/dm_flags.go @@ -506,7 +506,7 @@ func (b *taskBuilder) dmFlags(internalHardwareLabel string) { // Test rendering to wrapped dsts on a few bots // Also test "narrow-glf16", which hits F16 surfaces and F16 vertex colors. if b.extraConfig("BonusConfigs") { - configs = []string{"glbetex", "glbert", "narrow-glf16", "glreducedshaders"} + configs = []string{"glbetex", "glbert", "narrow-glf16", "glreducedshaders", "glr8"} } if b.os("ChromeOS") { diff --git a/infra/bots/tasks.json b/infra/bots/tasks.json index d029b77613..ce2f56451b 100755 --- a/infra/bots/tasks.json +++ b/infra/bots/tasks.json @@ -55412,7 +55412,7 @@ "skia/infra/bots/run_recipe.py", "${ISOLATED_OUTDIR}", "test", - "{\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"buildbucket_build_id\":\"<(BUILDBUCKET_BUILD_ID)\",\"buildername\":\"Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-BonusConfigs\",\"dm_flags\":\"[\\\"dm\\\",\\\"--nameByHash\\\",\\\"--key\\\",\\\"arch\\\",\\\"x86_64\\\",\\\"compiler\\\",\\\"Clang\\\",\\\"configuration\\\",\\\"Debug\\\",\\\"cpu_or_gpu\\\",\\\"GPU\\\",\\\"cpu_or_gpu_value\\\",\\\"QuadroP400\\\",\\\"extra_config\\\",\\\"BonusConfigs\\\",\\\"model\\\",\\\"Golo\\\",\\\"os\\\",\\\"Win10\\\",\\\"style\\\",\\\"default\\\",\\\"--randomProcessorTest\\\",\\\"--nocpu\\\",\\\"--config\\\",\\\"glbetex\\\",\\\"glbert\\\",\\\"narrow-glf16\\\",\\\"glreducedshaders\\\",\\\"--src\\\",\\\"tests\\\",\\\"gm\\\",\\\"image\\\",\\\"colorImage\\\",\\\"svg\\\",\\\"--skip\\\",\\\"_\\\",\\\"svg\\\",\\\"_\\\",\\\"svgparse_\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"pal8os2v2.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"pal8os2v2-16.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rgba32abf.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rgb24prof.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rgb24lprof.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"8bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"4bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"32bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"24bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"testimgari.jpg\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rle8-height-negative.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rle4-height-negative.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"error\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\"interlaced1.png\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\"interlaced2.png\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\"interlaced3.png\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".arw\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".cr2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".dng\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".nef\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".nrw\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".orf\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".raf\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".rw2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".pef\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".srw\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".ARW\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".CR2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".DNG\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".NEF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".NRW\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".ORF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".RAF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".RW2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".PEF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".SRW\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Arrays_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Structs_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Types_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Vectors_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLCommaSideEffects\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLMatrixConstructorsES2_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLMatrixConstructorsES3_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLMatrixFoldingES2_GPU\\\",\\\"--nonativeFonts\\\",\\\"--verbose\\\"]\",\"dm_properties\":\"{\\\"buildbucket_build_id\\\":\\\"<(BUILDBUCKET_BUILD_ID)\\\",\\\"builder\\\":\\\"Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-BonusConfigs\\\",\\\"gitHash\\\":\\\"<(REVISION)\\\",\\\"issue\\\":\\\"<(ISSUE)\\\",\\\"patch_storage\\\":\\\"<(PATCH_STORAGE)\\\",\\\"patchset\\\":\\\"<(PATCHSET)\\\",\\\"swarming_bot_id\\\":\\\"${SWARMING_BOT_ID}\\\",\\\"swarming_task_id\\\":\\\"${SWARMING_TASK_ID}\\\",\\\"task_id\\\":\\\"<(TASK_ID)\\\"}\",\"do_upload\":\"true\",\"gold_hashes_url\":\"https://gold.skia.org/json/v1/hashes\",\"images\":\"true\",\"patch_issue\":\"<(ISSUE_INT)\",\"patch_ref\":\"<(PATCH_REF)\",\"patch_repo\":\"<(PATCH_REPO)\",\"patch_set\":\"<(PATCHSET_INT)\",\"patch_storage\":\"<(PATCH_STORAGE)\",\"repository\":\"<(REPO)\",\"resources\":\"true\",\"revision\":\"<(REVISION)\",\"skps\":\"true\",\"svgs\":\"true\",\"swarm_out_dir\":\"test\",\"task_id\":\"<(TASK_ID)\"}", + "{\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"buildbucket_build_id\":\"<(BUILDBUCKET_BUILD_ID)\",\"buildername\":\"Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-BonusConfigs\",\"dm_flags\":\"[\\\"dm\\\",\\\"--nameByHash\\\",\\\"--key\\\",\\\"arch\\\",\\\"x86_64\\\",\\\"compiler\\\",\\\"Clang\\\",\\\"configuration\\\",\\\"Debug\\\",\\\"cpu_or_gpu\\\",\\\"GPU\\\",\\\"cpu_or_gpu_value\\\",\\\"QuadroP400\\\",\\\"extra_config\\\",\\\"BonusConfigs\\\",\\\"model\\\",\\\"Golo\\\",\\\"os\\\",\\\"Win10\\\",\\\"style\\\",\\\"default\\\",\\\"--randomProcessorTest\\\",\\\"--nocpu\\\",\\\"--config\\\",\\\"glbetex\\\",\\\"glbert\\\",\\\"narrow-glf16\\\",\\\"glreducedshaders\\\",\\\"glr8\\\",\\\"--src\\\",\\\"tests\\\",\\\"gm\\\",\\\"image\\\",\\\"colorImage\\\",\\\"svg\\\",\\\"--skip\\\",\\\"_\\\",\\\"svg\\\",\\\"_\\\",\\\"svgparse_\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"pal8os2v2.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"pal8os2v2-16.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rgba32abf.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rgb24prof.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rgb24lprof.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"8bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"4bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"32bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"24bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"testimgari.jpg\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rle8-height-negative.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rle4-height-negative.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"error\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\"interlaced1.png\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\"interlaced2.png\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\"interlaced3.png\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".arw\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".cr2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".dng\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".nef\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".nrw\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".orf\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".raf\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".rw2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".pef\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".srw\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".ARW\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".CR2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".DNG\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".NEF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".NRW\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".ORF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".RAF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".RW2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".PEF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".SRW\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Arrays_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Structs_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Types_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Vectors_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLCommaSideEffects\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLMatrixConstructorsES2_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLMatrixConstructorsES3_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLMatrixFoldingES2_GPU\\\",\\\"--nonativeFonts\\\",\\\"--verbose\\\"]\",\"dm_properties\":\"{\\\"buildbucket_build_id\\\":\\\"<(BUILDBUCKET_BUILD_ID)\\\",\\\"builder\\\":\\\"Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-BonusConfigs\\\",\\\"gitHash\\\":\\\"<(REVISION)\\\",\\\"issue\\\":\\\"<(ISSUE)\\\",\\\"patch_storage\\\":\\\"<(PATCH_STORAGE)\\\",\\\"patchset\\\":\\\"<(PATCHSET)\\\",\\\"swarming_bot_id\\\":\\\"${SWARMING_BOT_ID}\\\",\\\"swarming_task_id\\\":\\\"${SWARMING_TASK_ID}\\\",\\\"task_id\\\":\\\"<(TASK_ID)\\\"}\",\"do_upload\":\"true\",\"gold_hashes_url\":\"https://gold.skia.org/json/v1/hashes\",\"images\":\"true\",\"patch_issue\":\"<(ISSUE_INT)\",\"patch_ref\":\"<(PATCH_REF)\",\"patch_repo\":\"<(PATCH_REPO)\",\"patch_set\":\"<(PATCHSET_INT)\",\"patch_storage\":\"<(PATCH_STORAGE)\",\"repository\":\"<(REPO)\",\"resources\":\"true\",\"revision\":\"<(REVISION)\",\"skps\":\"true\",\"svgs\":\"true\",\"swarm_out_dir\":\"test\",\"task_id\":\"<(TASK_ID)\"}", "skia" ], "dependencies": [ @@ -56249,7 +56249,7 @@ "skia/infra/bots/run_recipe.py", "${ISOLATED_OUTDIR}", "test", - "{\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"buildbucket_build_id\":\"<(BUILDBUCKET_BUILD_ID)\",\"buildername\":\"Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-BonusConfigs\",\"dm_flags\":\"[\\\"dm\\\",\\\"--nameByHash\\\",\\\"--key\\\",\\\"arch\\\",\\\"x86_64\\\",\\\"compiler\\\",\\\"Clang\\\",\\\"configuration\\\",\\\"Release\\\",\\\"cpu_or_gpu\\\",\\\"GPU\\\",\\\"cpu_or_gpu_value\\\",\\\"QuadroP400\\\",\\\"extra_config\\\",\\\"BonusConfigs\\\",\\\"model\\\",\\\"Golo\\\",\\\"os\\\",\\\"Win10\\\",\\\"style\\\",\\\"default\\\",\\\"--randomProcessorTest\\\",\\\"--nocpu\\\",\\\"--config\\\",\\\"glbetex\\\",\\\"glbert\\\",\\\"narrow-glf16\\\",\\\"glreducedshaders\\\",\\\"--src\\\",\\\"tests\\\",\\\"gm\\\",\\\"image\\\",\\\"colorImage\\\",\\\"svg\\\",\\\"--skip\\\",\\\"_\\\",\\\"svg\\\",\\\"_\\\",\\\"svgparse_\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"pal8os2v2.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"pal8os2v2-16.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rgba32abf.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rgb24prof.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rgb24lprof.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"8bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"4bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"32bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"24bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"testimgari.jpg\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rle8-height-negative.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rle4-height-negative.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"error\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\"interlaced1.png\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\"interlaced2.png\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\"interlaced3.png\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".arw\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".cr2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".dng\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".nef\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".nrw\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".orf\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".raf\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".rw2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".pef\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".srw\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".ARW\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".CR2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".DNG\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".NEF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".NRW\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".ORF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".RAF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".RW2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".PEF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".SRW\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Arrays_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Structs_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Types_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Vectors_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLCommaSideEffects\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLMatrixConstructorsES2_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLMatrixConstructorsES3_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLMatrixFoldingES2_GPU\\\",\\\"--nonativeFonts\\\",\\\"--verbose\\\"]\",\"dm_properties\":\"{\\\"buildbucket_build_id\\\":\\\"<(BUILDBUCKET_BUILD_ID)\\\",\\\"builder\\\":\\\"Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-BonusConfigs\\\",\\\"gitHash\\\":\\\"<(REVISION)\\\",\\\"issue\\\":\\\"<(ISSUE)\\\",\\\"patch_storage\\\":\\\"<(PATCH_STORAGE)\\\",\\\"patchset\\\":\\\"<(PATCHSET)\\\",\\\"swarming_bot_id\\\":\\\"${SWARMING_BOT_ID}\\\",\\\"swarming_task_id\\\":\\\"${SWARMING_TASK_ID}\\\",\\\"task_id\\\":\\\"<(TASK_ID)\\\"}\",\"do_upload\":\"true\",\"gold_hashes_url\":\"https://gold.skia.org/json/v1/hashes\",\"images\":\"true\",\"patch_issue\":\"<(ISSUE_INT)\",\"patch_ref\":\"<(PATCH_REF)\",\"patch_repo\":\"<(PATCH_REPO)\",\"patch_set\":\"<(PATCHSET_INT)\",\"patch_storage\":\"<(PATCH_STORAGE)\",\"repository\":\"<(REPO)\",\"resources\":\"true\",\"revision\":\"<(REVISION)\",\"skps\":\"true\",\"svgs\":\"true\",\"swarm_out_dir\":\"test\",\"task_id\":\"<(TASK_ID)\"}", + "{\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"buildbucket_build_id\":\"<(BUILDBUCKET_BUILD_ID)\",\"buildername\":\"Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-BonusConfigs\",\"dm_flags\":\"[\\\"dm\\\",\\\"--nameByHash\\\",\\\"--key\\\",\\\"arch\\\",\\\"x86_64\\\",\\\"compiler\\\",\\\"Clang\\\",\\\"configuration\\\",\\\"Release\\\",\\\"cpu_or_gpu\\\",\\\"GPU\\\",\\\"cpu_or_gpu_value\\\",\\\"QuadroP400\\\",\\\"extra_config\\\",\\\"BonusConfigs\\\",\\\"model\\\",\\\"Golo\\\",\\\"os\\\",\\\"Win10\\\",\\\"style\\\",\\\"default\\\",\\\"--randomProcessorTest\\\",\\\"--nocpu\\\",\\\"--config\\\",\\\"glbetex\\\",\\\"glbert\\\",\\\"narrow-glf16\\\",\\\"glreducedshaders\\\",\\\"glr8\\\",\\\"--src\\\",\\\"tests\\\",\\\"gm\\\",\\\"image\\\",\\\"colorImage\\\",\\\"svg\\\",\\\"--skip\\\",\\\"_\\\",\\\"svg\\\",\\\"_\\\",\\\"svgparse_\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"pal8os2v2.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"pal8os2v2-16.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rgba32abf.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rgb24prof.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rgb24lprof.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"8bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"4bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"32bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"24bpp-pixeldata-cropped.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"testimgari.jpg\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rle8-height-negative.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"rle4-height-negative.bmp\\\",\\\"_\\\",\\\"image\\\",\\\"gen_platf\\\",\\\"error\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\"interlaced1.png\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\"interlaced2.png\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\"interlaced3.png\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".arw\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".cr2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".dng\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".nef\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".nrw\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".orf\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".raf\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".rw2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".pef\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".srw\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".ARW\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".CR2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".DNG\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".NEF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".NRW\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".ORF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".RAF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".RW2\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".PEF\\\",\\\"_\\\",\\\"image\\\",\\\"_\\\",\\\".SRW\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Arrays_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Structs_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Types_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLRecursiveComparison_Vectors_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLCommaSideEffects\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLMatrixConstructorsES2_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLMatrixConstructorsES3_GPU\\\",\\\"_\\\",\\\"tests\\\",\\\"_\\\",\\\"SkSLMatrixFoldingES2_GPU\\\",\\\"--nonativeFonts\\\",\\\"--verbose\\\"]\",\"dm_properties\":\"{\\\"buildbucket_build_id\\\":\\\"<(BUILDBUCKET_BUILD_ID)\\\",\\\"builder\\\":\\\"Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-BonusConfigs\\\",\\\"gitHash\\\":\\\"<(REVISION)\\\",\\\"issue\\\":\\\"<(ISSUE)\\\",\\\"patch_storage\\\":\\\"<(PATCH_STORAGE)\\\",\\\"patchset\\\":\\\"<(PATCHSET)\\\",\\\"swarming_bot_id\\\":\\\"${SWARMING_BOT_ID}\\\",\\\"swarming_task_id\\\":\\\"${SWARMING_TASK_ID}\\\",\\\"task_id\\\":\\\"<(TASK_ID)\\\"}\",\"do_upload\":\"true\",\"gold_hashes_url\":\"https://gold.skia.org/json/v1/hashes\",\"images\":\"true\",\"patch_issue\":\"<(ISSUE_INT)\",\"patch_ref\":\"<(PATCH_REF)\",\"patch_repo\":\"<(PATCH_REPO)\",\"patch_set\":\"<(PATCHSET_INT)\",\"patch_storage\":\"<(PATCH_STORAGE)\",\"repository\":\"<(REPO)\",\"resources\":\"true\",\"revision\":\"<(REVISION)\",\"skps\":\"true\",\"svgs\":\"true\",\"swarm_out_dir\":\"test\",\"task_id\":\"<(TASK_ID)\"}", "skia" ], "dependencies": [ diff --git a/src/core/SkConvertPixels.cpp b/src/core/SkConvertPixels.cpp index f00042b371..ef999d289a 100644 --- a/src/core/SkConvertPixels.cpp +++ b/src/core/SkConvertPixels.cpp @@ -103,7 +103,8 @@ static bool convert_to_alpha8(const SkImageInfo& dstInfo, void* vdst, size case kR16G16_float_SkColorType: case kRGB_888x_SkColorType: case kRGB_101010x_SkColorType: - case kBGR_101010x_SkColorType: { + case kBGR_101010x_SkColorType: + case kR8_unorm_SkColorType: { for (int y = 0; y < srcInfo.height(); ++y) { memset(dst, 0xFF, srcInfo.width()); dst = SkTAddOffset(dst, dstRB); diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp index 48ac09f0e9..d4bb889959 100644 --- a/src/core/SkImageInfo.cpp +++ b/src/core/SkImageInfo.cpp @@ -34,6 +34,7 @@ int SkColorTypeBytesPerPixel(SkColorType ct) { case kR16G16_float_SkColorType: return 4; case kR16G16B16A16_unorm_SkColorType: return 8; case kSRGBA_8888_SkColorType: return 4; + case kR8_unorm_SkColorType: return 1; } SkUNREACHABLE; } @@ -119,6 +120,7 @@ bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType, case kRGB_888x_SkColorType: case kRGB_101010x_SkColorType: case kBGR_101010x_SkColorType: + case kR8_unorm_SkColorType: alphaType = kOpaque_SkAlphaType; break; } diff --git a/src/core/SkMipmap.cpp b/src/core/SkMipmap.cpp index 5074a0003a..70c2c713b1 100644 --- a/src/core/SkMipmap.cpp +++ b/src/core/SkMipmap.cpp @@ -445,6 +445,7 @@ SkMipmap* SkMipmap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact, break; case kAlpha_8_SkColorType: case kGray_8_SkColorType: + case kR8_unorm_SkColorType: proc_1_2 = downsample_1_2; proc_1_3 = downsample_1_3; proc_2_1 = downsample_2_1; diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp index e27bb31251..fb30856dc0 100644 --- a/src/core/SkPixmap.cpp +++ b/src/core/SkPixmap.cpp @@ -109,6 +109,7 @@ float SkPixmap::getAlphaf(int x, int y) const { case kRGB_888x_SkColorType: case kRGB_101010x_SkColorType: case kBGR_101010x_SkColorType: + case kR8_unorm_SkColorType: return 1; case kAlpha_8_SkColorType: value = static_cast(srcPtr)[0] * (1.0f/255); @@ -276,6 +277,10 @@ SkColor SkPixmap::getColor(int x, int y) const { uint8_t value = *this->addr8(x, y); return SkColorSetRGB(value, value, value); } + case kR8_unorm_SkColorType: { + uint8_t value = *this->addr8(x, y); + return SkColorSetRGB(value, 0, 0); + } case kAlpha_8_SkColorType: { return SkColorSetA(0, *this->addr8(x, y)); } @@ -490,6 +495,7 @@ bool SkPixmap::computeIsOpaque() const { case kRGB_888x_SkColorType: case kRGB_101010x_SkColorType: case kBGR_101010x_SkColorType: + case kR8_unorm_SkColorType: return true; break; case kARGB_4444_SkColorType: { diff --git a/src/core/SkRasterPipeline.cpp b/src/core/SkRasterPipeline.cpp index 6d8d68d0ea..74c29eee96 100644 --- a/src/core/SkRasterPipeline.cpp +++ b/src/core/SkRasterPipeline.cpp @@ -190,6 +190,10 @@ void SkRasterPipeline::append_load(SkColorType ct, const SkRasterPipeline_Memory this->append(alpha_to_gray); break; + case kR8_unorm_SkColorType: this->append(load_a8, ctx); + this->append(alpha_to_red); + break; + case kRGB_888x_SkColorType: this->append(load_8888, ctx); this->append(force_opaque); break; @@ -241,6 +245,10 @@ void SkRasterPipeline::append_load_dst(SkColorType ct, const SkRasterPipeline_Me this->append(alpha_to_gray_dst); break; + case kR8_unorm_SkColorType: this->append(load_a8_dst, ctx); + this->append(alpha_to_red_dst); + break; + case kRGB_888x_SkColorType: this->append(load_8888_dst, ctx); this->append(force_opaque_dst); break; @@ -277,6 +285,7 @@ void SkRasterPipeline::append_store(SkColorType ct, const SkRasterPipeline_Memor case kUnknown_SkColorType: SkASSERT(false); break; case kAlpha_8_SkColorType: this->append(store_a8, ctx); break; + case kR8_unorm_SkColorType: this->append(store_r8, ctx); break; case kA16_unorm_SkColorType: this->append(store_a16, ctx); break; case kA16_float_SkColorType: this->append(store_af16, ctx); break; case kRGB_565_SkColorType: this->append(store_565, ctx); break; diff --git a/src/core/SkRasterPipeline.h b/src/core/SkRasterPipeline.h index 3b03020b2b..c5bb1373ca 100644 --- a/src/core/SkRasterPipeline.h +++ b/src/core/SkRasterPipeline.h @@ -57,10 +57,12 @@ class SkData; M(load_8888) M(load_8888_dst) M(store_8888) M(gather_8888) \ M(load_rg88) M(load_rg88_dst) M(store_rg88) M(gather_rg88) \ M(load_a16) M(load_a16_dst) M(store_a16) M(gather_a16) \ + M(store_r8) \ M(load_rg1616) M(load_rg1616_dst) M(store_rg1616) M(gather_rg1616) \ M(load_16161616) M(load_16161616_dst) M(store_16161616) M(gather_16161616) \ M(load_1010102) M(load_1010102_dst) M(store_1010102) M(gather_1010102) \ M(alpha_to_gray) M(alpha_to_gray_dst) \ + M(alpha_to_red) M(alpha_to_red_dst) \ M(bt709_luminance_or_luma_to_alpha) M(bt709_luminance_or_luma_to_rgb) \ M(bilerp_clamp_8888) M(bicubic_clamp_8888) \ M(store_u16_be) \ diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp index b49f5c9da4..6f4e496aa2 100644 --- a/src/core/SkRasterPipelineBlitter.cpp +++ b/src/core/SkRasterPipelineBlitter.cpp @@ -203,17 +203,26 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst, // to zero. We only dither non-constant shaders, so is_constant won't change here. if (paint.isDither() && !is_constant) { switch (dst.info().colorType()) { - case kARGB_4444_SkColorType: blitter->fDitherRate = 1/15.0f; break; - case kRGB_565_SkColorType: blitter->fDitherRate = 1/63.0f; break; - case kGray_8_SkColorType: - case kRGB_888x_SkColorType: + case kARGB_4444_SkColorType: + blitter->fDitherRate = 1 / 15.0f; + break; + case kRGB_565_SkColorType: + blitter->fDitherRate = 1 / 63.0f; + break; + case kGray_8_SkColorType: + case kRGB_888x_SkColorType: case kRGBA_8888_SkColorType: case kBGRA_8888_SkColorType: - case kSRGBA_8888_SkColorType: blitter->fDitherRate = 1/255.0f; break; + case kSRGBA_8888_SkColorType: + case kR8_unorm_SkColorType: + blitter->fDitherRate = 1 / 255.0f; + break; case kRGB_101010x_SkColorType: case kRGBA_1010102_SkColorType: case kBGR_101010x_SkColorType: - case kBGRA_1010102_SkColorType: blitter->fDitherRate = 1/1023.0f; break; + case kBGRA_1010102_SkColorType: + blitter->fDitherRate = 1 / 1023.0f; + break; case kUnknown_SkColorType: case kAlpha_8_SkColorType: @@ -225,7 +234,9 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst, case kA16_unorm_SkColorType: case kR16G16_float_SkColorType: case kR16G16_unorm_SkColorType: - case kR16G16B16A16_unorm_SkColorType: blitter->fDitherRate = 0.0f; break; + case kR16G16B16A16_unorm_SkColorType: + blitter->fDitherRate = 0.0f; + break; } if (blitter->fDitherRate > 0.0f) { colorPipeline->append(SkRasterPipeline::dither, &blitter->fDitherRate); diff --git a/src/core/SkVM.cpp b/src/core/SkVM.cpp index d90259e2ed..75b1e2e215 100644 --- a/src/core/SkVM.cpp +++ b/src/core/SkVM.cpp @@ -1203,8 +1203,9 @@ namespace skvm { case kA16_float_SkColorType: return {FLOAT, 0, 0,0,16, 0, 0,0,0}; case kR16G16_float_SkColorType: return {FLOAT, 16,16,0, 0, 0,16,0,0}; - case kAlpha_8_SkColorType: return {UNORM, 0,0,0,8, 0,0,0,0}; - case kGray_8_SkColorType: return {UNORM, 8,8,8,0, 0,0,0,0}; // Subtle. + case kAlpha_8_SkColorType: return {UNORM, 0,0,0,8, 0,0,0,0}; + case kGray_8_SkColorType: return {UNORM, 8,8,8,0, 0,0,0,0}; // Subtle. + case kR8_unorm_SkColorType: return {UNORM, 8,0,0,0, 0,0,0,0}; case kRGB_565_SkColorType: return {UNORM, 5,6,5,0, 11,5,0,0}; // (BGR) case kARGB_4444_SkColorType: return {UNORM, 4,4,4,4, 12,8,4,0}; // (ABGR) diff --git a/src/core/SkVMBlitter.cpp b/src/core/SkVMBlitter.cpp index a298ed4e1c..5b7b31ebc1 100644 --- a/src/core/SkVMBlitter.cpp +++ b/src/core/SkVMBlitter.cpp @@ -109,17 +109,26 @@ namespace { float rate = 0.0f; switch (dst.colorType()) { - case kARGB_4444_SkColorType: rate = 1/15.0f; break; - case kRGB_565_SkColorType: rate = 1/63.0f; break; - case kGray_8_SkColorType: - case kRGB_888x_SkColorType: + case kARGB_4444_SkColorType: + rate = 1 / 15.0f; + break; + case kRGB_565_SkColorType: + rate = 1 / 63.0f; + break; + case kGray_8_SkColorType: + case kRGB_888x_SkColorType: case kRGBA_8888_SkColorType: case kBGRA_8888_SkColorType: - case kSRGBA_8888_SkColorType: rate = 1/255.0f; break; + case kSRGBA_8888_SkColorType: + case kR8_unorm_SkColorType: + rate = 1 / 255.0f; + break; case kRGB_101010x_SkColorType: case kRGBA_1010102_SkColorType: case kBGR_101010x_SkColorType: - case kBGRA_1010102_SkColorType: rate = 1/1023.0f; break; + case kBGRA_1010102_SkColorType: + rate = 1 / 1023.0f; + break; case kUnknown_SkColorType: case kAlpha_8_SkColorType: @@ -131,7 +140,8 @@ namespace { case kA16_unorm_SkColorType: case kR16G16_float_SkColorType: case kR16G16_unorm_SkColorType: - case kR16G16B16A16_unorm_SkColorType: return c; + case kR16G16B16A16_unorm_SkColorType: + return c; } // See SkRasterPipeline dither stage. diff --git a/src/gpu/GrDataUtils.cpp b/src/gpu/GrDataUtils.cpp index 232c1d9982..d66f67d04e 100644 --- a/src/gpu/GrDataUtils.cpp +++ b/src/gpu/GrDataUtils.cpp @@ -393,6 +393,12 @@ static GrSwizzle get_load_and_src_swizzle(GrColorType ct, SkRasterPipeline::Stoc case GrColorType::kGray_8: *load = SkRasterPipeline::load_a8; swizzle = GrSwizzle("aaa1"); break; + case GrColorType::kR_8xxx: *load = SkRasterPipeline::load_8888; + swizzle = GrSwizzle("r001"); + break; + case GrColorType::kR_8: *load = SkRasterPipeline::load_a8; + swizzle = GrSwizzle("a001"); + break; case GrColorType::kGrayAlpha_88: *load = SkRasterPipeline::load_rg88; swizzle = GrSwizzle("rrrg"); break; @@ -405,7 +411,6 @@ static GrSwizzle get_load_and_src_swizzle(GrColorType ct, SkRasterPipeline::Stoc // These are color types we don't expect to ever have to load. case GrColorType::kRGB_888: - case GrColorType::kR_8: case GrColorType::kR_16: case GrColorType::kR_F16: case GrColorType::kGray_F16: @@ -473,6 +478,9 @@ static GrSwizzle get_dst_swizzle_and_store(GrColorType ct, SkRasterPipeline::Sto case GrColorType::kRGB_888x: swizzle = GrSwizzle("rgb1"); *store = SkRasterPipeline::store_8888; break; + case GrColorType::kR_8xxx: swizzle = GrSwizzle("r001"); + *store = SkRasterPipeline::store_8888; + break; case GrColorType::kR_8: swizzle = GrSwizzle("agbr"); *store = SkRasterPipeline::store_a8; break; diff --git a/src/gpu/GrSwizzle.cpp b/src/gpu/GrSwizzle.cpp index 3bef983b11..de93d32b65 100644 --- a/src/gpu/GrSwizzle.cpp +++ b/src/gpu/GrSwizzle.cpp @@ -23,6 +23,9 @@ void GrSwizzle::apply(SkRasterPipeline* pipeline) const { case GrSwizzle("rgb1").asKey(): pipeline->append(SkRasterPipeline::force_opaque); return; + case GrSwizzle("a001").asKey(): + pipeline->append(SkRasterPipeline::alpha_to_red); + return; default: { static_assert(sizeof(uintptr_t) >= 4 * sizeof(char)); // Rather than allocate the 4 control bytes on the heap somewhere, just jam them right diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index 746522d313..bac851456a 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -296,6 +296,7 @@ static inline float dither_range_for_config(GrColorType dstColorType) { case GrColorType::kGrayAlpha_88: case GrColorType::kGray_8xxx: case GrColorType::kR_8: + case GrColorType::kR_8xxx: case GrColorType::kRG_88: case GrColorType::kRGB_888: case GrColorType::kRGB_888x: diff --git a/src/gpu/d3d/GrD3DCaps.cpp b/src/gpu/d3d/GrD3DCaps.cpp index f6d3aa3693..73b7587b19 100644 --- a/src/gpu/d3d/GrD3DCaps.cpp +++ b/src/gpu/d3d/GrD3DCaps.cpp @@ -393,9 +393,16 @@ void GrD3DCaps::initFormatTable(const DXGI_ADAPTER_DESC& adapterDesc, ID3D12Devi info.init(adapterDesc, device, format); info.fFormatColorType = GrColorType::kR_8; if (SkToBool(info.fFlags & FormatInfo::kTexturable_Flag)) { - info.fColorTypeInfoCount = 2; + info.fColorTypeInfoCount = 3; info.fColorTypeInfos.reset(new ColorTypeInfo[info.fColorTypeInfoCount]()); int ctIdx = 0; + // Format: DXGI_FORMAT_R8_UNORM, Surface: kR_8 + { + constexpr GrColorType ct = GrColorType::kR_8; + auto& ctInfo = info.fColorTypeInfos[ctIdx++]; + ctInfo.fColorType = ct; + ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; + } // Format: DXGI_FORMAT_R8_UNORM, Surface: kAlpha_8 { constexpr GrColorType ct = GrColorType::kAlpha_8; diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 0faa64a8bc..2dd1ccd0de 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -1578,9 +1578,42 @@ void GrGLCaps::initFormatTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa } if (r8Support) { - info.fColorTypeInfoCount = 2; + info.fColorTypeInfoCount = 3; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); int ctIdx = 0; + // Format: R8, Surface: kR_8 + { + auto& ctInfo = info.fColorTypeInfos[ctIdx++]; + ctInfo.fColorType = GrColorType::kR_8; + ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; + this->setColorTypeFormat(GrColorType::kR_8, GrGLFormat::kR8); + + // External IO ColorTypes: + ctInfo.fExternalIOFormatCount = 2; + ctInfo.fExternalIOFormats = std::make_unique( + ctInfo.fExternalIOFormatCount); + int ioIdx = 0; + // Format: R8, Surface: kR_8, Data: kR_8 + { + auto& ioFormat = ctInfo.fExternalIOFormats[ioIdx++]; + ioFormat.fColorType = GrColorType::kR_8; + ioFormat.fExternalType = GR_GL_UNSIGNED_BYTE; + ioFormat.fExternalTexImageFormat = GR_GL_RED; + ioFormat.fExternalReadFormat = GR_GL_RED; + // Not guaranteed by ES/WebGL. + ioFormat.fRequiresImplementationReadQuery = !GR_IS_GR_GL(standard); + } + + // Format: R8, Surface: kR_8, Data: kR_8xxx + { + auto& ioFormat = ctInfo.fExternalIOFormats[ioIdx++]; + ioFormat.fColorType = GrColorType::kR_8xxx; + ioFormat.fExternalType = GR_GL_UNSIGNED_BYTE; + ioFormat.fExternalTexImageFormat = 0; + ioFormat.fExternalReadFormat = GR_GL_RGBA; + } + } + // Format: R8, Surface: kAlpha_8 { auto& ctInfo = info.fColorTypeInfos[ctIdx++]; diff --git a/src/gpu/mtl/GrMtlCaps.mm b/src/gpu/mtl/GrMtlCaps.mm index b8c5ff5136..a6463bd0b3 100644 --- a/src/gpu/mtl/GrMtlCaps.mm +++ b/src/gpu/mtl/GrMtlCaps.mm @@ -625,10 +625,16 @@ void GrMtlCaps::initFormatTable() { { info = &fFormatTable[GetFormatIndex(MTLPixelFormatR8Unorm)]; info->fFlags = FormatInfo::kAllFlags; - info->fColorTypeInfoCount = 2; + info->fColorTypeInfoCount = 3; info->fColorTypeInfos.reset(new ColorTypeInfo[info->fColorTypeInfoCount]()); int ctIdx = 0; // Format: R8Unorm, Surface: kAlpha_8 + { + auto& ctInfo = info->fColorTypeInfos[ctIdx++]; + ctInfo.fColorType = GrColorType::kR_8; + ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; + } + // Format: R8Unorm, Surface: kAlpha_8 { auto& ctInfo = info->fColorTypeInfos[ctIdx++]; ctInfo.fColorType = GrColorType::kAlpha_8; diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp index 87a7930072..e802c4d849 100644 --- a/src/gpu/vk/GrVkCaps.cpp +++ b/src/gpu/vk/GrVkCaps.cpp @@ -876,9 +876,17 @@ void GrVkCaps::initFormatTable(const GrVkInterface* interface, VkPhysicalDevice auto& info = this->getFormatInfo(format); info.init(interface, physDev, properties, format); if (SkToBool(info.fOptimalFlags & FormatInfo::kTexturable_Flag)) { - info.fColorTypeInfoCount = 2; + info.fColorTypeInfoCount = 3; info.fColorTypeInfos = std::make_unique(info.fColorTypeInfoCount); int ctIdx = 0; + // Format: VK_FORMAT_R8_UNORM, Surface: kR_8 + { + constexpr GrColorType ct = GrColorType::kR_8; + auto& ctInfo = info.fColorTypeInfos[ctIdx++]; + ctInfo.fColorType = ct; + ctInfo.fTransferColorType = ct; + ctInfo.fFlags = ColorTypeInfo::kUploadData_Flag | ColorTypeInfo::kRenderable_Flag; + } // Format: VK_FORMAT_R8_UNORM, Surface: kAlpha_8 { constexpr GrColorType ct = GrColorType::kAlpha_8; diff --git a/src/images/SkPngEncoder.cpp b/src/images/SkPngEncoder.cpp index 13d8534c47..7fa6215c59 100644 --- a/src/images/SkPngEncoder.cpp +++ b/src/images/SkPngEncoder.cpp @@ -339,6 +339,7 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info) { case kA16_unorm_SkColorType: case kA16_float_SkColorType: case kR16G16B16A16_unorm_SkColorType: + case kR8_unorm_SkColorType: return nullptr; } SkASSERT(false); diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h index 7948143a4c..7bb5c30cc4 100644 --- a/src/opts/SkRasterPipeline_opts.h +++ b/src/opts/SkRasterPipeline_opts.h @@ -1957,6 +1957,12 @@ STAGE(store_a8, const SkRasterPipeline_MemoryCtx* ctx) { U8 packed = pack(pack(to_unorm(a, 255))); store(ptr, packed, tail); } +STAGE(store_r8, const SkRasterPipeline_MemoryCtx* ctx) { + auto ptr = ptr_at_xy(ctx, dx,dy); + + U8 packed = pack(pack(to_unorm(r, 255))); + store(ptr, packed, tail); +} STAGE(load_565, const SkRasterPipeline_MemoryCtx* ctx) { auto ptr = ptr_at_xy(ctx, dx,dy); @@ -2356,6 +2362,15 @@ STAGE(alpha_to_gray_dst, Ctx::None) { dr = dg = db = da; da = 1; } +STAGE(alpha_to_red, Ctx::None) { + r = a; + a = 1; +} +STAGE(alpha_to_red_dst, Ctx::None) { + dr = da; + da = 1; +} + STAGE(bt709_luminance_or_luma_to_alpha, Ctx::None) { a = r*0.2126f + g*0.7152f + b*0.0722f; r = g = b = 0; @@ -3833,6 +3848,9 @@ STAGE_GP(gather_a8, const SkRasterPipeline_GatherCtx* ctx) { r = g = b = 0; a = cast(gather(ptr, ix)); } +STAGE_PP(store_r8, const SkRasterPipeline_MemoryCtx* ctx) { + store_8(ptr_at_xy(ctx, dx,dy), tail, r); +} STAGE_PP(alpha_to_gray, Ctx::None) { r = g = b = a; @@ -3842,6 +3860,15 @@ STAGE_PP(alpha_to_gray_dst, Ctx::None) { dr = dg = db = da; da = 255; } +STAGE_PP(alpha_to_red, Ctx::None) { + r = a; + a = 255; +} +STAGE_PP(alpha_to_red_dst, Ctx::None) { + dr = da; + da = 255; +} + STAGE_PP(bt709_luminance_or_luma_to_alpha, Ctx::None) { a = (r*54 + g*183 + b*19)/256; // 0.2126, 0.7152, 0.0722 with 256 denominator. r = g = b = 0; diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp index e373e9d993..22c99c7d71 100755 --- a/src/shaders/SkImageShader.cpp +++ b/src/shaders/SkImageShader.cpp @@ -561,6 +561,9 @@ bool SkImageShader::doStages(const SkStageRec& rec, TransformShader* updater) co case kGray_8_SkColorType: p->append(SkRasterPipeline::gather_a8, ctx); p->append(SkRasterPipeline::alpha_to_gray ); break; + case kR8_unorm_SkColorType: p->append(SkRasterPipeline::gather_a8, ctx); + p->append(SkRasterPipeline::alpha_to_red ); break; + case kRGB_888x_SkColorType: p->append(SkRasterPipeline::gather_8888, ctx); p->append(SkRasterPipeline::force_opaque ); break; diff --git a/tests/BackendAllocationTest.cpp b/tests/BackendAllocationTest.cpp index f89742e3e5..b5d0e4acf3 100644 --- a/tests/BackendAllocationTest.cpp +++ b/tests/BackendAllocationTest.cpp @@ -594,6 +594,7 @@ void color_type_backend_allocation_test(const sk_gpu_test::ContextInfo& ctxInfo, { kA16_float_SkColorType, kTransCol }, { kR16G16_float_SkColorType, { .25f, .75f, 0, 1 } }, { kR16G16B16A16_unorm_SkColorType,{ .25f, .5f, .75f, 1 } }, + { kR8_unorm_SkColorType, { .25f, 0, 0, 1 } }, }; static_assert(kLastEnum_SkColorType == SK_ARRAY_COUNT(combinations)); diff --git a/tests/ReadWritePixelsGpuTest.cpp b/tests/ReadWritePixelsGpuTest.cpp index 8fd263aa2f..46c9bd44aa 100644 --- a/tests/ReadWritePixelsGpuTest.cpp +++ b/tests/ReadWritePixelsGpuTest.cpp @@ -51,6 +51,7 @@ static constexpr int min_rgb_channel_bits(SkColorType ct) { case kRGBA_F16_SkColorType: return 10; // just counting the mantissa case kRGBA_F32_SkColorType: return 23; // just counting the mantissa case kR16G16B16A16_unorm_SkColorType: return 16; + case kR8_unorm_SkColorType: return 8; } SkUNREACHABLE; } @@ -79,6 +80,7 @@ static constexpr int alpha_channel_bits(SkColorType ct) { case kRGBA_F16_SkColorType: return 10; // just counting the mantissa case kRGBA_F32_SkColorType: return 23; // just counting the mantissa case kR16G16B16A16_unorm_SkColorType: return 16; + case kR8_unorm_SkColorType: return 0; } SkUNREACHABLE; } diff --git a/tools/HashAndEncode.cpp b/tools/HashAndEncode.cpp index e9c9dfb62d..c2fcd0f7d1 100644 --- a/tools/HashAndEncode.cpp +++ b/tools/HashAndEncode.cpp @@ -34,6 +34,8 @@ HashAndEncode::HashAndEncode(const SkBitmap& bitmap) : fSize(bitmap.info().dimen case kRGBA_1010102_SkColorType: srcFmt = skcms_PixelFormat_RGBA_1010102; break; case kBGRA_1010102_SkColorType: srcFmt = skcms_PixelFormat_BGRA_1010102; break; case kGray_8_SkColorType: srcFmt = skcms_PixelFormat_G_8; break; + // skcms doesn't have R_8. Pretend it's G_8, but see below for color space trickery: + case kR8_unorm_SkColorType: srcFmt = skcms_PixelFormat_G_8; break; case kRGBA_F16Norm_SkColorType: srcFmt = skcms_PixelFormat_RGBA_hhhh; break; case kRGBA_F16_SkColorType: srcFmt = skcms_PixelFormat_RGBA_hhhh; break; case kRGBA_F32_SkColorType: srcFmt = skcms_PixelFormat_RGBA_ffff; break; @@ -58,6 +60,14 @@ HashAndEncode::HashAndEncode(const SkBitmap& bitmap) : fSize(bitmap.info().dimen cs->toProfile(&srcProfile); } + // NOTE: If the color type is R8, we told skcms it's actually G8 above. To get red PNGs, + // we tweak the source color space to throw away any green and blue: + if (bitmap.colorType() == kR8_unorm_SkColorType) { + srcProfile.toXYZD50.vals[0][1] = srcProfile.toXYZD50.vals[0][2] = 0; + srcProfile.toXYZD50.vals[1][1] = srcProfile.toXYZD50.vals[1][2] = 0; + srcProfile.toXYZD50.vals[2][1] = srcProfile.toXYZD50.vals[2][2] = 0; + } + // Our common format that can represent anything we draw and encode as a PNG: // - 16-bit big-endian RGBA // - unpremul diff --git a/tools/ToolUtils.cpp b/tools/ToolUtils.cpp index 239226292d..48050231d1 100644 --- a/tools/ToolUtils.cpp +++ b/tools/ToolUtils.cpp @@ -73,6 +73,7 @@ const char* colortype_name(SkColorType ct) { case kR16G16_unorm_SkColorType: return "R16G16_unorm"; case kR16G16_float_SkColorType: return "R16G16_float"; case kR16G16B16A16_unorm_SkColorType: return "R16G16B16A16_unorm"; + case kR8_unorm_SkColorType: return "R8_unorm"; } SkASSERT(false); return "unexpected colortype"; @@ -102,6 +103,7 @@ const char* colortype_depth(SkColorType ct) { case kR16G16_unorm_SkColorType: return "1616"; case kR16G16_float_SkColorType: return "F16F16"; case kR16G16B16A16_unorm_SkColorType: return "16161616"; + case kR8_unorm_SkColorType: return "8"; } SkASSERT(false); return "unexpected colortype"; diff --git a/tools/flags/CommonFlagsConfig.cpp b/tools/flags/CommonFlagsConfig.cpp index a8b8dea732..dbe5beb20b 100644 --- a/tools/flags/CommonFlagsConfig.cpp +++ b/tools/flags/CommonFlagsConfig.cpp @@ -62,6 +62,7 @@ static const struct { { "glf16", "gpu", "api=gl,color=f16" }, { "glf16norm", "gpu", "api=gl,color=f16norm" }, { "glsrgba", "gpu", "api=gl,color=srgba" }, + { "glr8", "gpu", "api=gl,color=r8" }, { "glesf16", "gpu", "api=gles,color=f16" }, { "glessrgba", "gpu", "api=gles,color=srgba" }, { "glnostencils", "gpu", "api=gl,stencils=false" }, @@ -380,6 +381,9 @@ static bool parse_option_gpu_color(const SkString& value, *outColorType = kRGBA_F16Norm_SkColorType; } else if (value.equals("srgba")) { *outColorType = kSRGBA_8888_SkColorType; + } else if (value.equals("r8")) { + *outColorType = kR8_unorm_SkColorType; + *alphaType = kOpaque_SkAlphaType; } else { return false; }