Reland "Add kR8_unorm_SkColorType"

This is a reland of 3225c8cc46

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 <michaelludwig@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

Change-Id: I73fa17625d57e0e58da1b70e2e59ba200383cfe7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506460
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2022-02-08 10:34:38 -05:00 committed by SkCQ
parent 21cd6ff6a9
commit a7a2324f14
32 changed files with 206 additions and 29 deletions

View File

@ -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);

View File

@ -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";

View File

@ -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 "";
}

View File

@ -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

View File

@ -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";

View File

@ -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:

View File

@ -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") {

View File

@ -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": [

View File

@ -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<uint8_t>(dst, dstRB);

View File

@ -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;
}

View File

@ -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<ColorTypeFilter_8>;
proc_1_3 = downsample_1_3<ColorTypeFilter_8>;
proc_2_1 = downsample_2_1<ColorTypeFilter_8>;

View File

@ -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<const uint8_t*>(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: {

View File

@ -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;

View File

@ -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) \

View File

@ -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);

View File

@ -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)

View File

@ -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.

View File

@ -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;

View File

@ -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

View File

@ -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:

View File

@ -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;

View File

@ -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<ColorTypeInfo[]>(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<ColorTypeInfo::ExternalIOFormats[]>(
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++];

View File

@ -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;

View File

@ -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<ColorTypeInfo[]>(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;

View File

@ -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);

View File

@ -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<uint8_t>(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<const uint16_t>(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<U16>(gather<U8>(ptr, ix));
}
STAGE_PP(store_r8, const SkRasterPipeline_MemoryCtx* ctx) {
store_8(ptr_at_xy<uint8_t>(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;

View File

@ -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;

View File

@ -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));

View File

@ -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;
}

View File

@ -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

View File

@ -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";

View File

@ -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;
}