Chromium Code Reviews| 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 "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 break; | 476 break; |
| 477 case kBorrow_GrWrapOwnership: | 477 case kBorrow_GrWrapOwnership: |
| 478 idDesc.fLifeCycle = GrGpuResource::kBorrowed_LifeCycle; | 478 idDesc.fLifeCycle = GrGpuResource::kBorrowed_LifeCycle; |
| 479 break; | 479 break; |
| 480 } | 480 } |
| 481 | 481 |
| 482 surfDesc.fFlags = (GrSurfaceFlags) desc.fFlags; | 482 surfDesc.fFlags = (GrSurfaceFlags) desc.fFlags; |
| 483 surfDesc.fWidth = desc.fWidth; | 483 surfDesc.fWidth = desc.fWidth; |
| 484 surfDesc.fHeight = desc.fHeight; | 484 surfDesc.fHeight = desc.fHeight; |
| 485 surfDesc.fConfig = desc.fConfig; | 485 surfDesc.fConfig = desc.fConfig; |
| 486 surfDesc.fSampleCnt = SkTMin(desc.fSampleCnt, this->caps()->maxSampleCount() ); | 486 // We require the sample count to be less than both the max color sample cou nt and |
| 487 // max stencil sample count supported by the system | |
| 488 int maxSampleCount = SkTMin(this->caps()->maxColorSampleCount(), | |
| 489 this->caps()->maxStencilSampleCount()); | |
| 490 surfDesc.fSampleCnt = SkTMin(desc.fSampleCnt, maxSampleCount); | |
|
bsalomon
2016/01/15 18:08:29
Probably want to consider mixed samples here
| |
| 487 // FIXME: this should be calling resolve_origin(), but Chrome code is curre ntly | 491 // FIXME: this should be calling resolve_origin(), but Chrome code is curre ntly |
| 488 // assuming the old behaviour, which is that backend textures are always | 492 // assuming the old behaviour, which is that backend textures are always |
| 489 // BottomLeft, even for non-RT's. Once Chrome is fixed, change this to: | 493 // BottomLeft, even for non-RT's. Once Chrome is fixed, change this to: |
| 490 // glTexDesc.fOrigin = resolve_origin(desc.fOrigin, renderTarget); | 494 // glTexDesc.fOrigin = resolve_origin(desc.fOrigin, renderTarget); |
| 491 if (kDefault_GrSurfaceOrigin == desc.fOrigin) { | 495 if (kDefault_GrSurfaceOrigin == desc.fOrigin) { |
| 492 surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 496 surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
| 493 } else { | 497 } else { |
| 494 surfDesc.fOrigin = desc.fOrigin; | 498 surfDesc.fOrigin = desc.fOrigin; |
| 495 } | 499 } |
| 496 | 500 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 526 idDesc.fLifeCycle = GrGpuResource::kBorrowed_LifeCycle; | 530 idDesc.fLifeCycle = GrGpuResource::kBorrowed_LifeCycle; |
| 527 break; | 531 break; |
| 528 } | 532 } |
| 529 idDesc.fSampleConfig = GrRenderTarget::kUnified_SampleConfig; | 533 idDesc.fSampleConfig = GrRenderTarget::kUnified_SampleConfig; |
| 530 | 534 |
| 531 GrSurfaceDesc desc; | 535 GrSurfaceDesc desc; |
| 532 desc.fConfig = wrapDesc.fConfig; | 536 desc.fConfig = wrapDesc.fConfig; |
| 533 desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag; | 537 desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag; |
| 534 desc.fWidth = wrapDesc.fWidth; | 538 desc.fWidth = wrapDesc.fWidth; |
| 535 desc.fHeight = wrapDesc.fHeight; | 539 desc.fHeight = wrapDesc.fHeight; |
| 536 desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount() ); | 540 // We require the sample count to be less than both the max color sample cou nt and |
| 541 // max stencil sample count supported by the system | |
| 542 int maxSampleCount = SkTMin(this->caps()->maxColorSampleCount(), | |
| 543 this->caps()->maxStencilSampleCount()); | |
| 544 desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, maxSampleCount); | |
|
bsalomon
2016/01/15 18:08:29
and here
| |
| 537 desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true); | 545 desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true); |
| 538 | 546 |
| 539 return GrGLRenderTarget::CreateWrapped(this, desc, idDesc, wrapDesc.fStencil Bits); | 547 return GrGLRenderTarget::CreateWrapped(this, desc, idDesc, wrapDesc.fStencil Bits); |
| 540 } | 548 } |
| 541 | 549 |
| 542 //////////////////////////////////////////////////////////////////////////////// | 550 //////////////////////////////////////////////////////////////////////////////// |
| 543 bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, | 551 bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, |
| 544 size_t rowBytes, GrPixelConfig srcConfig, | 552 size_t rowBytes, GrPixelConfig srcConfig, |
| 545 DrawPreference* drawPreference, | 553 DrawPreference* drawPreference, |
| 546 WritePixelTempDrawInfo* tempDrawInfo) { | 554 WritePixelTempDrawInfo* tempDrawInfo) { |
| (...skipping 2937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3484 this->setVertexArrayID(gpu, 0); | 3492 this->setVertexArrayID(gpu, 0); |
| 3485 } | 3493 } |
| 3486 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3494 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 3487 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3495 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 3488 fDefaultVertexArrayAttribState.resize(attrCount); | 3496 fDefaultVertexArrayAttribState.resize(attrCount); |
| 3489 } | 3497 } |
| 3490 attribState = &fDefaultVertexArrayAttribState; | 3498 attribState = &fDefaultVertexArrayAttribState; |
| 3491 } | 3499 } |
| 3492 return attribState; | 3500 return attribState; |
| 3493 } | 3501 } |
| OLD | NEW |