diff options
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen7_wm_surface_state.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 22 |
1 files changed, 13 insertions, 9 deletions
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 e0fd3906250..97ae0e2f9a4 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c @@ -203,11 +203,13 @@ gen7_check_surface_setup(struct gen7_surface_state *surf, static void -gen7_update_buffer_texture_surface(struct gl_context *ctx, GLuint unit) +gen7_update_buffer_texture_surface(struct gl_context *ctx, + unsigned unit, + uint32_t *binding_table, + unsigned surf_index) { struct brw_context *brw = brw_context(ctx); struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current; - const GLuint surf_index = SURF_INDEX_TEXTURE(unit); struct gen7_surface_state *surf; struct intel_buffer_object *intel_obj = intel_buffer_object(tObj->BufferObject); @@ -216,7 +218,7 @@ gen7_update_buffer_texture_surface(struct gl_context *ctx, GLuint unit) int texel_size = _mesa_get_format_bytes(format); surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, - sizeof(*surf), 32, &brw->wm.surf_offset[surf_index]); + sizeof(*surf), 32, &binding_table[surf_index]); memset(surf, 0, sizeof(*surf)); surf->ss0.surface_type = BRW_SURFACE_BUFFER; @@ -237,7 +239,7 @@ gen7_update_buffer_texture_surface(struct gl_context *ctx, GLuint unit) * a separate cache and is just the sampler cache. */ drm_intel_bo_emit_reloc(brw->intel.batch.bo, - (brw->wm.surf_offset[surf_index] + + (binding_table[surf_index] + offsetof(struct gen7_surface_state, ss1)), bo, 0, I915_GEM_DOMAIN_SAMPLER, 0); @@ -261,7 +263,10 @@ gen7_update_buffer_texture_surface(struct gl_context *ctx, GLuint unit) } static void -gen7_update_texture_surface(struct gl_context *ctx, GLuint unit) +gen7_update_texture_surface(struct gl_context *ctx, + unsigned unit, + uint32_t *binding_table, + unsigned surf_index) { struct brw_context *brw = brw_context(ctx); struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current; @@ -269,12 +274,11 @@ gen7_update_texture_surface(struct gl_context *ctx, GLuint unit) struct intel_mipmap_tree *mt = intelObj->mt; struct gl_texture_image *firstImage = tObj->Image[0][tObj->BaseLevel]; struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit); - const GLuint surf_index = SURF_INDEX_TEXTURE(unit); struct gen7_surface_state *surf; int width, height, depth; if (tObj->Target == GL_TEXTURE_BUFFER) { - gen7_update_buffer_texture_surface(ctx, unit); + gen7_update_buffer_texture_surface(ctx, unit, binding_table, surf_index); return; } @@ -285,7 +289,7 @@ gen7_update_texture_surface(struct gl_context *ctx, GLuint unit) intel_miptree_get_dimensions_for_image(firstImage, &width, &height, &depth); surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, - sizeof(*surf), 32, &brw->wm.surf_offset[surf_index]); + sizeof(*surf), 32, &binding_table[surf_index]); memset(surf, 0, sizeof(*surf)); if (mt->align_h == 4) @@ -347,7 +351,7 @@ gen7_update_texture_surface(struct gl_context *ctx, GLuint unit) /* Emit relocation to surface contents */ drm_intel_bo_emit_reloc(brw->intel.batch.bo, - brw->wm.surf_offset[surf_index] + + binding_table[surf_index] + offsetof(struct gen7_surface_state, ss1), intelObj->mt->region->bo, intelObj->mt->offset, I915_GEM_DOMAIN_SAMPLER, 0); |