diff options
author | Axel Davy <[email protected]> | 2015-01-02 14:22:17 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-01-23 00:47:26 +0000 |
commit | 69c7cf70e758d1f2297b3487d72c78390aefe031 (patch) | |
tree | 952d5862f0fd0299f85606839dd0d91c5d902fc8 /src | |
parent | 4d04fd08717216df67e8e7b484f4ef9281fc115c (diff) |
st/nine: Add variables containing the size of the constant buffers
Reviewed-by: Tiziano Bacocco <[email protected]>
Signed-off-by: Axel Davy <[email protected]>
Cc: "10.4" <[email protected]>
(cherry picked from commit b9cbea9dbc75630061236c9858cbc0e2b5b18974)
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/nine/device9.c | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/device9.h | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/stateblock9.c | 4 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 7fe1d14594c..cb10531b0c7 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -109,7 +109,7 @@ NineDevice9_RestoreNonCSOState( struct NineDevice9 *This, unsigned mask ) cb.buffer = This->constbuf_vs; cb.user_buffer = NULL; } - cb.buffer_size = This->constbuf_vs->width0; + cb.buffer_size = This->vs_const_size; pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, &cb); if (This->prefer_user_constbuf) { @@ -117,7 +117,7 @@ NineDevice9_RestoreNonCSOState( struct NineDevice9 *This, unsigned mask ) } else { cb.buffer = This->constbuf_ps; } - cb.buffer_size = This->constbuf_ps->width0; + cb.buffer_size = This->ps_const_size; pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, &cb); } @@ -262,6 +262,8 @@ NineDevice9_ctor( struct NineDevice9 *This, This->max_ps_const_f = max_const_ps - (NINE_MAX_CONST_I + NINE_MAX_CONST_B / 4); + 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])); @@ -283,10 +285,10 @@ NineDevice9_ctor( struct NineDevice9 *This, tmpl.bind = PIPE_BIND_CONSTANT_BUFFER; tmpl.flags = 0; - tmpl.width0 = max_const_vs * sizeof(float[4]); + tmpl.width0 = This->vs_const_size; This->constbuf_vs = pScreen->resource_create(pScreen, &tmpl); - tmpl.width0 = max_const_ps * sizeof(float[4]); + tmpl.width0 = This->ps_const_size; This->constbuf_ps = pScreen->resource_create(pScreen, &tmpl); if (!This->constbuf_vs || !This->constbuf_ps) diff --git a/src/gallium/state_trackers/nine/device9.h b/src/gallium/state_trackers/nine/device9.h index 9deea2c5427..dc97ae7161d 100644 --- a/src/gallium/state_trackers/nine/device9.h +++ b/src/gallium/state_trackers/nine/device9.h @@ -77,6 +77,8 @@ struct NineDevice9 struct pipe_resource *constbuf_vs; struct pipe_resource *constbuf_ps; + uint16_t vs_const_size; + uint16_t ps_const_size; uint16_t max_vs_const_f; uint16_t max_ps_const_f; diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c index cb096c7fc1a..caa968e3464 100644 --- a/src/gallium/state_trackers/nine/stateblock9.c +++ b/src/gallium/state_trackers/nine/stateblock9.c @@ -43,8 +43,8 @@ NineStateBlock9_ctor( struct NineStateBlock9 *This, This->type = type; - This->state.vs_const_f = MALLOC(pParams->device->constbuf_vs->width0); - This->state.ps_const_f = MALLOC(pParams->device->constbuf_ps->width0); + 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) return E_OUTOFMEMORY; |