Debian Codegraph @

src/gpu/ganesh/glsl/GrGLSLBlend.h

raw
1 /*
2 * Copyright 2015 Google Inc.
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 #ifndef GrGLBlend_DEFINED
9 #define GrGLBlend_DEFINED
10
11 #include "src/gpu/ganesh/glsl/GrGLSLProgramDataManager.h"
12
13 #include <string>
14
15 class GrGLSLUniformHandler;
16 class GrProcessor;
17 enum class SkBlendMode;
18
19 namespace GrGLSLBlend {
20
21 /**
22 * Returns an SkSL expression that blends the passed-in srcColor and dstColor values.
23 * Matching calls to SetBlendModeUniformData and BlendKey must be made from your GrProcessor.
24 */
25 std::string BlendExpression(const GrProcessor* processor,
26 GrGLSLUniformHandler* uniformHandler,
27 GrGLSLProgramDataManager::UniformHandle* uniform,
28 const char* srcColor,
29 const char* dstColor,
30 SkBlendMode mode);
31
32 /**
33 * Returns a key, for use in onAddToKey from any GrProcessor. You must pass the same blend mode that
34 * was passed to BlendExpression
35 */
36 int BlendKey(SkBlendMode mode);
37
38 /**
39 * Sets up uniforms, for use in onSetData from any GrProcessor. You must pass the same uniform and
40 * blend mode that were passed to BlendExpression.
41 */
42 void SetBlendModeUniformData(const GrGLSLProgramDataManager& pdman,
43 GrGLSLProgramDataManager::UniformHandle uniform,
44 SkBlendMode mode);
45
46 } // namespace GrGLSLBlend
47
48 #endif