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

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

Issue 1186113007: Refactor separable varying location info to be stored in GrGLProgram subclass (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address review comments Created 5 years, 6 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/builders/GrGLPathProgramBuilder.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "GrGLPathProgramBuilder.h"
9 #include "gl/GrGLGpu.h"
10 #include "gl/GrGLPathProgram.h"
11
12 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X)
13 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X)
14
15 GrGLPathProgramBuilder::GrGLPathProgramBuilder(GrGLGpu* gpu, const DrawArgs& arg s)
16 : INHERITED(gpu, args)
17 , fSeparableVaryingInfos(kVarsPerBlock) {
18 }
19
20 GrGLProgram* GrGLPathProgramBuilder::createProgram(GrGLuint programID) {
21 return SkNEW_ARGS(GrGLPathProgram, (fGpu, this->desc(), fUniformHandles, pro gramID,
22 fUniforms,
23 fSeparableVaryingInfos,
24 fGeometryProcessor,
25 fXferProcessor, fFragmentProcessors.get( ),
26 &fSamplerUniforms));
27 }
28
29 GrGLProgramBuilder::SeparableVaryingHandle GrGLPathProgramBuilder::addSeparableV arying(
30 const char* name, GrGLVertToFrag* v, GrSLPrecision fsPrecision) {
31 this->addVarying(name, v, fsPrecision);
32 SeparableVaryingInfo& varyingInfo = fSeparableVaryingInfos.push_back();
33 varyingInfo.fVariable = this->getFragmentShaderBuilder()->fInputs.back();
34 varyingInfo.fLocation = fSeparableVaryingInfos.count() - 1;
35 return SeparableVaryingHandle::CreateFromSeparableVaryingIndex(varyingInfo.f Location);
36 }
37
38 void GrGLPathProgramBuilder::resolveProgramResourceLocations(GrGLuint programID) {
39 this->INHERITED::resolveProgramResourceLocations(programID);
40
41 int count = fSeparableVaryingInfos.count();
42 for (int i = 0; i < count; ++i) {
43 GrGLint location;
44 GL_CALL_RET(location,
45 GetProgramResourceLocation(programID,
46 GR_GL_FRAGMENT_INPUT,
47 fSeparableVaryingInfos[i].fVariab le.c_str()));
48 fSeparableVaryingInfos[i].fLocation = location;
49 }
50 }
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLPathProgramBuilder.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698