Commit 4650b358 authored by Brian's avatar Brian

gallium: add bitmap/drawpixels texcoord bias support

The state tracker will call pipe->get_paramf(PIPE_CAP_BITMAP_TEXCOORD_BIAS)
to get a bias factor for adjusting the texcoords used in bitmap/drawpixels.
This allows us to compensate for small differences in rasterization from
one device to another.
parent af6b12cc
......@@ -265,6 +265,6 @@ enum pipe_texture_target {
#define PIPE_CAP_MAX_POINT_WIDTH_AA 17
#define PIPE_CAP_MAX_TEXTURE_ANISOTROPY 18
#define PIPE_CAP_MAX_TEXTURE_LOD_BIAS 19
#define PIPE_CAP_BITMAP_TEXCOORD_BIAS 20
#endif
......@@ -581,10 +581,13 @@ draw_quad_colored(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
GLfloat x1, GLfloat y1, const GLfloat *color,
GLboolean invertTex)
{
GLfloat bias = ctx->st->bitmap_texcoord_bias;
GLfloat verts[4][3][4]; /* four verts, three attribs, XYZW */
GLuint i;
GLfloat sLeft = 0.0, sRight = 1.0;
GLfloat tTop = invertTex, tBot = 1.0 - tTop;
GLfloat xBias = bias / (x1-x0);
GLfloat yBias = bias / (y1-y0);
GLfloat sLeft = 0.0 + xBias, sRight = 1.0 + xBias;
GLfloat tTop = invertTex - yBias, tBot = 1.0 - tTop - yBias;
/* upper-left */
verts[0][0][0] = x0; /* attr[0].x */
......
......@@ -143,6 +143,8 @@ struct st_context
GLfloat polygon_offset_scale; /* ?? */
GLfloat bitmap_texcoord_bias;
/** Mapping from VERT_RESULT_x to post-transformed vertex slot */
const GLuint *vertex_result_to_slot;
......
......@@ -106,6 +106,9 @@ void st_init_limits(struct st_context *st)
c->MaxTextureLodBias
= pipe->get_paramf(pipe, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);
st->bitmap_texcoord_bias
= pipe->get_paramf(pipe, PIPE_CAP_BITMAP_TEXCOORD_BIAS);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment