mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-05 08:00:30 +01:00
gallium/util: add take_ownership parameter into util_draw_vertex_buffer
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27492>
This commit is contained in:
parent
0ee35cc443
commit
e271d342a4
6 changed files with 9 additions and 8 deletions
|
|
@ -293,7 +293,7 @@ pp_filter_misc_state(struct pp_program *p)
|
|||
void
|
||||
pp_filter_draw(struct pp_program *p)
|
||||
{
|
||||
util_draw_vertex_buffer(p->pipe, p->cso, p->vbuf, 0,
|
||||
util_draw_vertex_buffer(p->pipe, p->cso, p->vbuf, 0, false,
|
||||
MESA_PRIM_QUADS, 4, 2);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ util_draw_vertex_buffer(struct pipe_context *pipe,
|
|||
struct cso_context *cso,
|
||||
struct pipe_resource *vbuf,
|
||||
unsigned offset,
|
||||
bool vb_take_ownership,
|
||||
enum mesa_prim prim_type,
|
||||
unsigned num_verts,
|
||||
unsigned num_attribs)
|
||||
|
|
@ -59,10 +60,10 @@ util_draw_vertex_buffer(struct pipe_context *pipe,
|
|||
/* note: vertex elements already set by caller */
|
||||
|
||||
if (cso) {
|
||||
cso_set_vertex_buffers(cso, 1, false, &vbuffer);
|
||||
cso_set_vertex_buffers(cso, 1, vb_take_ownership, &vbuffer);
|
||||
cso_draw_arrays(cso, prim_type, 0, num_verts);
|
||||
} else {
|
||||
pipe->set_vertex_buffers(pipe, 1, false, &vbuffer);
|
||||
pipe->set_vertex_buffers(pipe, 1, vb_take_ownership, &vbuffer);
|
||||
util_draw_arrays(pipe, prim_type, 0, num_verts);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ struct cso_velems_state;
|
|||
extern void
|
||||
util_draw_vertex_buffer(struct pipe_context *pipe, struct cso_context *cso,
|
||||
struct pipe_resource *vbuf, unsigned offset,
|
||||
enum mesa_prim prim_type, unsigned num_attribs,
|
||||
unsigned num_verts);
|
||||
bool vb_take_ownership, enum mesa_prim prim_type,
|
||||
unsigned num_attribs, unsigned num_verts);
|
||||
|
||||
void
|
||||
util_draw_user_vertex_buffer(struct cso_context *cso, void *buffer,
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ static void draw(struct program *p)
|
|||
cso_set_vertex_elements(p->cso, &p->velem);
|
||||
|
||||
util_draw_vertex_buffer(p->pipe, p->cso,
|
||||
p->vbuf, 0,
|
||||
p->vbuf, 0, false,
|
||||
MESA_PRIM_QUADS,
|
||||
4, /* verts */
|
||||
2); /* attribs/vert */
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ static void draw(struct program *p)
|
|||
cso_set_vertex_elements(p->cso, &p->velem);
|
||||
|
||||
util_draw_vertex_buffer(p->pipe, p->cso,
|
||||
p->vbuf, 0,
|
||||
p->vbuf, 0, false,
|
||||
MESA_PRIM_TRIANGLES,
|
||||
3, /* verts */
|
||||
2); /* attribs/vert */
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
|
|||
}
|
||||
|
||||
util_draw_vertex_buffer(pipe, cso, vbuffer,
|
||||
offset, /* offset */
|
||||
offset, false,
|
||||
MESA_PRIM_TRIANGLE_FAN,
|
||||
4, /* verts */
|
||||
numAttribs); /* attribs/vert */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue