feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -243,7 +243,7 @@ void CopyEffects::gaussian_blur(GLuint p_source_texture, int p_mipmap_count, con
glBindTexture(GL_TEXTURE_2D, p_source_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, i - 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, i - 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, i);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, p_source_texture, i);
#ifdef DEV_ENABLED
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef COPY_EFFECTS_GLES3_H
#define COPY_EFFECTS_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -77,5 +76,3 @@ public:
} //namespace GLES3
#endif // GLES3_ENABLED
#endif // COPY_EFFECTS_GLES3_H

View file

@ -91,7 +91,7 @@ CubemapFilter::~CubemapFilter() {
Vector3 importance_sample_GGX(Vector2 xi, float roughness4) {
// Compute distribution direction
float phi = 2.0 * Math_PI * xi.x;
float phi = 2.0 * Math::PI * xi.x;
float cos_theta = sqrt((1.0 - xi.y) / (1.0 + (roughness4 - 1.0) * xi.y));
float sin_theta = sqrt(1.0 - cos_theta * cos_theta);
@ -107,7 +107,7 @@ Vector3 importance_sample_GGX(Vector2 xi, float roughness4) {
float distribution_GGX(float NdotH, float roughness4) {
float NdotH2 = NdotH * NdotH;
float denom = (NdotH2 * (roughness4 - 1.0) + 1.0);
denom = Math_PI * denom * denom;
denom = Math::PI * denom * denom;
return roughness4 / denom;
}
@ -157,7 +157,7 @@ void CubemapFilter::filter_radiance(GLuint p_source_cubemap, GLuint p_dest_cubem
float roughness4 = roughness * roughness;
roughness4 *= roughness4;
float solid_angle_texel = 4.0 * Math_PI / float(6 * size * size);
float solid_angle_texel = 4.0 * Math::PI / float(6 * size * size);
LocalVector<float> sample_directions;
sample_directions.resize(4 * sample_count);

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef CUBEMAP_FILTER_GLES3_H
#define CUBEMAP_FILTER_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -66,5 +65,3 @@ public:
} //namespace GLES3
#endif // GLES3_ENABLED
#endif // CUBEMAP_FILTER_GLES3_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef FEED_EFFECTS_GLES3_H
#define FEED_EFFECTS_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -65,5 +64,3 @@ private:
} // namespace GLES3
#endif // GLES3_ENABLED
#endif // FEED_EFFECTS_GLES3_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GLOW_GLES3_H
#define GLOW_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -85,5 +84,3 @@ public:
} //namespace GLES3
#endif // GLES3_ENABLED
#endif // GLOW_GLES3_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef POST_EFFECTS_GLES3_H
#define POST_EFFECTS_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -65,5 +64,3 @@ public:
} //namespace GLES3
#endif // GLES3_ENABLED
#endif // POST_EFFECTS_GLES3_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef FOG_GLES3_H
#define FOG_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -55,5 +54,3 @@ public:
} // namespace GLES3
#endif // GLES3_ENABLED
#endif // FOG_GLES3_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GI_GLES3_H
#define GI_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -87,5 +86,3 @@ public:
}; // namespace GLES3
#endif // GLES3_ENABLED
#endif // GI_GLES3_H

View file

