summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/state_trackers/nine/basetexture9.c82
-rw-r--r--src/gallium/state_trackers/nine/basetexture9.h19
-rw-r--r--src/gallium/state_trackers/nine/cubetexture9.c2
-rw-r--r--src/gallium/state_trackers/nine/device9.c2
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c2
-rw-r--r--src/gallium/state_trackers/nine/stateblock9.c2
-rw-r--r--src/gallium/state_trackers/nine/surface9.c2
-rw-r--r--src/gallium/state_trackers/nine/texture9.c2
-rw-r--r--src/gallium/state_trackers/nine/volume9.c2
-rw-r--r--src/gallium/state_trackers/nine/volumetexture9.c2
10 files changed, 60 insertions, 57 deletions
diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c
index f2ca35b0205..75a305f099a 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -67,8 +67,8 @@ NineBaseTexture9_ctor( struct NineBaseTexture9 *This,
This->pipe = pParams->device->pipe;
This->mipfilter = (Usage & D3DUSAGE_AUTOGENMIPMAP) ?
D3DTEXF_LINEAR : D3DTEXF_NONE;
- This->lod = 0;
- This->lod_resident = -1;
+ This->managed.lod = 0;
+ This->managed.lod_resident = -1;
/* When a depth buffer is sampled, it is for shadow mapping, except for
* D3DFMT_INTZ, D3DFMT_DF16 and D3DFMT_DF24.
* In addition D3DFMT_INTZ can be used for both texturing and depth buffering
@@ -103,15 +103,15 @@ DWORD WINAPI
NineBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
DWORD LODNew )
{
- DWORD old = This->lod;
+ DWORD old = This->managed.lod;
DBG("This=%p LODNew=%d\n", This, LODNew);
user_assert(This->base.pool == D3DPOOL_MANAGED, 0);
- This->lod = MIN2(LODNew, This->base.info.last_level);
+ This->managed.lod = MIN2(LODNew, This->base.info.last_level);
- if (This->lod != old && This->bind_count && LIST_IS_EMPTY(&This->list))
+ if (This->managed.lod != old && This->bind_count && LIST_IS_EMPTY(&This->list))
list_add(&This->list, &This->base.base.device->update_textures);
return old;
@@ -122,7 +122,7 @@ NineBaseTexture9_GetLOD( struct NineBaseTexture9 *This )
{
DBG("This=%p\n", This);
- return This->lod;
+ return This->managed.lod;
}
DWORD WINAPI
@@ -165,7 +165,7 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
unsigned last_level = This->base.info.last_level;
unsigned l;
- DBG("This=%p dirty=%i type=%s\n", This, This->dirty,
+ DBG("This=%p dirty=%i type=%s\n", This, This->managed.dirty,
nine_D3DRTYPE_to_str(This->base.type));
assert(This->base.pool == D3DPOOL_MANAGED);
@@ -173,10 +173,10 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP)
last_level = 0; /* TODO: What if level 0 is not resident ? */
- if (This->lod_resident != This->lod) {
+ if (This->managed.lod_resident != This->managed.lod) {
struct pipe_resource *res;
- DBG("updating LOD from %u to %u ...\n", This->lod_resident, This->lod);
+ DBG("updating LOD from %u to %u ...\n", This->managed.lod_resident, This->managed.lod);
pipe_sampler_view_reference(&This->view[0], NULL);
pipe_sampler_view_reference(&This->view[1], NULL);
@@ -192,13 +192,13 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
state->changed.group |= NINE_STATE_TEXTURE;
}
- hr = NineBaseTexture9_CreatePipeResource(This, This->lod_resident != -1);
+ hr = NineBaseTexture9_CreatePipeResource(This, This->managed.lod_resident != -1);
if (FAILED(hr))
return hr;
res = This->base.resource;
- if (This->lod_resident == -1) /* no levels were resident */
- This->lod_resident = This->base.info.last_level + 1;
+ if (This->managed.lod_resident == -1) /* no levels were resident */
+ This->managed.lod_resident = This->base.info.last_level + 1;
if (This->base.type == D3DRTYPE_TEXTURE) {
struct NineTexture9 *tex = NineTexture9(This);
@@ -207,15 +207,15 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
/* Mark uninitialized levels as dirty. */
box.x = box.y = box.z = 0;
box.depth = 1;
- for (l = This->lod; l < This->lod_resident; ++l) {
+ for (l = This->managed.lod; l < This->managed.lod_resident; ++l) {
box.width = u_minify(This->base.info.width0, l);
box.height = u_minify(This->base.info.height0, l);
NineSurface9_AddDirtyRect(tex->surfaces[l], &box);
}
- for (l = 0; l < This->lod; ++l)
+ for (l = 0; l < This->managed.lod; ++l)
NineSurface9_SetResource(tex->surfaces[l], NULL, -1);
for (; l <= This->base.info.last_level; ++l)
- NineSurface9_SetResource(tex->surfaces[l], res, l - This->lod);
+ NineSurface9_SetResource(tex->surfaces[l], res, l - This->managed.lod);
} else
if (This->base.type == D3DRTYPE_CUBETEXTURE) {
struct NineCubeTexture9 *tex = NineCubeTexture9(This);
@@ -225,13 +225,13 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
/* Mark uninitialized levels as dirty. */
box.x = box.y = box.z = 0;
box.depth = 1;
- for (l = This->lod; l < This->lod_resident; ++l) {
+ for (l = This->managed.lod; l < This->managed.lod_resident; ++l) {
box.width = u_minify(This->base.info.width0, l);
box.height = u_minify(This->base.info.height0, l);
for (z = 0; z < 6; ++z)
NineSurface9_AddDirtyRect(tex->surfaces[l * 6 + z], &box);
}
- for (l = 0; l < This->lod; ++l) {
+ for (l = 0; l < This->managed.lod; ++l) {
for (z = 0; z < 6; ++z)
NineSurface9_SetResource(tex->surfaces[l * 6 + z],
NULL, -1);
@@ -239,7 +239,7 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
for (; l <= This->base.info.last_level; ++l) {
for (z = 0; z < 6; ++z)
NineSurface9_SetResource(tex->surfaces[l * 6 + z],
- res, l - This->lod);
+ res, l - This->managed.lod);
}
} else
if (This->base.type == D3DRTYPE_VOLUMETEXTURE) {
@@ -248,25 +248,25 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
/* Mark uninitialized levels as dirty. */
box.x = box.y = box.z = 0;
- for (l = This->lod; l < This->lod_resident; ++l) {
+ for (l = This->managed.lod; l < This->managed.lod_resident; ++l) {
box.width = u_minify(This->base.info.width0, l);
box.height = u_minify(This->base.info.height0, l);
box.depth = u_minify(This->base.info.depth0, l);
NineVolume9_AddDirtyRegion(tex->volumes[l], &box);
}
- for (l = 0; l < This->lod; ++l)
+ for (l = 0; l < This->managed.lod; ++l)
NineVolume9_SetResource(tex->volumes[l], NULL, -1);
for (; l <= This->base.info.last_level; ++l)
- NineVolume9_SetResource(tex->volumes[l], res, l - This->lod);
+ NineVolume9_SetResource(tex->volumes[l], res, l - This->managed.lod);
} else {
assert(!"invalid texture type");
}
- if (This->lod < This->lod_resident)
- This->dirty = TRUE;
- This->lod_resident = This->lod;
+ if (This->managed.lod < This->managed.lod_resident)
+ This->managed.dirty = TRUE;
+ This->managed.lod_resident = This->managed.lod;
}
- if (!This->dirty)
+ if (!This->managed.dirty)
return D3D_OK;
if (This->base.type == D3DRTYPE_TEXTURE) {
@@ -287,7 +287,7 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
memset(&tex->dirty_rect, 0, sizeof(tex->dirty_rect));
tex->dirty_rect.depth = 1;
}
- for (l = This->lod; l <= last_level; ++l)
+ for (l = This->managed.lod; l <= last_level; ++l)
NineSurface9_UploadSelf(tex->surfaces[l]);
} else
if (This->base.type == D3DRTYPE_CUBETEXTURE) {
@@ -310,7 +310,7 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
memset(&tex->dirty_rect[z], 0, sizeof(tex->dirty_rect[z]));
tex->dirty_rect[z].depth = 1;
}
- for (l = This->lod; l <= last_level; ++l)
+ for (l = This->managed.lod; l <= last_level; ++l)
NineSurface9_UploadSelf(tex->surfaces[l * 6 + z]);
}
} else
@@ -329,12 +329,12 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
}
memset(&tex->dirty_box, 0, sizeof(tex->dirty_box));
}
- for (l = This->lod; l <= last_level; ++l)
+ for (l = This->managed.lod; l <= last_level; ++l)
NineVolume9_UploadSelf(tex->volumes[l]);
} else {
assert(!"invalid texture type");
}
- This->dirty = FALSE;
+ This->managed.dirty = FALSE;
if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP)
This->dirty_mip = TRUE;
@@ -350,7 +350,7 @@ NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This )
struct pipe_resource *resource = This->base.resource;
unsigned base_level = 0;
- unsigned last_level = This->base.info.last_level - This->lod;
+ unsigned last_level = This->base.info.last_level - This->managed.lod;
unsigned first_layer = 0;
unsigned last_layer;
unsigned filter = This->mipfilter == D3DTEXF_POINT ? PIPE_TEX_FILTER_NEAREST
@@ -361,7 +361,7 @@ NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This )
NineBaseTexture9_UploadSelf(This);
if (!This->dirty_mip)
return;
- if (This->lod) {
+ if (This->managed.lod) {
ERR("AUTOGENMIPMAP if level 0 is not resident not supported yet !\n");
return;
}
@@ -392,18 +392,18 @@ NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This,
struct pipe_resource *old = This->base.resource;
DBG("This=%p lod=%u last_level=%u\n", This,
- This->lod, This->base.info.last_level);
+ This->managed.lod, This->base.info.last_level);
assert(This->base.pool == D3DPOOL_MANAGED);
templ = This->base.info;
- if (This->lod) {
- templ.width0 = u_minify(templ.width0, This->lod);
- templ.height0 = u_minify(templ.height0, This->lod);
- templ.depth0 = u_minify(templ.depth0, This->lod);
+ if (This->managed.lod) {
+ templ.width0 = u_minify(templ.width0, This->managed.lod);
+ templ.height0 = u_minify(templ.height0, This->managed.lod);
+ templ.depth0 = u_minify(templ.depth0, This->managed.lod);
}
- templ.last_level = This->base.info.last_level - This->lod;
+ templ.last_level = This->base.info.last_level - This->managed.lod;
if (old) {
/* LOD might have changed. */
@@ -424,8 +424,8 @@ NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This,
box.y = 0;
box.z = 0;
- l = (This->lod < This->lod_resident) ? This->lod_resident - This->lod : 0;
- m = (This->lod < This->lod_resident) ? 0 : This->lod - This->lod_resident;
+ l = (This->managed.lod < This->managed.lod_resident) ? This->managed.lod_resident - This->managed.lod : 0;
+ m = (This->managed.lod < This->managed.lod_resident) ? 0 : This->managed.lod - This->managed.lod_resident;
box.width = u_minify(templ.width0, l);
box.height = u_minify(templ.height0, l);
@@ -545,7 +545,7 @@ NineBaseTexture9_PreLoad( struct NineBaseTexture9 *This )
{
DBG("This=%p\n", This);
- if (This->dirty && This->base.pool == D3DPOOL_MANAGED)
+ if (This->managed.dirty && This->base.pool == D3DPOOL_MANAGED)
NineBaseTexture9_UploadSelf(This);
}
@@ -562,6 +562,6 @@ NineBaseTexture9_Dump( struct NineBaseTexture9 *This )
d3dformat_to_string(This->format),
This->base.info.width0, This->base.info.height0, This->base.info.depth0,
This->base.info.array_size, This->base.info.last_level,
- This->lod, This->lod_resident);
+ This->managed.lod, This->managed.lod_resident);
}
#endif /* DEBUG */
diff --git a/src/gallium/state_trackers/nine/basetexture9.h b/src/gallium/state_trackers/nine/basetexture9.h
index 006277104a0..7a091bf2578 100644
--- a/src/gallium/state_trackers/nine/basetexture9.h
+++ b/src/gallium/state_trackers/nine/basetexture9.h
@@ -38,17 +38,20 @@ struct NineBaseTexture9
D3DFORMAT format;
- D3DTEXTUREFILTERTYPE mipfilter;
- DWORD lod;
- DWORD lod_resident;
-
int16_t bind_count; /* to Device9->state.texture */
boolean shadow;
uint8_t pstype; /* 0: 2D, 1: 1D, 2: CUBE, 3: 3D */
- boolean dirty;
boolean dirty_mip;
+ D3DTEXTUREFILTERTYPE mipfilter;
+
+ /* Specific to managed textures */
+ struct {
+ boolean dirty;
+ DWORD lod;
+ DWORD lod_resident;
+ } managed;
};
static INLINE struct NineBaseTexture9 *
NineBaseTexture9( void *data )
@@ -108,9 +111,9 @@ static INLINE void
NineBaseTexture9_Validate( struct NineBaseTexture9 *This )
{
DBG_FLAG(DBG_BASETEXTURE, "This=%p dirty=%i dirty_mip=%i lod=%u/%u\n",
- This, This->dirty, This->dirty_mip, This->lod, This->lod_resident);
+ This, This->managed.dirty, This->dirty_mip, This->managed.lod, This->managed.lod_resident);
if ((This->base.pool == D3DPOOL_MANAGED) &&
- (This->dirty || This->lod != This->lod_resident))
+ (This->managed.dirty || This->managed.lod != This->managed.lod_resident))
NineBaseTexture9_UploadSelf(This);
if (This->dirty_mip)
NineBaseTexture9_GenerateMipSubLevels(This);
@@ -133,7 +136,7 @@ NineBaseTexture9_Dump( struct NineBaseTexture9 *This ) { }
#endif
#define BASETEX_REGISTER_UPDATE(t) do { \
- if (((t)->dirty | ((t)->dirty_mip)) && (t)->base.base.bind) \
+ if (((t)->managed.dirty | ((t)->dirty_mip)) && (t)->base.base.bind) \
if (LIST_IS_EMPTY(&(t)->list)) \
list_add(&(t)->list, &(t)->base.base.device->update_textures); \
} while(0)
diff --git a/src/gallium/state_trackers/nine/cubetexture9.c b/src/gallium/state_trackers/nine/cubetexture9.c
index f64764c6733..98fe887072c 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -263,7 +263,7 @@ NineCubeTexture9_AddDirtyRect( struct NineCubeTexture9 *This,
This->base.dirty_mip = TRUE;
return D3D_OK;
}
- This->base.dirty = TRUE;
+ This->base.managed.dirty = TRUE;
BASETEX_REGISTER_UPDATE(&This->base);
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 7ffede57c73..ce2ea769640 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2457,7 +2457,7 @@ NineDevice9_SetTexture( struct NineDevice9 *This,
if (tex) {
state->samplers_shadow |= tex->shadow << Stage;
- if ((tex->dirty | tex->dirty_mip) && LIST_IS_EMPTY(&tex->list))
+ if ((tex->managed.dirty | tex->dirty_mip) && LIST_IS_EMPTY(&tex->list))
list_add(&tex->list, &This->update_textures);
tex->bind_count++;
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 034e666d84c..435118bc93f 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -688,7 +688,7 @@ update_sampler_derived(struct nine_state *state, unsigned s)
}
if (state->samp[s][D3DSAMP_MIPFILTER] != D3DTEXF_NONE) {
- int lod = state->samp[s][D3DSAMP_MAXMIPLEVEL] - state->texture[s]->lod;
+ int lod = state->samp[s][D3DSAMP_MAXMIPLEVEL] - state->texture[s]->managed.lod;
if (lod < 0)
lod = 0;
if (state->samp[s][NINED3DSAMP_MINLOD] != lod) {
diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c
index 13217ae4547..032b9ffcbf0 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -501,7 +501,7 @@ NineStateBlock9_Apply( struct NineStateBlock9 *This )
continue;
if (tex) {
tex->bind_count++;
- if ((tex->dirty | tex->dirty_mip) && LIST_IS_EMPTY(&tex->list))
+ if ((tex->managed.dirty | tex->dirty_mip) && LIST_IS_EMPTY(&tex->list))
list_add(&tex->list, &This->base.device->update_textures);
dst->samplers_shadow |= tex->shadow << s;
}
diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c
index e202f870720..3a0b4d0c948 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -240,7 +240,7 @@ NineSurface9_MarkContainerDirty( struct NineSurface9 *This )
assert(This->texture == D3DRTYPE_TEXTURE ||
This->texture == D3DRTYPE_CUBETEXTURE);
if (This->base.pool == D3DPOOL_MANAGED)
- tex->dirty = TRUE;
+ tex->managed.dirty = TRUE;
else
if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP)
tex->dirty_mip = TRUE;
diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c
index 536d631af4c..5b5fd551a80 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -299,7 +299,7 @@ NineTexture9_AddDirtyRect( struct NineTexture9 *This,
This->base.dirty_mip = TRUE;
return D3D_OK;
}
- This->base.dirty = TRUE;
+ This->base.managed.dirty = TRUE;
BASETEX_REGISTER_UPDATE(&This->base);
diff --git a/src/gallium/state_trackers/nine/volume9.c b/src/gallium/state_trackers/nine/volume9.c
index fce89396204..24d5d53f01d 100644
--- a/src/gallium/state_trackers/nine/volume9.c
+++ b/src/gallium/state_trackers/nine/volume9.c
@@ -168,7 +168,7 @@ NineVolume9_MarkContainerDirty( struct NineVolume9 *This )
tex = NineBaseTexture9(This->base.container);
assert(tex);
if (This->desc.Pool == D3DPOOL_MANAGED)
- tex->dirty = TRUE;
+ tex->managed.dirty = TRUE;
else
if (This->desc.Usage & D3DUSAGE_AUTOGENMIPMAP)
tex->dirty_mip = TRUE;
diff --git a/src/gallium/state_trackers/nine/volumetexture9.c b/src/gallium/state_trackers/nine/volumetexture9.c
index 08fdd3d29cf..b5661731764 100644
--- a/src/gallium/state_trackers/nine/volumetexture9.c
+++ b/src/gallium/state_trackers/nine/volumetexture9.c
@@ -208,7 +208,7 @@ NineVolumeTexture9_AddDirtyBox( struct NineVolumeTexture9 *This,
This->base.dirty_mip = TRUE;
return D3D_OK;
}
- This->base.dirty = TRUE;
+ This->base.managed.dirty = TRUE;
BASETEX_REGISTER_UPDATE(&This->base);