struct pipe_shader_state *stipple_fs = NULL, *curfs = &fs->shader;
unsigned unit = 0;
+#if DO_PSTIPPLE_IN_HELPER_MODULE
if (key->polygon_stipple) {
/* get new shader that implements polygon stippling */
stipple_fs = util_pstipple_create_fragment_shader(&softpipe->pipe,
curfs, &unit);
curfs = stipple_fs;
}
+#endif
/* codegen, create variant object */
- var = softpipe_create_fs_variant_sse(softpipe, curfs);
- if (!var) {
- var = softpipe_create_fs_variant_exec(softpipe, curfs);
- }
+ var = softpipe_create_fs_variant_exec(softpipe, curfs);
if (var) {
var->key = *key;
}
if (stipple_fs) {
- free((void *) stipple_fs->tokens);
- free(stipple_fs);
+ FREE((void *) stipple_fs->tokens);
+ FREE(stipple_fs);
}
return var;
draw_delete_fragment_shader(softpipe->draw, state->draw_shader);
FREE((void *) state->shader.tokens);
+ FREE(state);
}
draw_delete_geometry_shader(softpipe->draw,
(state) ? state->draw_data : 0);
+
+ FREE((void *) state->shader.tokens);
FREE(state);
}
static void
softpipe_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
- struct pipe_resource *constants)
+ struct pipe_constant_buffer *cb)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- unsigned size = constants ? constants->width0 : 0;
- const void *data = constants ? softpipe_resource(constants)->data : NULL;
+ struct pipe_resource *constants = cb ? cb->buffer : NULL;
+ unsigned size;
+ const void *data;
+
+ if (cb && cb->user_buffer) {
+ constants = softpipe_user_buffer_create(pipe->screen,
+ (void *) cb->user_buffer,
+ cb->buffer_size,
+ PIPE_BIND_CONSTANT_BUFFER);
+ }
+
+ size = constants ? constants->width0 : 0;
+ data = constants ? softpipe_resource(constants)->data : NULL;
assert(shader < PIPE_SHADER_TYPES);
softpipe->const_buffer_size[shader][index] = size;
softpipe->dirty |= SP_NEW_CONSTANTS;
+
+ if (cb && cb->user_buffer) {
+ pipe_resource_reference(&constants, NULL);
+ }
}