Fix and enable the gles3 renderer by default.

This commit is contained in:
Relintai 2024-07-16 19:44:22 +02:00
parent efccdca45f
commit 85e7f7327e
8 changed files with 88 additions and 86 deletions

View File

@ -155,7 +155,7 @@ opts.Add(
False,
)
)
opts.Add(BoolVariable("disable_gles3", "Disable the gles3 video driver.", True))
opts.Add(BoolVariable("disable_gles3", "Disable the gles3 video driver.", False))
opts.Add(BoolVariable("disable_3d", "Disable 3D nodes for a smaller executable", False))
opts.Add(BoolVariable("disable_advanced_gui", "Disable advanced GUI nodes and behaviors", False))
opts.Add(BoolVariable("modules_enabled_by_default", "If no, disable all modules except ones explicitly enabled", True))

View File

@ -896,7 +896,7 @@ void RasterizerCanvasBaseGLES3::canvas_light_shadow_buffer_update(RID p_buffer,
RS::CanvasOccluderPolygonCullMode transformed_cull_cache = instance->cull_cache;
if (transformed_cull_cache != RS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED &&
(p_light_xform.determinant() * instance->xform_cache.determinant()) < 0) {
(p_light_xform.basis_determinant() * instance->xform_cache.basis_determinant()) < 0) {
transformed_cull_cache = (transformed_cull_cache == RS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE)
? RS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE
: RS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE;
@ -971,11 +971,11 @@ void RasterizerCanvasBaseGLES3::reset_canvas() {
if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) {
csy = -1.0;
}
canvas_transform.translate(-(storage->frame.current_rt->width / 2.0f), -(storage->frame.current_rt->height / 2.0f), 0.0f);
canvas_transform.translate_local(-(storage->frame.current_rt->width / 2.0f), -(storage->frame.current_rt->height / 2.0f), 0.0f);
canvas_transform.scale(Vector3(2.0f / storage->frame.current_rt->width, csy * -2.0f / storage->frame.current_rt->height, 1.0f));
} else {
Vector2 ssize = OS::get_singleton()->get_window_size();
canvas_transform.translate(-(ssize.width / 2.0f), -(ssize.height / 2.0f), 0.0f);
canvas_transform.translate_local(-(ssize.width / 2.0f), -(ssize.height / 2.0f), 0.0f);
canvas_transform.scale(Vector3(2.0f / ssize.width, -2.0f / ssize.height, 1.0f));
}

View File

@ -52,17 +52,17 @@ const GLenum RasterizerSceneGLES3::_cube_side_enum[6] = {
};
void RasterizerSceneGLES3::store_transform(const Transform &p_mtx, float *p_array) {
p_array[0] = p_mtx.basis.elements[0][0];
p_array[1] = p_mtx.basis.elements[1][0];
p_array[2] = p_mtx.basis.elements[2][0];
p_array[0] = p_mtx.basis.rows[0][0];
p_array[1] = p_mtx.basis.rows[1][0];
p_array[2] = p_mtx.basis.rows[2][0];
p_array[3] = 0;
p_array[4] = p_mtx.basis.elements[0][1];
p_array[5] = p_mtx.basis.elements[1][1];
p_array[6] = p_mtx.basis.elements[2][1];
p_array[4] = p_mtx.basis.rows[0][1];
p_array[5] = p_mtx.basis.rows[1][1];
p_array[6] = p_mtx.basis.rows[2][1];
p_array[7] = 0;
p_array[8] = p_mtx.basis.elements[0][2];
p_array[9] = p_mtx.basis.elements[1][2];
p_array[10] = p_mtx.basis.elements[2][2];
p_array[8] = p_mtx.basis.rows[0][2];
p_array[9] = p_mtx.basis.rows[1][2];
p_array[10] = p_mtx.basis.rows[2][2];
p_array[11] = 0;
p_array[12] = p_mtx.origin.x;
p_array[13] = p_mtx.origin.y;
@ -3444,7 +3444,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment3D *env, const Projection &p_
if (state.used_sss) { //sss enabled
//copy diffuse while performing sss
Plane p = p_cam_projection.xform4(Plane(1, 0, -1, 1));
Plane p = p_cam_projection.xform(Plane(1, 0, -1, 1));
p.normal /= p.d;
float unit_size = p.normal.x;

View File

@ -2917,8 +2917,8 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
gui[1] = v.position.y;
gui[2] = v.size.x;
gui[3] = v.size.y;
} else if (value.get_type() == Variant::QUAT) {
Quat v = value;
} else if (value.get_type() == Variant::QUATERNION) {
Quaternion v = value;
gui[0] = v.x;
gui[1] = v.y;
@ -2938,12 +2938,12 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
GLfloat *gui = (GLfloat *)data;
//in std140 members of mat2 are treated as vec4s
gui[0] = v.elements[0][0];
gui[1] = v.elements[0][1];
gui[0] = v.columns[0][0];
gui[1] = v.columns[0][1];
gui[2] = 0;
gui[3] = 0;
gui[4] = v.elements[1][0];
gui[5] = v.elements[1][1];
gui[4] = v.columns[1][0];
gui[5] = v.columns[1][1];
gui[6] = 0;
gui[7] = 0;
} break;
@ -2951,34 +2951,34 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
Basis v = value;
GLfloat *gui = (GLfloat *)data;
gui[0] = v.elements[0][0];
gui[1] = v.elements[1][0];
gui[2] = v.elements[2][0];
gui[0] = v.rows[0][0];
gui[1] = v.rows[1][0];
gui[2] = v.rows[2][0];
gui[3] = 0;
gui[4] = v.elements[0][1];
gui[5] = v.elements[1][1];
gui[6] = v.elements[2][1];
gui[4] = v.rows[0][1];
gui[5] = v.rows[1][1];
gui[6] = v.rows[2][1];
gui[7] = 0;
gui[8] = v.elements[0][2];
gui[9] = v.elements[1][2];
gui[10] = v.elements[2][2];
gui[8] = v.rows[0][2];
gui[9] = v.rows[1][2];
gui[10] = v.rows[2][2];
gui[11] = 0;
} break;
case ShaderLanguage::TYPE_MAT4: {
Transform v = value;
GLfloat *gui = (GLfloat *)data;
gui[0] = v.basis.elements[0][0];
gui[1] = v.basis.elements[1][0];
gui[2] = v.basis.elements[2][0];
gui[0] = v.basis.rows[0][0];
gui[1] = v.basis.rows[1][0];
gui[2] = v.basis.rows[2][0];
gui[3] = 0;
gui[4] = v.basis.elements[0][1];
gui[5] = v.basis.elements[1][1];
gui[6] = v.basis.elements[2][1];
gui[4] = v.basis.rows[0][1];
gui[5] = v.basis.rows[1][1];
gui[6] = v.basis.rows[2][1];
gui[7] = 0;
gui[8] = v.basis.elements[0][2];
gui[9] = v.basis.elements[1][2];
gui[10] = v.basis.elements[2][2];
gui[8] = v.basis.rows[0][2];
gui[9] = v.basis.rows[1][2];
gui[10] = v.basis.rows[2][2];
gui[11] = 0;
gui[12] = v.origin.x;
gui[13] = v.origin.y;
@ -4666,17 +4666,17 @@ void RasterizerStorageGLES3::_multimesh_instance_set_transform(RID p_multimesh,
int stride = multimesh->color_floats + multimesh->xform_floats + multimesh->custom_data_floats;
float *dataptr = &multimesh->data.write[stride * p_index];
dataptr[0] = p_transform.basis.elements[0][0];
dataptr[1] = p_transform.basis.elements[0][1];
dataptr[2] = p_transform.basis.elements[0][2];
dataptr[0] = p_transform.basis.rows[0][0];
dataptr[1] = p_transform.basis.rows[0][1];
dataptr[2] = p_transform.basis.rows[0][2];
dataptr[3] = p_transform.origin.x;
dataptr[4] = p_transform.basis.elements[1][0];
dataptr[5] = p_transform.basis.elements[1][1];
dataptr[6] = p_transform.basis.elements[1][2];
dataptr[4] = p_transform.basis.rows[1][0];
dataptr[5] = p_transform.basis.rows[1][1];
dataptr[6] = p_transform.basis.rows[1][2];
dataptr[7] = p_transform.origin.y;
dataptr[8] = p_transform.basis.elements[2][0];
dataptr[9] = p_transform.basis.elements[2][1];
dataptr[10] = p_transform.basis.elements[2][2];
dataptr[8] = p_transform.basis.rows[2][0];
dataptr[9] = p_transform.basis.rows[2][1];
dataptr[10] = p_transform.basis.rows[2][2];
dataptr[11] = p_transform.origin.z;
multimesh->dirty_data = true;
@ -4696,14 +4696,14 @@ void RasterizerStorageGLES3::_multimesh_instance_set_transform_2d(RID p_multimes
int stride = multimesh->color_floats + multimesh->xform_floats + multimesh->custom_data_floats;
float *dataptr = &multimesh->data.write[stride * p_index];
dataptr[0] = p_transform.elements[0][0];
dataptr[1] = p_transform.elements[1][0];
dataptr[0] = p_transform.columns[0][0];
dataptr[1] = p_transform.columns[1][0];
dataptr[2] = 0;
dataptr[3] = p_transform.elements[2][0];
dataptr[4] = p_transform.elements[0][1];
dataptr[5] = p_transform.elements[1][1];
dataptr[3] = p_transform.columns[2][0];
dataptr[4] = p_transform.columns[0][1];
dataptr[5] = p_transform.columns[1][1];
dataptr[6] = 0;
dataptr[7] = p_transform.elements[2][1];
dataptr[7] = p_transform.columns[2][1];
multimesh->dirty_data = true;
multimesh->dirty_aabb = true;
@ -4793,17 +4793,17 @@ Transform RasterizerStorageGLES3::_multimesh_instance_get_transform(RID p_multim
Transform xform;
xform.basis.elements[0][0] = dataptr[0];
xform.basis.elements[0][1] = dataptr[1];
xform.basis.elements[0][2] = dataptr[2];
xform.basis.rows[0][0] = dataptr[0];
xform.basis.rows[0][1] = dataptr[1];
xform.basis.rows[0][2] = dataptr[2];
xform.origin.x = dataptr[3];
xform.basis.elements[1][0] = dataptr[4];
xform.basis.elements[1][1] = dataptr[5];
xform.basis.elements[1][2] = dataptr[6];
xform.basis.rows[1][0] = dataptr[4];
xform.basis.rows[1][1] = dataptr[5];
xform.basis.rows[1][2] = dataptr[6];
xform.origin.y = dataptr[7];
xform.basis.elements[2][0] = dataptr[8];
xform.basis.elements[2][1] = dataptr[9];
xform.basis.elements[2][2] = dataptr[10];
xform.basis.rows[2][0] = dataptr[8];
xform.basis.rows[2][1] = dataptr[9];
xform.basis.rows[2][2] = dataptr[10];
xform.origin.z = dataptr[11];
return xform;
@ -4819,12 +4819,12 @@ Transform2D RasterizerStorageGLES3::_multimesh_instance_get_transform_2d(RID p_m
Transform2D xform;
xform.elements[0][0] = dataptr[0];
xform.elements[1][0] = dataptr[1];
xform.elements[2][0] = dataptr[3];
xform.elements[0][1] = dataptr[4];
xform.elements[1][1] = dataptr[5];
xform.elements[2][1] = dataptr[7];
xform.columns[0][0] = dataptr[0];
xform.columns[1][0] = dataptr[1];
xform.columns[2][0] = dataptr[3];
xform.columns[0][1] = dataptr[4];
xform.columns[1][1] = dataptr[5];
xform.columns[2][1] = dataptr[7];
return xform;
}
@ -5017,17 +5017,17 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() {
float *dataptr = &data[i];
Transform xform;
xform.basis.elements[0][0] = dataptr[0];
xform.basis.elements[0][1] = dataptr[1];
xform.basis.elements[0][2] = dataptr[2];
xform.basis.rows[0][0] = dataptr[0];
xform.basis.rows[0][1] = dataptr[1];
xform.basis.rows[0][2] = dataptr[2];
xform.origin.x = dataptr[3];
xform.basis.elements[1][0] = dataptr[4];
xform.basis.elements[1][1] = dataptr[5];
xform.basis.elements[1][2] = dataptr[6];
xform.basis.rows[1][0] = dataptr[4];
xform.basis.rows[1][1] = dataptr[5];
xform.basis.rows[1][2] = dataptr[6];
xform.origin.y = dataptr[7];
xform.basis.elements[2][0] = dataptr[8];
xform.basis.elements[2][1] = dataptr[9];
xform.basis.elements[2][2] = dataptr[10];
xform.basis.rows[2][0] = dataptr[8];
xform.basis.rows[2][1] = dataptr[9];
xform.basis.rows[2][2] = dataptr[10];
xform.origin.z = dataptr[11];
AABB laabb = xform.xform(mesh_aabb);
@ -5046,7 +5046,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() {
int num_linked = multimesh->linked_canvas_items.size();
for (int n = 0; n < num_linked; n++) {
const RID &rid = multimesh->linked_canvas_items[n];
VSG::canvas->_canvas_item_invalidate_local_bound(rid);
RSG::canvas->_canvas_item_invalidate_local_bound(rid);
}
}
multimesh->dirty_aabb = false;
@ -5402,7 +5402,7 @@ void RasterizerStorageGLES3::update_dirty_skeletons() {
int num_linked = skeleton->linked_canvas_items.size();
for (int n = 0; n < num_linked; n++) {
const RID &rid = skeleton->linked_canvas_items[n];
VSG::canvas->_canvas_item_invalidate_local_bound(rid);
RSG::canvas->_canvas_item_invalidate_local_bound(rid);
}
ele = ele->next();
@ -5547,7 +5547,7 @@ void RasterizerStorageGLES3::light_set_reverse_cull_face_mode(RID p_light, bool
}
void RasterizerStorageGLES3::light_set_use_gi(RID p_light, bool p_enabled) {
WARN_DEPRECATED_MSG("'RenderingServer.light_set_use_gi' is deprecated and will be removed in a future version. Use 'VisualServer.light_set_bake_mode' instead.");
WARN_DEPRECATED_MSG("'RenderingServer.light_set_use_gi' is deprecated and will be removed in a future version. Use 'RenderingServer.light_set_bake_mode' instead.");
light_set_bake_mode(p_light, p_enabled ? RS::LightBakeMode::LIGHT_BAKE_INDIRECT : RS::LightBakeMode::LIGHT_BAKE_DISABLED);
}
@ -7927,7 +7927,7 @@ bool RasterizerStorageGLES3::free(RID p_rid) {
int num_linked = multimesh->linked_canvas_items.size();
for (int n = 0; n < num_linked; n++) {
const RID &rid = multimesh->linked_canvas_items[n];
VSG::canvas->_canvas_item_remove_references(rid, p_rid);
RSG::canvas->_canvas_item_remove_references(rid, p_rid);
}
// delete the texture

View File

@ -1202,7 +1202,7 @@ public:
bool use_local_coords;
RID process_material;
ParticlesDrawOrder draw_order;
RS::ParticlesDrawOrder draw_order;
Vector<RID> draw_passes;
@ -1246,7 +1246,7 @@ public:
restart_request(false),
custom_aabb(AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8))),
use_local_coords(true),
draw_order(PARTICLES_DRAW_ORDER_INDEX),
draw_order(RS::PARTICLES_DRAW_ORDER_INDEX),
histories_enabled(false),
particle_element(this),
prev_ticks(0),
@ -1297,7 +1297,7 @@ public:
virtual void particles_set_fractional_delta(RID p_particles, bool p_enable);
virtual void particles_restart(RID p_particles);
virtual void particles_set_draw_order(RID p_particles, ParticlesDrawOrder p_order);
virtual void particles_set_draw_order(RID p_particles, RS::ParticlesDrawOrder p_order);
virtual void particles_set_draw_passes(RID p_particles, int p_passes);
virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh);

View File

@ -170,7 +170,7 @@ ShaderCacheGLES3::ShaderCacheGLES3() {
storage_size = (int)GLOBAL_GET("rendering/gles3/shaders/shader_cache_size_mb") * 1024 * 1024;
storage_da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
storage_path = OS::get_singleton()->get_cache_path().plus_file(OS::get_singleton()->get_godot_dir_name()).plus_file("shaders");
storage_path = OS::get_singleton()->get_cache_path().plus_file(OS::get_singleton()->get_pandemonium_dir_name()).plus_file("shaders");
print_verbose("Shader cache path: " + storage_path);
if (storage_da->make_dir_recursive(storage_path) != OK) {

View File

@ -34,6 +34,7 @@
#include "core/containers/hash_map.h"
#include "core/containers/local_vector.h"
#include "core/containers/rb_map.h"
#include "core/containers/og_hash_map.h"
#include "core/math/projection.h"
#include "core/os/safe_refcount.h"
#include "core/containers/self_list.h"
@ -231,7 +232,7 @@ private:
};
//this should use a way more cachefriendly version..
HashMap<VersionKey, Version, VersionKeyHash> version_map;
OGHashMap<VersionKey, Version, VersionKeyHash> version_map;
HashMap<uint32_t, CustomCode> custom_code_map;
uint32_t last_custom_code;

View File

@ -452,6 +452,7 @@ public:
LIGHT_PARAM_SHADOW_NORMAL_BIAS,
LIGHT_PARAM_SHADOW_BIAS,
LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE,
LIGHT_PARAM_SHADOW_FADE_START,
LIGHT_PARAM_MAX
};