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.
This commit is contained in:
@@ -265,6 +265,6 @@ enum pipe_texture_target {
|
|||||||
#define PIPE_CAP_MAX_POINT_WIDTH_AA 17
|
#define PIPE_CAP_MAX_POINT_WIDTH_AA 17
|
||||||
#define PIPE_CAP_MAX_TEXTURE_ANISOTROPY 18
|
#define PIPE_CAP_MAX_TEXTURE_ANISOTROPY 18
|
||||||
#define PIPE_CAP_MAX_TEXTURE_LOD_BIAS 19
|
#define PIPE_CAP_MAX_TEXTURE_LOD_BIAS 19
|
||||||
|
#define PIPE_CAP_BITMAP_TEXCOORD_BIAS 20
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -581,10 +581,13 @@ draw_quad_colored(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
|
|||||||
GLfloat x1, GLfloat y1, const GLfloat *color,
|
GLfloat x1, GLfloat y1, const GLfloat *color,
|
||||||
GLboolean invertTex)
|
GLboolean invertTex)
|
||||||
{
|
{
|
||||||
|
GLfloat bias = ctx->st->bitmap_texcoord_bias;
|
||||||
GLfloat verts[4][3][4]; /* four verts, three attribs, XYZW */
|
GLfloat verts[4][3][4]; /* four verts, three attribs, XYZW */
|
||||||
GLuint i;
|
GLuint i;
|
||||||
GLfloat sLeft = 0.0, sRight = 1.0;
|
GLfloat xBias = bias / (x1-x0);
|
||||||
GLfloat tTop = invertTex, tBot = 1.0 - tTop;
|
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 */
|
/* upper-left */
|
||||||
verts[0][0][0] = x0; /* attr[0].x */
|
verts[0][0][0] = x0; /* attr[0].x */
|
||||||
|
@@ -143,6 +143,8 @@ struct st_context
|
|||||||
|
|
||||||
GLfloat polygon_offset_scale; /* ?? */
|
GLfloat polygon_offset_scale; /* ?? */
|
||||||
|
|
||||||
|
GLfloat bitmap_texcoord_bias;
|
||||||
|
|
||||||
/** Mapping from VERT_RESULT_x to post-transformed vertex slot */
|
/** Mapping from VERT_RESULT_x to post-transformed vertex slot */
|
||||||
const GLuint *vertex_result_to_slot;
|
const GLuint *vertex_result_to_slot;
|
||||||
|
|
||||||
|
@@ -106,6 +106,9 @@ void st_init_limits(struct st_context *st)
|
|||||||
|
|
||||||
c->MaxTextureLodBias
|
c->MaxTextureLodBias
|
||||||
= pipe->get_paramf(pipe, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);
|
= pipe->get_paramf(pipe, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);
|
||||||
|
|
||||||
|
st->bitmap_texcoord_bias
|
||||||
|
= pipe->get_paramf(pipe, PIPE_CAP_BITMAP_TEXCOORD_BIAS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user