blob: c3bee952665449a111f43d9834de5388e9c97b6b [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,
joshualitt2dd1ae02014-12-03 06:24:10 -080028 const char* outputColor,
29 const char* outputCoverage,
joshualittc369e7c2014-10-22 10:56:26 -070030 const TextureSamplerArray& samplers)
joshualitt2dd1ae02014-12-03 06:24:10 -080031 : fPB(pb)
32 , fGP(gp)
33 , fOutputColor(outputColor)
34 , fOutputCoverage(outputCoverage)
35 , fSamplers(samplers) {}
joshualittc369e7c2014-10-22 10:56:26 -070036 GrGLGPBuilder* fPB;
37 const GrGeometryProcessor& fGP;
joshualitt2dd1ae02014-12-03 06:24:10 -080038 const char* fOutputColor;
39 const char* fOutputCoverage;
joshualittc369e7c2014-10-22 10:56:26 -070040 const TextureSamplerArray& fSamplers;
41 };
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000042 /**
43 * This is similar to emitCode() in the base class, except it takes a full shader builder.
44 * This allows the effect subclass to emit vertex code.
45 */
joshualittc369e7c2014-10-22 10:56:26 -070046 virtual void emitCode(const EmitArgs&) = 0;
joshualitt30ba4362014-08-21 20:18:45 -070047
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000048private:
joshualittb0a8a372014-09-23 09:50:21 -070049 typedef GrGLProcessor INHERITED;
commit-bot@chromium.org261dc562013-10-04 15:42:56 +000050};
51
52#endif