#ifndef _NINE_BASETEXTURE9_H_
#define _NINE_BASETEXTURE9_H_
+#include "device9.h"
#include "resource9.h"
#include "util/u_inlines.h"
#include "util/list.h"
return This->view[sRGB];
}
+static void inline
+NineBindTextureToDevice( struct NineDevice9 *device,
+ struct NineBaseTexture9 **slot,
+ struct NineBaseTexture9 *tex )
+{
+ struct NineBaseTexture9 *old = *slot;
+
+ if (tex) {
+ if ((tex->managed.dirty | tex->dirty_mip) && LIST_IS_EMPTY(&tex->list))
+ list_add(&tex->list, &device->update_textures);
+
+ tex->bind_count++;
+ }
+ if (old)
+ old->bind_count--;
+
+ nine_bind(slot, tex);
+}
+
#ifdef DEBUG
void
NineBaseTexture9_Dump( struct NineBaseTexture9 *This );
NineUnknown_dtor(&This->base);
}
+static void
+NineStateBlock9_BindTexture( struct NineDevice9 *device,
+ boolean applyToDevice,
+ struct NineBaseTexture9 **slot,
+ struct NineBaseTexture9 *tex )
+{
+ if (applyToDevice)
+ NineBindTextureToDevice(device, slot, tex);
+ else
+ nine_bind(slot, tex);
+}
+
/* Copy state marked changed in @mask from @src to @dst.
* If @apply is false, updating dst->changed can be omitted.
* TODO: compare ?
}
}
+ /* Textures */
+ if (mask->changed.texture) {
+ uint32_t m = mask->changed.texture;
+ for (s = 0; m; ++s, m >>= 1)
+ if (m & 1)
+ NineStateBlock9_BindTexture(device, apply, &dst->texture[s], src->texture[s]);
+ }
+
if (!(mask->changed.group & NINE_STATE_FF))
return;
WARN_ONCE("Fixed function state not handled properly by StateBlocks.\n");
}
}
+ /* Textures */
+ if (1) {
+ for (i = 0; i < device->caps.MaxSimultaneousTextures; i++)
+ NineStateBlock9_BindTexture(device, apply, &dst->texture[i], src->texture[i]);
+ }
+
/* keep this check in case we want to disable FF */
if (!(help->changed.group & NINE_STATE_FF))
return;
struct nine_state *dst = &This->state;
struct nine_state *src = &device->state;
const int MaxStreams = device->caps.MaxStreams;
- unsigned s;
DBG("This=%p\n", This);
if (dst->changed.group & NINE_STATE_VDECL)
nine_bind(&dst->vdecl, src->vdecl);
- /* Textures */
- if (dst->changed.texture) {
- uint32_t m = dst->changed.texture;
- for (s = 0; m; ++s, m >>= 1)
- if (m & 1)
- nine_bind(&dst->texture[s], src->texture[s]);
- }
-
return D3D_OK;
}
struct nine_state *src = &This->state;
struct nine_range_pool *pool = &device->range_pool;
const int MaxStreams = device->caps.MaxStreams;
- unsigned s;
DBG("This=%p\n", This);
if ((src->changed.group & NINE_STATE_VDECL) && src->vdecl)
nine_bind(&dst->vdecl, src->vdecl);
- /* Textures */
- if (src->changed.texture) {
- uint32_t m = src->changed.texture;
-
- for (s = 0; m; ++s, m >>= 1) {
- struct NineBaseTexture9 *tex = src->texture[s];
- if (!(m & 1))
- continue;
- if (tex) {
- tex->bind_count++;
- if ((tex->managed.dirty | tex->dirty_mip) && LIST_IS_EMPTY(&tex->list))
- list_add(&tex->list, &This->base.device->update_textures);
- }
- if (src->texture[s])
- src->texture[s]->bind_count--;
- nine_bind(&dst->texture[s], src->texture[s]);
- }
- }
-
return D3D_OK;
}