blob: eba1fbe79573913a9b17cfab291ae05b571a2da9 [file] [log] [blame]
commit-bot@chromium.org261dc562013-10-04 15:42:56 +00001/*
2 * Copyright 2013 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 GrGLVertexEffect_DEFINED
9#define GrGLVertexEffect_DEFINED
10
11#include "GrGLEffect.h"
12
13/**
14 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, then it must inherit
15 * from this class. Since paths don't have vertices, this class is only meant to be used internally
16 * by skia, for special cases.
17 */
18class GrGLVertexEffect : public GrGLEffect {
19public:
20 GrGLVertexEffect(const GrBackendEffectFactory& factory)
21 : INHERITED(factory) { fIsVertexEffect = true; }
22
23 /**
24 * This is similar to emitCode() in the base class, except it takes a full shader builder.
25 * This allows the effect subclass to emit vertex code.
26 */
27 virtual void emitCode(GrGLFullShaderBuilder* builder,
28 const GrDrawEffect& drawEffect,
bsalomon63e99f72014-07-21 08:03:14 -070029 const GrEffectKey& key,
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000030 const char* outputColor,
31 const char* inputColor,
32 const TransformedCoordsArray& coords,
33 const TextureSamplerArray& samplers) = 0;
34
35 /**
36 * Provide a default override for base class's emitCode() function.
37 */
38 virtual void emitCode(GrGLShaderBuilder* builder,
39 const GrDrawEffect& drawEffect,
bsalomon63e99f72014-07-21 08:03:14 -070040 const GrEffectKey& key,
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000041 const char* outputColor,
42 const char* inputColor,
43 const TransformedCoordsArray& coords,
44 const TextureSamplerArray& samplers) SK_OVERRIDE {
commit-bot@chromium.org88cb22b2014-04-30 14:17:00 +000045 SkFAIL("GrGLVertexEffect requires GrGLFullShaderBuilder* overload for emitCode().");
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000046 }
47
48private:
49 typedef GrGLEffect INHERITED;
50};
51
52#endif