diff options
author | Rhys Perry <[email protected]> | 2018-04-27 11:35:00 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2018-04-30 21:13:53 -0600 |
commit | 4580617509d1ba48a7806227533a07e1c495ca81 (patch) | |
tree | 99d00ab799e56500ba754fa02bb50464731945ce /src/mesa/main/viewport.c | |
parent | 31ab0427a767c6c8377c00203e87bf0a03ac3247 (diff) |
mesa: add support for nvidia conservative rasterization extensions
Although the specs are written against compatibility GL 4.3 and allows core
profile and GLES2+, it is exposed for GL 1.0+ and GLES1 and GLES2+.
Signed-off-by: Rhys Perry <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/viewport.c')
-rw-r--r-- | src/mesa/main/viewport.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c index 398cc636856..97d328541b2 100644 --- a/src/mesa/main/viewport.c +++ b/src/mesa/main/viewport.c @@ -489,6 +489,9 @@ void _mesa_init_viewport(struct gl_context *ctx) ctx->ViewportArray[i].Near = 0.0; ctx->ViewportArray[i].Far = 1.0; } + + ctx->SubpixelPrecisionBias[0] = 0; + ctx->SubpixelPrecisionBias[1] = 0; } @@ -599,3 +602,58 @@ _mesa_get_viewport_xform(struct gl_context *ctx, unsigned i, translate[2] = n; } } + + +static void +subpixel_precision_bias(struct gl_context *ctx, GLuint xbits, GLuint ybits) +{ + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glSubpixelPrecisionBiasNV(%u, %u)\n", xbits, ybits); + + ctx->SubpixelPrecisionBias[0] = xbits; + ctx->SubpixelPrecisionBias[1] = ybits; + + FLUSH_VERTICES(ctx, 0); + ctx->NewDriverState |= + ctx->DriverFlags.NewNvConservativeRasterizationParams; +} + +void GLAPIENTRY +_mesa_SubpixelPrecisionBiasNV_no_error(GLuint xbits, GLuint ybits) +{ + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glSubpixelPrecisionBiasNV(%u, %u)\n", xbits, ybits); + + subpixel_precision_bias(ctx, xbits, ybits); +} + +void GLAPIENTRY +_mesa_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits) +{ + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glSubpixelPrecisionBiasNV(%u, %u)\n", xbits, ybits); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!ctx->Extensions.NV_conservative_raster) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glSubpixelPrecisionBiasNV not supported"); + return; + } + + if (xbits > ctx->Const.MaxSubpixelPrecisionBiasBits) { + _mesa_error(ctx, GL_INVALID_VALUE, "glSubpixelPrecisionBiasNV"); + return; + } + + if (ybits > ctx->Const.MaxSubpixelPrecisionBiasBits) { + _mesa_error(ctx, GL_INVALID_VALUE, "glSubpixelPrecisionBiasNV"); + return; + } + + subpixel_precision_bias(ctx, xbits, ybits); +} |