summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/texture9.c
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2015-02-20 12:34:47 +0100
committerAxel Davy <[email protected]>2015-04-29 08:28:11 +0200
commit58d295d41e30434c570248eeee73af2006b79eea (patch)
tree7553128065277d67b89b049c6571f9f6a5c5e5db /src/gallium/state_trackers/nine/texture9.c
parent6f57e014365563c0dcc32451401a76212abf0a54 (diff)
st/nine: Enforce LOD 0 for D3DUSAGE_AUTOGENMIPMAP
For D3DUSAGE_AUTOGENMIPMAP textures, applications can only lock/copy from/get surface descriptor for/etc the first level. Thus it makes sense to restrict the LOD to 0, and use only the first level to generate the sublevels. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/texture9.c')
-rw-r--r--src/gallium/state_trackers/nine/texture9.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c
index c1d1343b273..5900e76e52c 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -146,6 +146,11 @@ NineTexture9_ctor( struct NineTexture9 *This,
Width, Height,
info->last_level);
} else if (Pool != D3DPOOL_DEFAULT) {
+ /* TODO: For D3DUSAGE_AUTOGENMIPMAP, it is likely we only have to
+ * allocate only for the first level, since it is the only lockable
+ * level. Check apps don't crash if we allocate smaller buffer (some
+ * apps access sublevels of texture even if they locked only first
+ * level) */
level_offsets = alloca(sizeof(unsigned) * (info->last_level + 1));
user_buffer = MALLOC(
nine_format_get_size_and_offsets(pf, level_offsets,