| 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 |
| 11 #include "GrBuffer.h" | 11 #include "GrBuffer.h" |
| 12 #include "GrCaps.h" | 12 #include "GrCaps.h" |
| 13 #include "GrContext.h" | 13 #include "GrContext.h" |
| 14 #include "GrGpuResourcePriv.h" | 14 #include "GrGpuResourcePriv.h" |
| 15 #include "GrMesh.h" | 15 #include "GrMesh.h" |
| 16 #include "GrPathRendering.h" | 16 #include "GrPathRendering.h" |
| 17 #include "GrPipeline.h" | 17 #include "GrPipeline.h" |
| 18 #include "GrResourceCache.h" | 18 #include "GrResourceCache.h" |
| 19 #include "GrResourceProvider.h" | 19 #include "GrResourceProvider.h" |
| 20 #include "GrRenderTargetPriv.h" | 20 #include "GrRenderTargetPriv.h" |
| 21 #include "GrStencilAttachment.h" | 21 #include "GrStencilAttachment.h" |
| 22 #include "GrStencilSettings.h" |
| 22 #include "GrSurfacePriv.h" | 23 #include "GrSurfacePriv.h" |
| 23 #include "GrTexturePriv.h" | 24 #include "GrTexturePriv.h" |
| 24 #include "SkMathPriv.h" | 25 #include "SkMathPriv.h" |
| 25 | 26 |
| 26 GrMesh& GrMesh::operator =(const GrMesh& di) { | 27 GrMesh& GrMesh::operator =(const GrMesh& di) { |
| 27 fPrimitiveType = di.fPrimitiveType; | 28 fPrimitiveType = di.fPrimitiveType; |
| 28 fStartVertex = di.fStartVertex; | 29 fStartVertex = di.fStartVertex; |
| 29 fStartIndex = di.fStartIndex; | 30 fStartIndex = di.fStartIndex; |
| 30 fVertexCount = di.fVertexCount; | 31 fVertexCount = di.fVertexCount; |
| 31 fIndexCount = di.fIndexCount; | 32 fIndexCount = di.fIndexCount; |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 if (GrRenderTarget* target = surface->asRenderTarget()) { | 436 if (GrRenderTarget* target = surface->asRenderTarget()) { |
| 436 target->flagAsNeedingResolve(bounds); | 437 target->flagAsNeedingResolve(bounds); |
| 437 } | 438 } |
| 438 GrTexture* texture = surface->asTexture(); | 439 GrTexture* texture = surface->asTexture(); |
| 439 if (texture && 1 == mipLevels) { | 440 if (texture && 1 == mipLevels) { |
| 440 texture->texturePriv().dirtyMipMaps(true); | 441 texture->texturePriv().dirtyMipMaps(true); |
| 441 } | 442 } |
| 442 } | 443 } |
| 443 } | 444 } |
| 444 | 445 |
| 445 const GrGpu::MultisampleSpecs& GrGpu::queryMultisampleSpecs(GrRenderTarget* rt, | 446 const GrGpu::MultisampleSpecs& GrGpu::queryMultisampleSpecs(const GrPipeline& pi
peline) { |
| 446 const GrStencilSetti
ngs& stencil) { | 447 GrRenderTarget* rt = pipeline.getRenderTarget(); |
| 447 SkASSERT(rt->desc().fSampleCnt > 1); | 448 SkASSERT(rt->desc().fSampleCnt > 1); |
| 448 | 449 |
| 450 GrStencilSettings stencil; |
| 451 if (pipeline.isStencilEnabled()) { |
| 452 // TODO: attach stencil and create settings during render target flush. |
| 453 SkASSERT(rt->renderTargetPriv().getStencilAttachment()); |
| 454 stencil.reset(*pipeline.getUserStencil(), pipeline.hasStencilClip(), |
| 455 rt->renderTargetPriv().numStencilBits()); |
| 456 } |
| 457 |
| 449 int effectiveSampleCnt; | 458 int effectiveSampleCnt; |
| 450 SkSTArray<16, SkPoint, true> pattern; | 459 SkSTArray<16, SkPoint, true> pattern; |
| 451 this->onQueryMultisampleSpecs(rt, stencil, &effectiveSampleCnt, &pattern); | 460 this->onQueryMultisampleSpecs(rt, stencil, &effectiveSampleCnt, &pattern); |
| 452 SkASSERT(effectiveSampleCnt >= rt->desc().fSampleCnt); | 461 SkASSERT(effectiveSampleCnt >= rt->desc().fSampleCnt); |
| 453 | 462 |
| 454 uint8_t id; | 463 uint8_t id; |
| 455 if (this->caps()->sampleLocationsSupport()) { | 464 if (this->caps()->sampleLocationsSupport()) { |
| 456 SkASSERT(pattern.count() == effectiveSampleCnt); | 465 SkASSERT(pattern.count() == effectiveSampleCnt); |
| 457 const auto& insertResult = fMultisampleSpecsIdMap.insert( | 466 const auto& insertResult = fMultisampleSpecsIdMap.insert( |
| 458 MultisampleSpecsIdMap::value_type(pattern, SkTMin(fMultisampleSpecs.
count(), 255))); | 467 MultisampleSpecsIdMap::value_type(pattern, SkTMin(fMultisampleSpecs.
count(), 255))); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 484 // This doesn't have geometric meaning. We just need to define an orderi
ng for std::map. | 493 // This doesn't have geometric meaning. We just need to define an orderi
ng for std::map. |
| 485 if (a[i].x() != b[i].x()) { | 494 if (a[i].x() != b[i].x()) { |
| 486 return a[i].x() < b[i].x(); | 495 return a[i].x() < b[i].x(); |
| 487 } | 496 } |
| 488 if (a[i].y() != b[i].y()) { | 497 if (a[i].y() != b[i].y()) { |
| 489 return a[i].y() < b[i].y(); | 498 return a[i].y() < b[i].y(); |
| 490 } | 499 } |
| 491 } | 500 } |
| 492 return false; // Equal. | 501 return false; // Equal. |
| 493 } | 502 } |
| OLD | NEW |