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

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

Issue 2468653002: Remove GrStencilSettings from GrPipeline (Closed)
Patch Set: Remove GrStencilSettings from GrPipeline Created 4 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/gl/GrGLPathRendering.h ('k') | src/gpu/instanced/InstanceProcessor.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 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 m.setScale(1, -1); 350 m.setScale(1, -1);
351 m.preTranslate(-0.5f, -0.5f); 351 m.preTranslate(-0.5f, -0.5f);
352 this->defineSampleOffsetArray(sample_offset_array_name(kGLSLWindow_Coord inates), m); 352 this->defineSampleOffsetArray(sample_offset_array_name(kGLSLWindow_Coord inates), m);
353 } 353 }
354 } 354 }
355 355
356 void GrGLSLFragmentShaderBuilder::defineSampleOffsetArray(const char* name, cons t SkMatrix& m) { 356 void GrGLSLFragmentShaderBuilder::defineSampleOffsetArray(const char* name, cons t SkMatrix& m) {
357 SkASSERT(fProgramBuilder->caps()->sampleLocationsSupport()); 357 SkASSERT(fProgramBuilder->caps()->sampleLocationsSupport());
358 const GrPipeline& pipeline = fProgramBuilder->pipeline(); 358 const GrPipeline& pipeline = fProgramBuilder->pipeline();
359 const GrRenderTargetPriv& rtp = pipeline.getRenderTarget()->renderTargetPriv (); 359 const GrRenderTargetPriv& rtp = pipeline.getRenderTarget()->renderTargetPriv ();
360 const GrGpu::MultisampleSpecs& specs = rtp.getMultisampleSpecs(pipeline.getS tencil()); 360 const GrGpu::MultisampleSpecs& specs = rtp.getMultisampleSpecs(pipeline);
361 SkSTArray<16, SkPoint, true> offsets; 361 SkSTArray<16, SkPoint, true> offsets;
362 offsets.push_back_n(specs.fEffectiveSampleCnt); 362 offsets.push_back_n(specs.fEffectiveSampleCnt);
363 m.mapPoints(offsets.begin(), specs.fSampleLocations, specs.fEffectiveSampleC nt); 363 m.mapPoints(offsets.begin(), specs.fSampleLocations, specs.fEffectiveSampleC nt);
364 this->definitions().append("const "); 364 this->definitions().append("const ");
365 if (fProgramBuilder->glslCaps()->usesPrecisionModifiers()) { 365 if (fProgramBuilder->glslCaps()->usesPrecisionModifiers()) {
366 this->definitions().append("highp "); 366 this->definitions().append("highp ");
367 } 367 }
368 this->definitions().appendf("vec2 %s[] = vec2[](", name); 368 this->definitions().appendf("vec2 %s[] = vec2[](", name);
369 for (int i = 0; i < specs.fEffectiveSampleCnt; ++i) { 369 for (int i = 0; i < specs.fEffectiveSampleCnt; ++i) {
370 this->definitions().appendf("vec2(%f, %f)", offsets[i].x(), offsets[i].y ()); 370 this->definitions().appendf("vec2(%f, %f)", offsets[i].x(), offsets[i].y ());
371 this->definitions().append(i + 1 != specs.fEffectiveSampleCnt ? ", " : " );\n"); 371 this->definitions().append(i + 1 != specs.fEffectiveSampleCnt ? ", " : " );\n");
372 } 372 }
373 } 373 }
374 374
375 void GrGLSLFragmentShaderBuilder::onBeforeChildProcEmitCode() { 375 void GrGLSLFragmentShaderBuilder::onBeforeChildProcEmitCode() {
376 SkASSERT(fSubstageIndices.count() >= 1); 376 SkASSERT(fSubstageIndices.count() >= 1);
377 fSubstageIndices.push_back(0); 377 fSubstageIndices.push_back(0);
378 // second-to-last value in the fSubstageIndices stack is the index of the ch ild proc 378 // second-to-last value in the fSubstageIndices stack is the index of the ch ild proc
379 // at that level which is currently emitting code. 379 // at that level which is currently emitting code.
380 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2] ); 380 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2] );
381 } 381 }
382 382
383 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() { 383 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() {
384 SkASSERT(fSubstageIndices.count() >= 2); 384 SkASSERT(fSubstageIndices.count() >= 2);
385 fSubstageIndices.pop_back(); 385 fSubstageIndices.pop_back();
386 fSubstageIndices.back()++; 386 fSubstageIndices.back()++;
387 int removeAt = fMangleString.findLastOf('_'); 387 int removeAt = fMangleString.findLastOf('_');
388 fMangleString.remove(removeAt, fMangleString.size() - removeAt); 388 fMangleString.remove(removeAt, fMangleString.size() - removeAt);
389 } 389 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.h ('k') | src/gpu/instanced/InstanceProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698