本文整理汇总了C++中IDirect3DDevice9::CreateQuery方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirect3DDevice9::CreateQuery方法的具体用法?C++ IDirect3DDevice9::CreateQuery怎么用?C++ IDirect3DDevice9::CreateQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirect3DDevice9
的用法示例。
在下文中一共展示了IDirect3DDevice9::CreateQuery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DXGIYCbCrTextureClient
TextureClient*
IMFYCbCrImage::GetD3D9TextureClient(CompositableClient* aClient)
{
IDirect3DDevice9* device = gfxWindowsPlatform::GetPlatform()->GetD3D9Device();
RefPtr<IDirect3DTexture9> textureY;
HANDLE shareHandleY = 0;
if (!UploadData(device, textureY, shareHandleY,
mData.mYChannel, mData.mYSize, mData.mYStride)) {
return nullptr;
}
RefPtr<IDirect3DTexture9> textureCb;
HANDLE shareHandleCb = 0;
if (!UploadData(device, textureCb, shareHandleCb,
mData.mCbChannel, mData.mCbCrSize, mData.mCbCrStride)) {
return nullptr;
}
RefPtr<IDirect3DTexture9> textureCr;
HANDLE shareHandleCr = 0;
if (!UploadData(device, textureCr, shareHandleCr,
mData.mCrChannel, mData.mCbCrSize, mData.mCbCrStride)) {
return nullptr;
}
RefPtr<IDirect3DQuery9> query;
HRESULT hr = device->CreateQuery(D3DQUERYTYPE_EVENT, byRef(query));
hr = query->Issue(D3DISSUE_END);
int iterations = 0;
bool valid = false;
while (iterations < 10) {
HRESULT hr = query->GetData(nullptr, 0, D3DGETDATA_FLUSH);
if (hr == S_FALSE) {
Sleep(1);
iterations++;
continue;
}
if (hr == S_OK) {
valid = true;
}
break;
}
if (!valid) {
return nullptr;
}
RefPtr<DXGIYCbCrTextureClient> texClient =
new DXGIYCbCrTextureClient(aClient->GetForwarder(), TextureFlags::DEFAULT);
texClient->InitWith(textureY, textureCb, textureCr,
shareHandleY, shareHandleCb, shareHandleCr,
GetSize(), mData.mYSize, mData.mCbCrSize);
mTextureClient = texClient;
return mTextureClient;
}