summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/nine/device9.c19
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c32
-rw-r--r--src/gallium/state_trackers/nine/nine_state.h10
-rw-r--r--src/gallium/state_trackers/nine/stateblock9.c4
4 files changed, 46 insertions, 19 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 102e5fc5919..d11f3d1903c 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -3469,19 +3469,20 @@ NineDevice9_SetStreamSourceFreq( struct NineDevice9 *This,
(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;
}
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 066ed7f4aec..cde38ee6622 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -677,8 +677,6 @@ update_vertex_elements(struct NineDevice9 *device)
}
cso_set_vertex_elements(device->cso, vs->num_inputs, ve);
-
- state->changed.stream_freq = 0;
}
static void
@@ -1260,6 +1258,25 @@ nine_context_set_stream_source(struct NineDevice9 *device,
}
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)
{
@@ -1304,6 +1321,13 @@ nine_context_apply_stateblock(struct NineDevice9 *device,
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;
}
@@ -1473,8 +1497,8 @@ init_draw_info(struct pipe_draw_info *info,
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;
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index e111f091443..5bc9f707023 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -137,7 +137,7 @@ struct nine_state
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;
@@ -180,7 +180,6 @@ struct nine_state
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;
@@ -229,6 +228,8 @@ struct nine_context {
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];
@@ -293,6 +294,11 @@ nine_context_set_stream_source(struct NineDevice9 *device,
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);
diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c
index 3ebee84471f..4af370ec94d 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -282,9 +282,6 @@ nine_state_copy_common(struct NineDevice9 *device,
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;
@@ -466,7 +463,6 @@ nine_state_copy_common_all(struct NineDevice9 *device,
}
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;