diff options
Diffstat (limited to 'servers/rendering/rasterizer_rd/shaders')
24 files changed, 0 insertions, 150 deletions
diff --git a/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl b/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl index 7153fe6b17..dbeccbfff4 100644 --- a/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl +++ b/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl @@ -69,7 +69,6 @@ float get_depth_at_pos(vec2 uv) { } float get_blur_size(float depth) { - if (params.blur_near_active && depth < params.blur_near_begin) { return -(1.0 - smoothstep(params.blur_near_end, params.blur_near_begin, depth)) * params.blur_size - DEPTH_GAP; //near blur is negative } @@ -95,7 +94,6 @@ float hash12n(vec2 p) { #if defined(MODE_BOKEH_BOX) || defined(MODE_BOKEH_HEXAGONAL) vec4 weighted_filter_dir(vec2 dir, vec2 uv, vec2 pixel_size) { - dir *= pixel_size; vec4 color = texture(color_texture, uv); @@ -109,7 +107,6 @@ vec4 weighted_filter_dir(vec2 dir, vec2 uv, vec2 pixel_size) { } for (int i = -params.blur_steps; i <= params.blur_steps; i++) { - if (i == 0) { continue; } @@ -141,7 +138,6 @@ vec4 weighted_filter_dir(vec2 dir, vec2 uv, vec2 pixel_size) { #endif void main() { - ivec2 pos = ivec2(gl_GlobalInvocationID.xy); if (any(greaterThan(pos, params.size))) { //too large, do nothing @@ -218,7 +214,6 @@ void main() { float radius = params.blur_scale; for (float ang = 0.0; radius < params.blur_size; ang += GOLDEN_ANGLE) { - vec2 suv = uv + vec2(cos(ang), sin(ang)) * pixel_size * radius; vec4 sample_color = texture(color_texture, suv); float sample_size = abs(sample_color.a); diff --git a/servers/rendering/rasterizer_rd/shaders/canvas.glsl b/servers/rendering/rasterizer_rd/shaders/canvas.glsl index 28135fce31..fea36eb65c 100644 --- a/servers/rendering/rasterizer_rd/shaders/canvas.glsl +++ b/servers/rendering/rasterizer_rd/shaders/canvas.glsl @@ -40,7 +40,6 @@ VERTEX_SHADER_GLOBALS /* clang-format on */ void main() { - vec4 instance_custom = vec4(0.0); #ifdef USE_PRIMITIVE @@ -149,7 +148,6 @@ VERTEX_SHADER_CODE color_interp = color; if (bool(draw_data.flags & FLAGS_USE_PIXEL_SNAP)) { - vertex = floor(vertex + 0.5); // precision issue on some hardware creates artifacts within texture // offset uv by a small amount to avoid @@ -258,7 +256,6 @@ vec4 light_compute( vec2 screen_uv, vec2 uv, vec4 color) { - vec4 light = vec4(0.0); /* clang-format off */ LIGHT_SHADER_CODE @@ -271,7 +268,6 @@ LIGHT_SHADER_CODE #ifdef USE_NINEPATCH float map_ninepatch_axis(float pixel, float draw_size, float tex_pixel_size, float margin_begin, float margin_end, int np_repeat, inout int draw_center) { - float tex_size = 1.0 / tex_pixel_size; if (pixel < margin_begin) { @@ -313,7 +309,6 @@ float map_ninepatch_axis(float pixel, float draw_size, float tex_pixel_size, flo #endif void main() { - vec4 color = color_interp; vec2 uv = uv_interp; vec2 vertex = vertex_interp; @@ -335,7 +330,6 @@ void main() { #endif if (bool(draw_data.flags & FLAGS_CLIP_RECT_UV)) { - uv = clamp(uv, draw_data.src_rect.xy, draw_data.src_rect.xy + abs(draw_data.src_rect.zw)); } @@ -458,7 +452,6 @@ FRAGMENT_SHADER_CODE light_color.rgb *= light_base_color.rgb * light_base_color.a; if (normal_used) { - vec3 light_pos = vec3(light_array.data[light_base].position, light_array.data[light_base].height); vec3 pos = light_vertex; vec3 light_vec = normalize(light_pos - pos); @@ -490,7 +483,6 @@ FRAGMENT_SHADER_CODE } if (bool(light_array.data[light_base].flags & LIGHT_FLAGS_HAS_SHADOW)) { - vec2 shadow_pos = (vec4(shadow_vertex, 0.0, 1.0) * mat4(light_array.data[light_base].shadow_matrix[0], light_array.data[light_base].shadow_matrix[1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0))).xy; //multiply inverse given its transposed. Optimizer removes useless operations. vec2 pos_norm = normalize(shadow_pos); diff --git a/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl index 7b30cc8fe9..8c2b0c925d 100644 --- a/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl +++ b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl @@ -7,7 +7,6 @@ layout(location = 0) in highp vec3 vertex; /* clang-format on */ layout(push_constant, binding = 0, std430) uniform Constants { - mat4 projection; mat2x4 modelview; vec2 direction; @@ -18,7 +17,6 @@ constants; layout(location = 0) out highp float depth; void main() { - highp vec4 vtx = vec4(vertex, 1.0) * mat4(constants.modelview[0], constants.modelview[1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); depth = dot(constants.direction, vtx.xy); @@ -35,6 +33,5 @@ layout(location = 0) in highp float depth; layout(location = 0) out highp float distance_buf; void main() { - distance_buf = depth; } diff --git a/servers/rendering/rasterizer_rd/shaders/copy.glsl b/servers/rendering/rasterizer_rd/shaders/copy.glsl index 075ee2af22..c8a8b027c8 100644 --- a/servers/rendering/rasterizer_rd/shaders/copy.glsl +++ b/servers/rendering/rasterizer_rd/shaders/copy.glsl @@ -60,7 +60,6 @@ layout(rgba32f, set = 3, binding = 0) uniform restrict writeonly image2D dest_bu #endif void main() { - // Pixel being shaded ivec2 pos = ivec2(gl_GlobalInvocationID.xy); if (any(greaterThanEqual(pos, params.section.zw))) { //too large, do nothing @@ -84,7 +83,6 @@ void main() { //Simpler blur uses SIGMA2 for the gaussian kernel for a stronger effect if (bool(params.flags & FLAG_HORIZONTAL)) { - ivec2 base_pos = (pos + params.section.xy) << 1; vec4 color = texelFetch(source_color, base_pos + ivec2(0, 0), 0) * 0.214607; color += texelFetch(source_color, base_pos + ivec2(1, 0), 0) * 0.189879; @@ -95,7 +93,6 @@ void main() { color += texelFetch(source_color, base_pos + ivec2(-3, 0), 0) * 0.071303; imageStore(dest_buffer, pos + params.target, color); } else { - ivec2 base_pos = (pos + params.section.xy); vec4 color = texelFetch(source_color, base_pos + ivec2(0, 0), 0) * 0.38774; color += texelFetch(source_color, base_pos + ivec2(0, 1), 0) * 0.24477; @@ -121,7 +118,6 @@ void main() { vec4 color = vec4(0.0); if (bool(params.flags & FLAG_HORIZONTAL)) { - ivec2 base_pos = (pos + params.section.xy) << 1; ivec2 section_begin = params.section.xy << 1; ivec2 section_end = section_begin + (params.section.zw << 1); @@ -135,7 +131,6 @@ void main() { GLOW_ADD(ivec2(-3, 0), 0.106595); color *= params.glow_strength; } else { - ivec2 base_pos = pos + params.section.xy; ivec2 section_begin = params.section.xy; ivec2 section_end = section_begin + params.section.zw; diff --git a/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl b/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl index 07f8d09743..2308f58e00 100644 --- a/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl +++ b/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl @@ -20,7 +20,6 @@ layout(push_constant, binding = 1, std430) uniform Params { params; void main() { - vec2 base_arr[4] = vec2[](vec2(0.0, 0.0), vec2(0.0, 1.0), vec2(1.0, 1.0), vec2(1.0, 0.0)); uv_interp = base_arr[gl_VertexIndex]; @@ -63,7 +62,6 @@ layout(set = 0, binding = 0) uniform sampler2D source_color; layout(location = 0) out vec4 frag_color; void main() { - vec2 uv = uv_interp; #ifdef MODE_PANORAMA_TO_DP diff --git a/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl b/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl index 02ebe1a53b..2fd2e05ae1 100644 --- a/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl @@ -23,7 +23,6 @@ params; layout(r32f, set = 1, binding = 0) uniform restrict writeonly image2D depth_buffer; void main() { - ivec2 pos = ivec2(gl_GlobalInvocationID.xy); if (any(greaterThan(pos, params.screen_size))) { //too large, do nothing return; diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl index e85996fa1a..36dba6df3d 100644 --- a/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl @@ -119,10 +119,8 @@ void main() { //vec4 color = color_interp; if (params.use_direct_write) { - imageStore(dest_cubemap, ivec3(id), vec4(texture(source_cube, N).rgb, 1.0)); } else { - vec4 sum = vec4(0.0, 0.0, 0.0, 0.0); for (uint sampleNum = 0u; sampleNum < params.sample_count; sampleNum++) { @@ -135,7 +133,6 @@ void main() { float ndotl = clamp(dot(N, L), 0.0, 1.0); if (ndotl > 0.0) { - sum.rgb += textureLod(source_cube, L, 0.0).rgb * ndotl; sum.a += ndotl; } diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe.glsl index fd09f96a57..e4449afbd0 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe.glsl @@ -47,7 +47,6 @@ cell_data; #if defined(MODE_COMPUTE_LIGHT) || defined(MODE_DYNAMIC_LIGHTING) struct Light { - uint type; float energy; float radius; @@ -191,7 +190,6 @@ layout(r16ui, set = 0, binding = 13) uniform restrict writeonly uimage3D aniso_n #if defined(MODE_COMPUTE_LIGHT) || defined(MODE_DYNAMIC_LIGHTING) float raymarch(float distance, float distance_adv, vec3 from, vec3 direction) { - vec3 cell_size = 1.0 / vec3(params.limits); float occlusion = 1.0; while (distance > 0.5) { //use this to avoid precision errors @@ -213,14 +211,11 @@ float raymarch(float distance, float distance_adv, vec3 from, vec3 direction) { } bool compute_light_vector(uint light, vec3 pos, out float attenuation, out vec3 light_pos) { - if (lights.data[light].type == LIGHT_TYPE_DIRECTIONAL) { - light_pos = pos - lights.data[light].direction * length(vec3(params.limits)); attenuation = 1.0; } else { - light_pos = lights.data[light].position; float distance = length(pos - light_pos); if (distance >= lights.data[light].radius) { @@ -230,7 +225,6 @@ bool compute_light_vector(uint light, vec3 pos, out float attenuation, out vec3 attenuation = pow(clamp(1.0 - distance / lights.data[light].radius, 0.0001, 1.0), lights.data[light].attenuation); if (lights.data[light].type == LIGHT_TYPE_SPOT) { - vec3 rel = normalize(pos - light_pos); float angle = acos(dot(rel, lights.data[light].direction)); if (angle > lights.data[light].spot_angle_radians) { @@ -246,7 +240,6 @@ bool compute_light_vector(uint light, vec3 pos, out float attenuation, out vec3 } float get_normal_advance(vec3 p_normal) { - vec3 normal = p_normal; vec3 unorm = abs(normal); @@ -269,7 +262,6 @@ float get_normal_advance(vec3 p_normal) { } void clip_segment(vec4 plane, vec3 begin, inout vec3 end) { - vec3 segment = begin - end; float den = dot(plane.xyz, segment); @@ -302,7 +294,6 @@ bool compute_light_at_pos(uint index, vec3 pos, vec3 normal, inout vec3 light, i } if (lights.data[index].has_shadow) { - float distance_adv = get_normal_advance(light_dir); vec3 to = pos; @@ -352,7 +343,6 @@ bool compute_light_at_pos(uint index, vec3 pos, vec3 normal, inout vec3 light, i #endif // MODE COMPUTE LIGHT void main() { - #ifndef MODE_DYNAMIC uint cell_index = gl_GlobalInvocationID.x; @@ -383,7 +373,6 @@ void main() { #endif for (uint i = 0; i < params.light_count; i++) { - vec3 light; vec3 light_dir; if (!compute_light_at_pos(i, pos, normal.xyz, light, light_dir)) { @@ -394,7 +383,6 @@ void main() { #ifdef MODE_ANISOTROPIC for (uint j = 0; j < 6; j++) { - accum[j] += max(0.0, dot(accum_dirs[j], -light_dir)) * light; } #else @@ -461,7 +449,6 @@ void main() { #endif if (length(normal.xyz) > 0.2) { - vec3 v0 = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(0.0, 1.0, 0.0); vec3 tangent = normalize(cross(v0, normal.xyz)); vec3 bitangent = normalize(cross(tangent, normal.xyz)); @@ -481,11 +468,9 @@ void main() { float tan_half_angle = 0.577; for (int i = 0; i < MAX_CONE_DIRS; i++) { - vec3 direction = normal_mat * cone_dirs[i]; vec4 color = vec4(0.0); { - float dist = 1.5; float max_distance = length(vec3(params.limits)); vec3 cell_size = 1.0 / vec3(params.limits); @@ -519,7 +504,6 @@ void main() { color *= cone_weights[i] * vec4(albedo.rgb, 1.0) * params.dynamic_range; //restore range #ifdef MODE_ANISOTROPIC for (uint j = 0; j < 6; j++) { - accum[j] += max(0.0, dot(accum_dirs[j], direction)) * color.rgb; } #else @@ -594,7 +578,6 @@ void main() { #ifdef MODE_WRITE_TEXTURE { - #ifdef MODE_ANISOTROPIC vec3 accum_total = vec3(0.0); accum_total += outputs.data[cell_index * 6 + 0].rgb; @@ -665,7 +648,6 @@ void main() { vec3 accum = vec3(0.0); for (uint i = 0; i < params.light_count; i++) { - vec3 light; vec3 light_dir; if (!compute_light_at_pos(i, vec3(pos) * params.pos_multiplier, normal, light, light_dir)) { diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl index c0fcb9a8c4..dd347c86a7 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl @@ -28,7 +28,6 @@ layout(set = 0, binding = 5) uniform texture3D aniso_neg_tex; #endif layout(push_constant, binding = 0, std430) uniform Params { - mat4 projection; uint cell_offset; float dynamic_range; @@ -42,7 +41,6 @@ params; layout(location = 0) out vec4 color_interp; void main() { - const vec3 cube_triangles[36] = vec3[]( vec3(-1.0f, -1.0f, -1.0f), vec3(-1.0f, -1.0f, 1.0f), @@ -184,7 +182,6 @@ layout(location = 0) in vec4 color_interp; layout(location = 0) out vec4 frag_color; void main() { - frag_color = color_interp; #ifdef MODE_DEBUG_LIGHT_FULL diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl index d089236723..5e54c8b4de 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl @@ -45,7 +45,6 @@ layout(push_constant, binding = 0, std430) uniform Params { params; void main() { - vec3 pos = vec3(gl_GlobalInvocationID); float closest_dist = 100000.0; diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl index c832223b1e..d0f2703214 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl @@ -84,7 +84,6 @@ output; #ifdef MODE_COMPUTE_LIGHT uint raymarch(float distance, float distance_adv, vec3 from, vec3 direction) { - uint result = NO_CHILDREN; ivec3 size = ivec3(max(max(params.limits.x, params.limits.y), params.limits.z)); @@ -96,12 +95,10 @@ uint raymarch(float distance, float distance_adv, vec3 from, vec3 direction) { ivec3 pos = ivec3(from); if (all(greaterThanEqual(pos, ivec3(0))) && all(lessThan(pos, size))) { - ivec3 ofs = ivec3(0); ivec3 half_size = size / 2; for (int i = 0; i < params.stack_size - 1; i++) { - bvec3 greater = greaterThanEqual(pos, ofs + half_size); ofs += mix(ivec3(0), half_size, greater); @@ -137,14 +134,11 @@ uint raymarch(float distance, float distance_adv, vec3 from, vec3 direction) { } bool compute_light_vector(uint light, uint cell, vec3 pos, out float attenuation, out vec3 light_pos) { - if (lights.data[light].type == LIGHT_TYPE_DIRECTIONAL) { - light_pos = pos - lights.data[light].direction * length(vec3(params.limits)); attenuation = 1.0; } else { - light_pos = lights.data[light].position; float distance = length(pos - light_pos); if (distance >= lights.data[light].radius) { @@ -154,7 +148,6 @@ bool compute_light_vector(uint light, uint cell, vec3 pos, out float attenuation attenuation = pow(clamp(1.0 - distance / lights.data[light].radius, 0.0001, 1.0), lights.data[light].attenuation); if (lights.data[light].type == LIGHT_TYPE_SPOT) { - vec3 rel = normalize(pos - light_pos); float angle = acos(dot(rel, lights.data[light].direction)); if (angle > lights.data[light].spot_angle_radians) { @@ -170,7 +163,6 @@ bool compute_light_vector(uint light, uint cell, vec3 pos, out float attenuation } float get_normal_advance(vec3 p_normal) { - vec3 normal = p_normal; vec3 unorm = abs(normal); @@ -195,7 +187,6 @@ float get_normal_advance(vec3 p_normal) { #endif void main() { - uint cell_index = gl_GlobalInvocationID.x; if (cell_index >= params.cell_count) { return; @@ -220,7 +211,6 @@ void main() { #endif for (uint i = 0; i < params.light_count; i++) { - float attenuation; vec3 light_pos; @@ -237,7 +227,6 @@ void main() { } if (lights.data[i].has_shadow) { - float distance_adv = get_normal_advance(light_dir); distance += distance_adv - mod(distance, distance_adv); //make it reach the center of the box always diff --git a/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl b/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl index 4bf5b7e7f1..979fdb2dc1 100644 --- a/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl +++ b/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl @@ -40,12 +40,10 @@ layout(push_constant, binding = 1, std430) uniform Params { params; void main() { - uint t = gl_LocalInvocationID.y * BLOCK_SIZE + gl_LocalInvocationID.x; ivec2 pos = ivec2(gl_GlobalInvocationID.xy); if (any(lessThan(pos, params.source_size))) { - #ifdef READ_TEXTURE vec3 v = texelFetch(source_texture, pos, 0).rgb; tmp_data[t] = max(v.r, max(v.g, v.b)); diff --git a/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl b/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl index 3637b1abb2..6969a967b9 100644 --- a/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl +++ b/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl @@ -21,7 +21,6 @@ params; #define HALF_PI 1.5707963267948966 void main() { - // Pixel being shaded ivec2 pos = ivec2(gl_GlobalInvocationID.xy); if (any(greaterThan(pos, params.screen_size))) { //too large, do nothing diff --git a/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl b/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl index 90e37b3ec4..86d7ba6f1b 100644 --- a/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl +++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl @@ -75,7 +75,6 @@ layout(location = 8) out float dp_clip; #endif void main() { - instance_index = draw_call.instance_index; vec4 instance_custom = vec4(0.0); #if defined(COLOR_USED) @@ -693,7 +692,6 @@ float quick_hash(vec2 pos) { } float sample_directional_pcf_shadow(texture2D shadow, vec2 shadow_pixel_size, vec4 coord) { - vec2 pos = coord.xy; float depth = coord.z; @@ -720,7 +718,6 @@ float sample_directional_pcf_shadow(texture2D shadow, vec2 shadow_pixel_size, ve } float sample_pcf_shadow(texture2D shadow, vec2 shadow_pixel_size, vec4 coord) { - vec2 pos = coord.xy; float depth = coord.z; @@ -747,7 +744,6 @@ float sample_pcf_shadow(texture2D shadow, vec2 shadow_pixel_size, vec4 coord) { } float sample_directional_soft_shadow(texture2D shadow, vec3 pssm_coord, vec2 tex_scale) { - //find blocker float blocker_count = 0.0; float blocker_average = 0.0; @@ -761,7 +757,6 @@ float sample_directional_soft_shadow(texture2D shadow, vec3 pssm_coord, vec2 tex } for (uint i = 0; i < scene_data.directional_penumbra_shadow_samples; i++) { - vec2 suv = pssm_coord.xy + (disk_rotation * scene_data.directional_penumbra_shadow_kernel[i].xy) * tex_scale; float d = textureLod(sampler2D(shadow, material_samplers[SAMPLER_LINEAR_CLAMP]), suv, 0.0).r; if (d < pssm_coord.z) { @@ -771,7 +766,6 @@ float sample_directional_soft_shadow(texture2D shadow, vec3 pssm_coord, vec2 tex } if (blocker_count > 0.0) { - //blockers found, do soft shadow blocker_average /= blocker_count; float penumbra = (pssm_coord.z - blocker_average) / blocker_average; @@ -829,7 +823,6 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v float size_A = 0.0; if (lights.data[idx].size > 0.0) { - float t = lights.data[idx].size / max(0.001, light_length); size_A = max(0.0, 1.0 - 1 / sqrt(1 + t * t)); } @@ -883,7 +876,6 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v bitangent *= lights.data[idx].soft_shadow_size * lights.data[idx].soft_shadow_scale; for (uint i = 0; i < scene_data.penumbra_shadow_samples; i++) { - vec2 disk = disk_rotation * scene_data.penumbra_shadow_kernel[i].xy; vec3 pos = splane.xyz + tangent * disk.x + bitangent * disk.y; @@ -892,11 +884,9 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v vec4 uv_rect = lights.data[idx].atlas_rect; if (pos.z >= 0.0) { - pos.z += 1.0; uv_rect.y += uv_rect.w; } else { - pos.z = 1.0 - pos.z; } @@ -913,7 +903,6 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v } if (blocker_count > 0.0) { - //blockers found, do soft shadow blocker_average /= blocker_count; float penumbra = (z_norm - blocker_average) / blocker_average; @@ -924,7 +913,6 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v shadow = 0.0; for (uint i = 0; i < scene_data.penumbra_shadow_samples; i++) { - vec2 disk = disk_rotation * scene_data.penumbra_shadow_kernel[i].xy; vec3 pos = splane.xyz + tangent * disk.x + bitangent * disk.y; @@ -932,11 +920,9 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v vec4 uv_rect = lights.data[idx].atlas_rect; if (pos.z >= 0.0) { - pos.z += 1.0; uv_rect.y += uv_rect.w; } else { - pos.z = 1.0 - pos.z; } @@ -954,12 +940,10 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v shadow = 1.0; } } else { - splane.xyz = normalize(splane.xyz); vec4 clamp_rect = lights.data[idx].atlas_rect; if (splane.z >= 0.0) { - splane.z += 1.0; clamp_rect.y += clamp_rect.w; @@ -979,7 +963,6 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v #ifdef LIGHT_TRANSMITTANCE_USED { - vec4 clamp_rect = lights.data[idx].atlas_rect; //redo shadowmapping, but shrink the model a bit to avoid arctifacts @@ -989,11 +972,9 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v splane = normalize(splane.xyz); if (splane.z >= 0.0) { - splane.z += 1.0; } else { - splane.z = 1.0 - splane.z; } @@ -1011,19 +992,16 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v vec3 no_shadow = vec3(1.0); if (lights.data[idx].projector_rect != vec4(0.0)) { - vec3 local_v = (lights.data[idx].shadow_matrix * vec4(vertex, 1.0)).xyz; local_v = normalize(local_v); vec4 atlas_rect = lights.data[idx].projector_rect; if (local_v.z >= 0.0) { - local_v.z += 1.0; atlas_rect.y += atlas_rect.w; } else { - local_v.z = 1.0 - local_v.z; } @@ -1038,10 +1016,8 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v local_v_ddx = normalize(local_v_ddx); if (local_v_ddx.z >= 0.0) { - local_v_ddx.z += 1.0; } else { - local_v_ddx.z = 1.0 - local_v_ddx.z; } @@ -1054,10 +1030,8 @@ void light_process_omni(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v local_v_ddy = normalize(local_v_ddy); if (local_v_ddy.z >= 0.0) { - local_v_ddy.z += 1.0; } else { - local_v_ddy.z = 1.0 - local_v_ddy.z; } @@ -1145,7 +1119,6 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v float size_A = 0.0; if (lights.data[idx].size > 0.0) { - float t = lights.data[idx].size / max(0.001, light_length); size_A = max(0.0, 1.0 - 1 / sqrt(1 + t * t)); } @@ -1202,7 +1175,6 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v float uv_size = lights.data[idx].soft_shadow_size * z_norm * lights.data[idx].soft_shadow_scale; vec2 clamp_max = lights.data[idx].atlas_rect.xy + lights.data[idx].atlas_rect.zw; for (uint i = 0; i < scene_data.penumbra_shadow_samples; i++) { - vec2 suv = shadow_uv + (disk_rotation * scene_data.penumbra_shadow_kernel[i].xy) * uv_size; suv = clamp(suv, lights.data[idx].atlas_rect.xy, clamp_max); float d = textureLod(sampler2D(shadow_atlas, material_samplers[SAMPLER_LINEAR_CLAMP]), suv, 0.0).r; @@ -1213,7 +1185,6 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v } if (blocker_count > 0.0) { - //blockers found, do soft shadow blocker_average /= blocker_count; float penumbra = (z_norm - blocker_average) / blocker_average; @@ -1243,7 +1214,6 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v vec3 no_shadow = vec3(1.0); if (lights.data[idx].projector_rect != vec4(0.0)) { - splane = (lights.data[idx].shadow_matrix * vec4(vertex, 1.0)); splane /= splane.w; @@ -1266,7 +1236,6 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v #ifdef LIGHT_TRANSMITTANCE_USED { - splane = (lights.data[idx].shadow_matrix * vec4(vertex - normalize(normal_interp) * lights.data[idx].transmittance_bias, 1.0)); splane /= splane.w; splane.xy = splane.xy * lights.data[idx].atlas_rect.zw + lights.data[idx].atlas_rect.xy; @@ -1310,7 +1279,6 @@ void light_process_spot(uint idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 v } void reflection_process(uint ref_index, vec3 vertex, vec3 normal, float roughness, vec3 ambient_light, vec3 specular_light, inout vec4 ambient_accum, inout vec4 reflection_accum) { - vec3 box_extents = reflections.data[ref_index].box_extents; vec3 local_pos = (reflections.data[ref_index].local_matrix * vec4(vertex, 1.0)).xyz; @@ -1377,7 +1345,6 @@ void reflection_process(uint ref_index, vec3 vertex, vec3 normal, float roughnes ambient_out.rgb *= ambient_out.a; ambient_accum += ambient_out; } else { - vec4 ambient_out; ambient_out.a = blend; ambient_out.rgb = reflections.data[ref_index].ambient.rgb; @@ -1394,7 +1361,6 @@ void reflection_process(uint ref_index, vec3 vertex, vec3 normal, float roughnes //standard voxel cone trace vec4 voxel_cone_trace(texture3D probe, vec3 cell_size, vec3 pos, vec3 direction, float tan_half_angle, float max_distance, float p_bias) { - float dist = p_bias; vec4 color = vec4(0.0); @@ -1421,7 +1387,6 @@ vec4 voxel_cone_trace(texture3D probe, vec3 cell_size, vec3 pos, vec3 direction, #ifdef GI_PROBE_USE_ANISOTROPY vec4 voxel_cone_trace_anisotropic_45_degrees(texture3D probe, texture3D aniso_pos, texture3D aniso_neg, vec3 normal, vec3 cell_size, vec3 pos, vec3 direction, float tan_half_angle, float max_distance, float p_bias) { - float dist = p_bias; vec4 color = vec4(0.0); float radius = max(0.5, tan_half_angle * dist); @@ -1453,7 +1418,6 @@ vec4 voxel_cone_trace_anisotropic_45_degrees(texture3D probe, texture3D aniso_po #else vec4 voxel_cone_trace_45_degrees(texture3D probe, vec3 cell_size, vec3 pos, vec3 direction, float tan_half_angle, float max_distance, float p_bias) { - float dist = p_bias; vec4 color = vec4(0.0); float radius = max(0.5, tan_half_angle * dist); @@ -1485,7 +1449,6 @@ vec4 voxel_cone_trace_45_degrees(texture3D probe, vec3 cell_size, vec3 pos, vec3 //standard voxel cone trace vec4 voxel_cone_trace_anisotropic(texture3D probe, texture3D aniso_pos, texture3D aniso_neg, vec3 normal, vec3 cell_size, vec3 pos, vec3 direction, float tan_half_angle, float max_distance, float p_bias) { - float dist = p_bias; vec4 color = vec4(0.0); @@ -1516,7 +1479,6 @@ vec4 voxel_cone_trace_anisotropic(texture3D probe, texture3D aniso_pos, texture3 #endif void gi_probe_compute(uint index, vec3 position, vec3 normal, vec3 ref_vec, mat3 normal_xform, float roughness, vec3 ambient, vec3 environment, inout vec4 out_spec, inout vec4 out_diff) { - position = (gi_probes.data[index].xform * vec4(position, 1.0)).xyz; ref_vec = normalize((gi_probes.data[index].xform * vec4(ref_vec, 0.0)).xyz); normal = normalize((gi_probes.data[index].xform * vec4(normal, 0.0)).xyz); @@ -1577,7 +1539,6 @@ void gi_probe_compute(uint index, vec3 position, vec3 normal, vec3 ref_vec, mat3 vec3 light = vec3(0.0); for (int i = 0; i < MAX_CONE_DIRS; i++) { - vec3 dir = normalize((gi_probes.data[index].xform * vec4(normal_xform * cone_dirs[i], 0.0)).xyz); #if defined(GI_PROBE_HIGH_QUALITY) || defined(GI_PROBE_LOW_QUALITY) @@ -1609,7 +1570,6 @@ void gi_probe_compute(uint index, vec3 position, vec3 normal, vec3 ref_vec, mat3 light *= gi_probes.data[index].dynamic_range; if (gi_probes.data[index].ambient_occlusion > 0.001) { - float size = 1.0 + gi_probes.data[index].ambient_occlusion_size * 7.0; float taps, blend; @@ -1650,7 +1610,6 @@ void gi_probe_compute(uint index, vec3 position, vec3 normal, vec3 ref_vec, mat3 #endif //!defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED) void main() { - #ifdef MODE_DUAL_PARABOLOID if (dp_clip > 0.0) @@ -1802,7 +1761,6 @@ FRAGMENT_SHADER_CODE //do outside for performance and avoiding arctifacts for (uint i = 0; i < decal_count; i++) { - uint decal_index = cluster_data.indices[decal_pointer + i]; if (!bool(decals.data[decal_index].mask & instances.data[instance_index].layer_mask)) { continue; //not masked @@ -1831,7 +1789,6 @@ FRAGMENT_SHADER_CODE albedo = mix(albedo, decal_albedo.rgb, decal_albedo.a * decals.data[decal_index].albedo_mix); if (decals.data[decal_index].normal_rect != vec4(0.0)) { - vec3 decal_normal = textureGrad(sampler2D(decal_atlas, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), uv_local.xz * decals.data[decal_index].normal_rect.zw + decals.data[decal_index].normal_rect.xy, ddx * decals.data[decal_index].normal_rect.zw, ddy * decals.data[decal_index].normal_rect.zw).xyz; decal_normal.xy = decal_normal.xy * vec2(2.0, -2.0) - vec2(1.0, -1.0); //users prefer flipped y normal maps in most authoring software decal_normal.z = sqrt(max(0.0, 1.0 - dot(decal_normal.xy, decal_normal.xy))); @@ -1842,7 +1799,6 @@ FRAGMENT_SHADER_CODE } if (decals.data[decal_index].orm_rect != vec4(0.0)) { - vec3 decal_orm = textureGrad(sampler2D(decal_atlas, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), uv_local.xz * decals.data[decal_index].orm_rect.zw + decals.data[decal_index].orm_rect.xy, ddx * decals.data[decal_index].orm_rect.zw, ddy * decals.data[decal_index].orm_rect.zw).xyz; #if defined(AO_USED) ao = mix(ao, decal_orm.r, decal_albedo.a); @@ -1876,7 +1832,6 @@ FRAGMENT_SHADER_CODE } if (scene_data.use_reflection_cubemap) { - vec3 ref_vec = reflect(-view, normal); ref_vec = scene_data.radiance_inverse_xform * ref_vec; #ifdef USE_RADIANCE_CUBEMAP_ARRAY @@ -1896,7 +1851,6 @@ FRAGMENT_SHADER_CODE #ifndef USE_LIGHTMAP //lightmap overrides everything if (scene_data.use_ambient_light) { - ambient_light = scene_data.ambient_light_color_energy.rgb; if (scene_data.use_ambient_cubemap) { @@ -1977,7 +1931,6 @@ FRAGMENT_SHADER_CODE } } else { - ambient_light += textureLod(sampler2DArray(lightmap_textures[ofs], material_samplers[SAMPLER_LINEAR_CLAMP]), uvw, 0.0).rgb; } } @@ -2027,7 +1980,6 @@ FRAGMENT_SHADER_CODE uint reflection_probe_pointer = cluster_cell.z & CLUSTER_POINTER_MASK; for (uint i = 0; i < reflection_probe_count; i++) { - uint ref_index = cluster_data.indices[reflection_probe_pointer + i]; reflection_process(ref_index, vertex, normal, roughness, ambient_light, specular_light, ambient_accum, reflection_accum); } @@ -2044,7 +1996,6 @@ FRAGMENT_SHADER_CODE } { - #if defined(DIFFUSE_TOON) //simplify for toon, as specular_light *= specular * metallic * albedo * 2.0; @@ -2069,7 +2020,6 @@ FRAGMENT_SHADER_CODE { //directional light for (uint i = 0; i < scene_data.directional_light_count; i++) { - if (!bool(directional_lights.data[i].mask & instances.data[instance_index].layer_mask)) { continue; //not masked } @@ -2129,7 +2079,6 @@ FRAGMENT_SHADER_CODE } #endif } else if (depth_z < directional_lights.data[i].shadow_split_offsets.y) { - vec4 v = vec4(vertex, 1.0); BIAS_FUNC(v, 1) @@ -2162,7 +2111,6 @@ FRAGMENT_SHADER_CODE } #endif } else if (depth_z < directional_lights.data[i].shadow_split_offsets.z) { - vec4 v = vec4(vertex, 1.0); BIAS_FUNC(v, 2) @@ -2196,7 +2144,6 @@ FRAGMENT_SHADER_CODE #endif } else { - vec4 v = vec4(vertex, 1.0); BIAS_FUNC(v, 3) @@ -2232,7 +2179,6 @@ FRAGMENT_SHADER_CODE } if (directional_lights.data[i].blend_splits) { - vec3 shadow_color_blend = vec3(0.0); float pssm_blend; float shadow2; @@ -2342,7 +2288,6 @@ FRAGMENT_SHADER_CODE uint omni_light_pointer = cluster_cell.x & CLUSTER_POINTER_MASK; for (uint i = 0; i < omni_light_count; i++) { - uint light_index = cluster_data.indices[omni_light_pointer + i]; if (!bool(lights.data[light_index].mask & instances.data[instance_index].layer_mask)) { @@ -2381,7 +2326,6 @@ FRAGMENT_SHADER_CODE uint spot_light_pointer = cluster_cell.y & CLUSTER_POINTER_MASK; for (uint i = 0; i < spot_light_count; i++) { - uint light_index = cluster_data.indices[spot_light_pointer + i]; if (!bool(lights.data[light_index].mask & instances.data[instance_index].layer_mask)) { diff --git a/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl index 89706b74d6..4c2fb296e6 100644 --- a/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl +++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl @@ -28,7 +28,6 @@ layout(set = 0, binding = 1) uniform sampler material_samplers[12]; layout(set = 0, binding = 2) uniform sampler shadow_sampler; layout(set = 0, binding = 3, std140) uniform SceneData { - mat4 projection_matrix; mat4 inv_projection_matrix; @@ -176,7 +175,6 @@ layout(set = 0, binding = 5, std430) restrict readonly buffer Lights { lights; struct ReflectionData { - vec3 box_extents; float index; vec3 box_offset; diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl index 11a0d85c58..fcde6b9d7a 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl @@ -24,7 +24,6 @@ layout(set = 3, binding = 1) uniform sampler2D source_roughness; #endif layout(push_constant, binding = 2, std430) uniform Params { - vec4 proj_info; ivec2 screen_size; @@ -64,7 +63,6 @@ vec3 reconstructCSPosition(vec2 S, float z) { } void main() { - // Pixel being shaded ivec2 ssC = ivec2(gl_GlobalInvocationID.xy); @@ -156,7 +154,6 @@ void main() { float steps_taken = 0.0; for (int i = 0; i < params.num_steps; i++) { - pos += line_advance; z += z_advance; w += w_advance; @@ -187,7 +184,6 @@ void main() { } if (found) { - float margin_blend = 1.0; vec2 margin = vec2((params.screen_size.x + params.screen_size.y) * 0.5 * 0.05); // make a uniform margin @@ -220,7 +216,6 @@ void main() { float roughness = texelFetch(source_roughness, ssC << 1, 0).r; if (roughness > 0.001) { - float cone_angle = min(roughness, 0.999) * M_PI * 0.5; float cone_len = length(final_pos - line_begin); float op_len = 2.0 * tan(cone_angle) * cone_len; // opposite side of iso triangle diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl index 8571d9d6d1..a4ff2ba815 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl @@ -22,7 +22,6 @@ layout(r8, set = 2, binding = 1) uniform restrict writeonly image2D dest_radius; layout(r32f, set = 3, binding = 0) uniform restrict readonly image2D source_depth; layout(push_constant, binding = 2, std430) uniform Params { - vec4 proj_info; bool orthogonal; @@ -58,7 +57,6 @@ const float gauss_table[GAUSS_TABLE_SIZE + 1] = float[]( ); float gauss_weight(float p_val) { - float idxf; float c = modf(max(0.0, p_val * float(GAUSS_TABLE_SIZE)), idxf); int idx = int(idxf); @@ -80,7 +78,6 @@ vec3 reconstructCSPosition(vec2 S, float z) { } void do_filter(inout vec4 accum, inout float accum_radius, inout float divisor, ivec2 texcoord, ivec2 increment, vec3 p_pos, vec3 normal, float p_limit_radius) { - for (int i = 1; i < params.steps; i++) { float d = float(i * params.increment); ivec2 tc = texcoord + increment * i; @@ -104,7 +101,6 @@ void do_filter(inout vec4 accum, inout float accum_radius, inout float divisor, } if (d < radius) { - float w = gauss_weight(d / radius); accum += imageLoad(source_ssr, tc) * w; #ifndef VERTICAL_PASS @@ -116,7 +112,6 @@ void do_filter(inout vec4 accum, inout float accum_radius, inout float divisor, } void main() { - // Pixel being shaded ivec2 ssC = ivec2(gl_GlobalInvocationID.xy); diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl index f2c3230679..3c6b3748d8 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl @@ -18,7 +18,6 @@ layout(r32f, set = 3, binding = 0) uniform restrict writeonly image2D dest_depth layout(rgba8, set = 3, binding = 1) uniform restrict writeonly image2D dest_normal; layout(push_constant, binding = 1, std430) uniform Params { - ivec2 screen_size; float camera_z_near; float camera_z_far; @@ -30,7 +29,6 @@ layout(push_constant, binding = 1, std430) uniform Params { params; void main() { - // Pixel being shaded ivec2 ssC = ivec2(gl_GlobalInvocationID.xy); @@ -45,13 +43,11 @@ void main() { vec3 normal; if (params.filtered) { - color = vec4(0.0); depth = 0.0; normal = vec3(0.0); for (int i = 0; i < 4; i++) { - ivec2 ofs = ssC << 1; if (bool(i & 1)) { ofs.x += 1; diff --git a/servers/rendering/rasterizer_rd/shaders/sky.glsl b/servers/rendering/rasterizer_rd/shaders/sky.glsl index 536077980d..f8e2257480 100644 --- a/servers/rendering/rasterizer_rd/shaders/sky.glsl +++ b/servers/rendering/rasterizer_rd/shaders/sky.glsl @@ -17,7 +17,6 @@ layout(push_constant, binding = 1, std430) uniform Params { params; void main() { - vec2 base_arr[4] = vec2[](vec2(-1.0, -1.0), vec2(-1.0, 1.0), vec2(1.0, 1.0), vec2(1.0, -1.0)); uv_interp = base_arr[gl_VertexIndex]; gl_Position = vec4(uv_interp, 1.0, 1.0); @@ -120,7 +119,6 @@ FRAGMENT_SHADER_GLOBALS layout(location = 0) out vec4 frag_color; void main() { - vec3 cube_normal; cube_normal.z = -1.0; cube_normal.x = (cube_normal.z * (-uv_interp.x - params.proj.x)) / params.proj.y; diff --git a/servers/rendering/rasterizer_rd/shaders/specular_merge.glsl b/servers/rendering/rasterizer_rd/shaders/specular_merge.glsl index b24f7dccc7..c693ea5abc 100644 --- a/servers/rendering/rasterizer_rd/shaders/specular_merge.glsl +++ b/servers/rendering/rasterizer_rd/shaders/specular_merge.glsl @@ -9,7 +9,6 @@ layout(location = 0) out vec2 uv_interp; /* clang-format on */ void main() { - vec2 base_arr[4] = vec2[](vec2(0.0, 0.0), vec2(0.0, 1.0), vec2(1.0, 1.0), vec2(1.0, 0.0)); uv_interp = base_arr[gl_VertexIndex]; @@ -43,7 +42,6 @@ layout(set = 2, binding = 0) uniform sampler2D diffuse; layout(location = 0) out vec4 frag_color; void main() { - frag_color.rgb = texture(specular, uv_interp).rgb; frag_color.a = 0.0; #ifdef MODE_SSR diff --git a/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl b/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl index 877e5d50fe..642a051ba0 100644 --- a/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl +++ b/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl @@ -46,7 +46,6 @@ const float gaussian[R + 1] = //float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0 void main() { - // Pixel being shaded ivec2 ssC = ivec2(gl_GlobalInvocationID.xy); if (any(greaterThanEqual(ssC, params.screen_size))) { //too large, do nothing @@ -122,7 +121,6 @@ void main() { // We already handled the zero case above. This loop should be unrolled and the static branch optimized out, // so the IF statement has no runtime cost if (r != 0) { - ivec2 ppos = ssC + params.axis * (r * params.filter_scale); float value = texelFetch(source_ssao, clamp(ppos, ivec2(0), clamp_limit), 0).r; ivec2 rpos = clamp(ppos, ivec2(0), clamp_limit); diff --git a/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl b/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl index 8728154347..db50ce1893 100644 --- a/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl +++ b/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl @@ -26,7 +26,6 @@ layout(r32f, set = 0, binding = 0) uniform restrict readonly image2D source_imag layout(r32f, set = 1, binding = 0) uniform restrict writeonly image2D dest_image; void main() { - ivec2 pos = ivec2(gl_GlobalInvocationID.xy); if (any(greaterThan(pos, params.source_size >> 1))) { //too large, do nothing diff --git a/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl b/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl index 4cb486a499..c91ef49c78 100644 --- a/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl +++ b/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl @@ -93,7 +93,6 @@ const vec4 skin_kernel[kernel_size] = vec4[]( #endif //USE_11_SAMPLES layout(push_constant, binding = 1, std430) uniform Params { - ivec2 screen_size; float camera_z_far; float camera_z_near; @@ -113,7 +112,6 @@ layout(rgba16f, set = 1, binding = 0) uniform restrict writeonly image2D dest_im layout(set = 2, binding = 0) uniform sampler2D source_depth; void do_filter(inout vec3 color_accum, inout vec3 divisor, vec2 uv, vec2 step, bool p_skin) { - // Accumulate the other samples: for (int i = 1; i < kernel_size; i++) { // Fetch color and depth for current sample: @@ -138,7 +136,6 @@ void do_filter(inout vec3 color_accum, inout vec3 divisor, vec2 uv, vec2 step, b } void main() { - // Pixel being shaded ivec2 ssC = ivec2(gl_GlobalInvocationID.xy); @@ -153,7 +150,6 @@ void main() { float strength = abs(base_color.a); if (strength > 0.0) { - vec2 dir = params.vertical ? vec2(0.0, 1.0) : vec2(1.0, 0.0); // Fetch linear depth of current pixel: diff --git a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl index a142d263e2..780d961197 100644 --- a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl +++ b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl @@ -9,7 +9,6 @@ layout(location = 0) out vec2 uv_interp; /* clang-format on */ void main() { - vec2 base_arr[4] = vec2[](vec2(0.0, 0.0), vec2(0.0, 1.0), vec2(1.0, 1.0), vec2(1.0, 0.0)); uv_interp = base_arr[gl_VertexIndex]; gl_Position = vec4(uv_interp * 2.0 - 1.0, 0.0, 1.0); @@ -260,7 +259,6 @@ vec3 apply_color_correction(vec3 color, sampler3D correction_tex) { } vec3 do_fxaa(vec3 color, float exposure, vec2 uv_interp) { - const float FXAA_REDUCE_MIN = (1.0 / 128.0); const float FXAA_REDUCE_MUL = (1.0 / 8.0); const float FXAA_SPAN_MAX = 8.0; @@ -320,7 +318,6 @@ void main() { // Early Tonemap & SRGB Conversion if (params.use_glow && params.glow_mode == GLOW_MODE_MIX) { - vec3 glow = gather_glow(source_glow, uv_interp); color.rgb = mix(color.rgb, glow, params.glow_intensity); } @@ -335,7 +332,6 @@ void main() { // Glow if (params.use_glow && params.glow_mode != GLOW_MODE_MIX) { - vec3 glow = gather_glow(source_glow, uv_interp) * params.glow_intensity; // high dynamic range -> SRGB |