diff options
-rw-r--r-- | src/gallium/drivers/v3d/v3d_context.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/v3d/v3dx_draw.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/v3d/v3dx_state.c | 14 |
3 files changed, 12 insertions, 8 deletions
diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h index ab4756aa76f..6ffe09a9c1a 100644 --- a/src/gallium/drivers/v3d/v3d_context.h +++ b/src/gallium/drivers/v3d/v3d_context.h @@ -186,7 +186,8 @@ struct v3d_vertex_stateobj { unsigned num_elements; uint8_t attrs[16 * VC5_MAX_ATTRIBUTES]; - struct v3d_bo *default_attribute_values; + struct pipe_resource *defaults; + uint32_t defaults_offset; }; struct v3d_streamout_stateobj { diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c index 2016db7fa81..051907f1250 100644 --- a/src/gallium/drivers/v3d/v3dx_draw.c +++ b/src/gallium/drivers/v3d/v3dx_draw.c @@ -265,7 +265,8 @@ v3d_emit_gl_shader_state(struct v3d_context *v3d, v3d->prog.vs->prog_data.vs->uses_iid; shader.address_of_default_attribute_values = - cl_address(vtx->default_attribute_values, 0); + cl_address(v3d_resource(vtx->defaults)->bo, + vtx->defaults_offset); } for (int i = 0; i < vtx->num_elements; i++) { diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c index b20a32df67e..75c81f099dd 100644 --- a/src/gallium/drivers/v3d/v3dx_state.c +++ b/src/gallium/drivers/v3d/v3dx_state.c @@ -30,6 +30,7 @@ #include "util/u_memory.h" #include "util/u_half.h" #include "util/u_helpers.h" +#include "util/u_upload_mgr.h" #include "v3d_context.h" #include "v3d_tiling.h" @@ -404,11 +405,11 @@ v3d_vertex_state_create(struct pipe_context *pctx, unsigned num_elements, /* Set up the default attribute values in case any of the vertex * elements use them. */ - so->default_attribute_values = v3d_bo_alloc(v3d->screen, - VC5_MAX_ATTRIBUTES * - 4 * sizeof(float), - "default_attributes"); - uint32_t *attrs = v3d_bo_map(so->default_attribute_values); + uint32_t *attrs; + u_upload_alloc(v3d->state_uploader, 0, + VC5_MAX_ATTRIBUTES * 4 * sizeof(float), 16, + &so->defaults_offset, &so->defaults, (void **)&attrs); + for (int i = 0; i < VC5_MAX_ATTRIBUTES; i++) { attrs[i * 4 + 0] = 0; attrs[i * 4 + 1] = 0; @@ -421,6 +422,7 @@ v3d_vertex_state_create(struct pipe_context *pctx, unsigned num_elements, } } + u_upload_unmap(v3d->state_uploader); return so; } @@ -429,7 +431,7 @@ v3d_vertex_state_delete(struct pipe_context *pctx, void *hwcso) { struct v3d_vertex_stateobj *so = hwcso; - v3d_bo_unreference(&so->default_attribute_values); + pipe_resource_reference(&so->defaults, NULL); free(so); } |