[virglrenderer-devel] [PATCH 04/12] arb_gpu_shader5: add support for indexed queries
Dave Airlie
airlied at gmail.com
Tue May 15 10:00:54 UTC 2018
On 15 May 2018 at 18:54, Gert Wollny <gert.wollny at collabora.com> wrote:
> Am Dienstag, den 15.05.2018, 14:38 +1000 schrieb Dave Airlie:
>> From: Dave Airlie <airlied at redhat.com>
>>
>> ---
>> src/vrend_decode.c | 2 +-
>> src/vrend_renderer.c | 10 ++++++++--
>> 2 files changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/vrend_decode.c b/src/vrend_decode.c
>> index 5f62568..96f6077 100644
>> --- a/src/vrend_decode.c
>> +++ b/src/vrend_decode.c
>> @@ -659,7 +659,7 @@ static int vrend_decode_create_query(struct
>> vrend_decode_ctx *ctx, uint32_t hand
>>
>> tmp = get_buf_entry(ctx, VIRGL_OBJ_QUERY_TYPE_INDEX);
>> query_type = VIRGL_OBJ_QUERY_TYPE(tmp);
>> - query_index = VIRGL_OBJ_QUERY_INDEX(tmp);
>> + query_index = (tmp >> 16) & 0xffff;
> This seems to be the only place where the macro VIRGL_OBJ_QUERY_INDEX
> is/was used. Wouldn't it be better to fix the macro to have a nice name
> here instead of placing the shift+& code (or also replace
> the VIRGL_OBJ_QUERY_TYPE be the actual code, so one can see in one
> place what is happening)?
Oops looks like I just rebased this too many times, I'll recheck it.
>
>>
>> offset = get_buf_entry(ctx, VIRGL_OBJ_QUERY_OFFSET);
>> res_handle = get_buf_entry(ctx, VIRGL_OBJ_QUERY_RES_HANDLE);
>> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
>> index 3e52166..82188d8 100644
>> --- a/src/vrend_renderer.c
>> +++ b/src/vrend_renderer.c
>> @@ -6403,7 +6403,10 @@ void vrend_begin_query(struct vrend_context
>> *ctx, uint32_t handle)
>> if (q->gltype == GL_TIMESTAMP)
>> return;
>>
>> - glBeginQuery(q->gltype, q->id);
>> + if (q->index > 0)
>> + glBeginQueryIndexed(q->gltype, q->index, q->id);
>> + else
>> + glBeginQuery(q->gltype, q->id);
>> }
> Is this distinction actually needed, the index parameter can be zero,
> and at least in mesa
> glBeginQuery(target, id)
> directly calls
> glBeginQueryIndexed(target, 0, id)
> anyway.
Well we still want to work on older host GL. So if we have a host GL that
only supports GL3.3 and doesn't have indexed queries this would try
and call an API that isn't exported even for non-indexed queries.
Dave.
More information about the virglrenderer-devel
mailing list