diff options
author | Axel Davy <[email protected]> | 2015-01-02 14:38:01 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-01-23 00:47:26 +0000 |
commit | 4c9b64fc4436b77cd674a81bc2eb7dcc7df39348 (patch) | |
tree | 5bd60d2e33c835adcf71ba384673dd020d062bda /src | |
parent | 69c7cf70e758d1f2297b3487d72c78390aefe031 (diff) |
st/nine: Allocate the correct size for the user constant buffer
Reviewed-by: Ilia Mirkin <[email protected]>
Signed-off-by: Axel Davy <[email protected]>
Cc: "10.4" <[email protected]>
(cherry picked from commit e0f75044c8d2793b6a5bd9832c57c5d199822486)
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/nine/device9.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.c | 7 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.h | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index cb10531b0c7..c49d9592447 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -62,7 +62,7 @@ NineDevice9_SetDefaultState( struct NineDevice9 *This, boolean is_reset ) assert(!This->is_recording); - nine_state_set_defaults(&This->state, &This->caps, is_reset); + nine_state_set_defaults(This, &This->caps, is_reset); This->state.viewport.X = 0; This->state.viewport.Y = 0; @@ -265,8 +265,8 @@ NineDevice9_ctor( struct NineDevice9 *This, This->vs_const_size = max_const_vs * sizeof(float[4]); This->ps_const_size = max_const_ps * sizeof(float[4]); /* Include space for I,B constants for user constbuf. */ - This->state.vs_const_f = CALLOC(NINE_MAX_CONST_ALL, sizeof(float[4])); - This->state.ps_const_f = CALLOC(NINE_MAX_CONST_ALL, sizeof(float[4])); + This->state.vs_const_f = CALLOC(This->vs_const_size, 1); + This->state.ps_const_f = CALLOC(This->ps_const_size, 1); if (!This->state.vs_const_f || !This->state.ps_const_f) return E_OUTOFMEMORY; diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index e5c9a36b783..476bc8cc96b 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -997,9 +997,10 @@ static const DWORD nine_samp_state_defaults[NINED3DSAMP_LAST + 1] = [NINED3DSAMP_SHADOW] = 0 }; void -nine_state_set_defaults(struct nine_state *state, const D3DCAPS9 *caps, +nine_state_set_defaults(struct NineDevice9 *device, const D3DCAPS9 *caps, boolean is_reset) { + struct nine_state *state = &device->state; unsigned s; /* Initialize defaults. @@ -1020,9 +1021,9 @@ nine_state_set_defaults(struct nine_state *state, const D3DCAPS9 *caps, } if (state->vs_const_f) - memset(state->vs_const_f, 0, NINE_MAX_CONST_F * 4 * sizeof(float)); + memset(state->vs_const_f, 0, device->vs_const_size); if (state->ps_const_f) - memset(state->ps_const_f, 0, NINE_MAX_CONST_F * 4 * sizeof(float)); + memset(state->ps_const_f, 0, device->ps_const_size); /* Cap dependent initial state: */ diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h index 3e0162c9dfc..742c6f67425 100644 --- a/src/gallium/state_trackers/nine/nine_state.h +++ b/src/gallium/state_trackers/nine/nine_state.h @@ -218,7 +218,7 @@ struct NineDevice9; boolean nine_update_state(struct NineDevice9 *, uint32_t group_mask); -void nine_state_set_defaults(struct nine_state *, const D3DCAPS9 *, +void nine_state_set_defaults(struct NineDevice9 *, const D3DCAPS9 *, boolean is_reset); void nine_state_clear(struct nine_state *, const boolean device); |