| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 8 |
| 9 #ifndef GrGLProgram_DEFINED | 9 #ifndef GrGLProgram_DEFINED |
| 10 #define GrGLProgram_DEFINED | 10 #define GrGLProgram_DEFINED |
| 11 | 11 |
| 12 #include "GrGLContext.h" | 12 #include "GrGLContext.h" |
| 13 #include "GrGLProgramDesc.h" | 13 #include "GrGLProgramDesc.h" |
| 14 #include "GrGLTexture.h" | 14 #include "GrGLTexture.h" |
| 15 #include "GrGLProgramDataManager.h" | 15 #include "GrGLProgramDataManager.h" |
| 16 #include "glsl/GrGLSLProgramDataManager.h" | 16 #include "glsl/GrGLSLProgramDataManager.h" |
| 17 | 17 |
| 18 #include "SkString.h" | 18 #include "SkString.h" |
| 19 #include "SkXfermode.h" | 19 #include "SkXfermode.h" |
| 20 | 20 |
| 21 #include "builders/GrGLProgramBuilder.h" | 21 #include "builders/GrGLProgramBuilder.h" |
| 22 | 22 |
| 23 class GrGLProcessor; | |
| 24 class GrGLInstalledProcessors; | 23 class GrGLInstalledProcessors; |
| 25 class GrGLProgramBuilder; | 24 class GrGLProgramBuilder; |
| 26 class GrPipeline; | 25 class GrPipeline; |
| 27 | 26 |
| 28 /** | 27 /** |
| 29 * This class manages a GPU program and records per-program information. | 28 * This class manages a GPU program and records per-program information. |
| 30 * We can specify the attribute locations so that they are constant | 29 * We can specify the attribute locations so that they are constant |
| 31 * across our shaders. But the driver determines the uniform locations | 30 * across our shaders. But the driver determines the uniform locations |
| 32 * at link time. We don't need to remember the sampler uniform location | 31 * at link time. We don't need to remember the sampler uniform location |
| 33 * because we will bind a texture slot to it and never change it | 32 * because we will bind a texture slot to it and never change it |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 destVec[2] = -2.f / fRenderTargetSize.fHeight; | 81 destVec[2] = -2.f / fRenderTargetSize.fHeight; |
| 83 destVec[3] = 1.f; | 82 destVec[3] = 1.f; |
| 84 } else { | 83 } else { |
| 85 destVec[2] = 2.f / fRenderTargetSize.fHeight; | 84 destVec[2] = 2.f / fRenderTargetSize.fHeight; |
| 86 destVec[3] = -1.f; | 85 destVec[3] = -1.f; |
| 87 } | 86 } |
| 88 } | 87 } |
| 89 }; | 88 }; |
| 90 | 89 |
| 91 /** | 90 /** |
| 92 * This function uploads uniforms, calls each GrGLProcessor's setData, and r
etrieves the | 91 * This function uploads uniforms, calls each GrGL*Processor's setData, and
retrieves the |
| 93 * textures that need to be bound on each unit. It is the caller's responsib
ility to ensure | 92 * textures that need to be bound on each unit. It is the caller's responsib
ility to ensure |
| 94 * the program is bound before calling, and to bind the outgoing textures to
their respective | 93 * the program is bound before calling, and to bind the outgoing textures to
their respective |
| 95 * units upon return. (Each index in the array corresponds to its matching G
L texture unit.) | 94 * units upon return. (Each index in the array corresponds to its matching G
L texture unit.) |
| 96 */ | 95 */ |
| 97 void setData(const GrPrimitiveProcessor&, const GrPipeline&, | 96 void setData(const GrPrimitiveProcessor&, const GrPipeline&, |
| 98 SkTArray<const GrTextureAccess*>* textureBindings); | 97 SkTArray<const GrTextureAccess*>* textureBindings); |
| 99 | 98 |
| 100 protected: | 99 protected: |
| 101 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; | 100 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; |
| 102 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; | 101 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 GrGLGpu* fGpu; | 137 GrGLGpu* fGpu; |
| 139 GrGLProgramDataManager fProgramDataManager; | 138 GrGLProgramDataManager fProgramDataManager; |
| 140 SkTArray<UniformHandle> fSamplerUniforms; | 139 SkTArray<UniformHandle> fSamplerUniforms; |
| 141 | 140 |
| 142 friend class GrGLProgramBuilder; | 141 friend class GrGLProgramBuilder; |
| 143 | 142 |
| 144 typedef SkRefCnt INHERITED; | 143 typedef SkRefCnt INHERITED; |
| 145 }; | 144 }; |
| 146 | 145 |
| 147 #endif | 146 #endif |
| OLD | NEW |