| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
| 10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 GrSurfaceDesc surfDesc; | 394 GrSurfaceDesc surfDesc; |
| 395 | 395 |
| 396 idDesc.fTextureID = static_cast<GrGLuint>(desc.fTextureHandle); | 396 idDesc.fTextureID = static_cast<GrGLuint>(desc.fTextureHandle); |
| 397 idDesc.fLifeCycle = GrGpuResource::kWrapped_LifeCycle; | 397 idDesc.fLifeCycle = GrGpuResource::kWrapped_LifeCycle; |
| 398 | 398 |
| 399 // next line relies on GrBackendTextureDesc's flags matching GrTexture's | 399 // next line relies on GrBackendTextureDesc's flags matching GrTexture's |
| 400 surfDesc.fFlags = (GrSurfaceFlags) desc.fFlags; | 400 surfDesc.fFlags = (GrSurfaceFlags) desc.fFlags; |
| 401 surfDesc.fWidth = desc.fWidth; | 401 surfDesc.fWidth = desc.fWidth; |
| 402 surfDesc.fHeight = desc.fHeight; | 402 surfDesc.fHeight = desc.fHeight; |
| 403 surfDesc.fConfig = desc.fConfig; | 403 surfDesc.fConfig = desc.fConfig; |
| 404 surfDesc.fSampleCnt = desc.fSampleCnt; | 404 surfDesc.fSampleCnt = SkTMin(desc.fSampleCnt, this->caps()->maxSampleCount()
); |
| 405 bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFla
g); | 405 bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFla
g); |
| 406 // FIXME: this should be calling resolve_origin(), but Chrome code is curre
ntly | 406 // FIXME: this should be calling resolve_origin(), but Chrome code is curre
ntly |
| 407 // assuming the old behaviour, which is that backend textures are always | 407 // assuming the old behaviour, which is that backend textures are always |
| 408 // BottomLeft, even for non-RT's. Once Chrome is fixed, change this to: | 408 // BottomLeft, even for non-RT's. Once Chrome is fixed, change this to: |
| 409 // glTexDesc.fOrigin = resolve_origin(desc.fOrigin, renderTarget); | 409 // glTexDesc.fOrigin = resolve_origin(desc.fOrigin, renderTarget); |
| 410 if (kDefault_GrSurfaceOrigin == desc.fOrigin) { | 410 if (kDefault_GrSurfaceOrigin == desc.fOrigin) { |
| 411 surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 411 surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
| 412 } else { | 412 } else { |
| 413 surfDesc.fOrigin = desc.fOrigin; | 413 surfDesc.fOrigin = desc.fOrigin; |
| 414 } | 414 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 435 idDesc.fRTFBOID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle); | 435 idDesc.fRTFBOID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle); |
| 436 idDesc.fMSColorRenderbufferID = 0; | 436 idDesc.fMSColorRenderbufferID = 0; |
| 437 idDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID; | 437 idDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID; |
| 438 idDesc.fLifeCycle = GrGpuResource::kWrapped_LifeCycle; | 438 idDesc.fLifeCycle = GrGpuResource::kWrapped_LifeCycle; |
| 439 | 439 |
| 440 GrSurfaceDesc desc; | 440 GrSurfaceDesc desc; |
| 441 desc.fConfig = wrapDesc.fConfig; | 441 desc.fConfig = wrapDesc.fConfig; |
| 442 desc.fFlags = kCheckAllocation_GrSurfaceFlag; | 442 desc.fFlags = kCheckAllocation_GrSurfaceFlag; |
| 443 desc.fWidth = wrapDesc.fWidth; | 443 desc.fWidth = wrapDesc.fWidth; |
| 444 desc.fHeight = wrapDesc.fHeight; | 444 desc.fHeight = wrapDesc.fHeight; |
| 445 desc.fSampleCnt = wrapDesc.fSampleCnt; | 445 desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount()
); |
| 446 desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true); | 446 desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true); |
| 447 | 447 |
| 448 GrRenderTarget* tgt = SkNEW_ARGS(GrGLRenderTarget, (this, desc, idDesc)); | 448 GrRenderTarget* tgt = SkNEW_ARGS(GrGLRenderTarget, (this, desc, idDesc)); |
| 449 if (wrapDesc.fStencilBits) { | 449 if (wrapDesc.fStencilBits) { |
| 450 GrGLStencilBuffer::IDDesc sbDesc; | 450 GrGLStencilBuffer::IDDesc sbDesc; |
| 451 GrGLStencilBuffer::Format format; | 451 GrGLStencilBuffer::Format format; |
| 452 format.fInternalFormat = GrGLStencilBuffer::kUnknownInternalFormat; | 452 format.fInternalFormat = GrGLStencilBuffer::kUnknownInternalFormat; |
| 453 format.fPacked = false; | 453 format.fPacked = false; |
| 454 format.fStencilBits = wrapDesc.fStencilBits; | 454 format.fStencilBits = wrapDesc.fStencilBits; |
| 455 format.fTotalBits = wrapDesc.fStencilBits; | 455 format.fTotalBits = wrapDesc.fStencilBits; |
| (...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2816 this->setVertexArrayID(gpu, 0); | 2816 this->setVertexArrayID(gpu, 0); |
| 2817 } | 2817 } |
| 2818 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2818 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2819 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2819 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2820 fDefaultVertexArrayAttribState.resize(attrCount); | 2820 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2821 } | 2821 } |
| 2822 attribState = &fDefaultVertexArrayAttribState; | 2822 attribState = &fDefaultVertexArrayAttribState; |
| 2823 } | 2823 } |
| 2824 return attribState; | 2824 return attribState; |
| 2825 } | 2825 } |
| OLD | NEW |