mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 11:38:05 +02:00
mesa: Use floats for viewport bounds.
ARB_viewport_array specifies that DEPTH_RANGE consists of double- precision parameters (corresponding commitd4dc35987), and a preparatory commit (6340e609a) added _mesa_get_viewport_xform() which returned double-precision scale[3] and translate[3] vectors, even though X, Y, Width, and Height were still floats. All users of _mesa_get_viewport_xform() immediately convert the double scale and translation vectors into floats (which were floats originally, but were converted to doubles in _mesa_get_viewport_xform(), sigh). i965 at least cannot consume doubles (see SF_CLIP_VIEWPORT). If we want to pass doubles to hardware, we should have a different function that does that. Acked-by: Mathias Froehlich <Mathias.Froehlich@web.de>
This commit is contained in:
parent
ecc559218d
commit
f8a647883a
14 changed files with 22 additions and 22 deletions
|
|
@ -402,7 +402,7 @@ void
|
|||
intelCalcViewport(struct gl_context * ctx)
|
||||
{
|
||||
struct intel_context *intel = intel_context(ctx);
|
||||
double scale[3], translate[3];
|
||||
float scale[3], translate[3];
|
||||
|
||||
_mesa_get_viewport_xform(ctx, 0, scale, translate);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ static void upload_sf_vp(struct brw_context *brw)
|
|||
struct gl_context *ctx = &brw->ctx;
|
||||
struct brw_sf_viewport *sfv;
|
||||
GLfloat y_scale, y_bias;
|
||||
double scale[3], translate[3];
|
||||
float scale[3], translate[3];
|
||||
const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
|
||||
|
||||
sfv = brw_state_batch(brw, AUB_TRACE_SF_VP_STATE,
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ gen6_upload_sf_vp(struct brw_context *brw)
|
|||
}
|
||||
|
||||
for (unsigned i = 0; i < ctx->Const.MaxViewports; i++) {
|
||||
double scale[3], translate[3];
|
||||
float scale[3], translate[3];
|
||||
|
||||
/* _NEW_VIEWPORT */
|
||||
_mesa_get_viewport_xform(ctx, i, scale, translate);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ gen7_upload_sf_clip_viewport(struct brw_context *brw)
|
|||
}
|
||||
|
||||
for (unsigned i = 0; i < ctx->Const.MaxViewports; i++) {
|
||||
double scale[3], translate[3];
|
||||
float scale[3], translate[3];
|
||||
_mesa_get_viewport_xform(ctx, i, scale, translate);
|
||||
|
||||
/* According to the "Vertex X,Y Clamping and Quantization" section of
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ gen8_upload_sf_clip_viewport(struct brw_context *brw)
|
|||
}
|
||||
|
||||
for (unsigned i = 0; i < ctx->Const.MaxViewports; i++) {
|
||||
double scale[3], translate[3];
|
||||
float scale[3], translate[3];
|
||||
_mesa_get_viewport_xform(ctx, i, scale, translate);
|
||||
|
||||
/* _NEW_VIEWPORT: Viewport Matrix Elements */
|
||||
|
|
|
|||
|
|
@ -1546,7 +1546,7 @@ void r200UpdateWindow( struct gl_context *ctx )
|
|||
GLfloat xoffset = 0;
|
||||
GLfloat yoffset = dPriv ? (GLfloat) dPriv->h : 0;
|
||||
const GLboolean render_to_fbo = (ctx->DrawBuffer ? _mesa_is_user_fbo(ctx->DrawBuffer) : 0);
|
||||
double scale[3], translate[3];
|
||||
float scale[3], translate[3];
|
||||
GLfloat y_scale, y_bias;
|
||||
|
||||
if (render_to_fbo) {
|
||||
|
|
|
|||
|
|
@ -1354,7 +1354,7 @@ void radeonUpdateWindow( struct gl_context *ctx )
|
|||
GLfloat xoffset = 0.0;
|
||||
GLfloat yoffset = dPriv ? (GLfloat) dPriv->h : 0;
|
||||
const GLboolean render_to_fbo = (ctx->DrawBuffer ? _mesa_is_user_fbo(ctx->DrawBuffer) : 0);
|
||||
double scale[3], translate[3];
|
||||
float scale[3], translate[3];
|
||||
GLfloat y_scale, y_bias;
|
||||
|
||||
if (render_to_fbo) {
|
||||
|
|
|
|||
|
|
@ -443,12 +443,12 @@ _mesa_ClipControl(GLenum origin, GLenum depth)
|
|||
*/
|
||||
void
|
||||
_mesa_get_viewport_xform(struct gl_context *ctx, unsigned i,
|
||||
double scale[3], double translate[3])
|
||||
float scale[3], float translate[3])
|
||||
{
|
||||
double x = ctx->ViewportArray[i].X;
|
||||
double y = ctx->ViewportArray[i].Y;
|
||||
double half_width = 0.5*ctx->ViewportArray[i].Width;
|
||||
double half_height = 0.5*ctx->ViewportArray[i].Height;
|
||||
float x = ctx->ViewportArray[i].X;
|
||||
float y = ctx->ViewportArray[i].Y;
|
||||
float half_width = 0.5f * ctx->ViewportArray[i].Width;
|
||||
float half_height = 0.5f * ctx->ViewportArray[i].Height;
|
||||
double n = ctx->ViewportArray[i].Near;
|
||||
double f = ctx->ViewportArray[i].Far;
|
||||
|
||||
|
|
@ -462,8 +462,8 @@ _mesa_get_viewport_xform(struct gl_context *ctx, unsigned i,
|
|||
translate[1] = half_height + y;
|
||||
}
|
||||
if (ctx->Transform.ClipDepthMode == GL_NEGATIVE_ONE_TO_ONE) {
|
||||
scale[2] = 0.5*(f - n);
|
||||
translate[2] = 0.5*(n + f);
|
||||
scale[2] = 0.5 * (f - n);
|
||||
translate[2] = 0.5 * (n + f);
|
||||
} else {
|
||||
scale[2] = f - n;
|
||||
translate[2] = n;
|
||||
|
|
|
|||
|
|
@ -73,6 +73,6 @@ _mesa_ClipControl(GLenum origin, GLenum depth);
|
|||
|
||||
extern void
|
||||
_mesa_get_viewport_xform(struct gl_context *ctx, unsigned i,
|
||||
double scale[3], double translate[3]);
|
||||
float scale[3], float translate[3]);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1111,8 +1111,8 @@ _math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z )
|
|||
* Transforms Normalized Device Coords to window/Z values.
|
||||
*/
|
||||
void
|
||||
_math_matrix_viewport(GLmatrix *m, const double scale[3],
|
||||
const double translate[3], double depthMax)
|
||||
_math_matrix_viewport(GLmatrix *m, const float scale[3],
|
||||
const float translate[3], double depthMax)
|
||||
{
|
||||
m->m[MAT_SX] = scale[0];
|
||||
m->m[MAT_TX] = translate[0];
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ _math_matrix_frustum( GLmatrix *mat,
|
|||
GLfloat nearval, GLfloat farval );
|
||||
|
||||
extern void
|
||||
_math_matrix_viewport( GLmatrix *m, const double scale[3],
|
||||
const double translate[3], double depthMax );
|
||||
_math_matrix_viewport( GLmatrix *m, const float scale[3],
|
||||
const float translate[3], double depthMax );
|
||||
|
||||
extern void
|
||||
_math_matrix_set_identity( GLmatrix *dest );
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ update_viewport( struct st_context *st )
|
|||
*/
|
||||
for (i = 0; i < ctx->Const.MaxViewports; i++)
|
||||
{
|
||||
double scale[3], translate[3];
|
||||
float scale[3], translate[3];
|
||||
_mesa_get_viewport_xform(ctx, i, scale, translate);
|
||||
|
||||
st->state.viewport[i].scale[0] = scale[0];
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
|
|||
}
|
||||
|
||||
if (new_state & (_NEW_VIEWPORT | _NEW_BUFFERS)) {
|
||||
double scale[3], translate[3];
|
||||
float scale[3], translate[3];
|
||||
_mesa_get_viewport_xform(ctx, 0, scale, translate);
|
||||
_math_matrix_viewport(&tnl->_WindowMap, scale, translate,
|
||||
ctx->DrawBuffer->_DepthMaxF);
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ _tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4])
|
|||
GLfloat eye[4], clip[4], ndc[3], d;
|
||||
GLfloat *norm, eyenorm[3];
|
||||
GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
|
||||
double scale[3], translate[3];
|
||||
float scale[3], translate[3];
|
||||
|
||||
/* apply modelview matrix: eye = MV * obj */
|
||||
TRANSFORM_POINT( eye, ctx->ModelviewMatrixStack.Top->m, vObj );
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue