Expand RS vector3 types to vector4.
BUG=5609007
The underlying LLVM implementation for vector3 types does this implicitly. If
RS does not adjust its implementation, we will always be misaligned for any
subsequent data after a vector3 type. We previously inserted padding into the
reflected layers from llvm-rs-cc (hence the skip padding part of this change).
We can safely ignore the padding now that the Java/native code is updated to
use the expanded size. The compiler will also need modification to ensure that
we don't mistakenly skip over any end-of-struct padding.
Fixing the 3 component vector padding problem.
Change-Id: If68af42287deb8f4b28addcd19a9fa314656be44
diff --git a/libs/rs/rsElement.h b/libs/rs/rsElement.h
index bfdec53..04010fa 100644
--- a/libs/rs/rsElement.h
+++ b/libs/rs/rsElement.h
@@ -43,6 +43,11 @@
uint32_t getGLType() const;
uint32_t getGLFormat() const;
+ size_t getSizeBitsUnpadded() const;
+ size_t getSizeBytesUnpadded() const {
+ return (getSizeBitsUnpadded() + 7) >> 3;
+ }
+
size_t getSizeBits() const;
size_t getSizeBytes() const {
return (getSizeBits() + 7) >> 3;
@@ -55,6 +60,10 @@
return mFields[componentNumber].offsetBits >> 3;
}
+ size_t getFieldOffsetBytesUnpadded(uint32_t componentNumber) const {
+ return mFields[componentNumber].offsetBitsUnpadded >> 3;
+ }
+
uint32_t getFieldCount() const {return mFieldCount;}
const Element * getField(uint32_t idx) const {return mFields[idx].e.get();}
const char * getFieldName(uint32_t idx) const {return mFields[idx].name.string();}
@@ -64,6 +73,7 @@
RsDataType getType() const {return mComponent.getType();}
RsDataKind getKind() const {return mComponent.getKind();}
uint32_t getBits() const {return mBits;}
+ uint32_t getBitsUnpadded() const {return mBitsUnpadded;}
void dumpLOGV(const char *prefix) const;
virtual void serialize(OStream *stream) const;
@@ -112,6 +122,7 @@
String8 name;
ObjectBaseRef<const Element> e;
uint32_t offsetBits;
+ uint32_t offsetBitsUnpadded;
uint32_t arraySize;
} ElementField_t;
ElementField_t *mFields;
@@ -123,6 +134,7 @@
Element(Context *);
Component mComponent;
+ uint32_t mBitsUnpadded;
uint32_t mBits;
void compute();