summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2018-10-13 22:35:22 +0200
committerAxel Davy <[email protected]>2018-10-26 22:16:16 +0200
commitcb8ea21e1c0de86131b11e88c72407baf6621567 (patch)
treed396a8df405602e43bbf8f1a2ad655b8b200c96f /src/gallium/state_trackers
parent7e64e39f8bb54e45cc76dcd33d38537696e53a44 (diff)
st/nine: Remove commented nine_context_apply_stateblock
At some point the project was to adapt the commented version to csmt. The csmt rework enabled to fix some state aliasing issues between stateblocks and internal state updates. The commented version needs a lot of work to work with that. Just drop it. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c230
1 files changed, 0 insertions, 230 deletions
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 3db9a07fbf4..c9901209189 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -1893,236 +1893,6 @@ CSMT_ITEM_NO_WAIT(nine_context_set_swvp,
context->changed.group |= NINE_STATE_SWVP;
}
-#if 0
-
-void
-nine_context_apply_stateblock(struct NineDevice9 *device,
- const struct nine_state *src)
-{
- struct nine_context *context = &device->context;
- int i;
-
- context->changed.group |= src->changed.group;
-
- for (i = 0; i < ARRAY_SIZE(src->changed.rs); ++i) {
- uint32_t m = src->changed.rs[i];
- while (m) {
- const int r = ffs(m) - 1;
- m &= ~(1 << r);
- context->rs[i * 32 + r] = nine_fix_render_state_value(i * 32 + r, src->rs_advertised[i * 32 + r]);
- }
- }
-
- /* Textures */
- if (src->changed.texture) {
- uint32_t m = src->changed.texture;
- unsigned s;
-
- for (s = 0; m; ++s, m >>= 1) {
- struct NineBaseTexture9 *tex = src->texture[s];
- if (!(m & 1))
- continue;
- nine_context_set_texture(device, s, tex);
- }
- }
-
- /* Sampler state */
- if (src->changed.group & NINE_STATE_SAMPLER) {
- unsigned s;
-
- for (s = 0; s < NINE_MAX_SAMPLERS; ++s) {
- uint32_t m = src->changed.sampler[s];
- while (m) {
- const int i = ffs(m) - 1;
- m &= ~(1 << i);
- if (nine_check_sampler_state_value(i, src->samp_advertised[s][i]))
- context->samp[s][i] = src->samp_advertised[s][i];
- }
- context->changed.sampler[s] |= src->changed.sampler[s];
- }
- }
-
- /* Vertex buffers */
- if (src->changed.vtxbuf | src->changed.stream_freq) {
- uint32_t m = src->changed.vtxbuf | src->changed.stream_freq;
- for (i = 0; m; ++i, m >>= 1) {
- if (src->changed.vtxbuf & (1 << i)) {
- if (src->stream[i]) {
- unsigned offset = 0;
- pipe_resource_reference(&context->vtxbuf[i].buffer,
- src->stream[i] ? NineVertexBuffer9_GetResource(src->stream[i], &offset) : NULL);
- context->vtxbuf[i].buffer_offset = src->vtxbuf[i].buffer_offset + offset;
- 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;
- }
-
- /* Index buffer */
- if (src->changed.group & NINE_STATE_IDXBUF)
- nine_context_set_indices(device, src->idxbuf);
-
- /* Vertex declaration */
- if ((src->changed.group & NINE_STATE_VDECL) && src->vdecl)
- nine_context_set_vertex_declaration(device, src->vdecl);
-
- /* Vertex shader */
- if (src->changed.group & NINE_STATE_VS)
- nine_bind(&context->vs, src->vs);
-
- context->programmable_vs = context->vs && !(context->vdecl && context->vdecl->position_t);
-
- /* Pixel shader */
- if (src->changed.group & NINE_STATE_PS)
- nine_bind(&context->ps, src->ps);
-
- /* Vertex constants */
- if (src->changed.group & NINE_STATE_VS_CONST) {
- struct nine_range *r;
- if (device->may_swvp) {
- for (r = src->changed.vs_const_f; r; r = r->next) {
- int bgn = r->bgn;
- int end = r->end;
- memcpy(&context->vs_const_f_swvp[bgn * 4],
- &src->vs_const_f[bgn * 4],
- (end - bgn) * 4 * sizeof(float));
- if (bgn < device->max_vs_const_f) {
- end = MIN2(end, device->max_vs_const_f);
- memcpy(&context->vs_const_f[bgn * 4],
- &src->vs_const_f[bgn * 4],
- (end - bgn) * 4 * sizeof(float));
- }
- }
- } else {
- for (r = src->changed.vs_const_f; r; r = r->next) {
- memcpy(&context->vs_const_f[r->bgn * 4],
- &src->vs_const_f[r->bgn * 4],
- (r->end - r->bgn) * 4 * sizeof(float));
- }
- }
- for (r = src->changed.vs_const_i; r; r = r->next) {
- memcpy(&context->vs_const_i[r->bgn * 4],
- &src->vs_const_i[r->bgn * 4],
- (r->end - r->bgn) * 4 * sizeof(int));
- }
- for (r = src->changed.vs_const_b; r; r = r->next) {
- memcpy(&context->vs_const_b[r->bgn],
- &src->vs_const_b[r->bgn],
- (r->end - r->bgn) * sizeof(int));
- }
- context->changed.vs_const_f = !!src->changed.vs_const_f;
- context->changed.vs_const_i = !!src->changed.vs_const_i;
- context->changed.vs_const_b = !!src->changed.vs_const_b;
- }
-
- /* Pixel constants */
- if (src->changed.group & NINE_STATE_PS_CONST) {
- struct nine_range *r;
- for (r = src->changed.ps_const_f; r; r = r->next) {
- memcpy(&context->ps_const_f[r->bgn * 4],
- &src->ps_const_f[r->bgn * 4],
- (r->end - r->bgn) * 4 * sizeof(float));
- }
- if (src->changed.ps_const_i) {
- uint16_t m = src->changed.ps_const_i;
- for (i = ffs(m) - 1, m >>= i; m; ++i, m >>= 1)
- if (m & 1)
- memcpy(context->ps_const_i[i], src->ps_const_i[i], 4 * sizeof(int));
- }
- if (src->changed.ps_const_b) {
- uint16_t m = src->changed.ps_const_b;
- for (i = ffs(m) - 1, m >>= i; m; ++i, m >>= 1)
- if (m & 1)
- context->ps_const_b[i] = src->ps_const_b[i];
- }
- context->changed.ps_const_f = !!src->changed.ps_const_f;
- context->changed.ps_const_i = !!src->changed.ps_const_i;
- context->changed.ps_const_b = !!src->changed.ps_const_b;
- }
-
- /* Viewport */
- if (src->changed.group & NINE_STATE_VIEWPORT)
- context->viewport = src->viewport;
-
- /* Scissor */
- if (src->changed.group & NINE_STATE_SCISSOR)
- context->scissor = src->scissor;
-
- /* User Clip Planes */
- if (src->changed.ucp) {
- for (i = 0; i < PIPE_MAX_CLIP_PLANES; ++i)
- if (src->changed.ucp & (1 << i))
- memcpy(context->clip.ucp[i],
- src->clip.ucp[i], sizeof(src->clip.ucp[0]));
- context->changed.ucp = TRUE;
- }
-
- if (!(src->changed.group & NINE_STATE_FF))
- return;
-
- /* Fixed function state. */
-
- if (src->changed.group & NINE_STATE_FF_MATERIAL)
- context->ff.material = src->ff.material;
-
- if (src->changed.group & NINE_STATE_FF_PS_CONSTS) {
- unsigned s;
- for (s = 0; s < NINE_MAX_TEXTURE_STAGES; ++s) {
- for (i = 0; i < NINED3DTSS_COUNT; ++i)
- if (src->ff.changed.tex_stage[s][i / 32] & (1 << (i % 32)))
- context->ff.tex_stage[s][i] = src->ff.tex_stage[s][i];
- }
- }
- if (src->changed.group & NINE_STATE_FF_LIGHTING) {
- unsigned num_lights = MAX2(context->ff.num_lights, src->ff.num_lights);
- /* Can happen if the stateblock had recorded the creation of
- * new lights. */
- if (context->ff.num_lights < num_lights) {
- context->ff.light = REALLOC(context->ff.light,
- context->ff.num_lights * sizeof(D3DLIGHT9),
- num_lights * sizeof(D3DLIGHT9));
- memset(&context->ff.light[context->ff.num_lights], 0, (num_lights - context->ff.num_lights) * sizeof(D3DLIGHT9));
- for (i = context->ff.num_lights; i < num_lights; ++i)
- context->ff.light[i].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID;
- context->ff.num_lights = num_lights;
- }
- /* src->ff.num_lights < num_lights has been handled before */
- assert (src->ff.num_lights == num_lights);
-
- for (i = 0; i < num_lights; ++i)
- if (src->ff.light[i].Type != NINED3DLIGHT_INVALID)
- context->ff.light[i] = src->ff.light[i];
-
- memcpy(context->ff.active_light, src->ff.active_light, sizeof(src->ff.active_light) );
- context->ff.num_lights_active = src->ff.num_lights_active;
- }
- if (src->changed.group & NINE_STATE_FF_VSTRANSF) {
- for (i = 0; i < ARRAY_SIZE(src->ff.changed.transform); ++i) {
- unsigned s;
- if (!src->ff.changed.transform[i])
- continue;
- for (s = i * 32; s < (i * 32 + 32); ++s) {
- if (!(src->ff.changed.transform[i] & (1 << (s % 32))))
- continue;
- *nine_state_access_transform(&context->ff, s, TRUE) =
- *nine_state_access_transform( /* const because !alloc */
- (struct nine_ff_state *)&src->ff, s, FALSE);
- }
- context->ff.changed.transform[i] |= src->ff.changed.transform[i];
- }
- }
-}
-
-#endif
-
/* Do not write to nine_context directly. Slower,
* but works with csmt. TODO: write a special csmt version that
* would record the list of commands as much as possible,