OLD | NEW |
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 Loading... |
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 | |
196 void GrGLSLFragmentShaderBuilder::appendOffsetToSample(const char* sampleIdx, Co
ordinates coords) { | 192 void GrGLSLFragmentShaderBuilder::appendOffsetToSample(const char* sampleIdx, Co
ordinates coords) { |
197 SkASSERT(fProgramBuilder->header().fSamplePatternKey); | 193 SkASSERT(fProgramBuilder->header().fSamplePatternKey); |
198 SkDEBUGCODE(fUsedProcessorFeatures |= GrProcessor::kSampleLocations_Required
Feature); | 194 SkDEBUGCODE(fUsedProcessorFeatures |= GrProcessor::kSampleLocations_Required
Feature); |
199 if (kTopLeft_GrSurfaceOrigin == this->getSurfaceOrigin()) { | 195 if (kTopLeft_GrSurfaceOrigin == this->getSurfaceOrigin()) { |
200 // With a top left origin, device and window space are equal, so we only
use device coords. | 196 // With a top left origin, device and window space are equal, so we only
use device coords. |
201 coords = kSkiaDevice_Coordinates; | 197 coords = kSkiaDevice_Coordinates; |
202 } | 198 } |
203 this->codeAppendf("%s[%s]", sample_offset_array_name(coords), sampleIdx); | 199 this->codeAppendf("%s[%s]", sample_offset_array_name(coords), sampleIdx); |
204 fUsedSampleOffsetArrays |= (1 << coords); | 200 fUsedSampleOffsetArrays |= (1 << coords); |
205 } | 201 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]
); | 385 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]
); |
390 } | 386 } |
391 | 387 |
392 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() { | 388 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() { |
393 SkASSERT(fSubstageIndices.count() >= 2); | 389 SkASSERT(fSubstageIndices.count() >= 2); |
394 fSubstageIndices.pop_back(); | 390 fSubstageIndices.pop_back(); |
395 fSubstageIndices.back()++; | 391 fSubstageIndices.back()++; |
396 int removeAt = fMangleString.findLastOf('_'); | 392 int removeAt = fMangleString.findLastOf('_'); |
397 fMangleString.remove(removeAt, fMangleString.size() - removeAt); | 393 fMangleString.remove(removeAt, fMangleString.size() - removeAt); |
398 } | 394 } |
OLD | NEW |