MetalContext.h 789 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #if !defined(AK_OS_MACOS)
  8. static_assert(false, "This file must only be used for macOS");
  9. #endif
  10. #include <AK/Forward.h>
  11. #include <LibCore/IOSurface.h>
  12. namespace Core {
  13. class MetalTexture {
  14. public:
  15. virtual void const* texture() const = 0;
  16. virtual size_t width() const = 0;
  17. virtual size_t height() const = 0;
  18. virtual ~MetalTexture() {};
  19. };
  20. class MetalContext {
  21. public:
  22. virtual void const* device() const = 0;
  23. virtual void const* queue() const = 0;
  24. virtual OwnPtr<MetalTexture> create_texture_from_iosurface(IOSurfaceHandle const&) = 0;
  25. virtual ~MetalContext() {};
  26. };
  27. OwnPtr<MetalContext> get_metal_context();
  28. }