jumper, a couple simple loads and stores
Change-Id: I217d7b562f5fa443978044e17469ba757c061209 Reviewed-on: https://skia-review.googlesource.com/10971 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
parent
15bf678e08
commit
f809fef828
@ -86,8 +86,11 @@ static K kConstants = {
|
||||
M(load_tables) \
|
||||
M(load_a8) \
|
||||
M(store_a8) \
|
||||
M(load_g8) \
|
||||
M(load_565) \
|
||||
M(store_565) \
|
||||
M(load_4444) \
|
||||
M(store_4444) \
|
||||
M(load_8888) \
|
||||
M(store_8888) \
|
||||
M(load_f16) \
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -353,6 +353,13 @@ SI void from_565(U16 _565, F* r, F* g, F* b) {
|
||||
*g = cast(wide & C(63<< 5)) * C(1.0f / (63<< 5));
|
||||
*b = cast(wide & C(31<< 0)) * C(1.0f / (31<< 0));
|
||||
}
|
||||
SI void from_4444(U16 _4444, F* r, F* g, F* b, F* a) {
|
||||
U32 wide = expand(_4444);
|
||||
*r = cast(wide & C(15<<12)) * C(1.0f / (15<<12));
|
||||
*g = cast(wide & C(15<< 8)) * C(1.0f / (15<< 8));
|
||||
*b = cast(wide & C(15<< 4)) * C(1.0f / (15<< 4));
|
||||
*a = cast(wide & C(15<< 0)) * C(1.0f / (15<< 0));
|
||||
}
|
||||
|
||||
// Sometimes we want to work with 4 floats directly, regardless of the depth of the F vector.
|
||||
#if defined(JUMPER)
|
||||
@ -771,6 +778,13 @@ STAGE(store_a8) {
|
||||
store(ptr, packed, tail);
|
||||
}
|
||||
|
||||
STAGE(load_g8) {
|
||||
auto ptr = *(const uint8_t**)ctx + x;
|
||||
|
||||
r = g = b = cast(expand(load<U8>(ptr, tail))) * C(1/255.0f);
|
||||
a = 1.0_f;
|
||||
}
|
||||
|
||||
STAGE(load_565) {
|
||||
auto ptr = *(const uint16_t**)ctx + x;
|
||||
|
||||
@ -786,6 +800,19 @@ STAGE(store_565) {
|
||||
store(ptr, px, tail);
|
||||
}
|
||||
|
||||
STAGE(load_4444) {
|
||||
auto ptr = *(const uint16_t**)ctx + x;
|
||||
from_4444(load<U16>(ptr, tail), &r,&g,&b,&a);
|
||||
}
|
||||
STAGE(store_4444) {
|
||||
auto ptr = *(uint16_t**)ctx + x;
|
||||
U16 px = pack( round(r, 15.0_f) << 12
|
||||
| round(g, 15.0_f) << 8
|
||||
| round(b, 15.0_f) << 4
|
||||
| round(a, 15.0_f) );
|
||||
store(ptr, px, tail);
|
||||
}
|
||||
|
||||
STAGE(load_8888) {
|
||||
auto ptr = *(const uint32_t**)ctx + x;
|
||||
|
||||
@ -795,7 +822,6 @@ STAGE(load_8888) {
|
||||
b = cast((px >> 16) & 0xff_i) * C(1/255.0f);
|
||||
a = cast((px >> 24) ) * C(1/255.0f);
|
||||
}
|
||||
|
||||
STAGE(store_8888) {
|
||||
auto ptr = *(uint32_t**)ctx + x;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user