diff options
Diffstat (limited to 'modules/lightmapper_rd/lm_compute.glsl')
-rw-r--r-- | modules/lightmapper_rd/lm_compute.glsl | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/modules/lightmapper_rd/lm_compute.glsl b/modules/lightmapper_rd/lm_compute.glsl index a2a480043a..1d088450e9 100644 --- a/modules/lightmapper_rd/lm_compute.glsl +++ b/modules/lightmapper_rd/lm_compute.glsl @@ -13,6 +13,8 @@ denoise = "#define MODE_DENOISE"; #VERSION_DEFINES +#extension GL_EXT_samplerless_texture_functions : enable + // One 2D local group focusing in one layer at a time, though all // in parallel (no barriers) makes more sense than a 3D local group // as this can take more advantage of the cache for each group. @@ -152,7 +154,7 @@ uint trace_ray(vec3 p_from, vec3 p_to, bool p_any_hit, out float r_distance, out uint iters = 0; while (all(greaterThanEqual(icell, ivec3(0))) && all(lessThan(icell, ivec3(bake_params.grid_size))) && (iters < 1000)) { - uvec2 cell_data = texelFetch(usampler3D(grid, linear_sampler), icell, 0).xy; + uvec2 cell_data = texelFetch(grid, icell, 0).xy; uint triangle_count = cell_data.x; if (triangle_count > 0) { uint hit = RAY_MISS; @@ -264,7 +266,16 @@ uint trace_ray(vec3 p_from, vec3 p_to, bool p_any_hit, out float r_distance, out break; } - bvec3 mask = lessThanEqual(side.xyz, min(side.yzx, side.zxy)); + // There should be only one axis updated at a time for DDA to work properly. + bvec3 mask = bvec3(true, false, false); + float m = side.x; + if (side.y < m) { + m = side.y; + mask = bvec3(false, true, false); + } + if (side.z < m) { + mask = bvec3(false, false, true); + } side += vec3(mask) * delta; icell += ivec3(vec3(mask)) * step; iters++; |