2020-11-18 19:11:30 +01:00
|
|
|
/*************************************************************************/
|
2021-10-26 17:18:39 +02:00
|
|
|
/* rasterizer_storage_gles3.cpp */
|
2020-11-18 19:11:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/*************************************************************************/
|
2022-01-03 21:27:34 +01:00
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
2020-11-18 19:11:30 +01:00
|
|
|
/* */
|
|
|
|
/* 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. */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
#include "rasterizer_storage_gles3.h"
|
2022-02-16 13:56:32 +01:00
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
#ifdef GLES3_ENABLED
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
#include "core/config/project_settings.h"
|
|
|
|
#include "core/math/transform_3d.h"
|
2021-10-26 17:18:39 +02:00
|
|
|
#include "rasterizer_canvas_gles3.h"
|
|
|
|
#include "rasterizer_scene_gles3.h"
|
2020-11-18 19:11:30 +01:00
|
|
|
#include "servers/rendering/shader_language.h"
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
GLuint RasterizerStorageGLES3::system_fbo = 0;
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::bind_quad_array() const {
|
|
|
|
//glBindBuffer(GL_ARRAY_BUFFER, resources.quadie);
|
|
|
|
//glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, 0);
|
|
|
|
//glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, CAST_INT_TO_UCHAR_PTR(8));
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
//glEnableVertexAttribArray(RS::ARRAY_VERTEX);
|
|
|
|
//glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::sky_create() {
|
2020-11-18 19:11:30 +01:00
|
|
|
Sky *sky = memnew(Sky);
|
|
|
|
sky->radiance = 0;
|
|
|
|
return sky_owner.make_rid(sky);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::sky_set_texture(RID p_sky, RID p_panorama, int p_radiance_size) {
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* SHADER API */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::shader_allocate() {
|
2020-11-18 19:11:30 +01:00
|
|
|
Shader *shader = memnew(Shader);
|
2021-11-16 16:25:42 +01:00
|
|
|
shader->mode = RS::SHADER_CANVAS_ITEM;
|
|
|
|
//shader->shader = &scene->state.scene_shader;
|
2020-11-18 19:11:30 +01:00
|
|
|
RID rid = shader_owner.make_rid(shader);
|
|
|
|
_shader_make_dirty(shader);
|
|
|
|
shader->self = rid;
|
|
|
|
|
|
|
|
return rid;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::shader_initialize(RID p_rid) {
|
2020-11-18 19:11:30 +01:00
|
|
|
// noop
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
//RID RasterizerStorageGLES3::shader_create() {
|
2020-11-18 19:11:30 +01:00
|
|
|
// Shader *shader = memnew(Shader);
|
2021-09-27 01:07:10 +02:00
|
|
|
// shader->mode = RS::SHADER_SPATIAL;
|
2020-11-18 19:11:30 +01:00
|
|
|
// shader->shader = &scene->state.scene_shader;
|
|
|
|
// RID rid = shader_owner.make_rid(shader);
|
|
|
|
// _shader_make_dirty(shader);
|
|
|
|
// shader->self = rid;
|
|
|
|
|
|
|
|
// return rid;
|
|
|
|
//}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::_shader_make_dirty(Shader *p_shader) {
|
2022-01-27 17:34:33 +01:00
|
|
|
if (p_shader->dirty_list.in_list()) {
|
2020-11-18 19:11:30 +01:00
|
|
|
return;
|
2022-01-27 17:34:33 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
_shader_dirty_list.add(&p_shader->dirty_list);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::shader_set_code(RID p_shader, const String &p_code) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Shader *shader = shader_owner.get_or_null(p_shader);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!shader);
|
|
|
|
|
|
|
|
shader->code = p_code;
|
|
|
|
|
|
|
|
String mode_string = ShaderLanguage::get_shader_type(p_code);
|
2021-09-27 01:07:10 +02:00
|
|
|
RS::ShaderMode mode;
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
if (mode_string == "canvas_item") {
|
2021-09-27 01:07:10 +02:00
|
|
|
mode = RS::SHADER_CANVAS_ITEM;
|
2021-11-16 16:25:42 +01:00
|
|
|
} else if (mode_string == "particles") {
|
2021-09-27 01:07:10 +02:00
|
|
|
mode = RS::SHADER_PARTICLES;
|
2021-11-16 16:25:42 +01:00
|
|
|
} else if (mode_string == "sky") {
|
|
|
|
mode = RS::SHADER_SKY;
|
|
|
|
} else if (mode_string == "spatial") {
|
2021-09-27 01:07:10 +02:00
|
|
|
mode = RS::SHADER_SPATIAL;
|
2021-11-16 16:25:42 +01:00
|
|
|
} else {
|
|
|
|
mode = RS::SHADER_MAX;
|
|
|
|
ERR_PRINT("shader type " + mode_string + " not supported in OpenGL renderer");
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
if (shader->version.is_valid() && mode != shader->mode) {
|
|
|
|
shader->shader->version_free(shader->version);
|
|
|
|
shader->version = RID();
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
shader->mode = mode;
|
|
|
|
|
|
|
|
// TODO handle all shader types
|
2021-09-27 01:07:10 +02:00
|
|
|
if (mode == RS::SHADER_CANVAS_ITEM) {
|
2020-11-18 19:11:30 +01:00
|
|
|
shader->shader = &canvas->state.canvas_shader;
|
|
|
|
|
2021-09-27 01:07:10 +02:00
|
|
|
} else if (mode == RS::SHADER_SPATIAL) {
|
2021-11-16 16:25:42 +01:00
|
|
|
//shader->shader = &scene->state.scene_shader;
|
|
|
|
} else if (mode == RS::SHADER_PARTICLES) {
|
|
|
|
} else if (mode == RS::SHADER_SKY) {
|
2020-11-18 19:11:30 +01:00
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
if (shader->version.is_null() && shader->shader) {
|
|
|
|
shader->version = shader->shader->version_create();
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_shader_make_dirty(shader);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
String RasterizerStorageGLES3::shader_get_code(RID p_shader) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
const Shader *shader = shader_owner.get_or_null(p_shader);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!shader, "");
|
|
|
|
|
|
|
|
return shader->code;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
|
2020-11-18 19:11:30 +01:00
|
|
|
_shader_dirty_list.remove(&p_shader->dirty_list);
|
|
|
|
|
|
|
|
p_shader->valid = false;
|
|
|
|
|
|
|
|
p_shader->uniforms.clear();
|
|
|
|
|
2021-12-09 10:42:46 +01:00
|
|
|
if (p_shader->code.is_empty()) {
|
2020-11-18 19:11:30 +01:00
|
|
|
return; //just invalid, but no error
|
|
|
|
}
|
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
ShaderCompiler::GeneratedCode gen_code;
|
2022-01-27 17:34:33 +01:00
|
|
|
ShaderCompiler::IdentifierActions *actions = nullptr;
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
switch (p_shader->mode) {
|
2021-09-27 01:07:10 +02:00
|
|
|
case RS::SHADER_CANVAS_ITEM: {
|
2020-11-18 19:11:30 +01:00
|
|
|
p_shader->canvas_item.light_mode = Shader::CanvasItem::LIGHT_MODE_NORMAL;
|
|
|
|
p_shader->canvas_item.blend_mode = Shader::CanvasItem::BLEND_MODE_MIX;
|
|
|
|
|
|
|
|
p_shader->canvas_item.uses_screen_texture = false;
|
|
|
|
p_shader->canvas_item.uses_screen_uv = false;
|
|
|
|
p_shader->canvas_item.uses_time = false;
|
|
|
|
p_shader->canvas_item.uses_modulate = false;
|
|
|
|
p_shader->canvas_item.uses_color = false;
|
|
|
|
p_shader->canvas_item.uses_vertex = false;
|
|
|
|
|
|
|
|
p_shader->canvas_item.uses_world_matrix = false;
|
|
|
|
p_shader->canvas_item.uses_extra_matrix = false;
|
|
|
|
p_shader->canvas_item.uses_projection_matrix = false;
|
|
|
|
p_shader->canvas_item.uses_instance_custom = false;
|
|
|
|
|
|
|
|
shaders.actions_canvas.render_mode_values["blend_add"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_ADD);
|
|
|
|
shaders.actions_canvas.render_mode_values["blend_mix"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_MIX);
|
|
|
|
shaders.actions_canvas.render_mode_values["blend_sub"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_SUB);
|
|
|
|
shaders.actions_canvas.render_mode_values["blend_mul"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_MUL);
|
|
|
|
shaders.actions_canvas.render_mode_values["blend_premul_alpha"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_PMALPHA);
|
|
|
|
|
|
|
|
shaders.actions_canvas.render_mode_values["unshaded"] = Pair<int *, int>(&p_shader->canvas_item.light_mode, Shader::CanvasItem::LIGHT_MODE_UNSHADED);
|
|
|
|
shaders.actions_canvas.render_mode_values["light_only"] = Pair<int *, int>(&p_shader->canvas_item.light_mode, Shader::CanvasItem::LIGHT_MODE_LIGHT_ONLY);
|
|
|
|
|
|
|
|
shaders.actions_canvas.usage_flag_pointers["SCREEN_UV"] = &p_shader->canvas_item.uses_screen_uv;
|
|
|
|
shaders.actions_canvas.usage_flag_pointers["SCREEN_PIXEL_SIZE"] = &p_shader->canvas_item.uses_screen_uv;
|
|
|
|
shaders.actions_canvas.usage_flag_pointers["SCREEN_TEXTURE"] = &p_shader->canvas_item.uses_screen_texture;
|
|
|
|
shaders.actions_canvas.usage_flag_pointers["TIME"] = &p_shader->canvas_item.uses_time;
|
|
|
|
shaders.actions_canvas.usage_flag_pointers["MODULATE"] = &p_shader->canvas_item.uses_modulate;
|
|
|
|
shaders.actions_canvas.usage_flag_pointers["COLOR"] = &p_shader->canvas_item.uses_color;
|
|
|
|
|
|
|
|
shaders.actions_canvas.usage_flag_pointers["VERTEX"] = &p_shader->canvas_item.uses_vertex;
|
|
|
|
|
|
|
|
shaders.actions_canvas.usage_flag_pointers["WORLD_MATRIX"] = &p_shader->canvas_item.uses_world_matrix;
|
|
|
|
shaders.actions_canvas.usage_flag_pointers["EXTRA_MATRIX"] = &p_shader->canvas_item.uses_extra_matrix;
|
|
|
|
shaders.actions_canvas.usage_flag_pointers["PROJECTION_MATRIX"] = &p_shader->canvas_item.uses_projection_matrix;
|
|
|
|
shaders.actions_canvas.usage_flag_pointers["INSTANCE_CUSTOM"] = &p_shader->canvas_item.uses_instance_custom;
|
|
|
|
|
|
|
|
actions = &shaders.actions_canvas;
|
|
|
|
actions->uniforms = &p_shader->uniforms;
|
|
|
|
} break;
|
|
|
|
|
2021-09-27 01:07:10 +02:00
|
|
|
case RS::SHADER_SPATIAL: {
|
2021-11-16 16:25:42 +01:00
|
|
|
// TODO remove once 3D is added back
|
|
|
|
return;
|
2020-11-18 19:11:30 +01:00
|
|
|
p_shader->spatial.blend_mode = Shader::Spatial::BLEND_MODE_MIX;
|
|
|
|
p_shader->spatial.depth_draw_mode = Shader::Spatial::DEPTH_DRAW_OPAQUE;
|
|
|
|
p_shader->spatial.cull_mode = Shader::Spatial::CULL_MODE_BACK;
|
|
|
|
p_shader->spatial.uses_alpha = false;
|
|
|
|
p_shader->spatial.uses_alpha_scissor = false;
|
|
|
|
p_shader->spatial.uses_discard = false;
|
|
|
|
p_shader->spatial.unshaded = false;
|
|
|
|
p_shader->spatial.no_depth_test = false;
|
|
|
|
p_shader->spatial.uses_sss = false;
|
|
|
|
p_shader->spatial.uses_time = false;
|
|
|
|
p_shader->spatial.uses_vertex_lighting = false;
|
|
|
|
p_shader->spatial.uses_screen_texture = false;
|
|
|
|
p_shader->spatial.uses_depth_texture = false;
|
|
|
|
p_shader->spatial.uses_vertex = false;
|
|
|
|
p_shader->spatial.uses_tangent = false;
|
|
|
|
p_shader->spatial.uses_ensure_correct_normals = false;
|
|
|
|
p_shader->spatial.writes_modelview_or_projection = false;
|
|
|
|
p_shader->spatial.uses_world_coordinates = false;
|
|
|
|
|
|
|
|
shaders.actions_scene.render_mode_values["blend_add"] = Pair<int *, int>(&p_shader->spatial.blend_mode, Shader::Spatial::BLEND_MODE_ADD);
|
|
|
|
shaders.actions_scene.render_mode_values["blend_mix"] = Pair<int *, int>(&p_shader->spatial.blend_mode, Shader::Spatial::BLEND_MODE_MIX);
|
|
|
|
shaders.actions_scene.render_mode_values["blend_sub"] = Pair<int *, int>(&p_shader->spatial.blend_mode, Shader::Spatial::BLEND_MODE_SUB);
|
|
|
|
shaders.actions_scene.render_mode_values["blend_mul"] = Pair<int *, int>(&p_shader->spatial.blend_mode, Shader::Spatial::BLEND_MODE_MUL);
|
|
|
|
|
|
|
|
shaders.actions_scene.render_mode_values["depth_draw_opaque"] = Pair<int *, int>(&p_shader->spatial.depth_draw_mode, Shader::Spatial::DEPTH_DRAW_OPAQUE);
|
|
|
|
shaders.actions_scene.render_mode_values["depth_draw_always"] = Pair<int *, int>(&p_shader->spatial.depth_draw_mode, Shader::Spatial::DEPTH_DRAW_ALWAYS);
|
|
|
|
shaders.actions_scene.render_mode_values["depth_draw_never"] = Pair<int *, int>(&p_shader->spatial.depth_draw_mode, Shader::Spatial::DEPTH_DRAW_NEVER);
|
|
|
|
shaders.actions_scene.render_mode_values["depth_draw_alpha_prepass"] = Pair<int *, int>(&p_shader->spatial.depth_draw_mode, Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS);
|
|
|
|
|
|
|
|
shaders.actions_scene.render_mode_values["cull_front"] = Pair<int *, int>(&p_shader->spatial.cull_mode, Shader::Spatial::CULL_MODE_FRONT);
|
|
|
|
shaders.actions_scene.render_mode_values["cull_back"] = Pair<int *, int>(&p_shader->spatial.cull_mode, Shader::Spatial::CULL_MODE_BACK);
|
|
|
|
shaders.actions_scene.render_mode_values["cull_disabled"] = Pair<int *, int>(&p_shader->spatial.cull_mode, Shader::Spatial::CULL_MODE_DISABLED);
|
|
|
|
|
|
|
|
shaders.actions_scene.render_mode_flags["unshaded"] = &p_shader->spatial.unshaded;
|
|
|
|
shaders.actions_scene.render_mode_flags["depth_test_disable"] = &p_shader->spatial.no_depth_test;
|
|
|
|
|
|
|
|
shaders.actions_scene.render_mode_flags["vertex_lighting"] = &p_shader->spatial.uses_vertex_lighting;
|
|
|
|
|
|
|
|
shaders.actions_scene.render_mode_flags["world_vertex_coords"] = &p_shader->spatial.uses_world_coordinates;
|
|
|
|
|
|
|
|
shaders.actions_scene.render_mode_flags["ensure_correct_normals"] = &p_shader->spatial.uses_ensure_correct_normals;
|
|
|
|
|
|
|
|
shaders.actions_scene.usage_flag_pointers["ALPHA"] = &p_shader->spatial.uses_alpha;
|
|
|
|
shaders.actions_scene.usage_flag_pointers["ALPHA_SCISSOR"] = &p_shader->spatial.uses_alpha_scissor;
|
|
|
|
|
|
|
|
shaders.actions_scene.usage_flag_pointers["SSS_STRENGTH"] = &p_shader->spatial.uses_sss;
|
|
|
|
shaders.actions_scene.usage_flag_pointers["DISCARD"] = &p_shader->spatial.uses_discard;
|
|
|
|
shaders.actions_scene.usage_flag_pointers["SCREEN_TEXTURE"] = &p_shader->spatial.uses_screen_texture;
|
|
|
|
shaders.actions_scene.usage_flag_pointers["DEPTH_TEXTURE"] = &p_shader->spatial.uses_depth_texture;
|
|
|
|
shaders.actions_scene.usage_flag_pointers["TIME"] = &p_shader->spatial.uses_time;
|
|
|
|
|
|
|
|
// Use of any of these BUILTINS indicate the need for transformed tangents.
|
|
|
|
// This is needed to know when to transform tangents in software skinning.
|
|
|
|
shaders.actions_scene.usage_flag_pointers["TANGENT"] = &p_shader->spatial.uses_tangent;
|
|
|
|
shaders.actions_scene.usage_flag_pointers["NORMALMAP"] = &p_shader->spatial.uses_tangent;
|
|
|
|
|
|
|
|
shaders.actions_scene.write_flag_pointers["MODELVIEW_MATRIX"] = &p_shader->spatial.writes_modelview_or_projection;
|
|
|
|
shaders.actions_scene.write_flag_pointers["PROJECTION_MATRIX"] = &p_shader->spatial.writes_modelview_or_projection;
|
|
|
|
shaders.actions_scene.write_flag_pointers["VERTEX"] = &p_shader->spatial.uses_vertex;
|
|
|
|
|
|
|
|
actions = &shaders.actions_scene;
|
|
|
|
actions->uniforms = &p_shader->uniforms;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
default: {
|
|
|
|
return;
|
|
|
|
} break;
|
|
|
|
}
|
|
|
|
|
|
|
|
Error err = shaders.compiler.compile(p_shader->mode, p_shader->code, actions, p_shader->path, gen_code);
|
|
|
|
if (err != OK) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
Vector<StringName> texture_uniform_names;
|
|
|
|
for (int i = 0; i < gen_code.texture_uniforms.size(); i++) {
|
|
|
|
texture_uniform_names.push_back(gen_code.texture_uniforms[i].name);
|
|
|
|
}
|
|
|
|
|
|
|
|
p_shader->shader->version_set_code(p_shader->version, gen_code.code, gen_code.uniforms, gen_code.stage_globals[ShaderCompiler::STAGE_VERTEX], gen_code.stage_globals[ShaderCompiler::STAGE_FRAGMENT], gen_code.defines, texture_uniform_names);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
p_shader->texture_uniforms = gen_code.texture_uniforms;
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
p_shader->uses_vertex_time = gen_code.uses_vertex_time;
|
|
|
|
p_shader->uses_fragment_time = gen_code.uses_fragment_time;
|
|
|
|
|
|
|
|
for (SelfList<Material> *E = p_shader->materials.first(); E; E = E->next()) {
|
|
|
|
_material_make_dirty(E->self());
|
|
|
|
}
|
|
|
|
|
|
|
|
p_shader->valid = true;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::update_dirty_shaders() {
|
2020-11-18 19:11:30 +01:00
|
|
|
while (_shader_dirty_list.first()) {
|
|
|
|
_update_shader(_shader_dirty_list.first()->self());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
Shader *shader = shader_owner.get_or_null(p_shader);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!shader);
|
|
|
|
|
|
|
|
if (shader->dirty_list.in_list()) {
|
|
|
|
_update_shader(shader);
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<int, StringName> order;
|
|
|
|
|
|
|
|
for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = shader->uniforms.front(); E; E = E->next()) {
|
|
|
|
if (E->get().texture_order >= 0) {
|
|
|
|
order[E->get().texture_order + 100000] = E->key();
|
|
|
|
} else {
|
|
|
|
order[E->get().order] = E->key();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Map<int, StringName>::Element *E = order.front(); E; E = E->next()) {
|
|
|
|
PropertyInfo pi;
|
|
|
|
ShaderLanguage::ShaderNode::Uniform &u = shader->uniforms[E->get()];
|
|
|
|
|
|
|
|
pi.name = E->get();
|
|
|
|
|
|
|
|
switch (u.type) {
|
|
|
|
case ShaderLanguage::TYPE_VOID: {
|
|
|
|
pi.type = Variant::NIL;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ShaderLanguage::TYPE_BOOL: {
|
|
|
|
pi.type = Variant::BOOL;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
// bool vectors
|
|
|
|
case ShaderLanguage::TYPE_BVEC2: {
|
|
|
|
pi.type = Variant::INT;
|
|
|
|
pi.hint = PROPERTY_HINT_FLAGS;
|
|
|
|
pi.hint_string = "x,y";
|
|
|
|
} break;
|
|
|
|
case ShaderLanguage::TYPE_BVEC3: {
|
|
|
|
pi.type = Variant::INT;
|
|
|
|
pi.hint = PROPERTY_HINT_FLAGS;
|
|
|
|
pi.hint_string = "x,y,z";
|
|
|
|
} break;
|
|
|
|
case ShaderLanguage::TYPE_BVEC4: {
|
|
|
|
pi.type = Variant::INT;
|
|
|
|
pi.hint = PROPERTY_HINT_FLAGS;
|
|
|
|
pi.hint_string = "x,y,z,w";
|
|
|
|
} break;
|
|
|
|
|
|
|
|
// int stuff
|
|
|
|
case ShaderLanguage::TYPE_UINT:
|
|
|
|
case ShaderLanguage::TYPE_INT: {
|
|
|
|
pi.type = Variant::INT;
|
|
|
|
|
|
|
|
if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_RANGE) {
|
|
|
|
pi.hint = PROPERTY_HINT_RANGE;
|
|
|
|
pi.hint_string = rtos(u.hint_range[0]) + "," + rtos(u.hint_range[1]) + "," + rtos(u.hint_range[2]);
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ShaderLanguage::TYPE_IVEC2:
|
|
|
|
case ShaderLanguage::TYPE_UVEC2:
|
|
|
|
case ShaderLanguage::TYPE_IVEC3:
|
|
|
|
case ShaderLanguage::TYPE_UVEC3:
|
|
|
|
case ShaderLanguage::TYPE_IVEC4:
|
|
|
|
case ShaderLanguage::TYPE_UVEC4: {
|
|
|
|
// not sure what this should be in godot 4
|
|
|
|
// pi.type = Variant::POOL_INT_ARRAY;
|
|
|
|
pi.type = Variant::PACKED_INT32_ARRAY;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ShaderLanguage::TYPE_FLOAT: {
|
|
|
|
pi.type = Variant::FLOAT;
|
|
|
|
if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_RANGE) {
|
|
|
|
pi.hint = PROPERTY_HINT_RANGE;
|
|
|
|
pi.hint_string = rtos(u.hint_range[0]) + "," + rtos(u.hint_range[1]) + "," + rtos(u.hint_range[2]);
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ShaderLanguage::TYPE_VEC2: {
|
|
|
|
pi.type = Variant::VECTOR2;
|
|
|
|
} break;
|
|
|
|
case ShaderLanguage::TYPE_VEC3: {
|
|
|
|
pi.type = Variant::VECTOR3;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ShaderLanguage::TYPE_VEC4: {
|
|
|
|
if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
|
|
|
|
pi.type = Variant::COLOR;
|
|
|
|
} else {
|
|
|
|
pi.type = Variant::PLANE;
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ShaderLanguage::TYPE_MAT2: {
|
|
|
|
pi.type = Variant::TRANSFORM2D;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ShaderLanguage::TYPE_MAT3: {
|
|
|
|
pi.type = Variant::BASIS;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ShaderLanguage::TYPE_MAT4: {
|
|
|
|
pi.type = Variant::TRANSFORM3D;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ShaderLanguage::TYPE_SAMPLER2D:
|
|
|
|
// case ShaderLanguage::TYPE_SAMPLEREXT:
|
|
|
|
case ShaderLanguage::TYPE_ISAMPLER2D:
|
|
|
|
case ShaderLanguage::TYPE_USAMPLER2D: {
|
|
|
|
pi.type = Variant::OBJECT;
|
|
|
|
pi.hint = PROPERTY_HINT_RESOURCE_TYPE;
|
|
|
|
pi.hint_string = "Texture";
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ShaderLanguage::TYPE_SAMPLERCUBE: {
|
|
|
|
pi.type = Variant::OBJECT;
|
|
|
|
pi.hint = PROPERTY_HINT_RESOURCE_TYPE;
|
|
|
|
pi.hint_string = "CubeMap";
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ShaderLanguage::TYPE_SAMPLER2DARRAY:
|
|
|
|
case ShaderLanguage::TYPE_ISAMPLER2DARRAY:
|
|
|
|
case ShaderLanguage::TYPE_USAMPLER2DARRAY:
|
|
|
|
case ShaderLanguage::TYPE_SAMPLER3D:
|
|
|
|
case ShaderLanguage::TYPE_ISAMPLER3D:
|
|
|
|
case ShaderLanguage::TYPE_USAMPLER3D: {
|
2021-09-27 01:07:10 +02:00
|
|
|
// Not implemented in OpenGL
|
2020-11-18 19:11:30 +01:00
|
|
|
} break;
|
|
|
|
// new for godot 4
|
|
|
|
case ShaderLanguage::TYPE_SAMPLERCUBEARRAY:
|
|
|
|
case ShaderLanguage::TYPE_STRUCT:
|
|
|
|
case ShaderLanguage::TYPE_MAX: {
|
|
|
|
} break;
|
|
|
|
}
|
|
|
|
|
|
|
|
p_param_list->push_back(pi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-17 13:38:26 +02:00
|
|
|
void RasterizerStorageGLES3::shader_set_default_texture_param(RID p_shader, const StringName &p_name, RID p_texture, int p_index) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Shader *shader = shader_owner.get_or_null(p_shader);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!shader);
|
2022-03-12 12:19:59 +01:00
|
|
|
ERR_FAIL_COND(p_texture.is_valid() && !GLES3::TextureStorage::get_singleton()->owns_texture(p_texture));
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-17 13:38:26 +02:00
|
|
|
if (!p_texture.is_valid()) {
|
|
|
|
if (shader->default_textures.has(p_name) && shader->default_textures[p_name].has(p_index)) {
|
|
|
|
shader->default_textures[p_name].erase(p_index);
|
|
|
|
|
|
|
|
if (shader->default_textures[p_name].is_empty()) {
|
|
|
|
shader->default_textures.erase(p_name);
|
|
|
|
}
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
} else {
|
2021-10-17 13:38:26 +02:00
|
|
|
if (!shader->default_textures.has(p_name)) {
|
|
|
|
shader->default_textures[p_name] = Map<int, RID>();
|
|
|
|
}
|
|
|
|
shader->default_textures[p_name][p_index] = p_texture;
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_shader_make_dirty(shader);
|
|
|
|
}
|
|
|
|
|
2021-10-17 13:38:26 +02:00
|
|
|
RID RasterizerStorageGLES3::shader_get_default_texture_param(RID p_shader, const StringName &p_name, int p_index) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
const Shader *shader = shader_owner.get_or_null(p_shader);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!shader, RID());
|
|
|
|
|
2021-10-17 13:38:26 +02:00
|
|
|
if (shader->default_textures.has(p_name) && shader->default_textures[p_name].has(p_index)) {
|
|
|
|
return shader->default_textures[p_name][p_index];
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-17 13:38:26 +02:00
|
|
|
return RID();
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* COMMON MATERIAL API */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::_material_make_dirty(Material *p_material) const {
|
2022-01-27 17:34:33 +01:00
|
|
|
if (p_material->dirty_list.in_list()) {
|
2020-11-18 19:11:30 +01:00
|
|
|
return;
|
2022-01-27 17:34:33 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
_material_dirty_list.add(&p_material->dirty_list);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::material_allocate() {
|
2020-11-18 19:11:30 +01:00
|
|
|
Material *material = memnew(Material);
|
|
|
|
return material_owner.make_rid(material);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::material_initialize(RID p_rid) {
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
//RID RasterizerStorageGLES3::material_create() {
|
2020-11-18 19:11:30 +01:00
|
|
|
// Material *material = memnew(Material);
|
|
|
|
|
|
|
|
// return material_owner.make_rid(material);
|
|
|
|
//}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::material_set_shader(RID p_material, RID p_shader) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!material);
|
|
|
|
|
2021-09-27 01:07:10 +02:00
|
|
|
Shader *shader = shader_owner.get_or_null(p_shader);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
if (material->shader) {
|
|
|
|
// if a shader is present, remove the old shader
|
|
|
|
material->shader->materials.remove(&material->list);
|
|
|
|
}
|
|
|
|
|
|
|
|
material->shader = shader;
|
|
|
|
|
|
|
|
if (shader) {
|
|
|
|
shader->materials.add(&material->list);
|
|
|
|
}
|
|
|
|
|
|
|
|
_material_make_dirty(material);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::material_get_shader(RID p_material) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
const Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!material, RID());
|
|
|
|
|
|
|
|
if (material->shader) {
|
|
|
|
return material->shader->self;
|
|
|
|
}
|
|
|
|
|
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!material);
|
|
|
|
|
|
|
|
if (p_value.get_type() == Variant::NIL) {
|
|
|
|
material->params.erase(p_param);
|
|
|
|
} else {
|
|
|
|
material->params[p_param] = p_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
_material_make_dirty(material);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Variant RasterizerStorageGLES3::material_get_param(RID p_material, const StringName &p_param) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
const Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!material, RID());
|
|
|
|
|
|
|
|
if (material->params.has(p_param)) {
|
|
|
|
return material->params[p_param];
|
|
|
|
}
|
|
|
|
|
|
|
|
return material_get_param_default(p_material, p_param);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Variant RasterizerStorageGLES3::material_get_param_default(RID p_material, const StringName &p_param) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
const Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!material, Variant());
|
|
|
|
|
|
|
|
if (material->shader) {
|
|
|
|
if (material->shader->uniforms.has(p_param)) {
|
|
|
|
ShaderLanguage::ShaderNode::Uniform uniform = material->shader->uniforms[p_param];
|
|
|
|
Vector<ShaderLanguage::ConstantNode::Value> default_value = uniform.default_value;
|
|
|
|
return ShaderLanguage::constant_value_to_variant(default_value, uniform.type, uniform.hint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Variant();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::material_set_line_width(RID p_material, float p_width) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!material);
|
|
|
|
|
|
|
|
material->line_width = p_width;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::material_set_next_pass(RID p_material, RID p_next_material) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!material);
|
|
|
|
|
|
|
|
material->next_pass = p_next_material;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::material_is_animated(RID p_material) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!material, false);
|
|
|
|
if (material->dirty_list.in_list()) {
|
|
|
|
_update_material(material);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool animated = material->is_animated_cache;
|
|
|
|
if (!animated && material->next_pass.is_valid()) {
|
|
|
|
animated = material_is_animated(material->next_pass);
|
|
|
|
}
|
|
|
|
return animated;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::material_casts_shadows(RID p_material) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!material, false);
|
|
|
|
if (material->dirty_list.in_list()) {
|
|
|
|
_update_material(material);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool casts_shadows = material->can_cast_shadow_cache;
|
|
|
|
|
|
|
|
if (!casts_shadows && material->next_pass.is_valid()) {
|
|
|
|
casts_shadows = material_casts_shadows(material->next_pass);
|
|
|
|
}
|
|
|
|
|
|
|
|
return casts_shadows;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::material_uses_tangents(RID p_material) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!material, false);
|
|
|
|
|
|
|
|
if (!material->shader) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (material->shader->dirty_list.in_list()) {
|
|
|
|
_update_shader(material->shader);
|
|
|
|
}
|
|
|
|
|
|
|
|
return material->shader->spatial.uses_tangent;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::material_uses_ensure_correct_normals(RID p_material) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!material, false);
|
|
|
|
|
|
|
|
if (!material->shader) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (material->shader->dirty_list.in_list()) {
|
|
|
|
_update_shader(material->shader);
|
|
|
|
}
|
|
|
|
|
|
|
|
return material->shader->spatial.uses_ensure_correct_normals;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::material_add_instance_owner(RID p_material, DependencyTracker *p_instance) {
|
2020-11-18 19:11:30 +01:00
|
|
|
/*
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!material);
|
|
|
|
|
|
|
|
Map<InstanceBaseDependency *, int>::Element *E = material->instance_owners.find(p_instance);
|
|
|
|
if (E) {
|
|
|
|
E->get()++;
|
|
|
|
} else {
|
|
|
|
material->instance_owners[p_instance] = 1;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::material_remove_instance_owner(RID p_material, DependencyTracker *p_instance) {
|
2020-11-18 19:11:30 +01:00
|
|
|
/*
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!material);
|
|
|
|
|
|
|
|
Map<InstanceBaseDependency *, int>::Element *E = material->instance_owners.find(p_instance);
|
|
|
|
ERR_FAIL_COND(!E);
|
|
|
|
|
|
|
|
E->get()--;
|
|
|
|
|
|
|
|
if (E->get() == 0) {
|
|
|
|
material->instance_owners.erase(E);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::material_set_render_priority(RID p_material, int priority) {
|
2021-09-27 01:07:10 +02:00
|
|
|
ERR_FAIL_COND(priority < RS::MATERIAL_RENDER_PRIORITY_MIN);
|
|
|
|
ERR_FAIL_COND(priority > RS::MATERIAL_RENDER_PRIORITY_MAX);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!material);
|
|
|
|
|
|
|
|
material->render_priority = priority;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::_update_material(Material *p_material) {
|
2020-11-18 19:11:30 +01:00
|
|
|
if (p_material->dirty_list.in_list()) {
|
|
|
|
_material_dirty_list.remove(&p_material->dirty_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_material->shader && p_material->shader->dirty_list.in_list()) {
|
|
|
|
_update_shader(p_material->shader);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_material->shader && !p_material->shader->valid) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
bool can_cast_shadow = false;
|
|
|
|
bool is_animated = false;
|
|
|
|
|
2021-09-27 01:07:10 +02:00
|
|
|
if (p_material->shader && p_material->shader->mode == RS::SHADER_SPATIAL) {
|
2020-11-18 19:11:30 +01:00
|
|
|
if (p_material->shader->spatial.blend_mode == Shader::Spatial::BLEND_MODE_MIX &&
|
|
|
|
(!p_material->shader->spatial.uses_alpha || p_material->shader->spatial.depth_draw_mode == Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS)) {
|
|
|
|
can_cast_shadow = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_material->shader->spatial.uses_discard && p_material->shader->uses_fragment_time) {
|
|
|
|
is_animated = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_material->shader->spatial.uses_vertex && p_material->shader->uses_vertex_time) {
|
|
|
|
is_animated = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (can_cast_shadow != p_material->can_cast_shadow_cache || is_animated != p_material->is_animated_cache) {
|
|
|
|
p_material->can_cast_shadow_cache = can_cast_shadow;
|
|
|
|
p_material->is_animated_cache = is_animated;
|
|
|
|
|
|
|
|
/*
|
|
|
|
for (Map<Geometry *, int>::Element *E = p_material->geometry_owners.front(); E; E = E->next()) {
|
|
|
|
E->key()->material_changed_notify();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Map<InstanceBaseDependency *, int>::Element *E = p_material->instance_owners.front(); E; E = E->next()) {
|
|
|
|
E->key()->base_changed(false, true);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
// uniforms and other things will be set in the use_material method in ShaderGLES3
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
if (p_material->shader && p_material->shader->texture_uniforms.size() > 0) {
|
|
|
|
p_material->textures.resize(p_material->shader->texture_uniforms.size());
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = p_material->shader->uniforms.front(); E; E = E->next()) {
|
2022-01-27 17:34:33 +01:00
|
|
|
if (E->get().texture_order < 0) {
|
2020-11-18 19:11:30 +01:00
|
|
|
continue; // not a texture, does not go here
|
2022-01-27 17:34:33 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
RID texture;
|
|
|
|
|
|
|
|
Map<StringName, Variant>::Element *V = p_material->params.find(E->key());
|
|
|
|
|
|
|
|
if (V) {
|
|
|
|
texture = V->get();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!texture.is_valid()) {
|
2021-10-17 13:38:26 +02:00
|
|
|
Map<StringName, Map<int, RID>>::Element *W = p_material->shader->default_textures.find(E->key());
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-17 13:38:26 +02:00
|
|
|
// TODO: make texture uniform array properly works with GLES3
|
|
|
|
if (W && W->get().has(0)) {
|
|
|
|
texture = W->get()[0];
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
p_material->textures.write[E->get().texture_order] = Pair<StringName, RID>(E->key(), texture);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
p_material->textures.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::_material_add_geometry(RID p_material, Geometry *p_geometry) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!material);
|
|
|
|
|
|
|
|
Map<Geometry *, int>::Element *I = material->geometry_owners.find(p_geometry);
|
|
|
|
|
|
|
|
if (I) {
|
|
|
|
I->get()++;
|
|
|
|
} else {
|
|
|
|
material->geometry_owners[p_geometry] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::_material_remove_geometry(RID p_material, Geometry *p_geometry) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *material = material_owner.get_or_null(p_material);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!material);
|
|
|
|
|
|
|
|
Map<Geometry *, int>::Element *I = material->geometry_owners.find(p_geometry);
|
|
|
|
ERR_FAIL_COND(!I);
|
|
|
|
|
|
|
|
I->get()--;
|
|
|
|
|
|
|
|
if (I->get() == 0) {
|
|
|
|
material->geometry_owners.erase(I);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::update_dirty_materials() {
|
2020-11-18 19:11:30 +01:00
|
|
|
while (_material_dirty_list.first()) {
|
|
|
|
Material *material = _material_dirty_list.first()->self();
|
|
|
|
_update_material(material);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-27 01:07:10 +02:00
|
|
|
/* MESH API */
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::mesh_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_set_blend_shape_count(RID p_mesh, int p_blend_shape_count) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::mesh_needs_instance(RID p_mesh, bool p_has_skeleton) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::mesh_instance_create(RID p_base) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_instance_set_skeleton(RID p_mesh_instance, RID p_skeleton) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_instance_set_blend_shape_weight(RID p_mesh_instance, int p_shape, float p_weight) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_instance_check_for_update(RID p_mesh_instance) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::update_mesh_instances() {
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2021-12-29 00:10:41 +01:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_mesh_lod_threshold(RID p_probe, float p_ratio) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-12-29 00:10:41 +01:00
|
|
|
float RasterizerStorageGLES3::reflection_probe_get_mesh_lod_threshold(RID p_probe) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0.0;
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
int RasterizerStorageGLES3::mesh_get_blend_shape_count(RID p_mesh) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_set_blend_shape_mode(RID p_mesh, RS::BlendShapeMode p_mode) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RS::BlendShapeMode RasterizerStorageGLES3::mesh_get_blend_shape_mode(RID p_mesh) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::BLEND_SHAPE_MODE_NORMALIZED;
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_surface_update_vertex_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_surface_update_attribute_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_surface_update_skin_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::mesh_surface_get_material(RID p_mesh, int p_surface) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RS::SurfaceData RasterizerStorageGLES3::mesh_get_surface(RID p_mesh, int p_surface) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::SurfaceData();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
int RasterizerStorageGLES3::mesh_get_surface_count(RID p_mesh) const {
|
2021-11-16 16:25:42 +01:00
|
|
|
return 1;
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::mesh_get_custom_aabb(RID p_mesh) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::mesh_clear(RID p_mesh) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-09-27 01:07:10 +02:00
|
|
|
/* MULTIMESH API */
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::multimesh_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::multimesh_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::multimesh_allocate_data(RID p_multimesh, int p_instances, RS::MultimeshTransformFormat p_transform_format, bool p_use_colors, bool p_use_custom_data) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
int RasterizerStorageGLES3::multimesh_get_instance_count(RID p_multimesh) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::multimesh_set_mesh(RID p_multimesh, RID p_mesh) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::multimesh_instance_set_transform(RID p_multimesh, int p_index, const Transform3D &p_transform) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::multimesh_instance_set_transform_2d(RID p_multimesh, int p_index, const Transform2D &p_transform) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::multimesh_instance_set_custom_data(RID p_multimesh, int p_index, const Color &p_color) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::multimesh_get_mesh(RID p_multimesh) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::multimesh_get_aabb(RID p_multimesh) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Transform3D RasterizerStorageGLES3::multimesh_instance_get_transform(RID p_multimesh, int p_index) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Transform3D();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Transform2D RasterizerStorageGLES3::multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Transform2D();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Color RasterizerStorageGLES3::multimesh_instance_get_color(RID p_multimesh, int p_index) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Color();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Color RasterizerStorageGLES3::multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Color();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector<float> RasterizerStorageGLES3::multimesh_get_buffer(RID p_multimesh) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector<float>();
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::multimesh_set_visible_instances(RID p_multimesh, int p_visible) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
int RasterizerStorageGLES3::multimesh_get_visible_instances(RID p_multimesh) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-09-27 01:07:10 +02:00
|
|
|
/* SKELETON API */
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::skeleton_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::skeleton_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::skeleton_allocate_data(RID p_skeleton, int p_bones, bool p_2d_skeleton) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
int RasterizerStorageGLES3::skeleton_get_bone_count(RID p_skeleton) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::skeleton_bone_set_transform(RID p_skeleton, int p_bone, const Transform3D &p_transform) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Transform3D RasterizerStorageGLES3::skeleton_bone_get_transform(RID p_skeleton, int p_bone) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Transform3D();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Transform2D RasterizerStorageGLES3::skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Transform2D();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Light API */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::directional_light_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::directional_light_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::omni_light_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::omni_light_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::spot_light_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::spot_light_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::reflection_probe_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_set_color(RID p_light, const Color &p_color) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_set_param(RID p_light, RS::LightParam p_param, float p_value) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_set_shadow(RID p_light, bool p_enabled) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_set_projector(RID p_light, RID p_texture) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_set_negative(RID p_light, bool p_enable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_set_cull_mask(RID p_light, uint32_t p_mask) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2022-02-24 22:55:14 +01:00
|
|
|
void RasterizerStorageGLES3::light_set_distance_fade(RID p_light, bool p_enabled, float p_begin, float p_shadow, float p_length) {
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_set_bake_mode(RID p_light, RS::LightBakeMode p_bake_mode) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_set_max_sdfgi_cascade(RID p_light, uint32_t p_cascade) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_directional_set_shadow_mode(RID p_light, RS::LightDirectionalShadowMode p_mode) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_directional_set_blend_splits(RID p_light, bool p_enable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::light_directional_get_blend_splits(RID p_light) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::light_directional_set_sky_only(RID p_light, bool p_sky_only) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::light_directional_is_sky_only(RID p_light) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RS::LightDirectionalShadowMode RasterizerStorageGLES3::light_directional_get_shadow_mode(RID p_light) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RS::LightOmniShadowMode RasterizerStorageGLES3::light_omni_get_shadow_mode(RID p_light) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::light_has_shadow(RID p_light) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::light_has_projector(RID p_light) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RS::LightType RasterizerStorageGLES3::light_get_type(RID p_light) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::LIGHT_OMNI;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::light_get_aabb(RID p_light) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::light_get_param(RID p_light, RS::LightParam p_param) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Color RasterizerStorageGLES3::light_get_color(RID p_light) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Color();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RS::LightBakeMode RasterizerStorageGLES3::light_get_bake_mode(RID p_light) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::LIGHT_BAKE_DISABLED;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
uint32_t RasterizerStorageGLES3::light_get_max_sdfgi_cascade(RID p_light) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
uint64_t RasterizerStorageGLES3::light_get_version(RID p_light) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PROBE API */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_update_mode(RID p_probe, RS::ReflectionProbeUpdateMode p_mode) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_intensity(RID p_probe, float p_intensity) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_ambient_mode(RID p_probe, RS::ReflectionProbeAmbientMode p_mode) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_ambient_color(RID p_probe, const Color &p_color) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_ambient_energy(RID p_probe, float p_energy) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_max_distance(RID p_probe, float p_distance) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_as_interior(RID p_probe, bool p_enable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_enable_shadows(RID p_probe, bool p_enable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::reflection_probe_set_resolution(RID p_probe, int p_resolution) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::reflection_probe_get_aabb(RID p_probe) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RS::ReflectionProbeUpdateMode RasterizerStorageGLES3::reflection_probe_get_update_mode(RID p_probe) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RenderingServer::REFLECTION_PROBE_UPDATE_ONCE;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
uint32_t RasterizerStorageGLES3::reflection_probe_get_cull_mask(RID p_probe) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector3 RasterizerStorageGLES3::reflection_probe_get_extents(RID p_probe) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector3();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector3 RasterizerStorageGLES3::reflection_probe_get_origin_offset(RID p_probe) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector3();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::reflection_probe_get_origin_max_distance(RID p_probe) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::reflection_probe_renders_shadows(RID p_probe) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::base_update_dependency(RID p_base, DependencyTracker *p_instance) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::skeleton_update_dependency(RID p_base, DependencyTracker *p_instance) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* DECAL API */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::decal_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::decal_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::decal_set_extents(RID p_decal, const Vector3 &p_extents) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::decal_set_emission_energy(RID p_decal, float p_energy) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::decal_set_albedo_mix(RID p_decal, float p_mix) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::decal_set_modulate(RID p_decal, const Color &p_modulate) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::decal_set_cull_mask(RID p_decal, uint32_t p_layers) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::decal_set_distance_fade(RID p_decal, bool p_enabled, float p_begin, float p_length) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::decal_set_fade(RID p_decal, float p_above, float p_below) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::decal_set_normal_fade(RID p_decal, float p_fade) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::decal_get_aabb(RID p_decal) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* VOXEL GI API */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::voxel_gi_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_allocate_data(RID p_voxel_gi, const Transform3D &p_to_cell_xform, const AABB &p_aabb, const Vector3i &p_octree_size, const Vector<uint8_t> &p_octree_cells, const Vector<uint8_t> &p_data_cells, const Vector<uint8_t> &p_distance_field, const Vector<int> &p_level_counts) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::voxel_gi_get_bounds(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector3i RasterizerStorageGLES3::voxel_gi_get_octree_size(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector3i();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector<uint8_t> RasterizerStorageGLES3::voxel_gi_get_octree_cells(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector<uint8_t>();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector<uint8_t> RasterizerStorageGLES3::voxel_gi_get_data_cells(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector<uint8_t>();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector<uint8_t> RasterizerStorageGLES3::voxel_gi_get_distance_field(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector<uint8_t>();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector<int> RasterizerStorageGLES3::voxel_gi_get_level_counts(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector<int>();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Transform3D RasterizerStorageGLES3::voxel_gi_get_to_cell_xform(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Transform3D();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_dynamic_range(RID p_voxel_gi, float p_range) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::voxel_gi_get_dynamic_range(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_propagation(RID p_voxel_gi, float p_range) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::voxel_gi_get_propagation(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_energy(RID p_voxel_gi, float p_range) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::voxel_gi_get_energy(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_bias(RID p_voxel_gi, float p_range) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::voxel_gi_get_bias(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_normal_bias(RID p_voxel_gi, float p_range) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::voxel_gi_get_normal_bias(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_interior(RID p_voxel_gi, bool p_enable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::voxel_gi_is_interior(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_use_two_bounces(RID p_voxel_gi, bool p_enable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::voxel_gi_is_using_two_bounces(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_anisotropy_strength(RID p_voxel_gi, float p_strength) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::voxel_gi_get_anisotropy_strength(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
uint32_t RasterizerStorageGLES3::voxel_gi_get_version(RID p_voxel_gi) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* LIGHTMAP CAPTURE */
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::lightmap_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::lightmap_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::lightmap_set_textures(RID p_lightmap, RID p_light, bool p_uses_spherical_haromics) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::lightmap_set_probe_bounds(RID p_lightmap, const AABB &p_bounds) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::lightmap_set_probe_interior(RID p_lightmap, bool p_interior) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::lightmap_set_probe_capture_data(RID p_lightmap, const PackedVector3Array &p_points, const PackedColorArray &p_point_sh, const PackedInt32Array &p_tetrahedra, const PackedInt32Array &p_bsp_tree) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
PackedVector3Array RasterizerStorageGLES3::lightmap_get_probe_capture_points(RID p_lightmap) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return PackedVector3Array();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
PackedColorArray RasterizerStorageGLES3::lightmap_get_probe_capture_sh(RID p_lightmap) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return PackedColorArray();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
PackedInt32Array RasterizerStorageGLES3::lightmap_get_probe_capture_tetrahedra(RID p_lightmap) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return PackedInt32Array();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
PackedInt32Array RasterizerStorageGLES3::lightmap_get_probe_capture_bsp_tree(RID p_lightmap) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return PackedInt32Array();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::lightmap_get_aabb(RID p_lightmap) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::lightmap_tap_sh_light(RID p_lightmap, const Vector3 &p_point, Color *r_sh) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::lightmap_is_interior(RID p_lightmap) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::lightmap_set_probe_capture_update_speed(float p_speed) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::lightmap_get_probe_capture_update_speed() const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* OCCLUDER */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::occluder_set_mesh(RID p_occluder, const PackedVector3Array &p_vertices, const PackedInt32Array &p_indices) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* PARTICLES */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::particles_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_mode(RID p_particles, RS::ParticlesMode p_mode) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_emit(RID p_particles, const Transform3D &p_transform, const Vector3 &p_velocity, const Color &p_color, const Color &p_custom, uint32_t p_emit_flags) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_emitting(RID p_particles, bool p_emitting) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_amount(RID p_particles, int p_amount) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_lifetime(RID p_particles, double p_lifetime) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_one_shot(RID p_particles, bool p_one_shot) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_pre_process_time(RID p_particles, double p_time) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_explosiveness_ratio(RID p_particles, real_t p_ratio) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_randomness_ratio(RID p_particles, real_t p_ratio) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_custom_aabb(RID p_particles, const AABB &p_aabb) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_speed_scale(RID p_particles, double p_scale) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_use_local_coordinates(RID p_particles, bool p_enable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_process_material(RID p_particles, RID p_material) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
2022-02-14 13:27:10 +01:00
|
|
|
RID RasterizerStorageGLES3::particles_get_process_material(RID p_particles) const {
|
|
|
|
return RID();
|
|
|
|
}
|
2021-09-27 01:07:10 +02:00
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_fixed_fps(RID p_particles, int p_fps) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_interpolate(RID p_particles, bool p_enable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_fractional_delta(RID p_particles, bool p_enable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_subemitter(RID p_particles, RID p_subemitter_particles) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_view_axis(RID p_particles, const Vector3 &p_axis, const Vector3 &p_up_axis) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_collision_base_size(RID p_particles, real_t p_size) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_transform_align(RID p_particles, RS::ParticlesTransformAlign p_transform_align) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_trails(RID p_particles, bool p_enable, double p_length) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_trail_bind_poses(RID p_particles, const Vector<Transform3D> &p_bind_poses) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_restart(RID p_particles) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_draw_order(RID p_particles, RS::ParticlesDrawOrder p_order) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_draw_passes(RID p_particles, int p_count) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_request_process(RID p_particles) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::particles_get_aabb(RID p_particles) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_emission_transform(RID p_particles, const Transform3D &p_transform) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::particles_get_emitting(RID p_particles) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
int RasterizerStorageGLES3::particles_get_draw_passes(RID p_particles) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::particles_get_draw_pass_mesh(RID p_particles, int p_pass) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_add_collision(RID p_particles, RID p_instance) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_remove_collision(RID p_particles, RID p_instance) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_set_canvas_sdf_collision(RID p_particles, bool p_enable, const Transform2D &p_xform, const Rect2 &p_to_screen, RID p_texture) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::update_particles() {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* PARTICLES COLLISION */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::particles_collision_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_set_collision_type(RID p_particles_collision, RS::ParticlesCollisionType p_type) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_set_cull_mask(RID p_particles_collision, uint32_t p_cull_mask) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_set_sphere_radius(RID p_particles_collision, real_t p_radius) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_set_box_extents(RID p_particles_collision, const Vector3 &p_extents) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_set_attractor_strength(RID p_particles_collision, real_t p_strength) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_set_attractor_directionality(RID p_particles_collision, real_t p_directionality) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_set_attractor_attenuation(RID p_particles_collision, real_t p_curve) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_set_field_texture(RID p_particles_collision, RID p_texture) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_height_field_update(RID p_particles_collision) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_set_height_field_resolution(RID p_particles_collision, RS::ParticlesCollisionHeightfieldResolution p_resolution) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::particles_collision_get_aabb(RID p_particles_collision) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::particles_collision_is_heightfield(RID p_particles_collision) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::particles_collision_get_heightfield_framebuffer(RID p_particles_collision) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::particles_collision_instance_create(RID p_collision) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_instance_set_transform(RID p_collision_instance, const Transform3D &p_transform) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::particles_collision_instance_set_active(RID p_collision_instance, bool p_active) {
|
|
|
|
}
|
|
|
|
|
|
|
|
RID RasterizerStorageGLES3::fog_volume_allocate() {
|
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RasterizerStorageGLES3::fog_volume_initialize(RID p_rid) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void RasterizerStorageGLES3::fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void RasterizerStorageGLES3::fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void RasterizerStorageGLES3::fog_volume_set_material(RID p_fog_volume, RID p_material) {
|
|
|
|
}
|
|
|
|
|
|
|
|
AABB RasterizerStorageGLES3::fog_volume_get_aabb(RID p_fog_volume) const {
|
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
|
|
|
RS::FogVolumeShape RasterizerStorageGLES3::fog_volume_get_shape(RID p_fog_volume) const {
|
|
|
|
return RS::FOG_VOLUME_SHAPE_BOX;
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* VISIBILITY NOTIFIER */
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::visibility_notifier_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::visibility_notifier_initialize(RID p_notifier) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::visibility_notifier_set_aabb(RID p_notifier, const AABB &p_aabb) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::visibility_notifier_set_callbacks(RID p_notifier, const Callable &p_enter_callbable, const Callable &p_exit_callable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::visibility_notifier_get_aabb(RID p_notifier) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::visibility_notifier_call(RID p_notifier, bool p_enter, bool p_deferred) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* GLOBAL VARIABLES */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::global_variable_add(const StringName &p_name, RS::GlobalVariableType p_type, const Variant &p_value) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::global_variable_remove(const StringName &p_name) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector<StringName> RasterizerStorageGLES3::global_variable_get_list() const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector<StringName>();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::global_variable_set(const StringName &p_name, const Variant &p_value) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::global_variable_set_override(const StringName &p_name, const Variant &p_value) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Variant RasterizerStorageGLES3::global_variable_get(const StringName &p_name) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Variant();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RS::GlobalVariableType RasterizerStorageGLES3::global_variable_get_type(const StringName &p_name) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::GLOBAL_VAR_TYPE_MAX;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::global_variables_load_settings(bool p_load_textures) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::global_variables_clear() {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
int32_t RasterizerStorageGLES3::global_variables_instance_allocate(RID p_instance) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::global_variables_instance_free(RID p_instance) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::global_variables_instance_update(RID p_instance, int p_index, const Variant &p_value) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::particles_is_inactive(RID p_particles) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* RENDER TARGET */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::_set_current_render_target(RID p_render_target) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2021-09-27 01:07:10 +02:00
|
|
|
|
|
|
|
if (rt) {
|
|
|
|
if (rt->allocate_is_dirty) {
|
|
|
|
rt->allocate_is_dirty = false;
|
|
|
|
_render_target_allocate(rt);
|
|
|
|
}
|
|
|
|
|
|
|
|
frame.current_rt = rt;
|
|
|
|
ERR_FAIL_COND(!rt);
|
|
|
|
frame.clear_request = false;
|
|
|
|
|
|
|
|
glViewport(0, 0, rt->width, rt->height);
|
|
|
|
|
|
|
|
_dims.rt_width = rt->width;
|
|
|
|
_dims.rt_height = rt->height;
|
|
|
|
_dims.win_width = rt->width;
|
|
|
|
_dims.win_height = rt->height;
|
|
|
|
|
|
|
|
} else {
|
2022-01-27 17:34:33 +01:00
|
|
|
frame.current_rt = nullptr;
|
2021-09-27 01:07:10 +02:00
|
|
|
frame.clear_request = false;
|
|
|
|
bind_framebuffer_system();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
void RasterizerStorageGLES3::_render_target_allocate(GLES3::RenderTarget *rt) {
|
2021-09-27 01:07:10 +02:00
|
|
|
// do not allocate a render target with no size
|
2022-01-27 17:34:33 +01:00
|
|
|
if (rt->width <= 0 || rt->height <= 0) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return;
|
2022-01-27 17:34:33 +01:00
|
|
|
}
|
2021-09-27 01:07:10 +02:00
|
|
|
|
|
|
|
// do not allocate a render target that is attached to the screen
|
|
|
|
if (rt->flags[RENDER_TARGET_DIRECT_TO_SCREEN]) {
|
2021-10-26 17:18:39 +02:00
|
|
|
rt->fbo = RasterizerStorageGLES3::system_fbo;
|
2021-09-27 01:07:10 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GLuint color_internal_format;
|
|
|
|
GLuint color_format;
|
|
|
|
GLuint color_type = GL_UNSIGNED_BYTE;
|
|
|
|
Image::Format image_format;
|
|
|
|
|
|
|
|
if (rt->flags[RendererStorage::RENDER_TARGET_TRANSPARENT]) {
|
|
|
|
#ifdef GLES_OVER_GL
|
|
|
|
color_internal_format = GL_RGBA8;
|
|
|
|
#else
|
|
|
|
color_internal_format = GL_RGBA;
|
|
|
|
#endif
|
|
|
|
color_format = GL_RGBA;
|
|
|
|
image_format = Image::FORMAT_RGBA8;
|
|
|
|
} else {
|
|
|
|
#ifdef GLES_OVER_GL
|
|
|
|
color_internal_format = GL_RGB8;
|
|
|
|
#else
|
|
|
|
color_internal_format = GL_RGB;
|
|
|
|
#endif
|
|
|
|
color_format = GL_RGB;
|
|
|
|
image_format = Image::FORMAT_RGB8;
|
|
|
|
}
|
|
|
|
|
|
|
|
rt->used_dof_blur_near = false;
|
|
|
|
rt->mip_maps_allocated = false;
|
|
|
|
|
|
|
|
{
|
|
|
|
/* Front FBO */
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::Texture *texture = GLES3::TextureStorage::get_singleton()->get_texture(rt->texture);
|
2021-09-27 01:07:10 +02:00
|
|
|
ERR_FAIL_COND(!texture);
|
|
|
|
|
|
|
|
// framebuffer
|
|
|
|
glGenFramebuffers(1, &rt->fbo);
|
|
|
|
bind_framebuffer(rt->fbo);
|
|
|
|
|
|
|
|
// color
|
|
|
|
glGenTextures(1, &rt->color);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, rt->color);
|
|
|
|
|
2022-01-27 17:34:33 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, nullptr);
|
2021-09-27 01:07:10 +02:00
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
if (texture->flags & GLES3::TEXTURE_FLAG_FILTER) {
|
2021-09-27 01:07:10 +02:00
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
|
|
} else {
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
|
|
}
|
|
|
|
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
|
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0);
|
|
|
|
|
|
|
|
// depth
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
if (config->support_depth_texture) {
|
2021-09-27 01:07:10 +02:00
|
|
|
glGenTextures(1, &rt->depth);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, rt->depth);
|
2022-03-12 12:19:59 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, config->depth_internalformat, rt->width, rt->height, 0, GL_DEPTH_COMPONENT, config->depth_type, nullptr);
|
2021-09-27 01:07:10 +02:00
|
|
|
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
|
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, rt->depth, 0);
|
|
|
|
} else {
|
|
|
|
glGenRenderbuffers(1, &rt->depth);
|
|
|
|
glBindRenderbuffer(GL_RENDERBUFFER, rt->depth);
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
glRenderbufferStorage(GL_RENDERBUFFER, config->depth_buffer_internalformat, rt->width, rt->height);
|
2021-09-27 01:07:10 +02:00
|
|
|
|
|
|
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
|
|
|
|
}
|
|
|
|
|
|
|
|
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
|
|
|
|
|
|
|
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
|
|
|
glDeleteFramebuffers(1, &rt->fbo);
|
2022-03-12 12:19:59 +01:00
|
|
|
if (config->support_depth_texture) {
|
2021-09-27 01:07:10 +02:00
|
|
|
glDeleteTextures(1, &rt->depth);
|
|
|
|
} else {
|
|
|
|
glDeleteRenderbuffers(1, &rt->depth);
|
|
|
|
}
|
|
|
|
|
|
|
|
glDeleteTextures(1, &rt->color);
|
|
|
|
rt->fbo = 0;
|
|
|
|
rt->width = 0;
|
|
|
|
rt->height = 0;
|
|
|
|
rt->color = 0;
|
|
|
|
rt->depth = 0;
|
|
|
|
texture->tex_id = 0;
|
|
|
|
texture->active = false;
|
|
|
|
WARN_PRINT("Could not create framebuffer!!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
texture->format = image_format;
|
|
|
|
texture->gl_format_cache = color_format;
|
|
|
|
texture->gl_type_cache = GL_UNSIGNED_BYTE;
|
|
|
|
texture->gl_internal_format_cache = color_internal_format;
|
|
|
|
texture->tex_id = rt->color;
|
|
|
|
texture->width = rt->width;
|
|
|
|
texture->alloc_width = rt->width;
|
|
|
|
texture->height = rt->height;
|
|
|
|
texture->alloc_height = rt->height;
|
|
|
|
texture->active = true;
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::TextureStorage::get_singleton()->texture_set_flags(rt->texture, texture->flags);
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* BACK FBO */
|
|
|
|
/* For MSAA */
|
|
|
|
|
|
|
|
#ifndef JAVASCRIPT_ENABLED
|
2021-10-26 17:18:39 +02:00
|
|
|
if (rt->msaa >= RS::VIEWPORT_MSAA_2X && rt->msaa <= RS::VIEWPORT_MSAA_8X) {
|
2021-09-27 01:07:10 +02:00
|
|
|
rt->multisample_active = true;
|
|
|
|
|
|
|
|
static const int msaa_value[] = { 0, 2, 4, 8, 16 };
|
|
|
|
int msaa = msaa_value[rt->msaa];
|
|
|
|
|
|
|
|
int max_samples = 0;
|
|
|
|
glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
|
|
|
|
if (msaa > max_samples) {
|
|
|
|
WARN_PRINT("MSAA must be <= GL_MAX_SAMPLES, falling-back to GL_MAX_SAMPLES = " + itos(max_samples));
|
|
|
|
msaa = max_samples;
|
|
|
|
}
|
|
|
|
|
|
|
|
//regular fbo
|
|
|
|
glGenFramebuffers(1, &rt->multisample_fbo);
|
|
|
|
bind_framebuffer(rt->multisample_fbo);
|
|
|
|
|
|
|
|
glGenRenderbuffers(1, &rt->multisample_depth);
|
|
|
|
glBindRenderbuffer(GL_RENDERBUFFER, rt->multisample_depth);
|
2022-03-12 12:19:59 +01:00
|
|
|
glRenderbufferStorageMultisample(GL_RENDERBUFFER, msaa, config->depth_buffer_internalformat, rt->width, rt->height);
|
2021-09-27 01:07:10 +02:00
|
|
|
|
|
|
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->multisample_depth);
|
|
|
|
|
|
|
|
glGenRenderbuffers(1, &rt->multisample_color);
|
|
|
|
glBindRenderbuffer(GL_RENDERBUFFER, rt->multisample_color);
|
|
|
|
glRenderbufferStorageMultisample(GL_RENDERBUFFER, msaa, color_internal_format, rt->width, rt->height);
|
|
|
|
|
|
|
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rt->multisample_color);
|
|
|
|
|
|
|
|
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
|
|
|
|
|
|
|
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
|
|
|
// Delete allocated resources and default to no MSAA
|
|
|
|
WARN_PRINT_ONCE("Cannot allocate back framebuffer for MSAA");
|
2020-11-18 19:11:30 +01:00
|
|
|
printf("err status: %x\n", status);
|
|
|
|
rt->multisample_active = false;
|
|
|
|
|
|
|
|
glDeleteFramebuffers(1, &rt->multisample_fbo);
|
|
|
|
rt->multisample_fbo = 0;
|
|
|
|
|
|
|
|
glDeleteRenderbuffers(1, &rt->multisample_depth);
|
|
|
|
rt->multisample_depth = 0;
|
2021-10-26 17:18:39 +02:00
|
|
|
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteRenderbuffers(1, &rt->multisample_color);
|
|
|
|
rt->multisample_color = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
|
|
|
bind_framebuffer(0);
|
|
|
|
|
|
|
|
} else
|
|
|
|
#endif // JAVASCRIPT_ENABLED
|
|
|
|
{
|
|
|
|
rt->multisample_active = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
glClearColor(0, 0, 0, 0);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
|
|
|
|
|
|
// copy texscreen buffers
|
|
|
|
// if (!(rt->flags[RendererStorage::RENDER_TARGET_NO_SAMPLING])) {
|
|
|
|
if (true) {
|
|
|
|
glGenTextures(1, &rt->copy_screen_effect.color);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, rt->copy_screen_effect.color);
|
|
|
|
|
|
|
|
if (rt->flags[RendererStorage::RENDER_TARGET_TRANSPARENT]) {
|
2022-01-27 17:34:33 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
2020-11-18 19:11:30 +01:00
|
|
|
} else {
|
2022-01-27 17:34:33 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, rt->width, rt->height, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
|
|
|
|
glGenFramebuffers(1, &rt->copy_screen_effect.fbo);
|
|
|
|
bind_framebuffer(rt->copy_screen_effect.fbo);
|
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->copy_screen_effect.color, 0);
|
|
|
|
|
|
|
|
glClearColor(0, 0, 0, 0);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
|
|
|
|
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
|
|
|
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
|
|
|
_render_target_clear(rt);
|
|
|
|
ERR_FAIL_COND(status != GL_FRAMEBUFFER_COMPLETE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Allocate mipmap chains for post_process effects
|
|
|
|
// if (!rt->flags[RendererStorage::RENDER_TARGET_NO_3D] && rt->width >= 2 && rt->height >= 2) {
|
|
|
|
if (rt->width >= 2 && rt->height >= 2) {
|
|
|
|
for (int i = 0; i < 2; i++) {
|
|
|
|
ERR_FAIL_COND(rt->mip_maps[i].sizes.size());
|
|
|
|
int w = rt->width;
|
|
|
|
int h = rt->height;
|
|
|
|
|
|
|
|
if (i > 0) {
|
|
|
|
w >>= 1;
|
|
|
|
h >>= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int level = 0;
|
|
|
|
int fb_w = w;
|
|
|
|
int fb_h = h;
|
|
|
|
|
|
|
|
while (true) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget::MipMaps::Size mm;
|
2020-11-18 19:11:30 +01:00
|
|
|
mm.width = w;
|
|
|
|
mm.height = h;
|
|
|
|
rt->mip_maps[i].sizes.push_back(mm);
|
|
|
|
|
|
|
|
w >>= 1;
|
|
|
|
h >>= 1;
|
|
|
|
|
2022-01-27 17:34:33 +01:00
|
|
|
if (w < 2 || h < 2) {
|
2020-11-18 19:11:30 +01:00
|
|
|
break;
|
2022-01-27 17:34:33 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
level++;
|
|
|
|
}
|
|
|
|
|
|
|
|
GLsizei width = fb_w;
|
|
|
|
GLsizei height = fb_h;
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
if (config->render_to_mipmap_supported) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glGenTextures(1, &rt->mip_maps[i].color);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, rt->mip_maps[i].color);
|
|
|
|
|
|
|
|
for (int l = 0; l < level + 1; l++) {
|
2022-01-27 17:34:33 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, l, color_internal_format, width, height, 0, color_format, color_type, nullptr);
|
2020-11-18 19:11:30 +01:00
|
|
|
width = MAX(1, (width / 2));
|
|
|
|
height = MAX(1, (height / 2));
|
|
|
|
}
|
|
|
|
#ifdef GLES_OVER_GL
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level);
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
// Can't render to specific levels of a mipmap in ES 2.0 or Webgl so create a texture for each level
|
|
|
|
for (int l = 0; l < level + 1; l++) {
|
|
|
|
glGenTextures(1, &rt->mip_maps[i].sizes.write[l].color);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, rt->mip_maps[i].sizes[l].color);
|
2022-01-27 17:34:33 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, width, height, 0, color_format, color_type, nullptr);
|
2020-11-18 19:11:30 +01:00
|
|
|
width = MAX(1, (width / 2));
|
|
|
|
height = MAX(1, (height / 2));
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
glDisable(GL_SCISSOR_TEST);
|
|
|
|
glColorMask(1, 1, 1, 1);
|
|
|
|
glDepthMask(GL_TRUE);
|
|
|
|
|
|
|
|
for (int j = 0; j < rt->mip_maps[i].sizes.size(); j++) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget::MipMaps::Size &mm = rt->mip_maps[i].sizes.write[j];
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
glGenFramebuffers(1, &mm.fbo);
|
|
|
|
bind_framebuffer(mm.fbo);
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
if (config->render_to_mipmap_supported) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->mip_maps[i].color, j);
|
|
|
|
} else {
|
|
|
|
glBindTexture(GL_TEXTURE_2D, rt->mip_maps[i].sizes[j].color);
|
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->mip_maps[i].sizes[j].color, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool used_depth = false;
|
|
|
|
if (j == 0 && i == 0) { //use always
|
2022-03-12 12:19:59 +01:00
|
|
|
if (config->support_depth_texture) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, rt->depth, 0);
|
|
|
|
} else {
|
|
|
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
|
|
|
|
}
|
|
|
|
used_depth = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
|
|
|
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
|
|
|
WARN_PRINT_ONCE("Cannot allocate mipmaps for 3D post processing effects");
|
|
|
|
bind_framebuffer_system();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
glClearColor(1.0, 0.0, 1.0, 0.0);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
if (used_depth) {
|
|
|
|
glClearDepth(1.0);
|
|
|
|
glClear(GL_DEPTH_BUFFER_BIT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rt->mip_maps[i].levels = level;
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
if (config->render_to_mipmap_supported) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rt->mip_maps_allocated = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bind_framebuffer_system();
|
|
|
|
}
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
void RasterizerStorageGLES3::_render_target_clear(GLES3::RenderTarget *rt) {
|
2020-11-18 19:11:30 +01:00
|
|
|
// there is nothing to clear when DIRECT_TO_SCREEN is used
|
2022-01-27 17:34:33 +01:00
|
|
|
if (rt->flags[RENDER_TARGET_DIRECT_TO_SCREEN]) {
|
2020-11-18 19:11:30 +01:00
|
|
|
return;
|
2022-01-27 17:34:33 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
if (rt->fbo) {
|
|
|
|
glDeleteFramebuffers(1, &rt->fbo);
|
|
|
|
glDeleteTextures(1, &rt->color);
|
|
|
|
rt->fbo = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rt->external.fbo != 0) {
|
|
|
|
// free this
|
|
|
|
glDeleteFramebuffers(1, &rt->external.fbo);
|
|
|
|
|
|
|
|
// clean up our texture
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::Texture *t = GLES3::TextureStorage::get_singleton()->get_texture(rt->external.texture);
|
2020-11-18 19:11:30 +01:00
|
|
|
t->alloc_height = 0;
|
|
|
|
t->alloc_width = 0;
|
|
|
|
t->width = 0;
|
|
|
|
t->height = 0;
|
|
|
|
t->active = false;
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::TextureStorage::get_singleton()->texture_free(rt->external.texture);
|
2020-11-18 19:11:30 +01:00
|
|
|
memdelete(t);
|
|
|
|
|
|
|
|
rt->external.fbo = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rt->depth) {
|
2022-03-12 12:19:59 +01:00
|
|
|
if (config->support_depth_texture) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteTextures(1, &rt->depth);
|
|
|
|
} else {
|
|
|
|
glDeleteRenderbuffers(1, &rt->depth);
|
|
|
|
}
|
|
|
|
|
|
|
|
rt->depth = 0;
|
|
|
|
}
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::Texture *tex = GLES3::TextureStorage::get_singleton()->get_texture(rt->texture);
|
2020-11-18 19:11:30 +01:00
|
|
|
tex->alloc_height = 0;
|
|
|
|
tex->alloc_width = 0;
|
|
|
|
tex->width = 0;
|
|
|
|
tex->height = 0;
|
|
|
|
tex->active = false;
|
|
|
|
|
|
|
|
if (rt->copy_screen_effect.color) {
|
|
|
|
glDeleteFramebuffers(1, &rt->copy_screen_effect.fbo);
|
|
|
|
rt->copy_screen_effect.fbo = 0;
|
|
|
|
|
|
|
|
glDeleteTextures(1, &rt->copy_screen_effect.color);
|
|
|
|
rt->copy_screen_effect.color = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 2; i++) {
|
|
|
|
if (rt->mip_maps[i].sizes.size()) {
|
|
|
|
for (int j = 0; j < rt->mip_maps[i].sizes.size(); j++) {
|
|
|
|
glDeleteFramebuffers(1, &rt->mip_maps[i].sizes[j].fbo);
|
|
|
|
glDeleteTextures(1, &rt->mip_maps[i].sizes[j].color);
|
|
|
|
}
|
|
|
|
|
|
|
|
glDeleteTextures(1, &rt->mip_maps[i].color);
|
|
|
|
rt->mip_maps[i].sizes.clear();
|
|
|
|
rt->mip_maps[i].levels = 0;
|
|
|
|
rt->mip_maps[i].color = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rt->multisample_active) {
|
|
|
|
glDeleteFramebuffers(1, &rt->multisample_fbo);
|
|
|
|
rt->multisample_fbo = 0;
|
|
|
|
|
|
|
|
glDeleteRenderbuffers(1, &rt->multisample_depth);
|
|
|
|
rt->multisample_depth = 0;
|
2021-10-26 17:18:39 +02:00
|
|
|
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteRenderbuffers(1, &rt->multisample_color);
|
2021-10-26 17:18:39 +02:00
|
|
|
|
2020-11-18 19:11:30 +01:00
|
|
|
rt->multisample_color = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::render_target_create() {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = memnew(GLES3::RenderTarget);
|
|
|
|
GLES3::Texture *t = memnew(GLES3::Texture);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-09-27 01:07:10 +02:00
|
|
|
t->type = RenderingDevice::TEXTURE_TYPE_2D;
|
2020-11-18 19:11:30 +01:00
|
|
|
t->flags = 0;
|
|
|
|
t->width = 0;
|
|
|
|
t->height = 0;
|
|
|
|
t->alloc_height = 0;
|
|
|
|
t->alloc_width = 0;
|
|
|
|
t->format = Image::FORMAT_R8;
|
|
|
|
t->target = GL_TEXTURE_2D;
|
|
|
|
t->gl_format_cache = 0;
|
|
|
|
t->gl_internal_format_cache = 0;
|
|
|
|
t->gl_type_cache = 0;
|
|
|
|
t->data_size = 0;
|
|
|
|
t->total_data_size = 0;
|
|
|
|
t->ignore_mipmaps = false;
|
|
|
|
t->compressed = false;
|
|
|
|
t->mipmaps = 1;
|
|
|
|
t->active = true;
|
|
|
|
t->tex_id = 0;
|
|
|
|
t->render_target = rt;
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
rt->texture = GLES3::TextureStorage::get_singleton()->make_rid(t);
|
2020-11-18 19:11:30 +01:00
|
|
|
return render_target_owner.make_rid(rt);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_set_position(RID p_render_target, int p_x, int p_y) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!rt);
|
|
|
|
|
|
|
|
rt->x = p_x;
|
|
|
|
rt->y = p_y;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_set_size(RID p_render_target, int p_width, int p_height, uint32_t p_view_count) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!rt);
|
|
|
|
|
2022-01-27 17:34:33 +01:00
|
|
|
if (p_width == rt->width && p_height == rt->height) {
|
2020-11-18 19:11:30 +01:00
|
|
|
return;
|
2022-01-27 17:34:33 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
_render_target_clear(rt);
|
|
|
|
|
|
|
|
rt->width = p_width;
|
|
|
|
rt->height = p_height;
|
|
|
|
|
|
|
|
// print_line("render_target_set_size " + itos(p_render_target.get_id()) + ", w " + itos(p_width) + " h " + itos(p_height));
|
|
|
|
|
|
|
|
rt->allocate_is_dirty = true;
|
|
|
|
//_render_target_allocate(rt);
|
|
|
|
}
|
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
// TODO: convert to Size2i internally
|
|
|
|
Size2i RasterizerStorageGLES3::render_target_get_size(RID p_render_target) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2021-11-16 16:25:42 +01:00
|
|
|
ERR_FAIL_COND_V(!rt, Size2());
|
|
|
|
|
|
|
|
return Size2i(rt->width, rt->height);
|
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
RID RasterizerStorageGLES3::render_target_get_texture(RID p_render_target) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!rt, RID());
|
|
|
|
|
|
|
|
if (rt->external.fbo == 0) {
|
|
|
|
return rt->texture;
|
|
|
|
} else {
|
|
|
|
return rt->external.texture;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_set_external_texture(RID p_render_target, unsigned int p_texture_id) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!rt);
|
|
|
|
|
|
|
|
if (p_texture_id == 0) {
|
|
|
|
if (rt->external.fbo != 0) {
|
|
|
|
// free this
|
|
|
|
glDeleteFramebuffers(1, &rt->external.fbo);
|
|
|
|
|
|
|
|
// and this
|
|
|
|
if (rt->external.depth != 0) {
|
|
|
|
glDeleteRenderbuffers(1, &rt->external.depth);
|
|
|
|
}
|
|
|
|
|
|
|
|
// clean up our texture
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::Texture *t = GLES3::TextureStorage::get_singleton()->get_texture(rt->external.texture);
|
2020-11-18 19:11:30 +01:00
|
|
|
t->alloc_height = 0;
|
|
|
|
t->alloc_width = 0;
|
|
|
|
t->width = 0;
|
|
|
|
t->height = 0;
|
|
|
|
t->active = false;
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::TextureStorage::get_singleton()->texture_free(rt->external.texture);
|
2020-11-18 19:11:30 +01:00
|
|
|
memdelete(t);
|
|
|
|
|
|
|
|
rt->external.fbo = 0;
|
|
|
|
rt->external.color = 0;
|
|
|
|
rt->external.depth = 0;
|
|
|
|
}
|
|
|
|
} else {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::Texture *t;
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
if (rt->external.fbo == 0) {
|
|
|
|
// create our fbo
|
|
|
|
glGenFramebuffers(1, &rt->external.fbo);
|
|
|
|
bind_framebuffer(rt->external.fbo);
|
|
|
|
|
|
|
|
// allocate a texture
|
2022-03-12 12:19:59 +01:00
|
|
|
t = memnew(GLES3::Texture);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-09-27 01:07:10 +02:00
|
|
|
t->type = RenderingDevice::TEXTURE_TYPE_2D;
|
2020-11-18 19:11:30 +01:00
|
|
|
t->flags = 0;
|
|
|
|
t->width = 0;
|
|
|
|
t->height = 0;
|
|
|
|
t->alloc_height = 0;
|
|
|
|
t->alloc_width = 0;
|
|
|
|
t->format = Image::FORMAT_RGBA8;
|
|
|
|
t->target = GL_TEXTURE_2D;
|
|
|
|
t->gl_format_cache = 0;
|
|
|
|
t->gl_internal_format_cache = 0;
|
|
|
|
t->gl_type_cache = 0;
|
|
|
|
t->data_size = 0;
|
|
|
|
t->compressed = false;
|
|
|
|
t->srgb = false;
|
|
|
|
t->total_data_size = 0;
|
|
|
|
t->ignore_mipmaps = false;
|
|
|
|
t->mipmaps = 1;
|
|
|
|
t->active = true;
|
|
|
|
t->tex_id = 0;
|
|
|
|
t->render_target = rt;
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
rt->external.texture = GLES3::TextureStorage::get_singleton()->make_rid(t);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
} else {
|
|
|
|
// bind our frame buffer
|
|
|
|
bind_framebuffer(rt->external.fbo);
|
|
|
|
|
|
|
|
// find our texture
|
2022-03-12 12:19:59 +01:00
|
|
|
t = GLES3::TextureStorage::get_singleton()->get_texture(rt->external.texture);
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// set our texture
|
|
|
|
t->tex_id = p_texture_id;
|
|
|
|
rt->external.color = p_texture_id;
|
|
|
|
|
|
|
|
// size shouldn't be different
|
|
|
|
t->width = rt->width;
|
|
|
|
t->height = rt->height;
|
|
|
|
t->alloc_height = rt->width;
|
|
|
|
t->alloc_width = rt->height;
|
|
|
|
|
|
|
|
// Switch our texture on our frame buffer
|
|
|
|
{
|
|
|
|
// set our texture as the destination for our framebuffer
|
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, p_texture_id, 0);
|
|
|
|
|
|
|
|
// seeing we're rendering into this directly, better also use our depth buffer, just use our existing one :)
|
2022-03-12 12:19:59 +01:00
|
|
|
if (config->support_depth_texture) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, rt->depth, 0);
|
|
|
|
} else {
|
|
|
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// check status and unbind
|
|
|
|
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
|
|
|
bind_framebuffer_system();
|
|
|
|
|
|
|
|
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
|
|
|
printf("framebuffer fail, status: %x\n", status);
|
|
|
|
}
|
|
|
|
|
|
|
|
ERR_FAIL_COND(status != GL_FRAMEBUFFER_COMPLETE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!rt);
|
|
|
|
|
|
|
|
// When setting DIRECT_TO_SCREEN, you need to clear before the value is set, but allocate after as
|
|
|
|
// those functions change how they operate depending on the value of DIRECT_TO_SCREEN
|
|
|
|
if (p_flag == RENDER_TARGET_DIRECT_TO_SCREEN && p_value != rt->flags[RENDER_TARGET_DIRECT_TO_SCREEN]) {
|
|
|
|
_render_target_clear(rt);
|
|
|
|
rt->flags[p_flag] = p_value;
|
|
|
|
_render_target_allocate(rt);
|
|
|
|
}
|
|
|
|
|
|
|
|
rt->flags[p_flag] = p_value;
|
|
|
|
|
|
|
|
switch (p_flag) {
|
|
|
|
case RENDER_TARGET_TRANSPARENT:
|
|
|
|
/*
|
|
|
|
case RENDER_TARGET_HDR:
|
|
|
|
case RENDER_TARGET_NO_3D:
|
|
|
|
case RENDER_TARGET_NO_SAMPLING:
|
|
|
|
case RENDER_TARGET_NO_3D_EFFECTS: */
|
|
|
|
{
|
|
|
|
//must reset for these formats
|
|
|
|
_render_target_clear(rt);
|
|
|
|
_render_target_allocate(rt);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default: {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::render_target_was_used(RID p_render_target) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!rt, false);
|
|
|
|
|
|
|
|
return rt->used_in_frame;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_clear_used(RID p_render_target) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!rt);
|
|
|
|
|
|
|
|
rt->used_in_frame = false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_set_msaa(RID p_render_target, RS::ViewportMSAA p_msaa) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!rt);
|
|
|
|
|
2022-01-27 17:34:33 +01:00
|
|
|
if (rt->msaa == p_msaa) {
|
2020-11-18 19:11:30 +01:00
|
|
|
return;
|
2022-01-27 17:34:33 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
_render_target_clear(rt);
|
|
|
|
rt->msaa = p_msaa;
|
|
|
|
_render_target_allocate(rt);
|
|
|
|
}
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
//RasterizerStorageGLES3::GLES3::RenderTarget * RasterizerStorageGLES3::render_target_get(RID p_render_target)
|
2020-11-18 19:11:30 +01:00
|
|
|
//{
|
2021-09-27 01:07:10 +02:00
|
|
|
// return render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
//}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_set_use_fxaa(RID p_render_target, bool p_fxaa) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!rt);
|
|
|
|
|
|
|
|
rt->use_fxaa = p_fxaa;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_set_use_debanding(RID p_render_target, bool p_debanding) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!rt);
|
|
|
|
|
|
|
|
if (p_debanding) {
|
2021-09-27 01:07:10 +02:00
|
|
|
WARN_PRINT_ONCE("Debanding is not supported in the OpenGL backend. Switch to the Vulkan backend and make sure HDR is enabled.");
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
rt->use_debanding = p_debanding;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_request_clear(RID p_render_target, const Color &p_clear_color) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!rt);
|
|
|
|
rt->clear_requested = true;
|
|
|
|
rt->clear_color = p_clear_color;
|
|
|
|
|
|
|
|
// ERR_FAIL_COND(!frame.current_rt);
|
|
|
|
// frame.clear_request = true;
|
|
|
|
// frame.clear_request_color = p_color;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::render_target_is_clear_requested(RID p_render_target) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!rt, false);
|
|
|
|
return rt->clear_requested;
|
|
|
|
}
|
2021-10-26 17:18:39 +02:00
|
|
|
Color RasterizerStorageGLES3::render_target_get_clear_request_color(RID p_render_target) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND_V(!rt, Color());
|
|
|
|
return rt->clear_color;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_disable_clear_request(RID p_render_target) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
|
2020-11-18 19:11:30 +01:00
|
|
|
ERR_FAIL_COND(!rt);
|
|
|
|
rt->clear_requested = false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_do_clear_request(RID p_render_target) {
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_set_sdf_size_and_scale(RID p_render_target, RS::ViewportSDFOversize p_size, RS::ViewportSDFScale p_scale) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Rect2i RasterizerStorageGLES3::render_target_get_sdf_rect(RID p_render_target) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Rect2i();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::render_target_mark_sdf_enabled(RID p_render_target, bool p_enabled) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2020-11-18 19:11:30 +01:00
|
|
|
/* CANVAS SHADOW */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::canvas_light_shadow_buffer_create(int p_width) {
|
2020-11-18 19:11:30 +01:00
|
|
|
CanvasLightShadow *cls = memnew(CanvasLightShadow);
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
if (p_width > config->max_texture_size) {
|
|
|
|
p_width = config->max_texture_size;
|
2022-01-27 17:34:33 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
cls->size = p_width;
|
|
|
|
cls->height = 16;
|
|
|
|
|
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
|
|
|
|
glGenFramebuffers(1, &cls->fbo);
|
|
|
|
bind_framebuffer(cls->fbo);
|
|
|
|
|
|
|
|
glGenRenderbuffers(1, &cls->depth);
|
|
|
|
glBindRenderbuffer(GL_RENDERBUFFER, cls->depth);
|
2022-03-12 12:19:59 +01:00
|
|
|
glRenderbufferStorage(GL_RENDERBUFFER, config->depth_buffer_internalformat, cls->size, cls->height);
|
2020-11-18 19:11:30 +01:00
|
|
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, cls->depth);
|
|
|
|
|
|
|
|
glGenTextures(1, &cls->distance);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, cls->distance);
|
2022-03-12 12:19:59 +01:00
|
|
|
if (config->use_rgba_2d_shadows) {
|
2022-01-27 17:34:33 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, cls->size, cls->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
2020-11-18 19:11:30 +01:00
|
|
|
} else {
|
|
|
|
#ifdef GLES_OVER_GL
|
2022-01-27 17:34:33 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, cls->size, cls->height, 0, _RED_OES, GL_FLOAT, nullptr);
|
2020-11-18 19:11:30 +01:00
|
|
|
#else
|
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_FLOAT, cls->size, cls->height, 0, _RED_OES, GL_FLOAT, NULL);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, cls->distance, 0);
|
|
|
|
|
|
|
|
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
|
|
|
//printf("errnum: %x\n",status);
|
|
|
|
bind_framebuffer_system();
|
|
|
|
|
|
|
|
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
|
|
|
memdelete(cls);
|
|
|
|
ERR_FAIL_COND_V(status != GL_FRAMEBUFFER_COMPLETE, RID());
|
|
|
|
}
|
|
|
|
|
|
|
|
return canvas_light_shadow_owner.make_rid(cls);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* LIGHT SHADOW MAPPING */
|
|
|
|
/*
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::canvas_light_occluder_create() {
|
2020-11-18 19:11:30 +01:00
|
|
|
CanvasOccluder *co = memnew(CanvasOccluder);
|
|
|
|
co->index_id = 0;
|
|
|
|
co->vertex_id = 0;
|
|
|
|
co->len = 0;
|
|
|
|
|
|
|
|
return canvas_occluder_owner.make_rid(co);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2> &p_lines) {
|
2020-11-18 19:11:30 +01:00
|
|
|
CanvasOccluder *co = canvas_occluder_owner.get(p_occluder);
|
|
|
|
ERR_FAIL_COND(!co);
|
|
|
|
|
|
|
|
co->lines = p_lines;
|
|
|
|
|
|
|
|
if (p_lines.size() != co->len) {
|
2022-02-16 13:56:32 +01:00
|
|
|
if (co->index_id) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteBuffers(1, &co->index_id);
|
2022-02-16 13:56:32 +01:00
|
|
|
} if (co->vertex_id) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteBuffers(1, &co->vertex_id);
|
2022-02-16 13:56:32 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
co->index_id = 0;
|
|
|
|
co->vertex_id = 0;
|
|
|
|
co->len = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_lines.size()) {
|
|
|
|
PoolVector<float> geometry;
|
|
|
|
PoolVector<uint16_t> indices;
|
|
|
|
int lc = p_lines.size();
|
|
|
|
|
|
|
|
geometry.resize(lc * 6);
|
|
|
|
indices.resize(lc * 3);
|
|
|
|
|
|
|
|
PoolVector<float>::Write vw = geometry.write();
|
|
|
|
PoolVector<uint16_t>::Write iw = indices.write();
|
|
|
|
|
|
|
|
PoolVector<Vector2>::Read lr = p_lines.read();
|
|
|
|
|
|
|
|
const int POLY_HEIGHT = 16384;
|
|
|
|
|
|
|
|
for (int i = 0; i < lc / 2; i++) {
|
|
|
|
vw[i * 12 + 0] = lr[i * 2 + 0].x;
|
|
|
|
vw[i * 12 + 1] = lr[i * 2 + 0].y;
|
|
|
|
vw[i * 12 + 2] = POLY_HEIGHT;
|
|
|
|
|
|
|
|
vw[i * 12 + 3] = lr[i * 2 + 1].x;
|
|
|
|
vw[i * 12 + 4] = lr[i * 2 + 1].y;
|
|
|
|
vw[i * 12 + 5] = POLY_HEIGHT;
|
|
|
|
|
|
|
|
vw[i * 12 + 6] = lr[i * 2 + 1].x;
|
|
|
|
vw[i * 12 + 7] = lr[i * 2 + 1].y;
|
|
|
|
vw[i * 12 + 8] = -POLY_HEIGHT;
|
|
|
|
|
|
|
|
vw[i * 12 + 9] = lr[i * 2 + 0].x;
|
|
|
|
vw[i * 12 + 10] = lr[i * 2 + 0].y;
|
|
|
|
vw[i * 12 + 11] = -POLY_HEIGHT;
|
|
|
|
|
|
|
|
iw[i * 6 + 0] = i * 4 + 0;
|
|
|
|
iw[i * 6 + 1] = i * 4 + 1;
|
|
|
|
iw[i * 6 + 2] = i * 4 + 2;
|
|
|
|
|
|
|
|
iw[i * 6 + 3] = i * 4 + 2;
|
|
|
|
iw[i * 6 + 4] = i * 4 + 3;
|
|
|
|
iw[i * 6 + 5] = i * 4 + 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//if same buffer len is being set, just use BufferSubData to avoid a pipeline flush
|
|
|
|
|
|
|
|
if (!co->vertex_id) {
|
|
|
|
glGenBuffers(1, &co->vertex_id);
|
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, co->vertex_id);
|
|
|
|
glBufferData(GL_ARRAY_BUFFER, lc * 6 * sizeof(real_t), vw.ptr(), GL_STATIC_DRAW);
|
|
|
|
} else {
|
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, co->vertex_id);
|
|
|
|
glBufferSubData(GL_ARRAY_BUFFER, 0, lc * 6 * sizeof(real_t), vw.ptr());
|
|
|
|
}
|
|
|
|
|
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind
|
|
|
|
|
|
|
|
if (!co->index_id) {
|
|
|
|
glGenBuffers(1, &co->index_id);
|
|
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, co->index_id);
|
|
|
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, lc * 3 * sizeof(uint16_t), iw.ptr(), GL_DYNAMIC_DRAW);
|
|
|
|
} else {
|
|
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, co->index_id);
|
|
|
|
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, lc * 3 * sizeof(uint16_t), iw.ptr());
|
|
|
|
}
|
|
|
|
|
|
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); //unbind
|
|
|
|
|
|
|
|
co->len = lc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RS::InstanceType RasterizerStorageGLES3::get_base_type(RID p_rid) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_NONE;
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
if (mesh_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_MESH;
|
2020-11-18 19:11:30 +01:00
|
|
|
} else if (light_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_LIGHT;
|
2020-11-18 19:11:30 +01:00
|
|
|
} else if (multimesh_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_MULTIMESH;
|
2020-11-18 19:11:30 +01:00
|
|
|
} else if (immediate_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_IMMEDIATE;
|
2020-11-18 19:11:30 +01:00
|
|
|
} else if (reflection_probe_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_REFLECTION_PROBE;
|
2020-11-18 19:11:30 +01:00
|
|
|
} else if (lightmap_capture_data_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_LIGHTMAP_CAPTURE;
|
2020-11-18 19:11:30 +01:00
|
|
|
} else {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_NONE;
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::free(RID p_rid) {
|
2020-11-18 19:11:30 +01:00
|
|
|
if (render_target_owner.owns(p_rid)) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::RenderTarget *rt = render_target_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
_render_target_clear(rt);
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::Texture *t = GLES3::TextureStorage::get_singleton()->get_texture(rt->texture);
|
2020-11-18 19:11:30 +01:00
|
|
|
if (t) {
|
2022-03-12 12:19:59 +01:00
|
|
|
GLES3::TextureStorage::get_singleton()->texture_free(rt->texture);
|
2020-11-18 19:11:30 +01:00
|
|
|
memdelete(t);
|
|
|
|
}
|
|
|
|
render_target_owner.free(p_rid);
|
|
|
|
memdelete(rt);
|
|
|
|
|
|
|
|
return true;
|
2022-03-12 12:19:59 +01:00
|
|
|
} else if (GLES3::TextureStorage::get_singleton()->owns_texture(p_rid)) {
|
|
|
|
GLES3::TextureStorage::get_singleton()->texture_free(p_rid);
|
2021-11-16 16:25:42 +01:00
|
|
|
return true;
|
2022-03-12 12:19:59 +01:00
|
|
|
} else if (GLES3::CanvasTextureStorage::get_singleton()->owns_canvas_texture(p_rid)) {
|
|
|
|
GLES3::CanvasTextureStorage::get_singleton()->canvas_texture_free(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
return true;
|
|
|
|
} else if (sky_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Sky *sky = sky_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
sky_set_texture(p_rid, RID(), 256);
|
|
|
|
sky_owner.free(p_rid);
|
|
|
|
memdelete(sky);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (shader_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Shader *shader = shader_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
if (shader->shader && shader->version.is_valid()) {
|
|
|
|
shader->shader->version_free(shader->version);
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (shader->dirty_list.in_list()) {
|
|
|
|
_shader_dirty_list.remove(&shader->dirty_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
while (shader->materials.first()) {
|
|
|
|
Material *m = shader->materials.first()->self();
|
|
|
|
|
2022-01-27 17:34:33 +01:00
|
|
|
m->shader = nullptr;
|
2020-11-18 19:11:30 +01:00
|
|
|
_material_make_dirty(m);
|
|
|
|
|
|
|
|
shader->materials.remove(shader->materials.first());
|
|
|
|
}
|
|
|
|
|
|
|
|
shader_owner.free(p_rid);
|
|
|
|
memdelete(shader);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (material_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Material *m = material_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
if (m->shader) {
|
|
|
|
m->shader->materials.remove(&m->list);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
for (Map<Geometry *, int>::Element *E = m->geometry_owners.front(); E; E = E->next()) {
|
|
|
|
Geometry *g = E->key();
|
|
|
|
g->material = RID();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Map<InstanceBaseDependency *, int>::Element *E = m->instance_owners.front(); E; E = E->next()) {
|
|
|
|
InstanceBaseDependency *ins = E->key();
|
|
|
|
|
|
|
|
if (ins->material_override == p_rid) {
|
|
|
|
ins->material_override = RID();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < ins->materials.size(); i++) {
|
|
|
|
if (ins->materials[i] == p_rid) {
|
|
|
|
ins->materials.write[i] = RID();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
material_owner.free(p_rid);
|
|
|
|
memdelete(m);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
} else if (skeleton_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Skeleton *s = skeleton_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
if (s->update_list.in_list()) {
|
|
|
|
skeleton_update_list.remove(&s->update_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Set<InstanceBaseDependency *>::Element *E = s->instances.front(); E; E = E->next()) {
|
|
|
|
E->get()->skeleton = RID();
|
|
|
|
}
|
|
|
|
|
|
|
|
skeleton_allocate(p_rid, 0, false);
|
|
|
|
|
|
|
|
if (s->tex_id) {
|
|
|
|
glDeleteTextures(1, &s->tex_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
skeleton_owner.free(p_rid);
|
|
|
|
memdelete(s);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (mesh_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Mesh *mesh = mesh_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
mesh->instance_remove_deps();
|
|
|
|
mesh_clear(p_rid);
|
|
|
|
|
|
|
|
while (mesh->multimeshes.first()) {
|
|
|
|
MultiMesh *multimesh = mesh->multimeshes.first()->self();
|
|
|
|
multimesh->mesh = RID();
|
|
|
|
multimesh->dirty_aabb = true;
|
|
|
|
|
|
|
|
mesh->multimeshes.remove(mesh->multimeshes.first());
|
|
|
|
|
|
|
|
if (!multimesh->update_list.in_list()) {
|
|
|
|
multimesh_update_list.add(&multimesh->update_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mesh_owner.free(p_rid);
|
|
|
|
memdelete(mesh);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (multimesh_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
MultiMesh *multimesh = multimesh_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
multimesh->instance_remove_deps();
|
|
|
|
|
|
|
|
if (multimesh->mesh.is_valid()) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Mesh *mesh = mesh_owner.get_or_null(multimesh->mesh);
|
2020-11-18 19:11:30 +01:00
|
|
|
if (mesh) {
|
|
|
|
mesh->multimeshes.remove(&multimesh->mesh_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-27 01:07:10 +02:00
|
|
|
multimesh_allocate(p_rid, 0, RS::MULTIMESH_TRANSFORM_3D, RS::MULTIMESH_COLOR_NONE);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
update_dirty_multimeshes();
|
|
|
|
|
|
|
|
multimesh_owner.free(p_rid);
|
|
|
|
memdelete(multimesh);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (immediate_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Immediate *im = immediate_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
im->instance_remove_deps();
|
|
|
|
|
|
|
|
immediate_owner.free(p_rid);
|
|
|
|
memdelete(im);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (light_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Light *light = light_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
light->instance_remove_deps();
|
|
|
|
|
|
|
|
light_owner.free(p_rid);
|
|
|
|
memdelete(light);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (reflection_probe_owner.owns(p_rid)) {
|
|
|
|
// delete the texture
|
2021-09-27 01:07:10 +02:00
|
|
|
ReflectionProbe *reflection_probe = reflection_probe_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
reflection_probe->instance_remove_deps();
|
|
|
|
|
|
|
|
reflection_probe_owner.free(p_rid);
|
|
|
|
memdelete(reflection_probe);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (lightmap_capture_data_owner.owns(p_rid)) {
|
|
|
|
// delete the texture
|
2021-09-27 01:07:10 +02:00
|
|
|
LightmapCapture *lightmap_capture = lightmap_capture_data_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
lightmap_capture->instance_remove_deps();
|
|
|
|
|
|
|
|
lightmap_capture_data_owner.free(p_rid);
|
|
|
|
memdelete(lightmap_capture);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} else if (canvas_occluder_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
CanvasOccluder *co = canvas_occluder_owner.get_or_null(p_rid);
|
2022-02-16 13:56:32 +01:00
|
|
|
if (co->index_id) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteBuffers(1, &co->index_id);
|
2022-02-16 13:56:32 +01:00
|
|
|
}
|
|
|
|
if (co->vertex_id) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteBuffers(1, &co->vertex_id);
|
2022-02-16 13:56:32 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
canvas_occluder_owner.free(p_rid);
|
|
|
|
memdelete(co);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} else if (canvas_light_shadow_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
CanvasLightShadow *cls = canvas_light_shadow_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteFramebuffers(1, &cls->fbo);
|
|
|
|
glDeleteRenderbuffers(1, &cls->depth);
|
|
|
|
glDeleteTextures(1, &cls->distance);
|
|
|
|
canvas_light_shadow_owner.free(p_rid);
|
|
|
|
memdelete(cls);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::has_os_feature(const String &p_feature) const {
|
2021-12-29 02:06:12 +01:00
|
|
|
if (p_feature == "s3tc") {
|
2022-03-12 12:19:59 +01:00
|
|
|
return config->s3tc_supported;
|
2021-12-29 02:06:12 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-12-29 02:06:12 +01:00
|
|
|
if (p_feature == "etc") {
|
2022-03-12 12:19:59 +01:00
|
|
|
return config->etc_supported;
|
2021-12-29 02:06:12 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-12-29 02:06:12 +01:00
|
|
|
if (p_feature == "skinning_fallback") {
|
2022-03-12 12:19:59 +01:00
|
|
|
return config->use_skeleton_software;
|
2021-12-29 02:06:12 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::set_debug_generate_wireframes(bool p_generate) {
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
//void RasterizerStorageGLES3::render_info_begin_capture() {
|
2020-11-18 19:11:30 +01:00
|
|
|
// info.snap = info.render;
|
|
|
|
//}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
//void RasterizerStorageGLES3::render_info_end_capture() {
|
2020-11-18 19:11:30 +01:00
|
|
|
// info.snap.object_count = info.render.object_count - info.snap.object_count;
|
|
|
|
// info.snap.draw_call_count = info.render.draw_call_count - info.snap.draw_call_count;
|
|
|
|
// info.snap.material_switch_count = info.render.material_switch_count - info.snap.material_switch_count;
|
|
|
|
// info.snap.surface_switch_count = info.render.surface_switch_count - info.snap.surface_switch_count;
|
|
|
|
// info.snap.shader_rebind_count = info.render.shader_rebind_count - info.snap.shader_rebind_count;
|
|
|
|
// info.snap.vertices_count = info.render.vertices_count - info.snap.vertices_count;
|
|
|
|
// info.snap._2d_item_count = info.render._2d_item_count - info.snap._2d_item_count;
|
|
|
|
// info.snap._2d_draw_call_count = info.render._2d_draw_call_count - info.snap._2d_draw_call_count;
|
|
|
|
//}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
//int RasterizerStorageGLES3::get_captured_render_info(RS::RenderInfo p_info) {
|
2020-11-18 19:11:30 +01:00
|
|
|
// switch (p_info) {
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_OBJECTS_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap.object_count;
|
|
|
|
// } break;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_VERTICES_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap.vertices_count;
|
|
|
|
// } break;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_MATERIAL_CHANGES_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap.material_switch_count;
|
|
|
|
// } break;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_SHADER_CHANGES_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap.shader_rebind_count;
|
|
|
|
// } break;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_SURFACE_CHANGES_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap.surface_switch_count;
|
|
|
|
// } break;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_DRAW_CALLS_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap.draw_call_count;
|
|
|
|
// } break;
|
|
|
|
// /*
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_2D_ITEMS_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap._2d_item_count;
|
|
|
|
// } break;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_2D_DRAW_CALLS_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap._2d_draw_call_count;
|
|
|
|
// } break;
|
|
|
|
// */
|
|
|
|
// default: {
|
|
|
|
// return get_render_info(p_info);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
//int RasterizerStorageGLES3::get_render_info(RS::RenderInfo p_info) {
|
2020-11-18 19:11:30 +01:00
|
|
|
// switch (p_info) {
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_OBJECTS_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final.object_count;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_VERTICES_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final.vertices_count;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_MATERIAL_CHANGES_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final.material_switch_count;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_SHADER_CHANGES_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final.shader_rebind_count;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_SURFACE_CHANGES_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final.surface_switch_count;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_DRAW_CALLS_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final.draw_call_count;
|
|
|
|
// /*
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_2D_ITEMS_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final._2d_item_count;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_2D_DRAW_CALLS_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final._2d_draw_call_count;
|
|
|
|
//*/
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_USAGE_VIDEO_MEM_TOTAL:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return 0; //no idea
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_VIDEO_MEM_USED:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.vertex_mem + info.texture_mem;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_TEXTURE_MEM_USED:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.texture_mem;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_VERTEX_MEM_USED:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.vertex_mem;
|
|
|
|
// default:
|
|
|
|
// return 0; //no idea either
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
String RasterizerStorageGLES3::get_video_adapter_name() const {
|
2020-11-18 19:11:30 +01:00
|
|
|
return (const char *)glGetString(GL_RENDERER);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
String RasterizerStorageGLES3::get_video_adapter_vendor() const {
|
2020-11-18 19:11:30 +01:00
|
|
|
return (const char *)glGetString(GL_VENDOR);
|
|
|
|
}
|
|
|
|
|
2021-12-10 17:01:51 +01:00
|
|
|
RenderingDevice::DeviceType RasterizerStorageGLES3::get_video_adapter_type() const {
|
|
|
|
return RenderingDevice::DeviceType::DEVICE_TYPE_OTHER;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::initialize() {
|
|
|
|
RasterizerStorageGLES3::system_fbo = 0;
|
2022-03-12 12:19:59 +01:00
|
|
|
config = GLES3::Config::get_singleton();
|
|
|
|
config->initialize();
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
//determine formats for depth textures (or renderbuffers)
|
2022-03-12 12:19:59 +01:00
|
|
|
if (config->support_depth_texture) {
|
2020-11-18 19:11:30 +01:00
|
|
|
// Will use texture for depth
|
|
|
|
// have to manually see if we can create a valid framebuffer texture using UNSIGNED_INT,
|
|
|
|
// as there is no extension to test for this.
|
|
|
|
GLuint fbo;
|
|
|
|
glGenFramebuffers(1, &fbo);
|
|
|
|
bind_framebuffer(fbo);
|
|
|
|
GLuint depth;
|
|
|
|
glGenTextures(1, &depth);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, depth);
|
2022-03-12 12:19:59 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, config->depth_internalformat, 32, 32, 0, GL_DEPTH_COMPONENT, config->depth_type, nullptr);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
|
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth, 0);
|
|
|
|
|
|
|
|
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
|
|
|
|
|
|
|
bind_framebuffer_system();
|
|
|
|
glDeleteFramebuffers(1, &fbo);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
|
|
glDeleteTextures(1, &depth);
|
|
|
|
|
|
|
|
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
|
|
|
// If it fails, test to see if it supports a framebuffer texture using UNSIGNED_SHORT
|
|
|
|
// This is needed because many OSX devices don't support either UNSIGNED_INT or UNSIGNED_SHORT
|
|
|
|
#ifdef GLES_OVER_GL
|
2022-03-12 12:19:59 +01:00
|
|
|
config->depth_internalformat = GL_DEPTH_COMPONENT16;
|
2020-11-18 19:11:30 +01:00
|
|
|
#else
|
|
|
|
// OES_depth_texture extension only specifies GL_DEPTH_COMPONENT.
|
2022-03-12 12:19:59 +01:00
|
|
|
config->depth_internalformat = GL_DEPTH_COMPONENT;
|
2020-11-18 19:11:30 +01:00
|
|
|
#endif
|
2022-03-12 12:19:59 +01:00
|
|
|
config->depth_type = GL_UNSIGNED_SHORT;
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
glGenFramebuffers(1, &fbo);
|
|
|
|
bind_framebuffer(fbo);
|
|
|
|
|
|
|
|
glGenTextures(1, &depth);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, depth);
|
2022-03-12 12:19:59 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, config->depth_internalformat, 32, 32, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, nullptr);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
|
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth, 0);
|
|
|
|
|
|
|
|
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
|
|
|
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
|
|
|
//if it fails again depth textures aren't supported, use rgba shadows and renderbuffer for depth
|
2022-03-12 12:19:59 +01:00
|
|
|
config->support_depth_texture = false;
|
|
|
|
config->use_rgba_3d_shadows = true;
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bind_framebuffer_system();
|
|
|
|
glDeleteFramebuffers(1, &fbo);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
|
|
glDeleteTextures(1, &depth);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//picky requirements for these
|
2022-03-12 12:19:59 +01:00
|
|
|
config->support_shadow_cubemaps = config->support_depth_texture && config->support_write_depth && config->support_depth_cubemaps;
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
frame.count = 0;
|
|
|
|
frame.delta = 0;
|
2022-01-27 17:34:33 +01:00
|
|
|
frame.current_rt = nullptr;
|
2020-11-18 19:11:30 +01:00
|
|
|
frame.clear_request = false;
|
|
|
|
|
|
|
|
// the use skeleton software path should be used if either float texture is not supported,
|
|
|
|
// OR max_vertex_texture_image_units is zero
|
2022-03-12 12:19:59 +01:00
|
|
|
config->use_skeleton_software = (config->float_texture_supported == false) || (config->max_vertex_texture_image_units == 0);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
shaders.copy.initialize();
|
|
|
|
shaders.copy_version = shaders.copy.version_create(); //TODO
|
|
|
|
shaders.copy.version_bind_shader(shaders.copy_version, CopyShaderGLES3::MODE_COPY_SECTION);
|
|
|
|
//shaders.cubemap_filter.init();
|
|
|
|
//bool ggx_hq = GLOBAL_GET("rendering/quality/reflections/high_quality_ggx");
|
|
|
|
//shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::LOW_QUALITY, !ggx_hq);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
// quad for copying stuff
|
|
|
|
|
|
|
|
glGenBuffers(1, &resources.quadie);
|
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, resources.quadie);
|
|
|
|
{
|
|
|
|
const float qv[16] = {
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
-1,
|
|
|
|
1,
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
-1,
|
|
|
|
1,
|
|
|
|
0,
|
|
|
|
};
|
|
|
|
|
|
|
|
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 16, qv, GL_STATIC_DRAW);
|
|
|
|
}
|
|
|
|
|
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
//default textures
|
|
|
|
|
|
|
|
glGenTextures(1, &resources.white_tex);
|
|
|
|
unsigned char whitetexdata[8 * 8 * 3];
|
|
|
|
for (int i = 0; i < 8 * 8 * 3; i++) {
|
|
|
|
whitetexdata[i] = 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, resources.white_tex);
|
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE, whitetexdata);
|
|
|
|
glGenerateMipmap(GL_TEXTURE_2D);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
|
|
|
|
|
|
glGenTextures(1, &resources.black_tex);
|
|
|
|
unsigned char blacktexdata[8 * 8 * 3];
|
|
|
|
for (int i = 0; i < 8 * 8 * 3; i++) {
|
|
|
|
blacktexdata[i] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, resources.black_tex);
|
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE, blacktexdata);
|
|
|
|
glGenerateMipmap(GL_TEXTURE_2D);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
|
|
|
|
|
|
glGenTextures(1, &resources.normal_tex);
|
|
|
|
unsigned char normaltexdata[8 * 8 * 3];
|
|
|
|
for (int i = 0; i < 8 * 8 * 3; i += 3) {
|
|
|
|
normaltexdata[i + 0] = 128;
|
|
|
|
normaltexdata[i + 1] = 128;
|
|
|
|
normaltexdata[i + 2] = 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, resources.normal_tex);
|
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE, normaltexdata);
|
|
|
|
glGenerateMipmap(GL_TEXTURE_2D);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
|
|
|
|
|
|
glGenTextures(1, &resources.aniso_tex);
|
|
|
|
unsigned char anisotexdata[8 * 8 * 3];
|
|
|
|
for (int i = 0; i < 8 * 8 * 3; i += 3) {
|
|
|
|
anisotexdata[i + 0] = 255;
|
|
|
|
anisotexdata[i + 1] = 128;
|
|
|
|
anisotexdata[i + 2] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, resources.aniso_tex);
|
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE, anisotexdata);
|
|
|
|
glGenerateMipmap(GL_TEXTURE_2D);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// skeleton buffer
|
|
|
|
{
|
|
|
|
resources.skeleton_transform_buffer_size = 0;
|
|
|
|
glGenBuffers(1, &resources.skeleton_transform_buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
// radical inverse vdc cache texture
|
|
|
|
// used for cubemap filtering
|
2022-03-12 12:19:59 +01:00
|
|
|
if (true /*||config->float_texture_supported*/) { //uint8 is similar and works everywhere
|
2020-11-18 19:11:30 +01:00
|
|
|
glGenTextures(1, &resources.radical_inverse_vdc_cache_tex);
|
|
|
|
|
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, resources.radical_inverse_vdc_cache_tex);
|
|
|
|
|
|
|
|
uint8_t radical_inverse[512];
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < 512; i++) {
|
|
|
|
uint32_t bits = i;
|
|
|
|
|
|
|
|
bits = (bits << 16) | (bits >> 16);
|
|
|
|
bits = ((bits & 0x55555555) << 1) | ((bits & 0xAAAAAAAA) >> 1);
|
|
|
|
bits = ((bits & 0x33333333) << 2) | ((bits & 0xCCCCCCCC) >> 2);
|
|
|
|
bits = ((bits & 0x0F0F0F0F) << 4) | ((bits & 0xF0F0F0F0) >> 4);
|
|
|
|
bits = ((bits & 0x00FF00FF) << 8) | ((bits & 0xFF00FF00) >> 8);
|
|
|
|
|
|
|
|
float value = float(bits) * 2.3283064365386963e-10;
|
|
|
|
radical_inverse[i] = uint8_t(CLAMP(value * 255.0, 0, 255));
|
|
|
|
}
|
|
|
|
|
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 512, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, radical_inverse);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); //need this for proper sampling
|
|
|
|
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
glGenFramebuffers(1, &resources.mipmap_blur_fbo);
|
|
|
|
glGenTextures(1, &resources.mipmap_blur_color);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef GLES_OVER_GL
|
|
|
|
//this needs to be enabled manually in OpenGL 2.1
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
if (config->extensions.has("GL_ARB_seamless_cube_map")) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glEnable(_EXT_TEXTURE_CUBE_MAP_SEAMLESS);
|
|
|
|
}
|
|
|
|
glEnable(GL_POINT_SPRITE);
|
|
|
|
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::finalize() {
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::_copy_screen() {
|
2020-11-18 19:11:30 +01:00
|
|
|
bind_quad_array();
|
|
|
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::update_memory_info() {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
uint64_t RasterizerStorageGLES3::get_rendering_info(RS::RenderingInfo p_info) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::update_dirty_resources() {
|
2020-11-18 19:11:30 +01:00
|
|
|
update_dirty_shaders();
|
|
|
|
update_dirty_materials();
|
|
|
|
// update_dirty_skeletons();
|
|
|
|
// update_dirty_multimeshes();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RasterizerStorageGLES3::RasterizerStorageGLES3() {
|
|
|
|
RasterizerStorageGLES3::system_fbo = 0;
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
RasterizerStorageGLES3::~RasterizerStorageGLES3() {
|
|
|
|
shaders.copy.version_free(shaders.copy_version);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // GLES3_ENABLED
|