On 08/08/2012 10:38 AM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.roman...@intel.com>
> 
> Signed-off-by: Ian Romanick <ian.d.roman...@intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_context.c |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
> b/src/mesa/drivers/dri/i965/brw_context.c
> index 013ec14..990b467 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -108,6 +108,25 @@ brwCreateContext(int api,
>     case API_OPENGLES:
>     case API_OPENGLES2:
>        break;
> +   case API_OPENGL_CORE: {

I feel like this could be made more readable as:

#ifndef TEXTURE_FLOAT_ENABLED
*error = __DRI_CTX_ERROR_BAD_API;
return false;
#else
if (screen->gen < 6 || screen->gen == 7 &&
    screen->kernel_has_gen7_sol_reset) {
   *error = __DRI_CTX_ERROR_BAD_API;
   return false;
}

if (major_version * 10 + minor_version > 31) {
   *error = __DRI_CTX_ERROR_BAD_VERSION;
   return false;
}
#endif

> +#ifdef TEXTURE_FLOAT_ENABLED
> +      const unsigned max_version =
> +         (screen->gen == 6 ||
> +          (screen->gen == 7 && screen->kernel_has_gen7_sol_reset))
> +         ? 0x301 : 0;
> +#else
> +      const unsigned max_version = 0;
> +#endif
> +      const unsigned req_version = (major_version << 8) | minor_version;
> +
> +      if (req_version > max_version) {
> +         *error = (max_version == 0)
> +            ? __DRI_CTX_ERROR_BAD_API : __DRI_CTX_ERROR_BAD_VERSION;
> +         return false;
> +      }
> +
> +      break;
> +   }
>     default:
>        *error = __DRI_CTX_ERROR_BAD_API;
>        return false;

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to