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

Side by Side Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 12843026: Make GrDrawTarget::Caps ref counted and GrGLCaps derive from it. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrInOrderDrawBuffer.h" 10 #include "GrInOrderDrawBuffer.h"
(...skipping 11 matching lines...) Expand all
22 GrIndexBufferAllocPool* indexPool) 22 GrIndexBufferAllocPool* indexPool)
23 : GrDrawTarget(gpu->getContext()) 23 : GrDrawTarget(gpu->getContext())
24 , fDstGpu(gpu) 24 , fDstGpu(gpu)
25 , fClipSet(true) 25 , fClipSet(true)
26 , fClipProxyState(kUnknown_ClipProxyState) 26 , fClipProxyState(kUnknown_ClipProxyState)
27 , fVertexPool(*vertexPool) 27 , fVertexPool(*vertexPool)
28 , fIndexPool(*indexPool) 28 , fIndexPool(*indexPool)
29 , fFlushing(false) { 29 , fFlushing(false) {
30 30
31 fDstGpu->ref(); 31 fDstGpu->ref();
32 fCaps = fDstGpu->getCaps(); 32 fCaps.reset(SkRef(fDstGpu->caps()));
33 33
34 GrAssert(NULL != vertexPool); 34 GrAssert(NULL != vertexPool);
35 GrAssert(NULL != indexPool); 35 GrAssert(NULL != indexPool);
36 36
37 GeometryPoolState& poolState = fGeoPoolStateStack.push_back(); 37 GeometryPoolState& poolState = fGeoPoolStateStack.push_back();
38 poolState.fUsedPoolVertexBytes = 0; 38 poolState.fUsedPoolVertexBytes = 0;
39 poolState.fUsedPoolIndexBytes = 0; 39 poolState.fUsedPoolIndexBytes = 0;
40 #if GR_DEBUG 40 #if GR_DEBUG
41 poolState.fPoolVertexBuffer = (GrVertexBuffer*)~0; 41 poolState.fPoolVertexBuffer = (GrVertexBuffer*)~0;
42 poolState.fPoolStartVertex = ~0; 42 poolState.fPoolStartVertex = ~0;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 GrVertexAttrib currAttrib = {kVec2f_GrVertexAttribType, currentOffset}; 92 GrVertexAttrib currAttrib = {kVec2f_GrVertexAttribType, currentOffset};
93 attribs.push_back(currAttrib); 93 attribs.push_back(currAttrib);
94 currentOffset += sizeof(GrPoint); 94 currentOffset += sizeof(GrPoint);
95 95
96 // Using per-vertex colors allows batching across colors. (A lot of rects in a row differing 96 // Using per-vertex colors allows batching across colors. (A lot of rects in a row differing
97 // only in color is a common occurrence in tables). However, having per-vert ex colors disables 97 // only in color is a common occurrence in tables). However, having per-vert ex colors disables
98 // blending optimizations because we don't know if the color will be solid o r not. These 98 // blending optimizations because we don't know if the color will be solid o r not. These
99 // optimizations help determine whether coverage and color can be blended co rrectly when 99 // optimizations help determine whether coverage and color can be blended co rrectly when
100 // dual-source blending isn't available. This comes into play when there is coverage. If colors 100 // dual-source blending isn't available. This comes into play when there is coverage. If colors
101 // were a stage it could take a hint that every vertex's color will be opaqu e. 101 // were a stage it could take a hint that every vertex's color will be opaqu e.
102 if (this->getCaps().dualSourceBlendingSupport() || 102 if (this->caps()->dualSourceBlendingSupport() ||
103 drawState->hasSolidCoverage(drawState->getAttribBindings())) { 103 drawState->hasSolidCoverage(drawState->getAttribBindings())) {
104 bindings |= GrDrawState::kColor_AttribBindingsBit; 104 bindings |= GrDrawState::kColor_AttribBindingsBit;
105 drawState->setAttribIndex(GrDrawState::kColor_AttribIndex, attribs.count ()); 105 drawState->setAttribIndex(GrDrawState::kColor_AttribIndex, attribs.count ());
106 currAttrib.set(kVec4ub_GrVertexAttribType, currentOffset); 106 currAttrib.set(kVec4ub_GrVertexAttribType, currentOffset);
107 attribs.push_back(currAttrib); 107 attribs.push_back(currAttrib);
108 colorOffset = currentOffset; 108 colorOffset = currentOffset;
109 currentOffset += sizeof(GrColor); 109 currentOffset += sizeof(GrColor);
110 // We set the draw state's color to white here. This is done so that any batching performed 110 // We set the draw state's color to white here. This is done so that any batching performed
111 // in our subclass's onDraw() won't get a false from GrDrawState::op== d ue to a color 111 // in our subclass's onDraw() won't get a false from GrDrawState::op== d ue to a color
112 // mismatch. TODO: Once vertex layout is owned by GrDrawState it should skip comparing the 112 // mismatch. TODO: Once vertex layout is owned by GrDrawState it should skip comparing the
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 GrInOrderDrawBuffer::Clear* GrInOrderDrawBuffer::recordClear() { 758 GrInOrderDrawBuffer::Clear* GrInOrderDrawBuffer::recordClear() {
759 fCmds.push_back(kClear_Cmd); 759 fCmds.push_back(kClear_Cmd);
760 return &fClears.push_back(); 760 return &fClears.push_back();
761 } 761 }
762 762
763 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { 763 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) {
764 INHERITED::clipWillBeSet(newClipData); 764 INHERITED::clipWillBeSet(newClipData);
765 fClipSet = true; 765 fClipSet = true;
766 fClipProxyState = kUnknown_ClipProxyState; 766 fClipProxyState = kUnknown_ClipProxyState;
767 } 767 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrPathRendererChain.cpp » ('j') | src/gpu/gl/GrGLContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698