[Mesa-dev] [PATCH 3/4] i965: Unvirtualize brw_create_constant_surface; delete Gen7+ variant.
Kenneth Graunke
kenneth at whitecape.org
Fri Nov 1 20:23:13 PDT 2013
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 at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_context.h | 12 +++++-----
src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 6 ++---
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 17 +++++++-------
src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 27 -----------------------
4 files changed, 17 insertions(+), 45 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index e146efa..85bba1d 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -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,
@@ -1579,6 +1573,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,
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index ca8577a..9834c11 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -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;
}
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 a605c16..5a60a6b 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -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;
}
diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
index 2a42e32..c52e12d 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
@@ -398,32 +398,6 @@ gen7_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
-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.
*/
static void
@@ -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;
}
--
1.8.3.2
More information about the mesa-dev
mailing list