}
+static void
+softpipe_set_debug_callback(struct pipe_context *pipe,
+ const struct pipe_debug_callback *cb)
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+
+ if (cb)
+ softpipe->debug = *cb;
+ else
+ memset(&softpipe->debug, 0, sizeof(softpipe->debug));
+}
+
struct pipe_context *
softpipe_create_context(struct pipe_screen *screen,
softpipe_init_image_funcs(&softpipe->pipe);
softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state;
+ softpipe->pipe.set_debug_callback = softpipe_set_debug_callback;
softpipe->pipe.draw_vbo = softpipe_draw_vbo;
#include "draw/draw_vs.h"
#include "draw/draw_gs.h"
#include "tgsi/tgsi_dump.h"
+#include "tgsi/tgsi_from_mesa.h"
#include "tgsi/tgsi_scan.h"
#include "tgsi/tgsi_parse.h"
+#include "compiler/shader_enums.h"
/**
}
static void
-softpipe_create_shader_state(struct pipe_shader_state *shader,
+softpipe_shader_db(struct pipe_context *pipe, const struct tgsi_token *tokens)
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+
+ struct tgsi_shader_info info;
+ tgsi_scan_shader(tokens, &info);
+ pipe_debug_message(&softpipe->debug, SHADER_INFO, "%s shader: %d inst, %d loops, %d temps, %d const, %d imm",
+ _mesa_shader_stage_to_abbrev(tgsi_processor_to_shader_stage(info.processor)),
+ info.num_instructions,
+ info.opcode_count[TGSI_OPCODE_BGNLOOP],
+ info.file_max[TGSI_FILE_TEMPORARY] + 1,
+ info.file_max[TGSI_FILE_CONSTANT] + 1,
+ info.immediate_count);
+}
+
+static void
+softpipe_create_shader_state(struct pipe_context *pipe,
+ struct pipe_shader_state *shader,
const struct pipe_shader_state *templ,
bool debug)
{
if (debug)
tgsi_dump(shader->tokens, 0);
+
+ softpipe_shader_db(pipe, shader->tokens);
}
static void *
struct softpipe_context *softpipe = softpipe_context(pipe);
struct sp_fragment_shader *state = CALLOC_STRUCT(sp_fragment_shader);
- softpipe_create_shader_state(&state->shader, templ, sp_debug & SP_DBG_FS);
+ softpipe_create_shader_state(pipe, &state->shader, templ,
+ sp_debug & SP_DBG_FS);
/* draw's fs state */
state->draw_shader = draw_create_fragment_shader(softpipe->draw,
if (!state)
goto fail;
- softpipe_create_shader_state(&state->shader, templ, sp_debug & SP_DBG_VS);
+ softpipe_create_shader_state(pipe, &state->shader, templ,
+ sp_debug & SP_DBG_VS);
if (!state->shader.tokens)
goto fail;
if (!state)
goto fail;
- softpipe_create_shader_state(&state->shader, templ, sp_debug & SP_DBG_GS);
+ softpipe_create_shader_state(pipe, &state->shader, templ,
+ sp_debug & SP_DBG_GS);
if (templ->tokens) {
state->draw_data = draw_create_geometry_shader(softpipe->draw, templ);
if (sp_debug & SP_DBG_CS)
tgsi_dump(tokens, 0);
+ softpipe_shader_db(pipe, tokens);
+
state = CALLOC_STRUCT(sp_compute_shader);
state->shader = *templ;