Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Issue 2025703002: Pack repeated code in tex(Sub)Image2D and texSubImage3D into helper func (Closed)

Created:
4 years, 6 months ago by xidachen
Modified:
4 years, 6 months ago
CC:
chromium-reviews, blink-reviews, haraken
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Pack repeated code in tex(Sub)Image2D and texSubImage3D into helper func There are some repeated code in these functions and the only diff amongest them is whether it gives "texImage2D" or "texSubImage2D" or "texSubImage3D". This CL packs the repeated part into helper function. After this, when we make changes to these functions in the future, we would only need to change one place instead of 3 places. Also, this will reduce potential bugs in the code. For example, at this moment, line 4131 in WebGLRenderingContextBase.cpp (texImage2D) does this: if (imageForRender && imageForRender->isSVGImage()) while line 1095 in WebGL2RenderingContextBase.cpp (texSubImage3D) does: if (imageForRender->isSVGImage()) which doesn't do a null check on imageForRender. This change can certainly prevent bugs like this. For this change, we just need to make sure that all bots are green. CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel Committed: https://crrev.com/11401539431e6ff15901f90f4d1e87033dc77ba5 Cr-Commit-Position: refs/heads/master@{#398286}

Patch Set 1 #

Patch Set 2 : tests should pass #

Patch Set 3 : more tex2d vs tex3d cases clean up #

Total comments: 1

Patch Set 4 : make validateTexture3DBinding pure virtual in WebGLBase #

Total comments: 4

Patch Set 5 : pass enum instead of const char*, use a wrapper for validate2D(3D)Binding #

Total comments: 4

Patch Set 6 : should have no error, but needs more clean up #

Patch Set 7 : fix error for PS6, needs more clean up #

Patch Set 8 : texImage2DImpl + texSubImage2DImpl + texSubImage3DImpl = texImageImpl #

Patch Set 9 : all done, hand to bots #

Total comments: 10

Patch Set 10 : address comments #

Patch Set 11 : forgot a DCHECK #

Total comments: 1

Patch Set 12 : address comments #

Patch Set 13 : add a default case to prevent compile error #

Unified diffs Side-by-side diffs Delta from patch set Stats (+283 lines, -460 lines) Patch
M third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +14 lines, -188 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +23 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 9 chunks +245 lines, -266 lines 0 comments Download

Messages

Total messages: 32 (11 generated)
xidachen
PTAL.
4 years, 6 months ago (2016-05-30 17:30:33 UTC) #4
Zhenyao Mo
On 2016/05/30 17:30:33, xidachen wrote: > PTAL. This doesn't compile...
4 years, 6 months ago (2016-05-31 02:07:57 UTC) #5
xidachen
https://codereview.chromium.org/2025703002/diff/40001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/2025703002/diff/40001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode4062 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:4062: if ((!strcmp(funcType, "texImage3D") || !strcmp(funcType, "texSubImage3D")) && !validateTexture3DBinding(funcType, target)) ...
4 years, 6 months ago (2016-05-31 02:11:41 UTC) #6
Zhenyao Mo
https://codereview.chromium.org/2025703002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/2025703002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode4054 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:4054: void WebGLRenderingContextBase::texImageHelperDOMArrayBufferView(const char* funcType, GLenum target, GLint level, GLint ...
4 years, 6 months ago (2016-05-31 16:37:33 UTC) #7
xidachen
https://codereview.chromium.org/2025703002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/2025703002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode4072 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:4072: if (!strcmp(funcType, "texImage2D") || !strcmp(funcType, "texSubImage2D")) On 2016/05/31 16:37:33, ...
4 years, 6 months ago (2016-05-31 17:15:43 UTC) #8
Zhenyao Mo
On 2016/05/31 17:15:43, xidachen wrote: > https://codereview.chromium.org/2025703002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp > File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp > (right): > > https://codereview.chromium.org/2025703002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode4072 ...
4 years, 6 months ago (2016-05-31 17:16:34 UTC) #9
Ken Russell (switch to Gerrit)
Thanks for thinking about this and working on sharing more code. There are some aspects ...
4 years, 6 months ago (2016-06-01 00:34:03 UTC) #10
xidachen
https://codereview.chromium.org/2025703002/diff/80001/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp (right): https://codereview.chromium.org/2025703002/diff/80001/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp#newcode1016 third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp:1016: bool succeed = texImageHelperHTMLImageElement(TexSubImage3D, target, level, 0, format, type, ...
4 years, 6 months ago (2016-06-01 19:59:15 UTC) #11
Ken Russell (switch to Gerrit)
https://codereview.chromium.org/2025703002/diff/80001/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp (right): https://codereview.chromium.org/2025703002/diff/80001/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp#newcode1016 third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp:1016: bool succeed = texImageHelperHTMLImageElement(TexSubImage3D, target, level, 0, format, type, ...
4 years, 6 months ago (2016-06-02 00:58:50 UTC) #12
xidachen
PTAL. Right now all the tex(Sub)Image2D(3D) calls its own helper function and nothing more.
4 years, 6 months ago (2016-06-02 21:37:15 UTC) #13
Zhenyao Mo
lgtm with some minor suggestions. but let kbr takes a final look. https://codereview.chromium.org/2025703002/diff/160001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp ...
4 years, 6 months ago (2016-06-03 17:49:51 UTC) #14
xidachen
https://codereview.chromium.org/2025703002/diff/160001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/2025703002/diff/160001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode4083 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:4083: if (!validateTexImageBinding(funcName, functionName, target)) On 2016/06/03 17:49:51, Zhenyao Mo ...
4 years, 6 months ago (2016-06-03 18:28:30 UTC) #15
xidachen
kbr@: as suggested by zmo@, could you take a final look?
4 years, 6 months ago (2016-06-06 15:42:33 UTC) #16
Ken Russell (switch to Gerrit)
Very nice Xida. Thanks for persisting with this refactoring. I didn't have time to compare ...
4 years, 6 months ago (2016-06-07 04:06:53 UTC) #17
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2025703002/220001
4 years, 6 months ago (2016-06-07 11:17:35 UTC) #19
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: chromeos_amd64-generic_chromium_compile_only_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-generic_chromium_compile_only_ng/builds/149036)
4 years, 6 months ago (2016-06-07 11:28:38 UTC) #21
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2025703002/240001
4 years, 6 months ago (2016-06-07 11:56:17 UTC) #23
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 6 months ago (2016-06-07 13:12:59 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2025703002/240001
4 years, 6 months ago (2016-06-07 13:13:56 UTC) #28
commit-bot: I haz the power
Committed patchset #13 (id:240001)
4 years, 6 months ago (2016-06-07 13:17:22 UTC) #30
commit-bot: I haz the power
4 years, 6 months ago (2016-06-07 13:19:05 UTC) #32
Message was sent while issue was closed.
Patchset 13 (id:??) landed as
https://crrev.com/11401539431e6ff15901f90f4d1e87033dc77ba5
Cr-Commit-Position: refs/heads/master@{#398286}

Powered by Google App Engine
This is Rietveld 408576698