godot/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp

/**************************************************************************/
/*  texture_storage.cpp                                                   */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* Permission is hereby granted, free of charge, to any person obtaining  */
/* a copy of this software and associated documentation files (the        */
/* "Software"), to deal in the Software without restriction, including    */
/* without limitation the rights to use, copy, modify, merge, publish,    */
/* distribute, sublicense, and/or sell copies of the Software, and to     */
/* permit persons to whom the Software is furnished to do so, subject to  */
/* the following conditions:                                              */
/*                                                                        */
/* The above copyright notice and this permission notice shall be         */
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#include "texture_storage.h"

#include "../effects/copy_effects.h"
#include "../framebuffer_cache_rd.h"
#include "material_storage.h"
#include "servers/rendering/renderer_rd/renderer_scene_render_rd.h"

usingnamespaceRendererRD;

///////////////////////////////////////////////////////////////////////////
// TextureStorage::CanvasTexture

void TextureStorage::CanvasTexture::clear_cache() {}

TextureStorage::CanvasTexture::~CanvasTexture() {}

///////////////////////////////////////////////////////////////////////////
// TextureStorage::Texture

void TextureStorage::Texture::cleanup() {}

///////////////////////////////////////////////////////////////////////////
// TextureStorage

TextureStorage *TextureStorage::singleton =;

TextureStorage *TextureStorage::get_singleton() {}

TextureStorage::TextureStorage() {}

TextureStorage::~TextureStorage() {}

bool TextureStorage::free(RID p_rid) {}

/* Canvas Texture API */

RID TextureStorage::canvas_texture_allocate() {}

void TextureStorage::canvas_texture_initialize(RID p_rid) {}

void TextureStorage::canvas_texture_free(RID p_rid) {}

void TextureStorage::canvas_texture_set_channel(RID p_canvas_texture, RS::CanvasTextureChannel p_channel, RID p_texture) {}

void TextureStorage::canvas_texture_set_shading_parameters(RID p_canvas_texture, const Color &p_specular_color, float p_shininess) {}

void TextureStorage::canvas_texture_set_texture_filter(RID p_canvas_texture, RS::CanvasItemTextureFilter p_filter) {}

void TextureStorage::canvas_texture_set_texture_repeat(RID p_canvas_texture, RS::CanvasItemTextureRepeat p_repeat) {}

TextureStorage::CanvasTextureInfo TextureStorage::canvas_texture_get_info(RID p_texture, RS::CanvasItemTextureFilter p_base_filter, RS::CanvasItemTextureRepeat p_base_repeat, bool p_use_srgb, bool p_texture_is_data) {}

/* Texture API */

RID TextureStorage::texture_allocate() {}

void TextureStorage::texture_free(RID p_texture) {}

void TextureStorage::texture_2d_initialize(RID p_texture, const Ref<Image> &p_image) {}

void TextureStorage::texture_2d_layered_initialize(RID p_texture, const Vector<Ref<Image>> &p_layers, RS::TextureLayeredType p_layered_type) {}

void TextureStorage::texture_3d_initialize(RID p_texture, Image::Format p_format, int p_width, int p_height, int p_depth, bool p_mipmaps, const Vector<Ref<Image>> &p_data) {}

void TextureStorage::texture_external_initialize(RID p_texture, int p_width, int p_height, uint64_t p_external_buffer) {}

void TextureStorage::texture_proxy_initialize(RID p_texture, RID p_base) {}

// Note: We make some big assumptions about format and usage. If developers need more control,
// they should use RD::texture_create_from_extension() instead.
RID TextureStorage::texture_create_from_native_handle(RS::TextureType p_type, Image::Format p_format, uint64_t p_native_handle, int p_width, int p_height, int p_depth, int p_layers, RS::TextureLayeredType p_layered_type) {}

void TextureStorage::_texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer, bool p_immediate) {}

void TextureStorage::texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer) {}

void TextureStorage::texture_3d_update(RID p_texture, const Vector<Ref<Image>> &p_data) {}

void TextureStorage::texture_external_update(RID p_texture, int p_width, int p_height, uint64_t p_external_buffer) {}

void TextureStorage::texture_proxy_update(RID p_texture, RID p_proxy_to) {}

//these two APIs can be used together or in combination with the others.
void TextureStorage::texture_2d_placeholder_initialize(RID p_texture) {}

void TextureStorage::texture_2d_layered_placeholder_initialize(RID p_texture, RS::TextureLayeredType p_layered_type) {}

void TextureStorage::texture_3d_placeholder_initialize(RID p_texture) {}

Ref<Image> TextureStorage::texture_2d_get(RID p_texture) const {}

Ref<Image> TextureStorage::texture_2d_layer_get(RID p_texture, int p_layer) const {}

Vector<Ref<Image>> TextureStorage::texture_3d_get(RID p_texture) const {}

void TextureStorage::texture_replace(RID p_texture, RID p_by_texture) {}

void TextureStorage::texture_set_size_override(RID p_texture, int p_width, int p_height) {}

