for (unsigned k = 0; k < color_outputs; ++k) {
- unsigned location =
- (m_dual_source_blend && (semantics.location == FRAG_RESULT_COLOR)
- ? semantics.dual_source_blend_index
- : driver_location) + k;
+ unsigned location = semantics.location - FRAG_RESULT_DATA0;
- sfn_log << SfnLog::io << "Pixel output at loc:" << location << "\n";
+ if (semantics.location == FRAG_RESULT_COLOR)
+ location = driver_location + k;
+
+ if (semantics.dual_source_blend_index)
+ location = semantics.dual_source_blend_index;
+
+ sfn_log << SfnLog::io << "Pixel output at loc:" << location
+ << "("<< semantics.location << ") of "<< m_max_color_exports<<"\n";
if (location >= m_max_color_exports) {
sfn_log << SfnLog::io << "Pixel output loc:" << location
<< " dl:" << driver_location << " skipped because we have only "
<< m_max_color_exports << " CBs\n";
return true;
- ;
}
m_last_pixel_export = new ExportInstr(ExportInstr::pixel, location, value);
/* Hack: force dual source output handling if one color output has a
* dual_source_blend_index > 0 */
- if (semantics.location == FRAG_RESULT_COLOR &&
- semantics.dual_source_blend_index > 0)
+ if (semantics.dual_source_blend_index > 0)
m_dual_source_blend = true;
if (m_num_color_exports > 1)
m_fs_write_all = false;
unsigned mask = (0xfu << (location * 4));
+
+ /* If the i-th target format is set, all previous target formats must
+ * be non-zero to avoid hangs. - from radeonsi, seems to apply to eg as well.
+ /*/
+ for (unsigned i = 0; i < location; ++i)
+ mask |= (0x1u << (i * 4));
+
m_color_export_mask |= mask;
emit_instruction(m_last_pixel_export);