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

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

Issue 1116713002: Pull out shader-specific caps into GrShaderCaps and GrGLSLCaps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up some comments Created 5 years, 7 months 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/GrGLPathRendering.cpp ('k') | src/gpu/gl/builders/GrGLFragmentShaderBuilder.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 "GrGLProcessor.h" 9 #include "GrGLProcessor.h"
10 #include "GrProcessor.h" 10 #include "GrProcessor.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 GrGLProgramDesc* glDesc = (GrGLProgramDesc*) desc; 99 GrGLProgramDesc* glDesc = (GrGLProgramDesc*) desc;
100 100
101 GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t)); 101 GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t));
102 // Make room for everything up to the effect keys. 102 // Make room for everything up to the effect keys.
103 glDesc->key().reset(); 103 glDesc->key().reset();
104 glDesc->key().push_back_n(kProcessorKeysOffset); 104 glDesc->key().push_back_n(kProcessorKeysOffset);
105 105
106 GrProcessorKeyBuilder b(&glDesc->key()); 106 GrProcessorKeyBuilder b(&glDesc->key());
107 107
108 primProc.getGLProcessorKey(batchTracker, gpu->glCaps(), &b); 108 primProc.getGLProcessorKey(batchTracker, *gpu->glCaps().glslCaps(), &b);
109 //**** use glslCaps here? 109 //**** use glslCaps here?
110 if (!get_meta_key(primProc, gpu->glCaps(), 0, &b)) { 110 if (!get_meta_key(primProc, gpu->glCaps(), 0, &b)) {
111 glDesc->key().reset(); 111 glDesc->key().reset();
112 return false; 112 return false;
113 } 113 }
114 114
115 for (int s = 0; s < pipeline.numFragmentStages(); ++s) { 115 for (int s = 0; s < pipeline.numFragmentStages(); ++s) {
116 const GrPendingFragmentStage& fps = pipeline.getFragmentStage(s); 116 const GrPendingFragmentStage& fps = pipeline.getFragmentStage(s);
117 const GrFragmentProcessor& fp = *fps.processor(); 117 const GrFragmentProcessor& fp = *fps.processor();
118 fp.getGLProcessorKey(gpu->glCaps(), &b); 118 fp.getGLProcessorKey(*gpu->glCaps().glslCaps(), &b);
119 //**** use glslCaps here? 119 //**** use glslCaps here?
120 if (!get_meta_key(fp, gpu->glCaps(), primProc.getTransformKey(fp.coordTr ansforms()), &b)) { 120 if (!get_meta_key(fp, gpu->glCaps(), primProc.getTransformKey(fp.coordTr ansforms()), &b)) {
121 glDesc->key().reset(); 121 glDesc->key().reset();
122 return false; 122 return false;
123 } 123 }
124 } 124 }
125 125
126 const GrXferProcessor& xp = *pipeline.getXferProcessor(); 126 const GrXferProcessor& xp = *pipeline.getXferProcessor();
127 xp.getGLProcessorKey(gpu->glCaps(), &b); 127 xp.getGLProcessorKey(*gpu->glCaps().glslCaps(), &b);
128 //**** use glslCaps here? 128 //**** use glslCaps here?
129 if (!get_meta_key(xp, gpu->glCaps(), 0, &b)) { 129 if (!get_meta_key(xp, gpu->glCaps(), 0, &b)) {
130 glDesc->key().reset(); 130 glDesc->key().reset();
131 return false; 131 return false;
132 } 132 }
133 133
134 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- ------------------- 134 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- -------------------
135 // Because header is a pointer into the dynamic array, we can't push any new data into the key 135 // Because header is a pointer into the dynamic array, we can't push any new data into the key
136 // below here. 136 // below here.
137 KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>(); 137 KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>();
138 138
139 // make sure any padding in the header is zeroed. 139 // make sure any padding in the header is zeroed.
140 memset(header, 0, kHeaderSize); 140 memset(header, 0, kHeaderSize);
141 141
142 if (pipeline.readsFragPosition()) { 142 if (pipeline.readsFragPosition()) {
143 header->fFragPosKey = 143 header->fFragPosKey =
144 GrGLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.getRe nderTarget(), 144 GrGLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.getRe nderTarget(),
145 gpu->glCaps()) ; 145 gpu->glCaps()) ;
146 } else { 146 } else {
147 header->fFragPosKey = 0; 147 header->fFragPosKey = 0;
148 } 148 }
149 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); 149 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters();
150 header->fColorEffectCnt = pipeline.numColorFragmentStages(); 150 header->fColorEffectCnt = pipeline.numColorFragmentStages();
151 header->fCoverageEffectCnt = pipeline.numCoverageFragmentStages(); 151 header->fCoverageEffectCnt = pipeline.numCoverageFragmentStages();
152 glDesc->finalize(); 152 glDesc->finalize();
153 return true; 153 return true;
154 } 154 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.cpp ('k') | src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698