struct brw_fast_clear_state *fast_clear_state;
- /* Array of flags telling if auxiliary buffer is disabled for corresponding
- * renderbuffer. If draw_aux_buffer_disabled[i] is set then use of
- * auxiliary buffer for gl_framebuffer::_ColorDrawBuffers[i] is
- * disabled.
- * This is needed in case the same underlying buffer is also configured
- * to be sampled but with a format that the sampling engine can't treat
- * compressed or fast cleared.
+ /* Array of aux usages to use for drawing. Aux usage for render targets is
+ * a bit more complex than simply calling a single function so we need some
+ * way of passing it form brw_draw.c to surface state setup.
*/
- bool draw_aux_buffer_disabled[MAX_DRAW_BUFFERS];
+ enum isl_aux_usage draw_aux_usage[MAX_DRAW_BUFFERS];
__DRIcontext *driContext;
struct intel_screen *screen;
__DRIdrawable *drawable);
void intel_prepare_render(struct brw_context *brw);
-void brw_predraw_resolve_inputs(struct brw_context *brw, bool rendering);
+void brw_predraw_resolve_inputs(struct brw_context *brw, bool rendering,
+ bool *draw_aux_buffer_disabled);
void intel_resolve_for_dri2_flush(struct brw_context *brw,
__DRIdrawable *drawable);
*/
static bool
intel_disable_rb_aux_buffer(struct brw_context *brw,
+ bool *draw_aux_buffer_disabled,
struct intel_mipmap_tree *tex_mt,
unsigned min_level, unsigned num_levels,
const char *usage)
if (irb && irb->mt->bo == tex_mt->bo &&
irb->mt_level >= min_level &&
irb->mt_level < min_level + num_levels) {
- found = brw->draw_aux_buffer_disabled[i] = true;
+ found = draw_aux_buffer_disabled[i] = true;
}
}
* enabled depth texture, and flush the render cache for any dirty textures.
*/
void
-brw_predraw_resolve_inputs(struct brw_context *brw, bool rendering)
+brw_predraw_resolve_inputs(struct brw_context *brw, bool rendering,
+ bool *draw_aux_buffer_disabled)
{
struct gl_context *ctx = &brw->ctx;
struct intel_texture_object *tex_obj;
- memset(brw->draw_aux_buffer_disabled, 0,
- sizeof(brw->draw_aux_buffer_disabled));
-
BITSET_DECLARE(used_for_txf, MAX_COMBINED_TEXTURE_IMAGE_UNITS);
memset(used_for_txf, 0, sizeof(used_for_txf));
if (rendering) {
}
const bool disable_aux = rendering &&
- intel_disable_rb_aux_buffer(brw, tex_obj->mt, min_level, num_levels,
+ intel_disable_rb_aux_buffer(brw, draw_aux_buffer_disabled,
+ tex_obj->mt, min_level, num_levels,
"for sampling");
intel_miptree_prepare_texture(brw, tex_obj->mt, view_format,
if (tex_obj && tex_obj->mt) {
if (rendering) {
- intel_disable_rb_aux_buffer(brw, tex_obj->mt, 0, ~0,
+ intel_disable_rb_aux_buffer(brw, draw_aux_buffer_disabled,
+ tex_obj->mt, 0, ~0,
"as a shader image");
}
}
static void
-brw_predraw_resolve_framebuffer(struct brw_context *brw)
+brw_predraw_resolve_framebuffer(struct brw_context *brw,
+ bool *draw_aux_buffer_disabled)
{
struct gl_context *ctx = &brw->ctx;
struct intel_renderbuffer *depth_irb;
enum isl_aux_usage aux_usage =
intel_miptree_render_aux_usage(brw, irb->mt, isl_format,
blend_enabled,
- brw->draw_aux_buffer_disabled[i]);
+ draw_aux_buffer_disabled[i]);
+ brw->draw_aux_usage[i] = aux_usage;
intel_miptree_prepare_render(brw, irb->mt, irb->mt_level,
irb->mt_layer, irb->layer_count,
mesa_format mesa_format =
_mesa_get_render_format(ctx, intel_rb_format(irb));
enum isl_format isl_format = brw_isl_format_for_mesa_format(mesa_format);
- bool blend_enabled = ctx->Color.BlendEnabled & (1 << i);
- enum isl_aux_usage aux_usage =
- intel_miptree_render_aux_usage(brw, irb->mt, isl_format,
- blend_enabled,
- brw->draw_aux_buffer_disabled[i]);
+ enum isl_aux_usage aux_usage = brw->draw_aux_usage[i];
brw_render_cache_add_bo(brw, irb->mt->bo, isl_format, aux_usage);
* and finalizing textures but before setting up any hardware state for
* this draw call.
*/
- brw_predraw_resolve_inputs(brw, true);
- brw_predraw_resolve_framebuffer(brw);
+ bool draw_aux_buffer_disabled[MAX_DRAW_BUFFERS] = { };
+ brw_predraw_resolve_inputs(brw, true, draw_aux_buffer_disabled);
+ brw_predraw_resolve_framebuffer(brw, draw_aux_buffer_disabled);
/* Bind all inputs, derive varying and size information:
*/
}
enum isl_format isl_format = brw->mesa_to_isl_render_format[rb_format];
- enum isl_aux_usage aux_usage =
- intel_miptree_render_aux_usage(brw, mt, isl_format,
- ctx->Color.BlendEnabled & (1 << unit),
- brw->draw_aux_buffer_disabled[unit]);
-
struct isl_view view = {
.format = isl_format,
.base_level = irb->mt_level - irb->mt->first_level,
};
uint32_t offset;
- brw_emit_surface_state(brw, mt, mt->target, view, aux_usage,
+ brw_emit_surface_state(brw, mt, mt->target, view,
+ brw->draw_aux_usage[unit],
&offset, surf_index,
RELOC_WRITE);
return offset;
return (need_green_to_blue && scs == HSW_SCS_GREEN) ? HSW_SCS_BLUE : scs;
}
-static void
-brw_update_texture_surface(struct gl_context *ctx,
+static void brw_update_texture_surface(struct gl_context *ctx,
unsigned unit,
uint32_t *surf_offset,
bool for_gather,
enum isl_aux_usage aux_usage =
intel_miptree_texture_aux_usage(brw, irb->mt, format);
- if (brw->draw_aux_buffer_disabled[i])
+ if (brw->draw_aux_usage[i] == ISL_AUX_USAGE_NONE)
aux_usage = ISL_AUX_USAGE_NONE;
brw_emit_surface_state(brw, irb->mt, target, view, aux_usage,