[Mesa-dev] [PATCH 3/4] mesa: Refuse to EndQuery with a mismatched query target.

Brian Paul brianp at vmware.com
Fri Oct 19 15:03:50 PDT 2012


On 10/19/2012 03:59 PM, Brian Paul wrote:
> On 10/19/2012 12:53 PM, Eric Anholt wrote:
>> ---
>> src/mesa/main/queryobj.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
>> index ac03649..d2f064e 100644
>> --- a/src/mesa/main/queryobj.c
>> +++ b/src/mesa/main/queryobj.c
>> @@ -374,6 +374,15 @@ _mesa_EndQueryIndexed(GLenum target, GLuint index)
>>
>> /* XXX should probably refcount query objects */
>> q = *bindpt;
>> +
>> + if (q&& q->Target != target) {
>> + _mesa_error(ctx, GL_INVALID_OPERATION,
>> + "glEndQuery(target=%s with active query of target %s)",
>> + _mesa_lookup_enum_by_nr(target),
>> + _mesa_lookup_enum_by_nr(q->Target));
>> + return;
>> + }
>> +
>> *bindpt = NULL;
>>
>> if (!q || !q->Active) {
>
> I'm not clear on how this can actually happen. The bindpt pointer
> comes from get_query_binding_point() which depends on the target. And
> I don't see how a query object's target would not match the binding
> point's target.
>
> That said, I don't see any harm in this, so if this really happens:
> Reviewed-by: Brian Paul <brianp at vmware.com>
>

Ah, I guess this is because the GL_SAMPLES_PASSED_ARB and
GL_ANY_SAMPLES_PASSED targets both bind to the 
ctx->Query.CurrentOcclusionObject binding point, right?

Maybe there should be a comment somewhere to point that out.

-Brian


More information about the mesa-dev mailing list