(Setting & D3DSTREAMSOURCE_INDEXEDDATA)), D3DERR_INVALIDCALL);
user_assert(Setting, D3DERR_INVALIDCALL);
- if (likely(!This->is_recording) && state->stream_freq[StreamNumber] == Setting)
+ if (unlikely(This->is_recording)) {
+ state->stream_freq[StreamNumber] = Setting;
+ state->changed.stream_freq |= 1 << StreamNumber;
+ if (StreamNumber != 0)
+ state->changed.group |= NINE_STATE_STREAMFREQ;
return D3D_OK;
+ }
- state->stream_freq[StreamNumber] = Setting;
+ if (state->stream_freq[StreamNumber] == Setting)
+ return D3D_OK;
- if (Setting & D3DSTREAMSOURCE_INSTANCEDATA)
- state->stream_instancedata_mask |= 1 << StreamNumber;
- else
- state->stream_instancedata_mask &= ~(1 << StreamNumber);
+ state->stream_freq[StreamNumber] = Setting;
- state->changed.stream_freq |= 1 << StreamNumber; /* Used for stateblocks */
- if (StreamNumber != 0)
- state->changed.group |= NINE_STATE_STREAMFREQ;
+ nine_context_set_stream_source_freq(This, StreamNumber, Setting);
return D3D_OK;
}
}
cso_set_vertex_elements(device->cso, vs->num_inputs, ve);
-
- state->changed.stream_freq = 0;
}
static void
pVBuf9 ? NineVertexBuffer9_GetResource(pVBuf9) : NULL);
}
+void
+nine_context_set_stream_source_freq(struct NineDevice9 *device,
+ UINT StreamNumber,
+ UINT Setting)
+{
+ struct nine_state *state = &device->state;
+ struct nine_context *context = &device->context;
+
+ context->stream_freq[StreamNumber] = Setting;
+
+ if (Setting & D3DSTREAMSOURCE_INSTANCEDATA)
+ context->stream_instancedata_mask |= 1 << StreamNumber;
+ else
+ context->stream_instancedata_mask &= ~(1 << StreamNumber);
+
+ if (StreamNumber != 0)
+ state->changed.group |= NINE_STATE_STREAMFREQ;
+}
+
void
nine_context_apply_stateblock(struct NineDevice9 *device,
const struct nine_state *src)
context->vtxbuf[i].stride = src->vtxbuf[i].stride;
}
}
+ if (src->changed.stream_freq & (1 << i)) {
+ context->stream_freq[i] = src->stream_freq[i];
+ if (src->stream_freq[i] & D3DSTREAMSOURCE_INSTANCEDATA)
+ context->stream_instancedata_mask |= 1 << i;
+ else
+ context->stream_instancedata_mask &= ~(1 << i);
+ }
}
context->changed.vtxbuf |= src->changed.vtxbuf;
}
info->count = prim_count_to_vertex_count(type, count);
info->start_instance = 0;
info->instance_count = 1;
- if (dev->state.stream_instancedata_mask & dev->context.stream_usage_mask)
- info->instance_count = MAX2(dev->state.stream_freq[0] & 0x7FFFFF, 1);
+ if (dev->context.stream_instancedata_mask & dev->context.stream_usage_mask)
+ info->instance_count = MAX2(dev->context.stream_freq[0] & 0x7FFFFF, 1);
info->primitive_restart = FALSE;
info->restart_index = 0;
info->count_from_stream_output = NULL;
uint32_t group;
uint32_t rs[(NINED3DRS_COUNT + 31) / 32]; /* stateblocks only */
uint32_t vtxbuf; /* stateblocks only */
- uint32_t stream_freq;
+ uint32_t stream_freq; /* stateblocks only */
uint32_t texture; /* stateblocks only */
uint16_t sampler[NINE_MAX_SAMPLERS];
struct nine_range *vs_const_f;
struct NineVertexBuffer9 *stream[PIPE_MAX_ATTRIBS];
struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS]; /* vtxbuf.buffer unused */
UINT stream_freq[PIPE_MAX_ATTRIBS];
- uint32_t stream_instancedata_mask; /* derived from stream_freq */
struct pipe_clip_state clip;
uint8_t rt_mask;
struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
+ UINT stream_freq[PIPE_MAX_ATTRIBS];
+ uint32_t stream_instancedata_mask; /* derived from stream_freq */
uint32_t stream_usage_mask; /* derived from VS and vdecl */
DWORD rs[NINED3DRS_COUNT];
UINT OffsetInBytes,
UINT Stride);
+void
+nine_context_set_stream_source_freq(struct NineDevice9 *device,
+ UINT StreamNumber,
+ UINT Setting);
+
void
nine_context_apply_stateblock(struct NineDevice9 *device,
const struct nine_state *src);
if (mask->changed.stream_freq & (1 << i))
dst->stream_freq[i] = src->stream_freq[i];
}
- dst->stream_instancedata_mask &= ~mask->changed.stream_freq;
- dst->stream_instancedata_mask |=
- src->stream_instancedata_mask & mask->changed.stream_freq;
if (apply) {
dst->changed.vtxbuf |= mask->changed.vtxbuf;
dst->changed.stream_freq |= mask->changed.stream_freq;
}
dst->stream_freq[i] = src->stream_freq[i];
}
- dst->stream_instancedata_mask = src->stream_instancedata_mask;
if (apply) {
dst->changed.vtxbuf = (1ULL << MaxStreams) - 1;
dst->changed.stream_freq = (1ULL << MaxStreams) - 1;