• Home
  • Raw
  • Download

Lines Matching +full:enum +full:- +full:conversion

3  * Copyright (C) 2019-2021 Collabora, Ltd.
45 factor_is_supported(enum pipe_blendfactor factor) in factor_is_supported()
60 is_2srcdest(enum pipe_blend_func blend_func, enum pipe_blendfactor src_factor, in is_2srcdest()
61 enum pipe_blendfactor dest_factor, bool is_alpha) in is_2srcdest()
71 can_fixed_function_equation(enum pipe_blend_func blend_func, in can_fixed_function_equation()
72 enum pipe_blendfactor src_factor, in can_fixed_function_equation()
73 enum pipe_blendfactor dest_factor, bool is_alpha, in can_fixed_function_equation()
89 enum pipe_blendfactor src = util_blendfactor_without_invert(src_factor); in can_fixed_function_equation()
90 enum pipe_blendfactor dest = util_blendfactor_without_invert(dest_factor); in can_fixed_function_equation()
97 blend_factor_constant_mask(enum pipe_blendfactor factor) in blend_factor_constant_mask()
106 return 0b0000; /* - */ in blend_factor_constant_mask()
119 * valid for fixed-function, so check for this condition */
149 static enum mali_blend_operand_c
150 to_c_factor(enum pipe_blendfactor factor) in to_c_factor()
179 to_panfrost_function(enum pipe_blend_func blend_func, in to_panfrost_function()
180 enum pipe_blendfactor src_factor, in to_panfrost_function()
181 enum pipe_blendfactor dest_factor, bool is_alpha, in to_panfrost_function()
199 function->a = MALI_BLEND_OPERAND_A_ZERO; in to_panfrost_function()
200 function->b = MALI_BLEND_OPERAND_B_DEST; in to_panfrost_function()
202 function->negate_b = true; in to_panfrost_function()
203 function->invert_c = dest_inverted; in to_panfrost_function()
204 function->c = to_c_factor(dest_factor); in to_panfrost_function()
206 function->a = MALI_BLEND_OPERAND_A_SRC; in to_panfrost_function()
207 function->b = MALI_BLEND_OPERAND_B_DEST; in to_panfrost_function()
209 function->negate_b = true; in to_panfrost_function()
211 function->negate_a = true; in to_panfrost_function()
212 function->invert_c = dest_inverted; in to_panfrost_function()
213 function->c = to_c_factor(dest_factor); in to_panfrost_function()
215 function->a = MALI_BLEND_OPERAND_A_ZERO; in to_panfrost_function()
216 function->b = MALI_BLEND_OPERAND_B_SRC; in to_panfrost_function()
218 function->negate_b = true; in to_panfrost_function()
219 function->invert_c = src_inverted; in to_panfrost_function()
220 function->c = to_c_factor(src_factor); in to_panfrost_function()
222 function->a = MALI_BLEND_OPERAND_A_DEST; in to_panfrost_function()
223 function->b = MALI_BLEND_OPERAND_B_SRC; in to_panfrost_function()
225 function->negate_a = true; in to_panfrost_function()
227 function->negate_b = true; in to_panfrost_function()
228 function->invert_c = src_inverted; in to_panfrost_function()
229 function->c = to_c_factor(src_factor); in to_panfrost_function()
231 function->a = MALI_BLEND_OPERAND_A_ZERO; in to_panfrost_function()
232 function->invert_c = src_inverted; in to_panfrost_function()
233 function->c = to_c_factor(src_factor); in to_panfrost_function()
237 function->b = MALI_BLEND_OPERAND_B_SRC_PLUS_DEST; in to_panfrost_function()
240 function->negate_b = true; in to_panfrost_function()
243 function->b = MALI_BLEND_OPERAND_B_SRC_MINUS_DEST; in to_panfrost_function()
250 function->a = MALI_BLEND_OPERAND_A_ZERO; in to_panfrost_function()
251 function->b = MALI_BLEND_OPERAND_B_DEST; in to_panfrost_function()
252 function->c = MALI_BLEND_OPERAND_C_SRC_X_2; in to_panfrost_function()
258 function->a = MALI_BLEND_OPERAND_A_DEST; in to_panfrost_function()
259 function->invert_c = src_inverted; in to_panfrost_function()
260 function->c = to_c_factor(src_factor); in to_panfrost_function()
264 function->b = MALI_BLEND_OPERAND_B_SRC_MINUS_DEST; in to_panfrost_function()
267 function->b = MALI_BLEND_OPERAND_B_SRC_PLUS_DEST; in to_panfrost_function()
268 function->negate_b = true; in to_panfrost_function()
271 function->b = MALI_BLEND_OPERAND_B_SRC_PLUS_DEST; in to_panfrost_function()
272 function->negate_a = true; in to_panfrost_function()
292 /* Also detect open-coded opaque blending */ in pan_blend_is_opaque()
308 is_factor_01(enum pipe_blendfactor factor, unsigned val, unsigned srca) in is_factor_01()
324 return (val == (1 - srca)); in is_factor_01()
339 * Subtractive blending: Fails in general (D = S * f_S - D * f_D). We
340 * would need f_S = 0 and f_D = -1, which is not valid in the APIs.
342 * Reverse subtractive blending (D = D * f_D - S * f_S), we need f_D = 1
376 * Subtractive blending: S = S * f_s - D * f_d. Same as additive blending.
378 * Reverse subtractive blending: S = D * f_d - S * f_s. Fails in general since
379 * it would require f_s = -1, which is not valid in the APIs.
402 is_dest_factor(enum pipe_blendfactor factor, bool alpha) in is_dest_factor()
431 * state. Assumes the equation can be represented as fixed-function. */
439 out->color_mask = equation.color_mask; in pan_blend_to_fixed_function_equation()
440 out->rgb.a = MALI_BLEND_OPERAND_A_SRC; in pan_blend_to_fixed_function_equation()
441 out->rgb.b = MALI_BLEND_OPERAND_B_SRC; in pan_blend_to_fixed_function_equation()
442 out->rgb.c = MALI_BLEND_OPERAND_C_ZERO; in pan_blend_to_fixed_function_equation()
443 out->alpha.a = MALI_BLEND_OPERAND_A_SRC; in pan_blend_to_fixed_function_equation()
444 out->alpha.b = MALI_BLEND_OPERAND_B_SRC; in pan_blend_to_fixed_function_equation()
445 out->alpha.c = MALI_BLEND_OPERAND_C_ZERO; in pan_blend_to_fixed_function_equation()
449 /* Compile the fixed-function blend */ in pan_blend_to_fixed_function_equation()
451 equation.rgb_dst_factor, false, &out->rgb); in pan_blend_to_fixed_function_equation()
453 equation.alpha_dst_factor, true, &out->alpha); in pan_blend_to_fixed_function_equation()
455 out->color_mask = equation.color_mask; in pan_blend_to_fixed_function_equation()
476 cache->gpu_id = gpu_id; in pan_blend_shader_cache_init()
477 cache->shaders = pan_blend_shader_key_table_create(NULL); in pan_blend_shader_cache_init()
478 pthread_mutex_init(&cache->lock, NULL); in pan_blend_shader_cache_init()
484 _mesa_hash_table_destroy(cache->shaders, NULL); in pan_blend_shader_cache_cleanup()
485 pthread_mutex_destroy(&cache->lock); in pan_blend_shader_cache_cleanup()
491 logicop_str(enum pipe_logicop logicop) in logicop_str()
499 return "and-inverted"; in logicop_str()
501 return "copy-inverted"; in logicop_str()
503 return "and-reverse"; in logicop_str()
517 return "or-inverted"; in logicop_str()
521 return "or-reverse"; in logicop_str()
545 if (!rt_state->equation.blend_enable) { in get_equation_str()
547 (rt_state->equation.color_mask & 1) ? "R" : "", in get_equation_str()
548 (rt_state->equation.color_mask & 2) ? "G" : "", in get_equation_str()
549 (rt_state->equation.color_mask & 4) ? "B" : "", in get_equation_str()
550 (rt_state->equation.color_mask & 8) ? "A" : ""); in get_equation_str()
555 if (rt_state->equation.color_mask & 7) { in get_equation_str()
556 assert(rt_state->equation.rgb_func < ARRAY_SIZE(funcs)); in get_equation_str()
559 (rt_state->equation.color_mask & 1) ? "R" : "", in get_equation_str()
560 (rt_state->equation.color_mask & 2) ? "G" : "", in get_equation_str()
561 (rt_state->equation.color_mask & 4) ? "B" : "", in get_equation_str()
562 funcs[rt_state->equation.rgb_func], in get_equation_str()
563 util_blendfactor_is_inverted(rt_state->equation.rgb_src_factor) ? "-" in get_equation_str()
566 rt_state->equation.rgb_src_factor)], in get_equation_str()
567 util_blendfactor_is_inverted(rt_state->equation.rgb_dst_factor) ? "-" in get_equation_str()
570 rt_state->equation.rgb_dst_factor)], in get_equation_str()
571 rt_state->equation.color_mask & 8 ? ";" : ""); in get_equation_str()
574 len -= ret; in get_equation_str()
577 if (rt_state->equation.color_mask & 8) { in get_equation_str()
578 assert(rt_state->equation.alpha_func < ARRAY_SIZE(funcs)); in get_equation_str()
581 funcs[rt_state->equation.alpha_func], in get_equation_str()
582 util_blendfactor_is_inverted(rt_state->equation.alpha_src_factor) ? "-" in get_equation_str()
585 rt_state->equation.alpha_src_factor)], in get_equation_str()
586 util_blendfactor_is_inverted(rt_state->equation.alpha_dst_factor) ? "-" in get_equation_str()
589 rt_state->equation.alpha_dst_factor)]); in get_equation_str()
592 len -= ret; in get_equation_str()
600 if (intr->intrinsic != nir_intrinsic_load_blend_const_color_rgba) in pan_inline_blend_constants()
610 b->cursor = nir_after_instr(&intr->instr); in pan_inline_blend_constants()
612 nir_def_replace(&intr->def, constant); in pan_inline_blend_constants()
621 const struct pan_blend_rt_state *rt_state = &state->rts[rt]; in GENX()
629 util_format_name(rt_state->format), rt_state->nr_samples, in GENX()
630 state->logicop_enable ? "logicop" : "equation", in GENX()
631 state->logicop_enable ? logicop_str(state->logicop_func) : equation_str); in GENX()
634 util_format_description(rt_state->format); in GENX()
637 /* Bifrost/Valhall support 16-bit and 32-bit register formats for in GENX()
638 * LD_TILE/ST_TILE/BLEND, but do not support 8-bit. Rather than making in GENX()
639 * the fragment output 8-bit and inserting extra conversions in the in GENX()
640 * compiler, promote the output to 16-bit. The larger size is still in GENX()
641 * compatible with correct conversion semantics. in GENX()
647 .logicop_enable = state->logicop_enable, in GENX()
648 .logicop_func = state->logicop_func, in GENX()
651 options.rt[rt].colormask = rt_state->equation.color_mask; in GENX()
652 options.format[rt] = rt_state->format; in GENX()
654 if (!rt_state->equation.blend_enable) { in GENX()
664 options.rt[rt].rgb.func = rt_state->equation.rgb_func; in GENX()
665 options.rt[rt].rgb.src_factor = rt_state->equation.rgb_src_factor; in GENX()
666 options.rt[rt].rgb.dst_factor = rt_state->equation.rgb_dst_factor; in GENX()
667 options.rt[rt].alpha.func = rt_state->equation.alpha_func; in GENX()
668 options.rt[rt].alpha.src_factor = rt_state->equation.alpha_src_factor; in GENX()
669 options.rt[rt].alpha.dst_factor = rt_state->equation.alpha_dst_factor; in GENX()
688 if (state->alpha_to_one && src_type == nir_type_float32) { in GENX()
691 nir_imm_floatN_t(&b, 1.0, src->bit_size), in GENX()
695 /* On Midgard, the blend shader is responsible for format conversion. in GENX()
697 * saturate ourselves here. On Bifrost and later, the conversion in GENX()
712 b.shader->info.io_lowered = true; in GENX()
721 GENX(pan_blend_get_internal_desc)(enum pipe_format fmt, unsigned rt, in GENX()
729 cfg.fixed_function.num_comps = desc->nr_channels; in GENX()
739 cfg.fixed_function.conversion.register_format = in GENX()
743 cfg.fixed_function.conversion.register_format = in GENX()
748 cfg.fixed_function.conversion.register_format = in GENX()
752 cfg.fixed_function.conversion.register_format = in GENX()
757 cfg.fixed_function.conversion.register_format = in GENX()
761 cfg.fixed_function.conversion.register_format = in GENX()
768 cfg.fixed_function.conversion.memory_format = in GENX()
778 if (intr->intrinsic != nir_intrinsic_load_rt_conversion_pan) in inline_rt_conversion()
781 enum pipe_format *formats = data; in inline_rt_conversion()
784 uint64_t conversion = in inline_rt_conversion() local
787 b->cursor = nir_after_instr(&intr->instr); in inline_rt_conversion()
788 nir_def_rewrite_uses(&intr->def, nir_imm_int(b, conversion >> 32)); in inline_rt_conversion()
793 GENX(pan_inline_rt_conversion)(nir_shader *s, enum pipe_format *formats) in GENX()
807 .format = state->rts[rt].format, in GENX()
811 .has_constants = pan_blend_constant_mask(state->rts[rt].equation) != 0, in GENX()
812 .logicop_enable = state->logicop_enable, in GENX()
813 .logicop_func = state->logicop_func, in GENX()
814 .nr_samples = state->rts[rt].nr_samples, in GENX()
815 .equation = state->rts[rt].equation, in GENX()
816 .alpha_to_one = state->alpha_to_one, in GENX()
819 assert(PAN_ARCH <= 5 || state->logicop_enable || state->alpha_to_one || in GENX()
820 !pan_blend_is_opaque(state->rts[rt].equation)); in GENX()
821 assert(state->rts[rt].equation.color_mask != 0); in GENX()
824 _mesa_hash_table_search(cache->shaders, &key); in GENX()
825 struct pan_blend_shader *shader = he ? he->data : NULL; in GENX()
828 shader = rzalloc(cache->shaders, struct pan_blend_shader); in GENX()
829 shader->key = key; in GENX()
830 list_inithead(&shader->variants); in GENX()
831 _mesa_hash_table_insert(cache->shaders, &shader->key, shader); in GENX()
834 list_for_each_entry(struct pan_blend_shader_variant, iter, &shader->variants, in GENX()
837 !memcmp(iter->constants, state->constants, sizeof(iter->constants))) { in GENX()
844 if (shader->nvariants < PAN_BLEND_SHADER_MAX_VARIANTS) { in GENX()
846 util_dynarray_init(&variant->binary, variant); in GENX()
847 list_add(&variant->node, &shader->variants); in GENX()
848 shader->nvariants++; in GENX()
850 variant = list_last_entry(&shader->variants, in GENX()
852 list_del(&variant->node); in GENX()
853 list_add(&variant->node, &shader->variants); in GENX()
854 util_dynarray_clear(&variant->binary); in GENX()
857 memcpy(variant->constants, state->constants, sizeof(variant->constants)); in GENX()
864 (void *)state->constants); in GENX()
868 .gpu_id = cache->gpu_id, in GENX()
873 enum pipe_format rt_formats[8] = {0}; in GENX()
889 cache->gpu_id < 0x700); in GENX()
892 GENX(pan_shader_compile)(nir, &inputs, &variant->binary, &info); in GENX()
894 variant->work_reg_count = info.work_reg_count; in GENX()
897 variant->first_tag = info.midgard.first_tag; in GENX()