OLD | NEW |
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 #endif | 106 #endif |
107 } | 107 } |
108 | 108 |
109 //////////////////////////////////////////////////////////////////////////////// | 109 //////////////////////////////////////////////////////////////////////////////// |
110 | 110 |
111 GrTexture* GrGpu::createTexture(const GrTextureDesc& desc, | 111 GrTexture* GrGpu::createTexture(const GrTextureDesc& desc, |
112 const void* srcData, size_t rowBytes) { | 112 const void* srcData, size_t rowBytes) { |
113 if (kUnknown_GrPixelConfig == desc.fConfig) { | 113 if (kUnknown_GrPixelConfig == desc.fConfig) { |
114 return NULL; | 114 return NULL; |
115 } | 115 } |
| 116 if ((desc.fFlags & kRenderTarget_GrTextureFlagBit) && |
| 117 !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
| 118 return NULL; |
| 119 } |
116 | 120 |
117 this->handleDirtyContext(); | 121 this->handleDirtyContext(); |
118 GrTexture* tex = this->onCreateTexture(desc, srcData, rowBytes); | 122 GrTexture* tex = this->onCreateTexture(desc, srcData, rowBytes); |
119 if (NULL != tex && | 123 if (NULL != tex && |
120 (kRenderTarget_GrTextureFlagBit & desc.fFlags) && | 124 (kRenderTarget_GrTextureFlagBit & desc.fFlags) && |
121 !(kNoStencil_GrTextureFlagBit & desc.fFlags)) { | 125 !(kNoStencil_GrTextureFlagBit & desc.fFlags)) { |
122 SkASSERT(NULL != tex->asRenderTarget()); | 126 SkASSERT(NULL != tex->asRenderTarget()); |
123 // TODO: defer this and attach dynamically | 127 // TODO: defer this and attach dynamically |
124 if (!this->attachStencilBufferToRenderTarget(tex->asRenderTarget())) { | 128 if (!this->attachStencilBufferToRenderTarget(tex->asRenderTarget())) { |
125 tex->unref(); | 129 tex->unref(); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 } | 538 } |
535 | 539 |
536 void GrGpu::releaseIndexArray() { | 540 void GrGpu::releaseIndexArray() { |
537 // if index source was array, we stowed data in the pool | 541 // if index source was array, we stowed data in the pool |
538 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 542 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
539 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 543 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
540 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 544 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
541 fIndexPool->putBack(bytes); | 545 fIndexPool->putBack(bytes); |
542 --fIndexPoolUseCnt; | 546 --fIndexPoolUseCnt; |
543 } | 547 } |
OLD | NEW |