diff options
author | Rob Clark <[email protected]> | 2014-10-14 12:20:54 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2014-10-15 15:49:48 -0400 |
commit | d5d80b37392c7f15c4fb39b6b1826230239930fd (patch) | |
tree | a70ad7ceaea741ea2040996759c7d982fb875011 /src/gallium/drivers/freedreno/a3xx/fd3_context.c | |
parent | 57de9bbb632ed7639d07d37965dcee5a1fe3bf30 (diff) |
freedreno/a3xx: refactor vertex state emit
Get rid of fd3_vertex_buf and use fd_vertex_state directly for all
draws. Removes a tiny bit of CPU overhead for munging around the vertex
state every time it is emitted, but more importantly it cleans things up
for later optimizations, so the emit paths don't have to special case
internal draws (gmem<->mem, clears, etc) with regular draws.
Instead of constructing fd3_vertex_buf array each time for internal
draws, and context init time pre-create solid_vbuf_state and
blit_vbuf_state.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a3xx/fd3_context.c')
-rw-r--r-- | src/gallium/drivers/freedreno/a3xx/fd3_context.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_context.c b/src/gallium/drivers/freedreno/a3xx/fd3_context.c index f8f412e1a1b..4e3b5038bed 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_context.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_context.c @@ -49,6 +49,9 @@ fd3_context_destroy(struct pipe_context *pctx) fd_bo_del(fd3_ctx->fs_pvt_mem); fd_bo_del(fd3_ctx->vsc_size_mem); + pctx->delete_vertex_elements_state(pctx, fd3_ctx->solid_vbuf_state.vtx); + pctx->delete_vertex_elements_state(pctx, fd3_ctx->blit_vbuf_state.vtx); + pipe_resource_reference(&fd3_ctx->solid_vbuf, NULL); pipe_resource_reference(&fd3_ctx->blit_texcoord_vbuf, NULL); @@ -135,6 +138,34 @@ fd3_context_create(struct pipe_screen *pscreen, void *priv) fd3_ctx->solid_vbuf = create_solid_vertexbuf(pctx); fd3_ctx->blit_texcoord_vbuf = create_blit_texcoord_vertexbuf(pctx); + /* setup solid_vbuf_state: */ + fd3_ctx->solid_vbuf_state.vtx = pctx->create_vertex_elements_state( + pctx, 1, (struct pipe_vertex_element[]){{ + .vertex_buffer_index = 0, + .src_offset = 0, + .src_format = PIPE_FORMAT_R32G32B32_FLOAT, + }}); + fd3_ctx->solid_vbuf_state.vertexbuf.count = 1; + fd3_ctx->solid_vbuf_state.vertexbuf.vb[0].stride = 12; + fd3_ctx->solid_vbuf_state.vertexbuf.vb[0].buffer = fd3_ctx->solid_vbuf; + + /* setup blit_vbuf_state: */ + fd3_ctx->blit_vbuf_state.vtx = pctx->create_vertex_elements_state( + pctx, 2, (struct pipe_vertex_element[]){{ + .vertex_buffer_index = 0, + .src_offset = 0, + .src_format = PIPE_FORMAT_R32G32_FLOAT, + }, { + .vertex_buffer_index = 1, + .src_offset = 0, + .src_format = PIPE_FORMAT_R32G32B32_FLOAT, + }}); + fd3_ctx->blit_vbuf_state.vertexbuf.count = 2; + fd3_ctx->blit_vbuf_state.vertexbuf.vb[0].stride = 8; + fd3_ctx->blit_vbuf_state.vertexbuf.vb[0].buffer = fd3_ctx->blit_texcoord_vbuf; + fd3_ctx->blit_vbuf_state.vertexbuf.vb[1].stride = 12; + fd3_ctx->blit_vbuf_state.vertexbuf.vb[1].buffer = fd3_ctx->solid_vbuf; + fd3_query_context_init(pctx); fd3_ctx->border_color_uploader = u_upload_create(pctx, 4096, |