| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "GrGpu.h" | 9 #include "GrGpu.h" |
| 10 | 10 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (tex) { | 171 if (tex) { |
| 172 if (!caps->reuseScratchTextures() && !isRT) { | 172 if (!caps->reuseScratchTextures() && !isRT) { |
| 173 tex->resourcePriv().removeScratchKey(); | 173 tex->resourcePriv().removeScratchKey(); |
| 174 } | 174 } |
| 175 fStats.incTextureCreates(); | 175 fStats.incTextureCreates(); |
| 176 if (!texels.empty()) { | 176 if (!texels.empty()) { |
| 177 if (texels[0].fPixels) { | 177 if (texels[0].fPixels) { |
| 178 fStats.incTextureUploads(); | 178 fStats.incTextureUploads(); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 // This is a current work around to get discards into newly created text
ures. Once we are in |
| 182 // MDB world, we should remove this code a rely on the draw target havin
g specified load |
| 183 // operations. |
| 184 if (isRT && texels.empty()) { |
| 185 GrRenderTarget* rt = tex->asRenderTarget(); |
| 186 SkASSERT(rt); |
| 187 rt->discard(); |
| 188 } |
| 181 } | 189 } |
| 182 return tex; | 190 return tex; |
| 183 } | 191 } |
| 184 | 192 |
| 185 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwn
ership ownership) { | 193 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwn
ership ownership) { |
| 186 this->handleDirtyContext(); | 194 this->handleDirtyContext(); |
| 187 if (!this->caps()->isConfigTexturable(desc.fConfig)) { | 195 if (!this->caps()->isConfigTexturable(desc.fConfig)) { |
| 188 return nullptr; | 196 return nullptr; |
| 189 } | 197 } |
| 190 if ((desc.fFlags & kRenderTarget_GrBackendTextureFlag) && | 198 if ((desc.fFlags & kRenderTarget_GrBackendTextureFlag) && |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 fMultisampleSpecsMap.push_back_n(n, (const MultisampleSpecs*) nullptr); | 473 fMultisampleSpecsMap.push_back_n(n, (const MultisampleSpecs*) nullptr); |
| 466 } | 474 } |
| 467 fMultisampleSpecsMap[effectiveKey] = &specs; | 475 fMultisampleSpecsMap[effectiveKey] = &specs; |
| 468 if (effectiveSampleCnt != desc.fSampleCnt) { | 476 if (effectiveSampleCnt != desc.fSampleCnt) { |
| 469 SkASSERT(surfDescKey < effectiveKey); | 477 SkASSERT(surfDescKey < effectiveKey); |
| 470 fMultisampleSpecsMap[surfDescKey] = &specs; | 478 fMultisampleSpecsMap[surfDescKey] = &specs; |
| 471 } | 479 } |
| 472 return specs; | 480 return specs; |
| 473 } | 481 } |
| 474 | 482 |
| OLD | NEW |