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

Unified Diff: src/gpu/gl/builders/GrGLProgramBuilder.cpp

Issue 367643004: Implement NVPR on GLES (Closed) Base URL: https://skia.googlesource.com/skia.git@02-path-program-fragment
Patch Set: rebse Created 6 years, 4 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
Index: src/gpu/gl/builders/GrGLProgramBuilder.cpp
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index f4ee32b48db2579ff4b3ff9259c63d7829020690..41b84d806ab3a1b075e675acfd853f27eb2e3a2a 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -99,10 +99,13 @@ bool GrGLProgramBuilder::genProgram(const GrEffectStage* colorStages[],
GrGLProgramBuilder::GrGLProgramBuilder(GrGpuGL* gpu,
const GrGLProgramDesc& desc)
- : fFragOnly(!desc.getHeader().fHasVertexCode && gpu->shouldUseFixedFunctionTexturing())
+ : fFragOnly(!desc.getHeader().fRequiresVertexShader &&
+ gpu->glCaps().pathRenderingSupport() &&
+ gpu->glPathRendering()->texturingMode() == GrGLPathRendering::FixedFunction_TexturingMode)
, fTexCoordSetCnt(0)
, fProgramID(0)
, fFS(this, desc)
+ , fSeparableVaryingInfos(kVarsPerBlock)
, fDesc(desc)
, fGpu(gpu)
, fUniforms(kVarsPerBlock) {
@@ -304,6 +307,16 @@ void GrGLProgramBuilder::resolveProgramLocations(GrGLuint programId) {
fUniforms[i].fLocation = location;
}
}
+
+ 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;
+ }
}
const GrGLContextInfo& GrGLProgramBuilder::ctxInfo() const {
@@ -345,6 +358,18 @@ void GrGLFullProgramBuilder::addVarying(GrSLType type,
fFS.addVarying(type, fsInputName->c_str(), fsInName);
}
+GrGLFullProgramBuilder::VaryingHandle
+GrGLFullProgramBuilder::addSeparableVarying(GrSLType type,
+ const char* name,
+ const char** vsOutName,
+ const char** fsInName) {
+ addVarying(type, name, vsOutName, fsInName);
+ SeparableVaryingInfo& varying = fSeparableVaryingInfos.push_back();
+ varying.fVariable = fFS.fInputs.back();
+ return VaryingHandle::CreateFromSeparableVaryingIndex(fSeparableVaryingInfos.count() - 1);
+}
+
+
GrGLProgramEffects* GrGLFullProgramBuilder::createAndEmitEffects(
const GrEffectStage* effectStages[],
int effectCnt,
@@ -381,7 +406,7 @@ void GrGLFullProgramBuilder::bindProgramLocations(GrGLuint programId) {
GrGLFragmentOnlyProgramBuilder::GrGLFragmentOnlyProgramBuilder(GrGpuGL* gpu,
const GrGLProgramDesc& desc)
: INHERITED(gpu, desc) {
- SkASSERT(!desc.getHeader().fHasVertexCode);
+ SkASSERT(!desc.getHeader().fRequiresVertexShader);
SkASSERT(gpu->glCaps().pathRenderingSupport());
SkASSERT(GrGLProgramDesc::kAttribute_ColorInput != desc.getHeader().fColorInput);
SkASSERT(GrGLProgramDesc::kAttribute_ColorInput != desc.getHeader().fCoverageInput);

Powered by Google App Engine
This is Rietveld 408576698