From: Marek Olšák <marek.ol...@amd.com> No code checks the errors. --- src/gallium/auxiliary/cso_cache/cso_context.c | 22 ++++++---------------- src/gallium/auxiliary/cso_cache/cso_context.h | 4 ++-- 2 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 4947b8e..757bcf3 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -1191,61 +1191,59 @@ cso_restore_aux_vertex_buffer_slot(struct cso_context *ctx) pipe_vertex_buffer_unreference(&ctx->aux_vertex_buffer_saved); } unsigned cso_get_aux_vertex_buffer_slot(struct cso_context *ctx) { return ctx->aux_vertex_buffer_index; } -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) { if (templ) { unsigned key_size = sizeof(struct pipe_sampler_state); unsigned hash_key = cso_construct_key((void*)templ, key_size); struct cso_sampler *cso; struct cso_hash_iter iter = cso_find_state_template(ctx->cache, hash_key, CSO_SAMPLER, (void *) templ, key_size); 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); cso->delete_state = (cso_state_callback) ctx->pipe->delete_sampler_state; cso->context = ctx->pipe; cso->hash_key = hash_key; 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 { cso = cso_hash_iter_data(iter); } ctx->samplers[shader_stage].cso_samplers[idx] = cso; ctx->samplers[shader_stage].samplers[idx] = cso->data; ctx->max_sampler_seen = MAX2(ctx->max_sampler_seen, (int)idx); } - - return PIPE_OK; } /** * Send staged sampler state to the driver. */ void cso_single_sampler_done(struct cso_context *ctx, enum pipe_shader_type shader_stage) { @@ -1259,38 +1257,30 @@ cso_single_sampler_done(struct cso_context *ctx, info->samplers); ctx->max_sampler_seen = -1; } /* * 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 +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 cso_save_fragment_samplers(struct cso_context *ctx) { struct sampler_info *info = &ctx->samplers[PIPE_SHADER_FRAGMENT]; struct sampler_info *saved = &ctx->fragment_samplers_saved; memcpy(saved->cso_samplers, info->cso_samplers, sizeof(info->cso_samplers)); diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index c21e838..190d0dc 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -52,31 +52,31 @@ enum pipe_error cso_set_blend( struct cso_context *cso, enum pipe_error cso_set_depth_stencil_alpha( struct cso_context *cso, const struct pipe_depth_stencil_alpha_state *dsa ); 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, const struct pipe_sampler_state **states); /* 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); void cso_single_sampler_done(struct cso_context *cso, enum pipe_shader_type shader_stage); enum pipe_error cso_set_vertex_elements(struct cso_context *ctx, unsigned count, -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev