libretro / common-shaders

Collection of commonly used Cg shaders. These shaders are usable by either HLSL and/or Cg runtime compilers. The cg2glsl script will translate most of these into GLSL shaders.
http://www.libretro.com
1.05k stars 250 forks source link

About [tex2dblurNxNshared] function in [blur-functions.h] #72

Closed kingeric1992 closed 8 years ago

kingeric1992 commented 8 years ago

Accroding the reference document, and ddx, ddy gradient, if using tex2Dblur12x12shared as example, with the quad layout (mirrored offset)

8a 7a 6a 6b 7b 8b
5a 4a 3a 3b 4b 5b
2a 1a 0a 0b 1b 2b
2c 1c 0c 0d 1d 2d
5c 4c 3c 3d 4d 5d
8c 7c 6c 6d 7d 8d

the quad vector for gathering should be

    quad_gather(quad_vector * sample1_texel_offset * pow(2, 1-tex_uv.w), sample1curr, sample1adjx, sample1adjy, sample1diag);
    quad_gather(quad_vector * sample2_texel_offset * pow(2, 1-tex_uv.w), sample2curr, sample2adjx, sample2adjy, sample2diag);
   ...and so on

otherwise the weighting and estimated sample doesn't match up.

hizzlekizzle commented 8 years ago

If you want to make a PR to fix it (preferably with a couple of screenshots to compare before/after), I'll merge it.

kingeric1992 commented 8 years ago

Scrap it, I misunderstood the meaning...

hizzlekizzle commented 8 years ago

k, no worries!