summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine
diff options
context:
space:
mode:
authorPatrick Rudolph <[email protected]>2015-05-12 20:07:09 +0200
committerAxel Davy <[email protected]>2015-08-21 22:21:46 +0200
commitbb1c2c2aa3b15ee1fdf8b8085cc1ca9f8ef04ed9 (patch)
treec5b9615c0ef52f2fb33ffd9b5f4b1dde7e6ed7e5 /src/gallium/state_trackers/nine
parent3bcab9ba75b24bd6cabcd9d31165ad4c1fe9d75c (diff)
st/nine: Fix GenerateMipSubLevels potential crash
For the case of D3DPOOL_MANAGED textures, This->base.resource can be NULL at the start of the function. In This case, UploadSelf will take care of the defining. Assign resource after the UploadSelf call to prevent NULL pointer exception. Reviewed-by: Axel Davy <[email protected]> Signed-off-by: Patrick Rudolph <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine')
-rw-r--r--src/gallium/state_trackers/nine/basetexture9.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c
index 110df79769e..48fccb242bb 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -385,8 +385,7 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
void WINAPI
NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This )
{
- struct pipe_resource *resource = This->base.resource;
-
+ struct pipe_resource *resource;
unsigned base_level = 0;
unsigned last_level = This->base.info.last_level - This->managed.lod;
unsigned first_layer = 0;
@@ -409,6 +408,8 @@ NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This )
last_layer = util_max_layer(This->view[0]->texture, base_level);
+ resource = This->base.resource;
+
util_gen_mipmap(This->pipe, resource,
resource->format, base_level, last_level,
first_layer, last_layer, filter);