@ -1152,6 +1152,12 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
// Reset base data.
_update_transform_2d_to_mat2x3(base_transform * draw_transform, state.instance_data_array[r_index].world);
_prepare_canvas_texture(state.canvas_instance_batches[state.current_batch_index].tex, state.canvas_instance_batches[state.current_batch_index].filter, state.canvas_instance_batches[state.current_batch_index].repeat, r_index, texpixel_size);
state.instance_data_array[r_index].lights[0] = lights[0];
state.instance_data_array[r_index].lights[1] = lights[1];
state.instance_data_array[r_index].lights[2] = lights[2];
state.instance_data_array[r_index].lights[3] = lights[3];
state.instance_data_array[r_index].flags = base_flags;
state.instance_data_array[r_index].instance_uniforms_ofs = p_item->instance_allocated_shader_uniforms_offset;
for (uint32_t j = 0; j < 3; j++) {
int offset = j == 0 ? 0 : 1;
@ -1289,7 +1295,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend
_FORCE_INLINE_ static uint32_t _indices_to_primitives(RS::PrimitiveType p_primitive, uint32_t p_indices) {
static const uint32_t divisor[RS::PRIMITIVE_MAX] = { 1, 2, 1, 3, 1 };
static const uint32_t subtractor[RS::PRIMITIVE_MAX] = { 0, 0, 1, 0, 1 };
static const uint32_t subtractor[RS::PRIMITIVE_MAX] = { 0, 0, 1, 0, 2 };
return (p_indices - subtractor[p_primitive]) / divisor[p_primitive];
}
@ -1566,7 +1572,7 @@ void RasterizerCanvasGLES3::_add_to_batch(uint32_t &r_index, bool &r_batch_broke
}
void RasterizerCanvasGLES3::_new_batch(bool &r_batch_broken) {
if (state.canvas_instance_batches.size() == 0) {
if (state.canvas_instance_batches.is_empty()) {
Batch new_batch;
new_batch.instance_buffer_index = state.current_instance_buffer_index;
state.canvas_instance_batches.push_back(new_batch);
@ -1686,7 +1692,7 @@ void RasterizerCanvasGLES3::light_update_shadow(RID p_rid, int p_shadow_index, c
}
// Precomputed:
// Vector3 cam_target = Basis::from_euler(Vector3(0, 0, Math_TAU * ((i + 3) / 4.0))).xform(Vector3(0, 1, 0));
// Vector3 cam_target = Basis::from_euler(Vector3(0, 0, Math::TAU * ((i + 3) / 4.0))).xform(Vector3(0, 1, 0));
// projection = projection * Projection(Transform3D().looking_at(cam_targets[i], Vector3(0, 0, -1)).affine_inverse());
const Projection projections[4] = {
projection * Projection(Vector4(0, 0, -1, 0), Vector4(1, 0, 0, 0), Vector4(0, -1, 0, 0), Vector4(0, 0, 0, 1)),
@ -1761,7 +1767,7 @@ void RasterizerCanvasGLES3::light_update_directional_shadow(RID p_rid, int p_sha
Vector2 center = p_clip_rect.get_center();
float to_edge_distance = ABS(light_dir.dot(p_clip_rect.get_support(-light_dir)) - light_dir.dot(center));
float to_edge_distance = Math::abs(light_dir.dot(p_clip_rect.get_support(-light_dir)) - light_dir.dot(center));
Vector2 from_pos = center - light_dir * (to_edge_distance + p_cull_distance);
float distance = to_edge_distance * 2.0 + p_cull_distance;

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef RASTERIZER_CANVAS_GLES3_H
#define RASTERIZER_CANVAS_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -388,5 +387,3 @@ public:
};
#endif // GLES3_ENABLED
#endif // RASTERIZER_CANVAS_GLES3_H

View file

@ -55,6 +55,7 @@
#define _EXT_DEBUG_TYPE_PORTABILITY_ARB 0x824F
#define _EXT_DEBUG_TYPE_PERFORMANCE_ARB 0x8250
#define _EXT_DEBUG_TYPE_OTHER_ARB 0x8251
#define _EXT_DEBUG_TYPE_MARKER_ARB 0x8268
#define _EXT_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143
#define _EXT_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144
#define _EXT_DEBUG_LOGGED_MESSAGES_ARB 0x9145
@ -140,7 +141,7 @@ void RasterizerGLES3::clear_depth(float p_depth) {
#ifdef CAN_DEBUG
static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam) {
// These are ultimately annoying, so removing for now.
if (type == _EXT_DEBUG_TYPE_OTHER_ARB || type == _EXT_DEBUG_TYPE_PERFORMANCE_ARB) {
if (type == _EXT_DEBUG_TYPE_OTHER_ARB || type == _EXT_DEBUG_TYPE_PERFORMANCE_ARB || type == _EXT_DEBUG_TYPE_MARKER_ARB) {
return;
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef RASTERIZER_GLES3_H
#define RASTERIZER_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -105,6 +104,7 @@ public:
void blit_render_targets_to_screen(DisplayServer::WindowID p_screen, const BlitToScreen *p_render_targets, int p_amount);
bool is_opengl() { return true; }
void gl_end_frame(bool p_swap_buffers);
void end_frame(bool p_swap_buffers);
@ -141,5 +141,3 @@ public:
};
#endif // GLES3_ENABLED
#endif // RASTERIZER_GLES3_H

View file

@ -708,12 +708,7 @@ void RasterizerSceneGLES3::_setup_sky(const RenderDataGLES3 *p_render_data, cons
sky_light_data.enabled = true;
float angular_diameter = light_storage->light_get_param(base, RS::LIGHT_PARAM_SIZE);
if (angular_diameter > 0.0) {
angular_diameter = Math::tan(Math::deg_to_rad(angular_diameter));
} else {
angular_diameter = 0.0;
}
sky_light_data.size = angular_diameter;
sky_light_data.size = Math::deg_to_rad(angular_diameter);
sky_globals.directional_light_count++;
if (sky_globals.directional_light_count >= sky_globals.max_directional_lights) {
break;
@ -1224,7 +1219,7 @@ void RasterizerSceneGLES3::voxel_gi_set_quality(RS::VoxelGIQuality) {
_FORCE_INLINE_ static uint32_t _indices_to_primitives(RS::PrimitiveType p_primitive, uint32_t p_indices) {
static const uint32_t divisor[RS::PRIMITIVE_MAX] = { 1, 2, 1, 3, 1 };
static const uint32_t subtractor[RS::PRIMITIVE_MAX] = { 0, 0, 1, 0, 1 };
static const uint32_t subtractor[RS::PRIMITIVE_MAX] = { 0, 0, 1, 0, 2 };
return (p_indices - subtractor[p_primitive]) / divisor[p_primitive];
}
void RasterizerSceneGLES3::_fill_render_list(RenderListType p_render_list, const RenderDataGLES3 *p_render_data, PassMode p_pass_mode, bool p_append) {
@ -1677,7 +1672,7 @@ void RasterizerSceneGLES3::_setup_lights(const RenderDataGLES3 *p_render_data, b
if (is_using_physical_light_units()) {
light_data.energy *= light_storage->light_get_param(base, RS::LIGHT_PARAM_INTENSITY);
} else {
light_data.energy *= Math_PI;
light_data.energy *= Math::PI;
}
if (p_render_data->camera_attributes.is_valid()) {
@ -1867,14 +1862,14 @@ void RasterizerSceneGLES3::_setup_lights(const RenderDataGLES3 *p_render_data, b
// Convert from Luminous Power to Luminous Intensity
if (type == RS::LIGHT_OMNI) {
energy *= 1.0 / (Math_PI * 4.0);
energy *= 1.0 / (Math::PI * 4.0);
} else {
// Spot Lights are not physically accurate, Luminous Intensity should change in relation to the cone angle.
// We make this assumption to keep them easy to control.
energy *= 1.0 / Math_PI;
energy *= 1.0 / Math::PI;
}
} else {
energy *= Math_PI;
energy *= Math::PI;
}
if (p_render_data->camera_attributes.is_valid()) {
@ -3223,11 +3218,11 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
spec_constants |= SceneShaderGLES3::DISABLE_LIGHT_DIRECTIONAL;
spec_constants |= SceneShaderGLES3::DISABLE_LIGHTMAP;
} else {
if (inst->omni_light_gl_cache.size() == 0) {
if (inst->omni_light_gl_cache.is_empty()) {
spec_constants |= SceneShaderGLES3::DISABLE_LIGHT_OMNI;
}
if (inst->spot_light_gl_cache.size() == 0) {
if (inst->spot_light_gl_cache.is_empty()) {
spec_constants |= SceneShaderGLES3::DISABLE_LIGHT_SPOT;
}
@ -3235,7 +3230,7 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
spec_constants |= SceneShaderGLES3::DISABLE_LIGHT_DIRECTIONAL;
}
if (inst->reflection_probe_rid_cache.size() == 0) {
if (inst->reflection_probe_rid_cache.is_empty()) {
// We don't have any probes.
spec_constants |= SceneShaderGLES3::DISABLE_REFLECTION_PROBE;
} else if (inst->reflection_probe_rid_cache.size() > 1) {

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef RASTERIZER_SCENE_GLES3_H
#define RASTERIZER_SCENE_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -740,7 +739,7 @@ protected:
float baked_exposure = 1.0;
//State to track when radiance cubemap needs updating
GLES3::SkyMaterialData *prev_material;
GLES3::SkyMaterialData *prev_material = nullptr;
Vector3 prev_position = Vector3(0.0, 0.0, 0.0);
float prev_time = 0.0f;
};
@ -879,5 +878,3 @@ public:
};
#endif // GLES3_ENABLED
#endif // RASTERIZER_SCENE_GLES3_H

View file

@ -73,7 +73,7 @@ void ShaderGLES3::_add_stage(const char *p_code, StageType p_stage_type) {
} else if (l.begins_with("#CODE")) {
chunk.type = StageTemplate::Chunk::TYPE_CODE;
push_chunk = true;
chunk.code = l.replace_first("#CODE", String()).replace(":", "").strip_edges().to_upper();
chunk.code = l.replace_first("#CODE", String()).remove_char(':').strip_edges().to_upper();
} else {
text += l + "\n";
}
@ -690,7 +690,7 @@ void ShaderGLES3::_save_to_cache(Version *p_version) {
void ShaderGLES3::_clear_version(Version *p_version) {
// Variants not compiled yet, just return
if (p_version->variants.size() == 0) {
if (p_version->variants.is_empty()) {
return;
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef SHADER_GLES3_H
#define SHADER_GLES3_H
#pragma once
#include "core/math/projection.h"
#include "core/os/mutex.h"
@ -189,7 +188,7 @@ protected:
Version *version = version_owner.get_or_null(p_version);
ERR_FAIL_NULL_V(version, false);
if (version->variants.size() == 0) {
if (version->variants.is_empty()) {
_initialize_version(version); //may lack initialization
}
@ -258,5 +257,3 @@ public:
};
#endif // GLES3_ENABLED
#endif // SHADER_GLES3_H

View file

@ -78,8 +78,8 @@ Config::Config() {
#endif
bptc_supported = extensions.has("GL_ARB_texture_compression_bptc") || extensions.has("EXT_texture_compression_bptc");
astc_supported = extensions.has("GL_KHR_texture_compression_astc") || extensions.has("GL_OES_texture_compression_astc") || extensions.has("GL_KHR_texture_compression_astc_ldr") || extensions.has("GL_KHR_texture_compression_astc_hdr");
astc_hdr_supported = extensions.has("GL_KHR_texture_compression_astc_hdr");
astc_supported = astc_hdr_supported || extensions.has("GL_KHR_texture_compression_astc") || extensions.has("GL_OES_texture_compression_astc") || extensions.has("GL_KHR_texture_compression_astc_ldr") || extensions.has("WEBGL_compressed_texture_astc");
astc_layered_supported = extensions.has("GL_KHR_texture_compression_astc_sliced_3d");
if (RasterizerGLES3::is_gles_over_gl()) {
@ -226,7 +226,7 @@ Config::Config() {
// OpenGL ES 3.0 V@331.0 (GIT@35e467f, Ice9844a736) (Date:04/15/19)
// OpenGL ES 3.0 V@415.0 (GIT@d39f783, I79de86aa2c, 1591296226) (Date:06/04/20)
// OpenGL ES 3.0 V@0502.0 (GIT@09fef447e8, I1fe547a144, 1661493934) (Date:08/25/22)
String driver_version = gl_version.get_slice("V@", 1).get_slice(" ", 0);
String driver_version = gl_version.get_slice("V@", 1).get_slicec(' ', 0);
if (driver_version.is_valid_float() && driver_version.to_float() >= 331.0) {
flip_xy_workaround = false;

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef CONFIG_GLES3_H
#define CONFIG_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -123,5 +122,3 @@ public:
} // namespace GLES3
#endif // GLES3_ENABLED
#endif // CONFIG_GLES3_H

View file

@ -1181,7 +1181,7 @@ void LightStorage::lightmap_tap_sh_light(RID p_lightmap, const Vector3 &p_point,
return; // Nothing could be done.
}
node = ABS(node) - 1;
node = Math::abs(node) - 1;
uint32_t *tetrahedron = (uint32_t *)&lm->tetrahedra[node * 4];
Vector3 points[4] = { lm->points[tetrahedron[0]], lm->points[tetrahedron[1]], lm->points[tetrahedron[2]], lm->points[tetrahedron[3]] };

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef LIGHT_STORAGE_GLES3_H
#define LIGHT_STORAGE_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -909,5 +908,3 @@ public:
} // namespace GLES3
#endif // GLES3_ENABLED
#endif // LIGHT_STORAGE_GLES3_H

View file

@ -1143,9 +1143,9 @@ MaterialStorage::MaterialStorage() {
actions.renames["CANVAS_MATRIX"] = "canvas_transform";
actions.renames["SCREEN_MATRIX"] = "screen_transform";
actions.renames["TIME"] = "time";
actions.renames["PI"] = _MKSTR(Math_PI);
actions.renames["TAU"] = _MKSTR(Math_TAU);
actions.renames["E"] = _MKSTR(Math_E);
actions.renames["PI"] = String::num(Math::PI);
actions.renames["TAU"] = String::num(Math::TAU);
actions.renames["E"] = String::num(Math::E);
actions.renames["AT_LIGHT_PASS"] = "false";
actions.renames["INSTANCE_CUSTOM"] = "instance_custom";
@ -1238,9 +1238,9 @@ MaterialStorage::MaterialStorage() {
actions.renames["TIME"] = "scene_data.time";
actions.renames["EXPOSURE"] = "(1.0 / scene_data.emissive_exposure_normalization)";
actions.renames["PI"] = _MKSTR(Math_PI);
actions.renames["TAU"] = _MKSTR(Math_TAU);
actions.renames["E"] = _MKSTR(Math_E);
actions.renames["PI"] = String::num(Math::PI);
actions.renames["TAU"] = String::num(Math::TAU);
actions.renames["E"] = String::num(Math::E);
actions.renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
actions.renames["CLIP_SPACE_FAR"] = "SHADER_SPACE_FAR";
actions.renames["VIEWPORT_SIZE"] = "scene_data.viewport_size";
@ -1406,9 +1406,9 @@ MaterialStorage::MaterialStorage() {
}
actions.renames["TRANSFORM"] = "xform";
actions.renames["TIME"] = "time";
actions.renames["PI"] = _MKSTR(Math_PI);
actions.renames["TAU"] = _MKSTR(Math_TAU);
actions.renames["E"] = _MKSTR(Math_E);
actions.renames["PI"] = String::num(Math::PI);
actions.renames["TAU"] = String::num(Math::TAU);
actions.renames["E"] = String::num(Math::E);
actions.renames["LIFETIME"] = "lifetime";
actions.renames["DELTA"] = "local_delta";
actions.renames["NUMBER"] = "particle_number";
@ -1463,9 +1463,9 @@ MaterialStorage::MaterialStorage() {
actions.renames["SCREEN_UV"] = "uv";
actions.renames["TIME"] = "time";
actions.renames["FRAGCOORD"] = "gl_FragCoord";
actions.renames["PI"] = _MKSTR(Math_PI);
actions.renames["TAU"] = _MKSTR(Math_TAU);
actions.renames["E"] = _MKSTR(Math_E);
actions.renames["PI"] = String::num(Math::PI);
actions.renames["TAU"] = String::num(Math::TAU);
actions.renames["E"] = String::num(Math::E);
actions.renames["HALF_RES_COLOR"] = "half_res_color";
actions.renames["QUARTER_RES_COLOR"] = "quarter_res_color";
actions.renames["RADIANCE"] = "radiance";
@ -1925,7 +1925,7 @@ void MaterialStorage::global_shader_parameters_load_settings(bool p_load_texture
for (const PropertyInfo &E : settings) {
if (E.name.begins_with("shader_globals/")) {
StringName name = E.name.get_slice("/", 1);
StringName name = E.name.get_slicec('/', 1);
Dictionary d = GLOBAL_GET(E.name);
ERR_CONTINUE(!d.has("type"));

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef MATERIAL_STORAGE_GLES3_H
#define MATERIAL_STORAGE_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -634,5 +633,3 @@ public:
} // namespace GLES3
#endif // GLES3_ENABLED
#endif // MATERIAL_STORAGE_GLES3_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef MESH_STORAGE_GLES3_H
#define MESH_STORAGE_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -604,5 +603,3 @@ public:
} // namespace GLES3
#endif // GLES3_ENABLED
#endif // MESH_STORAGE_GLES3_H

View file

@ -513,7 +513,7 @@ void ParticlesStorage::_particles_process(Particles *p_particles, double p_delta
GLES3::TextureStorage *texture_storage = GLES3::TextureStorage::get_singleton();
GLES3::MaterialStorage *material_storage = GLES3::MaterialStorage::get_singleton();
double new_phase = Math::fmod(p_particles->phase + (p_delta / p_particles->lifetime) * p_particles->speed_scale, 1.0);
double new_phase = Math::fmod(p_particles->phase + (p_delta / p_particles->lifetime), 1.0);
//update current frame
ParticlesFrameParams frame_params;
@ -534,7 +534,7 @@ void ParticlesStorage::_particles_process(Particles *p_particles, double p_delta
p_particles->phase = new_phase;
frame_params.time = RSG::rasterizer->get_total_time();
frame_params.delta = p_delta * p_particles->speed_scale;
frame_params.delta = p_delta;
frame_params.random_seed = p_particles->random_seed;
frame_params.explosiveness = p_particles->explosiveness;
frame_params.randomness = p_particles->randomness;
@ -1097,8 +1097,6 @@ void ParticlesStorage::update_particles() {
fixed_fps = particles->fixed_fps;
}
bool zero_time_scale = Engine::get_singleton()->get_time_scale() <= 0.0;
if (particles->clear && particles->pre_process_time > 0.0) {
double frame_time;
if (fixed_fps > 0) {
@ -1115,37 +1113,27 @@ void ParticlesStorage::update_particles() {
}
}
double time_scale = MAX(particles->speed_scale, 0.0);
if (fixed_fps > 0) {
double frame_time;
double decr;
if (zero_time_scale) {
frame_time = 0.0;
decr = 1.0 / fixed_fps;
} else {
frame_time = 1.0 / fixed_fps;
decr = frame_time;
}
double frame_time = 1.0 / fixed_fps;
double delta = RSG::rasterizer->get_frame_delta_time();
if (delta > 0.1) { //avoid recursive stalls if fps goes below 10
delta = 0.1;
} else if (delta <= 0.0) { //unlikely but..
delta = 0.001;
}
double todo = particles->frame_remainder + delta;
double todo = particles->frame_remainder + delta * time_scale;
while (todo >= frame_time) {
_particles_process(particles, frame_time);
todo -= decr;
todo -= frame_time;
}
particles->frame_remainder = todo;
} else {
if (zero_time_scale) {
_particles_process(particles, 0.0);
} else {
_particles_process(particles, RSG::rasterizer->get_frame_delta_time());
}
_particles_process(particles, RSG::rasterizer->get_frame_delta_time() * time_scale);
}
if (particles->request_process_time > 0.0) {

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef PARTICLES_STORAGE_GLES3_H
#define PARTICLES_STORAGE_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -460,5 +459,3 @@ public:
} // namespace GLES3
#endif // GLES3_ENABLED
#endif // PARTICLES_STORAGE_GLES3_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef RENDER_SCENE_BUFFERS_GLES3_H
#define RENDER_SCENE_BUFFERS_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -164,5 +163,3 @@ public:
};
#endif // GLES3_ENABLED
#endif // RENDER_SCENE_BUFFERS_GLES3_H

View file

@ -1468,8 +1468,8 @@ void TextureStorage::texture_debug_usage(List<RS::TextureInfo> *r_info) {
List<RID> textures;
texture_owner.get_owned_list(&textures);
for (List<RID>::Element *E = textures.front(); E; E = E->next()) {
Texture *t = texture_owner.get_or_null(E->get());
for (const RID &rid : textures) {
Texture *t = texture_owner.get_or_null(rid);
if (!t) {
continue;
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef TEXTURE_STORAGE_GLES3_H
#define TEXTURE_STORAGE_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -730,5 +729,3 @@ inline String TextureStorage::get_framebuffer_error(GLenum p_status) {
} // namespace GLES3
#endif // GLES3_ENABLED
#endif // TEXTURE_STORAGE_GLES3_H

View file

@ -421,6 +421,9 @@ bool Utilities::has_os_feature(const String &p_feature) const {
if (p_feature == "etc2") {
return config->etc2_supported;
}
if (p_feature == "astc_hdr") {
return config->astc_hdr_supported;
}
return false;
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef UTILITIES_GLES3_H
#define UTILITIES_GLES3_H
#pragma once
#ifdef GLES3_ENABLED
@ -233,5 +232,3 @@ public:
} // namespace GLES3
#endif // GLES3_ENABLED
#endif // UTILITIES_GLES3_H