summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/basetexture9.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/basetexture9.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/basetexture9.c')
-rw-r--r--src/gallium/state_trackers/nine/basetexture9.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c
index 7315e787390..b868019d385 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -104,12 +104,15 @@ NineBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
DWORD LODNew )
{
DWORD old = This->managed.lod;
+ DWORD max_level;
DBG("This=%p LODNew=%d\n", This, LODNew);
user_assert(This->base.pool == D3DPOOL_MANAGED, 0);
- This->managed.lod = MIN2(LODNew, This->base.info.last_level);
+ max_level = (This->base.usage & D3DUSAGE_AUTOGENMIPMAP) ?
+ 0 : This->base.info.last_level;
+ This->managed.lod = MIN2(LODNew, max_level);
if (This->managed.lod != old && This->bind_count && LIST_IS_EMPTY(&This->list))
list_add(&This->list, &This->base.base.device->update_textures);
@@ -172,7 +175,7 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
assert(This->base.pool == D3DPOOL_MANAGED);
if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP)
- last_level = 0; /* TODO: What if level 0 is not resident ? */
+ last_level = 0;
update_lod = This->managed.lod_resident != This->managed.lod;
if (!update_lod && !This->managed.dirty)
@@ -366,7 +369,6 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP)
This->dirty_mip = TRUE;
- /* TODO: if dirty only because of lod change, only generate added levels */
DBG("DONE, generate mip maps = %i\n", This->dirty_mip);
return D3D_OK;