blob: 06b4aa9d475e5c1cebf48773827b842a4bed6598 [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
joshualittb0a8a372014-09-23 09:50:21 -070011#include "GrGLProcessor.h"
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000012
joshualitta5305a12014-10-10 17:47:00 -070013class GrGLGPBuilder;
14
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000015/**
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 */
joshualittb0a8a372014-09-23 09:50:21 -070020class GrGLGeometryProcessor : public GrGLProcessor {
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000021public:
joshualittb0a8a372014-09-23 09:50:21 -070022 GrGLGeometryProcessor(const GrBackendProcessorFactory& factory)
23 : INHERITED(factory) {}
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000024
joshualittc369e7c2014-10-22 10:56:26 -070025 struct EmitArgs {
26 EmitArgs(GrGLGPBuilder* pb,
27 const GrGeometryProcessor& gp,
joshualittc369e7c2014-10-22 10:56:26 -070028 const char* output,
29 const char* input,
30 const TextureSamplerArray& samplers)
joshualitt267ce482014-11-25 14:52:21 -080031 : fPB(pb), fGP(gp), fOutput(output), fInput(input), fSamplers(samplers) {}
joshualittc369e7c2014-10-22 10:56:26 -070032 GrGLGPBuilder* fPB;
33 const GrGeometryProcessor& fGP;
joshualittc369e7c2014-10-22 10:56:26 -070034 const char* fOutput;
35 const char* fInput;
36 const TextureSamplerArray& fSamplers;
37 };
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000038 /**
39 * This is similar to emitCode() in the base class, except it takes a full shader builder.
40 * This allows the effect subclass to emit vertex code.
41 */
joshualittc369e7c2014-10-22 10:56:26 -070042 virtual void emitCode(const EmitArgs&) = 0;
joshualitt30ba4362014-08-21 20:18:45 -070043
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000044private:
joshualittb0a8a372014-09-23 09:50:21 -070045 typedef GrGLProcessor INHERITED;
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000046};
47
48#endif