[Mesa-dev] [PATCH 1/4] mesa: implement glGet(GL_TIMESTAMP) v2

Eric Anholt eric at anholt.net
Thu Jul 5 15:59:00 PDT 2012


Marek Olšák <maraeo at gmail.com> writes:

> This is adds a new driver function to retrieve the timestamp.

> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index a83d367..7a507ce 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -1807,7 +1811,18 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
>     case GL_UNIFORM_BUFFER_BINDING:
>        v->value_int = ctx->UniformBuffer->Name;
>        break;
> -   }   
> +   /* GL_ARB_timer_query */
> +   case GL_TIMESTAMP:
> +      if (ctx->Driver.GetTimestamp) {
> +         /* Discard the last bit to convert it to a signed integer. */
> +         v->value_int64 =
> +               ctx->Driver.GetTimestamp(ctx) & 0x7fffffffffffffffull;
> +      }

Why wouldn't you just leave the top bit in place?  Otherwise, the driver
will have to truncate its query results to 63 bits and advertise 63 for
QUERY_COUNTER_BITS as well, so that correspondence is maintained.  .
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120705/b011aa43/attachment.pgp>


More information about the mesa-dev mailing list