[Mesa-dev] [PATCH 2/2] mesa/vbo: Support the ES 3.0 signed normalized scaling rules.

Chris Forbes chrisf at ijw.co.nz
Wed Nov 21 22:07:42 PST 2012


On Thu, Nov 22, 2012 at 5:44 PM, Kenneth Graunke <kenneth at whitecape.org>wrote:

>  static inline float conv_i2_to_norm_float(struct gl_context *ctx, int i2)
>  {
>     struct attr_bits_2 val;
>     val.x = i2;
> -   return (2.0F * (float)val.x + 1.0F) * (1.0F / 3.0F);
> +
> +   if (_mesa_is_gles3(ctx) ||
> +       (ctx->API == API_OPENGL_CORE && ctx->Version >= 42)) {
> +      /* Equation 2.3 above. */
> +      return (float) val.x;
>

This needs to be MAX2((float)val.x, -1.0) -- otherwise 0b10 maps to -2.

-- Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121122/45768752/attachment.html>


More information about the mesa-dev mailing list