diff options
author | 2015-07-09 07:31:31 -0700 | |
---|---|---|
committer | 2015-07-09 07:31:32 -0700 | |
commit | 2cdec31c29a6ba1a6927b3ee2325bf53b86796aa (patch) | |
tree | db9d14da67043d156ca7e02c21e375d29946caa2 /src/gpu | |
parent | 8d3f7bde942ed42a4bbe86624f084f3d6bc37c1a (diff) |
YUV to RGB Texture threading GrProcessorDataManager
BUG=skia:
Review URL: https://codereview.chromium.org/1230803002
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrPipelineBuilder.h | 4 | ||||
-rw-r--r-- | src/gpu/SkGr.cpp | 5 | ||||
-rw-r--r-- | src/gpu/effects/GrYUVtoRGBEffect.cpp | 23 | ||||
-rw-r--r-- | src/gpu/effects/GrYUVtoRGBEffect.h | 6 |
4 files changed, 23 insertions, 15 deletions
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h index 87c2bc08bc..df384b3c25 100644 --- a/src/gpu/GrPipelineBuilder.h +++ b/src/gpu/GrPipelineBuilder.h @@ -14,6 +14,7 @@ #include "GrGpuResourceRef.h" #include "GrFragmentStage.h" #include "GrProcOptInfo.h" +#include "GrProcessorDataManager.h" #include "GrRenderTarget.h" #include "GrStencil.h" #include "GrXferProcessor.h" @@ -391,6 +392,8 @@ public: void setClip(const GrClip& clip) { fClip = clip; } const GrClip& clip() const { return fClip; } + GrProcessorDataManager* getProcessorDataManager() { return &fProcDataManager; } + private: // Calculating invariant color / coverage information is expensive, so we partially cache the // results. @@ -431,6 +434,7 @@ private: typedef SkSTArray<4, GrFragmentStage> FragmentStageArray; + GrProcessorDataManager fProcDataManager; SkAutoTUnref<GrRenderTarget> fRenderTarget; uint32_t fFlags; GrStencilSettings fStencilSettings; diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index a703146c54..5608030776 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -428,10 +428,11 @@ static GrTexture* load_yuv_texture(GrContext* ctx, const GrUniqueKey& optionalKe GrRenderTarget* renderTarget = result->asRenderTarget(); SkASSERT(renderTarget); + GrPaint paint; SkAutoTUnref<GrFragmentProcessor> - yuvToRgbProcessor(GrYUVtoRGBEffect::Create(yuvTextures[0], yuvTextures[1], yuvTextures[2], + yuvToRgbProcessor(GrYUVtoRGBEffect::Create(paint.getProcessorDataManager(), yuvTextures[0], + yuvTextures[1], yuvTextures[2], yuvInfo.fSize, yuvInfo.fColorSpace)); - GrPaint paint; paint.addColorProcessor(yuvToRgbProcessor); SkRect r = SkRect::MakeWH(SkIntToScalar(yuvInfo.fSize[0].fWidth), SkIntToScalar(yuvInfo.fSize[0].fHeight)); diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp index 92acab3725..a46cb92077 100644 --- a/src/gpu/effects/GrYUVtoRGBEffect.cpp +++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp @@ -17,9 +17,9 @@ namespace { class YUVtoRGBEffect : public GrFragmentProcessor { public: - static GrFragmentProcessor* Create(GrTexture* yTexture, GrTexture* uTexture, - GrTexture* vTexture, const SkISize sizes[3], - SkYUVColorSpace colorSpace) { + static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* yTexture, + GrTexture* uTexture, GrTexture* vTexture, + const SkISize sizes[3], SkYUVColorSpace colorSpace) { SkScalar w[3], h[3]; w[0] = SkIntToScalar(sizes[0].fWidth) / SkIntToScalar(yTexture->width()); h[0] = SkIntToScalar(sizes[0].fHeight) / SkIntToScalar(yTexture->height()); @@ -40,7 +40,7 @@ public: (sizes[2].fHeight != sizes[0].fHeight)) ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_FilterMode; - return SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture, yuvMatrix, + return SkNEW_ARGS(YUVtoRGBEffect, (procDataManager, yTexture, uTexture, vTexture, yuvMatrix, uvFilterMode, colorSpace)); } @@ -110,9 +110,9 @@ public: } private: - YUVtoRGBEffect(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture, - const SkMatrix yuvMatrix[3], GrTextureParams::FilterMode uvFilterMode, - SkYUVColorSpace colorSpace) + YUVtoRGBEffect(GrProcessorDataManager*, GrTexture* yTexture, GrTexture* uTexture, + GrTexture* vTexture, const SkMatrix yuvMatrix[3], + GrTextureParams::FilterMode uvFilterMode, SkYUVColorSpace colorSpace) : fYTransform(kLocal_GrCoordSet, yuvMatrix[0], yTexture, GrTextureParams::kNone_FilterMode) , fYAccess(yTexture) , fUTransform(kLocal_GrCoordSet, yuvMatrix[1], uTexture, uvFilterMode) @@ -166,8 +166,9 @@ const GrGLfloat YUVtoRGBEffect::GLProcessor::kRec601ConversionMatrix[16] = { ////////////////////////////////////////////////////////////////////////////// GrFragmentProcessor* -GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture, - const SkISize sizes[3], SkYUVColorSpace colorSpace) { - SkASSERT(yTexture && uTexture && vTexture && sizes); - return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, sizes, colorSpace); +GrYUVtoRGBEffect::Create(GrProcessorDataManager* procDataManager, GrTexture* yTexture, + GrTexture* uTexture, GrTexture* vTexture, const SkISize sizes[3], + SkYUVColorSpace colorSpace) { + SkASSERT(procDataManager && yTexture && uTexture && vTexture && sizes); + return YUVtoRGBEffect::Create(procDataManager, yTexture, uTexture, vTexture, sizes, colorSpace); } diff --git a/src/gpu/effects/GrYUVtoRGBEffect.h b/src/gpu/effects/GrYUVtoRGBEffect.h index 03679788dd..a7379a48d9 100644 --- a/src/gpu/effects/GrYUVtoRGBEffect.h +++ b/src/gpu/effects/GrYUVtoRGBEffect.h @@ -11,14 +11,16 @@ #include "SkImageInfo.h" class GrFragmentProcessor; +class GrProcessorDataManager; class GrTexture; namespace GrYUVtoRGBEffect { /** * Creates an effect that performs color conversion from YUV to RGB */ - GrFragmentProcessor* Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture, - const SkISize sizes[3], SkYUVColorSpace colorSpace); + GrFragmentProcessor* Create(GrProcessorDataManager*, GrTexture* yTexture, GrTexture* uTexture, + GrTexture* vTexture, const SkISize sizes[3], + SkYUVColorSpace colorSpace); }; #endif |