* Create a simple vertex shader that just passes through the
* vertex position and texcoord (and optionally, color).
*/
-static struct st_vertex_program *
-make_vertex_shader(struct st_context *st, GLboolean passColor)
+struct st_vertex_program *
+st_make_passthrough_vertex_shader(struct st_context *st, GLboolean passColor)
{
/* only make programs once and re-use */
static struct st_vertex_program *progs[2] = { NULL, NULL };
verts[i][1][3] = 1.0; /*Q*/
}
- st_draw_vertices(ctx, PIPE_PRIM_QUADS, 4, (float *) verts, 2);
+ st_draw_vertices(ctx, PIPE_PRIM_QUADS, 4, (float *) verts, 2, GL_FALSE);
}
verts[i][2][3] = 1.0; /*Q*/
}
- st_draw_vertices(ctx, PIPE_PRIM_QUADS, 4, (float *) verts, 3);
+ st_draw_vertices(ctx, PIPE_PRIM_QUADS, 4, (float *) verts, 3, GL_FALSE);
}
if (format == GL_DEPTH_COMPONENT) {
ps = st->state.framebuffer.zsbuf;
stfp = make_fragment_shader_z(ctx->st);
- stvp = make_vertex_shader(ctx->st, GL_TRUE);
+ stvp = st_make_passthrough_vertex_shader(ctx->st, GL_TRUE);
color = ctx->Current.RasterColor;
}
else if (format == GL_STENCIL_INDEX) {
else {
ps = st->state.framebuffer.cbufs[0];
stfp = combined_drawpix_fragment_program(ctx);
- stvp = make_vertex_shader(ctx->st, GL_FALSE);
+ stvp = st_make_passthrough_vertex_shader(ctx->st, GL_FALSE);
color = NULL;
}
struct st_context *st = ctx->st;
struct pipe_texture *pt;
- stvp = make_vertex_shader(ctx->st, GL_TRUE);
+ stvp = st_make_passthrough_vertex_shader(ctx->st, GL_TRUE);
stfp = combined_bitmap_fragment_program(ctx);
st_validate_state(st);
rbRead = st_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
color = NULL;
stfp = combined_drawpix_fragment_program(ctx);
- stvp = make_vertex_shader(ctx->st, GL_FALSE);
+ stvp = st_make_passthrough_vertex_shader(ctx->st, GL_FALSE);
}
else {
rbRead = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer);
color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
stfp = make_fragment_shader_z(ctx->st);
- stvp = make_vertex_shader(ctx->st, GL_TRUE);
+ stvp = st_make_passthrough_vertex_shader(ctx->st, GL_TRUE);
}
psRead = rbRead->surface;
void
st_draw_vertices(GLcontext *ctx, unsigned prim,
unsigned numVertex, float *verts,
- unsigned numAttribs)
+ unsigned numAttribs,
+ GLboolean inClipCoords)
{
const float width = ctx->DrawBuffer->Width;
const float height = ctx->DrawBuffer->Height;
assert(numAttribs > 0);
- /* convert to clip coords */
- for (i = 0; i < numVertex; i++) {
- float x = verts[i * numAttribs * 4 + 0];
- float y = verts[i * numAttribs * 4 + 1];
- x = x / width * 2.0 - 1.0;
- y = y / height * 2.0 - 1.0;
- verts[i * numAttribs * 4 + 0] = x;
- verts[i * numAttribs * 4 + 1] = y;
+ if (!inClipCoords) {
+ /* convert to clip coords */
+ for (i = 0; i < numVertex; i++) {
+ float x = verts[i * numAttribs * 4 + 0];
+ float y = verts[i * numAttribs * 4 + 1];
+ x = x / width * 2.0 - 1.0;
+ y = y / height * 2.0 - 1.0;
+ verts[i * numAttribs * 4 + 0] = x;
+ verts[i * numAttribs * 4 + 1] = y;
+ }
}
/* XXX create one-time */