diff options
author | 2014-12-04 06:00:41 -0800 | |
---|---|---|
committer | 2014-12-04 06:00:41 -0800 | |
commit | 841a6b54c11137e210aa81e8b56e1763c3571cb8 (patch) | |
tree | fac39d5628255390df36a6fc7def7b4d13d8f30d /src/gpu/gl | |
parent | b8eb85cd2fae475f17b713b6739ede545a78f647 (diff) |
Revert of create and thread batch tracker object (patchset #9 id:160001 of https://codereview.chromium.org/772513002/)
Reason for revert:
Breaking linux layout test
Original issue's description:
> create and thread batch tracker object
>
> I remove the factory on the next CL
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/c3a6eb23483e5d28073b509a5f637f41660de294
TBR=bsalomon@google.com,joshualitt@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/774133003
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/GrGLGeometryProcessor.h | 13 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProcessor.h | 23 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProgram.cpp | 3 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProgramDesc.cpp | 8 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLProgramBuilder.cpp | 5 |
5 files changed, 17 insertions, 35 deletions
diff --git a/src/gpu/gl/GrGLGeometryProcessor.h b/src/gpu/gl/GrGLGeometryProcessor.h index a172904ac6..c3bee95266 100644 --- a/src/gpu/gl/GrGLGeometryProcessor.h +++ b/src/gpu/gl/GrGLGeometryProcessor.h @@ -10,7 +10,6 @@ #include "GrGLProcessor.h" -class GrBatchTracker; class GrGLGPBuilder; /** @@ -26,19 +25,16 @@ public: struct EmitArgs { EmitArgs(GrGLGPBuilder* pb, const GrGeometryProcessor& gp, - const GrBatchTracker& bt, const char* outputColor, const char* outputCoverage, const TextureSamplerArray& samplers) : fPB(pb) , fGP(gp) - , fBT(bt) , fOutputColor(outputColor) , fOutputCoverage(outputCoverage) , fSamplers(samplers) {} GrGLGPBuilder* fPB; const GrGeometryProcessor& fGP; - const GrBatchTracker& fBT; const char* fOutputColor; const char* fOutputCoverage; const TextureSamplerArray& fSamplers; @@ -49,15 +45,6 @@ public: */ virtual void emitCode(const EmitArgs&) = 0; - /** A GrGLGeometryProcessor instance can be reused with any GrGLGeometryProcessor that produces - the same stage key; this function reads data from a GrGLGeometryProcessor and uploads any - uniform variables required by the shaders created in emitCode(). The GrGeometryProcessor - parameter is guaranteed to be of the same type that created this GrGLGeometryProcessor and - to have an identical processor key as the one that created this GrGLGeometryProcessor. */ - virtual void setData(const GrGLProgramDataManager&, - const GrGeometryProcessor&, - const GrBatchTracker&) = 0; - private: typedef GrGLProcessor INHERITED; }; diff --git a/src/gpu/gl/GrGLProcessor.h b/src/gpu/gl/GrGLProcessor.h index 6401e2b324..ca4fa2459f 100644 --- a/src/gpu/gl/GrGLProcessor.h +++ b/src/gpu/gl/GrGLProcessor.h @@ -22,7 +22,7 @@ that their GrGLProcessors would emit the same GLSL code. The GrGLProcessor subclass must also have a constructor of the form: - ProcessorSubclass::ProcessorSubclass(const GrBackendProcessorFactory&, const GrProcessor&) + EffectSubclass::EffectSubclass(const GrBackendProcessorFactory&, const GrProcessor&) These objects are created by the factory object returned by the GrProcessor::getFactory(). */ @@ -70,6 +70,13 @@ public: virtual ~GrGLProcessor() {} + /** A GrGLProcessor instance can be reused with any GrProcessor that produces the same stage + key; this function reads data from a GrProcessor and uploads any uniform variables required + by the shaders created in emitCode(). The GrProcessor parameter is guaranteed to be of the + same type that created this GrGLProcessor and to have an identical effect key as the one + that created this GrGLProcessor. */ + virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {} + const char* name() const { return fFactory.name(); } static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*) {} @@ -93,7 +100,7 @@ public: stages. @param builder Interface used to emit code in the shaders. - @param processor The processor that generated this program stage. + @param effect The effect that generated this program stage. @param key The key that was computed by GenKey() from the generating GrProcessor. @param outputColor A predefined vec4 in the FS in which the stage should place its output color (or coverage). @@ -101,27 +108,19 @@ public: NULL in which case the implied input is solid white (all ones). TODO: Better system for communicating optimization info (e.g. input color is solid white, trans black, known to be opaque, etc.) that allows - the processor to communicate back similar known info about its output. + the effect to communicate back similar known info about its output. @param samplers Contains one entry for each GrTextureAccess of the GrProcessor. These can be passed to the builder to emit texture reads in the generated code. TODO this should take a struct */ virtual void emitCode(GrGLFPBuilder* builder, - const GrFragmentProcessor&, + const GrFragmentProcessor& effect, const char* outputColor, const char* inputColor, const TransformedCoordsArray& coords, const TextureSamplerArray& samplers) = 0; - /** A GrGLFragmentProcessor instance can be reused with any GrFragmentProcessor that produces - the same stage key; this function reads data from a GrFragmentProcessor and uploads any - uniform variables required by the shaders created in emitCode(). The GrFragmentProcessor - parameter is guaranteed to be of the same type that created this GrGLFragmentProcessor and - to have an identical processor key as the one that created this GrGLFragmentProcessor. */ - // TODO update this to pass in GrFragmentProcessor - virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {} - private: typedef GrGLProcessor INHERITED; }; diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index 29c44ac56c..3b04edb8c8 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -158,8 +158,7 @@ void GrGLProgram::setData(const GrOptDrawState& optState) { if (fGeometryProcessor.get()) { SkASSERT(optState.hasGeometryProcessor()); const GrGeometryProcessor& gp = *optState.getGeometryProcessor(); - const GrBatchTracker& bt = optState.getBatchTracker(); - fGeometryProcessor->fGLProc->setData(fProgramDataManager, gp, bt); + fGeometryProcessor->fGLProc->setData(fProgramDataManager, gp); this->bindTextures(fGeometryProcessor, gp); } this->setFragmentData(optState); diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp index 474f7026e4..f8dbbc26f9 100644 --- a/src/gpu/gl/GrGLProgramDesc.cpp +++ b/src/gpu/gl/GrGLProgramDesc.cpp @@ -123,6 +123,9 @@ static bool get_meta_key(const GrProcessor& proc, uint32_t transformKey, uint32_t attribKey, GrProcessorKeyBuilder* b) { + const GrBackendProcessorFactory& factory = proc.getFactory(); + factory.getGLProcessorKey(proc, caps, b); + size_t processorKeySize = b->size(); uint32_t textureKey = gen_texture_key(proc, caps); uint32_t classID = proc.getFactory().classID(); @@ -167,8 +170,6 @@ bool GrGLProgramDescBuilder::Build(const GrOptDrawState& optState, if (optState.hasGeometryProcessor()) { const GrGeometryProcessor& gp = *optState.getGeometryProcessor(); GrProcessorKeyBuilder b(&desc->fKey); - const GrBackendGeometryProcessorFactory& factory = gp.getFactory(); - factory.getGLProcessorKey(gp, optState.getBatchTracker(), gpu->glCaps(), &b); if (!get_meta_key(gp, gpu->glCaps(), 0, gen_attrib_key(gp), &b)) { desc->fKey.reset(); return false; @@ -177,10 +178,7 @@ bool GrGLProgramDescBuilder::Build(const GrOptDrawState& optState, for (int s = 0; s < optState.numFragmentStages(); ++s) { const GrPendingFragmentStage& fps = optState.getFragmentStage(s); - const GrFragmentProcessor& fp = *fps.getProcessor(); GrProcessorKeyBuilder b(&desc->fKey); - const GrBackendFragmentProcessorFactory& factory = fp.getFactory(); - factory.getGLProcessorKey(fp, gpu->glCaps(), &b); if (!get_meta_key(*fps.getProcessor(), gpu->glCaps(), gen_transform_key(fps, requiresLocalCoordAttrib), 0, &b)) { desc->fKey.reset(); diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index 2f4329ae04..aa9e40c3f2 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -359,13 +359,12 @@ void GrGLProgramBuilder::emitAndInstallProc(const GrGeometryProcessor& gp, SkASSERT(!fGeometryProcessor); fGeometryProcessor = SkNEW(GrGLInstalledGeoProc); - const GrBatchTracker& bt = fOptState.getBatchTracker(); - fGeometryProcessor->fGLProc.reset(gp.getFactory().createGLInstance(gp, bt)); + fGeometryProcessor->fGLProc.reset(gp.getFactory().createGLInstance(gp)); SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures()); this->emitSamplers(gp, &samplers, fGeometryProcessor); - GrGLGeometryProcessor::EmitArgs args(this, gp, bt, outColor, outCoverage, samplers); + GrGLGeometryProcessor::EmitArgs args(this, gp, outColor, outCoverage, samplers); fGeometryProcessor->fGLProc->emitCode(args); // We have to check that effects and the code they emit are consistent, ie if an effect |