@@ -19,11 +19,12 @@ namespace SkSL { class TraceHook; }
19
19
// by stages that have no lowp implementation. They can therefore use the (smaller) highp value to
20
20
// save memory in the arena.
21
21
inline static constexpr int SkRasterPipeline_kMaxStride = 16 ;
22
- inline static constexpr int SkRasterPipeline_kMaxStride_highp = 16 ;
22
+ inline static constexpr int SkRasterPipeline_kMaxStride_highp = 8 ;
23
+ inline static constexpr int SkRasterPipeline_kMaxStride_highp_skx = 16 ;
23
24
24
25
// How much space to allocate for each MemoryCtx scratch buffer, as part of tail-pixel handling.
25
26
inline static constexpr size_t SkRasterPipeline_MaxScratchPerPatch =
26
- std::max (SkRasterPipeline_kMaxStride_highp * 16 , // 16 == largest highp bpp (RGBA_F32)
27
+ std::max (SkRasterPipeline_kMaxStride_highp_skx * 16 , // 16 == largest highp bpp (RGBA_F32)
27
28
SkRasterPipeline_kMaxStride * 4 ); // 4 == largest lowp bpp (RGBA_8888)
28
29
29
30
// These structs hold the context data for many of the Raster Pipeline ops.
@@ -74,17 +75,17 @@ struct SkRasterPipeline_GatherCtx {
74
75
75
76
// State shared by save_xy, accumulate, and bilinear_* / bicubic_*.
76
77
struct SkRasterPipeline_SamplerCtx {
77
- float x[SkRasterPipeline_kMaxStride_highp ];
78
- float y[SkRasterPipeline_kMaxStride_highp ];
79
- float fx[SkRasterPipeline_kMaxStride_highp ];
80
- float fy[SkRasterPipeline_kMaxStride_highp ];
81
- float scalex[SkRasterPipeline_kMaxStride_highp ];
82
- float scaley[SkRasterPipeline_kMaxStride_highp ];
78
+ float x[SkRasterPipeline_kMaxStride_highp_skx ];
79
+ float y[SkRasterPipeline_kMaxStride_highp_skx ];
80
+ float fx[SkRasterPipeline_kMaxStride_highp_skx ];
81
+ float fy[SkRasterPipeline_kMaxStride_highp_skx ];
82
+ float scalex[SkRasterPipeline_kMaxStride_highp_skx ];
83
+ float scaley[SkRasterPipeline_kMaxStride_highp_skx ];
83
84
84
85
// for bicubic_[np][13][xy]
85
86
float weights[16 ];
86
- float wx[4 ][SkRasterPipeline_kMaxStride_highp ];
87
- float wy[4 ][SkRasterPipeline_kMaxStride_highp ];
87
+ float wx[4 ][SkRasterPipeline_kMaxStride_highp_skx ];
88
+ float wy[4 ][SkRasterPipeline_kMaxStride_highp_skx ];
88
89
};
89
90
90
91
struct SkRasterPipeline_TileCtx {
@@ -111,14 +112,14 @@ struct SkRasterPipeline_DecalTileCtx {
111
112
// State used by mipmap_linear_*
112
113
struct SkRasterPipeline_MipmapCtx {
113
114
// Original coords, saved before the base level logic
114
- float x[SkRasterPipeline_kMaxStride_highp ];
115
- float y[SkRasterPipeline_kMaxStride_highp ];
115
+ float x[SkRasterPipeline_kMaxStride_highp_skx ];
116
+ float y[SkRasterPipeline_kMaxStride_highp_skx ];
116
117
117
118
// Base level color
118
- float r[SkRasterPipeline_kMaxStride_highp ];
119
- float g[SkRasterPipeline_kMaxStride_highp ];
120
- float b[SkRasterPipeline_kMaxStride_highp ];
121
- float a[SkRasterPipeline_kMaxStride_highp ];
119
+ float r[SkRasterPipeline_kMaxStride_highp_skx ];
120
+ float g[SkRasterPipeline_kMaxStride_highp_skx ];
121
+ float b[SkRasterPipeline_kMaxStride_highp_skx ];
122
+ float a[SkRasterPipeline_kMaxStride_highp_skx ];
122
123
123
124
// Scale factors to transform base level coords to lower level coords
124
125
float scaleX;
@@ -138,22 +139,22 @@ struct SkRasterPipeline_CallbackCtx {
138
139
139
140
// When called, fn() will have our active pixels available in rgba.
140
141
// When fn() returns, the pipeline will read back those active pixels from read_from.
141
- float rgba[4 *SkRasterPipeline_kMaxStride_highp ];
142
+ float rgba[4 *SkRasterPipeline_kMaxStride_highp_skx ];
142
143
float * read_from = rgba;
143
144
};
144
145
145
146
// state shared by stack_checkpoint and stack_rewind
146
147
struct SkRasterPipelineStage ;
147
148
148
149
struct SkRasterPipeline_RewindCtx {
149
- float r[SkRasterPipeline_kMaxStride_highp ];
150
- float g[SkRasterPipeline_kMaxStride_highp ];
151
- float b[SkRasterPipeline_kMaxStride_highp ];
152
- float a[SkRasterPipeline_kMaxStride_highp ];
153
- float dr[SkRasterPipeline_kMaxStride_highp ];
154
- float dg[SkRasterPipeline_kMaxStride_highp ];
155
- float db[SkRasterPipeline_kMaxStride_highp ];
156
- float da[SkRasterPipeline_kMaxStride_highp ];
150
+ float r[SkRasterPipeline_kMaxStride_highp_skx ];
151
+ float g[SkRasterPipeline_kMaxStride_highp_skx ];
152
+ float b[SkRasterPipeline_kMaxStride_highp_skx ];
153
+ float a[SkRasterPipeline_kMaxStride_highp_skx ];
154
+ float dr[SkRasterPipeline_kMaxStride_highp_skx ];
155
+ float dg[SkRasterPipeline_kMaxStride_highp_skx ];
156
+ float db[SkRasterPipeline_kMaxStride_highp_skx ];
157
+ float da[SkRasterPipeline_kMaxStride_highp_skx ];
157
158
std::byte* base;
158
159
SkRasterPipelineStage* stage;
159
160
};
@@ -192,14 +193,18 @@ struct SkRasterPipeline_TablesCtx {
192
193
193
194
using SkRPOffset = uint32_t ;
194
195
196
+ struct SkRasterPipeline_InitLaneMasksCtx {
197
+ uint8_t * tail;
198
+ };
199
+
195
200
struct SkRasterPipeline_ConstantCtx {
196
201
float value;
197
202
SkRPOffset dst;
198
203
};
199
204
200
205
struct SkRasterPipeline_UniformCtx {
201
- float * dst;
202
- const float * src;
206
+ float * dst;
207
+ const float * src;
203
208
};
204
209
205
210
struct SkRasterPipeline_BinaryOpCtx {
@@ -227,20 +232,20 @@ struct SkRasterPipeline_SwizzleCtx {
227
232
};
228
233
229
234
struct SkRasterPipeline_ShuffleCtx {
230
- float * ptr;
235
+ float * ptr;
231
236
int count;
232
237
uint16_t offsets[16 ]; // values must be byte offsets (4 * highp-stride * component-index)
233
238
};
234
239
235
240
struct SkRasterPipeline_SwizzleCopyCtx {
236
- float * dst;
237
- float * src; // src values must _not_ overlap dst values
241
+ float * dst;
242
+ float * src; // src values must _not_ overlap dst values
238
243
uint16_t offsets[4 ]; // values must be byte offsets (4 * highp-stride * component-index)
239
244
};
240
245
241
246
struct SkRasterPipeline_CopyIndirectCtx {
242
- float * dst;
243
- const float * src;
247
+ float * dst;
248
+ const float * src;
244
249
const uint32_t *indirectOffset; // this applies to `src` or `dst` based on the op
245
250
uint32_t indirectLimit; // the indirect offset is clamped to this upper bound
246
251
uint32_t slots; // the number of slots to copy
@@ -254,6 +259,10 @@ struct SkRasterPipeline_BranchCtx {
254
259
int offset; // contains the label ID during compilation, and the program offset when compiled
255
260
};
256
261
262
+ struct SkRasterPipeline_BranchIfAllLanesActiveCtx : public SkRasterPipeline_BranchCtx {
263
+ uint8_t * tail = nullptr ; // lanes past the tail are _never_ active, so we need to exclude them
264
+ };
265
+
257
266
struct SkRasterPipeline_BranchIfEqualCtx : public SkRasterPipeline_BranchCtx {
258
267
int value;
259
268
const int * ptr;
0 commit comments