| 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 |
// `SK_RASTER_PIPELINE_OPS_LOWP` defines ops that have parallel lowp and highp implementations. |
| 12 |
#define SK_RASTER_PIPELINE_OPS_LOWP(M) \ |
| 13 |
M(move_src_dst) M(move_dst_src) M(swap_src_dst) \ |
| 14 |
M(clamp_01) M(clamp_a_01) M(clamp_gamut) \ |
| 15 |
M(premul) M(premul_dst) \ |
| 16 |
M(force_opaque) M(force_opaque_dst) \ |
| 17 |
M(set_rgb) M(swap_rb) M(swap_rb_dst) \ |
| 18 |
M(black_color) M(white_color) \ |
| 19 |
M(uniform_color) M(uniform_color_dst) \ |
| 20 |
M(seed_shader) \ |
| 21 |
M(load_a8) M(load_a8_dst) M(store_a8) M(gather_a8) \ |
| 22 |
M(load_565) M(load_565_dst) M(store_565) M(gather_565) \ |
| 23 |
M(load_4444) M(load_4444_dst) M(store_4444) M(gather_4444) \ |
| 24 |
M(load_8888) M(load_8888_dst) M(store_8888) M(gather_8888) \ |
| 25 |
M(load_rg88) M(load_rg88_dst) M(store_rg88) M(gather_rg88) \ |
| 26 |
M(store_r8) \ |
| 27 |
M(alpha_to_gray) M(alpha_to_gray_dst) \ |
| 28 |
M(alpha_to_red) M(alpha_to_red_dst) \ |
| 29 |
M(bt709_luminance_or_luma_to_alpha) \ |
| 30 |
M(bt709_luminance_or_luma_to_rgb) \ |
| 31 |
M(bilerp_clamp_8888) \ |
| 32 |
M(load_src) M(store_src) M(store_src_a) \ |
| 33 |
M(load_dst) M(store_dst) \ |
| 34 |
M(scale_u8) M(scale_565) M(scale_1_float) M(scale_native) \ |
| 35 |
M( lerp_u8) M( lerp_565) M( lerp_1_float) M(lerp_native) \ |
| 36 |
M(dstatop) M(dstin) M(dstout) M(dstover) \ |
| 37 |
M(srcatop) M(srcin) M(srcout) M(srcover) \ |
| 38 |
M(clear) M(modulate) M(multiply) M(plus_) M(screen) M(xor_) \ |
| 39 |
M(darken) M(difference) \ |
| 40 |
M(exclusion) M(hardlight) M(lighten) M(overlay) \ |
| 41 |
M(srcover_rgba_8888) \ |
| 42 |
M(matrix_translate) M(matrix_scale_translate) \ |
| 43 |
M(matrix_2x3) \ |
| 44 |
M(matrix_perspective) \ |
| 45 |
M(decal_x) M(decal_y) M(decal_x_and_y) \ |
| 46 |
M(check_decal_mask) \ |
| 47 |
M(clamp_x_1) M(mirror_x_1) M(repeat_x_1) \ |
| 48 |
M(clamp_x_and_y) \ |
| 49 |
M(evenly_spaced_gradient) \ |
| 50 |
M(gradient) \ |
| 51 |
M(evenly_spaced_2_stop_gradient) \ |
| 52 |
M(xy_to_unit_angle) \ |
| 53 |
M(xy_to_radius) \ |
| 54 |
M(emboss) \ |
| 55 |
M(swizzle) \ |
| 56 |
M(debug_x) M(debug_y) M(debug_r) M(debug_g) M(debug_b) M(debug_a) \ |
| 57 |
M(debug_r_255) M(debug_g_255) M(debug_b_255) M(debug_a_255) |
| 58 |
|
| 59 |
/** |
| 60 |
* `SK_RASTER_PIPELINE_OPS_SKSL` defines ops used by SkSL. |
| 61 |
* |
| 62 |
* Design docs for SkSL in Raster Pipeline: go/sksl-rp |
| 63 |
* https://docs.google.com/document/d/1GCQeAGVGHubOCbmULVdXUkNiXdw9J4umai_M5X3JGS4/edit?usp=sharing |
| 64 |
*/ |
| 65 |
#define SK_RASTER_PIPELINE_OPS_SKSL(M) \ |
| 66 |
M(init_lane_masks) M(store_device_xy01) M(exchange_src) \ |
| 67 |
M(load_condition_mask) M(store_condition_mask) \ |
| 68 |
M(merge_condition_mask) M(merge_inv_condition_mask) \ |
| 69 |
M(load_loop_mask) M(store_loop_mask) M(mask_off_loop_mask) \ |
| 70 |
M(reenable_loop_mask) M(merge_loop_mask) M(case_op) M(continue_op) \ |
| 71 |
M(load_return_mask) M(store_return_mask) M(mask_off_return_mask) \ |
| 72 |
M(branch_if_all_lanes_active) M(branch_if_any_lanes_active) M(branch_if_no_lanes_active) \ |
| 73 |
M(branch_if_no_active_lanes_eq) M(jump) \ |
| 74 |
M(bitwise_and_imm_4_ints) \ |
| 75 |
M(bitwise_and_imm_3_ints) M(bitwise_and_imm_2_ints) M(bitwise_and_imm_int) \ |
| 76 |
M(bitwise_and_n_ints) M(bitwise_and_int) M(bitwise_and_2_ints) \ |
| 77 |
M(bitwise_and_3_ints) M(bitwise_and_4_ints) \ |
| 78 |
M(bitwise_or_n_ints) \ |
| 79 |
M(bitwise_or_int) M(bitwise_or_2_ints) M(bitwise_or_3_ints) M(bitwise_or_4_ints) \ |
| 80 |
M(bitwise_xor_imm_int) \ |
| 81 |
M(bitwise_xor_n_ints) M(bitwise_xor_int) M(bitwise_xor_2_ints) \ |
| 82 |
M(bitwise_xor_3_ints) M(bitwise_xor_4_ints) \ |
| 83 |
M(cast_to_float_from_int) M(cast_to_float_from_2_ints) \ |
| 84 |
M(cast_to_float_from_3_ints) M(cast_to_float_from_4_ints) \ |
| 85 |
M(cast_to_float_from_uint) M(cast_to_float_from_2_uints) \ |
| 86 |
M(cast_to_float_from_3_uints) M(cast_to_float_from_4_uints) \ |
| 87 |
M(cast_to_int_from_float) M(cast_to_int_from_2_floats) \ |
| 88 |
M(cast_to_int_from_3_floats) M(cast_to_int_from_4_floats) \ |
| 89 |
M(cast_to_uint_from_float) M(cast_to_uint_from_2_floats) \ |
| 90 |
M(cast_to_uint_from_3_floats) M(cast_to_uint_from_4_floats) \ |
| 91 |
M(abs_int) M(abs_2_ints) M(abs_3_ints) M(abs_4_ints) \ |
| 92 |
M(floor_float) M(floor_2_floats) M(floor_3_floats) M(floor_4_floats) \ |
| 93 |
M(ceil_float) M(ceil_2_floats) M(ceil_3_floats) M(ceil_4_floats) \ |
| 94 |
M(invsqrt_float) M(invsqrt_2_floats) M(invsqrt_3_floats) M(invsqrt_4_floats) \ |
| 95 |
M(inverse_mat2) M(inverse_mat3) M(inverse_mat4) \ |
| 96 |
M(sin_float) M(cos_float) M(tan_float) \ |
| 97 |
M(asin_float) M(acos_float) M(atan_float) M(atan2_n_floats) \ |
| 98 |
M(sqrt_float) M(pow_n_floats) M(exp_float) M(exp2_float) \ |
| 99 |
M(log_float) M(log2_float) M(refract_4_floats) \ |
| 100 |
M(copy_uniform) M(copy_2_uniforms) M(copy_3_uniforms) M(copy_4_uniforms) \ |
| 101 |
M(copy_constant) M(splat_2_constants) M(splat_3_constants) M(splat_4_constants) \ |
| 102 |
M(copy_slot_masked) M(copy_2_slots_masked) M(copy_3_slots_masked) M(copy_4_slots_masked) \ |
| 103 |
M(copy_from_indirect_unmasked) M(copy_from_indirect_uniform_unmasked) \ |
| 104 |
M(copy_to_indirect_masked) M(swizzle_copy_to_indirect_masked) \ |
| 105 |
M(copy_slot_unmasked) M(copy_2_slots_unmasked) \ |
| 106 |
M(copy_3_slots_unmasked) M(copy_4_slots_unmasked) \ |
| 107 |
M(copy_immutable_unmasked) M(copy_2_immutables_unmasked) \ |
| 108 |
M(copy_3_immutables_unmasked) M(copy_4_immutables_unmasked) \ |
| 109 |
M(swizzle_copy_slot_masked) M(swizzle_copy_2_slots_masked) \ |
| 110 |
M(swizzle_copy_3_slots_masked) M(swizzle_copy_4_slots_masked) \ |
| 111 |
M(swizzle_1) M(swizzle_2) M(swizzle_3) M(swizzle_4) M(shuffle) \ |
| 112 |
M(matrix_multiply_2) M(matrix_multiply_3) M(matrix_multiply_4) \ |
| 113 |
M(smoothstep_n_floats) M(dot_2_floats) M(dot_3_floats) M(dot_4_floats) \ |
| 114 |
M(add_imm_float) \ |
| 115 |
M(add_n_floats) M(add_float) M(add_2_floats) M(add_3_floats) M(add_4_floats) \ |
| 116 |
M(add_imm_int) \ |
| 117 |
M(add_n_ints) M(add_int) M(add_2_ints) M(add_3_ints) M(add_4_ints) \ |
| 118 |
M(sub_n_floats) M(sub_float) M(sub_2_floats) M(sub_3_floats) M(sub_4_floats) \ |
| 119 |
M(sub_n_ints) M(sub_int) M(sub_2_ints) M(sub_3_ints) M(sub_4_ints) \ |
| 120 |
M(mul_imm_float) \ |
| 121 |
M(mul_n_floats) M(mul_float) M(mul_2_floats) M(mul_3_floats) M(mul_4_floats) \ |
| 122 |
M(mul_imm_int) \ |
| 123 |
M(mul_n_ints) M(mul_int) M(mul_2_ints) M(mul_3_ints) M(mul_4_ints) \ |
| 124 |
M(div_n_floats) M(div_float) M(div_2_floats) M(div_3_floats) M(div_4_floats) \ |
| 125 |
M(div_n_ints) M(div_int) M(div_2_ints) M(div_3_ints) M(div_4_ints) \ |
| 126 |
M(div_n_uints) M(div_uint) M(div_2_uints) M(div_3_uints) M(div_4_uints) \ |
| 127 |
M(max_imm_float) \ |
| 128 |
M(max_n_floats) M(max_float) M(max_2_floats) M(max_3_floats) M(max_4_floats) \ |
| 129 |
M(max_n_ints) M(max_int) M(max_2_ints) M(max_3_ints) M(max_4_ints) \ |
| 130 |
M(max_n_uints) M(max_uint) M(max_2_uints) M(max_3_uints) M(max_4_uints) \ |
| 131 |
M(min_imm_float) \ |
| 132 |
M(min_n_floats) M(min_float) M(min_2_floats) M(min_3_floats) M(min_4_floats) \ |
| 133 |
M(min_n_ints) M(min_int) M(min_2_ints) M(min_3_ints) M(min_4_ints) \ |
| 134 |
M(min_n_uints) M(min_uint) M(min_2_uints) M(min_3_uints) M(min_4_uints) \ |
| 135 |
M(mod_n_floats) M(mod_float) M(mod_2_floats) M(mod_3_floats) M(mod_4_floats) \ |
| 136 |
M(mix_n_floats) M(mix_float) M(mix_2_floats) M(mix_3_floats) M(mix_4_floats) \ |
| 137 |
M(mix_n_ints) M(mix_int) M(mix_2_ints) M(mix_3_ints) M(mix_4_ints) \ |
| 138 |
M(cmplt_imm_float) \ |
| 139 |
M(cmplt_n_floats) M(cmplt_float) M(cmplt_2_floats) M(cmplt_3_floats) M(cmplt_4_floats) \ |
| 140 |
M(cmplt_imm_int) \ |
| 141 |
M(cmplt_n_ints) M(cmplt_int) M(cmplt_2_ints) M(cmplt_3_ints) M(cmplt_4_ints) \ |
| 142 |
M(cmplt_imm_uint) \ |
| 143 |
M(cmplt_n_uints) M(cmplt_uint) M(cmplt_2_uints) M(cmplt_3_uints) M(cmplt_4_uints) \ |
| 144 |
M(cmple_imm_float) \ |
| 145 |
M(cmple_n_floats) M(cmple_float) M(cmple_2_floats) M(cmple_3_floats) M(cmple_4_floats) \ |
| 146 |
M(cmple_imm_int) \ |
| 147 |
M(cmple_n_ints) M(cmple_int) M(cmple_2_ints) M(cmple_3_ints) M(cmple_4_ints) \ |
| 148 |
M(cmple_imm_uint) \ |
| 149 |
M(cmple_n_uints) M(cmple_uint) M(cmple_2_uints) M(cmple_3_uints) M(cmple_4_uints) \ |
| 150 |
M(cmpeq_imm_float) \ |
| 151 |
M(cmpeq_n_floats) M(cmpeq_float) M(cmpeq_2_floats) M(cmpeq_3_floats) M(cmpeq_4_floats) \ |
| 152 |
M(cmpeq_imm_int) \ |
| 153 |
M(cmpeq_n_ints) M(cmpeq_int) M(cmpeq_2_ints) M(cmpeq_3_ints) M(cmpeq_4_ints) \ |
| 154 |
M(cmpne_imm_float) \ |
| 155 |
M(cmpne_n_floats) M(cmpne_float) M(cmpne_2_floats) M(cmpne_3_floats) M(cmpne_4_floats) \ |
| 156 |
M(cmpne_imm_int) \ |
| 157 |
M(cmpne_n_ints) M(cmpne_int) M(cmpne_2_ints) M(cmpne_3_ints) M(cmpne_4_ints) \ |
| 158 |
M(trace_line) M(trace_var) M(trace_enter) M(trace_exit) M(trace_scope) |
| 159 |
|
| 160 |
// `SK_RASTER_PIPELINE_OPS_HIGHP_ONLY` defines ops that are only available in highp; this subset |
| 161 |
// includes all of SkSL. |
| 162 |
#define SK_RASTER_PIPELINE_OPS_HIGHP_ONLY(M) \ |
| 163 |
M(callback) \ |
| 164 |
M(stack_checkpoint) M(stack_rewind) \ |
| 165 |
M(unbounded_set_rgb) M(unbounded_uniform_color) \ |
| 166 |
M(unpremul) M(unpremul_polar) M(dither) \ |
| 167 |
M(load_16161616) M(load_16161616_dst) M(store_16161616) M(gather_16161616) \ |
| 168 |
M(load_a16) M(load_a16_dst) M(store_a16) M(gather_a16) \ |
| 169 |
M(load_r16) M(load_r16_dst) M(store_r16) M(gather_r16) \ |
| 170 |
M(load_rg1616) M(load_rg1616_dst) M(store_rg1616) M(gather_rg1616) \ |
| 171 |
M(load_f16) M(load_f16_dst) M(store_f16) M(gather_f16) \ |
| 172 |
M(load_af16) M(load_af16_dst) M(store_af16) M(gather_af16) \ |
| 173 |
M(load_rgf16) M(load_rgf16_dst) M(store_rgf16) M(gather_rgf16) \ |
| 174 |
M(load_f32) M(load_f32_dst) M(store_f32) M(gather_f32) \ |
| 175 |
M(load_1010102) M(load_1010102_dst) M(store_1010102) M(gather_1010102) \ |
| 176 |
M(load_1010102_xr) M(load_1010102_xr_dst) M(store_1010102_xr) M(gather_1010102_xr) \ |
| 177 |
M(load_10x6) M(load_10x6_dst) M(store_10x6) M(gather_10x6) \ |
| 178 |
M(gather_10101010_xr) M(load_10101010_xr) M(load_10101010_xr_dst) M(store_10101010_xr) \ |
| 179 |
M(store_src_rg) M(load_src_rg) \ |
| 180 |
M(byte_tables) \ |
| 181 |
M(colorburn) M(colordodge) M(softlight) \ |
| 182 |
M(hue) M(saturation) M(color) M(luminosity) \ |
| 183 |
M(matrix_3x3) M(matrix_3x4) M(matrix_4x5) M(matrix_4x3) \ |
| 184 |
M(parametric) M(gamma_) M(PQish) M(HLGish) M(HLGinvish) M(ootf) \ |
| 185 |
M(rgb_to_hsl) M(hsl_to_rgb) \ |
| 186 |
M(css_lab_to_xyz) M(css_oklab_to_linear_srgb) \ |
| 187 |
M(css_oklab_gamut_map_to_linear_srgb) \ |
| 188 |
M(css_hcl_to_lab) \ |
| 189 |
M(css_hsl_to_srgb) M(css_hwb_to_srgb) \ |
| 190 |
M(gauss_a_to_rgba) \ |
| 191 |
M(mirror_x) M(repeat_x) \ |
| 192 |
M(mirror_y) M(repeat_y) \ |
| 193 |
M(negate_x) \ |
| 194 |
M(bilerp_clamp_8888_force_highp) \ |
| 195 |
M(bicubic_clamp_8888) \ |
| 196 |
M(bilinear_setup) \ |
| 197 |
M(bilinear_nx) M(bilinear_px) M(bilinear_ny) M(bilinear_py) \ |
| 198 |
M(bicubic_setup) \ |
| 199 |
M(bicubic_n3x) M(bicubic_n1x) M(bicubic_p1x) M(bicubic_p3x) \ |
| 200 |
M(bicubic_n3y) M(bicubic_n1y) M(bicubic_p1y) M(bicubic_p3y) \ |
| 201 |
M(accumulate) \ |
| 202 |
M(perlin_noise) \ |
| 203 |
M(mipmap_linear_init) M(mipmap_linear_update) M(mipmap_linear_finish) \ |
| 204 |
M(xy_to_2pt_conical_strip) \ |
| 205 |
M(xy_to_2pt_conical_focal_on_circle) \ |
| 206 |
M(xy_to_2pt_conical_well_behaved) \ |
| 207 |
M(xy_to_2pt_conical_smaller) \ |
| 208 |
M(xy_to_2pt_conical_greater) \ |
| 209 |
M(alter_2pt_conical_compensate_focal) \ |
| 210 |
M(alter_2pt_conical_unswap) \ |
| 211 |
M(mask_2pt_conical_nan) \ |
| 212 |
M(mask_2pt_conical_degenerates) M(apply_vector_mask) \ |
| 213 |
M(set_base_pointer) \ |
| 214 |
SK_RASTER_PIPELINE_OPS_SKSL(M) |
| 215 |
|
| 216 |
// The combined set of all RasterPipeline ops: |
| 217 |
#define SK_RASTER_PIPELINE_OPS_ALL(M) \ |
| 218 |
SK_RASTER_PIPELINE_OPS_LOWP(M) \ |
| 219 |
SK_RASTER_PIPELINE_OPS_HIGHP_ONLY(M) |
| 220 |
|
| 221 |
// An enumeration of every RasterPipeline op: |
| 222 |
enum class SkRasterPipelineOp { |
| 223 |
#define M(op) op, |
| 224 |
SK_RASTER_PIPELINE_OPS_ALL(M) |
| 225 |
#undef M |
| 226 |
}; |
| 227 |
|
| 228 |
// A count of raster pipeline ops: |
| 229 |
#define M(st) +1 |
| 230 |
static constexpr int kNumRasterPipelineLowpOps = SK_RASTER_PIPELINE_OPS_LOWP(M); |
| 231 |
static constexpr int kNumRasterPipelineHighpOps = SK_RASTER_PIPELINE_OPS_ALL(M); |
| 232 |
#undef M |
| 233 |
|
| 234 |
#endif // SkRasterPipelineOpList_DEFINED |