Skip to content

Commit

Permalink
vo_gpu: add HOOKED_gather
Browse files Browse the repository at this point in the history
Can be used conditionally (via #ifdef HOOKED_gather) to use
textureGather in custom shaders.
  • Loading branch information
haasn committed Jan 15, 2022
1 parent eca78ee commit 1ba0547
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions video/out/gpu/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,11 @@ static void hook_prelude(struct gl_video *p, const char *name, int id,
GLSLHF("#define %s_tex(pos) (%s_mul * vec4(texture(%s_raw, pos)).%s)\n",
name, name, name, crap);

if (p->ra->caps & RA_CAP_GATHER) {
GLSLHF("#define %s_gather(pos, c) (%s_mul * vec4("
"textureGather(%s_raw, pos, c)))\n", name, name, name);
}

// Since the extra matrix multiplication impacts performance,
// skip it unless the texture was actually rotated
if (gl_transform_eq(img.transform, identity_trans)) {
Expand Down

0 comments on commit 1ba0547

Please sign in to comment.