}
void
-fs_visitor::emit_fb_writes()
+fs_visitor::do_emit_fb_writes(int nr_color_regions, bool replicate_alpha)
{
- assert(stage == MESA_SHADER_FRAGMENT);
- struct brw_wm_prog_data *prog_data = brw_wm_prog_data(this->prog_data);
- brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;
-
fs_inst *inst = NULL;
- if (source_depth_to_render_target && devinfo->ver == 6) {
- /* For outputting oDepth on gfx6, SIMD8 writes have to be used. This
- * would require SIMD8 moves of each half to message regs, e.g. by using
- * the SIMD lowering pass. Unfortunately this is more difficult than it
- * sounds because the SIMD8 single-source message lacks channel selects
- * for the second and third subspans.
- */
- limit_dispatch_width(8, "Depth writes unsupported in SIMD16+ mode.\n");
- }
-
- if (nir->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_STENCIL)) {
- /* From the 'Render Target Write message' section of the docs:
- * "Output Stencil is not supported with SIMD16 Render Target Write
- * Messages."
- */
- limit_dispatch_width(8, "gl_FragStencilRefARB unsupported "
- "in SIMD16+ mode.\n");
- }
-
- /* ANV doesn't know about sample mask output during the wm key creation
- * so we compute if we need replicate alpha and emit alpha to coverage
- * workaround here.
- */
- const bool replicate_alpha = key->alpha_test_replicate_alpha ||
- (key->nr_color_regions > 1 && key->alpha_to_coverage &&
- (sample_mask.file == BAD_FILE || devinfo->ver == 6));
-
- for (int target = 0; target < key->nr_color_regions; target++) {
+ for (int target = 0; target < nr_color_regions; target++) {
/* Skip over outputs that weren't written. */
if (this->outputs[target].file == BAD_FILE)
continue;
inst->target = target;
}
- prog_data->dual_src_blend = (this->dual_src_output.file != BAD_FILE &&
- this->outputs[0].file != BAD_FILE);
- assert(!prog_data->dual_src_blend || key->nr_color_regions == 1);
-
if (inst == NULL) {
/* Even if there's no color buffers enabled, we still need to send
* alpha out the pipeline to our null renderbuffer to support
inst->last_rt = true;
inst->eot = true;
+}
+
+void
+fs_visitor::emit_fb_writes()
+{
+ assert(stage == MESA_SHADER_FRAGMENT);
+ struct brw_wm_prog_data *prog_data = brw_wm_prog_data(this->prog_data);
+ brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;
+
+ if (source_depth_to_render_target && devinfo->ver == 6) {
+ /* For outputting oDepth on gfx6, SIMD8 writes have to be used. This
+ * would require SIMD8 moves of each half to message regs, e.g. by using
+ * the SIMD lowering pass. Unfortunately this is more difficult than it
+ * sounds because the SIMD8 single-source message lacks channel selects
+ * for the second and third subspans.
+ */
+ limit_dispatch_width(8, "Depth writes unsupported in SIMD16+ mode.\n");
+ }
+
+ if (nir->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_STENCIL)) {
+ /* From the 'Render Target Write message' section of the docs:
+ * "Output Stencil is not supported with SIMD16 Render Target Write
+ * Messages."
+ */
+ limit_dispatch_width(8, "gl_FragStencilRefARB unsupported "
+ "in SIMD16+ mode.\n");
+ }
+
+ /* ANV doesn't know about sample mask output during the wm key creation
+ * so we compute if we need replicate alpha and emit alpha to coverage
+ * workaround here.
+ */
+ const bool replicate_alpha = key->alpha_test_replicate_alpha ||
+ (key->nr_color_regions > 1 && key->alpha_to_coverage &&
+ (sample_mask.file == BAD_FILE || devinfo->ver == 6));
+
+ prog_data->dual_src_blend = (this->dual_src_output.file != BAD_FILE &&
+ this->outputs[0].file != BAD_FILE);
+ assert(!prog_data->dual_src_blend || key->nr_color_regions == 1);
if (devinfo->ver >= 11 && devinfo->ver <= 12 &&
prog_data->dual_src_blend) {
limit_dispatch_width(8, "Dual source blending unsupported "
"in SIMD16 and SIMD32 modes.\n");
}
+
+ do_emit_fb_writes(key->nr_color_regions, replicate_alpha);
}
void