From bb666b0297cb81fc1b8192ba91efd2e0a69835c5 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Tue, 1 Nov 2016 18:30:33 +0100 Subject: [PATCH] st/nine: Back swvp in nine_context Part of the refactor to move all gallium calls to nine_state.c, and have all internal states required for those calls in nine_context. Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/device9.c | 3 ++- src/gallium/state_trackers/nine/nine_state.c | 14 ++++++++++++-- src/gallium/state_trackers/nine/nine_state.h | 7 +++++++ src/gallium/state_trackers/nine/vertexshader9.c | 2 +- src/gallium/state_trackers/nine/vertexshader9.h | 2 +- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 73b5888e4ec..8493e706fe8 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -173,6 +173,7 @@ NineDevice9_ctor( struct NineDevice9 *This, DBG("Application asked mixed Software Vertex Processing.\n"); This->may_swvp = true; } + This->context.swvp = This->swvp; /* TODO: check if swvp is resetted by device Resets */ if (This->may_swvp && @@ -2681,7 +2682,7 @@ NineDevice9_SetSoftwareVertexProcessing( struct NineDevice9 *This, { if (This->params.BehaviorFlags & D3DCREATE_MIXED_VERTEXPROCESSING) { This->swvp = bSoftware; - This->context.changed.group |= NINE_STATE_SWVP; + nine_context_set_swvp(This, bSoftware); return D3D_OK; } else return D3DERR_INVALIDCALL; /* msdn. TODO: check in practice */ diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 4242301af0c..6b4c77c773a 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -212,7 +212,7 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device) cb.buffer_size = context->vs->const_used_size; cb.user_buffer = context->vs_const_f; - if (device->swvp) { + if (context->swvp) { prepare_vs_constants_userbuf_swvp(device); return; } @@ -848,7 +848,7 @@ commit_vs_constants(struct NineDevice9 *device) if (unlikely(!context->programmable_vs)) pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, &context->pipe_data.cb_vs_ff); else { - if (device->swvp) { + if (context->swvp) { pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, &context->pipe_data.cb0_swvp); pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 1, &context->pipe_data.cb1_swvp); pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 2, &context->pipe_data.cb2_swvp); @@ -1684,6 +1684,16 @@ nine_context_set_clip_plane(struct NineDevice9 *device, context->changed.ucp = TRUE; } +void +nine_context_set_swvp(struct NineDevice9 *device, + boolean swvp) +{ + struct nine_context *context = &device->context; + + context->swvp = swvp; + context->changed.group |= NINE_STATE_SWVP; +} + #if 0 void diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h index 42d45d959b9..d5cbbd4198b 100644 --- a/src/gallium/state_trackers/nine/nine_state.h +++ b/src/gallium/state_trackers/nine/nine_state.h @@ -299,6 +299,9 @@ struct nine_context { struct nine_ff_state ff; + /* software vertex processing */ + boolean swvp; + uint32_t commit; struct { struct pipe_framebuffer_state fb; @@ -458,6 +461,10 @@ nine_context_set_clip_plane(struct NineDevice9 *device, DWORD Index, const float *pPlane); +void +nine_context_set_swvp(struct NineDevice9 *device, + boolean swvp); + void nine_context_apply_stateblock(struct NineDevice9 *device, const struct nine_state *src); diff --git a/src/gallium/state_trackers/nine/vertexshader9.c b/src/gallium/state_trackers/nine/vertexshader9.c index 947831d3bb4..71a56f4c6a2 100644 --- a/src/gallium/state_trackers/nine/vertexshader9.c +++ b/src/gallium/state_trackers/nine/vertexshader9.c @@ -194,7 +194,7 @@ NineVertexShader9_GetVariant( struct NineVertexShader9 *This ) info.fog_enable = device->context.rs[D3DRS_FOGENABLE]; info.point_size_min = asfloat(device->context.rs[D3DRS_POINTSIZE_MIN]); info.point_size_max = asfloat(device->context.rs[D3DRS_POINTSIZE_MAX]); - info.swvp_on = device->swvp; + info.swvp_on = device->context.swvp; info.process_vertices = false; hr = nine_translate_shader(This->base.device, &info, pipe); diff --git a/src/gallium/state_trackers/nine/vertexshader9.h b/src/gallium/state_trackers/nine/vertexshader9.h index a912d4628b4..888f1de35be 100644 --- a/src/gallium/state_trackers/nine/vertexshader9.h +++ b/src/gallium/state_trackers/nine/vertexshader9.h @@ -91,7 +91,7 @@ NineVertexShader9_UpdateKey( struct NineVertexShader9 *vs, if (vs->byte_code.version < 0x30) key |= (uint32_t) ((!!context->rs[D3DRS_FOGENABLE]) << 8); - key |= (uint32_t) (device->swvp << 9); + key |= (uint32_t) (context->swvp << 9); /* We want to use a 64 bits key for performance. * Use compressed float16 values for the pointsize min/max in the key. -- 2.30.2