Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 1 | /* |
Jason Sams | bc0ca6b | 2013-02-15 18:13:43 -0800 | [diff] [blame] | 2 | * Copyright (C) 2013 The Android Open Source Project |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_STRUCTURED_ALLOCATION_H |
| 18 | #define ANDROID_STRUCTURED_ALLOCATION_H |
| 19 | |
| 20 | #include "rsType.h" |
| 21 | |
Jason Sams | ddceab9 | 2013-08-07 13:02:32 -0700 | [diff] [blame] | 22 | #if !defined(RS_SERVER) && !defined(RS_COMPATIBILITY_LIB) |
Stephen Hines | 1664780 | 2013-08-15 16:28:01 -0700 | [diff] [blame] | 23 | #include <ui/GraphicBuffer.h> |
Jason Sams | ddceab9 | 2013-08-07 13:02:32 -0700 | [diff] [blame] | 24 | #include "rsGrallocConsumer.h" |
| 25 | #include "gui/CpuConsumer.h" |
| 26 | #include "gui/GLConsumer.h" |
Stephen Hines | 1664780 | 2013-08-15 16:28:01 -0700 | [diff] [blame] | 27 | #else |
| 28 | struct ANativeWindowBuffer; |
Jason Sams | ddceab9 | 2013-08-07 13:02:32 -0700 | [diff] [blame] | 29 | #endif |
| 30 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 31 | // --------------------------------------------------------------------------- |
| 32 | namespace android { |
Jason Sams | 3522f40 | 2012-03-23 11:47:26 -0700 | [diff] [blame] | 33 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 34 | namespace renderscript { |
| 35 | |
Jason Sams | 5c3e3bc | 2009-10-26 15:19:28 -0700 | [diff] [blame] | 36 | class Program; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 37 | |
Stephen Hines | 1e5149f | 2011-08-08 15:06:40 -0700 | [diff] [blame] | 38 | /***************************************************************************** |
| 39 | * CAUTION |
| 40 | * |
| 41 | * Any layout changes for this class may require a corresponding change to be |
| 42 | * made to frameworks/compile/libbcc/lib/ScriptCRT/rs_core.c, which contains |
| 43 | * a partial copy of the information below. |
| 44 | * |
| 45 | *****************************************************************************/ |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 46 | class Allocation : public ObjectBase { |
Stephen Hines | 1e5149f | 2011-08-08 15:06:40 -0700 | [diff] [blame] | 47 | // The graphics equivalent of malloc. The allocation contains a structure of elements. |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 48 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 49 | public: |
Jason Sams | 807fdc4 | 2012-07-25 17:55:39 -0700 | [diff] [blame] | 50 | const static int MAX_LOD = 16; |
Miao Wang | 47a5881 | 2015-07-23 21:59:16 -0700 | [diff] [blame] | 51 | // The mininum alignment requirement for RenderScript. Must be power of 2 and larger than 0. |
| 52 | const static size_t kMinimumRSAlignment = 16; |
Miao Wang | 7547468 | 2015-10-26 16:50:13 -0700 | [diff] [blame] | 53 | // The maximun number of Allocations that can share a single BufferQueue; |
| 54 | const static uint32_t MAX_NUM_ALLOC = 16; |
Jason Sams | 807fdc4 | 2012-07-25 17:55:39 -0700 | [diff] [blame] | 55 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 56 | struct Hal { |
| 57 | void * drv; |
| 58 | |
| 59 | struct State { |
Alex Sakhartchouk | 064aa7e | 2011-10-18 10:54:29 -0700 | [diff] [blame] | 60 | const Type * type; |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 61 | |
| 62 | uint32_t usageFlags; |
| 63 | RsAllocationMipmapControl mipmapControl; |
| 64 | |
| 65 | // Cached fields from the Type and Element |
| 66 | // to prevent pointer chasing in critical loops. |
Jason Sams | a572aca | 2013-01-09 11:52:26 -0800 | [diff] [blame] | 67 | uint32_t yuv; |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 68 | uint32_t elementSizeBytes; |
| 69 | bool hasMipmaps; |
| 70 | bool hasFaces; |
| 71 | bool hasReferences; |
Tim Murray | 2e1a94d | 2012-11-29 13:12:25 -0800 | [diff] [blame] | 72 | void * userProvidedPtr; |
Jason Sams | cf27eb4 | 2012-02-10 13:24:18 -0800 | [diff] [blame] | 73 | int32_t surfaceTextureID; |
Jason Sams | ddceab9 | 2013-08-07 13:02:32 -0700 | [diff] [blame] | 74 | ANativeWindowBuffer *nativeBuffer; |
| 75 | int64_t timestamp; |
Jason Sams | cfea6c1 | 2015-02-09 12:50:22 -0800 | [diff] [blame] | 76 | |
| 77 | // Allocation adapter state |
| 78 | const Allocation *baseAlloc; |
| 79 | uint32_t originX; |
| 80 | uint32_t originY; |
| 81 | uint32_t originZ; |
| 82 | uint32_t originLOD; |
| 83 | uint32_t originFace; |
| 84 | uint32_t originArray[Type::mMaxArrays]; |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 85 | }; |
| 86 | State state; |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 87 | |
| 88 | struct DrvState { |
Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 89 | struct LodState { |
| 90 | void * mallocPtr; |
| 91 | size_t stride; |
| 92 | uint32_t dimX; |
| 93 | uint32_t dimY; |
| 94 | uint32_t dimZ; |
| 95 | } lod[android::renderscript::Allocation::MAX_LOD]; |
| 96 | size_t faceOffset; |
| 97 | uint32_t lodCount; |
| 98 | uint32_t faceCount; |
Jason Sams | 61656a7 | 2013-09-03 16:21:18 -0700 | [diff] [blame] | 99 | |
| 100 | struct YuvState { |
| 101 | uint32_t shift; |
| 102 | uint32_t step; |
| 103 | } yuv; |
Jason Sams | e49da13 | 2014-10-23 17:32:27 -0700 | [diff] [blame] | 104 | |
| 105 | int grallocFlags; |
Jason Sams | cfea6c1 | 2015-02-09 12:50:22 -0800 | [diff] [blame] | 106 | uint32_t dimArray[Type::mMaxArrays]; |
Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 107 | }; |
| 108 | mutable DrvState drvState; |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 109 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 110 | }; |
| 111 | Hal mHal; |
| 112 | |
Tim Murray | 3468938 | 2013-03-11 12:12:03 -0700 | [diff] [blame] | 113 | void operator delete(void* ptr); |
| 114 | |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 115 | static Allocation * createAllocation(Context *rsc, const Type *, uint32_t usages, |
Jason Sams | 179e9a4 | 2011-11-23 15:02:15 -0800 | [diff] [blame] | 116 | RsAllocationMipmapControl mc = RS_ALLOCATION_MIPMAP_NONE, |
| 117 | void *ptr = 0); |
Miao Wang | 47a5881 | 2015-07-23 21:59:16 -0700 | [diff] [blame] | 118 | static Allocation * createAllocationStrided(Context *rsc, const Type *, uint32_t usages, |
| 119 | RsAllocationMipmapControl mc = RS_ALLOCATION_MIPMAP_NONE, |
| 120 | void *ptr = 0, size_t byteAligned = 16); |
Jason Sams | cfea6c1 | 2015-02-09 12:50:22 -0800 | [diff] [blame] | 121 | static Allocation * createAdapter(Context *rsc, const Allocation *alloc, const Type *type); |
| 122 | |
| 123 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 124 | virtual ~Allocation(); |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 125 | void updateCache(); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 126 | |
Alex Sakhartchouk | 064aa7e | 2011-10-18 10:54:29 -0700 | [diff] [blame] | 127 | const Type * getType() const {return mHal.state.type;} |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 128 | |
Jason Sams | 366c9c8 | 2010-12-08 16:14:36 -0800 | [diff] [blame] | 129 | void syncAll(Context *rsc, RsAllocationUsageType src); |
| 130 | |
Jason Sams | 96abf81 | 2010-10-05 13:32:49 -0700 | [diff] [blame] | 131 | void copyRange1D(Context *rsc, const Allocation *src, int32_t srcOff, int32_t destOff, int32_t len); |
| 132 | |
| 133 | void resize1D(Context *rsc, uint32_t dimX); |
| 134 | void resize2D(Context *rsc, uint32_t dimX, uint32_t dimY); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 135 | |
Stephen Hines | 6ae039b | 2012-01-18 18:46:27 -0800 | [diff] [blame] | 136 | void data(Context *rsc, uint32_t xoff, uint32_t lod, uint32_t count, const void *data, size_t sizeBytes); |
Jason Sams | 4b45b89 | 2010-12-29 14:31:29 -0800 | [diff] [blame] | 137 | void data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face, |
Tim Murray | 358747a | 2012-11-26 13:52:04 -0800 | [diff] [blame] | 138 | uint32_t w, uint32_t h, const void *data, size_t sizeBytes, size_t stride); |
Jason Sams | 3bbc0fd | 2013-04-09 14:16:13 -0700 | [diff] [blame] | 139 | void data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod, |
| 140 | uint32_t w, uint32_t h, uint32_t d, const void *data, size_t sizeBytes, size_t stride); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 141 | |
Jason Sams | 807fdc4 | 2012-07-25 17:55:39 -0700 | [diff] [blame] | 142 | void read(Context *rsc, uint32_t xoff, uint32_t lod, uint32_t count, void *data, size_t sizeBytes); |
Tim Murray | 358747a | 2012-11-26 13:52:04 -0800 | [diff] [blame] | 143 | void read(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face, |
| 144 | uint32_t w, uint32_t h, void *data, size_t sizeBytes, size_t stride); |
Jason Sams | 3bbc0fd | 2013-04-09 14:16:13 -0700 | [diff] [blame] | 145 | void read(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod, |
| 146 | uint32_t w, uint32_t h, uint32_t d, void *data, size_t sizeBytes, size_t stride); |
Jason Sams | 807fdc4 | 2012-07-25 17:55:39 -0700 | [diff] [blame] | 147 | |
Miao Wang | cc8cea7 | 2015-02-19 18:14:46 -0800 | [diff] [blame] | 148 | void elementData(Context *rsc, uint32_t x, uint32_t y, uint32_t z, |
Stephen Hines | 6ae039b | 2012-01-18 18:46:27 -0800 | [diff] [blame] | 149 | const void *data, uint32_t elementOff, size_t sizeBytes); |
Miao Wang | cc8cea7 | 2015-02-19 18:14:46 -0800 | [diff] [blame] | 150 | |
| 151 | void elementRead(Context *rsc, uint32_t x, uint32_t y, uint32_t z, |
| 152 | void *data, uint32_t elementOff, size_t sizeBytes); |
Jason Sams | 5f0c84c | 2010-08-31 13:50:42 -0700 | [diff] [blame] | 153 | |
Jason Sams | 5c3e3bc | 2009-10-26 15:19:28 -0700 | [diff] [blame] | 154 | void addProgramToDirty(const Program *); |
| 155 | void removeProgramToDirty(const Program *); |
Jason Sams | e5ffb87 | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 156 | |
Jason Sams | c21cf40 | 2009-11-17 17:26:46 -0800 | [diff] [blame] | 157 | virtual void dumpLOGV(const char *prefix) const; |
Jason Sams | e3150cf | 2012-07-24 18:10:20 -0700 | [diff] [blame] | 158 | virtual void serialize(Context *rsc, OStream *stream) const; |
Alex Sakhartchouk | b825f67 | 2010-06-04 10:06:50 -0700 | [diff] [blame] | 159 | virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_ALLOCATION; } |
Alex Sakhartchouk | fb6b614 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 160 | static Allocation *createFromStream(Context *rsc, IStream *stream); |
Jason Sams | c21cf40 | 2009-11-17 17:26:46 -0800 | [diff] [blame] | 161 | |
Jason Sams | b89b0b7 | 2010-12-13 17:11:21 -0800 | [diff] [blame] | 162 | bool getIsScript() const { |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 163 | return (mHal.state.usageFlags & RS_ALLOCATION_USAGE_SCRIPT) != 0; |
Jason Sams | b89b0b7 | 2010-12-13 17:11:21 -0800 | [diff] [blame] | 164 | } |
Jason Sams | ebc5019 | 2010-12-13 15:32:35 -0800 | [diff] [blame] | 165 | bool getIsTexture() const { |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 166 | return (mHal.state.usageFlags & RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE) != 0; |
Jason Sams | ebc5019 | 2010-12-13 15:32:35 -0800 | [diff] [blame] | 167 | } |
Alex Sakhartchouk | 7d9c5ff | 2011-04-01 14:19:01 -0700 | [diff] [blame] | 168 | bool getIsRenderTarget() const { |
| 169 | return (mHal.state.usageFlags & RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET) != 0; |
| 170 | } |
Jason Sams | ebc5019 | 2010-12-13 15:32:35 -0800 | [diff] [blame] | 171 | bool getIsBufferObject() const { |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 172 | return (mHal.state.usageFlags & RS_ALLOCATION_USAGE_GRAPHICS_VERTEX) != 0; |
Jason Sams | ebc5019 | 2010-12-13 15:32:35 -0800 | [diff] [blame] | 173 | } |
Jason Sams | 760f1f7 | 2010-06-25 12:45:41 -0700 | [diff] [blame] | 174 | |
Jason Sams | 96abf81 | 2010-10-05 13:32:49 -0700 | [diff] [blame] | 175 | void incRefs(const void *ptr, size_t ct, size_t startOff = 0) const; |
| 176 | void decRefs(const void *ptr, size_t ct, size_t startOff = 0) const; |
Jason Sams | a36c50a | 2014-06-17 12:06:06 -0700 | [diff] [blame] | 177 | virtual void callUpdateCacheObject(const Context *rsc, void *dstObj) const; |
Jason Sams | c7cec1e | 2011-08-18 18:01:33 -0700 | [diff] [blame] | 178 | virtual bool freeChildren(); |
Jason Sams | e3929c9 | 2010-08-09 18:13:33 -0700 | [diff] [blame] | 179 | |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 180 | void sendDirty(const Context *rsc) const; |
Jason Sams | b89b0b7 | 2010-12-13 17:11:21 -0800 | [diff] [blame] | 181 | bool getHasGraphicsMipmaps() const { |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 182 | return mHal.state.mipmapControl != RS_ALLOCATION_MIPMAP_NONE; |
Jason Sams | b89b0b7 | 2010-12-13 17:11:21 -0800 | [diff] [blame] | 183 | } |
| 184 | |
Miao Wang | 7547468 | 2015-10-26 16:50:13 -0700 | [diff] [blame] | 185 | void setupGrallocConsumer(const Context *rsc, uint32_t numAlloc); |
| 186 | void shareBufferQueue(const Context *rsc, const Allocation *alloc); |
Jason Sams | 733396b | 2013-02-22 12:46:18 -0800 | [diff] [blame] | 187 | void * getSurface(const Context *rsc); |
Jason Sams | 7ac2a4d | 2012-02-15 12:04:24 -0800 | [diff] [blame] | 188 | void setSurface(const Context *rsc, RsNativeWindow sur); |
| 189 | void ioSend(const Context *rsc); |
| 190 | void ioReceive(const Context *rsc); |
Miao Wang | 7547468 | 2015-10-26 16:50:13 -0700 | [diff] [blame] | 191 | int64_t getTimeStamp() {return mHal.state.timestamp;} |
Jason Sams | 5c3e3bc | 2009-10-26 15:19:28 -0700 | [diff] [blame] | 192 | |
Jason Sams | 442b7ff | 2015-03-06 16:50:11 -0800 | [diff] [blame] | 193 | void adapterOffset(Context *rsc, const uint32_t *offsets, size_t len); |
| 194 | |
Jason Sams | b8a94e2 | 2014-02-24 17:52:32 -0800 | [diff] [blame] | 195 | void * getPointer(const Context *rsc, uint32_t lod, RsAllocationCubemapFace face, |
| 196 | uint32_t z, uint32_t array, size_t *stride); |
| 197 | |
Jason Sams | c0d6847 | 2015-01-20 14:29:52 -0800 | [diff] [blame] | 198 | void * getPointerUnchecked(uint32_t x, uint32_t y, |
| 199 | uint32_t z = 0, uint32_t lod = 0, |
| 200 | RsAllocationCubemapFace face = RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X, |
| 201 | uint32_t a1 = 0, uint32_t a2 = 0, uint32_t a3 = 0, uint32_t a4 = 0) const { |
| 202 | |
| 203 | uint8_t * p = (uint8_t *) mHal.drvState.lod[lod].mallocPtr; |
| 204 | p += x * getType()->getElementSizeBytes(); |
| 205 | p += y * mHal.drvState.lod[lod].stride; |
| 206 | p += z * mHal.drvState.lod[lod].stride * mHal.drvState.lod[lod].dimY; |
| 207 | |
| 208 | // Todo: arrays |
| 209 | |
| 210 | return p; |
| 211 | } |
| 212 | |
Chris Wailes | 4b3c34e | 2014-06-11 12:00:29 -0700 | [diff] [blame] | 213 | bool hasSameDims(const Allocation *Other) const; |
| 214 | |
Alex Sakhartchouk | 1e5168d | 2010-09-01 16:34:48 -0700 | [diff] [blame] | 215 | protected: |
Yang Ni | b8353c5 | 2015-02-14 18:00:59 -0800 | [diff] [blame] | 216 | Vector<const Program *> mToDirtyList; |
Alex Sakhartchouk | 064aa7e | 2011-10-18 10:54:29 -0700 | [diff] [blame] | 217 | ObjectBaseRef<const Type> mType; |
| 218 | void setType(const Type *t) { |
| 219 | mType.set(t); |
| 220 | mHal.state.type = t; |
| 221 | } |
Jason Sams | 5c3e3bc | 2009-10-26 15:19:28 -0700 | [diff] [blame] | 222 | |
Miao Wang | 6223721 | 2017-02-27 15:19:36 -0800 | [diff] [blame^] | 223 | #ifndef RS_COMPATIBILITY_LIB |
Jason Sams | ddceab9 | 2013-08-07 13:02:32 -0700 | [diff] [blame] | 224 | class NewBufferListener : public android::ConsumerBase::FrameAvailableListener { |
| 225 | public: |
Chih-Hung Hsieh | 10ab8bb | 2016-07-01 12:20:20 -0700 | [diff] [blame] | 226 | explicit NewBufferListener(uint32_t numAlloc); |
Miao Wang | 7547468 | 2015-10-26 16:50:13 -0700 | [diff] [blame] | 227 | virtual ~NewBufferListener(); |
Jason Sams | ddceab9 | 2013-08-07 13:02:32 -0700 | [diff] [blame] | 228 | const android::renderscript::Context *rsc; |
Miao Wang | 7547468 | 2015-10-26 16:50:13 -0700 | [diff] [blame] | 229 | const android::renderscript::Allocation **alloc; |
Jason Sams | ddceab9 | 2013-08-07 13:02:32 -0700 | [diff] [blame] | 230 | |
Dan Stoza | f0d7aa2 | 2014-11-04 11:38:47 -0800 | [diff] [blame] | 231 | virtual void onFrameAvailable(const BufferItem& item); |
Miao Wang | 7547468 | 2015-10-26 16:50:13 -0700 | [diff] [blame] | 232 | private: |
| 233 | uint32_t mNumAlloc; |
Jason Sams | ddceab9 | 2013-08-07 13:02:32 -0700 | [diff] [blame] | 234 | }; |
| 235 | |
| 236 | sp<NewBufferListener> mBufferListener; |
| 237 | sp< GrallocConsumer > mGrallocConsumer; |
Miao Wang | 7547468 | 2015-10-26 16:50:13 -0700 | [diff] [blame] | 238 | sp<IGraphicBufferProducer> mGraphicBufferProducer; |
| 239 | bool mBufferQueueInited = false; |
| 240 | uint32_t mCurrentIdx; |
Jason Sams | ddceab9 | 2013-08-07 13:02:32 -0700 | [diff] [blame] | 241 | #endif |
| 242 | |
| 243 | |
Jason Sams | fa84da2 | 2010-03-01 15:31:04 -0800 | [diff] [blame] | 244 | private: |
Jason Sams | c7cec1e | 2011-08-18 18:01:33 -0700 | [diff] [blame] | 245 | void freeChildrenUnlocked(); |
Jason Sams | 179e9a4 | 2011-11-23 15:02:15 -0800 | [diff] [blame] | 246 | Allocation(Context *rsc, const Type *, uint32_t usages, RsAllocationMipmapControl mc, void *ptr); |
Jason Sams | cfea6c1 | 2015-02-09 12:50:22 -0800 | [diff] [blame] | 247 | Allocation(Context *rsc, const Allocation *, const Type *); |
Alex Sakhartchouk | 2d1220c | 2011-11-15 15:15:21 -0800 | [diff] [blame] | 248 | |
| 249 | uint32_t getPackedSize() const; |
Jason Sams | 807fdc4 | 2012-07-25 17:55:39 -0700 | [diff] [blame] | 250 | static void writePackedData(Context *rsc, const Type *type, uint8_t *dst, |
| 251 | const uint8_t *src, bool dstPadded); |
Jason Sams | e3150cf | 2012-07-24 18:10:20 -0700 | [diff] [blame] | 252 | void unpackVec3Allocation(Context *rsc, const void *data, size_t dataSize); |
| 253 | void packVec3Allocation(Context *rsc, OStream *stream) const; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 254 | }; |
| 255 | |
Rahul Chaudhry | 7974fc0 | 2017-02-09 12:33:28 -0800 | [diff] [blame] | 256 | } // namespace renderscript |
| 257 | } // namespace android |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 258 | #endif |