cso: Add set_vertex_samplers function

This commit is contained in:
Jakob Bornecrantz
2010-01-18 00:07:24 +00:00
parent 2a60302e51
commit 90cdf0d67c
2 changed files with 36 additions and 0 deletions
@@ -539,6 +539,38 @@ void cso_restore_samplers(struct cso_context *ctx)
cso_single_sampler_done( ctx );
}
/*
* 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_vertex_samplers(struct cso_context *ctx,
unsigned nr,
const struct pipe_sampler_state **templates)
{
unsigned i;
enum pipe_error temp, error = PIPE_OK;
/* TODO: fastpath
*/
for (i = 0; i < nr; i++) {
temp = cso_single_vertex_sampler( ctx, i, templates[i] );
if (temp != PIPE_OK)
error = temp;
}
for ( ; i < ctx->nr_samplers; i++) {
temp = cso_single_vertex_sampler( ctx, i, NULL );
if (temp != PIPE_OK)
error = temp;
}
cso_single_vertex_sampler_done( ctx );
return error;
}
void
cso_save_vertex_samplers(struct cso_context *ctx)
{
@@ -84,6 +84,10 @@ enum pipe_error cso_single_sampler( struct cso_context *cso,
void cso_single_sampler_done( struct cso_context *cso );
enum pipe_error cso_set_vertex_samplers(struct cso_context *cso,
unsigned count,
const struct pipe_sampler_state **states);
void
cso_save_vertex_samplers(struct cso_context *cso);