rendering_device_driver.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  1. /**************************************************************************/
  2. /* rendering_device_driver.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. #pragma once
  31. // ***********************************************************************************
  32. // RenderingDeviceDriver - Design principles
  33. // -----------------------------------------
  34. // - Very little validation is done, and normally only in dev or debug builds.
  35. // - Error reporting is generally simple: returning an id of 0 or a false boolean.
  36. // - Certain enums/constants/structs follow Vulkan values/layout. That makes things easier for RDDVulkan (it asserts compatibility).
  37. // - We allocate as little as possible in functions expected to be quick (a counterexample is loading/saving shaders) and use alloca() whenever suitable.
  38. // - We try to back opaque ids with the native ones or memory addresses.
  39. // - When using bookkeeping structures because the actual API id of a resource is not enough, we use a PagedAllocator.
  40. // - Every struct has default initializers.
  41. // - Using VectorView to take array-like arguments. Vector<uint8_t> is an exception (an indiom for "BLOB").
  42. // - If a driver needs some higher-level information (the kind of info RenderingDevice keeps), it shall store a copy of what it needs.
  43. // There's no backwards communication from the driver to query data from RenderingDevice.
  44. // ***********************************************************************************
  45. #include "core/object/object.h"
  46. #include "core/variant/type_info.h"
  47. #include "servers/rendering/rendering_context_driver.h"
  48. #include "servers/rendering/rendering_device_commons.h"
  49. #include "servers/rendering/rendering_shader_container.h"
  50. // These utilities help drivers avoid allocations.
  51. #define ALLOCA(m_size) ((m_size != 0) ? alloca(m_size) : nullptr)
  52. #define ALLOCA_ARRAY(m_type, m_count) ((m_type *)ALLOCA(sizeof(m_type) * (m_count)))
  53. #define ALLOCA_SINGLE(m_type) ALLOCA_ARRAY(m_type, 1)
  54. // This helps forwarding certain arrays to the API with confidence.
  55. #define ARRAYS_COMPATIBLE(m_type_a, m_type_b) (sizeof(m_type_a) == sizeof(m_type_b) && alignof(m_type_a) == alignof(m_type_b))
  56. // This is used when you also need to ensure structured types are compatible field-by-field.
  57. // TODO: The fieldwise check is unimplemented, but still this one is useful, as a strong annotation about the needs.
  58. #define ARRAYS_COMPATIBLE_FIELDWISE(m_type_a, m_type_b) ARRAYS_COMPATIBLE(m_type_a, m_type_b)
  59. // Another utility, to make it easy to compare members of different enums, which is not fine with some compilers.
  60. #define ENUM_MEMBERS_EQUAL(m_a, m_b) ((int64_t)m_a == (int64_t)m_b)
  61. // This helps using a single paged allocator for many resource types.
  62. template <typename... RESOURCE_TYPES>
  63. struct VersatileResourceTemplate {
  64. static constexpr size_t RESOURCE_SIZES[] = { sizeof(RESOURCE_TYPES)... };
  65. static constexpr size_t MAX_RESOURCE_SIZE = std::max_element(RESOURCE_SIZES, RESOURCE_SIZES + sizeof...(RESOURCE_TYPES))[0];
  66. uint8_t data[MAX_RESOURCE_SIZE];
  67. template <typename T>
  68. static T *allocate(PagedAllocator<VersatileResourceTemplate, true> &p_allocator) {
  69. T *obj = (T *)p_allocator.alloc();
  70. memnew_placement(obj, T);
  71. return obj;
  72. }
  73. template <typename T>
  74. static void free(PagedAllocator<VersatileResourceTemplate, true> &p_allocator, T *p_object) {
  75. p_object->~T();
  76. p_allocator.free((VersatileResourceTemplate *)p_object);
  77. }
  78. };
  79. class RenderingDeviceDriver : public RenderingDeviceCommons {
  80. public:
  81. struct ID {
  82. uint64_t id = 0;
  83. _ALWAYS_INLINE_ ID() = default;
  84. _ALWAYS_INLINE_ ID(uint64_t p_id) :
  85. id(p_id) {}
  86. };
  87. #define DEFINE_ID(m_name) \
  88. struct m_name##ID : public ID { \
  89. _ALWAYS_INLINE_ explicit operator bool() const { \
  90. return id != 0; \
  91. } \
  92. _ALWAYS_INLINE_ m_name##ID &operator=(m_name##ID p_other) { \
  93. id = p_other.id; \
  94. return *this; \
  95. } \
  96. _ALWAYS_INLINE_ bool operator<(const m_name##ID &p_other) const { \
  97. return id < p_other.id; \
  98. } \
  99. _ALWAYS_INLINE_ bool operator==(const m_name##ID &p_other) const { \
  100. return id == p_other.id; \
  101. } \
  102. _ALWAYS_INLINE_ bool operator!=(const m_name##ID &p_other) const { \
  103. return id != p_other.id; \
  104. } \
  105. _ALWAYS_INLINE_ m_name##ID(const m_name##ID &p_other) : ID(p_other.id) {} \
  106. _ALWAYS_INLINE_ explicit m_name##ID(uint64_t p_int) : ID(p_int) {} \
  107. _ALWAYS_INLINE_ explicit m_name##ID(void *p_ptr) : ID((uint64_t)p_ptr) {} \
  108. _ALWAYS_INLINE_ m_name##ID() = default; \
  109. };
  110. // Id types declared before anything else to prevent cyclic dependencies between the different concerns.
  111. DEFINE_ID(Buffer);
  112. DEFINE_ID(Texture);
  113. DEFINE_ID(Sampler);
  114. DEFINE_ID(VertexFormat);
  115. DEFINE_ID(CommandQueue);
  116. DEFINE_ID(CommandQueueFamily);
  117. DEFINE_ID(CommandPool);
  118. DEFINE_ID(CommandBuffer);
  119. DEFINE_ID(SwapChain);
  120. DEFINE_ID(Framebuffer);
  121. DEFINE_ID(Shader);
  122. DEFINE_ID(UniformSet);
  123. DEFINE_ID(Pipeline);
  124. DEFINE_ID(RenderPass);
  125. DEFINE_ID(QueryPool);
  126. DEFINE_ID(Fence);
  127. DEFINE_ID(Semaphore);
  128. public:
  129. /*****************/
  130. /**** GENERIC ****/
  131. /*****************/
  132. virtual Error initialize(uint32_t p_device_index, uint32_t p_frame_count) = 0;
  133. /****************/
  134. /**** MEMORY ****/
  135. /****************/
  136. enum MemoryAllocationType {
  137. MEMORY_ALLOCATION_TYPE_CPU, // For images, CPU allocation also means linear, GPU is tiling optimal.
  138. MEMORY_ALLOCATION_TYPE_GPU,
  139. };
  140. /*****************/
  141. /**** BUFFERS ****/
  142. /*****************/
  143. enum BufferUsageBits {
  144. BUFFER_USAGE_TRANSFER_FROM_BIT = (1 << 0),
  145. BUFFER_USAGE_TRANSFER_TO_BIT = (1 << 1),
  146. BUFFER_USAGE_TEXEL_BIT = (1 << 2),
  147. BUFFER_USAGE_UNIFORM_BIT = (1 << 4),
  148. BUFFER_USAGE_STORAGE_BIT = (1 << 5),
  149. BUFFER_USAGE_INDEX_BIT = (1 << 6),
  150. BUFFER_USAGE_VERTEX_BIT = (1 << 7),
  151. BUFFER_USAGE_INDIRECT_BIT = (1 << 8),
  152. BUFFER_USAGE_DEVICE_ADDRESS_BIT = (1 << 17),
  153. };
  154. enum {
  155. BUFFER_WHOLE_SIZE = ~0ULL
  156. };
  157. virtual BufferID buffer_create(uint64_t p_size, BitField<BufferUsageBits> p_usage, MemoryAllocationType p_allocation_type) = 0;
  158. // Only for a buffer with BUFFER_USAGE_TEXEL_BIT.
  159. virtual bool buffer_set_texel_format(BufferID p_buffer, DataFormat p_format) = 0;
  160. virtual void buffer_free(BufferID p_buffer) = 0;
  161. virtual uint64_t buffer_get_allocation_size(BufferID p_buffer) = 0;
  162. virtual uint8_t *buffer_map(BufferID p_buffer) = 0;
  163. virtual void buffer_unmap(BufferID p_buffer) = 0;
  164. // Only for a buffer with BUFFER_USAGE_DEVICE_ADDRESS_BIT.
  165. virtual uint64_t buffer_get_device_address(BufferID p_buffer) = 0;
  166. /*****************/
  167. /**** TEXTURE ****/
  168. /*****************/
  169. struct TextureView {
  170. DataFormat format = DATA_FORMAT_MAX;
  171. TextureSwizzle swizzle_r = TEXTURE_SWIZZLE_R;
  172. TextureSwizzle swizzle_g = TEXTURE_SWIZZLE_G;
  173. TextureSwizzle swizzle_b = TEXTURE_SWIZZLE_B;
  174. TextureSwizzle swizzle_a = TEXTURE_SWIZZLE_A;
  175. };
  176. enum TextureLayout {
  177. TEXTURE_LAYOUT_UNDEFINED,
  178. TEXTURE_LAYOUT_GENERAL,
  179. TEXTURE_LAYOUT_STORAGE_OPTIMAL,
  180. TEXTURE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
  181. TEXTURE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
  182. TEXTURE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL,
  183. TEXTURE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
  184. TEXTURE_LAYOUT_COPY_SRC_OPTIMAL,
  185. TEXTURE_LAYOUT_COPY_DST_OPTIMAL,
  186. TEXTURE_LAYOUT_RESOLVE_SRC_OPTIMAL,
  187. TEXTURE_LAYOUT_RESOLVE_DST_OPTIMAL,
  188. TEXTURE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL,
  189. TEXTURE_LAYOUT_FRAGMENT_DENSITY_MAP_ATTACHMENT_OPTIMAL,
  190. TEXTURE_LAYOUT_MAX
  191. };
  192. enum TextureAspect {
  193. TEXTURE_ASPECT_COLOR = 0,
  194. TEXTURE_ASPECT_DEPTH = 1,
  195. TEXTURE_ASPECT_STENCIL = 2,
  196. TEXTURE_ASPECT_MAX
  197. };
  198. enum TextureUsageMethod {
  199. TEXTURE_USAGE_VRS_FRAGMENT_SHADING_RATE_BIT = TEXTURE_USAGE_MAX_BIT << 1,
  200. TEXTURE_USAGE_VRS_FRAGMENT_DENSITY_MAP_BIT = TEXTURE_USAGE_MAX_BIT << 2,
  201. };
  202. enum TextureAspectBits {
  203. TEXTURE_ASPECT_COLOR_BIT = (1 << TEXTURE_ASPECT_COLOR),
  204. TEXTURE_ASPECT_DEPTH_BIT = (1 << TEXTURE_ASPECT_DEPTH),
  205. TEXTURE_ASPECT_STENCIL_BIT = (1 << TEXTURE_ASPECT_STENCIL),
  206. };
  207. struct TextureSubresource {
  208. TextureAspect aspect = TEXTURE_ASPECT_COLOR;
  209. uint32_t layer = 0;
  210. uint32_t mipmap = 0;
  211. };
  212. struct TextureSubresourceLayers {
  213. BitField<TextureAspectBits> aspect = {};
  214. uint32_t mipmap = 0;
  215. uint32_t base_layer = 0;
  216. uint32_t layer_count = 0;
  217. };
  218. struct TextureSubresourceRange {
  219. BitField<TextureAspectBits> aspect = {};
  220. uint32_t base_mipmap = 0;
  221. uint32_t mipmap_count = 0;
  222. uint32_t base_layer = 0;
  223. uint32_t layer_count = 0;
  224. };
  225. struct TextureCopyableLayout {
  226. uint64_t offset = 0;
  227. uint64_t size = 0;
  228. uint64_t row_pitch = 0;
  229. uint64_t depth_pitch = 0;
  230. uint64_t layer_pitch = 0;
  231. };
  232. virtual TextureID texture_create(const TextureFormat &p_format, const TextureView &p_view) = 0;
  233. virtual TextureID texture_create_from_extension(uint64_t p_native_texture, TextureType p_type, DataFormat p_format, uint32_t p_array_layers, bool p_depth_stencil, uint32_t p_mipmaps) = 0;
  234. // texture_create_shared_*() can only use original, non-view textures as original. RenderingDevice is responsible for ensuring that.
  235. virtual TextureID texture_create_shared(TextureID p_original_texture, const TextureView &p_view) = 0;
  236. virtual TextureID texture_create_shared_from_slice(TextureID p_original_texture, const TextureView &p_view, TextureSliceType p_slice_type, uint32_t p_layer, uint32_t p_layers, uint32_t p_mipmap, uint32_t p_mipmaps) = 0;
  237. virtual void texture_free(TextureID p_texture) = 0;
  238. virtual uint64_t texture_get_allocation_size(TextureID p_texture) = 0;
  239. virtual void texture_get_copyable_layout(TextureID p_texture, const TextureSubresource &p_subresource, TextureCopyableLayout *r_layout) = 0;
  240. virtual uint8_t *texture_map(TextureID p_texture, const TextureSubresource &p_subresource) = 0;
  241. virtual void texture_unmap(TextureID p_texture) = 0;
  242. virtual BitField<TextureUsageBits> texture_get_usages_supported_by_format(DataFormat p_format, bool p_cpu_readable) = 0;
  243. virtual bool texture_can_make_shared_with_format(TextureID p_texture, DataFormat p_format, bool &r_raw_reinterpretation) = 0;
  244. /*****************/
  245. /**** SAMPLER ****/
  246. /*****************/
  247. virtual SamplerID sampler_create(const SamplerState &p_state) = 0;
  248. virtual void sampler_free(SamplerID p_sampler) = 0;
  249. virtual bool sampler_is_format_supported_for_filter(DataFormat p_format, SamplerFilter p_filter) = 0;
  250. /**********************/
  251. /**** VERTEX ARRAY ****/
  252. /**********************/
  253. virtual VertexFormatID vertex_format_create(VectorView<VertexAttribute> p_vertex_attribs) = 0;
  254. virtual void vertex_format_free(VertexFormatID p_vertex_format) = 0;
  255. /******************/
  256. /**** BARRIERS ****/
  257. /******************/
  258. enum PipelineStageBits {
  259. PIPELINE_STAGE_TOP_OF_PIPE_BIT = (1 << 0),
  260. PIPELINE_STAGE_DRAW_INDIRECT_BIT = (1 << 1),
  261. PIPELINE_STAGE_VERTEX_INPUT_BIT = (1 << 2),
  262. PIPELINE_STAGE_VERTEX_SHADER_BIT = (1 << 3),
  263. PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = (1 << 4),
  264. PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = (1 << 5),
  265. PIPELINE_STAGE_GEOMETRY_SHADER_BIT = (1 << 6),
  266. PIPELINE_STAGE_FRAGMENT_SHADER_BIT = (1 << 7),
  267. PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = (1 << 8),
  268. PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = (1 << 9),
  269. PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = (1 << 10),
  270. PIPELINE_STAGE_COMPUTE_SHADER_BIT = (1 << 11),
  271. PIPELINE_STAGE_COPY_BIT = (1 << 12),
  272. PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = (1 << 13),
  273. PIPELINE_STAGE_RESOLVE_BIT = (1 << 14),
  274. PIPELINE_STAGE_ALL_GRAPHICS_BIT = (1 << 15),
  275. PIPELINE_STAGE_ALL_COMMANDS_BIT = (1 << 16),
  276. PIPELINE_STAGE_CLEAR_STORAGE_BIT = (1 << 17),
  277. PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT = (1 << 22),
  278. PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT = (1 << 23),
  279. };
  280. enum BarrierAccessBits {
  281. BARRIER_ACCESS_INDIRECT_COMMAND_READ_BIT = (1 << 0),
  282. BARRIER_ACCESS_INDEX_READ_BIT = (1 << 1),
  283. BARRIER_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = (1 << 2),
  284. BARRIER_ACCESS_UNIFORM_READ_BIT = (1 << 3),
  285. BARRIER_ACCESS_INPUT_ATTACHMENT_READ_BIT = (1 << 4),
  286. BARRIER_ACCESS_SHADER_READ_BIT = (1 << 5),
  287. BARRIER_ACCESS_SHADER_WRITE_BIT = (1 << 6),
  288. BARRIER_ACCESS_COLOR_ATTACHMENT_READ_BIT = (1 << 7),
  289. BARRIER_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = (1 << 8),
  290. BARRIER_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = (1 << 9),
  291. BARRIER_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = (1 << 10),
  292. BARRIER_ACCESS_COPY_READ_BIT = (1 << 11),
  293. BARRIER_ACCESS_COPY_WRITE_BIT = (1 << 12),
  294. BARRIER_ACCESS_HOST_READ_BIT = (1 << 13),
  295. BARRIER_ACCESS_HOST_WRITE_BIT = (1 << 14),
  296. BARRIER_ACCESS_MEMORY_READ_BIT = (1 << 15),
  297. BARRIER_ACCESS_MEMORY_WRITE_BIT = (1 << 16),
  298. BARRIER_ACCESS_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT = (1 << 23),
  299. BARRIER_ACCESS_FRAGMENT_DENSITY_MAP_ATTACHMENT_READ_BIT = (1 << 24),
  300. BARRIER_ACCESS_RESOLVE_READ_BIT = (1 << 25),
  301. BARRIER_ACCESS_RESOLVE_WRITE_BIT = (1 << 26),
  302. BARRIER_ACCESS_STORAGE_CLEAR_BIT = (1 << 27),
  303. };
  304. // https://github.com/godotengine/godot/pull/110360 - "MemoryBarrier" conflicts with Windows header defines
  305. struct MemoryAccessBarrier {
  306. BitField<BarrierAccessBits> src_access = {};
  307. BitField<BarrierAccessBits> dst_access = {};
  308. };
  309. struct BufferBarrier {
  310. BufferID buffer;
  311. BitField<BarrierAccessBits> src_access = {};
  312. BitField<BarrierAccessBits> dst_access = {};
  313. uint64_t offset = 0;
  314. uint64_t size = 0;
  315. };
  316. struct TextureBarrier {
  317. TextureID texture;
  318. BitField<BarrierAccessBits> src_access = {};
  319. BitField<BarrierAccessBits> dst_access = {};
  320. TextureLayout prev_layout = TEXTURE_LAYOUT_UNDEFINED;
  321. TextureLayout next_layout = TEXTURE_LAYOUT_UNDEFINED;
  322. TextureSubresourceRange subresources;
  323. };
  324. virtual void command_pipeline_barrier(
  325. CommandBufferID p_cmd_buffer,
  326. BitField<PipelineStageBits> p_src_stages,
  327. BitField<PipelineStageBits> p_dst_stages,
  328. VectorView<MemoryAccessBarrier> p_memory_barriers,
  329. VectorView<BufferBarrier> p_buffer_barriers,
  330. VectorView<TextureBarrier> p_texture_barriers) = 0;
  331. /****************/
  332. /**** FENCES ****/
  333. /****************/
  334. virtual FenceID fence_create() = 0;
  335. virtual Error fence_wait(FenceID p_fence) = 0;
  336. virtual void fence_free(FenceID p_fence) = 0;
  337. /********************/
  338. /**** SEMAPHORES ****/
  339. /********************/
  340. virtual SemaphoreID semaphore_create() = 0;
  341. virtual void semaphore_free(SemaphoreID p_semaphore) = 0;
  342. /*************************/
  343. /**** COMMAND BUFFERS ****/
  344. /*************************/
  345. // ----- QUEUE FAMILY -----
  346. enum CommandQueueFamilyBits {
  347. COMMAND_QUEUE_FAMILY_GRAPHICS_BIT = 0x1,
  348. COMMAND_QUEUE_FAMILY_COMPUTE_BIT = 0x2,
  349. COMMAND_QUEUE_FAMILY_TRANSFER_BIT = 0x4
  350. };
  351. // The requested command queue family must support all specified bits or it'll fail to return a valid family otherwise. If a valid surface is specified, the queue must support presenting to it.
  352. // It is valid to specify no bits and a valid surface: in this case, the dedicated presentation queue family will be the preferred option.
  353. virtual CommandQueueFamilyID command_queue_family_get(BitField<CommandQueueFamilyBits> p_cmd_queue_family_bits, RenderingContextDriver::SurfaceID p_surface = 0) = 0;
  354. // ----- QUEUE -----
  355. virtual CommandQueueID command_queue_create(CommandQueueFamilyID p_cmd_queue_family, bool p_identify_as_main_queue = false) = 0;
  356. virtual Error command_queue_execute_and_present(CommandQueueID p_cmd_queue, VectorView<SemaphoreID> p_wait_semaphores, VectorView<CommandBufferID> p_cmd_buffers, VectorView<SemaphoreID> p_cmd_semaphores, FenceID p_cmd_fence, VectorView<SwapChainID> p_swap_chains) = 0;
  357. virtual void command_queue_free(CommandQueueID p_cmd_queue) = 0;
  358. // ----- POOL -----
  359. enum CommandBufferType {
  360. COMMAND_BUFFER_TYPE_PRIMARY,
  361. COMMAND_BUFFER_TYPE_SECONDARY,
  362. };
  363. virtual CommandPoolID command_pool_create(CommandQueueFamilyID p_cmd_queue_family, CommandBufferType p_cmd_buffer_type) = 0;
  364. virtual bool command_pool_reset(CommandPoolID p_cmd_pool) = 0;
  365. virtual void command_pool_free(CommandPoolID p_cmd_pool) = 0;
  366. // ----- BUFFER -----
  367. virtual CommandBufferID command_buffer_create(CommandPoolID p_cmd_pool) = 0;
  368. virtual bool command_buffer_begin(CommandBufferID p_cmd_buffer) = 0;
  369. virtual bool command_buffer_begin_secondary(CommandBufferID p_cmd_buffer, RenderPassID p_render_pass, uint32_t p_subpass, FramebufferID p_framebuffer) = 0;
  370. virtual void command_buffer_end(CommandBufferID p_cmd_buffer) = 0;
  371. virtual void command_buffer_execute_secondary(CommandBufferID p_cmd_buffer, VectorView<CommandBufferID> p_secondary_cmd_buffers) = 0;
  372. /********************/
  373. /**** SWAP CHAIN ****/
  374. /********************/
  375. // The swap chain won't be valid for use until it is resized at least once.
  376. virtual SwapChainID swap_chain_create(RenderingContextDriver::SurfaceID p_surface) = 0;
  377. // The swap chain must not be in use when a resize is requested. Wait until all rendering associated to the swap chain is finished before resizing it.
  378. virtual Error swap_chain_resize(CommandQueueID p_cmd_queue, SwapChainID p_swap_chain, uint32_t p_desired_framebuffer_count) = 0;
  379. // Acquire the framebuffer that can be used for drawing. This must be called only once every time a new frame will be rendered.
  380. virtual FramebufferID swap_chain_acquire_framebuffer(CommandQueueID p_cmd_queue, SwapChainID p_swap_chain, bool &r_resize_required) = 0;
  381. // Retrieve the render pass that can be used to draw on the swap chain's framebuffers.
  382. virtual RenderPassID swap_chain_get_render_pass(SwapChainID p_swap_chain) = 0;
  383. // Retrieve the rotation in degrees to apply as a pre-transform. Usually 0 on PC. May be 0, 90, 180 & 270 on Android.
  384. virtual int swap_chain_get_pre_rotation_degrees(SwapChainID p_swap_chain) { return 0; }
  385. // Retrieve the format used by the swap chain's framebuffers.
  386. virtual DataFormat swap_chain_get_format(SwapChainID p_swap_chain) = 0;
  387. // Tells the swapchain the max_fps so it can use the proper frame pacing.
  388. // Android uses this with Swappy library. Some implementations or platforms may ignore this hint.
  389. virtual void swap_chain_set_max_fps(SwapChainID p_swap_chain, int p_max_fps) {}
  390. // Wait until all rendering associated to the swap chain is finished before deleting it.
  391. virtual void swap_chain_free(SwapChainID p_swap_chain) = 0;
  392. /*********************/
  393. /**** FRAMEBUFFER ****/
  394. /*********************/
  395. virtual FramebufferID framebuffer_create(RenderPassID p_render_pass, VectorView<TextureID> p_attachments, uint32_t p_width, uint32_t p_height) = 0;
  396. virtual void framebuffer_free(FramebufferID p_framebuffer) = 0;
  397. /****************/
  398. /**** SHADER ****/
  399. /****************/
  400. struct ImmutableSampler {
  401. UniformType type = UNIFORM_TYPE_MAX;
  402. uint32_t binding = 0xffffffff; // Binding index as specified in shader.
  403. LocalVector<ID> ids;
  404. };
  405. // Creates a Pipeline State Object (PSO) out of the shader and all the input data it needs.
  406. // Immutable samplers can be embedded when creating the pipeline layout on the condition they remain valid and unchanged, so they don't need to be
  407. // specified when creating uniform sets PSO resource for binding.
  408. virtual ShaderID shader_create_from_container(const Ref<RenderingShaderContainer> &p_shader_container, const Vector<ImmutableSampler> &p_immutable_samplers) = 0;
  409. // Only meaningful if API_TRAIT_SHADER_CHANGE_INVALIDATION is SHADER_CHANGE_INVALIDATION_ALL_OR_NONE_ACCORDING_TO_LAYOUT_HASH.
  410. virtual uint32_t shader_get_layout_hash(ShaderID p_shader) { return 0; }
  411. virtual void shader_free(ShaderID p_shader) = 0;
  412. virtual void shader_destroy_modules(ShaderID p_shader) = 0;
  413. public:
  414. /*********************/
  415. /**** UNIFORM SET ****/
  416. /*********************/
  417. struct BoundUniform {
  418. UniformType type = UNIFORM_TYPE_MAX;
  419. uint32_t binding = 0xffffffff; // Binding index as specified in shader.
  420. LocalVector<ID> ids;
  421. // Flag to indicate that this is an immutable sampler so it is skipped when creating uniform
  422. // sets, as it would be set previously when creating the pipeline layout.
  423. bool immutable_sampler = false;
  424. };
  425. virtual UniformSetID uniform_set_create(VectorView<BoundUniform> p_uniforms, ShaderID p_shader, uint32_t p_set_index, int p_linear_pool_index) = 0;
  426. virtual void linear_uniform_set_pools_reset(int p_linear_pool_index) {}
  427. virtual void uniform_set_free(UniformSetID p_uniform_set) = 0;
  428. virtual bool uniform_sets_have_linear_pools() const { return false; }
  429. // ----- COMMANDS -----
  430. virtual void command_uniform_set_prepare_for_use(CommandBufferID p_cmd_buffer, UniformSetID p_uniform_set, ShaderID p_shader, uint32_t p_set_index) = 0;
  431. /******************/
  432. /**** TRANSFER ****/
  433. /******************/
  434. struct BufferCopyRegion {
  435. uint64_t src_offset = 0;
  436. uint64_t dst_offset = 0;
  437. uint64_t size = 0;
  438. };
  439. struct TextureCopyRegion {
  440. TextureSubresourceLayers src_subresources;
  441. Vector3i src_offset;
  442. TextureSubresourceLayers dst_subresources;
  443. Vector3i dst_offset;
  444. Vector3i size;
  445. };
  446. struct BufferTextureCopyRegion {
  447. uint64_t buffer_offset = 0;
  448. TextureSubresourceLayers texture_subresources;
  449. Vector3i texture_offset;
  450. Vector3i texture_region_size;
  451. };
  452. virtual void command_clear_buffer(CommandBufferID p_cmd_buffer, BufferID p_buffer, uint64_t p_offset, uint64_t p_size) = 0;
  453. virtual void command_copy_buffer(CommandBufferID p_cmd_buffer, BufferID p_src_buffer, BufferID p_dst_buffer, VectorView<BufferCopyRegion> p_regions) = 0;
  454. virtual void command_copy_texture(CommandBufferID p_cmd_buffer, TextureID p_src_texture, TextureLayout p_src_texture_layout, TextureID p_dst_texture, TextureLayout p_dst_texture_layout, VectorView<TextureCopyRegion> p_regions) = 0;
  455. virtual void command_resolve_texture(CommandBufferID p_cmd_buffer, TextureID p_src_texture, TextureLayout p_src_texture_layout, uint32_t p_src_layer, uint32_t p_src_mipmap, TextureID p_dst_texture, TextureLayout p_dst_texture_layout, uint32_t p_dst_layer, uint32_t p_dst_mipmap) = 0;
  456. virtual void command_clear_color_texture(CommandBufferID p_cmd_buffer, TextureID p_texture, TextureLayout p_texture_layout, const Color &p_color, const TextureSubresourceRange &p_subresources) = 0;
  457. virtual void command_copy_buffer_to_texture(CommandBufferID p_cmd_buffer, BufferID p_src_buffer, TextureID p_dst_texture, TextureLayout p_dst_texture_layout, VectorView<BufferTextureCopyRegion> p_regions) = 0;
  458. virtual void command_copy_texture_to_buffer(CommandBufferID p_cmd_buffer, TextureID p_src_texture, TextureLayout p_src_texture_layout, BufferID p_dst_buffer, VectorView<BufferTextureCopyRegion> p_regions) = 0;
  459. /******************/
  460. /**** PIPELINE ****/
  461. /******************/
  462. virtual void pipeline_free(PipelineID p_pipeline) = 0;
  463. // ----- BINDING -----
  464. virtual void command_bind_push_constants(CommandBufferID p_cmd_buffer, ShaderID p_shader, uint32_t p_first_index, VectorView<uint32_t> p_data) = 0;
  465. // ----- CACHE -----
  466. virtual bool pipeline_cache_create(const Vector<uint8_t> &p_data) = 0;
  467. virtual void pipeline_cache_free() = 0;
  468. virtual size_t pipeline_cache_query_size() = 0;
  469. virtual Vector<uint8_t> pipeline_cache_serialize() = 0;
  470. /*******************/
  471. /**** RENDERING ****/
  472. /*******************/
  473. // ----- SUBPASS -----
  474. enum AttachmentLoadOp {
  475. ATTACHMENT_LOAD_OP_LOAD = 0,
  476. ATTACHMENT_LOAD_OP_CLEAR = 1,
  477. ATTACHMENT_LOAD_OP_DONT_CARE = 2,
  478. };
  479. enum AttachmentStoreOp {
  480. ATTACHMENT_STORE_OP_STORE = 0,
  481. ATTACHMENT_STORE_OP_DONT_CARE = 1,
  482. };
  483. struct Attachment {
  484. DataFormat format = DATA_FORMAT_MAX;
  485. TextureSamples samples = TEXTURE_SAMPLES_MAX;
  486. AttachmentLoadOp load_op = ATTACHMENT_LOAD_OP_DONT_CARE;
  487. AttachmentStoreOp store_op = ATTACHMENT_STORE_OP_DONT_CARE;
  488. AttachmentLoadOp stencil_load_op = ATTACHMENT_LOAD_OP_DONT_CARE;
  489. AttachmentStoreOp stencil_store_op = ATTACHMENT_STORE_OP_DONT_CARE;
  490. TextureLayout initial_layout = TEXTURE_LAYOUT_UNDEFINED;
  491. TextureLayout final_layout = TEXTURE_LAYOUT_UNDEFINED;
  492. };
  493. struct AttachmentReference {
  494. static constexpr uint32_t UNUSED = 0xffffffff;
  495. uint32_t attachment = UNUSED;
  496. TextureLayout layout = TEXTURE_LAYOUT_UNDEFINED;
  497. BitField<TextureAspectBits> aspect = {};
  498. };
  499. struct Subpass {
  500. LocalVector<AttachmentReference> input_references;
  501. LocalVector<AttachmentReference> color_references;
  502. AttachmentReference depth_stencil_reference;
  503. LocalVector<AttachmentReference> resolve_references;
  504. LocalVector<uint32_t> preserve_attachments;
  505. AttachmentReference fragment_shading_rate_reference;
  506. Size2i fragment_shading_rate_texel_size;
  507. };
  508. struct SubpassDependency {
  509. uint32_t src_subpass = 0xffffffff;
  510. uint32_t dst_subpass = 0xffffffff;
  511. BitField<PipelineStageBits> src_stages = {};
  512. BitField<PipelineStageBits> dst_stages = {};
  513. BitField<BarrierAccessBits> src_access = {};
  514. BitField<BarrierAccessBits> dst_access = {};
  515. };
  516. virtual RenderPassID render_pass_create(VectorView<Attachment> p_attachments, VectorView<Subpass> p_subpasses, VectorView<SubpassDependency> p_subpass_dependencies, uint32_t p_view_count, AttachmentReference p_fragment_density_map_attachment) = 0;
  517. virtual void render_pass_free(RenderPassID p_render_pass) = 0;
  518. // ----- COMMANDS -----
  519. union RenderPassClearValue {
  520. Color color = {};
  521. struct {
  522. float depth;
  523. uint32_t stencil;
  524. };
  525. RenderPassClearValue() {}
  526. };
  527. struct AttachmentClear {
  528. BitField<TextureAspectBits> aspect = {};
  529. uint32_t color_attachment = 0xffffffff;
  530. RenderPassClearValue value;
  531. };
  532. virtual void command_begin_render_pass(CommandBufferID p_cmd_buffer, RenderPassID p_render_pass, FramebufferID p_framebuffer, CommandBufferType p_cmd_buffer_type, const Rect2i &p_rect, VectorView<RenderPassClearValue> p_clear_values) = 0;
  533. virtual void command_end_render_pass(CommandBufferID p_cmd_buffer) = 0;
  534. virtual void command_next_render_subpass(CommandBufferID p_cmd_buffer, CommandBufferType p_cmd_buffer_type) = 0;
  535. virtual void command_render_set_viewport(CommandBufferID p_cmd_buffer, VectorView<Rect2i> p_viewports) = 0;
  536. virtual void command_render_set_scissor(CommandBufferID p_cmd_buffer, VectorView<Rect2i> p_scissors) = 0;
  537. virtual void command_render_clear_attachments(CommandBufferID p_cmd_buffer, VectorView<AttachmentClear> p_attachment_clears, VectorView<Rect2i> p_rects) = 0;
  538. // Binding.
  539. virtual void command_bind_render_pipeline(CommandBufferID p_cmd_buffer, PipelineID p_pipeline) = 0;
  540. virtual void command_bind_render_uniform_set(CommandBufferID p_cmd_buffer, UniformSetID p_uniform_set, ShaderID p_shader, uint32_t p_set_index) = 0;
  541. virtual void command_bind_render_uniform_sets(CommandBufferID p_cmd_buffer, VectorView<UniformSetID> p_uniform_sets, ShaderID p_shader, uint32_t p_first_set_index, uint32_t p_set_count) = 0;
  542. // Drawing.
  543. virtual void command_render_draw(CommandBufferID p_cmd_buffer, uint32_t p_vertex_count, uint32_t p_instance_count, uint32_t p_base_vertex, uint32_t p_first_instance) = 0;
  544. virtual void command_render_draw_indexed(CommandBufferID p_cmd_buffer, uint32_t p_index_count, uint32_t p_instance_count, uint32_t p_first_index, int32_t p_vertex_offset, uint32_t p_first_instance) = 0;
  545. virtual void command_render_draw_indexed_indirect(CommandBufferID p_cmd_buffer, BufferID p_indirect_buffer, uint64_t p_offset, uint32_t p_draw_count, uint32_t p_stride) = 0;
  546. virtual void command_render_draw_indexed_indirect_count(CommandBufferID p_cmd_buffer, BufferID p_indirect_buffer, uint64_t p_offset, BufferID p_count_buffer, uint64_t p_count_buffer_offset, uint32_t p_max_draw_count, uint32_t p_stride) = 0;
  547. virtual void command_render_draw_indirect(CommandBufferID p_cmd_buffer, BufferID p_indirect_buffer, uint64_t p_offset, uint32_t p_draw_count, uint32_t p_stride) = 0;
  548. virtual void command_render_draw_indirect_count(CommandBufferID p_cmd_buffer, BufferID p_indirect_buffer, uint64_t p_offset, BufferID p_count_buffer, uint64_t p_count_buffer_offset, uint32_t p_max_draw_count, uint32_t p_stride) = 0;
  549. // Buffer binding.
  550. virtual void command_render_bind_vertex_buffers(CommandBufferID p_cmd_buffer, uint32_t p_binding_count, const BufferID *p_buffers, const uint64_t *p_offsets) = 0;
  551. virtual void command_render_bind_index_buffer(CommandBufferID p_cmd_buffer, BufferID p_buffer, IndexBufferFormat p_format, uint64_t p_offset) = 0;
  552. // Dynamic state.
  553. virtual void command_render_set_blend_constants(CommandBufferID p_cmd_buffer, const Color &p_constants) = 0;
  554. virtual void command_render_set_line_width(CommandBufferID p_cmd_buffer, float p_width) = 0;
  555. // ----- PIPELINE -----
  556. virtual PipelineID render_pipeline_create(
  557. ShaderID p_shader,
  558. VertexFormatID p_vertex_format,
  559. RenderPrimitive p_render_primitive,
  560. PipelineRasterizationState p_rasterization_state,
  561. PipelineMultisampleState p_multisample_state,
  562. PipelineDepthStencilState p_depth_stencil_state,
  563. PipelineColorBlendState p_blend_state,
  564. VectorView<int32_t> p_color_attachments,
  565. BitField<PipelineDynamicStateFlags> p_dynamic_state,
  566. RenderPassID p_render_pass,
  567. uint32_t p_render_subpass,
  568. VectorView<PipelineSpecializationConstant> p_specialization_constants) = 0;
  569. /*****************/
  570. /**** COMPUTE ****/
  571. /*****************/
  572. // ----- COMMANDS -----
  573. // Binding.
  574. virtual void command_bind_compute_pipeline(CommandBufferID p_cmd_buffer, PipelineID p_pipeline) = 0;
  575. virtual void command_bind_compute_uniform_set(CommandBufferID p_cmd_buffer, UniformSetID p_uniform_set, ShaderID p_shader, uint32_t p_set_index) = 0;
  576. virtual void command_bind_compute_uniform_sets(CommandBufferID p_cmd_buffer, VectorView<UniformSetID> p_uniform_sets, ShaderID p_shader, uint32_t p_first_set_index, uint32_t p_set_count) = 0;
  577. // Dispatching.
  578. virtual void command_compute_dispatch(CommandBufferID p_cmd_buffer, uint32_t p_x_groups, uint32_t p_y_groups, uint32_t p_z_groups) = 0;
  579. virtual void command_compute_dispatch_indirect(CommandBufferID p_cmd_buffer, BufferID p_indirect_buffer, uint64_t p_offset) = 0;
  580. // ----- PIPELINE -----
  581. virtual PipelineID compute_pipeline_create(ShaderID p_shader, VectorView<PipelineSpecializationConstant> p_specialization_constants) = 0;
  582. /******************/
  583. /**** CALLBACK ****/
  584. /******************/
  585. typedef void (*DriverCallback)(RenderingDeviceDriver *p_driver, CommandBufferID p_command_buffer, void *p_userdata);
  586. /*****************/
  587. /**** QUERIES ****/
  588. /*****************/
  589. // ----- TIMESTAMP -----
  590. // Basic.
  591. virtual QueryPoolID timestamp_query_pool_create(uint32_t p_query_count) = 0;
  592. virtual void timestamp_query_pool_free(QueryPoolID p_pool_id) = 0;
  593. virtual void timestamp_query_pool_get_results(QueryPoolID p_pool_id, uint32_t p_query_count, uint64_t *r_results) = 0;
  594. virtual uint64_t timestamp_query_result_to_time(uint64_t p_result) = 0;
  595. // Commands.
  596. virtual void command_timestamp_query_pool_reset(CommandBufferID p_cmd_buffer, QueryPoolID p_pool_id, uint32_t p_query_count) = 0;
  597. virtual void command_timestamp_write(CommandBufferID p_cmd_buffer, QueryPoolID p_pool_id, uint32_t p_index) = 0;
  598. /****************/
  599. /**** LABELS ****/
  600. /****************/
  601. virtual void command_begin_label(CommandBufferID p_cmd_buffer, const char *p_label_name, const Color &p_color) = 0;
  602. virtual void command_end_label(CommandBufferID p_cmd_buffer) = 0;
  603. /****************/
  604. /**** DEBUG *****/
  605. /****************/
  606. virtual void command_insert_breadcrumb(CommandBufferID p_cmd_buffer, uint32_t p_data) = 0;
  607. /********************/
  608. /**** SUBMISSION ****/
  609. /********************/
  610. virtual void begin_segment(uint32_t p_frame_index, uint32_t p_frames_drawn) = 0;
  611. virtual void end_segment() = 0;
  612. /**************/
  613. /**** MISC ****/
  614. /**************/
  615. enum ObjectType {
  616. OBJECT_TYPE_TEXTURE,
  617. OBJECT_TYPE_SAMPLER,
  618. OBJECT_TYPE_BUFFER,
  619. OBJECT_TYPE_SHADER,
  620. OBJECT_TYPE_UNIFORM_SET,
  621. OBJECT_TYPE_PIPELINE,
  622. };
  623. struct MultiviewCapabilities {
  624. bool is_supported = false;
  625. bool geometry_shader_is_supported = false;
  626. bool tessellation_shader_is_supported = false;
  627. uint32_t max_view_count = 0;
  628. uint32_t max_instance_count = 0;
  629. };
  630. struct FragmentShadingRateCapabilities {
  631. Size2i min_texel_size;
  632. Size2i max_texel_size;
  633. Size2i max_fragment_size;
  634. bool pipeline_supported = false;
  635. bool primitive_supported = false;
  636. bool attachment_supported = false;
  637. };
  638. struct FragmentDensityMapCapabilities {
  639. Size2i min_texel_size;
  640. Size2i max_texel_size;
  641. Size2i offset_granularity;
  642. bool attachment_supported = false;
  643. bool dynamic_attachment_supported = false;
  644. bool non_subsampled_images_supported = false;
  645. bool invocations_supported = false;
  646. bool offset_supported = false;
  647. };
  648. enum ApiTrait {
  649. API_TRAIT_HONORS_PIPELINE_BARRIERS,
  650. API_TRAIT_SHADER_CHANGE_INVALIDATION,
  651. API_TRAIT_TEXTURE_TRANSFER_ALIGNMENT,
  652. API_TRAIT_TEXTURE_DATA_ROW_PITCH_STEP,
  653. API_TRAIT_SECONDARY_VIEWPORT_SCISSOR,
  654. API_TRAIT_CLEARS_WITH_COPY_ENGINE,
  655. API_TRAIT_USE_GENERAL_IN_COPY_QUEUES,
  656. API_TRAIT_BUFFERS_REQUIRE_TRANSITIONS,
  657. };
  658. enum ShaderChangeInvalidation {
  659. SHADER_CHANGE_INVALIDATION_ALL_BOUND_UNIFORM_SETS,
  660. // What Vulkan does.
  661. SHADER_CHANGE_INVALIDATION_INCOMPATIBLE_SETS_PLUS_CASCADE,
  662. // What D3D12 does.
  663. SHADER_CHANGE_INVALIDATION_ALL_OR_NONE_ACCORDING_TO_LAYOUT_HASH,
  664. };
  665. enum DeviceFamily {
  666. DEVICE_UNKNOWN,
  667. DEVICE_OPENGL,
  668. DEVICE_VULKAN,
  669. DEVICE_DIRECTX,
  670. DEVICE_METAL,
  671. };
  672. struct Capabilities {
  673. DeviceFamily device_family = DEVICE_UNKNOWN;
  674. uint32_t version_major = 1;
  675. uint32_t version_minor = 0;
  676. };
  677. virtual void set_object_name(ObjectType p_type, ID p_driver_id, const String &p_name) = 0;
  678. virtual uint64_t get_resource_native_handle(DriverResource p_type, ID p_driver_id) = 0;
  679. virtual uint64_t get_total_memory_used() = 0;
  680. virtual uint64_t get_lazily_memory_used() = 0;
  681. virtual uint64_t limit_get(Limit p_limit) = 0;
  682. virtual uint64_t api_trait_get(ApiTrait p_trait);
  683. virtual bool has_feature(Features p_feature) = 0;
  684. virtual const MultiviewCapabilities &get_multiview_capabilities() = 0;
  685. virtual const FragmentShadingRateCapabilities &get_fragment_shading_rate_capabilities() = 0;
  686. virtual const FragmentDensityMapCapabilities &get_fragment_density_map_capabilities() = 0;
  687. virtual String get_api_name() const = 0;
  688. virtual String get_api_version() const = 0;
  689. virtual String get_pipeline_cache_uuid() const = 0;
  690. virtual const Capabilities &get_capabilities() const = 0;
  691. virtual const RenderingShaderContainerFormat &get_shader_container_format() const = 0;
  692. virtual bool is_composite_alpha_supported(CommandQueueID p_queue) const { return false; }
  693. /******************/
  694. virtual ~RenderingDeviceDriver();
  695. };
  696. using RDD = RenderingDeviceDriver;