summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2016-02-16 10:22:31 -0700
committerBrian Paul <[email protected]>2016-02-16 10:22:31 -0700
commitb63fe0552b5f983bc19ab45231687dc684c5a267 (patch)
treebf37d8d66a87796c8d58426bf3ded527c1d8a7fc /src/mesa/state_tracker
parent2b1535f82fc58a61e7837c28a0547a5cbe01e106 (diff)
st/mesa: overhaul vertex setup for clearing, glDrawPixels, glBitmap
Define a new st_util_vertex structure which is a bit smaller (9 floats versus the previous 12 floats per vertex). Clean up the glClear, glDrawPixels and glBitmap code that sets up the vertex data and does the drawing so it's all very similar. This can lead to more consolidation. v2: add assertion that vertex buffer slot == 0 to catch possible future change in cso_get_aux_vertex_buffer_slot() behavior. Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c100
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c69
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c140
-rw-r--r--src/mesa/state_tracker/st_context.c32
-rw-r--r--src/mesa/state_tracker/st_context.h13
5 files changed, 193 insertions, 161 deletions
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 2b2792e2be6..a85c34068ec 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -49,7 +49,6 @@
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_inlines.h"
-#include "util/u_draw_quad.h"
#include "util/u_simple_shaders.h"
#include "util/u_upload_mgr.h"
#include "program/prog_instruction.h"
@@ -282,7 +281,8 @@ setup_render_state(struct gl_context *ctx,
cso_set_viewport(cso, &vp);
}
- cso_set_vertex_elements(cso, 3, st->velems_util_draw);
+ cso_set_vertex_elements(cso, 3, st->util_velems);
+
cso_set_stream_outputs(st->cso_context, 0, NULL, NULL);
}
@@ -322,7 +322,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
- struct pipe_resource *vbuf = NULL;
+ struct pipe_vertex_buffer vb = {0};
const float fb_width = (float) st->state.framebuffer.width;
const float fb_height = (float) st->state.framebuffer.height;
const float x0 = (float) x;
@@ -335,8 +335,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
const float clip_y0 = y0 / fb_height * 2.0f - 1.0f;
const float clip_x1 = x1 / fb_width * 2.0f - 1.0f;
const float clip_y1 = y1 / fb_height * 2.0f - 1.0f;
- float (*vertices)[3][4]; /**< vertex pos + color + texcoord */
- unsigned offset, i;
+ struct st_util_vertex *verts;
/* limit checks */
{
@@ -360,9 +359,11 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
tBot = (float) height;
}
- u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]), 4,
- &offset, &vbuf, (void **) &vertices);
- if (!vbuf) {
+ vb.stride = sizeof(struct st_util_vertex);
+
+ u_upload_alloc(st->uploader, 0, 4 * sizeof(struct st_util_vertex), 4,
+ &vb.buffer_offset, &vb.buffer, (void **) &verts);
+ if (!vb.buffer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBitmap");
restore_render_state(ctx);
return;
@@ -371,50 +372,57 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
/* Positions are in clip coords since we need to do clipping in case
* the bitmap quad goes beyond the window bounds.
*/
- vertices[0][0][0] = clip_x0;
- vertices[0][0][1] = clip_y0;
- vertices[0][2][0] = sLeft;
- vertices[0][2][1] = tTop;
-
- vertices[1][0][0] = clip_x1;
- vertices[1][0][1] = clip_y0;
- vertices[1][2][0] = sRight;
- vertices[1][2][1] = tTop;
-
- vertices[2][0][0] = clip_x1;
- vertices[2][0][1] = clip_y1;
- vertices[2][2][0] = sRight;
- vertices[2][2][1] = tBot;
-
- vertices[3][0][0] = clip_x0;
- vertices[3][0][1] = clip_y1;
- vertices[3][2][0] = sLeft;
- vertices[3][2][1] = tBot;
-
- /* same for all verts: */
- for (i = 0; i < 4; i++) {
- vertices[i][0][2] = z;
- vertices[i][0][3] = 1.0f;
- vertices[i][1][0] = color[0];
- vertices[i][1][1] = color[1];
- vertices[i][1][2] = color[2];
- vertices[i][1][3] = color[3];
- vertices[i][2][2] = 0.0; /*R*/
- vertices[i][2][3] = 1.0; /*Q*/
- }
+ verts[0].x = clip_x0;
+ verts[0].y = clip_y0;
+ verts[0].z = z;
+ verts[0].r = color[0];
+ verts[0].g = color[1];
+ verts[0].b = color[2];
+ verts[0].a = color[3];
+ verts[0].s = sLeft;
+ verts[0].t = tTop;
+
+ verts[1].x = clip_x1;
+ verts[1].y = clip_y0;
+ verts[1].z = z;
+ verts[1].r = color[0];
+ verts[1].g = color[1];
+ verts[1].b = color[2];
+ verts[1].a = color[3];
+ verts[1].s = sRight;
+ verts[1].t = tTop;
+
+ verts[2].x = clip_x1;
+ verts[2].y = clip_y1;
+ verts[2].z = z;
+ verts[2].r = color[0];
+ verts[2].g = color[1];
+ verts[2].b = color[2];
+ verts[2].a = color[3];
+ verts[2].s = sRight;
+ verts[2].t = tBot;
+
+ verts[3].x = clip_x0;
+ verts[3].y = clip_y1;
+ verts[3].z = z;
+ verts[3].r = color[0];
+ verts[3].g = color[1];
+ verts[3].b = color[2];
+ verts[3].a = color[3];
+ verts[3].s = sLeft;
+ verts[3].t = tBot;
u_upload_unmap(st->uploader);
- util_draw_vertex_buffer(pipe, st->cso_context, vbuf,
- cso_get_aux_vertex_buffer_slot(st->cso_context),
- offset,
- PIPE_PRIM_TRIANGLE_FAN,
- 4, /* verts */
- 3); /* attribs/vert */
+ cso_set_vertex_buffers(st->cso_context,
+ cso_get_aux_vertex_buffer_slot(st->cso_context),
+ 1, &vb);
+
+ cso_draw_arrays(st->cso_context, PIPE_PRIM_TRIANGLE_FAN, 0, 4);
restore_render_state(ctx);
- pipe_resource_reference(&vbuf, NULL);
+ pipe_resource_reference(&vb.buffer, NULL);
/* We uploaded modified constants, need to invalidate them. */
st->dirty.mesa |= _NEW_PROGRAM_CONSTANTS;
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 1e965b182ea..5c632c0b146 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -55,7 +55,6 @@
#include "util/u_framebuffer.h"
#include "util/u_inlines.h"
#include "util/u_simple_shaders.h"
-#include "util/u_draw_quad.h"
#include "util/u_upload_mgr.h"
#include "cso_cache/cso_context.h"
@@ -180,14 +179,12 @@ draw_quad(struct st_context *st,
{
struct cso_context *cso = st->cso_context;
struct pipe_vertex_buffer vb = {0};
- GLuint i;
- float (*vertices)[2][4]; /**< vertex pos + color */
+ struct st_util_vertex *verts;
- vb.stride = 8 * sizeof(float);
+ vb.stride = sizeof(struct st_util_vertex);
- u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]), 4,
- &vb.buffer_offset, &vb.buffer,
- (void **) &vertices);
+ u_upload_alloc(st->uploader, 0, 4 * sizeof(struct st_util_vertex), 4,
+ &vb.buffer_offset, &vb.buffer, (void **) &verts);
if (!vb.buffer) {
return;
}
@@ -195,28 +192,40 @@ draw_quad(struct st_context *st,
/* Convert Z from [0,1] to [-1,1] range */
z = z * 2.0f - 1.0f;
- /* positions */
- vertices[0][0][0] = x0;
- vertices[0][0][1] = y0;
-
- vertices[1][0][0] = x1;
- vertices[1][0][1] = y0;
-
- vertices[2][0][0] = x1;
- vertices[2][0][1] = y1;
-
- vertices[3][0][0] = x0;
- vertices[3][0][1] = y1;
-
- /* same for all verts: */
- for (i = 0; i < 4; i++) {
- vertices[i][0][2] = z;
- vertices[i][0][3] = 1.0;
- vertices[i][1][0] = color->f[0];
- vertices[i][1][1] = color->f[1];
- vertices[i][1][2] = color->f[2];
- vertices[i][1][3] = color->f[3];
- }
+ /* Note: if we're only clearing depth/stencil we still setup vertices
+ * with color, but they'll be ignored.
+ */
+ verts[0].x = x0;
+ verts[0].y = y0;
+ verts[0].z = z;
+ verts[0].r = color->f[0];
+ verts[0].g = color->f[1];
+ verts[0].b = color->f[2];
+ verts[0].a = color->f[3];
+
+ verts[1].x = x1;
+ verts[1].y = y0;
+ verts[1].z = z;
+ verts[1].r = color->f[0];
+ verts[1].g = color->f[1];
+ verts[1].b = color->f[2];
+ verts[1].a = color->f[3];
+
+ verts[2].x = x1;
+ verts[2].y = y1;
+ verts[2].z = z;
+ verts[2].r = color->f[0];
+ verts[2].g = color->f[1];
+ verts[2].b = color->f[2];
+ verts[2].a = color->f[3];
+
+ verts[3].x = x0;
+ verts[3].y = y1;
+ verts[3].z = z;
+ verts[3].r = color->f[0];
+ verts[3].g = color->f[1];
+ verts[3].b = color->f[2];
+ verts[3].a = color->f[3];
u_upload_unmap(st->uploader);
@@ -331,7 +340,7 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers)
cso_set_depth_stencil_alpha(st->cso_context, &depth_stencil);
}
- cso_set_vertex_elements(st->cso_context, 2, st->velems_util_draw);
+ cso_set_vertex_elements(st->cso_context, 2, st->util_velems);
cso_set_stream_outputs(st->cso_context, 0, NULL, NULL);
cso_set_sample_mask(st->cso_context, ~0);
cso_set_min_samples(st->cso_context, 1);
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index b910d71b735..565a10bc1b2 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -63,7 +63,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "tgsi/tgsi_ureg.h"
-#include "util/u_draw_quad.h"
#include "util/u_format.h"
#include "util/u_inlines.h"
#include "util/u_math.h"
@@ -162,22 +161,22 @@ make_passthrough_vertex_shader(struct st_context *st,
return NULL;
/* MOV result.pos, vertex.pos; */
- ureg_MOV(ureg,
+ ureg_MOV(ureg,
ureg_DECL_output( ureg, TGSI_SEMANTIC_POSITION, 0 ),
ureg_DECL_vs_input( ureg, 0 ));
-
- /* MOV result.texcoord0, vertex.attr[1]; */
- ureg_MOV(ureg,
- ureg_DECL_output( ureg, texcoord_semantic, 0 ),
- ureg_DECL_vs_input( ureg, 1 ));
-
+
if (passColor) {
- /* MOV result.color0, vertex.attr[2]; */
- ureg_MOV(ureg,
+ /* MOV result.color0, vertex.attr[1]; */
+ ureg_MOV(ureg,
ureg_DECL_output( ureg, TGSI_SEMANTIC_COLOR, 0 ),
- ureg_DECL_vs_input( ureg, 2 ));
+ ureg_DECL_vs_input( ureg, 1 ));
}
+ /* MOV result.texcoord0, vertex.attr[2]; */
+ ureg_MOV(ureg,
+ ureg_DECL_output( ureg, texcoord_semantic, 0 ),
+ ureg_DECL_vs_input( ureg, 2 ));
+
ureg_END( ureg );
st->drawpix.vert_shaders[passColor] =
@@ -453,14 +452,14 @@ draw_quad(struct gl_context *ctx, GLfloat x0, GLfloat y0, GLfloat z,
GLboolean invertTex, GLfloat maxXcoord, GLfloat maxYcoord)
{
struct st_context *st = st_context(ctx);
- struct pipe_context *pipe = st->pipe;
- GLfloat (*verts)[3][4]; /* four verts, three attribs, XYZW */
- struct pipe_resource *buf = NULL;
- unsigned offset;
+ struct pipe_vertex_buffer vb = {0};
+ struct st_util_vertex *verts;
+
+ vb.stride = sizeof(struct st_util_vertex);
- u_upload_alloc(st->uploader, 0, 4 * sizeof(verts[0]), 4, &offset,
- &buf, (void **) &verts);
- if (!buf) {
+ u_upload_alloc(st->uploader, 0, 4 * sizeof(struct st_util_vertex), 4,
+ &vb.buffer_offset, &vb.buffer, (void **) &verts);
+ if (!vb.buffer) {
return;
}
@@ -476,64 +475,61 @@ draw_quad(struct gl_context *ctx, GLfloat x0, GLfloat y0, GLfloat z,
const GLfloat sLeft = 0.0f, sRight = maxXcoord;
const GLfloat tTop = invertTex ? maxYcoord : 0.0f;
const GLfloat tBot = invertTex ? 0.0f : maxYcoord;
- GLuint i;
/* upper-left */
- verts[0][0][0] = clip_x0; /* v[0].attr[0].x */
- verts[0][0][1] = clip_y0; /* v[0].attr[0].y */
+ verts[0].x = clip_x0;
+ verts[0].y = clip_y0;
+ verts[0].z = z;
+ verts[0].r = color[0];
+ verts[0].g = color[1];
+ verts[0].b = color[2];
+ verts[0].a = color[3];
+ verts[0].s = sLeft;
+ verts[0].t = tTop;
/* upper-right */
- verts[1][0][0] = clip_x1;
- verts[1][0][1] = clip_y0;
+ verts[1].x = clip_x1;
+ verts[1].y = clip_y0;
+ verts[1].z = z;
+ verts[1].r = color[0];
+ verts[1].g = color[1];
+ verts[1].b = color[2];
+ verts[1].a = color[3];
+ verts[1].s = sRight;
+ verts[1].t = tTop;
/* lower-right */
- verts[2][0][0] = clip_x1;
- verts[2][0][1] = clip_y1;
+ verts[2].x = clip_x1;
+ verts[2].y = clip_y1;
+ verts[2].z = z;
+ verts[2].r = color[0];
+ verts[2].g = color[1];
+ verts[2].b = color[2];
+ verts[2].a = color[3];
+ verts[2].s = sRight;
+ verts[2].t = tBot;
/* lower-left */
- verts[3][0][0] = clip_x0;
- verts[3][0][1] = clip_y1;
-
- verts[0][1][0] = sLeft; /* v[0].attr[1].S */
- verts[0][1][1] = tTop; /* v[0].attr[1].T */
- verts[1][1][0] = sRight;
- verts[1][1][1] = tTop;
- verts[2][1][0] = sRight;
- verts[2][1][1] = tBot;
- verts[3][1][0] = sLeft;
- verts[3][1][1] = tBot;
-
- /* same for all verts: */
- if (color) {
- for (i = 0; i < 4; i++) {
- verts[i][0][2] = z; /* v[i].attr[0].z */
- verts[i][0][3] = 1.0f; /* v[i].attr[0].w */
- verts[i][2][0] = color[0]; /* v[i].attr[2].r */
- verts[i][2][1] = color[1]; /* v[i].attr[2].g */
- verts[i][2][2] = color[2]; /* v[i].attr[2].b */
- verts[i][2][3] = color[3]; /* v[i].attr[2].a */
- verts[i][1][2] = 0.0f; /* v[i].attr[1].R */
- verts[i][1][3] = 1.0f; /* v[i].attr[1].Q */
- }
- }
- else {
- for (i = 0; i < 4; i++) {
- verts[i][0][2] = z; /*Z*/
- verts[i][0][3] = 1.0f; /*W*/
- verts[i][1][2] = 0.0f; /*R*/
- verts[i][1][3] = 1.0f; /*Q*/
- }
- }
+ verts[3].x = clip_x0;
+ verts[3].y = clip_y1;
+ verts[3].z = z;
+ verts[3].r = color[0];
+ verts[3].g = color[1];
+ verts[3].b = color[2];
+ verts[3].a = color[3];
+ verts[3].s = sLeft;
+ verts[3].t = tBot;
}
u_upload_unmap(st->uploader);
- util_draw_vertex_buffer(pipe, st->cso_context, buf,
- cso_get_aux_vertex_buffer_slot(st->cso_context),
- offset,
- PIPE_PRIM_QUADS,
- 4, /* verts */
- 3); /* attribs/vert */
- pipe_resource_reference(&buf, NULL);
+
+ cso_set_vertex_buffers(st->cso_context,
+ cso_get_aux_vertex_buffer_slot(st->cso_context),
+ 1, &vb);
+
+ cso_draw_arrays(st->cso_context, PIPE_PRIM_QUADS, 0, 4);
+
+ pipe_resource_reference(&vb.buffer, NULL);
}
@@ -707,7 +703,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
cso_set_viewport(cso, &vp);
}
- cso_set_vertex_elements(cso, 3, st->velems_util_draw);
+ cso_set_vertex_elements(cso, 3, st->util_velems);
cso_set_stream_outputs(st->cso_context, 0, NULL, NULL);
/* Compute Gallium window coords (y=0=top) with pixel zoom.
@@ -1060,7 +1056,6 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
{
void *driver_vp, *driver_fp;
struct st_context *st = st_context(ctx);
- const GLfloat *color;
struct pipe_context *pipe = st->pipe;
GLboolean write_stencil = GL_FALSE, write_depth = GL_FALSE;
struct pipe_sampler_view *sv[2] = { NULL };
@@ -1106,7 +1101,6 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
driver_fp = get_drawpix_z_stencil_program(st, write_depth,
write_stencil);
driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
- color = ctx->Current.RasterColor;
}
else {
fpv = get_color_fp_variant(st);
@@ -1114,7 +1108,6 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
driver_fp = fpv->driver_shader;
driver_vp = make_passthrough_vertex_shader(st, GL_FALSE);
- color = NULL;
if (ctx->Pixel.MapColorFlag) {
pipe_sampler_view_reference(&sv[1],
st->pixel_xfer.pixelmap_sampler_view);
@@ -1172,7 +1165,8 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
num_sampler_view,
driver_vp,
driver_fp, fpv,
- color, GL_FALSE, write_depth, write_stencil);
+ ctx->Current.RasterColor,
+ GL_FALSE, write_depth, write_stencil);
pipe_sampler_view_reference(&sv[0], NULL);
if (num_sampler_view > 1)
pipe_sampler_view_reference(&sv[1], NULL);
@@ -1427,7 +1421,6 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
struct pipe_sampler_view *sv[2] = { NULL };
struct st_fp_variant *fpv = NULL;
int num_sampler_view = 1;
- GLfloat *color;
enum pipe_format srcFormat;
unsigned srcBind;
GLboolean invertTex = GL_FALSE;
@@ -1469,7 +1462,6 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
fpv = get_color_fp_variant(st);
rbRead = st_get_color_read_renderbuffer(ctx);
- color = NULL;
driver_fp = fpv->driver_shader;
driver_vp = make_passthrough_vertex_shader(st, GL_FALSE);
@@ -1490,7 +1482,6 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
assert(type == GL_DEPTH);
rbRead = st_renderbuffer(ctx->ReadBuffer->
Attachment[BUFFER_DEPTH].Renderbuffer);
- color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
driver_fp = get_drawpix_z_stencil_program(st, GL_TRUE, GL_FALSE);
driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
@@ -1622,7 +1613,8 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
num_sampler_view,
driver_vp,
driver_fp, fpv,
- color, invertTex, GL_FALSE, GL_FALSE);
+ ctx->Current.Attrib[VERT_ATTRIB_COLOR0],
+ invertTex, GL_FALSE, GL_FALSE);
pipe_resource_reference(&pt, NULL);
pipe_sampler_view_reference(&sv[0], NULL);
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index cba7f74c3a3..65a5218b2bb 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -248,16 +248,30 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
else
st->internal_target = PIPE_TEXTURE_RECT;
- /* Vertex element objects used for drawing rectangles for glBitmap,
- * glDrawPixels, glClear, etc.
+ /* Setup vertex element info for 'struct st_util_vertex'.
*/
- for (i = 0; i < ARRAY_SIZE(st->velems_util_draw); i++) {
- memset(&st->velems_util_draw[i], 0, sizeof(struct pipe_vertex_element));
- st->velems_util_draw[i].src_offset = i * 4 * sizeof(float);
- st->velems_util_draw[i].instance_divisor = 0;
- st->velems_util_draw[i].vertex_buffer_index =
- cso_get_aux_vertex_buffer_slot(st->cso_context);
- st->velems_util_draw[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ {
+ const unsigned slot = cso_get_aux_vertex_buffer_slot(st->cso_context);
+
+ /* If this assertion ever fails all state tracker calls to
+ * cso_get_aux_vertex_buffer_slot() should be audited. This
+ * particular call would have to be moved to just before each
+ * drawing call.
+ */
+ assert(slot == 0);
+
+ STATIC_ASSERT(sizeof(struct st_util_vertex) == 9 * sizeof(float));
+
+ memset(&st->util_velems, 0, sizeof(st->util_velems));
+ st->util_velems[0].src_offset = 0;
+ st->util_velems[0].vertex_buffer_index = slot;
+ st->util_velems[0].src_format = PIPE_FORMAT_R32G32B32_FLOAT;
+ st->util_velems[1].src_offset = 3 * sizeof(float);
+ st->util_velems[1].vertex_buffer_index = slot;
+ st->util_velems[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ st->util_velems[2].src_offset = 7 * sizeof(float);
+ st->util_velems[2].vertex_buffer_index = slot;
+ st->util_velems[2].src_format = PIPE_FORMAT_R32G32_FLOAT;
}
/* we want all vertex data to be placed in buffer objects */
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 9ed5d1914f3..93da0e5d1d1 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -89,6 +89,15 @@ enum st_pipeline {
};
+/** For drawing quads for glClear, glDraw/CopyPixels, glBitmap, etc. */
+struct st_util_vertex
+{
+ float x, y, z;
+ float r, g, b, a;
+ float s, t;
+};
+
+
struct st_context
{
struct st_context_iface iface;
@@ -230,8 +239,8 @@ struct st_context
bool use_gs;
} pbo_upload;
- /** used for anything using util_draw_vertex_buffer */
- struct pipe_vertex_element velems_util_draw[3];
+ /** for drawing with st_util_vertex */
+ struct pipe_vertex_element util_velems[3];
void *passthrough_fs; /**< simple pass-through frag shader */