summaryrefslogtreecommitdiff
path: root/libs/hwui/SkiaShader.cpp
diff options
context:
space:
mode:
author sergeyv <sergeyv@google.com> 2016-11-15 18:01:21 -0800
committer sergeyv <sergeyv@google.com> 2016-11-15 18:43:09 -0800
commit554ffeb8b7c836da43a637c59eedfc617895b19d (patch)
tree6504dca36ac62ce5ce4a1c37ad3342769e734105 /libs/hwui/SkiaShader.cpp
parentebd6c240318bd87554b274d18e15e21ba510a590 (diff)
Support hardware bitmaps in bitmap shaders
Test: hwuimacro bitmapShaderEglImage --onscreen. bug:30999911 Change-Id: I9d16a1c217a4474841794cf27ce49e3f7823678e
Diffstat (limited to 'libs/hwui/SkiaShader.cpp')
-rw-r--r--libs/hwui/SkiaShader.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/libs/hwui/SkiaShader.cpp b/libs/hwui/SkiaShader.cpp
index 971c2a314d4c..34e6a06c3dc2 100644
--- a/libs/hwui/SkiaShader.cpp
+++ b/libs/hwui/SkiaShader.cpp
@@ -58,7 +58,7 @@ static inline void bindUniformColor(int slot, FloatColor color) {
}
static inline void bindTexture(Caches* caches, Texture* texture, GLenum wrapS, GLenum wrapT) {
- caches->textureState().bindTexture(texture->id());
+ caches->textureState().bindTexture(texture->target(), texture->id());
texture->setWrapST(wrapS, wrapT);
}
@@ -218,10 +218,13 @@ bool tryStoreBitmap(Caches& caches, const SkShader& shader, const Matrix4& model
const float height = outData->bitmapTexture->height();
description->hasBitmap = true;
- if (!caches.extensions().hasNPot()
+ // gralloc doesn't support non-clamp modes
+ if (hwuiBitmap->isHardware() || (!caches.extensions().hasNPot()
&& (!isPowerOfTwo(width) || !isPowerOfTwo(height))
- && (xy[0] != SkShader::kClamp_TileMode || xy[1] != SkShader::kClamp_TileMode)) {
- description->isBitmapNpot = true;
+ && (xy[0] != SkShader::kClamp_TileMode || xy[1] != SkShader::kClamp_TileMode))) {
+ // need non-clamp mode, but it's not supported for this draw,
+ // so enable custom shader logic to mimic
+ description->useShaderBasedWrap = true;
description->bitmapWrapS = gTileModes[xy[0]];
description->bitmapWrapT = gTileModes[xy[1]];