void TextureStorage::texture_set_path(RID p_texture, const String &p_path) {}

String TextureStorage::texture_get_path(RID p_texture) const {}

Image::Format TextureStorage::texture_get_format(RID p_texture) const {}

void TextureStorage::texture_set_detect_3d_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) {}

void TextureStorage::texture_set_detect_normal_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) {}

void TextureStorage::texture_set_detect_roughness_callback(RID p_texture, RS::TextureDetectRoughnessCallback p_callback, void *p_userdata) {}

void TextureStorage::texture_debug_usage(List<RS::TextureInfo> *r_info) {}

void TextureStorage::texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) {}

Size2 TextureStorage::texture_size_with_proxy(RID p_proxy) {}

void TextureStorage::texture_rd_initialize(RID p_texture, const RID &p_rd_texture, const RS::TextureLayeredType p_layer_type) {}

RID TextureStorage::texture_get_rd_texture(RID p_texture, bool p_srgb) const {}

uint64_t TextureStorage::texture_get_native_handle(RID p_texture, bool p_srgb) const {}

Ref<Image> TextureStorage::_validate_texture_format(const Ref<Image> &p_image, TextureToRDFormat &r_format) {}

void TextureStorage::_texture_format_from_rd(RD::DataFormat p_rd_format, TextureFromRDFormat &r_format) {}

/* DECAL API */

RID TextureStorage::decal_atlas_get_texture() const {}

RID TextureStorage::decal_atlas_get_texture_srgb() const {}

RID TextureStorage::decal_allocate() {}

void TextureStorage::decal_initialize(RID p_decal) {}

void TextureStorage::decal_free(RID p_rid) {}

void TextureStorage::decal_set_size(RID p_decal, const Vector3 &p_size) {}

void TextureStorage::decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) {}

void TextureStorage::decal_set_emission_energy(RID p_decal, float p_energy) {}

void TextureStorage::decal_set_albedo_mix(RID p_decal, float p_mix) {}

void TextureStorage::decal_set_modulate(RID p_decal, const Color &p_modulate) {}

void TextureStorage::decal_set_cull_mask(RID p_decal, uint32_t p_layers) {}

void TextureStorage::decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) {}

void TextureStorage::decal_set_fade(RID p_decal, float p_above, float p_below) {}

void TextureStorage::decal_set_normal_fade(RID p_decal, float p_fade) {}

void TextureStorage::decal_atlas_mark_dirty_on_texture(RID p_texture) {}

void TextureStorage::decal_atlas_remove_texture(RID p_texture) {}

AABB TextureStorage::decal_get_aabb(RID p_decal) const {}

uint32_t TextureStorage::decal_get_cull_mask(RID p_decal) const {}

Dependency *TextureStorage::decal_get_dependency(RID p_decal) {}

void TextureStorage::update_decal_atlas() {}

void TextureStorage::texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp) {}

void TextureStorage::texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp) {}

/* DECAL INSTANCE API */

RID TextureStorage::decal_instance_create(RID p_decal) {}

void TextureStorage::decal_instance_free(RID p_decal_instance) {}

void TextureStorage::decal_instance_set_transform(RID p_decal_instance, const Transform3D &p_transform) {}

void TextureStorage::decal_instance_set_sorting_offset(RID p_decal_instance, float p_sorting_offset) {}

/* DECAL DATA API */

void TextureStorage::free_decal_data() {}

void TextureStorage::set_max_decals(const uint32_t p_max_decals) {}

void TextureStorage::update_decal_buffer(const PagedArray<RID> &p_decals, const Transform3D &p_camera_xform) {}

/* RENDER TARGET API */

RID TextureStorage::RenderTarget::get_framebuffer() {}

void TextureStorage::_clear_render_target(RenderTarget *rt) {}

void TextureStorage::_update_render_target(RenderTarget *rt) {}

void TextureStorage::_create_render_target_backbuffer(RenderTarget *rt) {}

RID TextureStorage::render_target_create() {}

void TextureStorage::render_target_free(RID p_rid) {}

void TextureStorage::render_target_set_position(RID p_render_target, int p_x, int p_y) {}

Point2i TextureStorage::render_target_get_position(RID p_render_target) const {}

void TextureStorage::render_target_set_size(RID p_render_target, int p_width, int p_height, uint32_t p_view_count) {}

Size2i TextureStorage::render_target_get_size(RID p_render_target) const {}

RID TextureStorage::render_target_get_texture(RID p_render_target) {}

void TextureStorage::render_target_set_override(RID p_render_target, RID p_color_texture, RID p_depth_texture, RID p_velocity_texture) {}

RID TextureStorage::render_target_get_override_color(RID p_render_target) const {}

RID TextureStorage::render_target_get_override_depth(RID p_render_target) const {}

RID TextureStorage::render_target_get_override_depth_slice(RID p_render_target, const uint32_t p_layer) const {}

RID TextureStorage::render_target_get_override_velocity(RID p_render_target) const {}

