* during resolves because the resolve operations only know about the
* resource and not the renderbuffer.
*/
- if (isl_format_srgb_to_linear(render_format) !=
- isl_format_srgb_to_linear(format)) {
+ if (!crocus_render_formats_color_compatible(render_format, res->surf.format,
+ color)) {
return false;
}
aux_usage, clear_supported);
}
+bool
+crocus_render_formats_color_compatible(enum isl_format a, enum isl_format b,
+ union isl_color_value color)
+{
+ if (a == b)
+ return true;
+
+ /* A difference in color space doesn't matter for 0/1 values. */
+ if (isl_format_srgb_to_linear(a) == isl_format_srgb_to_linear(b) &&
+ isl_color_value_is_zero_one(color, a)) {
+ return true;
+ }
+
+ return false;
+}
+
enum isl_aux_usage
crocus_resource_render_aux_usage(struct crocus_context *ice,
struct crocus_resource *res,
return res->aux.usage;
case ISL_AUX_USAGE_CCS_D:
+ /* Disable CCS for some cases of texture-view rendering. On gfx12, HW
+ * may convert some subregions of shader output to fast-cleared blocks
+ * if CCS is enabled and the shader output matches the clear color.
+ * Existing fast-cleared blocks are correctly interpreted by the clear
+ * color and the resource format (see can_fast_clear_color). To avoid
+ * gaining new fast-cleared blocks that can't be interpreted by the
+ * resource format (and to avoid misinterpreting existing ones), shut
+ * off CCS when the interpretation of the clear color differs between
+ * the render_format and the resource format.
+ */
+ if (!crocus_render_formats_color_compatible(render_format,
+ res->surf.format,
+ res->aux.clear_color)) {
+ return ISL_AUX_USAGE_NONE;
+ }
+
/* Otherwise, we try to fall back to CCS_D */
if (isl_format_supports_ccs_d(devinfo, render_format))
return ISL_AUX_USAGE_CCS_D;
unsigned start_level, unsigned num_levels,
unsigned start_layer, unsigned num_layers);
+bool crocus_render_formats_color_compatible(enum isl_format a,
+ enum isl_format b,
+ union isl_color_value color);
enum isl_aux_usage crocus_resource_render_aux_usage(struct crocus_context *ice,
struct crocus_resource *res,
uint32_t level,