diff options
author | cdalton <cdalton@nvidia.com> | 2015-04-29 14:17:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-29 14:17:00 -0700 |
commit | 9954bc38c498f6b9e9d8c0bcc5cd00d45bfc6e23 (patch) | |
tree | f88d88bad3884d979e595a6a462e21cf89b4bdc9 /include | |
parent | dbc3cefb0b624808ddb86d444e6103f216e12fa5 (diff) |
Use texture barriers to read directly from the RT
Updates GrXferProcessor to read directly from the RT texture when
texture barriers are supported and it needs to know the dst color.
Also adds the notion of an Xfer barrier and uses it to issue texture
barriers when the XP will read the RT.
BUG=skia:
Review URL: https://codereview.chromium.org/1040303002
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrXferProcessor.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h index 411231d154..8ef897c232 100644 --- a/include/gpu/GrXferProcessor.h +++ b/include/gpu/GrXferProcessor.h @@ -48,6 +48,14 @@ enum GrBlendCoeff { }; /** + * Barriers for blending. When a shader reads the dst directly, an Xfer barrier is sometimes + * required after a pixel has been written, before it can be safely read again. + */ +enum GrXferBarrierType { + kTexture_GrXferBarrierType, //<! Required when a shader reads and renders to the same texture. +}; + +/** * GrXferProcessor is responsible for implementing the xfer mode that blends the src color and dst * color. It does this by emitting fragment shader code and controlling the fixed-function blend * state. The inputs to its shader code are the final computed src color and fractional pixel @@ -124,6 +132,14 @@ public: GrColor* overrideColor, const GrDrawTargetCaps& caps) = 0; + /** + * Returns whether this XP will require an Xfer barrier on the given rt. If true, outBarrierType + * is updated to contain the type of barrier needed. + */ + bool willNeedXferBarrier(const GrRenderTarget* rt, + const GrDrawTargetCaps& caps, + GrXferBarrierType* outBarrierType) const; + struct BlendInfo { void reset() { fSrcBlend = kOne_GrBlendCoeff; |