Skip to content

Commit

Permalink
Cleanup not needed code
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmaa committed May 24, 2024
1 parent 3a01651 commit ec6efad
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 136 deletions.
34 changes: 0 additions & 34 deletions drivers/gles3/shaders/scene.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -344,37 +344,6 @@ void main() {

highp mat4 model_matrix = world_transform;

#ifdef USE_VERTEX_LIGHTING
//lay out everything, whatever is unused is optimized away anyway
vec3 albedo = vec3(1.0);
vec3 backlight = vec3(0.0);
vec4 transmittance_color = vec4(0.0, 0.0, 0.0, 1.0);
float transmittance_depth = 0.0;
float transmittance_boost = 0.0;
float metallic = 0.0;
float specular = 0.5;
vec3 emission = vec3(0.0);
float rim = 0.0;
float rim_tint = 0.0;
float clearcoat = 0.0;
float clearcoat_roughness = 0.0;
float anisotropy = 0.0;
vec2 anisotropy_flow = vec2(1.0, 0.0);
#ifndef FOG_DISABLED
vec4 fog = vec4(0.0);
#endif // !FOG_DISABLED
#if defined(CUSTOM_RADIANCE_USED)
vec4 custom_radiance = vec4(0.0);
#endif
#if defined(CUSTOM_IRRADIANCE_USED)
vec4 custom_irradiance = vec4(0.0);
#endif

float ao = 1.0;
float ao_light_affect = 0.0;

float alpha = 1.0;
#endif // USE_VERTEX_LIGHTING

#ifdef USE_INSTANCING
highp mat4 m = mat4(instance_xform0, instance_xform1, instance_xform2, vec4(0.0, 0.0, 0.0, 1.0));
Expand Down Expand Up @@ -1635,9 +1604,6 @@ void main() {
diffuse_light, specular_light);
}
#endif // !DISABLE_LIGHT_SPOT
#else // Pass Vertex Lighting data to fragment colors
diffuse_light *= mix(vec3(1.0), vec3(1.0), diffuse_light_interp.a);
specular_light *= mix(vec3(1.0), vec3(1.0), specular_light_interp.a);
#endif // !USE_VERTEX_LIGHTING
#endif // BASE_PASS
#endif // !MODE_UNSHADED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,37 +523,6 @@ void vertex_shader(vec3 vertex_input,
#ifdef MOTION_VECTORS
screen_pos = gl_Position;
#endif
#ifdef USE_VERTEX_LIGHTING
//lay out everything, whatever is unused is optimized away anyway
vec3 albedo = vec3(1.0);
vec3 backlight = vec3(0.0);
vec4 transmittance_color = vec4(0.0);
float transmittance_depth = 0.0;
float transmittance_boost = 0.0;
float metallic = 0.0;
float specular = 0.5;
vec3 emission = vec3(0.0);
float rim = 0.0;
float rim_tint = 0.0;
float clearcoat = 0.0;
float clearcoat_roughness = 0.0;
float anisotropy = 0.0;
vec2 anisotropy_flow = vec2(1.0, 0.0);
#ifndef FOG_DISABLED
vec4 fog = vec4(0.0);
#endif // !FOG_DISABLED
#if defined(CUSTOM_RADIANCE_USED)
vec4 custom_radiance = vec4(0.0);
#endif
#if defined(CUSTOM_IRRADIANCE_USED)
vec4 custom_irradiance = vec4(0.0);
#endif

float ao = 1.0;
float ao_light_affect = 0.0;

float alpha = 1.0;
#endif // USE_VERTEX_LIGHTING
// VERTEX LIGHTING
#if !defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED) && defined(USE_VERTEX_LIGHTING)
diffuse_light_interp = vec4(0.0);
Expand All @@ -577,26 +546,6 @@ void vertex_shader(vec3 vertex_input,
//this saves some VGPRs
vec3 f0 = F0(metallic, specular, albedo);

{
#if defined(DIFFUSE_TOON)
//simplify for toon, as
specular_light_interp.rgb *= specular * metallic * albedo * 2.0;
#else

// scales the specular reflections, needs to be computed before lighting happens,
// but after environment, GI, and reflection probes are added
// Environment brdf approximation (Lazarov 2013)
// see https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile
const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);
vec4 r = roughness * c0 + c1;
float ndotv = clamp(dot(normal, view), 0.0, 1.0);
float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;

specular_light_interp.rgb *= env.x * f0 + env.y * clamp(50.0 * f0.g, metallic, 1.0);
#endif
}

#if !defined(MODE_RENDER_DEPTH)
//this saves some VGPRs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,37 +208,6 @@ void main() {

mat4 model_matrix = instances.data[draw_call.instance_index].transform;
mat4 inv_view_matrix = scene_data.inv_view_matrix;
#ifdef USE_VERTEX_LIGHTING
//lay out everything, whatever is unused is optimized away anyway
vec3 albedo = vec3(1.0);
vec3 backlight = vec3(0.0);
vec4 transmittance_color = vec4(0.0);
float transmittance_depth = 0.0;
float transmittance_boost = 0.0;
float metallic = 0.0;
float specular = 0.5;
vec3 emission = vec3(0.0);
float rim = 0.0;
float rim_tint = 0.0;
float clearcoat = 0.0;
float clearcoat_roughness = 0.0;
float anisotropy = 0.0;
vec2 anisotropy_flow = vec2(1.0, 0.0);
#ifndef FOG_DISABLED
vec4 fog = vec4(0.0);
#endif // !FOG_DISABLED
#if defined(CUSTOM_RADIANCE_USED)
vec4 custom_radiance = vec4(0.0);
#endif
#if defined(CUSTOM_IRRADIANCE_USED)
vec4 custom_irradiance = vec4(0.0);
#endif

float ao = 1.0;
float ao_light_affect = 0.0;

float alpha = 1.0;
#endif // USE_VERTEX_LIGHTING

#ifdef USE_DOUBLE_PRECISION
vec3 model_precision = vec3(model_matrix[0][3], model_matrix[1][3], model_matrix[2][3]);
Expand Down Expand Up @@ -523,26 +492,6 @@ void main() {
vec3 f0 = F0(metallic, specular, albedo);
diffuse_light_interp = vec4(0.0);
specular_light_interp = vec4(0.0);
{
#if defined(DIFFUSE_TOON)
//simplify for toon, as
specular_light_interp.rgb *= specular * metallic * albedo * 2.0;
#else

// scales the specular reflections, needs to be computed before lighting happens,
// but after environment, GI, and reflection probes are added
// Environment brdf approximation (Lazarov 2013)
// see https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile
const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);
vec4 r = roughness * c0 + c1;
float ndotv = clamp(dot(normal, view), 0.0, 1.0);
float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;

specular_light_interp.rgb *= env.x * f0 + env.y * clamp(50.0 * f0.g, metallic, 1.0);
#endif
}

#if !defined(MODE_RENDER_DEPTH)
//this saves some VGPRs
Expand Down

0 comments on commit ec6efad

Please sign in to comment.