Skip to content

Commit 895e1ee

Browse files
reed-at-googleSkia Commit-Bot
authored andcommitted
lowp stages for load/stores and lerp-native
Speeds up mixer-lerp bench by 2x Bug: skia: Change-Id: I052ddff6e8b726486f1e7f7bdeed9f1bb4beb4ba Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201688 Reviewed-by: Mike Klein <[email protected]> Commit-Queue: Mike Reed <[email protected]>
1 parent 72ef2d5 commit 895e1ee

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

src/opts/SkRasterPipeline_opts.h

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3057,6 +3057,33 @@ STAGE_PP(luminance_to_alpha, Ctx::None) {
30573057

30583058
// ~~~~~~ Coverage scales / lerps ~~~~~~ //
30593059

3060+
STAGE_PP(load_src, const uint16_t* ptr) {
3061+
r = unaligned_load<U16>(ptr + 0*N);
3062+
g = unaligned_load<U16>(ptr + 1*N);
3063+
b = unaligned_load<U16>(ptr + 2*N);
3064+
a = unaligned_load<U16>(ptr + 3*N);
3065+
}
3066+
STAGE_PP(store_src, uint16_t* ptr) {
3067+
unaligned_store(ptr + 0*N, r);
3068+
unaligned_store(ptr + 1*N, g);
3069+
unaligned_store(ptr + 2*N, b);
3070+
unaligned_store(ptr + 3*N, a);
3071+
}
3072+
STAGE_PP(load_dst, const uint16_t* ptr) {
3073+
dr = unaligned_load<U16>(ptr + 0*N);
3074+
dg = unaligned_load<U16>(ptr + 1*N);
3075+
db = unaligned_load<U16>(ptr + 2*N);
3076+
da = unaligned_load<U16>(ptr + 3*N);
3077+
}
3078+
STAGE_PP(store_dst, uint16_t* ptr) {
3079+
unaligned_store(ptr + 0*N, dr);
3080+
unaligned_store(ptr + 1*N, dg);
3081+
unaligned_store(ptr + 2*N, db);
3082+
unaligned_store(ptr + 3*N, da);
3083+
}
3084+
3085+
// ~~~~~~ Coverage scales / lerps ~~~~~~ //
3086+
30603087
STAGE_PP(scale_1_float, const float* f) {
30613088
U16 c = from_float(*f);
30623089
r = div255( r * c );
@@ -3071,6 +3098,13 @@ STAGE_PP(lerp_1_float, const float* f) {
30713098
b = lerp(db, b, c);
30723099
a = lerp(da, a, c);
30733100
}
3101+
STAGE_PP(lerp_native, const uint16_t scales[]) {
3102+
auto c = unaligned_load<U16>(scales);
3103+
r = lerp(dr, r, c);
3104+
g = lerp(dg, g, c);
3105+
b = lerp(db, b, c);
3106+
a = lerp(da, a, c);
3107+
}
30743108

30753109
STAGE_PP(scale_u8, const SkRasterPipeline_MemoryCtx* ctx) {
30763110
U16 c = load_8(ptr_at_xy<const uint8_t>(ctx, dx,dy), tail);
@@ -3355,15 +3389,10 @@ STAGE_GP(bilerp_clamp_8888, const SkRasterPipeline_GatherCtx* ctx) {
33553389
// If a pipeline uses these stages, it'll boot it out of lowp into highp.
33563390
#define NOT_IMPLEMENTED(st) static void (*st)(void) = nullptr;
33573391
NOT_IMPLEMENTED(callback)
3358-
NOT_IMPLEMENTED(load_src) // TODO
3359-
NOT_IMPLEMENTED(store_src) // TODO
3360-
NOT_IMPLEMENTED(load_dst) // TODO
3361-
NOT_IMPLEMENTED(store_dst) // TODO
33623392
NOT_IMPLEMENTED(unbounded_set_rgb)
33633393
NOT_IMPLEMENTED(unbounded_uniform_color)
33643394
NOT_IMPLEMENTED(unpremul)
33653395
NOT_IMPLEMENTED(dither) // TODO
3366-
NOT_IMPLEMENTED(lerp_native) // TODO
33673396
NOT_IMPLEMENTED(from_srgb)
33683397
NOT_IMPLEMENTED(to_srgb)
33693398
NOT_IMPLEMENTED(load_f16)

0 commit comments

Comments
 (0)