| 33 | } |
| 34 | |
| 35 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetTextureSwapChainBufferDX(ovrSession session, |
| 36 | ovrTextureSwapChain chain, |
| 37 | int index, |
| 38 | IID iid, |
| 39 | void** out_Buffer) |
| 40 | { |
| 41 | REV_TRACE(ovr_GetTextureSwapChainBufferDX); |
| 42 | |
| 43 | if (!session) |
| 44 | return ovrError_InvalidSession; |
| 45 | |
| 46 | if (!chain || !out_Buffer) |
| 47 | return ovrError_InvalidParameter; |
| 48 | |
| 49 | if (index < 0) |
| 50 | index = chain->CurrentIndex; |
| 51 | |
| 52 | TextureD3D* texture = dynamic_cast<TextureD3D*>(chain->Textures[index].get()); |
| 53 | if (!texture) |
| 54 | return ovrError_InvalidParameter; |
| 55 | |
| 56 | HRESULT hr = texture->Texture()->QueryInterface(iid, out_Buffer); |
| 57 | if (FAILED(hr)) |
| 58 | return ovrError_InvalidParameter; |
| 59 | |
| 60 | return ovrSuccess; |
| 61 | } |
| 62 | |
| 63 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_CreateMirrorTextureDX(ovrSession session, |
| 64 | IUnknown* d3dPtr, |