state->vtxbuf[i].stride = Stride;
state->vtxbuf[i].buffer_offset = OffsetInBytes;
- nine_bind(&state->stream[i], pStreamData);
+ NineBindBufferToDevice(This,
+ (struct NineBuffer9 **)&state->stream[i],
+ (struct NineBuffer9 *)pVBuf9);
nine_context_set_stream_source(This,
StreamNumber,
if (state->idxbuf == idxbuf)
return D3D_OK;
- nine_bind(&state->idxbuf, idxbuf);
+
+ NineBindBufferToDevice(This,
+ (struct NineBuffer9 **)&state->idxbuf,
+ (struct NineBuffer9 *)idxbuf);
nine_context_set_indices(This, idxbuf);
#include "basetexture9.h"
#include "nine_helpers.h"
#include "vertexdeclaration9.h"
+#include "vertexbuffer9.h"
+#include "indexbuffer9.h"
#define DBG_CHANNEL DBG_STATEBLOCK
NineUnknown_dtor(&This->base);
}
+static void
+NineStateBlock9_BindBuffer( struct NineDevice9 *device,
+ boolean applyToDevice,
+ struct NineBuffer9 **slot,
+ struct NineBuffer9 *buf )
+{
+ if (applyToDevice)
+ NineBindBufferToDevice(device, slot, buf);
+ else
+ nine_bind(slot, buf);
+}
+
static void
NineStateBlock9_BindTexture( struct NineDevice9 *device,
boolean applyToDevice,
/* Index buffer. */
if (mask->changed.group & NINE_STATE_IDXBUF)
- nine_bind(&dst->idxbuf, src->idxbuf);
+ NineStateBlock9_BindBuffer(device,
+ apply,
+ (struct NineBuffer9 **)&dst->idxbuf,
+ (struct NineBuffer9 *)src->idxbuf);
/* Vertex streams. */
if (mask->changed.vtxbuf | mask->changed.stream_freq) {
uint32_t m = mask->changed.vtxbuf | mask->changed.stream_freq;
for (i = 0; m; ++i, m >>= 1) {
if (mask->changed.vtxbuf & (1 << i)) {
- nine_bind(&dst->stream[i], src->stream[i]);
+ NineStateBlock9_BindBuffer(device,
+ apply,
+ (struct NineBuffer9 **)&dst->stream[i],
+ (struct NineBuffer9 *)src->stream[i]);
if (src->stream[i]) {
dst->vtxbuf[i].buffer_offset = src->vtxbuf[i].buffer_offset;
dst->vtxbuf[i].stride = src->vtxbuf[i].stride;
src->changed.sampler, sizeof(dst->changed.sampler));
/* Index buffer. */
- nine_bind(&dst->idxbuf, src->idxbuf);
+ NineStateBlock9_BindBuffer(device,
+ apply,
+ (struct NineBuffer9 **)&dst->idxbuf,
+ (struct NineBuffer9 *)src->idxbuf);
/* Vertex streams. */
if (1) {
for (i = 0; i < ARRAY_SIZE(dst->stream); ++i) {
- nine_bind(&dst->stream[i], src->stream[i]);
+ NineStateBlock9_BindBuffer(device,
+ apply,
+ (struct NineBuffer9 **)&dst->stream[i],
+ (struct NineBuffer9 *)src->stream[i]);
if (src->stream[i]) {
dst->vtxbuf[i].buffer_offset = src->vtxbuf[i].buffer_offset;
dst->vtxbuf[i].stride = src->vtxbuf[i].stride;