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

Side by Side Diff: src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp

Issue 2114993002: GrFP can express distance vector field req., program builder declares variable for it (Closed) Base URL: https://skia.googlesource.com/skia@dvonbeck-bevel-api-change
Patch Set: Fixed GrPaint unintialized bool Created 4 years, 4 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/glsl/GrGLSLFragmentShaderBuilder.h ('k') | src/gpu/glsl/GrGLSLPrimitiveProcessor.h » ('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 2014 Google Inc. 2 * Copyright 2014 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 #include "GrGLSLFragmentShaderBuilder.h" 8 #include "GrGLSLFragmentShaderBuilder.h"
9 #include "GrRenderTarget.h" 9 #include "GrRenderTarget.h"
10 #include "GrRenderTargetPriv.h" 10 #include "GrRenderTargetPriv.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 this->codePrependf("\t%svec4 %s = vec4(%s.x, %s - %s.y, 1.0, 1.0);\n ", 182 this->codePrependf("\t%svec4 %s = vec4(%s.x, %s - %s.y, 1.0, 1.0);\n ",
183 precision, kCoordName, kTempName, rtHeightName, k TempName); 183 precision, kCoordName, kTempName, rtHeightName, k TempName);
184 this->codePrependf("%svec2 %s = gl_FragCoord.xy;", precision, kTempN ame); 184 this->codePrependf("%svec2 %s = gl_FragCoord.xy;", precision, kTempN ame);
185 fSetupFragPosition = true; 185 fSetupFragPosition = true;
186 } 186 }
187 SkASSERT(fProgramBuilder->fUniformHandles.fRTHeightUni.isValid()); 187 SkASSERT(fProgramBuilder->fUniformHandles.fRTHeightUni.isValid());
188 return kCoordName; 188 return kCoordName;
189 } 189 }
190 } 190 }
191 191
192 const char* GrGLSLFragmentShaderBuilder::distanceVectorName() const {
193 return "fsDistanceVector";
194 }
195
192 void GrGLSLFragmentShaderBuilder::appendOffsetToSample(const char* sampleIdx, Co ordinates coords) { 196 void GrGLSLFragmentShaderBuilder::appendOffsetToSample(const char* sampleIdx, Co ordinates coords) {
193 SkASSERT(fProgramBuilder->header().fSamplePatternKey); 197 SkASSERT(fProgramBuilder->header().fSamplePatternKey);
194 SkDEBUGCODE(fUsedProcessorFeatures |= GrProcessor::kSampleLocations_Required Feature); 198 SkDEBUGCODE(fUsedProcessorFeatures |= GrProcessor::kSampleLocations_Required Feature);
195 if (kTopLeft_GrSurfaceOrigin == this->getSurfaceOrigin()) { 199 if (kTopLeft_GrSurfaceOrigin == this->getSurfaceOrigin()) {
196 // With a top left origin, device and window space are equal, so we only use device coords. 200 // With a top left origin, device and window space are equal, so we only use device coords.
197 coords = kSkiaDevice_Coordinates; 201 coords = kSkiaDevice_Coordinates;
198 } 202 }
199 this->codeAppendf("%s[%s]", sample_offset_array_name(coords), sampleIdx); 203 this->codeAppendf("%s[%s]", sample_offset_array_name(coords), sampleIdx);
200 fUsedSampleOffsetArrays |= (1 << coords); 204 fUsedSampleOffsetArrays |= (1 << coords);
201 } 205 }
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2] ); 389 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2] );
386 } 390 }
387 391
388 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() { 392 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() {
389 SkASSERT(fSubstageIndices.count() >= 2); 393 SkASSERT(fSubstageIndices.count() >= 2);
390 fSubstageIndices.pop_back(); 394 fSubstageIndices.pop_back();
391 fSubstageIndices.back()++; 395 fSubstageIndices.back()++;
392 int removeAt = fMangleString.findLastOf('_'); 396 int removeAt = fMangleString.findLastOf('_');
393 fMangleString.remove(removeAt, fMangleString.size() - removeAt); 397 fMangleString.remove(removeAt, fMangleString.size() - removeAt);
394 } 398 }
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLFragmentShaderBuilder.h ('k') | src/gpu/glsl/GrGLSLPrimitiveProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698