Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Unified Diff: src/gpu/gl/builders/GrGLProgramBuilder.h

Issue 1535603006: Move some program building utils from GL to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix build Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLProgram.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/builders/GrGLProgramBuilder.h
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index 70cfad5633ec652417cc6e42cae2b5c1e09f37c1..20879253cae37940c21dbbb1c3748e7f1dd30698 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -12,42 +12,14 @@
#include "gl/GrGLProgramDataManager.h"
#include "gl/GrGLUniformHandler.h"
#include "gl/GrGLVaryingHandler.h"
-#include "glsl/GrGLSLPrimitiveProcessor.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
-#include "glsl/GrGLSLTextureSampler.h"
-#include "glsl/GrGLSLXferProcessor.h"
class GrFragmentProcessor;
class GrGLContextInfo;
class GrGLSLShaderBuilder;
class GrGLSLCaps;
-/**
- * The below struct represent processors installed in programs.
- */
-template <class Proc>
-struct GrGLInstalledProc {
- SkDEBUGCODE(int fSamplersIdx;)
- SkAutoTDelete<Proc> fGLProc;
-};
-
-typedef GrGLInstalledProc<GrGLSLPrimitiveProcessor> GrGLInstalledGeoProc;
-typedef GrGLInstalledProc<GrGLSLXferProcessor> GrGLInstalledXferProc;
-typedef GrGLInstalledProc<GrGLSLFragmentProcessor> GrGLInstalledFragProc;
-
-struct GrGLInstalledFragProcs : public SkRefCnt {
- virtual ~GrGLInstalledFragProcs();
- SkSTArray<8, GrGLInstalledFragProc*, true> fProcs;
-};
-
-/*
- * Please note - no diamond problems because of virtual inheritance. Also, both base classes
- * are pure virtual with no data members. This is the base class for program building.
- * Subclasses are nearly identical but each has their own way of emitting transforms. State for
- * each of the elements of the shader pipeline, ie vertex, fragment, geometry, etc, lives in those
- * respective builders
-*/
class GrGLProgramBuilder : public GrGLSLProgramBuilder {
public:
/** Generates a shader program.
@@ -59,6 +31,7 @@ public:
*/
static GrGLProgram* CreateProgram(const DrawArgs&, GrGLGpu*);
+ const GrCaps* caps() const override;
const GrGLSLCaps* glslCaps() const override;
GrGLGpu* gpu() const { return fGpu; }
@@ -66,41 +39,8 @@ public:
private:
GrGLProgramBuilder(GrGLGpu*, const DrawArgs&);
- // Generates a possibly mangled name for a stage variable and writes it to the fragment shader.
- // If GrGLSLExpr4 has a valid name then it will use that instead
- void nameExpression(GrGLSLExpr4*, const char* baseName);
- bool emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr4* inputCoverage);
- void emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOut);
- void emitAndInstallProc(const GrFragmentProcessor&,
- int index,
- const GrGLSLExpr4& input,
- GrGLSLExpr4* output);
-
- void emitAndInstallProc(const GrPrimitiveProcessor&,
- GrGLSLExpr4* outputColor,
- GrGLSLExpr4* outputCoverage);
-
- // these emit functions help to keep the createAndEmitProcessors template general
- void emitAndInstallProc(const GrFragmentProcessor&,
- int index,
- const char* outColor,
- const char* inColor);
- void emitAndInstallProc(const GrPrimitiveProcessor&,
- const char* outColor,
- const char* outCoverage);
- void emitAndInstallXferProc(const GrXferProcessor&,
- const GrGLSLExpr4& colorIn,
- const GrGLSLExpr4& coverageIn,
- bool ignoresCoverage);
- void emitFSOutputSwizzle(bool hasSecondaryOutput);
-
- void verify(const GrPrimitiveProcessor&);
- void verify(const GrXferProcessor&);
- void verify(const GrFragmentProcessor&);
- template <class Proc>
void emitSamplers(const GrProcessor&,
- GrGLSLTextureSampler::TextureSamplerArray* outSamplers,
- GrGLInstalledProc<Proc>*);
+ GrGLSLTextureSampler::TextureSamplerArray* outSamplers) override;
bool compileAndAttachShaders(GrGLSLShaderBuilder& shader,
GrGLuint programId,
@@ -120,35 +60,8 @@ private:
const GrGLSLUniformHandler* uniformHandler() const override { return &fUniformHandler; }
GrGLSLVaryingHandler* varyingHandler() override { return &fVaryingHandler; }
- // reset is called by program creator between each processor's emit code. It increments the
- // stage offset for variable name mangling, and also ensures verfication variables in the
- // fragment shader are cleared.
- void reset() {
- this->addStage();
- fFS.reset();
- }
- void addStage() { fStageIndex++; }
-
- class AutoStageAdvance {
- public:
- AutoStageAdvance(GrGLProgramBuilder* pb)
- : fPB(pb) {
- fPB->reset();
- // Each output to the fragment processor gets its own code section
- fPB->fFS.nextStage();
- }
- ~AutoStageAdvance() {}
- private:
- GrGLProgramBuilder* fPB;
- };
-
- GrGLInstalledGeoProc* fGeometryProcessor;
- GrGLInstalledXferProc* fXferProcessor;
- SkAutoTUnref<GrGLInstalledFragProcs> fFragmentProcessors;
GrGLGpu* fGpu;
- GrGLSLPrimitiveProcessor::TransformsIn fCoordTransforms;
- GrGLSLPrimitiveProcessor::TransformsOut fOutCoords;
typedef GrGLSLUniformHandler::UniformHandle UniformHandle;
SkTArray<UniformHandle> fSamplerUniforms;
« no previous file with comments | « src/gpu/gl/GrGLProgram.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698