/* * If the function encouters any errors it will return the * last one. Done to always try to set as many samplers * as possible. */ enum pipe_error cso_set_samplers(struct cso_context *ctx, unsigned shader_stage, unsigned nr, const struct pipe_sampler_state **templates) { struct sampler_info *info = &ctx->samplers[shader_stage]; unsigned i; enum pipe_error temp, error = PIPE_OK; /* TODO: fastpath */ for (i = 0; i < nr; i++) { temp = single_sampler(ctx, info, i, templates[i]); if (temp != PIPE_OK) error = temp; } for ( ; i < info->nr_samplers; i++) { temp = single_sampler(ctx, info, i, NULL); if (temp != PIPE_OK) error = temp; } single_sampler_done(ctx, shader_stage); return error; }
static void restore_samplers(struct cso_context *ctx, struct sampler_info *info) { info->nr_samplers = info->nr_samplers_saved; memcpy(info->samplers, info->samplers_saved, sizeof(info->samplers)); single_sampler_done(ctx, info); }
void cso_restore_samplers(struct cso_context *ctx, unsigned shader_stage) { struct sampler_info *info = &ctx->samplers[shader_stage]; info->nr_samplers = info->nr_samplers_saved; memcpy(info->samplers, info->samplers_saved, sizeof(info->samplers)); single_sampler_done(ctx, shader_stage); }
void cso_single_sampler_done(struct cso_context *ctx, unsigned shader_stage) { single_sampler_done(ctx, shader_stage); }
void cso_single_vertex_sampler_done(struct cso_context *ctx) { single_sampler_done(ctx, &ctx->vertex_samplers); }
void cso_single_sampler_done( struct cso_context *ctx ) { single_sampler_done(ctx, &ctx->fragment_samplers); }