summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/auxiliary/util/u_draw_quad.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2018-10-23 06:36:00 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2018-10-23 06:36:00 +0000
commitb65fcab046d3a1b6b6ac315720df220925c5322e (patch)
treeff73dcc383ac0799c655ff6194cda9dacb75dde9 /lib/mesa/src/gallium/auxiliary/util/u_draw_quad.c
parent18d6381c51e253e4c41c62619f80d9ce745b95c8 (diff)
Merge Mesa 17.3.9
Mesa 18.x needs an ld with build-id for at least the intel code Mesa 18.2 assumes linux only memfd syscalls in intel code Tested by matthieu@, kettenis@ and myself on a variety of hardware and architectures. ok kettenis@
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/util/u_draw_quad.c')
-rw-r--r--lib/mesa/src/gallium/auxiliary/util/u_draw_quad.c71
1 files changed, 3 insertions, 68 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/util/u_draw_quad.c b/lib/mesa/src/gallium/auxiliary/util/u_draw_quad.c
index fa442aff3..fe9558e6c 100644
--- a/lib/mesa/src/gallium/auxiliary/util/u_draw_quad.c
+++ b/lib/mesa/src/gallium/auxiliary/util/u_draw_quad.c
@@ -54,7 +54,7 @@ util_draw_vertex_buffer(struct pipe_context *pipe,
/* tell pipe about the vertex buffer */
memset(&vbuffer, 0, sizeof(vbuffer));
- vbuffer.buffer = vbuf;
+ vbuffer.buffer.resource = vbuf;
vbuffer.stride = num_attribs * 4 * sizeof(float); /* vertex size */
vbuffer.buffer_offset = offset;
@@ -82,7 +82,8 @@ util_draw_user_vertex_buffer(struct cso_context *cso, void *buffer,
assert(num_attribs <= PIPE_MAX_ATTRIBS);
- vbuffer.user_buffer = buffer;
+ vbuffer.is_user_buffer = true;
+ vbuffer.buffer.user = buffer;
vbuffer.stride = num_attribs * 4 * sizeof(float); /* vertex size */
/* note: vertex elements already set by caller */
@@ -90,69 +91,3 @@ util_draw_user_vertex_buffer(struct cso_context *cso, void *buffer,
cso_set_vertex_buffers(cso, 0, 1, &vbuffer);
cso_draw_arrays(cso, prim_type, 0, num_verts);
}
-
-
-/**
- * Draw screen-aligned textured quad.
- * Note: this isn't especially efficient.
- */
-void
-util_draw_texquad(struct pipe_context *pipe, struct cso_context *cso,
- uint vbuf_slot,
- float x0, float y0, float x1, float y1, float z)
-{
- uint numAttribs = 2, i, j;
- uint vertexBytes = 4 * (4 * numAttribs * sizeof(float));
- struct pipe_resource *vbuf = NULL;
- float *v = NULL;
-
- v = MALLOC(vertexBytes);
- if (!v)
- goto out;
-
- /*
- * Load vertex buffer
- */
- for (i = j = 0; i < 4; i++) {
- v[j + 2] = z; /* z */
- v[j + 3] = 1.0; /* w */
- v[j + 6] = 0.0; /* r */
- v[j + 7] = 1.0; /* q */
- j += 8;
- }
-
- v[0] = x0;
- v[1] = y0;
- v[4] = 0.0; /*s*/
- v[5] = 0.0; /*t*/
-
- v[8] = x1;
- v[9] = y0;
- v[12] = 1.0;
- v[13] = 0.0;
-
- v[16] = x1;
- v[17] = y1;
- v[20] = 1.0;
- v[21] = 1.0;
-
- v[24] = x0;
- v[25] = y1;
- v[28] = 0.0;
- v[29] = 1.0;
-
- vbuf = pipe_buffer_create(pipe->screen, PIPE_BIND_VERTEX_BUFFER,
- PIPE_USAGE_STAGING, vertexBytes);
- if (!vbuf)
- goto out;
- pipe_buffer_write(pipe, vbuf, 0, vertexBytes, v);
-
- util_draw_vertex_buffer(pipe, cso, vbuf, vbuf_slot, 0,
- PIPE_PRIM_TRIANGLE_FAN, 4, 2);
-
-out:
- if (vbuf)
- pipe_resource_reference(&vbuf, NULL);
-
- FREE(v);
-}