Util_D3D11_Blitter.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /************************************************************************************
  2. Filename : Util_D3D11_Blitter.h
  3. Content : D3D11 implementation for blitting, supporting scaling
  4. Created : February 24, 2015
  5. Authors : Reza Nourai
  6. Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved.
  7. Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
  8. you may not use the Oculus VR Rift SDK except in compliance with the License,
  9. which is provided at the time of installation or download, or which
  10. otherwise accompanies this software in either electronic or hard copy form.
  11. You may obtain a copy of the License at
  12. http://www.oculusvr.com/licenses/LICENSE-3.2
  13. Unless required by applicable law or agreed to in writing, the Oculus VR SDK
  14. distributed under the License is distributed on an "AS IS" BASIS,
  15. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. See the License for the specific language governing permissions and
  17. limitations under the License.
  18. ************************************************************************************/
  19. #ifndef OVR_Util_D3D11_Blitter_h
  20. #define OVR_Util_D3D11_Blitter_h
  21. #include "Kernel/OVR_RefCount.h"
  22. #ifdef OVR_OS_MS
  23. #include <d3d11_1.h>
  24. namespace OVR { namespace D3DUtil {
  25. //-------------------------------------------------------------------------------------
  26. // ***** CAPI::Blitter
  27. // D3D11 implementation of blitter
  28. class Blitter : public RefCountBase<Blitter>
  29. {
  30. public:
  31. Blitter(const Ptr<ID3D11Device>& device);
  32. ~Blitter();
  33. bool Initialize();
  34. bool Blt(ID3D11RenderTargetView* dest, ID3D11ShaderResourceView* source);
  35. private:
  36. Ptr<ID3D11Device1> Device;
  37. Ptr<ID3D11DeviceContext1> Context1;
  38. Ptr<ID3DDeviceContextState> BltState;
  39. Ptr<ID3D11InputLayout> IL;
  40. Ptr<ID3D11Buffer> VB;
  41. Ptr<ID3D11VertexShader> VS;
  42. Ptr<ID3D11PixelShader> PS;
  43. Ptr<ID3D11SamplerState> Sampler;
  44. bool AlreadyInitialized;
  45. struct BltVertex
  46. {
  47. float x, y;
  48. float u, v;
  49. };
  50. };
  51. }} // namespace OVR::D3DUtil
  52. #endif // OVR_OS_MS
  53. #endif // OVR_Util_D3D11_Blitter_h