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

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

Issue 302783002: Initial work to get ETC1 data up to the GPU (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix some code clarity issues Created 6 years, 7 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 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 "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 SkASSERT(NULL != tex->asRenderTarget()); 126 SkASSERT(NULL != tex->asRenderTarget());
127 // TODO: defer this and attach dynamically 127 // TODO: defer this and attach dynamically
128 if (!this->attachStencilBufferToRenderTarget(tex->asRenderTarget())) { 128 if (!this->attachStencilBufferToRenderTarget(tex->asRenderTarget())) {
129 tex->unref(); 129 tex->unref();
130 return NULL; 130 return NULL;
131 } 131 }
132 } 132 }
133 return tex; 133 return tex;
134 } 134 }
135 135
136 GrTexture* GrGpu::createCompressedTexture(const GrTextureDesc& desc,
137 const void* srcData, GrCompressedForma t format) {
138 if (kUnknown_GrPixelConfig == desc.fConfig) {
139 return NULL;
140 }
141 if (desc.fFlags & kRenderTarget_GrTextureFlagBit) {
142 return NULL;
143 }
144
145 // Do we support this format?
146 if (!this->caps()->compressedTextureSupport(format)) {
147 return NULL;
148 }
149
150 this->handleDirtyContext();
151 return this->onCreateCompressedTexture(desc, srcData, format);
152 }
153
136 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { 154 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) {
137 SkASSERT(NULL == rt->getStencilBuffer()); 155 SkASSERT(NULL == rt->getStencilBuffer());
138 GrStencilBuffer* sb = 156 GrStencilBuffer* sb =
139 this->getContext()->findStencilBuffer(rt->width(), 157 this->getContext()->findStencilBuffer(rt->width(),
140 rt->height(), 158 rt->height(),
141 rt->numSamples()); 159 rt->numSamples());
142 if (NULL != sb) { 160 if (NULL != sb) {
143 rt->setStencilBuffer(sb); 161 rt->setStencilBuffer(sb);
144 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); 162 bool attached = this->attachStencilBufferToRenderTarget(sb, rt);
145 if (!attached) { 163 if (!attached) {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } 568 }
551 569
552 void GrGpu::releaseIndexArray() { 570 void GrGpu::releaseIndexArray() {
553 // if index source was array, we stowed data in the pool 571 // if index source was array, we stowed data in the pool
554 const GeometrySrcState& geoSrc = this->getGeomSrc(); 572 const GeometrySrcState& geoSrc = this->getGeomSrc();
555 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); 573 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc);
556 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); 574 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t);
557 fIndexPool->putBack(bytes); 575 fIndexPool->putBack(bytes);
558 --fIndexPoolUseCnt; 576 --fIndexPoolUseCnt;
559 } 577 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698