From: Marek Olšák Date: Sat, 10 Jun 2017 21:23:56 +0000 (+0200) Subject: cso: don't return errors from sampler functions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0e0fc1ce71317b759f88ce8fd04912f60f767015;p=mesa.git cso: don't return errors from sampler functions No code checks the errors. Reviewed-by: Nicolai Hähnle --- diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 4947b8e1624..757bcf32806 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -1198,7 +1198,7 @@ unsigned cso_get_aux_vertex_buffer_slot(struct cso_context *ctx) -enum pipe_error +void cso_single_sampler(struct cso_context *ctx, enum pipe_shader_type shader_stage, unsigned idx, const struct pipe_sampler_state *templ) { @@ -1214,7 +1214,7 @@ cso_single_sampler(struct cso_context *ctx, enum pipe_shader_type shader_stage, if (cso_hash_iter_is_null(iter)) { cso = MALLOC(sizeof(struct cso_sampler)); if (!cso) - return PIPE_ERROR_OUT_OF_MEMORY; + return; memcpy(&cso->state, templ, sizeof(*templ)); cso->data = ctx->pipe->create_sampler_state(ctx->pipe, &cso->state); @@ -1226,7 +1226,7 @@ cso_single_sampler(struct cso_context *ctx, enum pipe_shader_type shader_stage, iter = cso_insert_state(ctx->cache, hash_key, CSO_SAMPLER, cso); if (cso_hash_iter_is_null(iter)) { FREE(cso); - return PIPE_ERROR_OUT_OF_MEMORY; + return; } } else { @@ -1237,8 +1237,6 @@ cso_single_sampler(struct cso_context *ctx, enum pipe_shader_type shader_stage, ctx->samplers[shader_stage].samplers[idx] = cso->data; ctx->max_sampler_seen = MAX2(ctx->max_sampler_seen, (int)idx); } - - return PIPE_OK; } @@ -1266,24 +1264,16 @@ cso_single_sampler_done(struct cso_context *ctx, * last one. Done to always try to set as many samplers * as possible. */ -enum pipe_error +void cso_set_samplers(struct cso_context *ctx, enum pipe_shader_type shader_stage, unsigned nr, const struct pipe_sampler_state **templates) { - unsigned i; - enum pipe_error temp, error = PIPE_OK; - - for (i = 0; i < nr; i++) { - temp = cso_single_sampler(ctx, shader_stage, i, templates[i]); - if (temp != PIPE_OK) - error = temp; - } + for (unsigned i = 0; i < nr; i++) + cso_single_sampler(ctx, shader_stage, i, templates[i]); cso_single_sampler_done(ctx, shader_stage); - - return error; } static void diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index c21e83849ef..190d0dc40f6 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -59,7 +59,7 @@ enum pipe_error cso_set_rasterizer( struct cso_context *cso, const struct pipe_rasterizer_state *rasterizer ); -enum pipe_error +void cso_set_samplers(struct cso_context *cso, enum pipe_shader_type shader_stage, unsigned count, @@ -69,7 +69,7 @@ cso_set_samplers(struct cso_context *cso, /* Alternate interface to support state trackers that like to modify * samplers one at a time: */ -enum pipe_error +void cso_single_sampler(struct cso_context *cso, enum pipe_shader_type shader_stage, unsigned idx, const struct pipe_sampler_state *states);