|
|
Created:
5 years, 2 months ago by r.kasibhatla Modified:
5 years, 1 month ago Reviewers:
Ken Russell (switch to Gerrit), bajones, Sami, bsalomon_chromium, piman, RaviKasibhatla, Zhenyao Mo, vmiura CC:
asanka, benjhayden+dwatch_chromium.org, chromium-reviews, piman+watch_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionAdd missing break in switch-case statements in gles2_cmd_decoder
GL_STENCIL_BUFFER_BIT bit is enabled whenever GL_DEPTH_EXT attachment is
requested on backbuffer_needs_clear_bits_ in DoDiscardFramebufferEXT() -
irrespective of whether GL_STENCIL_EXT attachment is actually requested or not.
BUG=None
TEST=gpu_unittests --gtest_filter=*GLES2DecoderManualInitTest.ClearBackbufferBitsOnDiscardFramebufferEXT*
Committed: https://crrev.com/411eecbfe40524f5f62dee1662cde665d12dfaf9
Cr-Commit-Position: refs/heads/master@{#359838}
Patch Set 1 #Patch Set 2 : Added unit test for checking clearing of backbuffer bits! #
Total comments: 4
Patch Set 3 : Reworked as per comments! #Patch Set 4 : #Patch Set 5 : Rebased to ToT! #
Total comments: 3
Patch Set 6 : Patch for landing after addressing nits! #Patch Set 7 : Changes to go through the clang compiler error! #
Messages
Total messages: 45 (15 generated)
kphanee@chromium.org changed reviewers: + bsalomon@chromium.org, skyostil@chromium.org, zmo@chromium.org
kphanee@chromium.org changed reviewers: + kphanee@chromium.org
PTAL. I noticed that there is no separate unittest for clearing the bits of GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT individually. Rather the present unittests clears all 3 bits together. There is no unittest for fetching Renderbuffer param ofGL_RENDERBUFFER_SAMPLES_EXT. Should I add unittests (with this CL) for these cases which will fail without the change of this CL?
Wow, good find. If it's not too much trouble I'd suggest splitting the unit test into three separate cases to catch this type of stuff.
On 2015/10/06 15:13:01, Sami wrote: > Wow, good find. If it's not too much trouble I'd suggest splitting the unit test > into three separate cases to catch this type of stuff. Thanks for catching these bugs! As Sami suggested, can you add tests for them?
On 2015/10/06 20:58:59, Zhenyao Mo wrote: > On 2015/10/06 15:13:01, Sami wrote: > > Wow, good find. If it's not too much trouble I'd suggest splitting the unit > test > > into three separate cases to catch this type of stuff. > > Thanks for catching these bugs! > > As Sami suggested, can you add tests for them? @zmo/@sami: Currently there are no unit tests which captures the backbuffer_needs_clear_bits_ behavior. We have the unit test for checking the drawing on back buffer impl (GLES2DecoderTest::DrawBuffersEXTImmediateBackbuffer) or discard buffer impl (GLES2DecoderManualInitTest::DiscardFramebufferEXT). DiscardFramebufferEXT unit test uses only GL_COLOR_EXT attachment value. However, that test also doesn't verify the behavior of clear bits mask. I tried few things (ex. adding EXPECT_CALL of glClearColor, glClearDepth or glClearStencil when the corresponding clear bit mask is set) but it didn't work. I also tried the approach to call CheckFramebufferValid() where we actually use this clear bits flag. But, I couldn't do any verification with the API. Also, in that API we are always clearing depth and stencil values irrespective of whether those clear bits are set or not. Is that expected behavior i.e. checking only for Color mask? I was wondering how should I approach verifying the behavior of the clear bits mask? I was thinking about exposing an API which returns the value of the mask which I can utilize in the unit test (ex. EXPECT_EQ(GL_COLOR_BUFFER_BIT, BoundBackbufferClearBits() & GL_COLOR_EXT) or EXPECT_EQ(GL_DEPTH_BUFFER_BIT, BoundBackbufferClearBits() & GL_DEPTH_EXT). Is there other way to verify the behavior (ex. calling some gl get calls) to check which bits are set? Please suggest me the correct approach.
On 2015/10/09 13:29:09, RaviKasibhatla wrote: > DiscardFramebufferEXT unit test uses only GL_COLOR_EXT attachment value. > However, that test also doesn't verify the behavior of clear bits mask. > I tried few things (ex. adding EXPECT_CALL of glClearColor, glClearDepth or > glClearStencil when the corresponding clear bit mask is set) but it didn't work. This seems like the most straightforward approach. Why doesn't EXPECT_CALL work for this?
On 2015/10/12 10:59:23, Sami wrote: > On 2015/10/09 13:29:09, RaviKasibhatla wrote: > > DiscardFramebufferEXT unit test uses only GL_COLOR_EXT attachment value. > > However, that test also doesn't verify the behavior of clear bits mask. > > I tried few things (ex. adding EXPECT_CALL of glClearColor, glClearDepth or > > glClearStencil when the corresponding clear bit mask is set) but it didn't > work. > > This seems like the most straightforward approach. Why doesn't EXPECT_CALL work > for this? The clear bits mask variable "backbuffer_needs_clear_bits_" is updated inside GLES2DecoderImpl::DoDiscardFramebufferEXT(). The clear bits mask variable is used only in GLES2DecoderImpl::CheckFramebufferValid() - if mask present, only then call glClear(backbuffer_needs_clear_bits_) is made. After the mask is set, as there is no call to CheckFramebufferValid in the added unit test - hence EXPECT_CALL fails. The only way AFAIK is either to expose the value backbuffer_needs_clear_bits_ into unit test or probably plumb a way to call CheckFramebufferValid so that glClear() is invoked immediately. WDYT?
On 2015/10/12 11:28:07, RaviKasibhatla wrote: > The clear bits mask variable "backbuffer_needs_clear_bits_" is updated inside > GLES2DecoderImpl::DoDiscardFramebufferEXT(). > The clear bits mask variable is used only in > GLES2DecoderImpl::CheckFramebufferValid() - if mask present, only then call > glClear(backbuffer_needs_clear_bits_) is made. > After the mask is set, as there is no call to CheckFramebufferValid in the added > unit test - hence EXPECT_CALL fails. > > The only way AFAIK is either to expose the value backbuffer_needs_clear_bits_ > into unit test or probably plumb a way to call CheckFramebufferValid so that > glClear() is invoked immediately. WDYT? Could you just call something like DoClear() which will check framebuffer validity as a side effect?
On 2015/10/12 11:33:03, Sami wrote: > On 2015/10/12 11:28:07, RaviKasibhatla wrote: > > The clear bits mask variable "backbuffer_needs_clear_bits_" is updated inside > > GLES2DecoderImpl::DoDiscardFramebufferEXT(). > > The clear bits mask variable is used only in > > GLES2DecoderImpl::CheckFramebufferValid() - if mask present, only then call > > glClear(backbuffer_needs_clear_bits_) is made. > > After the mask is set, as there is no call to CheckFramebufferValid in the > added > > unit test - hence EXPECT_CALL fails. > > > > The only way AFAIK is either to expose the value backbuffer_needs_clear_bits_ > > into unit test or probably plumb a way to call CheckFramebufferValid so that > > glClear() is invoked immediately. WDYT? > > Could you just call something like DoClear() which will check framebuffer > validity as a side effect? @Sami/Zho, Sorry for late response. I was busy with some other work and couldn't upload reworked patch soon. As suggested by Sami I tried few approaches including calling DoClear (using ClearCmd) but I was not able to get a proper working unittest. I believe the reason partly to be the manner in which backbuffer_needs_clear_bits_ is used for invoking glClear() inside GLES2DecoderImpl::CheckFramebufferValid(). The usage of the variable is under specific condition - there is no frame_buffer however there it is not surfaceless. I am not sure if we are able to stimulate the conditions properly - I will give it one more shot but not sure of the result. However, please note that: Inside GLES2DecoderImpl::CheckFramebufferValid(), there is no check of the bits set in backbuffer_needs_clear_bits_ variable. All the calls of glClearDepth, glClearStencil and glClearColor are invoked directly without any check whether that bit is set or not. I think we should first fix the code inside CheckFramebufferValid() for clearing the bits and then add/update the test using ClearCmd to ensure the code is running as expected.
On 2015/10/30 07:41:10, RaviKasibhatla wrote: > On 2015/10/12 11:33:03, Sami wrote: > > On 2015/10/12 11:28:07, RaviKasibhatla wrote: > > > The clear bits mask variable "backbuffer_needs_clear_bits_" is updated > inside > > > GLES2DecoderImpl::DoDiscardFramebufferEXT(). > > > The clear bits mask variable is used only in > > > GLES2DecoderImpl::CheckFramebufferValid() - if mask present, only then call > > > glClear(backbuffer_needs_clear_bits_) is made. > > > After the mask is set, as there is no call to CheckFramebufferValid in the > > added > > > unit test - hence EXPECT_CALL fails. > > > > > > The only way AFAIK is either to expose the value > backbuffer_needs_clear_bits_ > > > into unit test or probably plumb a way to call CheckFramebufferValid so that > > > glClear() is invoked immediately. WDYT? > > > > Could you just call something like DoClear() which will check framebuffer > > validity as a side effect? > > @Sami/Zho, > Sorry for late response. I was busy with some other work and couldn't upload > reworked patch soon. > > As suggested by Sami I tried few approaches including calling DoClear (using > ClearCmd) but I was not able to get a proper working unittest. > I believe the reason partly to be the manner in which > backbuffer_needs_clear_bits_ is used for invoking glClear() inside > GLES2DecoderImpl::CheckFramebufferValid(). > The usage of the variable is under specific condition - there is no frame_buffer > however there it is not surfaceless. > I am not sure if we are able to stimulate the conditions properly - I will give > it one more shot but not sure of the result. > > However, please note that: Inside GLES2DecoderImpl::CheckFramebufferValid(), > there is no check of the bits set in backbuffer_needs_clear_bits_ variable. > All the calls of glClearDepth, glClearStencil and glClearColor are invoked > directly without any check whether that bit is set or not. > I think we should first fix the code inside CheckFramebufferValid() for clearing > the bits and then add/update the test using ClearCmd to ensure the code is > running as expected. @sami/zmo: Thoughts on the patch?
Thanks for adding the test. I think the patch looks good -- just a few nits. I'll leave it to zmo@ to approve for real. https://codereview.chromium.org/1387143003/diff/20001/gpu/command_buffer/serv... File gpu/command_buffer/service/gles2_cmd_decoder.h (right): https://codereview.chromium.org/1387143003/diff/20001/gpu/command_buffer/serv... gpu/command_buffer/service/gles2_cmd_decoder.h:250: virtual uint32 GetBackbufferClearBits() { return 0; } Please add the "ForTest" suffix for these to make it clearer that these are test-only. Could also move them next to the existing test methods. Also I think I'd combine these into a single GetAndClearBackbufferClearBitsForTest() method. https://codereview.chromium.org/1387143003/diff/20001/gpu/command_buffer/serv... File gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc (right): https://codereview.chromium.org/1387143003/diff/20001/gpu/command_buffer/serv... gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc:2524: // EXPECT_EQ can't be used to compare function pointers nit: append a full stop.
Thanks for the comments. I have updated the patch as per your comments. PTAL. https://codereview.chromium.org/1387143003/diff/20001/gpu/command_buffer/serv... File gpu/command_buffer/service/gles2_cmd_decoder.h (right): https://codereview.chromium.org/1387143003/diff/20001/gpu/command_buffer/serv... gpu/command_buffer/service/gles2_cmd_decoder.h:250: virtual uint32 GetBackbufferClearBits() { return 0; } On 2015/11/04 11:55:52, Sami wrote: > Please add the "ForTest" suffix for these to make it clearer that these are > test-only. Could also move them next to the existing test methods. > > Also I think I'd combine these into a single > GetAndClearBackbufferClearBitsForTest() method. Done. https://codereview.chromium.org/1387143003/diff/20001/gpu/command_buffer/serv... File gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc (right): https://codereview.chromium.org/1387143003/diff/20001/gpu/command_buffer/serv... gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc:2524: // EXPECT_EQ can't be used to compare function pointers On 2015/11/04 11:55:52, Sami wrote: > nit: append a full stop. Done.
Thanks, non-owner l-g-t-m.
Description was changed from ========== Fix missing break in switch-case statements in gles2_cmd_decoder GL_STENCIL_BUFFER_BIT bit is enabled on backbuffer_needs_clear_bits_ in DoDiscardFramebufferEXT() whenever GL_DEPTH_EXT attachment is present for the buffer - irrespective of whether GL_STENCIL_EXT attachment is actually requested or not. Similarly, when fetching GL_RENDERBUFFER_SAMPLES_IMG render buffer params in DoGetRenderbufferParameteriv(), GL_RENDERBUFFER_SAMPLES_EXT param is actually fetched for render buffer. BUG=None TEST=None ========== to ========== Add missing break in switch-case statements in gles2_cmd_decoder GL_STENCIL_BUFFER_BIT bit is enabled whenever GL_DEPTH_EXT attachment is requested on backbuffer_needs_clear_bits_ in DoDiscardFramebufferEXT() - irrespective of whether GL_STENCIL_EXT attachment is actually requested or not. Similarly, fetching GL_RENDERBUFFER_SAMPLES_IMG render buffer params in DoGetRenderbufferParameteriv() actually fetches GL_RENDERBUFFER_SAMPLES_EXT param instead. BUG=None TEST=gpu_unittests --gtest_filter=*GLES2DecoderManualInitTest.ClearBackbufferBitsOnDiscardFramebufferEXT* ==========
Description was changed from ========== Add missing break in switch-case statements in gles2_cmd_decoder GL_STENCIL_BUFFER_BIT bit is enabled whenever GL_DEPTH_EXT attachment is requested on backbuffer_needs_clear_bits_ in DoDiscardFramebufferEXT() - irrespective of whether GL_STENCIL_EXT attachment is actually requested or not. Similarly, fetching GL_RENDERBUFFER_SAMPLES_IMG render buffer params in DoGetRenderbufferParameteriv() actually fetches GL_RENDERBUFFER_SAMPLES_EXT param instead. BUG=None TEST=gpu_unittests --gtest_filter=*GLES2DecoderManualInitTest.ClearBackbufferBitsOnDiscardFramebufferEXT* ========== to ========== Add missing break in switch-case statements in gles2_cmd_decoder GL_STENCIL_BUFFER_BIT bit is enabled whenever GL_DEPTH_EXT attachment is requested on backbuffer_needs_clear_bits_ in DoDiscardFramebufferEXT() - irrespective of whether GL_STENCIL_EXT attachment is actually requested or not. Similarly, fetching GL_RENDERBUFFER_SAMPLES_IMG render buffer params in DoGetRenderbufferParameteriv() actually fetches GL_RENDERBUFFER_SAMPLES_EXT param instead. BUG=None TEST=gpu_unittests --gtest_filter=*GLES2DecoderManualInitTest.ClearBackbufferBitsOnDiscardFramebufferEXT* ==========
On 2015/11/04 15:36:24, Sami wrote: > Thanks, non-owner l-g-t-m. @zmo: Any comments?
On 2015/11/06 at 04:04:00, kphanee wrote: > On 2015/11/04 15:36:24, Sami wrote: > > Thanks, non-owner l-g-t-m. > > @zmo: Any comments? @zmo: gentle remainder ping!!! Can you please review the patch and update comments (if any)?
skyostil@chromium.org changed reviewers: + kbr@chromium.org
+kbr@ in case zmo@ is out.
kbr@chromium.org changed reviewers: + bajones@chromium.org, piman@chromium.org, vmiura@chromium.org
Good catch and nice test. This LGTM but I'm not an OWNER. CC'ing bajones, piman and vmiura.
On 2015/11/11 19:20:57, Ken Russell wrote: > Good catch and nice test. This LGTM but I'm not an OWNER. CC'ing bajones, piman > and vmiura. LGTM
Nice! Could you please split the two fixes into separate CLs? https://codereview.chromium.org/1387143003/diff/80001/gpu/command_buffer/serv... File gpu/command_buffer/service/gles2_cmd_decoder.cc (right): https://codereview.chromium.org/1387143003/diff/80001/gpu/command_buffer/serv... gpu/command_buffer/service/gles2_cmd_decoder.cc:896: int32 GetAndClearBackbufferClearBitsForTest() override; uint32
On 2015/11/11 at 19:51:21, vmiura wrote: > Nice! Could you please split the two fixes into separate CLs? Okay will split the two missing cases to 2 separate patches. > > https://codereview.chromium.org/1387143003/diff/80001/gpu/command_buffer/serv... > File gpu/command_buffer/service/gles2_cmd_decoder.cc (right): > > https://codereview.chromium.org/1387143003/diff/80001/gpu/command_buffer/serv... > gpu/command_buffer/service/gles2_cmd_decoder.cc:896: int32 GetAndClearBackbufferClearBitsForTest() override; > uint32
https://codereview.chromium.org/1387143003/diff/80001/gpu/command_buffer/serv... File gpu/command_buffer/service/gles2_cmd_decoder.cc (right): https://codereview.chromium.org/1387143003/diff/80001/gpu/command_buffer/serv... gpu/command_buffer/service/gles2_cmd_decoder.cc:896: int32 GetAndClearBackbufferClearBitsForTest() override; On 2015/11/11 at 19:51:21, vmiura wrote: > uint32 uint32 return value fails the build in Android. GLenum value being compared (EXPECT_EQ(GL_COLOR_BUFFER_BIT, GetAndClearBackbufferClearBitsForTest());) is considered as int32 in Android. :(. So I made return value int32 - which makes all compilers happy. :)
LGTM after comment addressed. https://codereview.chromium.org/1387143003/diff/80001/gpu/command_buffer/serv... File gpu/command_buffer/service/gles2_cmd_decoder.cc (right): https://codereview.chromium.org/1387143003/diff/80001/gpu/command_buffer/serv... gpu/command_buffer/service/gles2_cmd_decoder.cc:896: int32 GetAndClearBackbufferClearBitsForTest() override; On 2015/11/11 20:13:21, r.kasibhatla wrote: > On 2015/11/11 at 19:51:21, vmiura wrote: > > uint32 > > uint32 return value fails the build in Android. GLenum value being compared > (EXPECT_EQ(GL_COLOR_BUFFER_BIT, GetAndClearBackbufferClearBitsForTest());) is > considered as int32 in Android. :(. > So I made return value int32 - which makes all compilers happy. :) please use a static_cast<uint32_t>(GL_COLOR_BUFFER_BIT) at the callsite instead.
LGTM after cooment addressed. Thanks for catching the bugs.
Description was changed from ========== Add missing break in switch-case statements in gles2_cmd_decoder GL_STENCIL_BUFFER_BIT bit is enabled whenever GL_DEPTH_EXT attachment is requested on backbuffer_needs_clear_bits_ in DoDiscardFramebufferEXT() - irrespective of whether GL_STENCIL_EXT attachment is actually requested or not. Similarly, fetching GL_RENDERBUFFER_SAMPLES_IMG render buffer params in DoGetRenderbufferParameteriv() actually fetches GL_RENDERBUFFER_SAMPLES_EXT param instead. BUG=None TEST=gpu_unittests --gtest_filter=*GLES2DecoderManualInitTest.ClearBackbufferBitsOnDiscardFramebufferEXT* ========== to ========== Add missing break in switch-case statements in gles2_cmd_decoder GL_STENCIL_BUFFER_BIT bit is enabled whenever GL_DEPTH_EXT attachment is requested on backbuffer_needs_clear_bits_ in DoDiscardFramebufferEXT() - irrespective of whether GL_STENCIL_EXT attachment is actually requested or not. BUG=None TEST=gpu_unittests --gtest_filter=*GLES2DecoderManualInitTest.ClearBackbufferBitsOnDiscardFramebufferEXT* ==========
Description was changed from ========== Add missing break in switch-case statements in gles2_cmd_decoder GL_STENCIL_BUFFER_BIT bit is enabled whenever GL_DEPTH_EXT attachment is requested on backbuffer_needs_clear_bits_ in DoDiscardFramebufferEXT() - irrespective of whether GL_STENCIL_EXT attachment is actually requested or not. BUG=None TEST=gpu_unittests --gtest_filter=*GLES2DecoderManualInitTest.ClearBackbufferBitsOnDiscardFramebufferEXT* ========== to ========== Add missing break in switch-case statements in gles2_cmd_decoder GL_STENCIL_BUFFER_BIT bit is enabled whenever GL_DEPTH_EXT attachment is requested on backbuffer_needs_clear_bits_ in DoDiscardFramebufferEXT() - irrespective of whether GL_STENCIL_EXT attachment is actually requested or not. BUG=None TEST=gpu_unittests --gtest_filter=*GLES2DecoderManualInitTest.ClearBackbufferBitsOnDiscardFramebufferEXT* ==========
The CQ bit was checked by kphanee@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from kbr@chromium.org, bajones@chromium.org, piman@chromium.org, zmo@chromium.org Link to the patchset: https://codereview.chromium.org/1387143003/#ps100001 (title: "Patch for landing after addressing nits!")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1387143003/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1387143003/100001
On 2015/11/12 09:08:14, Zhenyao Mo wrote: > LGTM after cooment addressed. > > Thanks for catching the bugs. Thanks for the comments. I have updated the patch as per @vmiura comments - separating the 2 fixes to separate CL's and returning uint32 instead of int32. Will be uploading the second CL for the second fix soon.
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by kphanee@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1387143003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1387143003/120001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by kphanee@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from kbr@chromium.org, bajones@chromium.org, piman@chromium.org, zmo@chromium.org Link to the patchset: https://codereview.chromium.org/1387143003/#ps120001 (title: "Changes to go through the clang compiler error!")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1387143003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1387143003/120001
Message was sent while issue was closed.
Committed patchset #7 (id:120001)
Message was sent while issue was closed.
Patchset 7 (id:??) landed as https://crrev.com/411eecbfe40524f5f62dee1662cde665d12dfaf9 Cr-Commit-Position: refs/heads/master@{#359838} |