unsigned unit, uint32_t *surf_offset,
bool for_gather, uint32_t plane);
-void brw_update_renderbuffer_surfaces(struct brw_context *brw,
- const struct gl_framebuffer *fb,
- uint32_t render_target_start,
- uint32_t *surf_offset);
-
/* brw_sampler_state.c */
void brw_emit_sampler_state(struct brw_context *brw,
uint32_t *sampler_state,
return offset;
}
-/**
- * Construct SURFACE_STATE objects for renderbuffers/draw buffers.
- */
-void
-brw_update_renderbuffer_surfaces(struct brw_context *brw,
- const struct gl_framebuffer *fb,
- uint32_t render_target_start,
- uint32_t *surf_offset)
+static void
+update_renderbuffer_surfaces(struct brw_context *brw)
{
- GLuint i;
+ const struct gl_context *ctx = &brw->ctx;
+
+ /* BRW_NEW_FS_PROG_DATA */
+ const struct brw_wm_prog_data *wm_prog_data =
+ brw_wm_prog_data(brw->wm.base.prog_data);
+
+ /* _NEW_BUFFERS | _NEW_COLOR */
+ const struct gl_framebuffer *fb = ctx->DrawBuffer;
+
+ const unsigned rt_start = wm_prog_data->binding_table.render_target_start;
+
+ uint32_t *surf_offsets = brw->wm.base.surf_offset;
/* Update surfaces for drawing buffers */
if (fb->_NumColorDrawBuffers >= 1) {
- for (i = 0; i < fb->_NumColorDrawBuffers; i++) {
- const uint32_t surf_index = render_target_start + i;
+ for (unsigned i = 0; i < fb->_NumColorDrawBuffers; i++) {
struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[i];
if (intel_renderbuffer(rb)) {
- surf_offset[surf_index] = brw->gen >= 6 ?
- gen6_update_renderbuffer_surface(brw, rb, i, surf_index) :
- gen4_update_renderbuffer_surface(brw, rb, i, surf_index);
+ surf_offsets[rt_start + i] = brw->gen >= 6 ?
+ gen6_update_renderbuffer_surface(brw, rb, i, rt_start + i) :
+ gen4_update_renderbuffer_surface(brw, rb, i, rt_start + i);
} else {
- emit_null_surface_state(brw, fb, &surf_offset[surf_index]);
+ emit_null_surface_state(brw, fb, &surf_offsets[rt_start + i]);
}
}
} else {
- const uint32_t surf_index = render_target_start;
- emit_null_surface_state(brw, fb, &surf_offset[surf_index]);
+ emit_null_surface_state(brw, fb, &surf_offsets[rt_start]);
}
-}
-
-static void
-update_renderbuffer_surfaces(struct brw_context *brw)
-{
- const struct gl_context *ctx = &brw->ctx;
- /* BRW_NEW_FS_PROG_DATA */
- const struct brw_wm_prog_data *wm_prog_data =
- brw_wm_prog_data(brw->wm.base.prog_data);
-
- /* _NEW_BUFFERS | _NEW_COLOR */
- const struct gl_framebuffer *fb = ctx->DrawBuffer;
- brw_update_renderbuffer_surfaces(
- brw, fb,
- wm_prog_data->binding_table.render_target_start,
- brw->wm.base.surf_offset);
brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
}