RID TextureStorage::render_target_get_override_velocity_slice(RID p_render_target, const uint32_t p_layer) const {}

void TextureStorage::render_target_set_transparent(RID p_render_target, bool p_is_transparent) {}

bool TextureStorage::render_target_get_transparent(RID p_render_target) const {}

void TextureStorage::render_target_set_direct_to_screen(RID p_render_target, bool p_value) {}

bool TextureStorage::render_target_get_direct_to_screen(RID p_render_target) const {}

bool TextureStorage::render_target_was_used(RID p_render_target) const {}

void TextureStorage::render_target_set_as_unused(RID p_render_target) {}

void TextureStorage::render_target_set_msaa(RID p_render_target, RS::ViewportMSAA p_msaa) {}

RS::ViewportMSAA TextureStorage::render_target_get_msaa(RID p_render_target) const {}

void TextureStorage::render_target_set_msaa_needs_resolve(RID p_render_target, bool p_needs_resolve) {}

bool TextureStorage::render_target_get_msaa_needs_resolve(RID p_render_target) const {}

void TextureStorage::render_target_do_msaa_resolve(RID p_render_target) {}

void TextureStorage::render_target_set_use_hdr(RID p_render_target, bool p_use_hdr) {}

bool TextureStorage::render_target_is_using_hdr(RID p_render_target) const {}

RID TextureStorage::render_target_get_rd_framebuffer(RID p_render_target) {}

RID TextureStorage::render_target_get_rd_texture(RID p_render_target) {}

RID TextureStorage::render_target_get_rd_texture_slice(RID p_render_target, uint32_t p_layer) {}

RID TextureStorage::render_target_get_rd_texture_msaa(RID p_render_target) {}

RID TextureStorage::render_target_get_rd_backbuffer(RID p_render_target) {}

RID TextureStorage::render_target_get_rd_backbuffer_framebuffer(RID p_render_target) {}

void TextureStorage::render_target_request_clear(RID p_render_target, const Color &p_clear_color) {}

bool TextureStorage::render_target_is_clear_requested(RID p_render_target) {}

Color TextureStorage::render_target_get_clear_request_color(RID p_render_target) {}

void TextureStorage::render_target_disable_clear_request(RID p_render_target) {}

void TextureStorage::render_target_do_clear_request(RID p_render_target) {}

void TextureStorage::render_target_set_sdf_size_and_scale(RID p_render_target, RS::ViewportSDFOversize p_size, RS::ViewportSDFScale p_scale) {}

Rect2i TextureStorage::_render_target_get_sdf_rect(const RenderTarget *rt) const {}

Rect2i TextureStorage::render_target_get_sdf_rect(RID p_render_target) const {}

void TextureStorage::render_target_mark_sdf_enabled(RID p_render_target, bool p_enabled) {}

bool TextureStorage::render_target_is_sdf_enabled(RID p_render_target) const {}

RID TextureStorage::render_target_get_sdf_texture(RID p_render_target) {}

void TextureStorage::_render_target_allocate_sdf(RenderTarget *rt) {}

void TextureStorage::_render_target_clear_sdf(RenderTarget *rt) {}

RID TextureStorage::render_target_get_sdf_framebuffer(RID p_render_target) {}
void TextureStorage::render_target_sdf_process(RID p_render_target) {}

void TextureStorage::render_target_copy_to_back_buffer(RID p_render_target, const Rect2i &p_region, bool p_gen_mipmaps) {}

void TextureStorage::render_target_clear_back_buffer(RID p_render_target, const Rect2i &p_region, const Color &p_color) {}

void TextureStorage::render_target_gen_back_buffer_mipmaps(RID p_render_target, const Rect2i &p_region) {}

RID TextureStorage::render_target_get_framebuffer_uniform_set(RID p_render_target) {}
RID TextureStorage::render_target_get_backbuffer_uniform_set(RID p_render_target) {}

void TextureStorage::render_target_set_framebuffer_uniform_set(RID p_render_target, RID p_uniform_set) {}

void TextureStorage::render_target_set_backbuffer_uniform_set(RID p_render_target, RID p_uniform_set) {}

void TextureStorage::render_target_set_vrs_mode(RID p_render_target, RS::ViewportVRSMode p_mode) {}

RS::ViewportVRSMode TextureStorage::render_target_get_vrs_mode(RID p_render_target) const {}

void TextureStorage::render_target_set_vrs_update_mode(RID p_render_target, RS::ViewportVRSUpdateMode p_mode) {}

RS::ViewportVRSUpdateMode TextureStorage::render_target_get_vrs_update_mode(RID p_render_target) const {}

void TextureStorage::render_target_set_vrs_texture(RID p_render_target, RID p_texture) {}

RID TextureStorage::render_target_get_vrs_texture(RID p_render_target) const {}

RD::DataFormat TextureStorage::render_target_get_color_format(bool p_use_hdr, bool p_srgb) {}

uint32_t TextureStorage::render_target_get_color_usage_bits(bool p_msaa) {}