summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/intel/intel_pixel_draw.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-05-08 12:46:18 -0700
committerEric Anholt <eric@anholt.net>2009-05-08 14:18:04 -0700
commitb6e94f71c2bfc63497e2c8265179f19babe87688 (patch)
tree3ad2ba8e9909de2bccb2ff1c3466cc75bc54932a /src/mesa/drivers/dri/intel/intel_pixel_draw.c
parentf09e5a5b637822b89ba19b2e306b83f8fc3809d0 (diff)
intel: Put the constant texcoords used in metaops into a vbo.
Make this be its own function for setup/teardown of the binding of these texcoords. No performance difference in the engine demo (I just felt dirty not using a VBO for this), and I think it should be more resilient to interference from current GL state.
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_pixel_draw.c')
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_draw.c33
1 files changed, 6 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index e8d5ac8569..abcdcd5724 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -70,7 +70,6 @@ intel_texture_drawpixels(GLcontext * ctx,
struct intel_context *intel = intel_context(ctx);
GLuint texname;
GLfloat vertices[4][4];
- GLfloat texcoords[4][2];
GLfloat z;
GLint old_active_texture;
GLenum internalFormat;
@@ -169,22 +168,13 @@ intel_texture_drawpixels(GLcontext * ctx,
vertices[3][2] = z;
vertices[3][3] = 1.0;
- texcoords[0][0] = 0.0;
- texcoords[0][1] = 0.0;
- texcoords[1][0] = 1.0;
- texcoords[1][1] = 0.0;
- texcoords[2][0] = 1.0;
- texcoords[2][1] = 1.0;
- texcoords[3][0] = 0.0;
- texcoords[3][1] = 1.0;
-
_mesa_VertexPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &vertices);
- _mesa_ClientActiveTextureARB(GL_TEXTURE0);
- _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &texcoords);
_mesa_Enable(GL_VERTEX_ARRAY);
- _mesa_Enable(GL_TEXTURE_COORD_ARRAY);
+ intel_meta_set_default_texrect(intel);
+
CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4));
+ intel_meta_restore_texcoords(intel);
intel_meta_restore_transform(intel);
_mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture);
@@ -208,7 +198,6 @@ intel_stencil_drawpixels(GLcontext * ctx,
struct intel_context *intel = intel_context(ctx);
GLuint texname, rb_name, fb_name, old_fb_name;
GLfloat vertices[4][2];
- GLfloat texcoords[4][2];
struct intel_renderbuffer *irb;
struct intel_renderbuffer *depth_irb;
struct gl_renderbuffer *rb;
@@ -343,7 +332,6 @@ intel_stencil_drawpixels(GLcontext * ctx,
_mesa_free(stencil_pixels);
intel_meta_set_passthrough_transform(intel);
-
vertices[0][0] = x;
vertices[0][1] = y;
vertices[1][0] = x + width * ctx->Pixel.ZoomX;
@@ -353,22 +341,13 @@ intel_stencil_drawpixels(GLcontext * ctx,
vertices[3][0] = x;
vertices[3][1] = y + height * ctx->Pixel.ZoomY;
- texcoords[0][0] = 0.0;
- texcoords[0][1] = 0.0;
- texcoords[1][0] = 1.0;
- texcoords[1][1] = 0.0;
- texcoords[2][0] = 1.0;
- texcoords[2][1] = 1.0;
- texcoords[3][0] = 0.0;
- texcoords[3][1] = 1.0;
-
_mesa_VertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &vertices);
- _mesa_ClientActiveTextureARB(GL_TEXTURE0);
- _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &texcoords);
_mesa_Enable(GL_VERTEX_ARRAY);
- _mesa_Enable(GL_TEXTURE_COORD_ARRAY);
+ intel_meta_set_default_texrect(intel);
+
CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4));
+ intel_meta_restore_texcoords(intel);
intel_meta_restore_transform(intel);
_mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture);