summaryrefslogtreecommitdiffstats
path: root/libs/rs
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2012-02-02 09:47:26 -0800
committerAlex Sakhartchouk <alexst@google.com>2012-02-02 09:47:26 -0800
commitbf3c3f2ab1067b647038170cb201cdd1a9a1c6d2 (patch)
treeb5a9129e4c9e34d1f043058c0810fc0405b51340 /libs/rs
parentbbf1bc8b6c3348265930ce08506efbbd3c5ab61f (diff)
downloadframeworks_base-bf3c3f2ab1067b647038170cb201cdd1a9a1c6d2.zip
frameworks_base-bf3c3f2ab1067b647038170cb201cdd1a9a1c6d2.tar.gz
frameworks_base-bf3c3f2ab1067b647038170cb201cdd1a9a1c6d2.tar.bz2
Fix an incorrect assert that doesn't account for element array size.
Change-Id: Ibcb5c55d91967603391a1721137d010a85025990
Diffstat (limited to 'libs/rs')
-rw-r--r--libs/rs/rsAllocation.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 972e3d6..fd85b07 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -124,7 +124,8 @@ void Allocation::elementData(Context *rsc, uint32_t x, const void *data,
}
const Element * e = mHal.state.type->getElement()->getField(cIdx);
- if (sizeBytes != e->getSizeBytes()) {
+ uint32_t elemArraySize = mHal.state.type->getElement()->getFieldArraySize(cIdx);
+ if (sizeBytes != e->getSizeBytes() * elemArraySize) {
ALOGE("Error Allocation::subElementData data size %zu does not match field size %zu.", sizeBytes, e->getSizeBytes());
rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size.");
return;
@@ -157,8 +158,8 @@ void Allocation::elementData(Context *rsc, uint32_t x, uint32_t y,
}
const Element * e = mHal.state.type->getElement()->getField(cIdx);
-
- if (sizeBytes != e->getSizeBytes()) {
+ uint32_t elemArraySize = mHal.state.type->getElement()->getFieldArraySize(cIdx);
+ if (sizeBytes != e->getSizeBytes() * elemArraySize) {
ALOGE("Error Allocation::subElementData data size %zu does not match field size %zu.", sizeBytes, e->getSizeBytes());
rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size.");
return;