[Mesa-dev] [PATCH 3/4] nine: handle D3DISSUE_END without previous D3DISSUE_BEGIN

Axel Davy axel.davy at ens.fr
Sat Nov 22 02:05:50 PST 2014

On 22/11/2014 07:51, Ilia Mirkin wrote :
>>> It requires a begin_query for some but not all queries.
>>> Perhaps the code should read like
>>>      } else {
>>>          if (This->state != NINE_QUERY_STATE_RUNNING)
>>>              pipe->begin_query(pipe, This->pq);
>>>          pipe->end_query(pipe, This->pq);
>>>          This->state = NINE_QUERY_STATE_ENDED;
>>>      }
>>> This seems like it would also take care of the Ended -> Ended
>>> transition which is supposed to restart the query.
>> My understanding is that the End->End restart is only in the final state of
>> the query, so it shouldn't happen in the others.
>> Do you see that differently?
> No, but it seems like my proposed code above handles all the
> situations... if it's in the Building state (aka 'RUNNING'), then it
> just executes end_query. If it's in any other state (i.e. FRESH,
> ENDED, or FLUSHED) it will start a query anew and flip back to the
> ENDED state (which roughly corresponds to Issued). I guess
> FRESH/FLUSHED correspond to 'Signaled', although ENDED can mean
> 'Signaled' as well since nothing changes the state if
> pipe->get_query_results succeeds.
> Cheers,
>    -ilia

After reading the documentation and the code myself, I think Ilia's 
comment are right.
The current patch won't issue a query when the applications issues 
D3DISSUE_END directly, whereas
Ilia's proposed code does.

However on the extension of the user_assert to return INVALIDCALL when 
the status is fresh, It is not written in the documentation:
When things are not written in the documentation explicitly, it happens 
apps have bad behaviour. Someone should check the behaviour on windows.
Looking at what wine does, I seems wine will return S_OK like we 
currently do, but it does in addition fill the return structure with 0, 
with the comment: /* D3D allows GetData on a new query, OpenGL doesn't. 
So just invent the data ourselves */
Perhaps for best compatibility we could issue the state with 
D3DISSUE_END in this case and correctly fill the structure.

Axel Davy

More information about the mesa-dev mailing list