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

Side by Side Diff: src/gpu/gl/GrGLProgram.h

Issue 1428543003: Create GLSL base class for ProgramDataManager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add space Created 5 years, 1 month 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
« no previous file with comments | « src/gpu/gl/GrGLProcessor.h ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17
17 #include "SkString.h" 18 #include "SkString.h"
18 #include "SkXfermode.h" 19 #include "SkXfermode.h"
19 20
20 #include "builders/GrGLProgramBuilder.h" 21 #include "builders/GrGLProgramBuilder.h"
21 22
22 class GrGLProcessor; 23 class GrGLProcessor;
23 class GrGLInstalledProcessors; 24 class GrGLInstalledProcessors;
24 class GrGLProgramBuilder; 25 class GrGLProgramBuilder;
25 class GrPipeline; 26 class GrPipeline;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 fRenderTargetOrigin = (GrSurfaceOrigin) -1; 68 fRenderTargetOrigin = (GrSurfaceOrigin) -1;
68 } 69 }
69 70
70 /** 71 /**
71 * Gets a vec4 that adjusts the position from Skia device coords to GL's normalized device 72 * Gets a vec4 that adjusts the position from Skia device coords to GL's normalized device
72 * coords. Assuming the transformed position, pos, is a homogeneous vec3 , the vec, v, is 73 * coords. Assuming the transformed position, pos, is a homogeneous vec3 , the vec, v, is
73 * applied as such: 74 * applied as such:
74 * pos.x = dot(v.xy, pos.xz) 75 * pos.x = dot(v.xy, pos.xz)
75 * pos.y = dot(v.zw, pos.yz) 76 * pos.y = dot(v.zw, pos.yz)
76 */ 77 */
77 void getRTAdjustmentVec(GrGLfloat* destVec) { 78 void getRTAdjustmentVec(float* destVec) {
78 destVec[0] = 2.f / fRenderTargetSize.fWidth; 79 destVec[0] = 2.f / fRenderTargetSize.fWidth;
79 destVec[1] = -1.f; 80 destVec[1] = -1.f;
80 if (kBottomLeft_GrSurfaceOrigin == fRenderTargetOrigin) { 81 if (kBottomLeft_GrSurfaceOrigin == fRenderTargetOrigin) {
81 destVec[2] = -2.f / fRenderTargetSize.fHeight; 82 destVec[2] = -2.f / fRenderTargetSize.fHeight;
82 destVec[3] = 1.f; 83 destVec[3] = 1.f;
83 } else { 84 } else {
84 destVec[2] = 2.f / fRenderTargetSize.fHeight; 85 destVec[2] = 2.f / fRenderTargetSize.fHeight;
85 destVec[3] = -1.f; 86 destVec[3] = -1.f;
86 } 87 }
87 } 88 }
88 }; 89 };
89 90
90 /** 91 /**
91 * This function uploads uniforms, calls each GrGLProcessor's setData, and r etrieves the 92 * This function uploads uniforms, calls each GrGLProcessor's setData, and r etrieves the
92 * textures that need to be bound on each unit. It is the caller's responsib ility to ensure 93 * textures that need to be bound on each unit. It is the caller's responsib ility to ensure
93 * the program is bound before calling, and to bind the outgoing textures to their respective 94 * the program is bound before calling, and to bind the outgoing textures to their respective
94 * units upon return. (Each index in the array corresponds to its matching G L texture unit.) 95 * units upon return. (Each index in the array corresponds to its matching G L texture unit.)
95 */ 96 */
96 void setData(const GrPrimitiveProcessor&, const GrPipeline&, 97 void setData(const GrPrimitiveProcessor&, const GrPipeline&,
97 SkTArray<const GrTextureAccess*>* textureBindings); 98 SkTArray<const GrTextureAccess*>* textureBindings);
98 99
99 protected: 100 protected:
100 typedef GrGLProgramDataManager::UniformHandle UniformHandle; 101 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
101 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; 102 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray;
102 typedef GrGLProgramDataManager::SeparableVaryingInfoArray SeparableVaryingIn foArray; 103 typedef GrGLProgramDataManager::SeparableVaryingInfoArray SeparableVaryingIn foArray;
103 104
104 GrGLProgram(GrGLGpu*, 105 GrGLProgram(GrGLGpu*,
105 const GrProgramDesc&, 106 const GrProgramDesc&,
106 const BuiltinUniformHandles&, 107 const BuiltinUniformHandles&,
107 GrGLuint programID, 108 GrGLuint programID,
108 const UniformInfoArray&, 109 const UniformInfoArray&,
109 const SeparableVaryingInfoArray&, 110 const SeparableVaryingInfoArray&,
110 GrGLInstalledGeoProc* geometryProcessor, 111 GrGLInstalledGeoProc* geometryProcessor,
(...skipping 26 matching lines...) Expand all
137 GrGLGpu* fGpu; 138 GrGLGpu* fGpu;
138 GrGLProgramDataManager fProgramDataManager; 139 GrGLProgramDataManager fProgramDataManager;
139 SkTArray<UniformHandle> fSamplerUniforms; 140 SkTArray<UniformHandle> fSamplerUniforms;
140 141
141 friend class GrGLProgramBuilder; 142 friend class GrGLProgramBuilder;
142 143
143 typedef SkRefCnt INHERITED; 144 typedef SkRefCnt INHERITED;
144 }; 145 };
145 146
146 #endif 147 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProcessor.h ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698