ARB_viewport_array specifies that DEPTH_RANGE consists of double-
precision parameters (corresponding commit
d4dc35987), 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>
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);
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,
}
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);
}
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
}
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 */
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) {
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) {
*/
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;
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;
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
* 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];
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 );
*/
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];
}
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);
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 );