This->state.ps_const_f = CALLOC(This->ps_const_size, 1);
This->state.vs_lconstf_temp = CALLOC(This->vs_const_size,1);
This->state.ps_lconstf_temp = CALLOC(This->ps_const_size,1);
+ This->state.vs_const_i = CALLOC(NINE_MAX_CONST_I * sizeof(int[4]), 1);
+ This->state.vs_const_b = CALLOC(NINE_MAX_CONST_B * sizeof(BOOL), 1);
if (!This->state.vs_const_f || !This->state.ps_const_f ||
- !This->state.vs_lconstf_temp || !This->state.ps_lconstf_temp)
+ !This->state.vs_lconstf_temp || !This->state.ps_lconstf_temp ||
+ !This->state.vs_const_i || !This->state.vs_const_b)
return E_OUTOFMEMORY;
if (strstr(pScreen->get_name(pScreen), "AMD") ||
FREE(This->state.ps_const_f);
FREE(This->state.vs_lconstf_temp);
FREE(This->state.ps_lconstf_temp);
+ FREE(This->state.vs_const_i);
+ FREE(This->state.vs_const_b);
if (This->swapchains) {
for (i = 0; i < This->nswapchains; ++i)
if (This->driver_caps.vs_integer) {
if (!This->is_recording) {
- if (!memcmp(&state->vs_const_i[StartRegister][0], pConstantData,
- Vector4iCount * sizeof(state->vs_const_i[0])))
+ if (!memcmp(&state->vs_const_i[4 * StartRegister], pConstantData,
+ Vector4iCount * sizeof(int[4])))
return D3D_OK;
}
- memcpy(&state->vs_const_i[StartRegister][0],
+ memcpy(&state->vs_const_i[4 * StartRegister],
pConstantData,
- Vector4iCount * sizeof(state->vs_const_i[0]));
+ Vector4iCount * sizeof(int[4]));
} else {
for (i = 0; i < Vector4iCount; i++) {
- state->vs_const_i[StartRegister+i][0] = fui((float)(pConstantData[4*i]));
- state->vs_const_i[StartRegister+i][1] = fui((float)(pConstantData[4*i+1]));
- state->vs_const_i[StartRegister+i][2] = fui((float)(pConstantData[4*i+2]));
- state->vs_const_i[StartRegister+i][3] = fui((float)(pConstantData[4*i+3]));
+ state->vs_const_i[4 * (StartRegister + i)] = fui((float)(pConstantData[4 * i]));
+ state->vs_const_i[4 * (StartRegister + i) + 1] = fui((float)(pConstantData[4 * i + 1]));
+ state->vs_const_i[4 * (StartRegister + i) + 2] = fui((float)(pConstantData[4 * i + 2]));
+ state->vs_const_i[4 * (StartRegister + i) + 3] = fui((float)(pConstantData[4 * i + 3]));
}
}
if (This->driver_caps.vs_integer) {
memcpy(pConstantData,
- &state->vs_const_i[StartRegister][0],
- Vector4iCount * sizeof(state->vs_const_i[0]));
+ &state->vs_const_i[4 * StartRegister],
+ Vector4iCount * sizeof(int[4]));
} else {
for (i = 0; i < Vector4iCount; i++) {
- pConstantData[4*i] = (int32_t) uif(state->vs_const_i[StartRegister+i][0]);
- pConstantData[4*i+1] = (int32_t) uif(state->vs_const_i[StartRegister+i][1]);
- pConstantData[4*i+2] = (int32_t) uif(state->vs_const_i[StartRegister+i][2]);
- pConstantData[4*i+3] = (int32_t) uif(state->vs_const_i[StartRegister+i][3]);
+ pConstantData[4 * i] = (int32_t) uif(state->vs_const_i[4 * (StartRegister + i)]);
+ pConstantData[4 * i + 1] = (int32_t) uif(state->vs_const_i[4 * (StartRegister + i) + 1]);
+ pConstantData[4 * i + 2] = (int32_t) uif(state->vs_const_i[4 * (StartRegister + i) + 2]);
+ pConstantData[4 * i + 3] = (int32_t) uif(state->vs_const_i[4 * (StartRegister + i) + 3]);
}
}
if (state->changed.vs_const_i) {
int *idst = (int *)&state->vs_const_f[4 * device->max_vs_const_f];
- memcpy(idst, state->vs_const_i, sizeof(state->vs_const_i));
+ memcpy(idst, state->vs_const_i, NINE_MAX_CONST_I * sizeof(int[4]));
state->changed.vs_const_i = 0;
}
if (state->changed.vs_const_b) {
int *idst = (int *)&state->vs_const_f[4 * device->max_vs_const_f];
uint32_t *bdst = (uint32_t *)&idst[4 * NINE_MAX_CONST_I];
- memcpy(bdst, state->vs_const_b, sizeof(state->vs_const_b));
+ memcpy(bdst, state->vs_const_b, NINE_MAX_CONST_B * sizeof(BOOL));
state->changed.vs_const_b = 0;
}
/* 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,
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;
FREE(state->vs_const_f);
FREE(state->ps_const_f);
+ FREE(state->vs_const_i);
+ FREE(state->vs_const_b);
FREE(state->ff.light);
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,
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);