diff options
author | Nicolai Hähnle <[email protected]> | 2017-05-08 13:29:33 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-05-10 08:58:34 +0200 |
commit | bf4ecfec4b1b75929d1f7f7bfc65df603e163f0b (patch) | |
tree | 3f9120c9a94db38dbca9bf87b77ad6fad97047f0 /src/gallium | |
parent | fa1519d0c96616e9cb3f7869864dcccb805ec89d (diff) |
ddebug: extract dd_dump_shader
Will be re-used for compute shaders.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/ddebug/dd_draw.c | 156 |
1 files changed, 82 insertions, 74 deletions
diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c index 6e96c7247a3..291ce89a8db 100644 --- a/src/gallium/drivers/ddebug/dd_draw.c +++ b/src/gallium/drivers/ddebug/dd_draw.c @@ -197,9 +197,9 @@ dd_dump_render_condition(struct dd_draw_state *dstate, FILE *f) } static void -dd_dump_draw_vbo(struct dd_draw_state *dstate, struct pipe_draw_info *info, FILE *f) +dd_dump_shader(struct dd_draw_state *dstate, enum pipe_shader_type sh, FILE *f) { - int sh, i; + int i; const char *shader_str[PIPE_SHADER_TYPES]; shader_str[PIPE_SHADER_VERTEX] = "VERTEX"; @@ -209,6 +209,85 @@ dd_dump_draw_vbo(struct dd_draw_state *dstate, struct pipe_draw_info *info, FILE shader_str[PIPE_SHADER_FRAGMENT] = "FRAGMENT"; shader_str[PIPE_SHADER_COMPUTE] = "COMPUTE"; + if (sh == PIPE_SHADER_TESS_CTRL && + !dstate->shaders[PIPE_SHADER_TESS_CTRL] && + dstate->shaders[PIPE_SHADER_TESS_EVAL]) + fprintf(f, "tess_state: {default_outer_level = {%f, %f, %f, %f}, " + "default_inner_level = {%f, %f}}\n", + dstate->tess_default_levels[0], + dstate->tess_default_levels[1], + dstate->tess_default_levels[2], + dstate->tess_default_levels[3], + dstate->tess_default_levels[4], + dstate->tess_default_levels[5]); + + if (sh == PIPE_SHADER_FRAGMENT) + if (dstate->rs) { + unsigned num_viewports = dd_num_active_viewports(dstate); + + if (dstate->rs->state.rs.clip_plane_enable) + DUMP(clip_state, &dstate->clip_state); + + for (i = 0; i < num_viewports; i++) + DUMP_I(viewport_state, &dstate->viewports[i], i); + + if (dstate->rs->state.rs.scissor) + for (i = 0; i < num_viewports; i++) + DUMP_I(scissor_state, &dstate->scissors[i], i); + + DUMP(rasterizer_state, &dstate->rs->state.rs); + + if (dstate->rs->state.rs.poly_stipple_enable) + DUMP(poly_stipple, &dstate->polygon_stipple); + fprintf(f, "\n"); + } + + if (!dstate->shaders[sh]) + return; + + fprintf(f, COLOR_SHADER "begin shader: %s" COLOR_RESET "\n", shader_str[sh]); + DUMP(shader_state, &dstate->shaders[sh]->state.shader); + + for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) + if (dstate->constant_buffers[sh][i].buffer || + dstate->constant_buffers[sh][i].user_buffer) { + DUMP_I(constant_buffer, &dstate->constant_buffers[sh][i], i); + if (dstate->constant_buffers[sh][i].buffer) + DUMP_M(resource, &dstate->constant_buffers[sh][i], buffer); + } + + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) + if (dstate->sampler_states[sh][i]) + DUMP_I(sampler_state, &dstate->sampler_states[sh][i]->state.sampler, i); + + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) + if (dstate->sampler_views[sh][i]) { + DUMP_I(sampler_view, dstate->sampler_views[sh][i], i); + DUMP_M(resource, dstate->sampler_views[sh][i], texture); + } + + for (i = 0; i < PIPE_MAX_SHADER_IMAGES; i++) + if (dstate->shader_images[sh][i].resource) { + DUMP_I(image_view, &dstate->shader_images[sh][i], i); + if (dstate->shader_images[sh][i].resource) + DUMP_M(resource, &dstate->shader_images[sh][i], resource); + } + + for (i = 0; i < PIPE_MAX_SHADER_BUFFERS; i++) + if (dstate->shader_buffers[sh][i].buffer) { + DUMP_I(shader_buffer, &dstate->shader_buffers[sh][i], i); + if (dstate->shader_buffers[sh][i].buffer) + DUMP_M(resource, &dstate->shader_buffers[sh][i], buffer); + } + + fprintf(f, COLOR_SHADER "end shader: %s" COLOR_RESET "\n\n", shader_str[sh]); +} + +static void +dd_dump_draw_vbo(struct dd_draw_state *dstate, struct pipe_draw_info *info, FILE *f) +{ + int sh, i; + DUMP(draw_info, info); if (info->indexed) { DUMP(index_buffer, &dstate->index_buffer); @@ -258,78 +337,7 @@ dd_dump_draw_vbo(struct dd_draw_state *dstate, struct pipe_draw_info *info, FILE if (sh == PIPE_SHADER_COMPUTE) continue; - if (sh == PIPE_SHADER_TESS_CTRL && - !dstate->shaders[PIPE_SHADER_TESS_CTRL] && - dstate->shaders[PIPE_SHADER_TESS_EVAL]) - fprintf(f, "tess_state: {default_outer_level = {%f, %f, %f, %f}, " - "default_inner_level = {%f, %f}}\n", - dstate->tess_default_levels[0], - dstate->tess_default_levels[1], - dstate->tess_default_levels[2], - dstate->tess_default_levels[3], - dstate->tess_default_levels[4], - dstate->tess_default_levels[5]); - - if (sh == PIPE_SHADER_FRAGMENT) - if (dstate->rs) { - unsigned num_viewports = dd_num_active_viewports(dstate); - - if (dstate->rs->state.rs.clip_plane_enable) - DUMP(clip_state, &dstate->clip_state); - - for (i = 0; i < num_viewports; i++) - DUMP_I(viewport_state, &dstate->viewports[i], i); - - if (dstate->rs->state.rs.scissor) - for (i = 0; i < num_viewports; i++) - DUMP_I(scissor_state, &dstate->scissors[i], i); - - DUMP(rasterizer_state, &dstate->rs->state.rs); - - if (dstate->rs->state.rs.poly_stipple_enable) - DUMP(poly_stipple, &dstate->polygon_stipple); - fprintf(f, "\n"); - } - - if (!dstate->shaders[sh]) - continue; - - fprintf(f, COLOR_SHADER "begin shader: %s" COLOR_RESET "\n", shader_str[sh]); - DUMP(shader_state, &dstate->shaders[sh]->state.shader); - - for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) - if (dstate->constant_buffers[sh][i].buffer || - dstate->constant_buffers[sh][i].user_buffer) { - DUMP_I(constant_buffer, &dstate->constant_buffers[sh][i], i); - if (dstate->constant_buffers[sh][i].buffer) - DUMP_M(resource, &dstate->constant_buffers[sh][i], buffer); - } - - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) - if (dstate->sampler_states[sh][i]) - DUMP_I(sampler_state, &dstate->sampler_states[sh][i]->state.sampler, i); - - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) - if (dstate->sampler_views[sh][i]) { - DUMP_I(sampler_view, dstate->sampler_views[sh][i], i); - DUMP_M(resource, dstate->sampler_views[sh][i], texture); - } - - for (i = 0; i < PIPE_MAX_SHADER_IMAGES; i++) - if (dstate->shader_images[sh][i].resource) { - DUMP_I(image_view, &dstate->shader_images[sh][i], i); - if (dstate->shader_images[sh][i].resource) - DUMP_M(resource, &dstate->shader_images[sh][i], resource); - } - - for (i = 0; i < PIPE_MAX_SHADER_BUFFERS; i++) - if (dstate->shader_buffers[sh][i].buffer) { - DUMP_I(shader_buffer, &dstate->shader_buffers[sh][i], i); - if (dstate->shader_buffers[sh][i].buffer) - DUMP_M(resource, &dstate->shader_buffers[sh][i], buffer); - } - - fprintf(f, COLOR_SHADER "end shader: %s" COLOR_RESET "\n\n", shader_str[sh]); + dd_dump_shader(dstate, sh, f); } if (dstate->dsa) |