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

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 GCC warning Created 6 years, 6 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, const void* srcData) {
137 if (kUnknown_GrPixelConfig == desc.fConfig ||
138 !GrPixelConfigIsCompressed(desc.fConfig)) {
139 return NULL;
140 }
141
142 // We shouldn't be rendering into this
143 if (desc.fFlags & kRenderTarget_GrTextureFlagBit) {
144 return NULL;
145 }
146
147 // Do we support this format?
148 if (!this->caps()->isConfigTexturable(desc.fConfig)) {
149 return NULL;
150 }
151
152 this->handleDirtyContext();
153 return this->onCreateCompressedTexture(desc, srcData);
154 }
155
136 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { 156 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) {
137 SkASSERT(NULL == rt->getStencilBuffer()); 157 SkASSERT(NULL == rt->getStencilBuffer());
138 GrStencilBuffer* sb = 158 GrStencilBuffer* sb =
139 this->getContext()->findStencilBuffer(rt->width(), 159 this->getContext()->findStencilBuffer(rt->width(),
140 rt->height(), 160 rt->height(),
141 rt->numSamples()); 161 rt->numSamples());
142 if (NULL != sb) { 162 if (NULL != sb) {
143 rt->setStencilBuffer(sb); 163 rt->setStencilBuffer(sb);
144 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); 164 bool attached = this->attachStencilBufferToRenderTarget(sb, rt);
145 if (!attached) { 165 if (!attached) {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } 570 }
551 571
552 void GrGpu::releaseIndexArray() { 572 void GrGpu::releaseIndexArray() {
553 // if index source was array, we stowed data in the pool 573 // if index source was array, we stowed data in the pool
554 const GeometrySrcState& geoSrc = this->getGeomSrc(); 574 const GeometrySrcState& geoSrc = this->getGeomSrc();
555 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); 575 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc);
556 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); 576 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t);
557 fIndexPool->putBack(bytes); 577 fIndexPool->putBack(bytes);
558 --fIndexPoolUseCnt; 578 --fIndexPoolUseCnt;
559 } 579 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698