godot/drivers/gles3/storage/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.                 */
/**************************************************************************/

#ifdef GLES3_ENABLED

#include "texture_storage.h"

#include "../effects/copy_effects.h"
#include "../rasterizer_gles3.h"
#include "config.h"
#include "utilities.h"

#ifdef ANDROID_ENABLED
#define glFramebufferTextureMultiviewOVR
#endif

usingnamespaceGLES3;

TextureStorage *TextureStorage::singleton =;

TextureStorage *TextureStorage::get_singleton() {}

static const GLenum _cube_side_enum[6] =;

TextureStorage::TextureStorage() {}

TextureStorage::~TextureStorage() {}

//TODO, move back to storage
bool TextureStorage::can_create_resources_async() const {}

/* 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) {}

/* Texture API */

Ref<Image> TextureStorage::_get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, Image::Format &r_real_format, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_gl_type, bool &r_compressed, bool p_force_decompress) const {}

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) {}

// Called internally when texture_proxy_create(p_base) is called.
// Note: p_base is the root and p_texture is the proxy.
void TextureStorage::texture_proxy_initialize(RID p_texture, RID p_base) {}

RID TextureStorage::texture_create_external(GLES3::Texture::Type p_type, Image::Format p_format, unsigned int p_image, 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) {}

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

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

void TextureStorage::texture_2d_placeholder_initialize(RID p_texture) {}

void TextureStorage::texture_2d_layered_placeholder_initialize(RID p_texture, RenderingServer::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_read_framebuffer(GLES3::Texture *p_texture) 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 {}

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

void TextureStorage::texture_set_detect_srgb_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_texture) {}

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 {}

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

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

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

void TextureStorage::_texture_set_swizzle(GLES3::Texture *p_texture, Image::Format p_real_format) {}

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

uint32_t TextureStorage::texture_get_texid(RID p_texture) const {}

Vector3i TextureStorage::texture_get_size(RID p_texture) const {}

uint32_t TextureStorage::texture_get_width(RID p_texture) const {}

uint32_t TextureStorage::texture_get_height(RID p_texture) const {}

uint32_t TextureStorage::texture_get_depth(RID p_texture) const {}

void TextureStorage::texture_bind(RID p_texture, uint32_t p_texture_no) {}

/* TEXTURE ATLAS API */

void TextureStorage::texture_add_to_texture_atlas(RID p_texture) {}

void TextureStorage::texture_remove_from_texture_atlas(RID p_texture) {}

void TextureStorage::texture_atlas_mark_dirty_on_texture(RID p_texture) {}

void TextureStorage::texture_atlas_remove_texture(RID p_texture) {}

GLuint TextureStorage::texture_atlas_get_texture() const {}

void TextureStorage::update_texture_atlas() {}

/* DECAL API */

RID TextureStorage::decal_allocate() {}

void TextureStorage::decal_initialize(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) {}

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

/* RENDER TARGET API */

GLuint TextureStorage::system_fbo =;

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

void TextureStorage::_create_render_target_backbuffer(RenderTarget *rt) {}
void GLES3::TextureStorage::check_backbuffer(RenderTarget *rt, const bool uses_screen_texture, const bool uses_depth_texture) {}
void TextureStorage::_clear_render_target(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 {
	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
	ERR_FAIL_NULL_V(rt, Point2i());

	return rt->position;
};

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

// TODO: convert to Size2i internally
Size2i TextureStorage::render_target_get_size(RID p_render_target) const {}

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_velocity(RID p_render_target) const {}

RID TextureStorage::render_target_get_texture(RID p_render_target) {}

void TextureStorage::render_target_set_transparent(RID p_render_target, bool p_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_direct_to_screen) {}

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_clear_used(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_use_hdr(RID p_render_target, bool p_use_hdr_2d) {}

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

GLuint TextureStorage::render_target_get_color_internal_format(RID p_render_target) const {}

GLuint TextureStorage::render_target_get_color_format(RID p_render_target) const {}

GLuint TextureStorage::render_target_get_color_type(RID p_render_target) const {}

uint32_t TextureStorage::render_target_get_color_format_size(RID p_render_target) const {}

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) {}

GLuint TextureStorage::render_target_get_fbo(RID p_render_target) const {}

GLuint TextureStorage::render_target_get_color(RID p_render_target) const {}

GLuint TextureStorage::render_target_get_depth(RID p_render_target) const {}

void TextureStorage::render_target_set_reattach_textures(RID p_render_target, bool p_reattach_textures) const {}

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

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 {}

GLuint 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) {}

GLuint 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) {}

#endif // GLES3_ENABLED