diff options
author | Marek Olšák <[email protected]> | 2017-10-05 01:48:51 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-10-07 18:26:35 +0200 |
commit | 387590accb267fab57935b7118e998acc2117eef (patch) | |
tree | 0785e1e543e86e2f20de28bd82c8fe3082e9ce52 /src/gallium/drivers/radeon | |
parent | de810f8b84b698e12458c8d793e8f10fead893a4 (diff) |
radeonsi: move si_draw_rectangle into si_state_draw.c
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.c | 83 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.h | 5 |
2 files changed, 0 insertions, 88 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index fd4e2c18ef0..d05f8688d66 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -202,89 +202,6 @@ void si_gfx_wait_fence(struct r600_common_context *ctx, radeon_emit(cs, 4); /* poll interval */ } -void si_draw_rectangle(struct blitter_context *blitter, - int x1, int y1, int x2, int y2, - float depth, unsigned num_instances, - enum blitter_attrib_type type, - const union blitter_attrib *attrib) -{ - struct r600_common_context *rctx = - (struct r600_common_context*)util_blitter_get_pipe(blitter); - struct pipe_viewport_state viewport; - struct pipe_resource *buf = NULL; - unsigned offset = 0; - float *vb; - - /* Some operations (like color resolve on r6xx) don't work - * with the conventional primitive types. - * One that works is PT_RECTLIST, which we use here. */ - - /* setup viewport */ - viewport.scale[0] = 1.0f; - viewport.scale[1] = 1.0f; - viewport.scale[2] = 1.0f; - viewport.translate[0] = 0.0f; - viewport.translate[1] = 0.0f; - viewport.translate[2] = 0.0f; - rctx->b.set_viewport_states(&rctx->b, 0, 1, &viewport); - - /* Upload vertices. The hw rectangle has only 3 vertices, - * The 4th one is derived from the first 3. - * The vertex specification should match u_blitter's vertex element state. */ - u_upload_alloc(rctx->b.stream_uploader, 0, sizeof(float) * 24, - rctx->screen->info.tcc_cache_line_size, - &offset, &buf, (void**)&vb); - if (!buf) - return; - - vb[0] = x1; - vb[1] = y1; - vb[2] = depth; - vb[3] = 1; - - vb[8] = x1; - vb[9] = y2; - vb[10] = depth; - vb[11] = 1; - - vb[16] = x2; - vb[17] = y1; - vb[18] = depth; - vb[19] = 1; - - switch (type) { - case UTIL_BLITTER_ATTRIB_COLOR: - memcpy(vb+4, attrib->color, sizeof(float)*4); - memcpy(vb+12, attrib->color, sizeof(float)*4); - memcpy(vb+20, attrib->color, sizeof(float)*4); - break; - case UTIL_BLITTER_ATTRIB_TEXCOORD_XYZW: - case UTIL_BLITTER_ATTRIB_TEXCOORD_XY: - vb[6] = vb[14] = vb[22] = attrib->texcoord.z; - vb[7] = vb[15] = vb[23] = attrib->texcoord.w; - /* fall through */ - vb[4] = attrib->texcoord.x1; - vb[5] = attrib->texcoord.y1; - vb[12] = attrib->texcoord.x1; - vb[13] = attrib->texcoord.y2; - vb[20] = attrib->texcoord.x2; - vb[21] = attrib->texcoord.y1; - break; - default:; /* Nothing to do. */ - } - - /* draw */ - struct pipe_vertex_buffer vbuffer = {}; - vbuffer.buffer.resource = buf; - vbuffer.stride = 2 * 4 * sizeof(float); /* vertex size */ - vbuffer.buffer_offset = offset; - - rctx->b.set_vertex_buffers(&rctx->b, blitter->vb_slot, 1, &vbuffer); - util_draw_arrays_instanced(&rctx->b, R600_PRIM_RECTANGLE_LIST, 0, 3, - 0, num_instances); - pipe_resource_reference(&buf, NULL); -} - static void r600_dma_emit_wait_idle(struct r600_common_context *rctx) { struct radeon_winsys_cs *cs = rctx->dma.cs; diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index 85307983c10..ec259c27380 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -736,11 +736,6 @@ void si_gfx_write_event_eop(struct r600_common_context *ctx, unsigned si_gfx_write_fence_dwords(struct r600_common_screen *screen); void si_gfx_wait_fence(struct r600_common_context *ctx, uint64_t va, uint32_t ref, uint32_t mask); -void si_draw_rectangle(struct blitter_context *blitter, - int x1, int y1, int x2, int y2, - float depth, unsigned num_instances, - enum blitter_attrib_type type, - const union blitter_attrib *attrib); bool si_common_screen_init(struct r600_common_screen *rscreen, struct radeon_winsys *ws); void si_destroy_common_screen(struct r600_common_screen *rscreen); |