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

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

Issue 582963002: Solo gp (Closed) Base URL: https://skia.googlesource.com/skia.git@no_peb
Patch Set: rebase Created 6 years, 3 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/GrGLFullProgramBuilder.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/GrGLFullProgramBuilder.cpp
diff --git a/src/gpu/gl/builders/GrGLFullProgramBuilder.cpp b/src/gpu/gl/builders/GrGLFullProgramBuilder.cpp
index dd6409e6fd33fcd31b2a35d2e0b1fe412c475fc6..46db712a96a0f00e4acd62980e70c71ec7868e58 100644
--- a/src/gpu/gl/builders/GrGLFullProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLFullProgramBuilder.cpp
@@ -10,16 +10,17 @@
#include "../GrGpuGL.h"
GrGLFullProgramBuilder::GrGLFullProgramBuilder(GrGpuGL* gpu,
- const GrGLProgramDesc& desc)
+ const GrGLProgramDesc& desc)
: INHERITED(gpu, desc)
+ , fGLGeometryProcessorEmitter(this)
, fGS(this)
, fVS(this) {
}
void
-GrGLFullProgramBuilder::createAndEmitEffects(const GrEffectStage* geometryProcessor,
- const GrEffectStage* colorStages[],
- const GrEffectStage* coverageStages[],
+GrGLFullProgramBuilder::createAndEmitEffects(const GrGeometryStage* geometryProcessor,
+ const GrFragmentStage* colorStages[],
+ const GrFragmentStage* coverageStages[],
GrGLSLExpr4* inputColor,
GrGLSLExpr4* inputCoverage) {
fVS.emitCodeBeforeEffects(inputColor, inputCoverage);
@@ -27,7 +28,6 @@ GrGLFullProgramBuilder::createAndEmitEffects(const GrEffectStage* geometryProces
///////////////////////////////////////////////////////////////////////////
// emit the per-effect code for both color and coverage effects
- bool useLocalCoords = this->getVertexShaderBuilder()->hasExplicitLocalCoords();
EffectKeyProvider colorKeyProvider(&this->desc(), EffectKeyProvider::kColor_EffectType);
fColorEffects.reset(this->onCreateAndEmitEffects(colorStages,
this->desc().numColorEffects(),
@@ -35,10 +35,15 @@ GrGLFullProgramBuilder::createAndEmitEffects(const GrEffectStage* geometryProces
inputColor));
if (geometryProcessor) {
+ const GrGeometryProcessor& gp = *geometryProcessor->getGeometryProcessor();
+ fGLGeometryProcessorEmitter.set(&gp);
+ fEffectEmitter = &fGLGeometryProcessorEmitter;
+ fVS.emitAttributes(gp);
GrGLSLExpr4 gpInputCoverage = *inputCoverage;
GrGLSLExpr4 gpOutputCoverage;
EffectKeyProvider gpKeyProvider(&this->desc(),
EffectKeyProvider::kGeometryProcessor_EffectType);
+ bool useLocalCoords = this->getVertexShaderBuilder()->hasExplicitLocalCoords();
fProgramEffects.reset(SkNEW_ARGS(GrGLVertexProgramEffects, (1, useLocalCoords)));
this->INHERITED::emitEffect(*geometryProcessor, 0, gpKeyProvider, &gpInputCoverage,
&gpOutputCoverage);
@@ -86,7 +91,7 @@ GrGLFullProgramBuilder::addSeparableVarying(GrSLType type,
}
GrGLProgramEffects* GrGLFullProgramBuilder::onCreateAndEmitEffects(
- const GrEffectStage* effectStages[],
+ const GrFragmentStage* effectStages[],
int effectCnt,
const GrGLProgramDesc::EffectKeyProvider& keyProvider,
GrGLSLExpr4* inOutFSColor) {
@@ -100,21 +105,21 @@ GrGLProgramEffects* GrGLFullProgramBuilder::onCreateAndEmitEffects(
return fProgramEffects.detach();
}
-void GrGLFullProgramBuilder::emitEffect(const GrEffectStage& stage,
- const GrEffectKey& key,
- const char* outColor,
- const char* inColor,
- int stageIndex) {
+void GrGLFullProgramBuilder::emitEffect(const GrProcessorStage& stage,
+ const GrProcessorKey& key,
+ const char* outColor,
+ const char* inColor,
+ int stageIndex) {
SkASSERT(fProgramEffects.get());
- const GrEffect& effect = *stage.getEffect();
- SkSTArray<2, GrGLEffect::TransformedCoords> coords(effect.numTransforms());
- SkSTArray<4, GrGLEffect::TextureSampler> samplers(effect.numTextures());
+ const GrProcessor& effect = *stage.getProcessor();
+ SkSTArray<2, GrGLProcessor::TransformedCoords> coords(effect.numTransforms());
+ SkSTArray<4, GrGLProcessor::TextureSampler> samplers(effect.numTextures());
- fVS.emitAttributes(stage);
this->emitTransforms(stage, &coords);
this->emitSamplers(effect, &samplers);
- GrGLEffect* glEffect = effect.getFactory().createGLInstance(effect);
+ SkASSERT(fEffectEmitter);
+ GrGLProcessor* glEffect = fEffectEmitter->createGLInstance();
fProgramEffects->addEffect(glEffect);
// Enclose custom code in a block to avoid namespace conflicts
@@ -123,22 +128,17 @@ void GrGLFullProgramBuilder::emitEffect(const GrEffectStage& stage,
fFS.codeAppend(openBrace.c_str());
fVS.codeAppend(openBrace.c_str());
- if (glEffect->isVertexEffect()) {
- GrGLGeometryProcessor* vertexEffect = static_cast<GrGLGeometryProcessor*>(glEffect);
- vertexEffect->emitCode(this, effect, key, outColor, inColor, coords, samplers);
- } else {
- glEffect->emitCode(this, effect, key, outColor, inColor, coords, samplers);
- }
+ fEffectEmitter->emit(key, outColor, inColor, coords, samplers);
fVS.codeAppend("\t}\n");
fFS.codeAppend("\t}\n");
}
-void GrGLFullProgramBuilder::emitTransforms(const GrEffectStage& effectStage,
- GrGLEffect::TransformedCoordsArray* outCoords) {
+void GrGLFullProgramBuilder::emitTransforms(const GrProcessorStage& effectStage,
+ GrGLProcessor::TransformedCoordsArray* outCoords) {
SkTArray<GrGLVertexProgramEffects::Transform, true>& transforms =
fProgramEffects->addTransforms();
- const GrEffect* effect = effectStage.getEffect();
+ const GrProcessor* effect = effectStage.getProcessor();
int numTransforms = effect->numTransforms();
transforms.push_back_n(numTransforms);
@@ -199,7 +199,7 @@ void GrGLFullProgramBuilder::emitTransforms(const GrEffectStage& effectStage,
fVS.codeAppendf("%s = %s * vec3(%s, 1);",
vsVaryingName, uniName, coords.c_str());
}
- SkNEW_APPEND_TO_TARRAY(outCoords, GrGLEffect::TransformedCoords,
+ SkNEW_APPEND_TO_TARRAY(outCoords, GrGLProcessor::TransformedCoords,
(SkString(fsVaryingName), varyingType));
}
}
« no previous file with comments | « src/gpu/gl/builders/GrGLFullProgramBuilder.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698