blob: 4b9bd449fb22f4782ea89fa03ffaa529b4cbe71d [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
joshualitt249af152014-09-15 11:41:13 -07008#ifndef GrGLGeometryProcessor_DEFINED
9#define GrGLGeometryProcessor_DEFINED
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000010
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 */
joshualitt249af152014-09-15 11:41:13 -070018class GrGLGeometryProcessor : public GrGLEffect {
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000019public:
joshualitt249af152014-09-15 11:41:13 -070020 GrGLGeometryProcessor(const GrBackendEffectFactory& factory)
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000021 : 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 */
joshualitt30ba4362014-08-21 20:18:45 -070027 virtual void emitCode(GrGLFullProgramBuilder* builder,
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000028 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;
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000034 /**
35 * Provide a default override for base class's emitCode() function.
36 */
joshualitt30ba4362014-08-21 20:18:45 -070037 virtual void emitCode(GrGLProgramBuilder* builder,
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000038 const GrDrawEffect& drawEffect,
bsalomon63e99f72014-07-21 08:03:14 -070039 const GrEffectKey& key,
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000040 const char* outputColor,
41 const char* inputColor,
42 const TransformedCoordsArray& coords,
43 const TextureSamplerArray& samplers) SK_OVERRIDE {
joshualitt249af152014-09-15 11:41:13 -070044 SkFAIL("GrGLGeometryProcessor requires GrGLFullProgramBuilder* overload for emitCode().");
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000045 }
46
joshualitt30ba4362014-08-21 20:18:45 -070047
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000048private:
49 typedef GrGLEffect INHERITED;
50};
51
52#endif