i965: Unvirtualize brw_create_constant_surface; delete Gen7+ variant.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 2 Nov 2013 00:37:10 +0000 (17:37 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 6 Nov 2013 01:59:51 +0000 (17:59 -0800)
Now that brw_create_constant_surface uses a virtual function internally,
it doesn't need to be virtual itself.  We can delete the Gen7+ variant
and simplify things.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_vs_surface_state.c
src/mesa/drivers/dri/i965/brw_wm_surface_state.c
src/mesa/drivers/dri/i965/gen7_wm_surface_state.c

index 6065782ee0c223d99040a264865ec3af33b88d55..c15f8a4179848b10bf4251d47e31a5a27f83ff02 100644 (file)
@@ -976,12 +976,6 @@ struct brw_context
                                          unsigned unit);
       void (*update_null_renderbuffer_surface)(struct brw_context *brw,
                                               unsigned unit);
-      void (*create_constant_surface)(struct brw_context *brw,
-                                     drm_intel_bo *bo,
-                                     uint32_t offset,
-                                     uint32_t size,
-                                     uint32_t *out_offset,
-                                      bool dword_pitch);
 
       void (*create_raw_surface)(struct brw_context *brw,
                                  drm_intel_bo *bo,
@@ -1577,6 +1571,12 @@ unsigned brw_get_index_type(GLenum type);
 
 /* brw_wm_surface_state.c */
 void brw_init_surface_formats(struct brw_context *brw);
+void brw_create_constant_surface(struct brw_context *brw,
+                                 drm_intel_bo *bo,
+                                 uint32_t offset,
+                                 uint32_t size,
+                                 uint32_t *out_offset,
+                                 bool dword_pitch);
 void
 brw_update_sol_surface(struct brw_context *brw,
                        struct gl_buffer_object *buffer_obj,
index ca8577a9ebaf8246bd6cc1e929d57b339d9f73b6..9834c11cc37b1cbfe3445e40954cf42978cd7bb0 100644 (file)
@@ -85,9 +85,9 @@ brw_upload_vec4_pull_constants(struct brw_context *brw,
 
    drm_intel_gem_bo_unmap_gtt(stage_state->const_bo);
 
-   brw->vtbl.create_constant_surface(brw, stage_state->const_bo, 0, size,
-                                     &stage_state->surf_offset[surf_index],
-                                     false);
+   brw_create_constant_surface(brw, stage_state->const_bo, 0, size,
+                               &stage_state->surf_offset[surf_index],
+                               false);
 
    brw->state.dirty.brw |= brw_new_constbuf;
 }
index a605c16ca813b94a39dc755c8a3c05b63d84585a..5a60a6bfe0b303d0bd5dd53f24970f18bf191fe2 100644 (file)
@@ -321,7 +321,7 @@ brw_update_texture_surface(struct gl_context *ctx,
  * Create the constant buffer surface.  Vertex/fragment shader constants will be
  * read from this buffer with Data Port Read instructions/messages.
  */
-static void
+void
 brw_create_constant_surface(struct brw_context *brw,
                            drm_intel_bo *bo,
                            uint32_t offset,
@@ -469,9 +469,9 @@ brw_upload_wm_pull_constants(struct brw_context *brw)
    }
    drm_intel_gem_bo_unmap_gtt(brw->wm.base.const_bo);
 
-   brw->vtbl.create_constant_surface(brw, brw->wm.base.const_bo, 0, size,
-                                     &brw->wm.base.surf_offset[surf_index],
-                                     true);
+   brw_create_constant_surface(brw, brw->wm.base.const_bo, 0, size,
+                               &brw->wm.base.surf_offset[surf_index],
+                               true);
 
    brw->state.dirty.brw |= BRW_NEW_SURFACES;
 }
@@ -840,10 +840,10 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
        * glBindBufferRange case is undefined, we can just bind the whole buffer
        * glBindBufferBase wants and be a correct implementation.
        */
-      brw->vtbl.create_constant_surface(brw, bo, binding->Offset,
-                                        bo->size - binding->Offset,
-                                        &surf_offsets[i],
-                                        shader->Type == GL_FRAGMENT_SHADER);
+      brw_create_constant_surface(brw, bo, binding->Offset,
+                                  bo->size - binding->Offset,
+                                  &surf_offsets[i],
+                                  shader->Type == GL_FRAGMENT_SHADER);
    }
 
    if (shader->NumUniformBlocks)
@@ -931,6 +931,5 @@ gen4_init_vtable_surface_functions(struct brw_context *brw)
    brw->vtbl.update_renderbuffer_surface = brw_update_renderbuffer_surface;
    brw->vtbl.update_null_renderbuffer_surface =
       brw_update_null_renderbuffer_surface;
-   brw->vtbl.create_constant_surface = brw_create_constant_surface;
    brw->vtbl.emit_buffer_surface_state = gen4_emit_buffer_surface_state;
 }
index 2a42e32b19fa5afee4b8c7c1f86b0fd25bb64bba..c52e12dd5089aa5a625c86544643f6f9187aa184 100644 (file)
@@ -397,32 +397,6 @@ gen7_update_texture_surface(struct gl_context *ctx,
    gen7_check_surface_setup(surf, false /* is_render_target */);
 }
 
-/**
- * Create the constant buffer surface.  Vertex/fragment shader constants will
- * be read from this buffer with Data Port Read instructions/messages.
- */
-static void
-gen7_create_constant_surface(struct brw_context *brw,
-                            drm_intel_bo *bo,
-                            uint32_t offset,
-                            uint32_t size,
-                            uint32_t *out_offset,
-                             bool dword_pitch)
-{
-   uint32_t stride = dword_pitch ? 4 : 16;
-   uint32_t elements = ALIGN(size, stride) / stride;
-
-   gen7_emit_buffer_surface_state(brw,
-                                  out_offset,
-                                  bo,
-                                  offset,
-                                  BRW_SURFACEFORMAT_R32G32B32A32_FLOAT,
-                                  elements,
-                                  stride,
-                                  0 /* mocs */,
-                                  false /* rw */);
-}
-
 /**
  * Create a raw surface for untyped R/W access.
  */
@@ -613,7 +587,6 @@ gen7_init_vtable_surface_functions(struct brw_context *brw)
    brw->vtbl.update_renderbuffer_surface = gen7_update_renderbuffer_surface;
    brw->vtbl.update_null_renderbuffer_surface =
       gen7_update_null_renderbuffer_surface;
-   brw->vtbl.create_constant_surface = gen7_create_constant_surface;
    brw->vtbl.create_raw_surface = gen7_create_raw_surface;
    brw->vtbl.emit_buffer_surface_state = gen7_emit_buffer_surface_state;
 }