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

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

Issue 700943005: Send coverage VA as floats instead of bytes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use floats instead of scalars Created 6 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/GrAARectRenderer.cpp ('k') | no next file » | 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 #include "GrGLProgram.h" 8 #include "GrGLProgram.h"
9 9
10 #include "GrAllocator.h" 10 #include "GrAllocator.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 void GrGLProgram::setCoverage(const GrOptDrawState& optState, uint8_t coverage) { 226 void GrGLProgram::setCoverage(const GrOptDrawState& optState, uint8_t coverage) {
227 const GrProgramDesc::KeyHeader& header = fDesc.header(); 227 const GrProgramDesc::KeyHeader& header = fDesc.header();
228 switch (header.fCoverageInput) { 228 switch (header.fCoverageInput) {
229 case GrProgramDesc::kAttribute_ColorInput: 229 case GrProgramDesc::kAttribute_ColorInput:
230 // Attribute case is handled in GrGpuGL::setupGeometry 230 // Attribute case is handled in GrGpuGL::setupGeometry
231 break; 231 break;
232 case GrProgramDesc::kUniform_ColorInput: 232 case GrProgramDesc::kUniform_ColorInput:
233 if (fCoverage != coverage) { 233 if (fCoverage != coverage) {
234 // OpenGL ES doesn't support unsigned byte varieties of glUnifor m 234 // OpenGL ES doesn't support unsigned byte varieties of glUnifor m
235 static const float ONE_OVER_255 = 1.f / 255.f; 235 GrGLfloat c = GrNormalizeByteToFloat(coverage);
236 GrGLfloat c = coverage * ONE_OVER_255;
237 fProgramDataManager.set1f(fBuiltinUniformHandles.fCoverageUni, c ); 236 fProgramDataManager.set1f(fBuiltinUniformHandles.fCoverageUni, c );
238 fCoverage = coverage; 237 fCoverage = coverage;
239 } 238 }
240 break; 239 break;
241 case GrProgramDesc::kAllOnes_ColorInput: 240 case GrProgramDesc::kAllOnes_ColorInput:
242 // Handled by shader creation 241 // Handled by shader creation
243 break; 242 break;
244 default: 243 default:
245 SkFAIL("Unexpected coverage type."); 244 SkFAIL("Unexpected coverage type.");
246 } 245 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 for (int t = 0; t < numTransforms; ++t) { 377 for (int t = 0; t < numTransforms; ++t) {
379 const SkMatrix& transform = get_transform_matrix(proc, false, t); 378 const SkMatrix& transform = get_transform_matrix(proc, false, t);
380 GrGLPathRendering::PathTexGenComponents components = 379 GrGLPathRendering::PathTexGenComponents components =
381 GrGLPathRendering::kST_PathTexGenComponents; 380 GrGLPathRendering::kST_PathTexGenComponents;
382 if (proc.isPerspectiveCoordTransform(t, false)) { 381 if (proc.isPerspectiveCoordTransform(t, false)) {
383 components = GrGLPathRendering::kSTR_PathTexGenComponents; 382 components = GrGLPathRendering::kSTR_PathTexGenComponents;
384 } 383 }
385 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t ransform); 384 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t ransform);
386 } 385 }
387 } 386 }
OLDNEW
« no previous file with comments | « src/gpu/GrAARectRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698