diff options
author | Eric Anholt <[email protected]> | 2018-12-07 12:36:55 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2018-12-07 16:48:23 -0800 |
commit | e94d034a38b9993d0ea898dec550cf52541da8f1 (patch) | |
tree | 6293930a0d85b832fd97fced2fe7974c27ee0806 /src/gallium/drivers/v3d/v3dx_state.c | |
parent | b38e4d313fc27a225a36c42f84b2bee9933e62e6 (diff) |
v3d: Put default vertex attribute values into the state uploader as well.
The default attributes are long-lived (the state struct is cached), and
only 256 bytes each.
Diffstat (limited to 'src/gallium/drivers/v3d/v3dx_state.c')
-rw-r--r-- | src/gallium/drivers/v3d/v3dx_state.c | 14 |
1 files changed, 8 insertions, 6 deletions
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); } |