for (unsigned c = 0; c < 4; ++c) {
/* Decide properties based on channel */
nir_lower_blend_channel chan =
- (c < 3) ? options.rt[0].rgb : options.rt[0].alpha;
+ (c < 3) ? options.rgb : options.alpha;
nir_ssa_def *psrc = nir_channel(b, src, c);
nir_ssa_def *pdst = nir_channel(b, dst, c);
/* Then just recombine with an applied colormask */
nir_ssa_def *blended = nir_vec(b, channels, 4);
- return nir_color_mask(b, options.rt[0].colormask, blended, dst);
+ return nir_color_mask(b, options.colormask, blended, dst);
}
static bool
nir_is_blend_replace(nir_lower_blend_options options)
{
return
- nir_is_blend_channel_replace(options.rt[0].rgb) &&
- nir_is_blend_channel_replace(options.rt[0].alpha);
+ nir_is_blend_channel_replace(options.rgb) &&
+ nir_is_blend_channel_replace(options.alpha);
}
void
*/
static nir_lower_blend_options
-nir_make_options(const struct pipe_blend_state *blend, unsigned nr_cbufs)
+nir_make_options(const struct pipe_blend_state *blend, unsigned i)
{
nir_lower_blend_options options;
- for (unsigned i = 0; i < nr_cbufs; ++i) {
- /* If blend is disabled, we just use replace mode */
-
- nir_lower_blend_channel rgb = {
- .func = BLEND_FUNC_ADD,
- .src_factor = BLEND_FACTOR_ZERO,
- .invert_src_factor = true,
- .dst_factor = BLEND_FACTOR_ZERO,
- .invert_dst_factor = false
- };
-
- nir_lower_blend_channel alpha = rgb;
-
- if (blend->rt[i].blend_enable) {
- rgb.func = util_blend_func_to_shader(blend->rt[i].rgb_func);
- rgb.src_factor = util_blend_factor_to_shader(blend->rt[i].rgb_src_factor);
- rgb.dst_factor = util_blend_factor_to_shader(blend->rt[i].rgb_dst_factor);
- rgb.invert_src_factor = util_blend_factor_is_inverted(blend->rt[i].rgb_src_factor);
- rgb.invert_dst_factor = util_blend_factor_is_inverted(blend->rt[i].rgb_dst_factor);
-
- alpha.func = util_blend_func_to_shader(blend->rt[i].alpha_func);
- alpha.src_factor = util_blend_factor_to_shader(blend->rt[i].alpha_src_factor);
- alpha.dst_factor = util_blend_factor_to_shader(blend->rt[i].alpha_dst_factor);
- alpha.invert_src_factor = util_blend_factor_is_inverted(blend->rt[i].alpha_src_factor);
- alpha.invert_dst_factor = util_blend_factor_is_inverted(blend->rt[i].alpha_dst_factor);
- }
-
- options.rt[i].rgb = rgb;
- options.rt[i].alpha = alpha;
-
- options.rt[i].colormask = blend->rt[i].colormask;
+ /* If blend is disabled, we just use replace mode */
+
+ nir_lower_blend_channel rgb = {
+ .func = BLEND_FUNC_ADD,
+ .src_factor = BLEND_FACTOR_ZERO,
+ .invert_src_factor = true,
+ .dst_factor = BLEND_FACTOR_ZERO,
+ .invert_dst_factor = false
+ };
+
+ nir_lower_blend_channel alpha = rgb;
+
+ if (blend->rt[i].blend_enable) {
+ rgb.func = util_blend_func_to_shader(blend->rt[i].rgb_func);
+ rgb.src_factor = util_blend_factor_to_shader(blend->rt[i].rgb_src_factor);
+ rgb.dst_factor = util_blend_factor_to_shader(blend->rt[i].rgb_dst_factor);
+ rgb.invert_src_factor = util_blend_factor_is_inverted(blend->rt[i].rgb_src_factor);
+ rgb.invert_dst_factor = util_blend_factor_is_inverted(blend->rt[i].rgb_dst_factor);
+
+ alpha.func = util_blend_func_to_shader(blend->rt[i].alpha_func);
+ alpha.src_factor = util_blend_factor_to_shader(blend->rt[i].alpha_src_factor);
+ alpha.dst_factor = util_blend_factor_to_shader(blend->rt[i].alpha_dst_factor);
+ alpha.invert_src_factor = util_blend_factor_is_inverted(blend->rt[i].alpha_src_factor);
+ alpha.invert_dst_factor = util_blend_factor_is_inverted(blend->rt[i].alpha_dst_factor);
}
+ options.rgb = rgb;
+ options.alpha = alpha;
+
+ options.colormask = blend->rt[i].colormask;
+
return options;
}
nir_store_var(b, c_out, s_src, 0xFF);
nir_lower_blend_options options =
- nir_make_options(cso, 1);
+ nir_make_options(cso, rt);
NIR_PASS_V(shader, nir_lower_blend, options);
NIR_PASS_V(shader, nir_lower_framebuffer, format, screen->gpu_id);
uint32_t *words = (uint32_t *) code;
unsigned num_words = size / 4;
int tabs = 0;
+ num_words = MIN2(num_words, 100);
bool prefetch_flag = false;
while (i < num_words) {
unsigned tag = words[i] & 0xF;
unsigned next_tag = (words[i] >> 4) & 0xF;
+ printf("\t%X -> %X\n", tag, next_tag);
unsigned num_quad_words = midgard_word_size[tag];
if (midg_tags[i] && midg_tags[i] != tag) {
/* Break based on instruction prefetch flag */
+#if 0
if (i < num_words && next == 1) {
prefetch_flag = true;
if (midgard_word_types[words[i] & 0xF] != midgard_word_type_alu)
break;
}
+#endif
i += 4 * num_quad_words;
}