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

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

Issue 678953002: Default geometry processor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix dm bug 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
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 "GrGLNvprProgramBuilder.h" 8 #include "GrGLNvprProgramBuilder.h"
9 #include "../GrGpuGL.h" 9 #include "../GrGpuGL.h"
10 10
11 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) 11 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X)
12 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X) 12 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X)
13 13
14 GrGLNvprProgramBuilderBase::GrGLNvprProgramBuilderBase(GrGpuGL* gpu,
15 const GrOptDrawState& opt State,
16 const GrGLProgramDesc& de sc)
17 : INHERITED(gpu, optState, desc) {
18 }
19
20 GrGLProgram* GrGLNvprProgramBuilderBase::create() {
21 const GrGLProgramDesc::KeyHeader& header = this->header();
22
23 // emit code to read the dst copy texture, if necessary
24 if (GrGLFragmentShaderBuilder::kNoDstRead_DstReadKey != header.fDstReadKey
25 && !fGpu->glCaps().fbFetchSupport()) {
26 this->fFS.emitCodeToReadDstTexture();
27 }
28
29 // get the initial color and coverage to feed into the first effect in each effect chain
30 GrGLSLExpr4 inputColor, inputCoverage;
31 this->setupUniformColorAndCoverageIfNeeded(&inputColor, &inputCoverage);
32
33 // Emit fragment processors
34 fFragmentProcessors.reset(SkNEW(GrGLInstalledFragProcs));
35 int numProcs = fOptState.numFragmentStages();
36 this->emitAndInstallFragProcs(0, fOptState.numColorStages(), &inputColor);
37 this->emitAndInstallFragProcs(fOptState.numColorStages(), numProcs, &inputC overage);
38
39 // write the secondary color output if necessary
40 if (GrOptDrawState::kNone_SecondaryOutputType != header.fSecondaryOutputType ) {
41 fFS.enableSecondaryOutput(inputColor, inputCoverage);
42 }
43
44 fFS.combineColorAndCoverage(inputColor, inputCoverage);
45
46 return this->finalize();
47 }
48
49 //////////////////////////////////////////////////////////////////////////////// ////////////////////
50
14 GrGLNvprProgramBuilder::GrGLNvprProgramBuilder(GrGpuGL* gpu, 51 GrGLNvprProgramBuilder::GrGLNvprProgramBuilder(GrGpuGL* gpu,
15 const GrOptDrawState& optState, 52 const GrOptDrawState& optState,
16 const GrGLProgramDesc& desc) 53 const GrGLProgramDesc& desc)
17 : INHERITED(gpu, optState, desc) 54 : INHERITED(gpu, optState, desc)
18 , fSeparableVaryingInfos(kVarsPerBlock) { 55 , fSeparableVaryingInfos(kVarsPerBlock) {
19 } 56 }
20 57
21 void GrGLNvprProgramBuilder::emitTransforms(const GrFragmentStage& processorStag e, 58 void GrGLNvprProgramBuilder::emitTransforms(const GrFragmentStage& processorStag e,
22 GrGLProcessor::TransformedCoordsArra y* outCoords, 59 GrGLProcessor::TransformedCoordsArra y* outCoords,
23 GrGLInstalledFragProc* ifp) { 60 GrGLInstalledFragProc* ifp) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 105 }
69 } 106 }
70 107
71 GrGLProgram* GrGLNvprProgramBuilder::createProgram(GrGLuint programID) { 108 GrGLProgram* GrGLNvprProgramBuilder::createProgram(GrGLuint programID) {
72 // this is just for nvpr es, which has separable varyings that are plugged i n after 109 // this is just for nvpr es, which has separable varyings that are plugged i n after
73 // building 110 // building
74 this->resolveSeparableVaryings(programID); 111 this->resolveSeparableVaryings(programID);
75 return SkNEW_ARGS(GrGLNvprProgram, (fGpu, fDesc, fUniformHandles, programID, fUniforms, 112 return SkNEW_ARGS(GrGLNvprProgram, (fGpu, fDesc, fUniformHandles, programID, fUniforms,
76 fFragmentProcessors.get(), fSeparableVar yingInfos)); 113 fFragmentProcessors.get(), fSeparableVar yingInfos));
77 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698