From: Kenneth Graunke Date: Thu, 17 Aug 2017 08:28:56 +0000 (-0700) Subject: i965: Inline brw_update_renderbuffer_surfaces(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=00b7d04181e63cd3b11aa67871a4818936d14e38;p=mesa.git i965: Inline brw_update_renderbuffer_surfaces(). Less baklava layers. Reviewed-by: Topi Pohjolainen --- diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index c9fd9414826..a07e70341df 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -221,11 +221,6 @@ void brw_update_texture_surface(struct gl_context *ctx, 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, diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index a70553e24f5..f33fc70e6f6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -985,52 +985,39 @@ gen4_update_renderbuffer_surface(struct brw_context *brw, 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; }