godot/drivers/gles3/storage/material_storage.cpp

/**************************************************************************/
/*  material_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 "core/config/project_settings.h"

#include "config.h"
#include "material_storage.h"
#include "particles_storage.h"
#include "texture_storage.h"

#include "drivers/gles3/rasterizer_canvas_gles3.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "servers/rendering/storage/variant_converters.h"

usingnamespaceGLES3;

///////////////////////////////////////////////////////////////////////////
// UBI helper functions

static void _fill_std140_variant_ubo_value(ShaderLanguage::DataType type, int p_array_size, const Variant &value, uint8_t *data) {}

_FORCE_INLINE_ static void _fill_std140_ubo_value(ShaderLanguage::DataType type, const Vector<ShaderLanguage::ConstantNode::Value> &value, uint8_t *data) {}

_FORCE_INLINE_ static void _fill_std140_ubo_empty(ShaderLanguage::DataType type, int p_array_size, uint8_t *data) {}

///////////////////////////////////////////////////////////////////////////
// ShaderData

void ShaderData::set_path_hint(const String &p_hint) {}

void ShaderData::set_default_texture_parameter(const StringName &p_name, RID p_texture, int p_index) {}

Variant ShaderData::get_default_parameter(const StringName &p_parameter) const {}

void ShaderData::get_shader_uniform_list(List<PropertyInfo> *p_param_list) const {}

void ShaderData::get_instance_param_list(List<RendererMaterialStorage::InstanceShaderParam> *p_param_list) const {}

bool ShaderData::is_parameter_texture(const StringName &p_param) const {}

///////////////////////////////////////////////////////////////////////////
// MaterialData

// Look up table to translate ShaderLanguage::DataType to GL_TEXTURE_*
static const GLenum target_from_type[ShaderLanguage::TYPE_MAX] =;

static const RS::CanvasItemTextureRepeat repeat_from_uniform[ShaderLanguage::REPEAT_DEFAULT + 1] =;

static const RS::CanvasItemTextureRepeat repeat_from_uniform_canvas[ShaderLanguage::REPEAT_DEFAULT + 1] =;

static const RS::CanvasItemTextureFilter filter_from_uniform[ShaderLanguage::FILTER_DEFAULT + 1] =;

static const RS::CanvasItemTextureFilter filter_from_uniform_canvas[ShaderLanguage::FILTER_DEFAULT + 1] =;

void MaterialData::update_uniform_buffer(const HashMap<StringName, ShaderLanguage::ShaderNode::Uniform> &p_uniforms, const uint32_t *p_uniform_offsets, const HashMap<StringName, Variant> &p_parameters, uint8_t *p_buffer, uint32_t p_buffer_size) {}

MaterialData::~MaterialData() {}

void MaterialData::update_textures(const HashMap<StringName, Variant> &p_parameters, const HashMap<StringName, HashMap<int, RID>> &p_default_textures, const Vector<ShaderCompiler::GeneratedCode::Texture> &p_texture_uniforms, RID *p_textures, bool p_is_3d_shader_type) {}

void MaterialData::update_parameters_internal(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty, const HashMap<StringName, ShaderLanguage::ShaderNode::Uniform> &p_uniforms, const uint32_t *p_uniform_offsets, const Vector<ShaderCompiler::GeneratedCode::Texture> &p_texture_uniforms, const HashMap<StringName, HashMap<int, RID>> &p_default_texture_params, uint32_t p_ubo_size, bool p_is_3d_shader_type) {}

///////////////////////////////////////////////////////////////////////////
// Material Storage

MaterialStorage *MaterialStorage::singleton =;

MaterialStorage *MaterialStorage::get_singleton() {}

MaterialStorage::MaterialStorage() {}

MaterialStorage::~MaterialStorage() {}

/* GLOBAL SHADER UNIFORM API */

int32_t MaterialStorage::_global_shader_uniform_allocate(uint32_t p_elements) {}

void MaterialStorage::_global_shader_uniform_store_in_buffer(int32_t p_index, RS::GlobalShaderParameterType p_type, const Variant &p_value) {}

void MaterialStorage::_global_shader_uniform_mark_buffer_dirty(int32_t p_index, int32_t p_elements) {}

void MaterialStorage::global_shader_parameter_add(const StringName &p_name, RS::GlobalShaderParameterType p_type, const Variant &p_value) {}

void MaterialStorage::global_shader_parameter_remove(const StringName &p_name) {}

Vector<StringName> MaterialStorage::global_shader_parameter_get_list() const {}

void MaterialStorage::global_shader_parameter_set(const StringName &p_name, const Variant &p_value) {}

void MaterialStorage::global_shader_parameter_set_override(const StringName &p_name, const Variant &p_value) {}

Variant MaterialStorage::global_shader_parameter_get(const StringName &p_name) const {}

RS::GlobalShaderParameterType MaterialStorage::global_shader_parameter_get_type_internal(const StringName &p_name) const {}

RS::GlobalShaderParameterType MaterialStorage::global_shader_parameter_get_type(const StringName &p_name) const {}

void MaterialStorage::global_shader_parameters_load_settings(bool p_load_textures) {}

void MaterialStorage::global_shader_parameters_clear() {}

GLuint MaterialStorage::global_shader_parameters_get_uniform_buffer() const {}

int32_t MaterialStorage::global_shader_parameters_instance_allocate(RID p_instance) {}

void MaterialStorage::global_shader_parameters_instance_free(RID p_instance) {}

void MaterialStorage::global_shader_parameters_instance_update(RID p_instance, int p_index, const Variant &p_value, int p_flags_count) {}

void MaterialStorage::_update_global_shader_uniforms() {}

/* SHADER API */

RID MaterialStorage::shader_allocate() {}

