Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / src / gpu / ganesh / GrProgramInfo.cpp
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/ganesh/GrProgramInfo.h"
9
10 #include "src/gpu/ganesh/GrStencilSettings.h"
11 #include "src/gpu/ganesh/effects/GrTextureEffect.h"
12
13 GrStencilSettings 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/ganesh/GrTexture.h"
25
26 void GrProgramInfo::validate(bool flushTime) const {
27     if (flushTime) {
28         SkASSERT(fPipeline->allProxiesInstantiated());
29     }
30 }
31
32 void GrProgramInfo::checkAllInstantiated() const {
33     this->pipeline().visitProxies([](GrSurfaceProxy* proxy, GrMipmapped) {
34         SkASSERT(proxy->isInstantiated());
35         return true;
36     });
37 }
38
39 void 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