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 "../GrGLPathProgramDataManager.h" | |
16 #include "../GrGLPrimitiveProcessor.h" | 15 #include "../GrGLPrimitiveProcessor.h" |
17 #include "../GrGLXferProcessor.h" | 16 #include "../GrGLXferProcessor.h" |
18 #include "../../GrPipeline.h" | 17 #include "../../GrPipeline.h" |
19 | 18 |
20 class GrFragmentProcessor; | 19 class GrFragmentProcessor; |
21 | 20 |
22 // Enough precision to represent 1 / 2048 accurately in printf | 21 // Enough precision to represent 1 / 2048 accurately in printf |
23 #define GR_SIGNIFICANT_POW2_DECIMAL_DIG 11 | 22 #define GR_SIGNIFICANT_POW2_DECIMAL_DIG 11 |
24 | 23 |
25 /* | 24 /* |
(...skipping 10 matching lines...) Expand all Loading... |
36 public: | 35 public: |
37 enum ShaderVisibility { | 36 enum ShaderVisibility { |
38 kVertex_Visibility = 1 << kVertex_GrShaderType, | 37 kVertex_Visibility = 1 << kVertex_GrShaderType, |
39 kGeometry_Visibility = 1 << kGeometry_GrShaderType, | 38 kGeometry_Visibility = 1 << kGeometry_GrShaderType, |
40 kFragment_Visibility = 1 << kFragment_GrShaderType, | 39 kFragment_Visibility = 1 << kFragment_GrShaderType, |
41 }; | 40 }; |
42 | 41 |
43 virtual ~GrGLUniformBuilder() {} | 42 virtual ~GrGLUniformBuilder() {} |
44 | 43 |
45 typedef GrGLProgramDataManager::UniformHandle UniformHandle; | 44 typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
46 typedef GrGLPathProgramDataManager::SeparableVaryingHandle SeparableVaryingH
andle; | 45 typedef GrGLProgramDataManager::SeparableVaryingHandle SeparableVaryingHandl
e; |
47 | 46 |
48 /** Add a uniform variable to the current program, that has visibility in on
e or more shaders. | 47 /** Add a uniform variable to the current program, that has visibility in on
e or more shaders. |
49 visibility is a bitfield of ShaderVisibility values indicating from whic
h shaders the | 48 visibility is a bitfield of ShaderVisibility values indicating from whic
h shaders the |
50 uniform should be accessible. At least one bit must be set. Geometry sha
der uniforms are not | 49 uniform should be accessible. At least one bit must be set. Geometry sha
der uniforms are not |
51 supported at this time. The actual uniform name will be mangled. If outN
ame is not nullptr then | 50 supported at this time. The actual uniform name will be mangled. If outN
ame is not nullptr then |
52 it will refer to the final uniform name after return. Use the addUniform
Array variant to add | 51 it will refer to the final uniform name after return. Use the addUniform
Array variant to add |
53 an array of uniforms. */ | 52 an array of uniforms. */ |
54 UniformHandle addUniform(uint32_t visibility, | 53 UniformHandle addUniform(uint32_t visibility, |
55 GrSLType type, | 54 GrSLType type, |
56 GrSLPrecision precision, | 55 GrSLPrecision precision, |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 UniformHandle fRTAdjustmentUni; | 273 UniformHandle fRTAdjustmentUni; |
275 | 274 |
276 // We use the render target height to provide a y-down frag coord when s
pecifying | 275 // We use the render target height to provide a y-down frag coord when s
pecifying |
277 // origin_upper_left is not supported. | 276 // origin_upper_left is not supported. |
278 UniformHandle fRTHeightUni; | 277 UniformHandle fRTHeightUni; |
279 }; | 278 }; |
280 | 279 |
281 protected: | 280 protected: |
282 typedef GrGLProgramDataManager::UniformInfo UniformInfo; | 281 typedef GrGLProgramDataManager::UniformInfo UniformInfo; |
283 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; | 282 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; |
284 | 283 typedef GrGLProgramDataManager::SeparableVaryingInfo SeparableVaryingInfo; |
285 static GrGLProgramBuilder* CreateProgramBuilder(const DrawArgs&, GrGLGpu*); | 284 typedef GrGLProgramDataManager::SeparableVaryingInfoArray SeparableVaryingIn
foArray; |
286 | 285 |
287 GrGLProgramBuilder(GrGLGpu*, const DrawArgs&); | 286 GrGLProgramBuilder(GrGLGpu*, const DrawArgs&); |
288 | 287 |
289 const GrPrimitiveProcessor& primitiveProcessor() const { return *fArgs.fPrim
itiveProcessor; } | 288 const GrPrimitiveProcessor& primitiveProcessor() const { return *fArgs.fPrim
itiveProcessor; } |
290 const GrPipeline& pipeline() const { return *fArgs.fPipeline; } | 289 const GrPipeline& pipeline() const { return *fArgs.fPipeline; } |
291 const GrProgramDesc& desc() const { return *fArgs.fDesc; } | 290 const GrProgramDesc& desc() const { return *fArgs.fDesc; } |
292 const GrProgramDesc::KeyHeader& header() const { return fArgs.fDesc->header(
); } | 291 const GrProgramDesc::KeyHeader& header() const { return fArgs.fDesc->header(
); } |
293 | 292 |
294 // Generates a name for a variable. The generated string will be name prefix
ed by the prefix | 293 // Generates a name for a variable. The generated string will be name prefix
ed by the prefix |
295 // char (unless the prefix is '\0'). It also mangles the name to be stage-sp
ecific if we're | 294 // char (unless the prefix is '\0'). It also mangles the name to be stage-sp
ecific if we're |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 GrGLInstalledGeoProc* fGeometryProcessor; | 391 GrGLInstalledGeoProc* fGeometryProcessor; |
393 GrGLInstalledXferProc* fXferProcessor; | 392 GrGLInstalledXferProc* fXferProcessor; |
394 SkAutoTUnref<GrGLInstalledFragProcs> fFragmentProcessors; | 393 SkAutoTUnref<GrGLInstalledFragProcs> fFragmentProcessors; |
395 | 394 |
396 const DrawArgs& fArgs; | 395 const DrawArgs& fArgs; |
397 GrGLGpu* fGpu; | 396 GrGLGpu* fGpu; |
398 UniformInfoArray fUniforms; | 397 UniformInfoArray fUniforms; |
399 GrGLPrimitiveProcessor::TransformsIn fCoordTransforms; | 398 GrGLPrimitiveProcessor::TransformsIn fCoordTransforms; |
400 GrGLPrimitiveProcessor::TransformsOut fOutCoords; | 399 GrGLPrimitiveProcessor::TransformsOut fOutCoords; |
401 SkTArray<UniformHandle> fSamplerUniforms; | 400 SkTArray<UniformHandle> fSamplerUniforms; |
| 401 SeparableVaryingInfoArray fSeparableVaryingInfos; |
402 | 402 |
403 friend class GrGLShaderBuilder; | 403 friend class GrGLShaderBuilder; |
404 friend class GrGLVertexBuilder; | 404 friend class GrGLVertexBuilder; |
405 friend class GrGLFragmentShaderBuilder; | 405 friend class GrGLFragmentShaderBuilder; |
406 friend class GrGLGeometryBuilder; | 406 friend class GrGLGeometryBuilder; |
407 }; | 407 }; |
408 #endif | 408 #endif |
OLD | NEW |