mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
[422/906] convolution: reduce the number of register used
Reduce the number of register calculating texture lookup offset on the fly. It was just a simple sequence, no need to store it in a array. Fixes maximum number of registers exceeded error with i915. Still exceed maximum indirect texture lookups and maximum ALU instructions. Maybe we should gave up some blur goodness and use lightly more little kernels.
This commit is contained in:
parent
a3454365fc
commit
e602d818e3
1 changed files with 6 additions and 22 deletions
|
@ -282,21 +282,13 @@ const gchar *hconv9_fragment_source =
|
|||
"void main () {"
|
||||
/* "float offset[9] = float[9] (-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0);" */
|
||||
/* don't use array constructor so we don't have to depend on #version 120 */
|
||||
" float offset[9];"
|
||||
" offset[0] = -4.0;"
|
||||
" offset[1] = -3.0;"
|
||||
" offset[2] = -2.0;"
|
||||
" offset[3] = -1.0;"
|
||||
" offset[4] = 0.0;"
|
||||
" offset[5] = 1.0;"
|
||||
" offset[6] = 2.0;"
|
||||
" offset[7] = 3.0;"
|
||||
" offset[8] = 4.0;"
|
||||
" float offset = - 4.0;"
|
||||
" vec2 texturecoord = gl_TexCoord[0].st;"
|
||||
" int i;"
|
||||
" vec4 sum = vec4 (0.0);"
|
||||
" for (i = 0; i < 9; i++) { "
|
||||
" vec4 neighbor = texture2DRect(tex, vec2(texturecoord.s+offset[i], texturecoord.t)); "
|
||||
" ++offset;"
|
||||
" vec4 neighbor = texture2DRect(tex, vec2(texturecoord.s+offset, texturecoord.t)); "
|
||||
" sum += neighbor * kernel[i]/norm_const; "
|
||||
" }"
|
||||
" gl_FragColor = sum + norm_offset;"
|
||||
|
@ -312,21 +304,13 @@ const gchar *vconv9_fragment_source =
|
|||
"void main () {"
|
||||
/* "float offset[9] = float[9] (-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0);" */
|
||||
/* don't use array constructor so we don't have to depend on #version 120 */
|
||||
" float offset[9];"
|
||||
" offset[0] = -4.0;"
|
||||
" offset[1] = -3.0;"
|
||||
" offset[2] = -2.0;"
|
||||
" offset[3] = -1.0;"
|
||||
" offset[4] = 0.0;"
|
||||
" offset[5] = 1.0;"
|
||||
" offset[6] = 2.0;"
|
||||
" offset[7] = 3.0;"
|
||||
" offset[8] = 4.0;"
|
||||
" float offset = - 4.0;"
|
||||
" vec2 texturecoord = gl_TexCoord[0].st;"
|
||||
" int i;"
|
||||
" vec4 sum = vec4 (0.0);"
|
||||
" for (i = 0; i < 9; i++) { "
|
||||
" vec4 neighbor = texture2DRect(tex, vec2(texturecoord.s, texturecoord.t+offset[i])); "
|
||||
" ++offset;"
|
||||
" vec4 neighbor = texture2DRect(tex, vec2(texturecoord.s, texturecoord.t+offset)); "
|
||||
" sum += neighbor * kernel[i]/norm_const; "
|
||||
" }"
|
||||
" gl_FragColor = sum + norm_offset;"
|
||||
|
|
Loading…
Reference in a new issue