1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Optimize Mobile renderer by using FP16 explicitly.

This commit is contained in:
Dario
2025-05-28 11:58:07 -03:00
parent 8f87e60307
commit 46277836a6
23 changed files with 938 additions and 786 deletions

View File

@@ -3,31 +3,31 @@
#define LIGHT_BAKE_DYNAMIC 2
struct LightData { //this structure needs to be as packed as possible
highp vec3 position;
highp float inv_radius;
vec3 position;
float inv_radius;
mediump vec3 direction;
highp float size;
vec3 direction;
float size;
mediump vec3 color;
mediump float attenuation;
vec3 color;
float attenuation;
mediump float cone_attenuation;
mediump float cone_angle;
mediump float specular_amount;
mediump float shadow_opacity;
float cone_attenuation;
float cone_angle;
float specular_amount;
float shadow_opacity;
highp vec4 atlas_rect; // rect in the shadow atlas
highp mat4 shadow_matrix;
highp float shadow_bias;
highp float shadow_normal_bias;
highp float transmittance_bias;
highp float soft_shadow_size; // for spot, it's the size in uv coordinates of the light, for omni it's the span angle
highp float soft_shadow_scale; // scales the shadow kernel for blurrier shadows
vec4 atlas_rect; // rect in the shadow atlas
mat4 shadow_matrix;
float shadow_bias;
float shadow_normal_bias;
float transmittance_bias;
float soft_shadow_size; // for spot, it's the size in uv coordinates of the light, for omni it's the span angle
float soft_shadow_scale; // scales the shadow kernel for blurrier shadows
uint mask;
mediump float volumetric_fog_energy;
float volumetric_fog_energy;
uint bake_mode;
highp vec4 projector_rect; //projector rect in srgb decal atlas
vec4 projector_rect; //projector rect in srgb decal atlas
};
#define REFLECTION_AMBIENT_DISABLED 0
@@ -35,13 +35,13 @@ struct LightData { //this structure needs to be as packed as possible
#define REFLECTION_AMBIENT_COLOR 2
struct ReflectionData {
highp vec3 box_extents;
mediump float index;
highp vec3 box_offset;
vec3 box_extents;
float index;
vec3 box_offset;
uint mask;
mediump vec3 ambient; // ambient color
mediump float intensity;
mediump float blend_distance;
vec3 ambient; // ambient color
float intensity;
float blend_distance;
bool exterior;
bool box_project;
uint ambient_mode;
@@ -50,38 +50,38 @@ struct ReflectionData {
float pad1;
float pad2;
//0-8 is intensity,8-9 is ambient, mode
highp mat4 local_matrix; // up to here for spot and omni, rest is for directional
mat4 local_matrix; // up to here for spot and omni, rest is for directional
// notes: for ambientblend, use distance to edge to blend between already existing global environment
};
struct DirectionalLightData {
mediump vec3 direction;
highp float energy; // needs to be highp to avoid NaNs being created with high energy values (i.e. when using physical light units and over-exposing the image)
mediump vec3 color;
mediump float size;
mediump float specular;
vec3 direction;
float energy; // needs to be highp to avoid NaNs being created with high energy values (i.e. when using physical light units and over-exposing the image)
vec3 color;
float size;
float specular;
uint mask;
highp float softshadow_angle;
highp float soft_shadow_scale;
float softshadow_angle;
float soft_shadow_scale;
bool blend_splits;
mediump float shadow_opacity;
highp float fade_from;
highp float fade_to;
float shadow_opacity;
float fade_from;
float fade_to;
uvec2 pad;
uint bake_mode;
mediump float volumetric_fog_energy;
highp vec4 shadow_bias;
highp vec4 shadow_normal_bias;
highp vec4 shadow_transmittance_bias;
highp vec4 shadow_z_range;
highp vec4 shadow_range_begin;
highp vec4 shadow_split_offsets;
highp mat4 shadow_matrix1;
highp mat4 shadow_matrix2;
highp mat4 shadow_matrix3;
highp mat4 shadow_matrix4;
highp vec2 uv_scale1;
highp vec2 uv_scale2;
highp vec2 uv_scale3;
highp vec2 uv_scale4;
float volumetric_fog_energy;
vec4 shadow_bias;
vec4 shadow_normal_bias;
vec4 shadow_transmittance_bias;
vec4 shadow_z_range;
vec4 shadow_range_begin;
vec4 shadow_split_offsets;
mat4 shadow_matrix1;
mat4 shadow_matrix2;
mat4 shadow_matrix3;
mat4 shadow_matrix4;
vec2 uv_scale1;
vec2 uv_scale2;
vec2 uv_scale3;
vec2 uv_scale4;
};