| 1 | /**************************************************************************/ | 
|---|
| 2 | /*  texture_storage.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 |  | 
|---|
| 31 | #ifndef TEXTURE_STORAGE_RD_H | 
|---|
| 32 | #define TEXTURE_STORAGE_RD_H | 
|---|
| 33 |  | 
|---|
| 34 | #include "core/templates/local_vector.h" | 
|---|
| 35 | #include "core/templates/paged_array.h" | 
|---|
| 36 | #include "core/templates/rid_owner.h" | 
|---|
| 37 | #include "servers/rendering/renderer_rd/shaders/canvas_sdf.glsl.gen.h" | 
|---|
| 38 | #include "servers/rendering/renderer_rd/storage_rd/forward_id_storage.h" | 
|---|
| 39 | #include "servers/rendering/rendering_server_default.h" | 
|---|
| 40 | #include "servers/rendering/storage/texture_storage.h" | 
|---|
| 41 | #include "servers/rendering/storage/utilities.h" | 
|---|
| 42 |  | 
|---|
| 43 | namespace RendererRD { | 
|---|
| 44 |  | 
|---|
| 45 | class LightStorage; | 
|---|
| 46 | class MaterialStorage; | 
|---|
| 47 |  | 
|---|
| 48 | class TextureStorage : public RendererTextureStorage { | 
|---|
| 49 | public: | 
|---|
| 50 | enum DefaultRDTexture { | 
|---|
| 51 | DEFAULT_RD_TEXTURE_WHITE, | 
|---|
| 52 | DEFAULT_RD_TEXTURE_BLACK, | 
|---|
| 53 | DEFAULT_RD_TEXTURE_TRANSPARENT, | 
|---|
| 54 | DEFAULT_RD_TEXTURE_NORMAL, | 
|---|
| 55 | DEFAULT_RD_TEXTURE_ANISO, | 
|---|
| 56 | DEFAULT_RD_TEXTURE_DEPTH, | 
|---|
| 57 | DEFAULT_RD_TEXTURE_MULTIMESH_BUFFER, | 
|---|
| 58 | DEFAULT_RD_TEXTURE_CUBEMAP_BLACK, | 
|---|
| 59 | DEFAULT_RD_TEXTURE_CUBEMAP_ARRAY_BLACK, | 
|---|
| 60 | DEFAULT_RD_TEXTURE_CUBEMAP_WHITE, | 
|---|
| 61 | DEFAULT_RD_TEXTURE_CUBEMAP_ARRAY_WHITE, | 
|---|
| 62 | DEFAULT_RD_TEXTURE_3D_WHITE, | 
|---|
| 63 | DEFAULT_RD_TEXTURE_3D_BLACK, | 
|---|
| 64 | DEFAULT_RD_TEXTURE_2D_ARRAY_WHITE, | 
|---|
| 65 | DEFAULT_RD_TEXTURE_2D_ARRAY_BLACK, | 
|---|
| 66 | DEFAULT_RD_TEXTURE_2D_ARRAY_NORMAL, | 
|---|
| 67 | DEFAULT_RD_TEXTURE_2D_ARRAY_DEPTH, | 
|---|
| 68 | DEFAULT_RD_TEXTURE_2D_UINT, | 
|---|
| 69 | DEFAULT_RD_TEXTURE_VRS, | 
|---|
| 70 | DEFAULT_RD_TEXTURE_MAX | 
|---|
| 71 | }; | 
|---|
| 72 |  | 
|---|
| 73 | enum TextureType { | 
|---|
| 74 | TYPE_2D, | 
|---|
| 75 | TYPE_LAYERED, | 
|---|
| 76 | TYPE_3D | 
|---|
| 77 | }; | 
|---|
| 78 |  | 
|---|
| 79 | private: | 
|---|
| 80 | friend class LightStorage; | 
|---|
| 81 | friend class MaterialStorage; | 
|---|
| 82 |  | 
|---|
| 83 | static TextureStorage *singleton; | 
|---|
| 84 |  | 
|---|
| 85 | RID default_rd_textures[DEFAULT_RD_TEXTURE_MAX]; | 
|---|
| 86 |  | 
|---|
| 87 | /* Canvas Texture API */ | 
|---|
| 88 |  | 
|---|
| 89 | class CanvasTexture { | 
|---|
| 90 | public: | 
|---|
| 91 | RID diffuse; | 
|---|
| 92 | RID normal_map; | 
|---|
| 93 | RID specular; | 
|---|
| 94 | Color specular_color = Color(1, 1, 1, 1); | 
|---|
| 95 | float shininess = 1.0; | 
|---|
| 96 |  | 
|---|
| 97 | RS::CanvasItemTextureFilter texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT; | 
|---|
| 98 | RS::CanvasItemTextureRepeat texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT; | 
|---|
| 99 | RID uniform_sets[RS::CANVAS_ITEM_TEXTURE_FILTER_MAX][RS::CANVAS_ITEM_TEXTURE_REPEAT_MAX][2]; | 
|---|
| 100 |  | 
|---|
| 101 | Size2i size_cache = Size2i(1, 1); | 
|---|
| 102 | bool use_normal_cache = false; | 
|---|
| 103 | bool use_specular_cache = false; | 
|---|
| 104 | bool cleared_cache = true; | 
|---|
| 105 |  | 
|---|
| 106 | void clear_sets(); | 
|---|
| 107 | ~CanvasTexture(); | 
|---|
| 108 | }; | 
|---|
| 109 |  | 
|---|
| 110 | RID_Owner<CanvasTexture, true> canvas_texture_owner; | 
|---|
| 111 |  | 
|---|
| 112 | /* Texture API */ | 
|---|
| 113 |  | 
|---|
| 114 | struct RenderTarget; | 
|---|
| 115 |  | 
|---|
| 116 | class Texture { | 
|---|
| 117 | public: | 
|---|
| 118 | TextureType type; | 
|---|
| 119 | RS::TextureLayeredType layered_type = RS::TEXTURE_LAYERED_2D_ARRAY; | 
|---|
| 120 |  | 
|---|
| 121 | RenderingDevice::TextureType rd_type; | 
|---|
| 122 | RID rd_texture; | 
|---|
| 123 | RID rd_texture_srgb; | 
|---|
| 124 | RenderingDevice::DataFormat rd_format; | 
|---|
| 125 | RenderingDevice::DataFormat rd_format_srgb; | 
|---|
| 126 |  | 
|---|
| 127 | RD::TextureView rd_view; | 
|---|
| 128 |  | 
|---|
| 129 | Image::Format format; | 
|---|
| 130 | Image::Format validated_format; | 
|---|
| 131 |  | 
|---|
| 132 | int width; | 
|---|
| 133 | int height; | 
|---|
| 134 | int depth; | 
|---|
| 135 | int layers; | 
|---|
| 136 | int mipmaps; | 
|---|
| 137 |  | 
|---|
| 138 | int height_2d; | 
|---|
| 139 | int width_2d; | 
|---|
| 140 |  | 
|---|
| 141 | struct BufferSlice3D { | 
|---|
| 142 | Size2i size; | 
|---|
| 143 | uint32_t offset = 0; | 
|---|
| 144 | uint32_t buffer_size = 0; | 
|---|
| 145 | }; | 
|---|
| 146 | Vector<BufferSlice3D> buffer_slices_3d; | 
|---|
| 147 | uint32_t buffer_size_3d = 0; | 
|---|
| 148 |  | 
|---|
| 149 | RenderTarget *render_target = nullptr; | 
|---|
| 150 | bool is_render_target; | 
|---|
| 151 | bool is_proxy; | 
|---|
| 152 |  | 
|---|
| 153 | Ref<Image> image_cache_2d; | 
|---|
| 154 | String path; | 
|---|
| 155 |  | 
|---|
| 156 | RID proxy_to; | 
|---|
| 157 | Vector<RID> proxies; | 
|---|
| 158 |  | 
|---|
| 159 | HashSet<RID> lightmap_users; | 
|---|
| 160 |  | 
|---|
| 161 | RS::TextureDetectCallback detect_3d_callback = nullptr; | 
|---|
| 162 | void *detect_3d_callback_ud = nullptr; | 
|---|
| 163 |  | 
|---|
| 164 | RS::TextureDetectCallback detect_normal_callback = nullptr; | 
|---|
| 165 | void *detect_normal_callback_ud = nullptr; | 
|---|
| 166 |  | 
|---|
| 167 | RS::TextureDetectRoughnessCallback detect_roughness_callback = nullptr; | 
|---|
| 168 | void *detect_roughness_callback_ud = nullptr; | 
|---|
| 169 |  | 
|---|
| 170 | CanvasTexture *canvas_texture = nullptr; | 
|---|
| 171 |  | 
|---|
| 172 | void cleanup(); | 
|---|
| 173 | }; | 
|---|
| 174 |  | 
|---|
| 175 | //textures can be created from threads, so this RID_Owner is thread safe | 
|---|
| 176 | mutable RID_Owner<Texture, true> texture_owner; | 
|---|
| 177 | Texture *get_texture(RID p_rid) { return texture_owner.get_or_null(p_rid); }; | 
|---|
| 178 |  | 
|---|
| 179 | struct TextureToRDFormat { | 
|---|
| 180 | RD::DataFormat format; | 
|---|
| 181 | RD::DataFormat format_srgb; | 
|---|
| 182 | RD::TextureSwizzle swizzle_r; | 
|---|
| 183 | RD::TextureSwizzle swizzle_g; | 
|---|
| 184 | RD::TextureSwizzle swizzle_b; | 
|---|
| 185 | RD::TextureSwizzle swizzle_a; | 
|---|
| 186 | TextureToRDFormat() { | 
|---|
| 187 | format = RD::DATA_FORMAT_MAX; | 
|---|
| 188 | format_srgb = RD::DATA_FORMAT_MAX; | 
|---|
| 189 | swizzle_r = RD::TEXTURE_SWIZZLE_R; | 
|---|
| 190 | swizzle_g = RD::TEXTURE_SWIZZLE_G; | 
|---|
| 191 | swizzle_b = RD::TEXTURE_SWIZZLE_B; | 
|---|
| 192 | swizzle_a = RD::TEXTURE_SWIZZLE_A; | 
|---|
| 193 | } | 
|---|
| 194 | }; | 
|---|
| 195 |  | 
|---|
| 196 | Ref<Image> _validate_texture_format(const Ref<Image> &p_image, TextureToRDFormat &r_format); | 
|---|
| 197 | void _texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer = 0, bool p_immediate = false); | 
|---|
| 198 |  | 
|---|
| 199 | struct TextureFromRDFormat { | 
|---|
| 200 | Image::Format image_format; | 
|---|
| 201 | RD::DataFormat rd_format; | 
|---|
| 202 | RD::DataFormat rd_format_srgb; | 
|---|
| 203 | RD::TextureSwizzle swizzle_r; | 
|---|
| 204 | RD::TextureSwizzle swizzle_g; | 
|---|
| 205 | RD::TextureSwizzle swizzle_b; | 
|---|
| 206 | RD::TextureSwizzle swizzle_a; | 
|---|
| 207 | TextureFromRDFormat() { | 
|---|
| 208 | image_format = Image::FORMAT_MAX; | 
|---|
| 209 | rd_format = RD::DATA_FORMAT_MAX; | 
|---|
| 210 | rd_format_srgb = RD::DATA_FORMAT_MAX; | 
|---|
| 211 | swizzle_r = RD::TEXTURE_SWIZZLE_R; | 
|---|
| 212 | swizzle_g = RD::TEXTURE_SWIZZLE_G; | 
|---|
| 213 | swizzle_b = RD::TEXTURE_SWIZZLE_B; | 
|---|
| 214 | swizzle_a = RD::TEXTURE_SWIZZLE_A; | 
|---|
| 215 | } | 
|---|
| 216 | }; | 
|---|
| 217 |  | 
|---|
| 218 | void _texture_format_from_rd(RD::DataFormat p_rd_format, TextureFromRDFormat &r_format); | 
|---|
| 219 |  | 
|---|
| 220 | /* DECAL API */ | 
|---|
| 221 |  | 
|---|
| 222 | struct DecalAtlas { | 
|---|
| 223 | struct Texture { | 
|---|
| 224 | int panorama_to_dp_users; | 
|---|
| 225 | int users; | 
|---|
| 226 | Rect2 uv_rect; | 
|---|
| 227 | }; | 
|---|
| 228 |  | 
|---|
| 229 | struct SortItem { | 
|---|
| 230 | RID texture; | 
|---|
| 231 | Size2i pixel_size; | 
|---|
| 232 | Size2i size; | 
|---|
| 233 | Point2i pos; | 
|---|
| 234 |  | 
|---|
| 235 | bool operator<(const SortItem &p_item) const { | 
|---|
| 236 | //sort larger to smaller | 
|---|
| 237 | if (size.height == p_item.size.height) { | 
|---|
| 238 | return size.width > p_item.size.width; | 
|---|
| 239 | } else { | 
|---|
| 240 | return size.height > p_item.size.height; | 
|---|
| 241 | } | 
|---|
| 242 | } | 
|---|
| 243 | }; | 
|---|
| 244 |  | 
|---|
| 245 | HashMap<RID, Texture> textures; | 
|---|
| 246 | bool dirty = true; | 
|---|
| 247 | int mipmaps = 5; | 
|---|
| 248 |  | 
|---|
| 249 | RID texture; | 
|---|
| 250 | RID texture_srgb; | 
|---|
| 251 | struct MipMap { | 
|---|
| 252 | RID fb; | 
|---|
| 253 | RID texture; | 
|---|
| 254 | Size2i size; | 
|---|
| 255 | }; | 
|---|
| 256 | Vector<MipMap> texture_mipmaps; | 
|---|
| 257 |  | 
|---|
| 258 | Size2i size; | 
|---|
| 259 | } decal_atlas; | 
|---|
| 260 |  | 
|---|
| 261 | struct Decal { | 
|---|
| 262 | Vector3 size = Vector3(2, 2, 2); | 
|---|
| 263 | RID textures[RS::DECAL_TEXTURE_MAX]; | 
|---|
| 264 | float emission_energy = 1.0; | 
|---|
| 265 | float albedo_mix = 1.0; | 
|---|
| 266 | Color modulate = Color(1, 1, 1, 1); | 
|---|
| 267 | uint32_t cull_mask = (1 << 20) - 1; | 
|---|
| 268 | float upper_fade = 0.3; | 
|---|
| 269 | float lower_fade = 0.3; | 
|---|
| 270 | bool distance_fade = false; | 
|---|
| 271 | float distance_fade_begin = 40.0; | 
|---|
| 272 | float distance_fade_length = 10.0; | 
|---|
| 273 | float normal_fade = 0.0; | 
|---|
| 274 |  | 
|---|
| 275 | Dependency dependency; | 
|---|
| 276 | }; | 
|---|
| 277 |  | 
|---|
| 278 | mutable RID_Owner<Decal, true> decal_owner; | 
|---|
| 279 |  | 
|---|
| 280 | /* DECAL INSTANCE */ | 
|---|
| 281 |  | 
|---|
| 282 | struct DecalInstance { | 
|---|
| 283 | RID decal; | 
|---|
| 284 | Transform3D transform; | 
|---|
| 285 | float sorting_offset = 0.0; | 
|---|
| 286 | uint32_t cull_mask = 0; | 
|---|
| 287 | RendererRD::ForwardID forward_id = -1; | 
|---|
| 288 | }; | 
|---|
| 289 |  | 
|---|
| 290 | mutable RID_Owner<DecalInstance> decal_instance_owner; | 
|---|
| 291 |  | 
|---|
| 292 | /* DECAL DATA (UBO) */ | 
|---|
| 293 |  | 
|---|
| 294 | struct DecalData { | 
|---|
| 295 | float xform[16]; | 
|---|
| 296 | float inv_extents[3]; | 
|---|
| 297 | float albedo_mix; | 
|---|
| 298 | float albedo_rect[4]; | 
|---|
| 299 | float normal_rect[4]; | 
|---|
| 300 | float orm_rect[4]; | 
|---|
| 301 | float emission_rect[4]; | 
|---|
| 302 | float modulate[4]; | 
|---|
| 303 | float emission_energy; | 
|---|
| 304 | uint32_t mask; | 
|---|
| 305 | float upper_fade; | 
|---|
| 306 | float lower_fade; | 
|---|
| 307 | float normal_xform[12]; | 
|---|
| 308 | float normal[3]; | 
|---|
| 309 | float normal_fade; | 
|---|
| 310 | }; | 
|---|
| 311 |  | 
|---|
| 312 | struct DecalInstanceSort { | 
|---|
| 313 | float depth; | 
|---|
| 314 | DecalInstance *decal_instance; | 
|---|
| 315 | Decal *decal; | 
|---|
| 316 | bool operator<(const DecalInstanceSort &p_sort) const { | 
|---|
| 317 | return depth < p_sort.depth; | 
|---|
| 318 | } | 
|---|
| 319 | }; | 
|---|
| 320 |  | 
|---|
| 321 | uint32_t max_decals = 0; | 
|---|
| 322 | uint32_t decal_count = 0; | 
|---|
| 323 | DecalData *decals = nullptr; | 
|---|
| 324 | DecalInstanceSort *decal_sort = nullptr; | 
|---|
| 325 | RID decal_buffer; | 
|---|
| 326 |  | 
|---|
| 327 | /* RENDER TARGET API */ | 
|---|
| 328 |  | 
|---|
| 329 | struct RenderTarget { | 
|---|
| 330 | Size2i size; | 
|---|
| 331 | uint32_t view_count; | 
|---|
| 332 | RID color; | 
|---|
| 333 | Vector<RID> color_slices; | 
|---|
| 334 | RID color_multisample; // Needed when MSAA is enabled. | 
|---|
| 335 |  | 
|---|
| 336 | RS::ViewportMSAA msaa = RS::VIEWPORT_MSAA_DISABLED; | 
|---|
| 337 |  | 
|---|
| 338 | //used for retrieving from CPU | 
|---|
| 339 | RD::DataFormat color_format = RD::DATA_FORMAT_R4G4_UNORM_PACK8; | 
|---|
| 340 | RD::DataFormat color_format_srgb = RD::DATA_FORMAT_R4G4_UNORM_PACK8; | 
|---|
| 341 | Image::Format image_format = Image::FORMAT_L8; | 
|---|
| 342 |  | 
|---|
| 343 | bool is_transparent = false; | 
|---|
| 344 | bool use_hdr = false; | 
|---|
| 345 |  | 
|---|
| 346 | bool sdf_enabled = false; | 
|---|
| 347 |  | 
|---|
| 348 | RID backbuffer; //used for effects | 
|---|
| 349 | RID backbuffer_fb; | 
|---|
| 350 | RID backbuffer_mipmap0; | 
|---|
| 351 |  | 
|---|
| 352 | Vector<RID> backbuffer_mipmaps; | 
|---|
| 353 |  | 
|---|
| 354 | RID framebuffer_uniform_set; | 
|---|
| 355 | RID backbuffer_uniform_set; | 
|---|
| 356 |  | 
|---|
| 357 | RID sdf_buffer_write; | 
|---|
| 358 | RID sdf_buffer_write_fb; | 
|---|
| 359 | RID sdf_buffer_process[2]; | 
|---|
| 360 | RID sdf_buffer_read; | 
|---|
| 361 | RID sdf_buffer_process_uniform_sets[2]; | 
|---|
| 362 | RS::ViewportSDFOversize sdf_oversize = RS::VIEWPORT_SDF_OVERSIZE_120_PERCENT; | 
|---|
| 363 | RS::ViewportSDFScale sdf_scale = RS::VIEWPORT_SDF_SCALE_50_PERCENT; | 
|---|
| 364 | Size2i process_size; | 
|---|
| 365 |  | 
|---|
| 366 | // VRS | 
|---|
| 367 | RS::ViewportVRSMode vrs_mode = RS::VIEWPORT_VRS_DISABLED; | 
|---|
| 368 | RID vrs_texture; | 
|---|
| 369 |  | 
|---|
| 370 | // overridden textures | 
|---|
| 371 | struct RTOverridden { | 
|---|
| 372 | RID color; | 
|---|
| 373 | RID depth; | 
|---|
| 374 | RID velocity; | 
|---|
| 375 |  | 
|---|
| 376 | // In a multiview scenario, which is the most likely where we | 
|---|
| 377 | // override our destination textures, we need to obtain slices | 
|---|
| 378 | // for each layer of these textures. | 
|---|
| 379 | // These are likely changing every frame as we loop through | 
|---|
| 380 | // texture chains hence we add a cache to manage these slices. | 
|---|
| 381 | // For this we define a key using the RID of the texture and | 
|---|
| 382 | // the layer for which we create a slice. | 
|---|
| 383 | struct SliceKey { | 
|---|
| 384 | RID rid; | 
|---|
| 385 | uint32_t layer = 0; | 
|---|
| 386 |  | 
|---|
| 387 | bool operator==(const SliceKey &p_val) const { | 
|---|
| 388 | return (rid == p_val.rid) && (layer == p_val.layer); | 
|---|
| 389 | } | 
|---|
| 390 |  | 
|---|
| 391 | static uint32_t hash(const SliceKey &p_val) { | 
|---|
| 392 | uint32_t h = hash_one_uint64(p_val.rid.get_id()); | 
|---|
| 393 | h = hash_murmur3_one_32(p_val.layer, h); | 
|---|
| 394 | return hash_fmix32(h); | 
|---|
| 395 | } | 
|---|
| 396 |  | 
|---|
| 397 | SliceKey() {} | 
|---|
| 398 | SliceKey(RID p_rid, uint32_t p_layer) { | 
|---|
| 399 | rid = p_rid; | 
|---|
| 400 | layer = p_layer; | 
|---|
| 401 | } | 
|---|
| 402 | }; | 
|---|
| 403 |  | 
|---|
| 404 | mutable HashMap<SliceKey, RID, SliceKey> cached_slices; | 
|---|
| 405 | } overridden; | 
|---|
| 406 |  | 
|---|
| 407 | //texture generated for this owner (nor RD). | 
|---|
| 408 | RID texture; | 
|---|
| 409 | bool was_used; | 
|---|
| 410 |  | 
|---|
| 411 | //clear request | 
|---|
| 412 | bool clear_requested; | 
|---|
| 413 | Color clear_color; | 
|---|
| 414 |  | 
|---|
| 415 | RID get_framebuffer(); | 
|---|
| 416 | }; | 
|---|
| 417 |  | 
|---|
| 418 | mutable RID_Owner<RenderTarget> render_target_owner; | 
|---|
| 419 | RenderTarget *get_render_target(RID p_rid) const { return render_target_owner.get_or_null(p_rid); }; | 
|---|
| 420 |  | 
|---|
| 421 | void _clear_render_target(RenderTarget *rt); | 
|---|
| 422 | void _update_render_target(RenderTarget *rt); | 
|---|
| 423 | void _create_render_target_backbuffer(RenderTarget *rt); | 
|---|
| 424 | void _render_target_allocate_sdf(RenderTarget *rt); | 
|---|
| 425 | void _render_target_clear_sdf(RenderTarget *rt); | 
|---|
| 426 | Rect2i _render_target_get_sdf_rect(const RenderTarget *rt) const; | 
|---|
| 427 |  | 
|---|
| 428 | struct RenderTargetSDF { | 
|---|
| 429 | enum { | 
|---|
| 430 | SHADER_LOAD, | 
|---|
| 431 | SHADER_LOAD_SHRINK, | 
|---|
| 432 | SHADER_PROCESS, | 
|---|
| 433 | SHADER_PROCESS_OPTIMIZED, | 
|---|
| 434 | SHADER_STORE, | 
|---|
| 435 | SHADER_STORE_SHRINK, | 
|---|
| 436 | SHADER_MAX | 
|---|
| 437 | }; | 
|---|
| 438 |  | 
|---|
| 439 | struct PushConstant { | 
|---|
| 440 | int32_t size[2]; | 
|---|
| 441 | int32_t stride; | 
|---|
| 442 | int32_t shift; | 
|---|
| 443 | int32_t base_size[2]; | 
|---|
| 444 | int32_t pad[2]; | 
|---|
| 445 | }; | 
|---|
| 446 |  | 
|---|
| 447 | CanvasSdfShaderRD shader; | 
|---|
| 448 | RID shader_version; | 
|---|
| 449 | RID pipelines[SHADER_MAX]; | 
|---|
| 450 | } rt_sdf; | 
|---|
| 451 |  | 
|---|
| 452 | public: | 
|---|
| 453 | static TextureStorage *get_singleton(); | 
|---|
| 454 |  | 
|---|
| 455 | _FORCE_INLINE_ RID texture_rd_get_default(DefaultRDTexture p_texture) { | 
|---|
| 456 | return default_rd_textures[p_texture]; | 
|---|
| 457 | } | 
|---|
| 458 |  | 
|---|
| 459 | TextureStorage(); | 
|---|
| 460 | virtual ~TextureStorage(); | 
|---|
| 461 |  | 
|---|
| 462 | bool free(RID p_rid); | 
|---|
| 463 |  | 
|---|
| 464 | /* Canvas Texture API */ | 
|---|
| 465 |  | 
|---|
| 466 | bool owns_canvas_texture(RID p_rid) { return canvas_texture_owner.owns(p_rid); }; | 
|---|
| 467 |  | 
|---|
| 468 | virtual RID canvas_texture_allocate() override; | 
|---|
| 469 | virtual void canvas_texture_initialize(RID p_rid) override; | 
|---|
| 470 | virtual void canvas_texture_free(RID p_rid) override; | 
|---|
| 471 |  | 
|---|
| 472 | virtual void canvas_texture_set_channel(RID p_canvas_texture, RS::CanvasTextureChannel p_channel, RID p_texture) override; | 
|---|
| 473 | virtual void canvas_texture_set_shading_parameters(RID p_canvas_texture, const Color &p_base_color, float p_shininess) override; | 
|---|
| 474 |  | 
|---|
| 475 | virtual void canvas_texture_set_texture_filter(RID p_item, RS::CanvasItemTextureFilter p_filter) override; | 
|---|
| 476 | virtual void canvas_texture_set_texture_repeat(RID p_item, RS::CanvasItemTextureRepeat p_repeat) override; | 
|---|
| 477 |  | 
|---|
| 478 | bool canvas_texture_get_uniform_set(RID p_texture, RS::CanvasItemTextureFilter p_base_filter, RS::CanvasItemTextureRepeat p_base_repeat, RID p_base_shader, int p_base_set, bool p_use_srgb, RID &r_uniform_set, Size2i &r_size, Color &r_specular_shininess, bool &r_use_normal, bool &r_use_specular, bool p_texture_is_data); | 
|---|
| 479 |  | 
|---|
| 480 | /* Texture API */ | 
|---|
| 481 |  | 
|---|
| 482 | bool owns_texture(RID p_rid) const { return texture_owner.owns(p_rid); }; | 
|---|
| 483 |  | 
|---|
| 484 | virtual bool can_create_resources_async() const override; | 
|---|
| 485 |  | 
|---|
| 486 | virtual RID texture_allocate() override; | 
|---|
| 487 | virtual void texture_free(RID p_rid) override; | 
|---|
| 488 |  | 
|---|
| 489 | virtual void texture_2d_initialize(RID p_texture, const Ref<Image> &p_image) override; | 
|---|
| 490 | virtual void texture_2d_layered_initialize(RID p_texture, const Vector<Ref<Image>> &p_layers, RS::TextureLayeredType p_layered_type) override; | 
|---|
| 491 | virtual void texture_3d_initialize(RID p_texture, Image::Format, int p_width, int p_height, int p_depth, bool p_mipmaps, const Vector<Ref<Image>> &p_data) override; | 
|---|
| 492 | virtual void texture_proxy_initialize(RID p_texture, RID p_base) override; //all slices, then all the mipmaps, must be coherent | 
|---|
| 493 |  | 
|---|
| 494 | virtual void texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) override; | 
|---|
| 495 | virtual void texture_3d_update(RID p_texture, const Vector<Ref<Image>> &p_data) override; | 
|---|
| 496 | virtual void texture_proxy_update(RID p_proxy, RID p_base) override; | 
|---|
| 497 |  | 
|---|
| 498 | //these two APIs can be used together or in combination with the others. | 
|---|
| 499 | virtual void texture_2d_placeholder_initialize(RID p_texture) override; | 
|---|
| 500 | virtual void texture_2d_layered_placeholder_initialize(RID p_texture, RenderingServer::TextureLayeredType p_layered_type) override; | 
|---|
| 501 | virtual void texture_3d_placeholder_initialize(RID p_texture) override; | 
|---|
| 502 |  | 
|---|
| 503 | virtual Ref<Image> texture_2d_get(RID p_texture) const override; | 
|---|
| 504 | virtual Ref<Image> texture_2d_layer_get(RID p_texture, int p_layer) const override; | 
|---|
| 505 | virtual Vector<Ref<Image>> texture_3d_get(RID p_texture) const override; | 
|---|
| 506 |  | 
|---|
| 507 | virtual void texture_replace(RID p_texture, RID p_by_texture) override; | 
|---|
| 508 | virtual void texture_set_size_override(RID p_texture, int p_width, int p_height) override; | 
|---|
| 509 |  | 
|---|
| 510 | virtual void texture_set_path(RID p_texture, const String &p_path) override; | 
|---|
| 511 | virtual String texture_get_path(RID p_texture) const override; | 
|---|
| 512 |  | 
|---|
| 513 | virtual Image::Format texture_get_format(RID p_texture) const override; | 
|---|
| 514 |  | 
|---|
| 515 | virtual void texture_set_detect_3d_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) override; | 
|---|
| 516 | virtual void texture_set_detect_normal_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) override; | 
|---|
| 517 | virtual void texture_set_detect_roughness_callback(RID p_texture, RS::TextureDetectRoughnessCallback p_callback, void *p_userdata) override; | 
|---|
| 518 |  | 
|---|
| 519 | virtual void texture_debug_usage(List<RS::TextureInfo> *r_info) override; | 
|---|
| 520 |  | 
|---|
| 521 | virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) override; | 
|---|
| 522 |  | 
|---|
| 523 | virtual Size2 texture_size_with_proxy(RID p_proxy) override; | 
|---|
| 524 |  | 
|---|
| 525 | virtual void texture_rd_initialize(RID p_texture, const RID &p_rd_texture, const RS::TextureLayeredType p_layer_type = RS::TEXTURE_LAYERED_2D_ARRAY) override; | 
|---|
| 526 | virtual RID texture_get_rd_texture(RID p_texture, bool p_srgb = false) const override; | 
|---|
| 527 | virtual uint64_t texture_get_native_handle(RID p_texture, bool p_srgb = false) const override; | 
|---|
| 528 |  | 
|---|
| 529 | //internal usage | 
|---|
| 530 | _FORCE_INLINE_ TextureType texture_get_type(RID p_texture) { | 
|---|
| 531 | RendererRD::TextureStorage::Texture *tex = texture_owner.get_or_null(p_texture); | 
|---|
| 532 | if (tex == nullptr) { | 
|---|
| 533 | return TYPE_2D; | 
|---|
| 534 | } | 
|---|
| 535 |  | 
|---|
| 536 | return tex->type; | 
|---|
| 537 | } | 
|---|
| 538 |  | 
|---|
| 539 | _FORCE_INLINE_ int texture_get_layers(RID p_texture) { | 
|---|
| 540 | RendererRD::TextureStorage::Texture *tex = texture_owner.get_or_null(p_texture); | 
|---|
| 541 | if (tex == nullptr) { | 
|---|
| 542 | return 1; | 
|---|
| 543 | } | 
|---|
| 544 |  | 
|---|
| 545 | return tex->layers; | 
|---|
| 546 | } | 
|---|
| 547 |  | 
|---|
| 548 | _FORCE_INLINE_ Size2i texture_2d_get_size(RID p_texture) { | 
|---|
| 549 | if (p_texture.is_null()) { | 
|---|
| 550 | return Size2i(); | 
|---|
| 551 | } | 
|---|
| 552 | RendererRD::TextureStorage::Texture *tex = texture_owner.get_or_null(p_texture); | 
|---|
| 553 |  | 
|---|
| 554 | if (!tex) { | 
|---|
| 555 | return Size2i(); | 
|---|
| 556 | } | 
|---|
| 557 | return Size2i(tex->width_2d, tex->height_2d); | 
|---|
| 558 | } | 
|---|
| 559 |  | 
|---|
| 560 | /* DECAL API */ | 
|---|
| 561 |  | 
|---|
| 562 | void update_decal_atlas(); | 
|---|
| 563 |  | 
|---|
| 564 | bool owns_decal(RID p_rid) const { return decal_owner.owns(p_rid); }; | 
|---|
| 565 |  | 
|---|
| 566 | RID decal_atlas_get_texture() const; | 
|---|
| 567 | RID decal_atlas_get_texture_srgb() const; | 
|---|
| 568 | _FORCE_INLINE_ Rect2 decal_atlas_get_texture_rect(RID p_texture) { | 
|---|
| 569 | DecalAtlas::Texture *t = decal_atlas.textures.getptr(p_texture); | 
|---|
| 570 | if (!t) { | 
|---|
| 571 | return Rect2(); | 
|---|
| 572 | } | 
|---|
| 573 |  | 
|---|
| 574 | return t->uv_rect; | 
|---|
| 575 | } | 
|---|
| 576 |  | 
|---|
| 577 | virtual RID decal_allocate() override; | 
|---|
| 578 | virtual void decal_initialize(RID p_decal) override; | 
|---|
| 579 | virtual void decal_free(RID p_rid) override; | 
|---|
| 580 |  | 
|---|
| 581 | virtual void decal_set_size(RID p_decal, const Vector3 &p_size) override; | 
|---|
| 582 | virtual void decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) override; | 
|---|
| 583 | virtual void decal_set_emission_energy(RID p_decal, float p_energy) override; | 
|---|
| 584 | virtual void decal_set_albedo_mix(RID p_decal, float p_mix) override; | 
|---|
| 585 | virtual void decal_set_modulate(RID p_decal, const Color &p_modulate) override; | 
|---|
| 586 | virtual void decal_set_cull_mask(RID p_decal, uint32_t p_layers) override; | 
|---|
| 587 | virtual void decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) override; | 
|---|
| 588 | virtual void decal_set_fade(RID p_decal, float p_above, float p_below) override; | 
|---|
| 589 | virtual void decal_set_normal_fade(RID p_decal, float p_fade) override; | 
|---|
| 590 |  | 
|---|
| 591 | void decal_atlas_mark_dirty_on_texture(RID p_texture); | 
|---|
| 592 | void decal_atlas_remove_texture(RID p_texture); | 
|---|
| 593 |  | 
|---|
| 594 | virtual void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override; | 
|---|
| 595 | virtual void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) override; | 
|---|
| 596 |  | 
|---|
| 597 | _FORCE_INLINE_ Vector3 decal_get_size(RID p_decal) { | 
|---|
| 598 | const Decal *decal = decal_owner.get_or_null(p_decal); | 
|---|
| 599 | return decal->size; | 
|---|
| 600 | } | 
|---|
| 601 |  | 
|---|
| 602 | _FORCE_INLINE_ RID decal_get_texture(RID p_decal, RS::DecalTexture p_texture) { | 
|---|
| 603 | const Decal *decal = decal_owner.get_or_null(p_decal); | 
|---|
| 604 | return decal->textures[p_texture]; | 
|---|
| 605 | } | 
|---|
| 606 |  | 
|---|
| 607 | _FORCE_INLINE_ Color decal_get_modulate(RID p_decal) { | 
|---|
| 608 | const Decal *decal = decal_owner.get_or_null(p_decal); | 
|---|
| 609 | return decal->modulate; | 
|---|
| 610 | } | 
|---|
| 611 |  | 
|---|
| 612 | _FORCE_INLINE_ float decal_get_emission_energy(RID p_decal) { | 
|---|
| 613 | const Decal *decal = decal_owner.get_or_null(p_decal); | 
|---|
| 614 | return decal->emission_energy; | 
|---|
| 615 | } | 
|---|
| 616 |  | 
|---|
| 617 | _FORCE_INLINE_ float decal_get_albedo_mix(RID p_decal) { | 
|---|
| 618 | const Decal *decal = decal_owner.get_or_null(p_decal); | 
|---|
| 619 | return decal->albedo_mix; | 
|---|
| 620 | } | 
|---|
| 621 |  | 
|---|
| 622 | _FORCE_INLINE_ uint32_t decal_get_cull_mask(RID p_decal) { | 
|---|
| 623 | const Decal *decal = decal_owner.get_or_null(p_decal); | 
|---|
| 624 | return decal->cull_mask; | 
|---|
| 625 | } | 
|---|
| 626 |  | 
|---|
| 627 | _FORCE_INLINE_ float decal_get_upper_fade(RID p_decal) { | 
|---|
| 628 | const Decal *decal = decal_owner.get_or_null(p_decal); | 
|---|
| 629 | return decal->upper_fade; | 
|---|
| 630 | } | 
|---|
| 631 |  | 
|---|
| 632 | _FORCE_INLINE_ float decal_get_lower_fade(RID p_decal) { | 
|---|
| 633 | const Decal *decal = decal_owner.get_or_null(p_decal); | 
|---|
| 634 | return decal->lower_fade; | 
|---|
| 635 | } | 
|---|
| 636 |  | 
|---|
| 637 | _FORCE_INLINE_ float decal_get_normal_fade(RID p_decal) { | 
|---|
| 638 | const Decal *decal = decal_owner.get_or_null(p_decal); | 
|---|
| 639 | return decal->normal_fade; | 
|---|
| 640 | } | 
|---|
| 641 |  | 
|---|
| 642 | _FORCE_INLINE_ bool decal_is_distance_fade_enabled(RID p_decal) { | 
|---|
| 643 | const Decal *decal = decal_owner.get_or_null(p_decal); | 
|---|
| 644 | return decal->distance_fade; | 
|---|
| 645 | } | 
|---|
| 646 |  | 
|---|
| 647 | _FORCE_INLINE_ float decal_get_distance_fade_begin(RID p_decal) { | 
|---|
| 648 | const Decal *decal = decal_owner.get_or_null(p_decal); | 
|---|
| 649 | return decal->distance_fade_begin; | 
|---|
| 650 | } | 
|---|
| 651 |  | 
|---|
| 652 | _FORCE_INLINE_ float decal_get_distance_fade_length(RID p_decal) { | 
|---|
| 653 | const Decal *decal = decal_owner.get_or_null(p_decal); | 
|---|
| 654 | return decal->distance_fade_length; | 
|---|
| 655 | } | 
|---|
| 656 |  | 
|---|
| 657 | virtual AABB decal_get_aabb(RID p_decal) const override; | 
|---|
| 658 | virtual uint32_t decal_get_cull_mask(RID p_decal) const override; | 
|---|
| 659 | Dependency *decal_get_dependency(RID p_decal); | 
|---|
| 660 |  | 
|---|
| 661 | /* DECAL INSTANCE API */ | 
|---|
| 662 |  | 
|---|
| 663 | bool owns_decal_instance(RID p_rid) const { return decal_instance_owner.owns(p_rid); } | 
|---|
| 664 |  | 
|---|
| 665 | virtual RID decal_instance_create(RID p_decal) override; | 
|---|
| 666 | virtual void decal_instance_free(RID p_decal_instance) override; | 
|---|
| 667 | virtual void decal_instance_set_transform(RID p_decal_instance, const Transform3D &p_transform) override; | 
|---|
| 668 | virtual void decal_instance_set_sorting_offset(RID p_decal_instance, float p_sorting_offset) override; | 
|---|
| 669 |  | 
|---|
| 670 | _FORCE_INLINE_ RID decal_instance_get_base(RID p_decal_instance) const { | 
|---|
| 671 | DecalInstance *di = decal_instance_owner.get_or_null(p_decal_instance); | 
|---|
| 672 | return di->decal; | 
|---|
| 673 | } | 
|---|
| 674 |  | 
|---|
| 675 | _FORCE_INLINE_ RendererRD::ForwardID decal_instance_get_forward_id(RID p_decal_instance) const { | 
|---|
| 676 | DecalInstance *di = decal_instance_owner.get_or_null(p_decal_instance); | 
|---|
| 677 | return di->forward_id; | 
|---|
| 678 | } | 
|---|
| 679 |  | 
|---|
| 680 | _FORCE_INLINE_ Transform3D decal_instance_get_transform(RID p_decal_instance) const { | 
|---|
| 681 | DecalInstance *di = decal_instance_owner.get_or_null(p_decal_instance); | 
|---|
| 682 | return di->transform; | 
|---|
| 683 | } | 
|---|
| 684 |  | 
|---|
| 685 | _FORCE_INLINE_ ForwardID decal_instance_get_forward_id(RID p_decal_instance) { | 
|---|
| 686 | DecalInstance *di = decal_instance_owner.get_or_null(p_decal_instance); | 
|---|
| 687 | return di->forward_id; | 
|---|
| 688 | } | 
|---|
| 689 |  | 
|---|
| 690 | _FORCE_INLINE_ void decal_instance_set_cullmask(RID p_decal_instance, uint32_t p_cull_mask) const { | 
|---|
| 691 | DecalInstance *di = decal_instance_owner.get_or_null(p_decal_instance); | 
|---|
| 692 | di->cull_mask = p_cull_mask; | 
|---|
| 693 | } | 
|---|
| 694 |  | 
|---|
| 695 | /* DECAL DATA API */ | 
|---|
| 696 |  | 
|---|
| 697 | void free_decal_data(); | 
|---|
| 698 | void set_max_decals(const uint32_t p_max_decals); | 
|---|
| 699 | RID get_decal_buffer() { return decal_buffer; } | 
|---|
| 700 | void update_decal_buffer(const PagedArray<RID> &p_decals, const Transform3D &p_camera_xform); | 
|---|
| 701 |  | 
|---|
| 702 | /* RENDER TARGET API */ | 
|---|
| 703 |  | 
|---|
| 704 | bool owns_render_target(RID p_rid) const { return render_target_owner.owns(p_rid); }; | 
|---|
| 705 |  | 
|---|
| 706 | virtual RID render_target_create() override; | 
|---|
| 707 | virtual void render_target_free(RID p_rid) override; | 
|---|
| 708 |  | 
|---|
| 709 | virtual void render_target_set_position(RID p_render_target, int p_x, int p_y) override; | 
|---|
| 710 | virtual Point2i render_target_get_position(RID p_render_target) const override; | 
|---|
| 711 | virtual void render_target_set_size(RID p_render_target, int p_width, int p_height, uint32_t p_view_count) override; | 
|---|
| 712 | virtual Size2i render_target_get_size(RID p_render_target) const override; | 
|---|
| 713 | virtual void render_target_set_transparent(RID p_render_target, bool p_is_transparent) override; | 
|---|
| 714 | virtual bool render_target_get_transparent(RID p_render_target) const override; | 
|---|
| 715 | virtual void render_target_set_direct_to_screen(RID p_render_target, bool p_direct_to_screen) override; | 
|---|
| 716 | virtual bool render_target_get_direct_to_screen(RID p_render_target) const override; | 
|---|
| 717 | virtual bool render_target_was_used(RID p_render_target) const override; | 
|---|
| 718 | virtual void render_target_set_as_unused(RID p_render_target) override; | 
|---|
| 719 | virtual void render_target_set_msaa(RID p_render_target, RS::ViewportMSAA p_msaa) override; | 
|---|
| 720 | virtual RS::ViewportMSAA render_target_get_msaa(RID p_render_target) const override; | 
|---|
| 721 | virtual void render_target_set_use_hdr(RID p_render_target, bool p_use_hdr) override; | 
|---|
| 722 | virtual bool render_target_is_using_hdr(RID p_render_target) const override; | 
|---|
| 723 |  | 
|---|
| 724 | void render_target_copy_to_back_buffer(RID p_render_target, const Rect2i &p_region, bool p_gen_mipmaps); | 
|---|
| 725 | void render_target_clear_back_buffer(RID p_render_target, const Rect2i &p_region, const Color &p_color); | 
|---|
| 726 | void render_target_gen_back_buffer_mipmaps(RID p_render_target, const Rect2i &p_region); | 
|---|
| 727 | RID render_target_get_back_buffer_uniform_set(RID p_render_target, RID p_base_shader); | 
|---|
| 728 |  | 
|---|
| 729 | virtual void render_target_request_clear(RID p_render_target, const Color &p_clear_color) override; | 
|---|
| 730 | virtual bool render_target_is_clear_requested(RID p_render_target) override; | 
|---|
| 731 | virtual Color render_target_get_clear_request_color(RID p_render_target) override; | 
|---|
| 732 | virtual void render_target_disable_clear_request(RID p_render_target) override; | 
|---|
| 733 | virtual void render_target_do_clear_request(RID p_render_target) override; | 
|---|
| 734 |  | 
|---|
| 735 | virtual void render_target_set_sdf_size_and_scale(RID p_render_target, RS::ViewportSDFOversize p_size, RS::ViewportSDFScale p_scale) override; | 
|---|
| 736 | RID render_target_get_sdf_texture(RID p_render_target); | 
|---|
| 737 | RID render_target_get_sdf_framebuffer(RID p_render_target); | 
|---|
| 738 | void render_target_sdf_process(RID p_render_target); | 
|---|
| 739 | virtual Rect2i render_target_get_sdf_rect(RID p_render_target) const override; | 
|---|
| 740 | virtual void render_target_mark_sdf_enabled(RID p_render_target, bool p_enabled) override; | 
|---|
| 741 | bool render_target_is_sdf_enabled(RID p_render_target) const; | 
|---|
| 742 |  | 
|---|
| 743 | virtual void render_target_set_vrs_mode(RID p_render_target, RS::ViewportVRSMode p_mode) override; | 
|---|
| 744 | virtual RS::ViewportVRSMode render_target_get_vrs_mode(RID p_render_target) const override; | 
|---|
| 745 | virtual void render_target_set_vrs_texture(RID p_render_target, RID p_texture) override; | 
|---|
| 746 | virtual RID render_target_get_vrs_texture(RID p_render_target) const override; | 
|---|
| 747 |  | 
|---|
| 748 | virtual void render_target_set_override(RID p_render_target, RID p_color_texture, RID p_depth_texture, RID p_velocity_texture) override; | 
|---|
| 749 | virtual RID render_target_get_override_color(RID p_render_target) const override; | 
|---|
| 750 | virtual RID render_target_get_override_depth(RID p_render_target) const override; | 
|---|
| 751 | RID render_target_get_override_depth_slice(RID p_render_target, const uint32_t p_layer) const; | 
|---|
| 752 | virtual RID render_target_get_override_velocity(RID p_render_target) const override; | 
|---|
| 753 | RID render_target_get_override_velocity_slice(RID p_render_target, const uint32_t p_layer) const; | 
|---|
| 754 |  | 
|---|
| 755 | virtual RID render_target_get_texture(RID p_render_target) override; | 
|---|
| 756 |  | 
|---|
| 757 | RID render_target_get_rd_framebuffer(RID p_render_target); | 
|---|
| 758 | RID render_target_get_rd_texture(RID p_render_target); | 
|---|
| 759 | RID render_target_get_rd_texture_slice(RID p_render_target, uint32_t p_layer); | 
|---|
| 760 | RID render_target_get_rd_texture_msaa(RID p_render_target); | 
|---|
| 761 | RID render_target_get_rd_backbuffer(RID p_render_target); | 
|---|
| 762 | RID render_target_get_rd_backbuffer_framebuffer(RID p_render_target); | 
|---|
| 763 |  | 
|---|
| 764 | RID render_target_get_framebuffer_uniform_set(RID p_render_target); | 
|---|
| 765 | RID render_target_get_backbuffer_uniform_set(RID p_render_target); | 
|---|
| 766 |  | 
|---|
| 767 | void render_target_set_framebuffer_uniform_set(RID p_render_target, RID p_uniform_set); | 
|---|
| 768 | void render_target_set_backbuffer_uniform_set(RID p_render_target, RID p_uniform_set); | 
|---|
| 769 | }; | 
|---|
| 770 |  | 
|---|
| 771 | } // namespace RendererRD | 
|---|
| 772 |  | 
|---|
| 773 | #endif // TEXTURE_STORAGE_RD_H | 
|---|
| 774 |  | 
|---|