aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-02-08 14:51:32 -0700
committerBrian <[email protected]>2008-02-08 15:13:48 -0700
commit0b64ee6960f9e099bc1a6ca6fa10720fee875b3a (patch)
treeb598178e23bf01e1ce3f20bf124c9ba5b01a916b /src
parent864abce57d3b81d0f92673472959b71e09c4f245 (diff)
gallium: added inClipCoords param to st_draw_vertices() to indicate coord system of vertices
Also, export st_make_passthrough_vertex_shader() from st_cb_drawpixels.c
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c2
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c18
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.h4
-rw-r--r--src/mesa/state_tracker/st_draw.c21
-rw-r--r--src/mesa/state_tracker/st_draw.h3
5 files changed, 28 insertions, 20 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 0cd469c156a..ab98b54bab4 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -251,7 +251,7 @@ draw_quad(GLcontext *ctx,
verts[i][1][3] = color[3];
}
- st_draw_vertices(ctx, PIPE_PRIM_QUADS, 4, (float *) verts, 2);
+ st_draw_vertices(ctx, PIPE_PRIM_QUADS, 4, (float *) verts, 2, GL_FALSE);
}
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 34d420fcffa..07886e79829 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -355,8 +355,8 @@ make_fragment_shader_z(struct st_context *st)
* 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 };
@@ -572,7 +572,7 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
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);
}
@@ -625,7 +625,7 @@ draw_quad_colored(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
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);
}
@@ -945,7 +945,7 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
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) {
@@ -956,7 +956,7 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
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;
}
@@ -1111,7 +1111,7 @@ st_Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
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);
@@ -1229,13 +1229,13 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
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;
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.h b/src/mesa/state_tracker/st_cb_drawpixels.h
index 71ba4870200..b8b906f06bc 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.h
+++ b/src/mesa/state_tracker/st_cb_drawpixels.h
@@ -30,6 +30,10 @@
#define ST_CB_DRAWPIXELS_H
+extern struct st_vertex_program *
+st_make_passthrough_vertex_shader(struct st_context *st, GLboolean passColor);
+
+
extern void st_init_drawpixels_functions(struct dd_function_table *functions);
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index c9b8e784855..ae9f5c8b117 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -354,7 +354,8 @@ st_draw_vbo(GLcontext *ctx,
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;
@@ -367,14 +368,16 @@ st_draw_vertices(GLcontext *ctx, unsigned prim,
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 */
diff --git a/src/mesa/state_tracker/st_draw.h b/src/mesa/state_tracker/st_draw.h
index 89ee790c577..171bde57e55 100644
--- a/src/mesa/state_tracker/st_draw.h
+++ b/src/mesa/state_tracker/st_draw.h
@@ -62,7 +62,8 @@ st_feedback_draw_vbo(GLcontext *ctx,
void
st_draw_vertices(GLcontext *ctx, unsigned prim,
unsigned numVertex, float *verts,
- unsigned numAttribs);
+ unsigned numAttribs,
+ GLboolean inClipCoords);
#endif