/* get new shader that implements polygon stippling */
var->tokens =
util_pstipple_create_fragment_shader(curfs->tokens,
- &var->stipple_sampler_unit);
+ &var->stipple_sampler_unit, 0,
+ TGSI_FILE_INPUT);
}
else
#endif
state->draw_shader = draw_create_fragment_shader(softpipe->draw,
&state->shader);
if (!state->draw_shader) {
- FREE((void *) state->shader.tokens);
+ tgsi_free_tokens(state->shader.tokens);
FREE(state);
return NULL;
}
draw_delete_fragment_shader(softpipe->draw, state->draw_shader);
- FREE((void *) state->shader.tokens);
+ tgsi_free_tokens(state->shader.tokens);
FREE(state);
}
struct sp_vertex_shader *state;
state = CALLOC_STRUCT(sp_vertex_shader);
- if (state == NULL )
+ if (!state)
goto fail;
/* copy shader tokens, the ones passed in will go away.
fail:
if (state) {
- FREE( (void *)state->shader.tokens );
+ tgsi_free_tokens(state->shader.tokens);
FREE( state->draw_data );
FREE( state );
}
struct sp_vertex_shader *state = (struct sp_vertex_shader *) vs;
draw_delete_vertex_shader(softpipe->draw, state->draw_data);
- FREE( (void *)state->shader.tokens );
+ tgsi_free_tokens(state->shader.tokens);
FREE( state );
}
struct sp_geometry_shader *state;
state = CALLOC_STRUCT(sp_geometry_shader);
- if (state == NULL )
+ if (!state)
goto fail;
state->shader = *templ;
fail:
if (state) {
- FREE( (void *)state->shader.tokens );
+ tgsi_free_tokens(state->shader.tokens);
FREE( state->draw_data );
FREE( state );
}
draw_delete_geometry_shader(softpipe->draw,
(state) ? state->draw_data : 0);
- FREE((void *) state->shader.tokens);
+ tgsi_free_tokens(state->shader.tokens);
FREE(state);
}
static void
softpipe_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
- struct pipe_constant_buffer *cb)
+ const struct pipe_constant_buffer *cb)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
struct pipe_resource *constants = cb ? cb->buffer : NULL;
}
}
+static void *
+softpipe_create_compute_state(struct pipe_context *pipe,
+ const struct pipe_compute_state *templ)
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+ const struct tgsi_token *tokens;
+ struct sp_compute_shader *state;
+ if (templ->ir_type != PIPE_SHADER_IR_TGSI)
+ return NULL;
+
+ tokens = templ->prog;
+ /* debug */
+ if (softpipe->dump_cs)
+ tgsi_dump(tokens, 0);
+
+ state = CALLOC_STRUCT(sp_compute_shader);
+
+ state->shader = *templ;
+ state->tokens = tgsi_dup_tokens(tokens);
+ tgsi_scan_shader(state->tokens, &state->info);
+
+ state->max_sampler = state->info.file_max[TGSI_FILE_SAMPLER];
+
+ return state;
+}
+
+static void
+softpipe_bind_compute_state(struct pipe_context *pipe,
+ void *cs)
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+ struct sp_compute_shader *state = (struct sp_compute_shader *)cs;
+ if (softpipe->cs == state)
+ return;
+
+ softpipe->cs = state;
+}
+
+static void
+softpipe_delete_compute_state(struct pipe_context *pipe,
+ void *cs)
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+ struct sp_compute_shader *state = (struct sp_compute_shader *)cs;
+
+ assert(softpipe->cs != state);
+ tgsi_free_tokens(state->tokens);
+ FREE(state);
+}
void
softpipe_init_shader_funcs(struct pipe_context *pipe)
pipe->delete_gs_state = softpipe_delete_gs_state;
pipe->set_constant_buffer = softpipe_set_constant_buffer;
+
+ pipe->create_compute_state = softpipe_create_compute_state;
+ pipe->bind_compute_state = softpipe_bind_compute_state;
+ pipe->delete_compute_state = softpipe_delete_compute_state;
}