b61535e098199a867b5962fa07fa1442e45a46ed
[platform/framework/web/crosswalk.git] / src / third_party / skia / src / gpu / gl / GrGLGeometryProcessor.h
1 /*
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 GrGLGeometryProcessor_DEFINED
9 #define GrGLGeometryProcessor_DEFINED
10
11 #include "GrGLProcessor.h"
12
13 class GrGLGPBuilder;
14
15 /**
16  * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, then it must inherit
17  * from this class. Since paths don't have vertices, this class is only meant to be used internally
18  * by skia, for special cases.
19  */
20 class GrGLGeometryProcessor : public GrGLProcessor {
21 public:
22     GrGLGeometryProcessor(const GrBackendProcessorFactory& factory)
23         : INHERITED(factory) {}
24
25     struct EmitArgs {
26         EmitArgs(GrGLGPBuilder* pb,
27                  const GrGeometryProcessor& gp,
28                  const GrProcessorKey& key,
29                  const char* output,
30                  const char* input,
31                  const TextureSamplerArray& samplers)
32             : fPB(pb), fGP(gp), fKey(key), fOutput(output), fInput(input), fSamplers(samplers) {}
33         GrGLGPBuilder* fPB;
34         const GrGeometryProcessor& fGP;
35         const GrProcessorKey& fKey;
36         const char* fOutput;
37         const char* fInput;
38         const TextureSamplerArray& fSamplers;
39     };
40     /**
41      * This is similar to emitCode() in the base class, except it takes a full shader builder.
42      * This allows the effect subclass to emit vertex code.
43      */
44     virtual void emitCode(const EmitArgs&) = 0;
45
46 private:
47     typedef GrGLProcessor INHERITED;
48 };
49
50 #endif