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

Side by Side Diff: src/gpu/gl/builders/GrGLProgramBuilder.cpp

Issue 776243005: Revert of move program descriptor generation to flush (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/builders/GrGLProgramBuilder.h ('k') | tests/GLProgramsTest.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 "GrGLProgramBuilder.h" 8 #include "GrGLProgramBuilder.h"
9 #include "gl/GrGLProgram.h" 9 #include "gl/GrGLProgram.h"
10 #include "gl/GrGLSLPrettyPrint.h" 10 #include "gl/GrGLSLPrettyPrint.h"
(...skipping 10 matching lines...) Expand all
21 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) 21 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X)
22 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) 22 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X)
23 23
24 // ES2 FS only guarantees mediump and lowp support 24 // ES2 FS only guarantees mediump and lowp support
25 static const GrGLShaderVar::Precision kDefaultFragmentPrecision = GrGLShaderVar: :kMedium_Precision; 25 static const GrGLShaderVar::Precision kDefaultFragmentPrecision = GrGLShaderVar: :kMedium_Precision;
26 26
27 ////////////////////////////////////////////////////////////////////////////// 27 //////////////////////////////////////////////////////////////////////////////
28 28
29 const int GrGLProgramBuilder::kVarsPerBlock = 8; 29 const int GrGLProgramBuilder::kVarsPerBlock = 8;
30 30
31 GrGLProgram* GrGLProgramBuilder::CreateProgram(const GrOptDrawState& optState, G rGpuGL* gpu) { 31 GrGLProgram* GrGLProgramBuilder::CreateProgram(const GrOptDrawState& optState,
32 GrGpu::DrawType drawType,
33 GrGpuGL* gpu) {
32 // create a builder. This will be handed off to effects so they can use it to add 34 // create a builder. This will be handed off to effects so they can use it to add
33 // uniforms, varyings, textures, etc 35 // uniforms, varyings, textures, etc
34 SkAutoTDelete<GrGLProgramBuilder> builder(CreateProgramBuilder(optState, 36 SkAutoTDelete<GrGLProgramBuilder> builder(CreateProgramBuilder(optState,
37 drawType,
35 optState.hasG eometryProcessor(), 38 optState.hasG eometryProcessor(),
36 gpu)); 39 gpu));
37 40
38 GrGLProgramBuilder* pb = builder.get(); 41 GrGLProgramBuilder* pb = builder.get();
39 const GrGLProgramDescBuilder::GLKeyHeader& header = GrGLProgramDescBuilder:: GetHeader(pb->desc()); 42 const GrGLProgramDescBuilder::GLKeyHeader& header = GrGLProgramDescBuilder:: GetHeader(pb->desc());
40 43
41 // emit code to read the dst copy texture, if necessary 44 // emit code to read the dst copy texture, if necessary
42 if (GrGLFragmentShaderBuilder::kNoDstRead_DstReadKey != header.fDstReadKey 45 if (GrGLFragmentShaderBuilder::kNoDstRead_DstReadKey != header.fDstReadKey
43 && !gpu->glCaps().fbFetchSupport()) { 46 && !gpu->glCaps().fbFetchSupport()) {
44 pb->fFS.emitCodeToReadDstTexture(); 47 pb->fFS.emitCodeToReadDstTexture();
(...skipping 18 matching lines...) Expand all
63 pb->fFS.enableSecondaryOutput(inputColor, inputCoverageVec4); 66 pb->fFS.enableSecondaryOutput(inputColor, inputCoverageVec4);
64 } 67 }
65 68
66 pb->fFS.combineColorAndCoverage(inputColor, inputCoverageVec4); 69 pb->fFS.combineColorAndCoverage(inputColor, inputCoverageVec4);
67 70
68 return pb->finalize(); 71 return pb->finalize();
69 } 72 }
70 73
71 GrGLProgramBuilder* 74 GrGLProgramBuilder*
72 GrGLProgramBuilder::CreateProgramBuilder(const GrOptDrawState& optState, 75 GrGLProgramBuilder::CreateProgramBuilder(const GrOptDrawState& optState,
76 GrGpu::DrawType drawType,
73 bool hasGeometryProcessor, 77 bool hasGeometryProcessor,
74 GrGpuGL* gpu) { 78 GrGpuGL* gpu) {
75 const GrProgramDesc& desc = optState.programDesc(); 79 const GrProgramDesc& desc = optState.programDesc();
76 if (GrGLProgramDescBuilder::GetHeader(desc).fUseNvpr) { 80 if (GrGLProgramDescBuilder::GetHeader(desc).fUseNvpr) {
77 SkASSERT(gpu->glCaps().pathRenderingSupport()); 81 SkASSERT(gpu->glCaps().pathRenderingSupport());
78 SkASSERT(GrProgramDesc::kAttribute_ColorInput != desc.header().fColorInp ut); 82 SkASSERT(GrProgramDesc::kAttribute_ColorInput != desc.header().fColorInp ut);
79 SkASSERT(GrProgramDesc::kAttribute_ColorInput != desc.header().fCoverage Input); 83 SkASSERT(GrProgramDesc::kAttribute_ColorInput != desc.header().fCoverage Input);
80 SkASSERT(!hasGeometryProcessor); 84 SkASSERT(!hasGeometryProcessor);
81 if (gpu->glPathRendering()->texturingMode() == 85 if (gpu->glPathRendering()->texturingMode() ==
82 GrGLPathRendering::FixedFunction_TexturingMode) { 86 GrGLPathRendering::FixedFunction_TexturingMode) {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } else if (GrProgramDesc::kAllOnes_ColorInput == header.fCoverageInput) { 227 } else if (GrProgramDesc::kAllOnes_ColorInput == header.fCoverageInput) {
224 *inputCoverage = GrGLSLExpr1(1); 228 *inputCoverage = GrGLSLExpr1(1);
225 } 229 }
226 } 230 }
227 231
228 void GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr 4* inputCoverage) { 232 void GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr 4* inputCoverage) {
229 if (fOptState.hasGeometryProcessor()) { 233 if (fOptState.hasGeometryProcessor()) {
230 fVS.setupUniformViewMatrix(); 234 fVS.setupUniformViewMatrix();
231 235
232 const GrProgramDesc::KeyHeader& header = this->header(); 236 const GrProgramDesc::KeyHeader& header = this->header();
233 fVS.codeAppend("gl_PointSize = 1.0;"); 237 if (header.fEmitsPointSize) {
238 fVS.codeAppend("gl_PointSize = 1.0;");
239 }
234 240
235 // Setup position 241 // Setup position
236 // TODO it'd be possible to remove these from the vertexshader builder a nd have them 242 // TODO it'd be possible to remove these from the vertexshader builder a nd have them
237 // be outputs from the emit call. We don't do this because emitargs is constant. It would 243 // be outputs from the emit call. We don't do this because emitargs is constant. It would
238 // be easy to change this though 244 // be easy to change this though
239 fVS.codeAppendf("vec3 %s;", fVS.glPosition()); 245 fVS.codeAppendf("vec3 %s;", fVS.glPosition());
240 fVS.codeAppendf("vec2 %s;", fVS.positionCoords()); 246 fVS.codeAppendf("vec2 %s;", fVS.positionCoords());
241 fVS.codeAppendf("vec2 %s;", fVS.localCoords()); 247 fVS.codeAppendf("vec2 %s;", fVS.localCoords());
242 248
243 const GrGeometryProcessor& gp = *fOptState.getGeometryProcessor(); 249 const GrGeometryProcessor& gp = *fOptState.getGeometryProcessor();
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } 554 }
549 555
550 //////////////////////////////////////////////////////////////////////////////// /////////////////// 556 //////////////////////////////////////////////////////////////////////////////// ///////////////////
551 557
552 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { 558 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() {
553 int numProcs = fProcs.count(); 559 int numProcs = fProcs.count();
554 for (int e = 0; e < numProcs; ++e) { 560 for (int e = 0; e < numProcs; ++e) {
555 SkDELETE(fProcs[e]); 561 SkDELETE(fProcs[e]);
556 } 562 }
557 } 563 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698