diff options
author | 2016-03-11 10:07:37 -0800 | |
---|---|---|
committer | 2016-03-11 10:07:37 -0800 | |
commit | 9c3f14327a38e79ab7d0cf30dfd9bf89676fde06 (patch) | |
tree | f4695cc85cf19bf471ed8c956083f2234f18d4e1 /include/gpu | |
parent | 6b563156eb7ce05b51997695ec9ab2aedcc2e6b1 (diff) |
Add support for vertex and geometry shader textures
Adds a visibility bitfield to GrTextureAccess that controls in which
shaders the texture should be accessible. Also adds caps and
validation to ensure we don't exceed texture limits.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1782583002
Review URL: https://codereview.chromium.org/1782583002
Diffstat (limited to 'include/gpu')
-rw-r--r-- | include/gpu/GrTexture.h | 6 | ||||
-rw-r--r-- | include/gpu/GrTextureAccess.h | 15 |
2 files changed, 15 insertions, 6 deletions
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h index a25c1023c8..1d589eddce 100644 --- a/include/gpu/GrTexture.h +++ b/include/gpu/GrTexture.h @@ -20,6 +20,7 @@ class GrTexture : virtual public GrSurface { public: GrTexture* asTexture() override { return this; } const GrTexture* asTexture() const override { return this; } + GrSLType samplerType() const { return fSamplerType; } /** * Return the native ID or handle to the texture, depending on the @@ -45,7 +46,7 @@ public: inline const GrTexturePriv texturePriv() const; protected: - GrTexture(GrGpu*, LifeCycle, const GrSurfaceDesc&, bool wasMipMapDataProvided); + GrTexture(GrGpu*, LifeCycle, const GrSurfaceDesc&, GrSLType, bool wasMipMapDataProvided); void validateDesc() const; @@ -59,8 +60,9 @@ private: kValid_MipMapsStatus }; + GrSLType fSamplerType; MipMapsStatus fMipMapsStatus; - int fMaxMipMapLevel; + int fMaxMipMapLevel; friend class GrTexturePriv; diff --git a/include/gpu/GrTextureAccess.h b/include/gpu/GrTextureAccess.h index 124a75aabc..1b5de0ce99 100644 --- a/include/gpu/GrTextureAccess.h +++ b/include/gpu/GrTextureAccess.h @@ -29,20 +29,26 @@ public: explicit GrTextureAccess(GrTexture*, GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode, - SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode); + SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode, + GrShaderFlags visibility = kFragment_GrShaderFlag); - void reset(GrTexture*, const GrTextureParams&); + void reset(GrTexture*, const GrTextureParams&, + GrShaderFlags visibility = kFragment_GrShaderFlag); void reset(GrTexture*, GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode, - SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode); + SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode, + GrShaderFlags visibility = kFragment_GrShaderFlag); bool operator==(const GrTextureAccess& that) const { - return this->getTexture() == that.getTexture() && fParams == that.fParams; + return this->getTexture() == that.getTexture() && + fParams == that.fParams && + fVisibility == that.fVisibility; } bool operator!=(const GrTextureAccess& other) const { return !(*this == other); } GrTexture* getTexture() const { return fTexture.get(); } + GrShaderFlags getVisibility() const { return fVisibility; } /** * For internal use by GrProcessor. @@ -57,6 +63,7 @@ private: ProgramTexture fTexture; GrTextureParams fParams; + GrShaderFlags fVisibility; typedef SkNoncopyable INHERITED; }; |