gl_fence_win.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_GL_GL_FENCE_WIN_H_
  5. #define UI_GL_GL_FENCE_WIN_H_
  6. #include "ui/gl/gl_fence.h"
  7. #include <d3d11_3.h>
  8. #include <wrl/client.h>
  9. namespace gl {
  10. class GL_EXPORT GLFenceWin : public GLFence {
  11. public:
  12. static std::unique_ptr<GLFenceWin> CreateForGpuFence();
  13. static std::unique_ptr<GLFenceWin> CreateForGpuFence(ID3D11Device*);
  14. static std::unique_ptr<GLFenceWin> CreateFromGpuFence(
  15. const gfx::GpuFence& gpu_fence);
  16. static std::unique_ptr<GLFenceWin> CreateFromGpuFence(
  17. ID3D11Device*,
  18. const gfx::GpuFence& gpu_fence);
  19. static bool IsSupported();
  20. GLFenceWin(Microsoft::WRL::ComPtr<ID3D11Fence> d3d11_fence,
  21. gfx::GpuFenceHandle gpu_fence_handle);
  22. ~GLFenceWin() override;
  23. bool HasCompleted() override;
  24. void ClientWait() override;
  25. void ServerWait() override;
  26. std::unique_ptr<gfx::GpuFence> GetGpuFence() override;
  27. private:
  28. Microsoft::WRL::ComPtr<ID3D11Fence> d3d11_fence_;
  29. gfx::GpuFenceHandle gpu_fence_handle_;
  30. };
  31. } // namespace gl
  32. #endif // UI_GL_GL_FENCE_WIN_H_