| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrGLProgramBuilder_DEFINED | 8 #ifndef GrGLProgramBuilder_DEFINED |
| 9 #define GrGLProgramBuilder_DEFINED | 9 #define GrGLProgramBuilder_DEFINED |
| 10 | 10 |
| 11 #include "GrGLFragmentShaderBuilder.h" | 11 #include "GrGLFragmentShaderBuilder.h" |
| 12 #include "GrGLGeometryShaderBuilder.h" | 12 #include "GrGLGeometryShaderBuilder.h" |
| 13 #include "GrGLVertexShaderBuilder.h" | 13 #include "GrGLVertexShaderBuilder.h" |
| 14 #include "../GrGLProgramDataManager.h" | 14 #include "../GrGLProgramDataManager.h" |
| 15 #include "../GrGLUniformHandle.h" | 15 #include "../GrGLUniformHandle.h" |
| 16 #include "../GrGLGeometryProcessor.h" | 16 #include "../GrGLGeometryProcessor.h" |
| 17 #include "../../GrPendingFragmentStage.h" |
| 17 | 18 |
| 18 /* | 19 /* |
| 19 * This is the base class for a series of interfaces. This base class *MUST* re
main abstract with | 20 * This is the base class for a series of interfaces. This base class *MUST* re
main abstract with |
| 20 * NO data members because it is used in multiple interface inheritance. | 21 * NO data members because it is used in multiple interface inheritance. |
| 21 * Heirarchy: | 22 * Heirarchy: |
| 22 * GrGLUniformBuilder | 23 * GrGLUniformBuilder |
| 23 * / \ | 24 * / \ |
| 24 * GrGLFPBuilder GrGLGPBuilder | 25 * GrGLFPBuilder GrGLGPBuilder |
| 25 * \ / | 26 * \ / |
| 26 * GrGLProgramBuilder(internal use only) | 27 * GrGLProgramBuilder(internal use only) |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 GrGLSLExpr4* inputCoverage); | 246 GrGLSLExpr4* inputCoverage); |
| 246 void emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOu
t); | 247 void emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOu
t); |
| 247 template <class Proc> | 248 template <class Proc> |
| 248 void emitAndInstallProc(const Proc&, | 249 void emitAndInstallProc(const Proc&, |
| 249 int index, | 250 int index, |
| 250 const ProcKeyProvider&, | 251 const ProcKeyProvider&, |
| 251 const GrGLSLExpr4& input, | 252 const GrGLSLExpr4& input, |
| 252 GrGLSLExpr4* output); | 253 GrGLSLExpr4* output); |
| 253 | 254 |
| 254 // these emit functions help to keep the createAndEmitProcessors template ge
neral | 255 // these emit functions help to keep the createAndEmitProcessors template ge
neral |
| 255 void emitAndInstallProc(const GrFragmentStage&, | 256 void emitAndInstallProc(const GrPendingFragmentStage&, |
| 256 const GrProcessorKey&, | 257 const GrProcessorKey&, |
| 257 const char* outColor, | 258 const char* outColor, |
| 258 const char* inColor); | 259 const char* inColor); |
| 259 void emitAndInstallProc(const GrGeometryProcessor&, | 260 void emitAndInstallProc(const GrGeometryProcessor&, |
| 260 const GrProcessorKey&, | 261 const GrProcessorKey&, |
| 261 const char* outCoverage, | 262 const char* outCoverage, |
| 262 const char* inCoverage); | 263 const char* inCoverage); |
| 263 void verify(const GrGeometryProcessor&); | 264 void verify(const GrGeometryProcessor&); |
| 264 void verify(const GrFragmentProcessor&); | 265 void verify(const GrFragmentProcessor&); |
| 265 void emitSamplers(const GrProcessor&, | 266 void emitSamplers(const GrProcessor&, |
| 266 GrGLProcessor::TextureSamplerArray* outSamplers, | 267 GrGLProcessor::TextureSamplerArray* outSamplers, |
| 267 GrGLInstalledProc*); | 268 GrGLInstalledProc*); |
| 268 | 269 |
| 269 // each specific program builder has a distinct transform and must override
this function | 270 // each specific program builder has a distinct transform and must override
this function |
| 270 virtual void emitTransforms(const GrFragmentStage&, | 271 virtual void emitTransforms(const GrPendingFragmentStage&, |
| 271 GrGLProcessor::TransformedCoordsArray* outCoords
, | 272 GrGLProcessor::TransformedCoordsArray* outCoords
, |
| 272 GrGLInstalledFragProc*); | 273 GrGLInstalledFragProc*); |
| 273 GrGLProgram* finalize(); | 274 GrGLProgram* finalize(); |
| 274 void bindUniformLocations(GrGLuint programID); | 275 void bindUniformLocations(GrGLuint programID); |
| 275 bool checkLinkStatus(GrGLuint programID); | 276 bool checkLinkStatus(GrGLuint programID); |
| 276 void resolveUniformLocations(GrGLuint programID); | 277 void resolveUniformLocations(GrGLuint programID); |
| 277 void cleanupProgram(GrGLuint programID, const SkTDArray<GrGLuint>& shaderIDs
); | 278 void cleanupProgram(GrGLuint programID, const SkTDArray<GrGLuint>& shaderIDs
); |
| 278 void cleanupShaders(const SkTDArray<GrGLuint>& shaderIDs); | 279 void cleanupShaders(const SkTDArray<GrGLuint>& shaderIDs); |
| 279 | 280 |
| 280 // Subclasses create different programs | 281 // Subclasses create different programs |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 SkSTArray<2, Transform, true> fTransforms; | 402 SkSTArray<2, Transform, true> fTransforms; |
| 402 bool fLocalCoordAttrib; | 403 bool fLocalCoordAttrib; |
| 403 }; | 404 }; |
| 404 | 405 |
| 405 struct GrGLInstalledFragProcs : public SkRefCnt { | 406 struct GrGLInstalledFragProcs : public SkRefCnt { |
| 406 virtual ~GrGLInstalledFragProcs(); | 407 virtual ~GrGLInstalledFragProcs(); |
| 407 SkSTArray<8, GrGLInstalledFragProc*, true> fProcs; | 408 SkSTArray<8, GrGLInstalledFragProc*, true> fProcs; |
| 408 }; | 409 }; |
| 409 | 410 |
| 410 #endif | 411 #endif |
| OLD | NEW |