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:
Marek Olšák
2024-02-01 12:58:20 -05:00
committed by Marge Bot
parent 0ee35cc443
commit e271d342a4
6 changed files with 9 additions and 8 deletions

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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,

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */