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

Side by Side Diff: src/gpu/glsl/GrGLSLProgramBuilder.h

Issue 1806983002: Update how we send draws to gpu backend to reduce state setting. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrGLSLProgramBuilder_DEFINED 8 #ifndef GrGLSLProgramBuilder_DEFINED
9 #define GrGLSLProgramBuilder_DEFINED 9 #define GrGLSLProgramBuilder_DEFINED
10 10
(...skipping 17 matching lines...) Expand all
28 class GrGLSLProgramBuilder { 28 class GrGLSLProgramBuilder {
29 public: 29 public:
30 typedef GrGpu::DrawArgs DrawArgs; 30 typedef GrGpu::DrawArgs DrawArgs;
31 typedef GrGLSLUniformHandler::UniformHandle UniformHandle; 31 typedef GrGLSLUniformHandler::UniformHandle UniformHandle;
32 32
33 virtual ~GrGLSLProgramBuilder() {} 33 virtual ~GrGLSLProgramBuilder() {}
34 34
35 virtual const GrCaps* caps() const = 0; 35 virtual const GrCaps* caps() const = 0;
36 virtual const GrGLSLCaps* glslCaps() const = 0; 36 virtual const GrGLSLCaps* glslCaps() const = 0;
37 37
38 const GrPrimitiveProcessor& primitiveProcessor() const { return *fArgs.fPrim itiveProcessor; } 38 const GrPrimitiveProcessor& primitiveProcessor() const { return fPrimProc; }
39 const GrPipeline& pipeline() const { return *fArgs.fPipeline; } 39 const GrPipeline& pipeline() const { return fPipeline; }
40 const GrProgramDesc& desc() const { return *fArgs.fDesc; } 40 const GrProgramDesc& desc() const { return fDesc; }
41 const GrProgramDesc::KeyHeader& header() const { return fArgs.fDesc->header( ); } 41 const GrProgramDesc::KeyHeader& header() const { return fDesc.header(); }
42 42
43 void appendUniformDecls(GrShaderFlags visibility, SkString*) const; 43 void appendUniformDecls(GrShaderFlags visibility, SkString*) const;
44 44
45 // Handles for program uniforms (other than per-effect uniforms) 45 // Handles for program uniforms (other than per-effect uniforms)
46 struct BuiltinUniformHandles { 46 struct BuiltinUniformHandles {
47 UniformHandle fRTAdjustmentUni; 47 UniformHandle fRTAdjustmentUni;
48 48
49 // We use the render target height to provide a y-down frag coord when s pecifying 49 // We use the render target height to provide a y-down frag coord when s pecifying
50 // origin_upper_left is not supported. 50 // origin_upper_left is not supported.
51 UniformHandle fRTHeightUni; 51 UniformHandle fRTHeightUni;
(...skipping 23 matching lines...) Expand all
75 75
76 // number of each input/output type in a single allocation block, used by ma ny builders 76 // number of each input/output type in a single allocation block, used by ma ny builders
77 static const int kVarsPerBlock; 77 static const int kVarsPerBlock;
78 78
79 GrGLSLVertexBuilder fVS; 79 GrGLSLVertexBuilder fVS;
80 GrGLSLGeometryBuilder fGS; 80 GrGLSLGeometryBuilder fGS;
81 GrGLSLFragmentShaderBuilder fFS; 81 GrGLSLFragmentShaderBuilder fFS;
82 82
83 int fStageIndex; 83 int fStageIndex;
84 84
85 const DrawArgs& fArgs; 85 const GrPipeline& fPipeline;
86 const GrPrimitiveProcessor& fPrimProc;
87 const GrProgramDesc& fDesc;
86 88
87 BuiltinUniformHandles fUniformHandles; 89 BuiltinUniformHandles fUniformHandles;
88 90
89 GrGLSLPrimitiveProcessor* fGeometryProcessor; 91 GrGLSLPrimitiveProcessor* fGeometryProcessor;
90 GrGLSLXferProcessor* fXferProcessor; 92 GrGLSLXferProcessor* fXferProcessor;
91 GrGLSLFragProcs fFragmentProcessors; 93 GrGLSLFragProcs fFragmentProcessors;
92 94
93 protected: 95 protected:
94 explicit GrGLSLProgramBuilder(const DrawArgs& args); 96 explicit GrGLSLProgramBuilder(const GrPipeline&,
97 const GrPrimitiveProcessor&,
98 const GrProgramDesc&);
95 99
96 void addFeature(GrShaderFlags shaders, uint32_t featureBit, const char* exte nsionName); 100 void addFeature(GrShaderFlags shaders, uint32_t featureBit, const char* exte nsionName);
97 101
98 bool emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr4* inputCoverage ); 102 bool emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr4* inputCoverage );
99 103
100 void cleanupFragmentProcessors(); 104 void cleanupFragmentProcessors();
101 105
102 void finalizeShaders(); 106 void finalizeShaders();
103 107
104 SkTArray<UniformHandle> fSamplerUniforms; 108 SkTArray<UniformHandle> fSamplerUniforms;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 #endif 159 #endif
156 160
157 GrGLSLPrimitiveProcessor::TransformsIn fCoordTransforms; 161 GrGLSLPrimitiveProcessor::TransformsIn fCoordTransforms;
158 GrGLSLPrimitiveProcessor::TransformsOut fOutCoords; 162 GrGLSLPrimitiveProcessor::TransformsOut fOutCoords;
159 int fNumVertexSamplers; 163 int fNumVertexSamplers;
160 int fNumGeometrySamplers; 164 int fNumGeometrySamplers;
161 int fNumFragmentSamplers; 165 int fNumFragmentSamplers;
162 }; 166 };
163 167
164 #endif 168 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698