X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fviewport.c;h=bd580446f7620d174530493e211721c739f2d616;hb=e70d0d22a2dccc1df2c88890a2964491cdafac94;hp=9917f2de299b14fe7c16bd3438ef65a30a1ea048;hpb=2f11e92cef51c88a09bc778e2ceca4ab50cf0017;p=mesa.git diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c index 9917f2de299..bd580446f76 100644 --- a/src/mesa/main/viewport.c +++ b/src/mesa/main/viewport.c @@ -52,7 +52,9 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx, * determined by calling GetFloatv with the symbolic constant * VIEWPORT_BOUNDS_RANGE (see section 6.1)." */ - if (ctx->Extensions.ARB_viewport_array) { + if (ctx->Extensions.ARB_viewport_array || + (ctx->Extensions.OES_viewport_array && + _mesa_is_gles31(ctx))) { x = CLAMP(x, ctx->Const.ViewportBounds.Min, ctx->Const.ViewportBounds.Max); y = CLAMP(y, @@ -330,6 +332,29 @@ _mesa_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v) ctx->Driver.DepthRange(ctx); } +void GLAPIENTRY +_mesa_DepthRangeArrayfvOES(GLuint first, GLsizei count, const GLfloat *v) +{ + int i; + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glDepthRangeArrayfv %d %d\n", first, count); + + if ((first + count) > ctx->Const.MaxViewports) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glDepthRangeArrayfv: first (%d) + count (%d) >= MaxViewports (%d)", + first, count, ctx->Const.MaxViewports); + return; + } + + for (i = 0; i < count; i++) + set_depth_range_no_notify(ctx, i + first, v[i * 2], v[i * 2 + 1]); + + if (ctx->Driver.DepthRange) + ctx->Driver.DepthRange(ctx); +} + /** * Update a single DepthRange * @@ -358,6 +383,12 @@ _mesa_DepthRangeIndexed(GLuint index, GLclampd nearval, GLclampd farval) _mesa_set_depth_range(ctx, index, nearval, farval); } +void GLAPIENTRY +_mesa_DepthRangeIndexedfOES(GLuint index, GLfloat nearval, GLfloat farval) +{ + _mesa_DepthRangeIndexed(index, nearval, farval); +} + /** * Initialize the context viewport attribute group. * \param ctx the GL context. @@ -443,12 +474,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; @@ -456,14 +487,14 @@ _mesa_get_viewport_xform(struct gl_context *ctx, unsigned i, translate[0] = half_width + x; if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT) { scale[1] = -half_height; - translate[1] = half_height - y; } else { scale[1] = half_height; - translate[1] = half_height + y; } + 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;