[Mesa-dev] [PATCH 2/2] gallium/cso_cache: remove one call to pipe_sampler_view_reference

2011-11-04 Thread Marek Olšák
---
 src/gallium/auxiliary/cso_cache/cso_context.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c 
b/src/gallium/auxiliary/cso_cache/cso_context.c
index fdd40fc..b91fe1a 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -1265,8 +1265,10 @@ restore_sampler_views(struct cso_context *ctx,
uint i;
 
for (i = 0; i  info-nr_views_saved; i++) {
-  pipe_sampler_view_reference(info-views[i], info-views_saved[i]);
-  pipe_sampler_view_reference(info-views_saved[i], NULL);
+  pipe_sampler_view_reference(info-views[i], NULL);
+  /* move the reference from one pointer to another */
+  info-views[i] = info-views_saved[i];
+  info-views_saved[i] = NULL;
}
for (; i  info-nr_views; i++) {
   pipe_sampler_view_reference(info-views[i], NULL);
-- 
1.7.4.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] gallium/cso_cache: remove one call to pipe_sampler_view_reference

2011-11-04 Thread Jose Fonseca
Looks ok to me.

Jose

- Original Message -
 ---
  src/gallium/auxiliary/cso_cache/cso_context.c |6 --
  1 files changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c
 b/src/gallium/auxiliary/cso_cache/cso_context.c
 index fdd40fc..b91fe1a 100644
 --- a/src/gallium/auxiliary/cso_cache/cso_context.c
 +++ b/src/gallium/auxiliary/cso_cache/cso_context.c
 @@ -1265,8 +1265,10 @@ restore_sampler_views(struct cso_context *ctx,
 uint i;
  
 for (i = 0; i  info-nr_views_saved; i++) {
 -  pipe_sampler_view_reference(info-views[i],
 info-views_saved[i]);
 -  pipe_sampler_view_reference(info-views_saved[i], NULL);
 +  pipe_sampler_view_reference(info-views[i], NULL);
 +  /* move the reference from one pointer to another */
 +  info-views[i] = info-views_saved[i];
 +  info-views_saved[i] = NULL;
 }
 for (; i  info-nr_views; i++) {
pipe_sampler_view_reference(info-views[i], NULL);
 --
 1.7.4.1
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev