HRESULT nine_is_query_supported(D3DQUERYTYPE type) { const unsigned ptype = d3dquerytype_to_pipe_query(type); user_assert(ptype != ~0, D3DERR_INVALIDCALL); if (ptype == PIPE_QUERY_TYPES) { DBG("Query type %u (%s) not supported.\n", type, nine_D3DQUERYTYPE_to_str(type)); return D3DERR_NOTAVAILABLE; } return D3D_OK; }
HRESULT NineQuery9_ctor( struct NineQuery9 *This, struct NineUnknownParams *pParams, D3DQUERYTYPE Type ) { struct pipe_context *pipe = pParams->device->pipe; const unsigned ptype = d3dquerytype_to_pipe_query(pParams->device->screen, Type); HRESULT hr; DBG("This=%p pParams=%p Type=%d\n", This, pParams, Type); hr = NineUnknown_ctor(&This->base, pParams); if (FAILED(hr)) return hr; This->state = NINE_QUERY_STATE_FRESH; This->type = Type; user_assert(ptype != ~0, D3DERR_INVALIDCALL); if (ptype < PIPE_QUERY_TYPES) { This->pq = pipe->create_query(pipe, ptype, 0); if (!This->pq) return E_OUTOFMEMORY; } else { assert(0); /* we have checked this case before */ } This->instant = Type == D3DQUERYTYPE_EVENT || Type == D3DQUERYTYPE_RESOURCEMANAGER || Type == D3DQUERYTYPE_TIMESTAMP || Type == D3DQUERYTYPE_TIMESTAMPFREQ || Type == D3DQUERYTYPE_VCACHE || Type == D3DQUERYTYPE_VERTEXSTATS; This->result_size = nine_query_result_size(Type); return D3D_OK; }