RESOLVED FIXED 89277
[Texmap] Share gaussian formula between shaders in TextureMapperShaderManager.
https://bugs.webkit.org/show_bug.cgi?id=89277
Summary [Texmap] Share gaussian formula between shaders in TextureMapperShaderManager.
Dongseong Hwang
Reported 2012-06-16 01:06:01 PDT
Remove "FIXME : share gaussian formula between shaders" in TextureMapperShaderManager. Moreover, this patch can increase performance, because it calculates gaussian kernel only one time.
Attachments
patch v.1 (12.09 KB, patch)
2012-06-16 01:08 PDT, Dongseong Hwang
noam: review-
noam: commit-queue-
patch v.2 (12.74 KB, patch)
2012-06-16 19:17 PDT, Dongseong Hwang
noam: review+
noam: commit-queue-
patch v.3 (12.71 KB, patch)
2012-06-16 20:25 PDT, Dongseong Hwang
no flags
Dongseong Hwang
Comment 1 2012-06-16 01:08:09 PDT
Created attachment 147958 [details] patch v.1
Dongseong Hwang
Comment 2 2012-06-16 01:09:59 PDT
Comment on attachment 147958 [details] patch v.1 View in context: https://bugs.webkit.org/attachment.cgi?id=147958&action=review > Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp:43 > + STRINGIFY_VAL(src) It is needless, but I amended it for symmetric with FRAGMENT_SHADER.
Dongseong Hwang
Comment 3 2012-06-16 06:49:52 PDT
Comment on attachment 147958 [details] patch v.1 View in context: https://bugs.webkit.org/attachment.cgi?id=147958&action=review > Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp:46 > + STRINGIFY_VAL(src) I add STRINGIFY_VAL in order to use macro in shader code, especially GAUSSIAN_KERNEL_HALF_WIDTH and GAUSSIAN_KERNEL_STEP.
Noam Rosenthal
Comment 4 2012-06-16 07:03:14 PDT
Comment on attachment 147958 [details] patch v.1 View in context: https://bugs.webkit.org/attachment.cgi?id=147958&action=review > Source/WebCore/ChangeLog:8 > + [Texmap] Share gaussian formula between shaders in TextureMapperShaderManager. > + https://bugs.webkit.org/show_bug.cgi?id=89277 > + > + Reviewed by NOBODY (OOPS!). > + > + No new tests. This patch doesn't change behavior. You're doing a lot more than that, actually moving to a more accurate gaussian blur... I like that, but please describe in the Changelog. > Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp:672 > + } > + // Normalize the kernel Extra line > Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp:678 > + } > + return kernel; Extra line
Dongseong Hwang
Comment 5 2012-06-16 19:17:12 PDT
Created attachment 148000 [details] patch v.2
Dongseong Hwang
Comment 6 2012-06-16 19:18:48 PDT
I'm glad because you like this. :)
Noam Rosenthal
Comment 7 2012-06-16 19:25:25 PDT
Comment on attachment 148000 [details] patch v.2 View in context: https://bugs.webkit.org/attachment.cgi?id=148000&action=review Awesome! Please fix nit-picks before committing. > Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp:658 > + return exp(- (x * x) / 2.f); Remove space between - and ( Use 2. instead of 2.f > Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp:678 > + if (!prepared) { > + kernel[0] = gauss(0); > + float sum = kernel[0]; > + for (unsigned i = 1; i < GAUSSIAN_KERNEL_HALF_WIDTH; ++i) { > + kernel[i] = gauss(i * GAUSSIAN_KERNEL_STEP); > + sum += 2 * kernel[i]; > + } > + > + // Normalize the kernel > + float scale = 1 / sum; > + for (unsigned i = 0; i < GAUSSIAN_KERNEL_HALF_WIDTH; ++i) > + kernel[i] *= scale; > + prepared = true; > + } Better to do if (prepared) return kernel;
Dongseong Hwang
Comment 8 2012-06-16 20:25:19 PDT
Created attachment 148004 [details] patch v.3 Good advice.
WebKit Review Bot
Comment 9 2012-06-16 21:42:35 PDT
Comment on attachment 148004 [details] patch v.3 Clearing flags on attachment: 148004 Committed r120545: <http://trac.webkit.org/changeset/120545>
WebKit Review Bot
Comment 10 2012-06-16 21:42:39 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.