 Chromium Code Reviews
 Chromium Code Reviews Issue 
            2402273002:
    DrawingBuffer: Clean up GL state restoration  (Closed)
    
  
    Issue 
            2402273002:
    DrawingBuffer: Clean up GL state restoration  (Closed) 
  | DescriptionDrawingBuffer: Clean up GL state restoration
Several of DrawingBuffer's methods leave the caller's state dirty,
and the responsibility for restoring this state comes in three forms:
- Responsibility of DrawingBuffer.
  - E.g, DrawingBuffer::PrepareTextureMailbox, which calls
    DrawingBuffer::finishPrepareTextureMailboxGpu, which restores
    texture and framebuffer bindings.
- Responsibility of the caller
  - E.g, WebGLRenderingContextBase::restoreStateAfterClear and
    everything that calls it.
  - Except..
- Both, together, in strange ways. That is, the caller will explicitly
  restore some state, but it will also call into DrawingBuffer to
  restore some of the state
  - E.g, WebGLRenderingContextBase::reshape, where we have all
    sorts of state restore calls, from all sorts of places.
Note how strange it is to have WebGLRenderingContextBase call
DrawingBuffer to have it restore state. WebGLRenderingContextBase is
the structure that knows the values to restore -- DrawingBuffer only
knows these values because WebGLRenderingContextBase told them to it.
Get rid of all of the state tracking in DrawingBuffer. Instead, have
it call back to its Client (WebGLRenderingContextBase) to restore state
at the end of all of its public entrypoints.
There exists no testing for this state restoration. Sprinkle "verify
that state was restored correctly" calls throughout the existing tests.
Also, make some method names more sensical. Change "commit" to a
name that reflects what it does and the state changes associated with it.
Change "reset" to "resize".
BUG=648707
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel
Committed: https://crrev.com/123016bf9ed08d599540dddc9a3b92a0df7eba2e
Cr-Commit-Position: refs/heads/master@{#426686}
   Patch Set 1 #
      Total comments: 4
      
     Patch Set 2 : Use built-in methods #
      Total comments: 9
      
     Patch Set 3 : Add comments for size check #Patch Set 4 : fix compile #Patch Set 5 : Fix state update #Patch Set 6 : Remove conditional in texture binding #Patch Set 7 : Rebase #Patch Set 8 : Incorporate review feedback #Messages
    Total messages: 44 (34 generated)
     |