i965: Inline brw_update_renderbuffer_surfaces().
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 17 Aug 2017 08:28:56 +0000 (01:28 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 23 Aug 2017 18:55:17 +0000 (11:55 -0700)
Less baklava layers.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_state.h
src/mesa/drivers/dri/i965/brw_wm_surface_state.c

index c9fd9414826ef099d794f298be181cd989ae9307..a07e70341df601135c5fb8bb54134d79f0cd1ea6 100644 (file)
@@ -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,
index a70553e24f5838558cc9a3f8f3509f5afe8632f0..f33fc70e6f6d34829a086018c1dd285ec64e8f96 100644 (file)
@@ -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;
 }