• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2023 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkRasterPipelineOpList_DEFINED
9 #define SkRasterPipelineOpList_DEFINED
10 
11 // There are two macros here: The first defines ops that have lowp (and highp) implementations.
12 // The second defines ops that are only present in the highp pipeline.
13 #define SK_RASTER_PIPELINE_OPS_LOWP(M)                             \
14     M(move_src_dst) M(move_dst_src) M(swap_src_dst)                \
15     M(clamp_01) M(clamp_gamut)                                     \
16     M(premul) M(premul_dst)                                        \
17     M(force_opaque) M(force_opaque_dst)                            \
18     M(set_rgb) M(swap_rb) M(swap_rb_dst)                           \
19     M(black_color) M(white_color)                                  \
20     M(uniform_color) M(uniform_color_dst)                          \
21     M(seed_shader)                                                 \
22     M(load_a8)     M(load_a8_dst)   M(store_a8)    M(gather_a8)    \
23     M(load_565)    M(load_565_dst)  M(store_565)   M(gather_565)   \
24     M(load_4444)   M(load_4444_dst) M(store_4444)  M(gather_4444)  \
25     M(load_8888)   M(load_8888_dst) M(store_8888)  M(gather_8888)  \
26     M(load_rg88)   M(load_rg88_dst) M(store_rg88)  M(gather_rg88)  \
27     M(store_r8)                                                    \
28     M(alpha_to_gray) M(alpha_to_gray_dst)                          \
29     M(alpha_to_red) M(alpha_to_red_dst)                            \
30     M(bt709_luminance_or_luma_to_alpha) M(bt709_luminance_or_luma_to_rgb) \
31     M(bilerp_clamp_8888)                                           \
32     M(load_src) M(store_src) M(store_src_a) M(load_dst) M(store_dst) \
33     M(scale_u8) M(scale_565) M(scale_1_float) M(scale_native)      \
34     M( lerp_u8) M( lerp_565) M( lerp_1_float) M(lerp_native)       \
35     M(dstatop) M(dstin) M(dstout) M(dstover)                       \
36     M(srcatop) M(srcin) M(srcout) M(srcover)                       \
37     M(clear) M(modulate) M(multiply) M(plus_) M(screen) M(xor_)    \
38     M(darken) M(difference)                                        \
39     M(exclusion) M(hardlight) M(lighten) M(overlay)                \
40     M(srcover_rgba_8888)                                           \
41     M(matrix_translate) M(matrix_scale_translate)                  \
42     M(matrix_2x3)                                                  \
43     M(matrix_perspective)                                          \
44     M(decal_x)    M(decal_y)   M(decal_x_and_y)                    \
45     M(check_decal_mask)                                            \
46     M(clamp_x_1) M(mirror_x_1) M(repeat_x_1)                       \
47     M(clamp_x_and_y)                                               \
48     M(evenly_spaced_gradient)                                      \
49     M(gradient)                                                    \
50     M(evenly_spaced_2_stop_gradient)                               \
51     M(xy_to_unit_angle)                                            \
52     M(xy_to_radius)                                                \
53     M(emboss)                                                      \
54     M(swizzle)
55 
56 #define SK_RASTER_PIPELINE_OPS_HIGHP_ONLY(M)                       \
57     M(callback)                                                    \
58     M(stack_checkpoint) M(stack_rewind)                            \
59     M(unbounded_set_rgb) M(unbounded_uniform_color)                \
60     M(unpremul) M(unpremul_polar) M(dither)                        \
61     M(load_16161616) M(load_16161616_dst) M(store_16161616) M(gather_16161616) \
62     M(load_a16)    M(load_a16_dst)  M(store_a16)   M(gather_a16)   \
63     M(load_rg1616) M(load_rg1616_dst) M(store_rg1616) M(gather_rg1616) \
64     M(load_f16)    M(load_f16_dst)  M(store_f16)   M(gather_f16)   \
65     M(load_af16)   M(load_af16_dst) M(store_af16)  M(gather_af16)  \
66     M(load_rgf16)  M(load_rgf16_dst) M(store_rgf16) M(gather_rgf16) \
67     M(load_f32)    M(load_f32_dst)  M(store_f32)   M(gather_f32)   \
68     M(load_rgf32)                   M(store_rgf32)                 \
69     M(load_1010102) M(load_1010102_dst) M(store_1010102) M(gather_1010102) \
70     M(load_1010102_xr) M(load_1010102_xr_dst) M(store_1010102_xr) \
71     M(store_u16_be)                                                \
72     M(store_src_rg) M(load_src_rg)                                 \
73     M(byte_tables)                                                 \
74     M(colorburn) M(colordodge) M(softlight)                        \
75     M(hue) M(saturation) M(color) M(luminosity)                    \
76     M(matrix_3x3) M(matrix_3x4) M(matrix_4x5) M(matrix_4x3)        \
77     M(parametric) M(gamma_) M(PQish) M(HLGish) M(HLGinvish)        \
78     M(rgb_to_hsl) M(hsl_to_rgb)                                    \
79     M(css_lab_to_xyz) M(css_oklab_to_linear_srgb)                  \
80     M(css_hcl_to_lab)                                              \
81     M(css_hsl_to_srgb) M(css_hwb_to_srgb)                          \
82     M(gauss_a_to_rgba)                                             \
83     M(mirror_x)   M(repeat_x)                                      \
84     M(mirror_y)   M(repeat_y)                                      \
85     M(negate_x)                                                    \
86     M(bicubic_clamp_8888)                                          \
87     M(bilinear_setup)                                              \
88     M(bilinear_nx) M(bilinear_px) M(bilinear_ny) M(bilinear_py)    \
89     M(bicubic_setup)                                               \
90     M(bicubic_n3x) M(bicubic_n1x) M(bicubic_p1x) M(bicubic_p3x)    \
91     M(bicubic_n3y) M(bicubic_n1y) M(bicubic_p1y) M(bicubic_p3y)    \
92     M(accumulate)                                                  \
93     M(mipmap_linear_init) M(mipmap_linear_update) M(mipmap_linear_finish) \
94     M(xy_to_2pt_conical_strip)                                     \
95     M(xy_to_2pt_conical_focal_on_circle)                           \
96     M(xy_to_2pt_conical_well_behaved)                              \
97     M(xy_to_2pt_conical_smaller)                                   \
98     M(xy_to_2pt_conical_greater)                                   \
99     M(alter_2pt_conical_compensate_focal)                          \
100     M(alter_2pt_conical_unswap)                                    \
101     M(mask_2pt_conical_nan)                                        \
102     M(mask_2pt_conical_degenerates) M(apply_vector_mask)           \
103     /* Dedicated SkSL stages begin here: */                                                   \
104     M(init_lane_masks) M(store_device_xy01)                                                   \
105     M(load_condition_mask) M(store_condition_mask) M(merge_condition_mask)                    \
106     M(load_loop_mask)      M(store_loop_mask)      M(mask_off_loop_mask)                      \
107     M(reenable_loop_mask)  M(merge_loop_mask)      M(case_op)                                 \
108     M(load_return_mask)    M(store_return_mask)    M(mask_off_return_mask)                    \
109     M(branch_if_any_active_lanes) M(branch_if_no_active_lanes)                                \
110     M(branch_if_no_active_lanes_eq)  M(jump)                                                  \
111     M(bitwise_and_n_ints)                                                                     \
112     M(bitwise_and_int) M(bitwise_and_2_ints) M(bitwise_and_3_ints) M(bitwise_and_4_ints)      \
113     M(bitwise_or_n_ints)                                                                      \
114     M(bitwise_or_int)  M(bitwise_or_2_ints)  M(bitwise_or_3_ints)  M(bitwise_or_4_ints)       \
115     M(bitwise_xor_n_ints)                                                                     \
116     M(bitwise_xor_int) M(bitwise_xor_2_ints) M(bitwise_xor_3_ints) M(bitwise_xor_4_ints)      \
117     M(bitwise_not_int) M(bitwise_not_2_ints) M(bitwise_not_3_ints) M(bitwise_not_4_ints)      \
118     M(cast_to_float_from_int)     M(cast_to_float_from_2_ints)                                \
119     M(cast_to_float_from_3_ints)  M(cast_to_float_from_4_ints)                                \
120     M(cast_to_float_from_uint)    M(cast_to_float_from_2_uints)                               \
121     M(cast_to_float_from_3_uints) M(cast_to_float_from_4_uints)                               \
122     M(cast_to_int_from_float)     M(cast_to_int_from_2_floats)                                \
123     M(cast_to_int_from_3_floats)  M(cast_to_int_from_4_floats)                                \
124     M(cast_to_uint_from_float)    M(cast_to_uint_from_2_floats)                               \
125     M(cast_to_uint_from_3_floats) M(cast_to_uint_from_4_floats)                               \
126     M(abs_float)        M(abs_2_floats)        M(abs_3_floats)        M(abs_4_floats)         \
127     M(abs_int)          M(abs_2_ints)          M(abs_3_ints)          M(abs_4_ints)           \
128     M(floor_float)      M(floor_2_floats)      M(floor_3_floats)      M(floor_4_floats)       \
129     M(ceil_float)       M(ceil_2_floats)       M(ceil_3_floats)       M(ceil_4_floats)        \
130     M(sin_float)        M(cos_float)           M(tan_float)           M(atan_float)           \
131     M(atan2_n_floats)   M(sqrt_float)          M(pow_n_floats)        M(exp_float)            \
132     M(copy_constant)    M(copy_2_constants)    M(copy_3_constants)    M(copy_4_constants)     \
133     M(copy_slot_masked) M(copy_2_slots_masked) M(copy_3_slots_masked) M(copy_4_slots_masked)  \
134     M(copy_from_indirect_masked)                                                              \
135     M(copy_slot_unmasked)          M(copy_2_slots_unmasked)                                   \
136     M(copy_3_slots_unmasked)       M(copy_4_slots_unmasked)                                   \
137     M(zero_slot_unmasked)          M(zero_2_slots_unmasked)                                   \
138     M(zero_3_slots_unmasked)       M(zero_4_slots_unmasked)                                   \
139     M(swizzle_copy_slot_masked)    M(swizzle_copy_2_slots_masked)                             \
140     M(swizzle_copy_3_slots_masked) M(swizzle_copy_4_slots_masked)                             \
141     M(swizzle_1) M(swizzle_2) M(swizzle_3) M(swizzle_4) M(shuffle)                            \
142     M(add_n_floats)   M(add_float)   M(add_2_floats)   M(add_3_floats)   M(add_4_floats)      \
143     M(add_n_ints)     M(add_int)     M(add_2_ints)     M(add_3_ints)     M(add_4_ints)        \
144     M(sub_n_floats)   M(sub_float)   M(sub_2_floats)   M(sub_3_floats)   M(sub_4_floats)      \
145     M(sub_n_ints)     M(sub_int)     M(sub_2_ints)     M(sub_3_ints)     M(sub_4_ints)        \
146     M(mul_n_floats)   M(mul_float)   M(mul_2_floats)   M(mul_3_floats)   M(mul_4_floats)      \
147     M(mul_n_ints)     M(mul_int)     M(mul_2_ints)     M(mul_3_ints)     M(mul_4_ints)        \
148     M(div_n_floats)   M(div_float)   M(div_2_floats)   M(div_3_floats)   M(div_4_floats)      \
149     M(div_n_ints)     M(div_int)     M(div_2_ints)     M(div_3_ints)     M(div_4_ints)        \
150     M(div_n_uints)    M(div_uint)    M(div_2_uints)    M(div_3_uints)    M(div_4_uints)       \
151     M(max_n_floats)   M(max_float)   M(max_2_floats)   M(max_3_floats)   M(max_4_floats)      \
152     M(max_n_ints)     M(max_int)     M(max_2_ints)     M(max_3_ints)     M(max_4_ints)        \
153     M(max_n_uints)    M(max_uint)    M(max_2_uints)    M(max_3_uints)    M(max_4_uints)       \
154     M(min_n_floats)   M(min_float)   M(min_2_floats)   M(min_3_floats)   M(min_4_floats)      \
155     M(min_n_ints)     M(min_int)     M(min_2_ints)     M(min_3_ints)     M(min_4_ints)        \
156     M(min_n_uints)    M(min_uint)    M(min_2_uints)    M(min_3_uints)    M(min_4_uints)       \
157     M(mix_n_floats)   M(mix_float)   M(mix_2_floats)   M(mix_3_floats)   M(mix_4_floats)      \
158     M(mix_n_ints)     M(mix_int)     M(mix_2_ints)     M(mix_3_ints)     M(mix_4_ints)        \
159                                      M(dot_2_floats)   M(dot_3_floats)   M(dot_4_floats)      \
160     M(cmplt_n_floats) M(cmplt_float) M(cmplt_2_floats) M(cmplt_3_floats) M(cmplt_4_floats)    \
161     M(cmplt_n_ints)   M(cmplt_int)   M(cmplt_2_ints)   M(cmplt_3_ints)   M(cmplt_4_ints)      \
162     M(cmplt_n_uints)  M(cmplt_uint)  M(cmplt_2_uints)  M(cmplt_3_uints)  M(cmplt_4_uints)     \
163     M(cmple_n_floats) M(cmple_float) M(cmple_2_floats) M(cmple_3_floats) M(cmple_4_floats)    \
164     M(cmple_n_ints)   M(cmple_int)   M(cmple_2_ints)   M(cmple_3_ints)   M(cmple_4_ints)      \
165     M(cmple_n_uints)  M(cmple_uint)  M(cmple_2_uints)  M(cmple_3_uints)  M(cmple_4_uints)     \
166     M(cmpeq_n_floats) M(cmpeq_float) M(cmpeq_2_floats) M(cmpeq_3_floats) M(cmpeq_4_floats)    \
167     M(cmpeq_n_ints)   M(cmpeq_int)   M(cmpeq_2_ints)   M(cmpeq_3_ints)   M(cmpeq_4_ints)      \
168     M(cmpne_n_floats) M(cmpne_float) M(cmpne_2_floats) M(cmpne_3_floats) M(cmpne_4_floats)    \
169     M(cmpne_n_ints)   M(cmpne_int)   M(cmpne_2_ints)   M(cmpne_3_ints)   M(cmpne_4_ints)
170 
171 // The combined list of all RasterPipeline ops:
172 #define SK_RASTER_PIPELINE_OPS_ALL(M) \
173     SK_RASTER_PIPELINE_OPS_LOWP(M)    \
174     SK_RASTER_PIPELINE_OPS_HIGHP_ONLY(M)
175 
176 // An enumeration of every RasterPipeline op:
177 enum class SkRasterPipelineOp {
178 #define M(op) op,
179     SK_RASTER_PIPELINE_OPS_ALL(M)
180 #undef M
181 };
182 
183 // A count of raster pipeline ops:
184 #define M(st) +1
185     static constexpr int kNumRasterPipelineLowpOps  = SK_RASTER_PIPELINE_OPS_LOWP(M);
186     static constexpr int kNumRasterPipelineHighpOps = SK_RASTER_PIPELINE_OPS_ALL(M);
187 #undef M
188 
189 #endif  // SkRasterPipelineOpList_DEFINED
190