summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/i915simple
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-02-20 15:09:27 -0700
committerBrian <[email protected]>2008-02-20 15:09:44 -0700
commit25ea1901b44107a5bc5351487e18d52d75df8ffd (patch)
tree6b5255f7342a5fccabdbe0d3c845a0fbb12693af /src/gallium/drivers/i915simple
parentfce61f341faf6a2e1a8497ab963985ddbffa8b0a (diff)
gallium: replace some ordinary assignments with pipe_reference_texture()
This fixes at least one instance of dereferencing an invalid texture pointer.
Diffstat (limited to 'src/gallium/drivers/i915simple')
-rw-r--r--src/gallium/drivers/i915simple/i915_state.c5
-rw-r--r--src/gallium/drivers/i915simple/i915_texture.c1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/gallium/drivers/i915simple/i915_state.c b/src/gallium/drivers/i915simple/i915_state.c
index 294e6fad035..e055eed7e02 100644
--- a/src/gallium/drivers/i915simple/i915_state.c
+++ b/src/gallium/drivers/i915simple/i915_state.c
@@ -32,6 +32,7 @@
#include "draw/draw_context.h"
#include "pipe/p_winsys.h"
#include "pipe/p_util.h"
+#include "pipe/p_inlines.h"
#include "i915_context.h"
#include "i915_reg.h"
@@ -505,7 +506,9 @@ static void i915_set_sampler_texture(struct pipe_context *pipe,
{
struct i915_context *i915 = i915_context(pipe);
- i915->texture[sampler] = (struct i915_texture*)texture; /* ptr, not struct */
+ pipe_texture_reference(pipe,
+ (struct pipe_texture **) &i915->texture[sampler],
+ texture);
i915->dirty |= I915_NEW_TEXTURE;
}
diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c
index b235fae96d9..1b415a94d40 100644
--- a/src/gallium/drivers/i915simple/i915_texture.c
+++ b/src/gallium/drivers/i915simple/i915_texture.c
@@ -488,6 +488,7 @@ i915_texture_create(struct pipe_context *pipe,
struct i915_context *i915 = i915_context(pipe);
tex->base = *templat;
+ tex->base.refcount = 1;
if (i915->flags.is_i945 ? i945_miptree_layout(pipe, tex) :
i915_miptree_layout(pipe, tex))