vulkan_surface_win32.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 GPU_VULKAN_WIN32_VULKAN_SURFACE_WIN32_H_
  5. #define GPU_VULKAN_WIN32_VULKAN_SURFACE_WIN32_H_
  6. #include <vulkan/vulkan_core.h>
  7. #include "base/component_export.h"
  8. #include "base/types/pass_key.h"
  9. #include "gpu/vulkan/vulkan_surface.h"
  10. namespace gfx {
  11. class WindowImpl;
  12. }
  13. namespace gpu {
  14. class COMPONENT_EXPORT(VULKAN_WIN32) VulkanSurfaceWin32 : public VulkanSurface {
  15. public:
  16. static std::unique_ptr<VulkanSurfaceWin32> Create(VkInstance vk_instance,
  17. HWND parent_window);
  18. class WindowThread;
  19. VulkanSurfaceWin32(base::PassKey<VulkanSurfaceWin32> pass_key,
  20. VkInstance vk_instance,
  21. VkSurfaceKHR vk_surface,
  22. scoped_refptr<WindowThread> thread,
  23. std::unique_ptr<gfx::WindowImpl> window);
  24. ~VulkanSurfaceWin32() override;
  25. VulkanSurfaceWin32(const VulkanSurfaceWin32&) = delete;
  26. VulkanSurfaceWin32& operator=(const VulkanSurfaceWin32&) = delete;
  27. private:
  28. // VulkanSurface:
  29. bool Reshape(const gfx::Size& size,
  30. gfx::OverlayTransform pre_transform) override;
  31. // The thread for running message loop of child |window_|.
  32. // All VulkanSurfaceWin32 share one thread. The thread will be destroyed with
  33. // the last VulkanSurfaceWin32.
  34. scoped_refptr<WindowThread> thread_;
  35. std::unique_ptr<gfx::WindowImpl> window_;
  36. };
  37. } // namespace gpu
  38. #endif // GPU_VULKAN_WIN32_VULKAN_SURFACE_WIN32_H_