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

Side by Side Diff: src/gpu/gl/GrGLProgramDesc.cpp

Issue 1443743002: Rename some processor functions from GL to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@primProcs
Patch Set: nits 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/effects/GrYUVtoRGBEffect.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.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 2013 Google Inc. 2 * Copyright 2013 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 #include "GrGLProgramDesc.h" 7 #include "GrGLProgramDesc.h"
8 8
9 #include "GrProcessor.h" 9 #include "GrProcessor.h"
10 #include "GrGLGpu.h" 10 #include "GrGLGpu.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 static bool get_frag_proc_and_meta_keys(const GrPrimitiveProcessor& primProc, 81 static bool get_frag_proc_and_meta_keys(const GrPrimitiveProcessor& primProc,
82 const GrFragmentProcessor& fp, 82 const GrFragmentProcessor& fp,
83 const GrGLCaps& caps, 83 const GrGLCaps& caps,
84 GrProcessorKeyBuilder* b) { 84 GrProcessorKeyBuilder* b) {
85 for (int i = 0; i < fp.numChildProcessors(); ++i) { 85 for (int i = 0; i < fp.numChildProcessors(); ++i) {
86 if (!get_frag_proc_and_meta_keys(primProc, fp.childProcessor(i), caps, b )) { 86 if (!get_frag_proc_and_meta_keys(primProc, fp.childProcessor(i), caps, b )) {
87 return false; 87 return false;
88 } 88 }
89 } 89 }
90 90
91 fp.getGLProcessorKey(*caps.glslCaps(), b); 91 fp.getGLSLProcessorKey(*caps.glslCaps(), b);
92 92
93 //**** use glslCaps here? 93 //**** use glslCaps here?
94 return get_meta_key(fp, caps, primProc.getTransformKey(fp.coordTransforms(), 94 return get_meta_key(fp, caps, primProc.getTransformKey(fp.coordTransforms(),
95 fp.numTransformsExclC hildren()), b); 95 fp.numTransformsExclC hildren()), b);
96 } 96 }
97 97
98 bool GrGLProgramDescBuilder::Build(GrProgramDesc* desc, 98 bool GrGLProgramDescBuilder::Build(GrProgramDesc* desc,
99 const GrPrimitiveProcessor& primProc, 99 const GrPrimitiveProcessor& primProc,
100 const GrPipeline& pipeline, 100 const GrPipeline& pipeline,
101 const GrGLGpu* gpu) { 101 const GrGLGpu* gpu) {
102 // The descriptor is used as a cache key. Thus when a field of the 102 // The descriptor is used as a cache key. Thus when a field of the
103 // descriptor will not affect program generation (because of the attribute 103 // descriptor will not affect program generation (because of the attribute
104 // bindings in use or other descriptor field settings) it should be set 104 // bindings in use or other descriptor field settings) it should be set
105 // to a canonical value to avoid duplicate programs with different keys. 105 // to a canonical value to avoid duplicate programs with different keys.
106 106
107 GrGLProgramDesc* glDesc = (GrGLProgramDesc*) desc; 107 GrGLProgramDesc* glDesc = (GrGLProgramDesc*) desc;
108 108
109 GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t)); 109 GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t));
110 // Make room for everything up to the effect keys. 110 // Make room for everything up to the effect keys.
111 glDesc->key().reset(); 111 glDesc->key().reset();
112 glDesc->key().push_back_n(kProcessorKeysOffset); 112 glDesc->key().push_back_n(kProcessorKeysOffset);
113 113
114 GrProcessorKeyBuilder b(&glDesc->key()); 114 GrProcessorKeyBuilder b(&glDesc->key());
115 115
116 primProc.getGLProcessorKey(*gpu->glCaps().glslCaps(), &b); 116 primProc.getGLSLProcessorKey(*gpu->glCaps().glslCaps(), &b);
117 //**** use glslCaps here? 117 //**** use glslCaps here?
118 if (!get_meta_key(primProc, gpu->glCaps(), 0, &b)) { 118 if (!get_meta_key(primProc, gpu->glCaps(), 0, &b)) {
119 glDesc->key().reset(); 119 glDesc->key().reset();
120 return false; 120 return false;
121 } 121 }
122 122
123 for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) { 123 for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) {
124 const GrFragmentProcessor& fp = pipeline.getFragmentProcessor(i); 124 const GrFragmentProcessor& fp = pipeline.getFragmentProcessor(i);
125 if (!get_frag_proc_and_meta_keys(primProc, fp, gpu->glCaps(), &b)) { 125 if (!get_frag_proc_and_meta_keys(primProc, fp, gpu->glCaps(), &b)) {
126 glDesc->key().reset(); 126 glDesc->key().reset();
127 return false; 127 return false;
128 } 128 }
129 } 129 }
130 130
131 const GrXferProcessor& xp = *pipeline.getXferProcessor(); 131 const GrXferProcessor& xp = *pipeline.getXferProcessor();
132 xp.getGLProcessorKey(*gpu->glCaps().glslCaps(), &b); 132 xp.getGLSLProcessorKey(*gpu->glCaps().glslCaps(), &b);
133 //**** use glslCaps here? 133 //**** use glslCaps here?
134 if (!get_meta_key(xp, gpu->glCaps(), 0, &b)) { 134 if (!get_meta_key(xp, gpu->glCaps(), 0, &b)) {
135 glDesc->key().reset(); 135 glDesc->key().reset();
136 return false; 136 return false;
137 } 137 }
138 138
139 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- ------------------- 139 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- -------------------
140 // Because header is a pointer into the dynamic array, we can't push any new data into the key 140 // Because header is a pointer into the dynamic array, we can't push any new data into the key
141 // below here. 141 // below here.
142 KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>(); 142 KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>();
143 143
144 // make sure any padding in the header is zeroed. 144 // make sure any padding in the header is zeroed.
145 memset(header, 0, kHeaderSize); 145 memset(header, 0, kHeaderSize);
146 146
147 if (pipeline.readsFragPosition()) { 147 if (pipeline.readsFragPosition()) {
148 header->fFragPosKey = 148 header->fFragPosKey =
149 GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.get RenderTarget()); 149 GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.get RenderTarget());
150 } else { 150 } else {
151 header->fFragPosKey = 0; 151 header->fFragPosKey = 0;
152 } 152 }
153 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); 153 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters();
154 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); 154 header->fColorEffectCnt = pipeline.numColorFragmentProcessors();
155 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); 155 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors();
156 glDesc->finalize(); 156 glDesc->finalize();
157 return true; 157 return true;
158 } 158 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrYUVtoRGBEffect.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698