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

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

Issue 647183002: Revert of Opt state takes a GP instead of a GeometryStage (Closed) Base URL: https://skia.googlesource.com/skia.git@builder_cleanup
Patch Set: Created 6 years, 2 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
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 "GrGLLegacyNvprProgramBuilder.h" 8 #include "GrGLLegacyNvprProgramBuilder.h"
9 #include "../GrGpuGL.h" 9 #include "../GrGpuGL.h"
10 10
11 GrGLLegacyNvprProgramBuilder::GrGLLegacyNvprProgramBuilder(GrGpuGL* gpu, 11 GrGLLegacyNvprProgramBuilder::GrGLLegacyNvprProgramBuilder(GrGpuGL* gpu,
12 const GrOptDrawState& optState, 12 const GrOptDrawState& optState,
13 const GrGLProgramDesc & desc) 13 const GrGLProgramDesc & desc)
14 : INHERITED(gpu, optState, desc) 14 : INHERITED(gpu, optState, desc)
15 , fTexCoordSetCnt(0) { 15 , fTexCoordSetCnt(0) {
16 SkASSERT(GrGLProgramDesc::kAttribute_ColorInput != desc.getHeader().fColorIn put); 16 SkASSERT(GrGLProgramDesc::kAttribute_ColorInput != desc.getHeader().fColorIn put);
17 SkASSERT(GrGLProgramDesc::kAttribute_ColorInput != desc.getHeader().fCoverag eInput); 17 SkASSERT(GrGLProgramDesc::kAttribute_ColorInput != desc.getHeader().fCoverag eInput);
18 } 18 }
19 19
20 int GrGLLegacyNvprProgramBuilder::addTexCoordSets(int count) { 20 int GrGLLegacyNvprProgramBuilder::addTexCoordSets(int count) {
21 int firstFreeCoordSet = fTexCoordSetCnt; 21 int firstFreeCoordSet = fTexCoordSetCnt;
22 fTexCoordSetCnt += count; 22 fTexCoordSetCnt += count;
23 SkASSERT(gpu()->glCaps().maxFixedFunctionTextureCoords() >= fTexCoordSetCnt) ; 23 SkASSERT(gpu()->glCaps().maxFixedFunctionTextureCoords() >= fTexCoordSetCnt) ;
24 return firstFreeCoordSet; 24 return firstFreeCoordSet;
25 } 25 }
26 26
27 void GrGLLegacyNvprProgramBuilder::emitTransforms(const GrFragmentStage& process orStage, 27 void GrGLLegacyNvprProgramBuilder::emitTransforms(const GrProcessorStage& proces sorStage,
28 GrGLProcessor::TransformedCoordsArra y* outCoords, 28 GrGLProcessor::TransformedCoordsArra y* outCoords,
29 GrGLInstalledFragProc* ifp) { 29 GrGLInstalledProcessors* installedPr ocessors) {
30 int numTransforms = processorStage.getProcessor()->numTransforms(); 30 int numTransforms = processorStage.getProcessor()->numTransforms();
31 int texCoordIndex = this->addTexCoordSets(numTransforms); 31 int texCoordIndex = this->addTexCoordSets(numTransforms);
32 32
33 SkTArray<GrGLInstalledProcessors::Transform, true>& transforms =
34 installedProcessors->addTransforms();
35
33 // Use the first uniform location as the texcoord index. This may seem a bi t hacky but it 36 // Use the first uniform location as the texcoord index. This may seem a bi t hacky but it
34 // allows us to use one program effects object for all of our programs which really simplifies 37 // allows us to use one program effects object for all of our programs which really simplifies
35 // the code overall 38 // the code overall
36 ifp->fTransforms.push_back_n(1); 39 transforms.push_back_n(1);
37 ifp->fTransforms[0].fHandle = GrGLInstalledFragProc::ShaderVarHandle(texCoor dIndex); 40 transforms[0].fHandle = GrGLInstalledProcessors::ShaderVarHandle(texCoordInd ex);
38 41
39 SkString name; 42 SkString name;
40 for (int t = 0; t < numTransforms; ++t) { 43 for (int t = 0; t < numTransforms; ++t) {
41 GrSLType type = processorStage.isPerspectiveCoordTransform(t, false) ? k Vec3f_GrSLType : 44 GrSLType type = processorStage.isPerspectiveCoordTransform(t, false) ? k Vec3f_GrSLType :
42 k Vec2f_GrSLType; 45 k Vec2f_GrSLType;
43 46
44 name.printf("%s(gl_TexCoord[%i])", GrGLSLTypeString(type), texCoordIndex ++); 47 name.printf("%s(gl_TexCoord[%i])", GrGLSLTypeString(type), texCoordIndex ++);
45 SkNEW_APPEND_TO_TARRAY(outCoords, GrGLProcessor::TransformedCoords, (nam e, type)); 48 SkNEW_APPEND_TO_TARRAY(outCoords, GrGLProcessor::TransformedCoords, (nam e, type));
46 } 49 }
47 } 50 }
48 51
49 GrGLProgram* GrGLLegacyNvprProgramBuilder::createProgram(GrGLuint programID) { 52 GrGLProgram* GrGLLegacyNvprProgramBuilder::createProgram(GrGLuint programID) {
50 return SkNEW_ARGS(GrGLLegacyNvprProgram, (fGpu, fDesc, fUniformHandles, prog ramID, fUniforms, 53 return SkNEW_ARGS(GrGLLegacyNvprProgram, (fGpu, fDesc, fUniformHandles, prog ramID, fUniforms,
51 fFragmentProcessors.get(), fTexCo ordSetCnt)); 54 fColorEffects, fCoverageEffects, fTexCo ordSetCnt));
52 } 55 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.h ('k') | src/gpu/gl/builders/GrGLNvprProgramBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698