summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/stateblock9.c
diff options
context:
space:
mode:
authorAxel Davy <axel.davy@ens.fr>2016-10-04 19:45:40 +0200
committerAxel Davy <axel.davy@ens.fr>2016-10-10 23:43:49 +0200
commitf8c8f4424405c4789a044470e64df810720358c8 (patch)
tree99abbff56842e37643fb3df1a44fbfa995d81b77 /src/gallium/state_trackers/nine/stateblock9.c
parenta83dce01284f220b1bf932774730e13fca6cdd20 (diff)
downloadexternal_mesa3d-f8c8f4424405c4789a044470e64df810720358c8.zip
external_mesa3d-f8c8f4424405c4789a044470e64df810720358c8.tar.gz
external_mesa3d-f8c8f4424405c4789a044470e64df810720358c8.tar.bz2
st/nine: Rework vs int and bool constants buffer
This will help to support swvp constants. Signed-off-by: Axel Davy <axel.davy@ens.fr>
Diffstat (limited to 'src/gallium/state_trackers/nine/stateblock9.c')
-rw-r--r--src/gallium/state_trackers/nine/stateblock9.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c
index 7ba19e7..19c3766 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -30,6 +30,9 @@
/* XXX TODO: handling of lights is broken */
+#define VS_CONST_I_SIZE (NINE_MAX_CONST_I * sizeof(int[4]))
+#define VS_CONST_B_SIZE (NINE_MAX_CONST_B * sizeof(BOOL))
+
HRESULT
NineStateBlock9_ctor( struct NineStateBlock9 *This,
struct NineUnknownParams *pParams,
@@ -46,7 +49,10 @@ NineStateBlock9_ctor( struct NineStateBlock9 *This,
This->state.vs_const_f = MALLOC(This->base.device->vs_const_size);
This->state.ps_const_f = MALLOC(This->base.device->ps_const_size);
- if (!This->state.vs_const_f || !This->state.ps_const_f)
+ This->state.vs_const_i = MALLOC(VS_CONST_I_SIZE);
+ This->state.vs_const_b = MALLOC(VS_CONST_B_SIZE);
+ if (!This->state.vs_const_f || !This->state.ps_const_f ||
+ !This->state.vs_const_i || !This->state.vs_const_b)
return E_OUTOFMEMORY;
return D3D_OK;
@@ -63,6 +69,8 @@ NineStateBlock9_dtor( struct NineStateBlock9 *This )
FREE(state->vs_const_f);
FREE(state->ps_const_f);
+ FREE(state->vs_const_i);
+ FREE(state->vs_const_b);
FREE(state->ff.light);
@@ -131,8 +139,8 @@ nine_state_copy_common(struct nine_state *dst,
pool);
}
for (r = mask->changed.vs_const_i; r; r = r->next) {
- memcpy(&dst->vs_const_i[r->bgn],
- &src->vs_const_i[r->bgn],
+ memcpy(&dst->vs_const_i[r->bgn * 4],
+ &src->vs_const_i[r->bgn * 4],
(r->end - r->bgn) * 4 * sizeof(int));
if (apply)
nine_ranges_insert(&dst->changed.vs_const_i, r->bgn, r->end,
@@ -365,8 +373,8 @@ nine_state_copy_common_all(struct nine_state *dst,
if (apply)
nine_ranges_insert(&dst->changed.vs_const_f, r->bgn, r->end, pool);
- memcpy(dst->vs_const_i, src->vs_const_i, sizeof(dst->vs_const_i));
- memcpy(dst->vs_const_b, src->vs_const_b, sizeof(dst->vs_const_b));
+ memcpy(dst->vs_const_i, src->vs_const_i, VS_CONST_I_SIZE);
+ memcpy(dst->vs_const_b, src->vs_const_b, VS_CONST_B_SIZE);
if (apply) {
r = help->changed.vs_const_i;
nine_ranges_insert(&dst->changed.vs_const_i, r->bgn, r->end, pool);