Skip to content

Commit

Permalink
shaders/sampling: don't use polar compute for high radius
Browse files Browse the repository at this point in the history
After a certain input size, the gather kernel pulls ahead. This is
either due to interactions with the size of the texture cache, or due to
alignment with the 2x2 gather input grid, or both.

Regardless, this should generally speed things up for very high radius
polar kernels (especially when downscaling).
  • Loading branch information
haasn committed Mar 5, 2024
1 parent 989a436 commit f56faa4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/shaders/sampling.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,11 @@ bool pl_shader_sample_polar(pl_shader sh, const struct pl_sample_src *src,
int bw = 32, bh = sh_glsl(sh).max_group_threads / bw;
int sizew, sizeh, iw, ih;

// Disable compute shaders after a (hard-coded) radius of 6, since the
// gather kernel generally pulls ahead here.
bool is_compute = !params->no_compute && sh_glsl(sh).compute;
is_compute &= obj->filter->radius < 6.0;

while (is_compute) {
// We need to sample everything from base_min to base_max, so make sure
// we have enough room in shmem. The extra margin on the ceilf guards
Expand Down

0 comments on commit f56faa4

Please sign in to comment.