void MaterialStorage::shader_initialize(RID p_rid) {}

void MaterialStorage::shader_free(RID p_rid) {}

void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {}

void MaterialStorage::shader_set_path_hint(RID p_shader, const String &p_path) {}

String MaterialStorage::shader_get_code(RID p_shader) const {}

void MaterialStorage::get_shader_parameter_list(RID p_shader, List<PropertyInfo> *p_param_list) const {}

void MaterialStorage::shader_set_default_texture_parameter(RID p_shader, const StringName &p_name, RID p_texture, int p_index) {}

RID MaterialStorage::shader_get_default_texture_parameter(RID p_shader, const StringName &p_name, int p_index) const {}

Variant MaterialStorage::shader_get_parameter_default(RID p_shader, const StringName &p_param) const {}

RS::ShaderNativeSourceCode MaterialStorage::shader_get_native_source_code(RID p_shader) const {}

/* MATERIAL API */

void MaterialStorage::_material_queue_update(GLES3::Material *material, bool p_uniform, bool p_texture) {}

void MaterialStorage::_update_queued_materials() {}

RID MaterialStorage::material_allocate() {}

void MaterialStorage::material_initialize(RID p_rid) {}

void MaterialStorage::material_free(RID p_rid) {}

void MaterialStorage::material_set_shader(RID p_material, RID p_shader) {}

void MaterialStorage::material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) {}

Variant MaterialStorage::material_get_param(RID p_material, const StringName &p_param) const {}

void MaterialStorage::material_set_next_pass(RID p_material, RID p_next_material) {}

void MaterialStorage::material_set_render_priority(RID p_material, int priority) {}

bool MaterialStorage::material_is_animated(RID p_material) {}

bool MaterialStorage::material_casts_shadows(RID p_material) {}

void MaterialStorage::material_get_instance_shader_parameters(RID p_material, List<InstanceShaderParam> *r_parameters) {}

void MaterialStorage::material_update_dependency(RID p_material, DependencyTracker *p_instance) {}

LocalVector<ShaderGLES3::TextureUniformData> get_texture_uniform_data(const Vector<ShaderCompiler::GeneratedCode::Texture> &texture_uniforms) {}

/* Canvas Shader Data */

void CanvasShaderData::set_code(const String &p_code) {}

bool CanvasShaderData::is_animated() const {}

bool CanvasShaderData::casts_shadows() const {}

RS::ShaderNativeSourceCode CanvasShaderData::get_native_source_code() const {}

CanvasShaderData::CanvasShaderData() {}

CanvasShaderData::~CanvasShaderData() {}

GLES3::ShaderData *GLES3::_create_canvas_shader_func() {}

void CanvasMaterialData::update_parameters(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) {}

static void bind_uniforms_generic(const Vector<RID> &p_textures, const Vector<ShaderCompiler::GeneratedCode::Texture> &p_texture_uniforms, int texture_offset = 0, const RS::CanvasItemTextureFilter *filter_mapping = filter_from_uniform, const RS::CanvasItemTextureRepeat *repeat_mapping = repeat_from_uniform) {}

void CanvasMaterialData::bind_uniforms() {}

CanvasMaterialData::~CanvasMaterialData() {}

GLES3::MaterialData *GLES3::_create_canvas_material_func(ShaderData *p_shader) {}

////////////////////////////////////////////////////////////////////////////////
// SKY SHADER

void SkyShaderData::set_code(const String &p_code) {}

bool SkyShaderData::is_animated() const {}

bool SkyShaderData::casts_shadows() const {}

RS::ShaderNativeSourceCode SkyShaderData::get_native_source_code() const {}

SkyShaderData::SkyShaderData() {}

SkyShaderData::~SkyShaderData() {}

GLES3::ShaderData *GLES3::_create_sky_shader_func() {}

////////////////////////////////////////////////////////////////////////////////
// Sky material

void SkyMaterialData::update_parameters(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) {}

SkyMaterialData::~SkyMaterialData() {}
GLES3::MaterialData *GLES3::_create_sky_material_func(ShaderData *p_shader) {}

void SkyMaterialData::bind_uniforms() {}

////////////////////////////////////////////////////////////////////////////////
// Scene SHADER

void SceneShaderData::set_code(const String &p_code) {}

bool SceneShaderData::is_animated() const {}

bool SceneShaderData::casts_shadows() const {}

RS::ShaderNativeSourceCode SceneShaderData::get_native_source_code() const {}

SceneShaderData::SceneShaderData() {}

SceneShaderData::~SceneShaderData() {}

GLES3::ShaderData *GLES3::_create_scene_shader_func() {}

void SceneMaterialData::set_render_priority(int p_priority) {}

void SceneMaterialData::set_next_pass(RID p_pass) {}

void SceneMaterialData::update_parameters(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) {}

SceneMaterialData::~SceneMaterialData() {}

GLES3::MaterialData *GLES3::_create_scene_material_func(ShaderData *p_shader) {}

void SceneMaterialData::bind_uniforms() {}

/* Particles SHADER */

void ParticlesShaderData::set_code(const String &p_code) {}

bool ParticlesShaderData::is_animated() const {}

bool ParticlesShaderData::casts_shadows() const {}

RS::ShaderNativeSourceCode ParticlesShaderData::get_native_source_code() const {}

ParticlesShaderData::~ParticlesShaderData() {}

GLES3::ShaderData *GLES3::_create_particles_shader_func() {}

void ParticleProcessMaterialData::update_parameters(const HashMap<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) {}

ParticleProcessMaterialData::~ParticleProcessMaterialData() {}

GLES3::MaterialData *GLES3::_create_particles_material_func(ShaderData *p_shader) {}

void ParticleProcessMaterialData::bind_uniforms() {}

#endif // !GLES3_ENABLED