From d2ad10d03be8e6d4b150bbdf2a28ea3d5a18a2ed Mon Sep 17 00:00:00 2001 From: marha Date: Sun, 13 Apr 2014 14:24:56 +0200 Subject: fontconfig libxcb mesa xserver xcb-proto git update 13 Apr 2014 xserver commit 3028ae6c9aa37168e249e0d847b29f8e3efb05b2 libxcb commit 29e419c5840a1eeda3336a0802686ee723dcaab3 libxcb/xcb-proto commit 70fea02b7d90d86e9d3b0dc5b61406bf4c910999 pixman commit 4b76bbfda670f9ede67d0449f3640605e1fc4df0 fontconfig commit f44157c809d280e2a0ce87fb078fc4b278d24a67 mesa commit 936dda08ee6d7b2be2b016bc06780e401088ec13 --- mesalib/src/mesa/state_tracker/st_atom_texture.c | 55 +++++++++++------------- 1 file changed, 26 insertions(+), 29 deletions(-) (limited to 'mesalib/src/mesa/state_tracker/st_atom_texture.c') diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c index c9bffce4f..afc6d9dab 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_texture.c +++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c @@ -200,9 +200,9 @@ get_texture_format_swizzle(const struct st_texture_object *stObj) * \param stObj the st texture object, */ static boolean -check_sampler_swizzle(const struct st_texture_object *stObj) +check_sampler_swizzle(const struct st_texture_object *stObj, + struct pipe_sampler_view *sv) { - const struct pipe_sampler_view *sv = stObj->sampler_view; unsigned swizzle = get_texture_format_swizzle(stObj); return ((sv->swizzle_r != GET_SWZ(swizzle, 0)) || @@ -258,40 +258,47 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe, static struct pipe_sampler_view * -st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj, - struct pipe_context *pipe, +st_get_texture_sampler_view_from_stobj(struct st_context *st, + struct st_texture_object *stObj, const struct gl_sampler_object *samp, enum pipe_format format) { + struct pipe_sampler_view **sv; + if (!stObj || !stObj->pt) { return NULL; } - if (!stObj->sampler_view) { - stObj->sampler_view = - st_create_texture_sampler_view_from_stobj(pipe, stObj, samp, format); + sv = st_texture_get_sampler_view(st, stObj); + + /* if sampler view has changed dereference it */ + if (*sv) { + if (check_sampler_swizzle(stObj, *sv) || + (format != (*sv)->format) || + stObj->base.BaseLevel != (*sv)->u.tex.first_level) { + pipe_sampler_view_reference(sv, NULL); + } + } + + if (!*sv) { + *sv = st_create_texture_sampler_view_from_stobj(st->pipe, stObj, samp, format); - } else if (stObj->sampler_view->context != pipe) { + } else if ((*sv)->context != st->pipe) { /* Recreate view in correct context, use existing view as template */ - /* XXX: This isn't optimal, we should try to use more than one view. - Otherwise we create/destroy the view all the time - */ - struct pipe_sampler_view *sv = - pipe->create_sampler_view(pipe, stObj->pt, stObj->sampler_view); - pipe_sampler_view_reference(&stObj->sampler_view, NULL); - stObj->sampler_view = sv; + struct pipe_sampler_view *new_sv = + st->pipe->create_sampler_view(st->pipe, stObj->pt, *sv); + pipe_sampler_view_reference(sv, NULL); + *sv = new_sv; } - return stObj->sampler_view; + return *sv; } - static GLboolean update_single_texture(struct st_context *st, struct pipe_sampler_view **sampler_view, GLuint texUnit) { - struct pipe_context *pipe = st->pipe; struct gl_context *ctx = st->ctx; const struct gl_sampler_object *samp; struct gl_texture_object *texObj; @@ -330,17 +337,7 @@ update_single_texture(struct st_context *st, } } - /* if sampler view has changed dereference it */ - if (stObj->sampler_view) { - if (check_sampler_swizzle(stObj) || - (view_format != stObj->sampler_view->format) || - stObj->base.BaseLevel != stObj->sampler_view->u.tex.first_level) { - pipe_sampler_view_release(pipe, &stObj->sampler_view); - } - } - - *sampler_view = st_get_texture_sampler_view_from_stobj(stObj, pipe, - samp, + *sampler_view = st_get_texture_sampler_view_from_stobj(st, stObj, samp, view_format); return GL_TRUE; } -- cgit v1.2.3