blob: e5b06471f47435f16d36cff6a5268855d15cd37a [file] [log] [blame]
wangyixcef14bf2015-07-24 13:48:26 -07001/*
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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkBlendMode.h"
wangyixcef14bf2015-07-24 13:48:26 -070012
Brian Salomonffd15ea2020-07-01 16:48:20 -040013class GrGLSLShaderBuilder;
wangyixcef14bf2015-07-24 13:48:26 -070014
bsalomonae4738f2015-09-15 15:33:27 -070015namespace GrGLSLBlend {
Brian Salomon87e9ddb2019-12-19 14:50:22 -050016/*
17 * Returns the name of the built in blend function for a SkBlendMode.
18 * When and if the SkSL compiler supports inlining it'd be simpler to just call
19 * blend(mode, src, dst) where mode is a literal when the desired blend mode is
20 * not variable.
21 */
22const char* BlendFuncName(SkBlendMode mode);
23
24/*
25 * Appends GLSL code to fsBuilder that assigns a specified blend of the srcColor and dstColor
26 * variables to the outColor variable.
27 */
Brian Salomonffd15ea2020-07-01 16:48:20 -040028void AppendMode(GrGLSLShaderBuilder* fsBuilder,
Brian Salomon87e9ddb2019-12-19 14:50:22 -050029 const char* srcColor,
30 const char* dstColor,
31 const char* outColor,
32 SkBlendMode mode);
John Stilesa6841be2020-08-06 14:11:56 -040033} // namespace GrGLSLBlend
wangyixcef14bf2015-07-24 13:48:26 -070034
35#endif