From 95addca0190032d49bd576ea1c486e34c1e3c76f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 16 Nov 2010 07:34:32 +0800 Subject: [PATCH] i965: Add state dumping for sampler state. --- src/mesa/drivers/dri/i965/brw_state_dump.c | 41 ++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c index b79b33c2e32..c720c95a87b 100644 --- a/src/mesa/drivers/dri/i965/brw_state_dump.c +++ b/src/mesa/drivers/dri/i965/brw_state_dump.c @@ -107,14 +107,14 @@ static void dump_wm_surface_state(struct brw_context *brw) char name[20]; if (surf_bo == NULL) { - fprintf(stderr, " WM SS%d: NULL\n", i); + fprintf(stderr, "WM SURF%d: NULL\n", i); continue; } drm_intel_bo_map(surf_bo, GL_FALSE); surfoff = surf_bo->offset + brw->wm.surf_offset[i]; surf = (struct brw_surface_state *)(surf_bo->virtual + brw->wm.surf_offset[i]); - sprintf(name, "WM SS%d", i); + sprintf(name, "WM SURF%d", i); state_out(name, surf, surfoff, 0, "%s %s\n", get_965_surfacetype(surf->ss0.surface_type), get_965_surface_format(surf->ss0.surface_format)); @@ -132,6 +132,42 @@ static void dump_wm_surface_state(struct brw_context *brw) } } + +static void dump_wm_sampler_state(struct brw_context *brw) +{ + struct gl_context *ctx = &brw->intel.ctx; + int i; + + if (!brw->wm.sampler_bo) { + fprintf(stderr, "WM_SAMPLER: NULL\n"); + return; + } + + drm_intel_bo_map(brw->wm.sampler_bo, GL_FALSE); + for (i = 0; i < BRW_MAX_TEX_UNIT; i++) { + unsigned int offset; + struct brw_sampler_state *samp; + char name[20]; + + if (!ctx->Texture.Unit[i]._ReallyEnabled) { + fprintf(stderr, "WM SAMP%d: disabled\n", i); + continue; + } + + offset = brw->wm.sampler_bo->offset + + i * sizeof(struct brw_sampler_state); + samp = (struct brw_sampler_state *)(brw->wm.sampler_bo->virtual + + i * sizeof(struct brw_sampler_state)); + + sprintf(name, "WM SAMP%d", i); + state_out(name, samp, offset, 0, "filtering\n"); + state_out(name, samp, offset, 1, "wrapping, lod\n"); + state_out(name, samp, offset, 2, "default color pointer\n"); + state_out(name, samp, offset, 3, "chroma key, aniso\n"); + } + drm_intel_bo_unmap(brw->wm.sampler_bo); +} + static void dump_sf_viewport_state(struct brw_context *brw) { const char *name = "SF VP"; @@ -324,6 +360,7 @@ void brw_debug_batch(struct intel_context *intel) state_struct_out("WM bind", brw->wm.bind_bo, 4 * brw->wm.nr_surfaces); dump_wm_surface_state(brw); + dump_wm_sampler_state(brw); if (intel->gen < 6) state_struct_out("VS", brw->vs.state_bo, sizeof(struct brw_vs_unit_state)); -- 2.30.2