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

Marek Olšák maraeo at gmail.com
Thu Jul 5 16:04:17 PDT 2012


On Fri, Jul 6, 2012 at 12:59 AM, Eric Anholt <eric at anholt.net> wrote:
> 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.  .

I thought a negative timestamp didn't make much sense. I'll leave the
top bit in place then.

Marek


More information about the mesa-dev mailing list