Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | |
michael@0 | 2 | /* |
michael@0 | 3 | * Copyright 2012 Google Inc. |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | #include "GrFrameBufferObj.h" |
michael@0 | 10 | #include "GrFBBindableObj.h" |
michael@0 | 11 | |
michael@0 | 12 | void GrFrameBufferObj::setColor(GrFBBindableObj *buffer) { |
michael@0 | 13 | if (fColorBuffer) { |
michael@0 | 14 | // automatically break the binding of the old buffer |
michael@0 | 15 | GrAlwaysAssert(fColorBuffer->getColorBound(this)); |
michael@0 | 16 | fColorBuffer->resetColorBound(this); |
michael@0 | 17 | |
michael@0 | 18 | GrAlwaysAssert(!fColorBuffer->getDeleted()); |
michael@0 | 19 | fColorBuffer->unref(); |
michael@0 | 20 | } |
michael@0 | 21 | fColorBuffer = buffer; |
michael@0 | 22 | if (fColorBuffer) { |
michael@0 | 23 | GrAlwaysAssert(!fColorBuffer->getDeleted()); |
michael@0 | 24 | fColorBuffer->ref(); |
michael@0 | 25 | |
michael@0 | 26 | GrAlwaysAssert(!fColorBuffer->getColorBound(this)); |
michael@0 | 27 | fColorBuffer->setColorBound(this); |
michael@0 | 28 | } |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | void GrFrameBufferObj::setDepth(GrFBBindableObj *buffer) { |
michael@0 | 32 | if (fDepthBuffer) { |
michael@0 | 33 | // automatically break the binding of the old buffer |
michael@0 | 34 | GrAlwaysAssert(fDepthBuffer->getDepthBound(this)); |
michael@0 | 35 | fDepthBuffer->resetDepthBound(this); |
michael@0 | 36 | |
michael@0 | 37 | GrAlwaysAssert(!fDepthBuffer->getDeleted()); |
michael@0 | 38 | fDepthBuffer->unref(); |
michael@0 | 39 | } |
michael@0 | 40 | fDepthBuffer = buffer; |
michael@0 | 41 | if (fDepthBuffer) { |
michael@0 | 42 | GrAlwaysAssert(!fDepthBuffer->getDeleted()); |
michael@0 | 43 | fDepthBuffer->ref(); |
michael@0 | 44 | |
michael@0 | 45 | GrAlwaysAssert(!fDepthBuffer->getDepthBound(this)); |
michael@0 | 46 | fDepthBuffer->setDepthBound(this); |
michael@0 | 47 | } |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | void GrFrameBufferObj::setStencil(GrFBBindableObj *buffer) { |
michael@0 | 51 | if (fStencilBuffer) { |
michael@0 | 52 | // automatically break the binding of the old buffer |
michael@0 | 53 | GrAlwaysAssert(fStencilBuffer->getStencilBound(this)); |
michael@0 | 54 | fStencilBuffer->resetStencilBound(this); |
michael@0 | 55 | |
michael@0 | 56 | //GrAlwaysAssert(!fStencilBuffer->getDeleted()); |
michael@0 | 57 | fStencilBuffer->unref(); |
michael@0 | 58 | } |
michael@0 | 59 | fStencilBuffer = buffer; |
michael@0 | 60 | if (fStencilBuffer) { |
michael@0 | 61 | GrAlwaysAssert(!fStencilBuffer->getDeleted()); |
michael@0 | 62 | fStencilBuffer->ref(); |
michael@0 | 63 | |
michael@0 | 64 | GrAlwaysAssert(!fStencilBuffer->getStencilBound(this)); |
michael@0 | 65 | fStencilBuffer->setStencilBound(this); |
michael@0 | 66 | } |
michael@0 | 67 | } |