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

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

Issue 2120403002: Revert of Fix caching of sample locations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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/GrGLGpu.cpp ('k') | src/gpu/vk/GrVkGpu.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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 } 358 }
359 } 359 }
360 360
361 void GrGLSLFragmentShaderBuilder::defineSampleOffsetArray(const char* name, cons t SkMatrix& m) { 361 void GrGLSLFragmentShaderBuilder::defineSampleOffsetArray(const char* name, cons t SkMatrix& m) {
362 SkASSERT(fProgramBuilder->caps()->sampleLocationsSupport()); 362 SkASSERT(fProgramBuilder->caps()->sampleLocationsSupport());
363 const GrPipeline& pipeline = fProgramBuilder->pipeline(); 363 const GrPipeline& pipeline = fProgramBuilder->pipeline();
364 const GrRenderTargetPriv& rtp = pipeline.getRenderTarget()->renderTargetPriv (); 364 const GrRenderTargetPriv& rtp = pipeline.getRenderTarget()->renderTargetPriv ();
365 const GrGpu::MultisampleSpecs& specs = rtp.getMultisampleSpecs(pipeline.getS tencil()); 365 const GrGpu::MultisampleSpecs& specs = rtp.getMultisampleSpecs(pipeline.getS tencil());
366 SkSTArray<16, SkPoint, true> offsets; 366 SkSTArray<16, SkPoint, true> offsets;
367 offsets.push_back_n(specs.fEffectiveSampleCnt); 367 offsets.push_back_n(specs.fEffectiveSampleCnt);
368 m.mapPoints(offsets.begin(), specs.fSampleLocations, specs.fEffectiveSampleC nt); 368 m.mapPoints(offsets.begin(), specs.fSampleLocations.get(), specs.fEffectiveS ampleCnt);
369 this->definitions().append("const "); 369 this->definitions().append("const ");
370 if (fProgramBuilder->glslCaps()->usesPrecisionModifiers()) { 370 if (fProgramBuilder->glslCaps()->usesPrecisionModifiers()) {
371 this->definitions().append("highp "); 371 this->definitions().append("highp ");
372 } 372 }
373 this->definitions().appendf("vec2 %s[] = vec2[](", name); 373 this->definitions().appendf("vec2 %s[] = vec2[](", name);
374 for (int i = 0; i < specs.fEffectiveSampleCnt; ++i) { 374 for (int i = 0; i < specs.fEffectiveSampleCnt; ++i) {
375 this->definitions().appendf("vec2(%f, %f)", offsets[i].x(), offsets[i].y ()); 375 this->definitions().appendf("vec2(%f, %f)", offsets[i].x(), offsets[i].y ());
376 this->definitions().append(i + 1 != specs.fEffectiveSampleCnt ? ", " : " );\n"); 376 this->definitions().append(i + 1 != specs.fEffectiveSampleCnt ? ", " : " );\n");
377 } 377 }
378 } 378 }
379 379
380 void GrGLSLFragmentShaderBuilder::onBeforeChildProcEmitCode() { 380 void GrGLSLFragmentShaderBuilder::onBeforeChildProcEmitCode() {
381 SkASSERT(fSubstageIndices.count() >= 1); 381 SkASSERT(fSubstageIndices.count() >= 1);
382 fSubstageIndices.push_back(0); 382 fSubstageIndices.push_back(0);
383 // second-to-last value in the fSubstageIndices stack is the index of the ch ild proc 383 // second-to-last value in the fSubstageIndices stack is the index of the ch ild proc
384 // at that level which is currently emitting code. 384 // at that level which is currently emitting code.
385 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2] ); 385 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2] );
386 } 386 }
387 387
388 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() { 388 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() {
389 SkASSERT(fSubstageIndices.count() >= 2); 389 SkASSERT(fSubstageIndices.count() >= 2);
390 fSubstageIndices.pop_back(); 390 fSubstageIndices.pop_back();
391 fSubstageIndices.back()++; 391 fSubstageIndices.back()++;
392 int removeAt = fMangleString.findLastOf('_'); 392 int removeAt = fMangleString.findLastOf('_');
393 fMangleString.remove(removeAt, fMangleString.size() - removeAt); 393 fMangleString.remove(removeAt, fMangleString.size() - removeAt);
394 } 394 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | src/gpu/vk/GrVkGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698