| OLD | NEW |
| 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 GrGLPathProgramDataManager_DEFINED | 8 #ifndef GrGLPathProgramDataManager_DEFINED |
| 9 #define GrGLPathProgramDataManager_DEFINED | 9 #define GrGLPathProgramDataManager_DEFINED |
| 10 | 10 |
| 11 #include "gl/GrGLProgramDataManager.h" | 11 #include "gl/GrGLProgramDataManager.h" |
| 12 | 12 |
| 13 class GrGLPathProgram; | 13 class GrGLPathProgram; |
| 14 class GrGLPathProgramBuilder; | 14 class GrGLPathProgramBuilder; |
| 15 | 15 |
| 16 /** Manages the resources used by a shader program for NVPR rendering. | 16 /** Manages the resources used by a shader program for NVPR rendering. |
| 17 */ | 17 */ |
| 18 class GrGLPathProgramDataManager : SkNoncopyable { | 18 class GrGLPathProgramDataManager : SkNoncopyable { |
| 19 public: | 19 public: |
| 20 class SeparableVaryingHandle : public GrGLProgramDataManager::ShaderResource
Handle { | 20 typedef GrGLProgramDataManager::ShaderResourceHandle SeparableVaryingHandle; |
| 21 public: | |
| 22 /* | |
| 23 * Creates a reference to a separable varying of a GrGLShaderBuilder. T
he ref can be used | |
| 24 * to set the varying with the corresponding GrGLPathProgramDataManager. | |
| 25 */ | |
| 26 static SeparableVaryingHandle CreateFromSeparableVaryingIndex(int i) { | |
| 27 return GrGLPathProgramDataManager::SeparableVaryingHandle(i); | |
| 28 } | |
| 29 SeparableVaryingHandle() { } | |
| 30 bool operator==(const SeparableVaryingHandle& other) { | |
| 31 return other.fValue == fValue; | |
| 32 } | |
| 33 private: | |
| 34 SeparableVaryingHandle(int value) : ShaderResourceHandle(value) { } | |
| 35 int toProgramDataIndex() const { SkASSERT(isValid()); return fValue; } | |
| 36 int toShaderBuilderIndex() const { return toProgramDataIndex(); } | |
| 37 | |
| 38 friend class GrGLPathProgramDataManager; // For accessing toProgramDataI
ndex(). | |
| 39 friend class GrGLPathProcessor; // For accessing toShaderBuilderIndex(). | |
| 40 }; | |
| 41 | 21 |
| 42 struct SeparableVaryingInfo { | 22 struct SeparableVaryingInfo { |
| 43 GrGLShaderVar fVariable; | 23 GrGLShaderVar fVariable; |
| 44 GrGLint fLocation; | 24 GrGLint fLocation; |
| 45 }; | 25 }; |
| 46 | 26 |
| 47 // This uses an allocator rather than array so that the GrGLShaderVars don't
move in memory | 27 // This uses an allocator rather than array so that the GrGLShaderVars don't
move in memory |
| 48 // after they are inserted. Users of GrGLShaderBuilder get refs to the vars
and ptrs to their | 28 // after they are inserted. Users of GrGLShaderBuilder get refs to the vars
and ptrs to their |
| 49 // name strings. Otherwise, we'd have to hand out copies. | 29 // name strings. Otherwise, we'd have to hand out copies. |
| 50 typedef GrTAllocator<SeparableVaryingInfo> SeparableVaryingInfoArray; | 30 typedef GrTAllocator<SeparableVaryingInfo> SeparableVaryingInfoArray; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 66 GrSLType fType; | 46 GrSLType fType; |
| 67 int fArrayCount; | 47 int fArrayCount; |
| 68 ); | 48 ); |
| 69 }; | 49 }; |
| 70 SkTArray<SeparableVarying, true> fSeparableVaryings; | 50 SkTArray<SeparableVarying, true> fSeparableVaryings; |
| 71 GrGLGpu* fGpu; | 51 GrGLGpu* fGpu; |
| 72 GrGLuint fProgramID; | 52 GrGLuint fProgramID; |
| 73 typedef SkNoncopyable INHERITED; | 53 typedef SkNoncopyable INHERITED; |
| 74 }; | 54 }; |
| 75 #endif | 55 #endif |
| OLD | NEW |