Merge pull request #55422 from Calinou/gi-shader-remove-unused-define

Remove unused code in GI shaders
This commit is contained in:
Rémi Verschelde 2022-01-04 09:49:42 +01:00 committed by GitHub
commit a97889abe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 61 deletions

View File

@ -7,7 +7,6 @@
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
#define NO_CHILDREN 0xFFFFFFFF
#define GREY_VEC vec3(0.33333, 0.33333, 0.33333)
struct CellChildren {
uint children[8];

View File

@ -13,7 +13,6 @@ layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
#ifndef MODE_DYNAMIC
#define NO_CHILDREN 0xFFFFFFFF
#define GREY_VEC vec3(0.33333, 0.33333, 0.33333)
struct CellChildren {
uint children[8];

View File

@ -90,66 +90,10 @@ void main() {
#endif
#ifdef MODE_DEBUG_LIGHT
#ifdef USE_ANISOTROPY
#define POS_X 0
#define POS_Y 1
#define POS_Z 2
#define NEG_X 3
#define NEG_Y 4
#define NEG_Z 5
const uint triangle_aniso[12] = uint[](
NEG_X,
NEG_Z,
NEG_Y,
NEG_Z,
NEG_X,
NEG_Y,
POS_Z,
POS_X,
POS_X,
POS_Y,
POS_Y,
POS_Z);
color_interp.xyz = texelFetch(sampler3D(color_tex, tex_sampler), ivec3(posu), int(params.level)).xyz * params.dynamic_range;
vec3 aniso_pos = texelFetch(sampler3D(aniso_pos_tex, tex_sampler), ivec3(posu), int(params.level)).xyz;
vec3 aniso_neg = texelFetch(sampler3D(aniso_neg_tex, tex_sampler), ivec3(posu), int(params.level)).xyz;
uint side = triangle_aniso[gl_VertexIndex / 3];
float strength = 0.0;
switch (side) {
case POS_X:
strength = aniso_pos.x;
break;
case POS_Y:
strength = aniso_pos.y;
break;
case POS_Z:
strength = aniso_pos.z;
break;
case NEG_X:
strength = aniso_neg.x;
break;
case NEG_Y:
strength = aniso_neg.y;
break;
case NEG_Z:
strength = aniso_neg.z;
break;
}
color_interp.xyz *= strength;
#else
color_interp = texelFetch(sampler3D(color_tex, tex_sampler), ivec3(posu), int(params.level));
color_interp.xyz *params.dynamic_range;
#endif
#endif
float scale = (1 << params.level);
gl_Position = params.projection * vec4((vec3(posu) + vertex) * scale, 1.0);

View File

@ -6,10 +6,9 @@
layout(local_size_x = 4, local_size_y = 4, local_size_z = 4) in;
#define MAX_DISTANCE 100000
#define MAX_DISTANCE 100000.0
#define NO_CHILDREN 0xFFFFFFFF
#define GREY_VEC vec3(0.33333, 0.33333, 0.33333)
struct CellChildren {
uint children[8];
@ -44,7 +43,7 @@ params;
void main() {
vec3 pos = vec3(gl_GlobalInvocationID);
float closest_dist = 100000.0;
float closest_dist = MAX_DISTANCE;
for (uint i = params.offset; i < params.end; i++) {
vec3 posu = vec3(uvec3(cell_data.data[i].position & 0x7FF, (cell_data.data[i].position >> 11) & 0x3FF, cell_data.data[i].position >> 21));