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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/builders/GrGLPathProgramBuilder.cpp
diff --git a/src/gpu/gl/builders/GrGLPathProgramBuilder.cpp b/src/gpu/gl/builders/GrGLPathProgramBuilder.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c9f88cd702b3d0636585731f460c4561ab5dcd69
--- /dev/null
+++ b/src/gpu/gl/builders/GrGLPathProgramBuilder.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrGLPathProgramBuilder.h"
+#include "gl/GrGLGpu.h"
+#include "gl/GrGLPathProgram.h"
+
+#define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X)
+#define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X)
+
+GrGLPathProgramBuilder::GrGLPathProgramBuilder(GrGLGpu* gpu, const DrawArgs& args)
+ : INHERITED(gpu, args)
+ , fSeparableVaryingInfos(kVarsPerBlock) {
+}
+
+GrGLProgram* GrGLPathProgramBuilder::createProgram(GrGLuint programID) {
+ return SkNEW_ARGS(GrGLPathProgram, (fGpu, this->desc(), fUniformHandles, programID,
+ fUniforms,
+ fSeparableVaryingInfos,
+ fGeometryProcessor,
+ fXferProcessor, fFragmentProcessors.get(),
+ &fSamplerUniforms));
+}
+
+GrGLProgramBuilder::SeparableVaryingHandle GrGLPathProgramBuilder::addSeparableVarying(
+ const char* name, GrGLVertToFrag* v, GrSLPrecision fsPrecision) {
+ this->addVarying(name, v, fsPrecision);
+ SeparableVaryingInfo& varyingInfo = fSeparableVaryingInfos.push_back();
+ varyingInfo.fVariable = this->getFragmentShaderBuilder()->fInputs.back();
+ varyingInfo.fLocation = fSeparableVaryingInfos.count() - 1;
+ return SeparableVaryingHandle::CreateFromSeparableVaryingIndex(varyingInfo.fLocation);
+}
+
+void GrGLPathProgramBuilder::resolveProgramResourceLocations(GrGLuint programID) {
+ this->INHERITED::resolveProgramResourceLocations(programID);
+
+ int count = fSeparableVaryingInfos.count();
+ for (int i = 0; i < count; ++i) {
+ GrGLint location;
+ GL_CALL_RET(location,
+ GetProgramResourceLocation(programID,
+ GR_GL_FRAGMENT_INPUT,
+ fSeparableVaryingInfos[i].fVariable.c_str()));
+ fSeparableVaryingInfos[i].fLocation = location;
+ }
+}
« 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