1 /* 2 * Copyright 2019 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "src/gpu/GrProgramInfo.h" 9 10 #include "src/gpu/GrStencilSettings.h" 11 #include "src/gpu/effects/GrTextureEffect.h" 12 nonGLStencilSettings() const13GrStencilSettings GrProgramInfo::nonGLStencilSettings() const { 14 GrStencilSettings stencil; 15 16 if (this->isStencilEnabled()) { 17 stencil.reset(*fUserStencilSettings, this->pipeline().hasStencilClip(), 8); 18 } 19 20 return stencil; 21 } 22 23 #ifdef SK_DEBUG 24 #include "src/gpu/GrTexture.h" 25 validate(bool flushTime) const26void GrProgramInfo::validate(bool flushTime) const { 27 if (flushTime) { 28 SkASSERT(fPipeline->allProxiesInstantiated()); 29 } 30 } 31 checkAllInstantiated() const32void GrProgramInfo::checkAllInstantiated() const { 33 this->pipeline().visitProxies([](GrSurfaceProxy* proxy, GrMipmapped) { 34 SkASSERT(proxy->isInstantiated()); 35 return true; 36 }); 37 } 38 checkMSAAAndMIPSAreResolved() const39void GrProgramInfo::checkMSAAAndMIPSAreResolved() const { 40 this->pipeline().visitTextureEffects([](const GrTextureEffect& te) { 41 GrTexture* tex = te.texture(); 42 SkASSERT(tex); 43 44 // Ensure mipmaps were all resolved ahead of time by the DAG. 45 if (te.samplerState().mipmapped() == GrMipmapped::kYes && 46 (tex->width() != 1 || tex->height() != 1)) { 47 // There are some cases where we might be given a non-mipmapped texture with a 48 // mipmap filter. See skbug.com/7094. 49 SkASSERT(tex->mipmapped() != GrMipmapped::kYes || !tex->mipmapsAreDirty()); 50 } 51 }); 52 } 53 54 #endif 55