api_context_rd.h 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /**************************************************************************/
  2. /* api_context_rd.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef API_CONTEXT_RD_H
  31. #define API_CONTEXT_RD_H
  32. #include "servers/rendering/rendering_device.h"
  33. #include "servers/rendering/rendering_device_driver.h"
  34. class ApiContextRD {
  35. public:
  36. virtual const char *get_api_name() const = 0;
  37. virtual RenderingDevice::Capabilities get_device_capabilities() const = 0;
  38. virtual const RDD::MultiviewCapabilities &get_multiview_capabilities() const = 0;
  39. virtual int get_swapchain_image_count() const = 0;
  40. virtual Error window_create(DisplayServer::WindowID p_window_id, DisplayServer::VSyncMode p_vsync_mode, int p_width, int p_height, const void *p_platform_data) = 0;
  41. virtual void window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height) = 0;
  42. virtual int window_get_width(DisplayServer::WindowID p_window = 0) = 0;
  43. virtual int window_get_height(DisplayServer::WindowID p_window = 0) = 0;
  44. virtual bool window_is_valid_swapchain(DisplayServer::WindowID p_window = 0) = 0;
  45. virtual void window_destroy(DisplayServer::WindowID p_window_id) = 0;
  46. virtual RDD::RenderPassID window_get_render_pass(DisplayServer::WindowID p_window = 0) = 0;
  47. virtual RDD::FramebufferID window_get_framebuffer(DisplayServer::WindowID p_window = 0) = 0;
  48. virtual RID local_device_create() = 0;
  49. virtual void local_device_push_command_buffers(RID p_local_device, const RDD::CommandBufferID *p_buffers, int p_count) = 0;
  50. virtual void local_device_sync(RID p_local_device) = 0;
  51. virtual void local_device_free(RID p_local_device) = 0;
  52. virtual void set_setup_buffer(RDD::CommandBufferID p_command_buffer) = 0;
  53. virtual void append_command_buffer(RDD::CommandBufferID p_command_buffer) = 0;
  54. virtual void flush(bool p_flush_setup = false, bool p_flush_pending = false, bool p_sync = true) = 0;
  55. virtual Error prepare_buffers(RDD::CommandBufferID p_command_buffer) = 0;
  56. virtual void postpare_buffers(RDD::CommandBufferID p_command_buffer) = 0;
  57. virtual Error swap_buffers() = 0;
  58. virtual Error initialize() = 0;
  59. virtual String get_device_vendor_name() const = 0;
  60. virtual String get_device_name() const = 0;
  61. virtual RDD::DeviceType get_device_type() const = 0;
  62. virtual String get_device_api_version() const = 0;
  63. virtual String get_device_pipeline_cache_uuid() const = 0;
  64. virtual void set_vsync_mode(DisplayServer::WindowID p_window, DisplayServer::VSyncMode p_mode) = 0;
  65. virtual DisplayServer::VSyncMode get_vsync_mode(DisplayServer::WindowID p_window = 0) const = 0;
  66. virtual RenderingDeviceDriver *get_driver(RID p_local_device = RID()) = 0;
  67. virtual bool is_debug_utils_enabled() const = 0;
  68. virtual ~ApiContextRD();
  69. };
  70. #endif // API_CONTEXT_RD_H