diff options
Diffstat (limited to 'libs/rs/rsAllocation.h')
-rw-r--r-- | libs/rs/rsAllocation.h | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h index 516f8b7..5b432f2 100644 --- a/libs/rs/rsAllocation.h +++ b/libs/rs/rsAllocation.h @@ -25,13 +25,10 @@ namespace renderscript { class Program; -class Allocation : public ObjectBase -{ +class Allocation : public ObjectBase { // The graphics equilivent of malloc. The allocation contains a structure of elements. public: - // By policy this allocation will hold a pointer to the type - // but will not destroy it on destruction. Allocation(Context *rsc, const Type *); Allocation(Context *rsc, const Type *, void *bmp, void *callbackData, RsBitmapCallback_t callback); @@ -51,18 +48,29 @@ public: void uploadToTexture(const Context *rsc); uint32_t getTextureID() const {return mTextureID;} + uint32_t getGLTarget() const; + void deferedUploadToBufferObject(const Context *rsc); void uploadToBufferObject(const Context *rsc); uint32_t getBufferObjectID() const {return mBufferID;} + void copyRange1D(Context *rsc, const Allocation *src, int32_t srcOff, int32_t destOff, int32_t len); + + void resize1D(Context *rsc, uint32_t dimX); + void resize2D(Context *rsc, uint32_t dimX, uint32_t dimY); - void data(const void *data, uint32_t sizeBytes); - void subData(uint32_t xoff, uint32_t count, const void *data, uint32_t sizeBytes); - void subData(uint32_t xoff, uint32_t yoff, + void data(Context *rsc, const void *data, uint32_t sizeBytes); + void subData(Context *rsc, uint32_t xoff, uint32_t count, const void *data, uint32_t sizeBytes); + void subData(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, const void *data, uint32_t sizeBytes); - void subData(uint32_t xoff, uint32_t yoff, uint32_t zoff, + void subData(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t w, uint32_t h, uint32_t d, const void *data, uint32_t sizeBytes); + void subElementData(Context *rsc, uint32_t x, + const void *data, uint32_t elementOff, uint32_t sizeBytes); + void subElementData(Context *rsc, uint32_t x, uint32_t y, + const void *data, uint32_t elementOff, uint32_t sizeBytes); + void read(void *data); void enableGLVertexBuffers() const; @@ -72,12 +80,22 @@ public: void removeProgramToDirty(const Program *); virtual void dumpLOGV(const char *prefix) const; + virtual void serialize(OStream *stream) const; + virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_ALLOCATION; } + static Allocation *createFromStream(Context *rsc, IStream *stream); virtual void uploadCheck(const Context *rsc); -protected: + bool getIsTexture() const {return mIsTexture;} + bool getIsBufferObject() const {return mIsVertexBuffer;} + + void incRefs(const void *ptr, size_t ct, size_t startOff = 0) const; + void decRefs(const void *ptr, size_t ct, size_t startOff = 0) const; + void sendDirty() const; + bool getHasGraphicsMipmaps() const {return mTextureGenMipmap;} +protected: ObjectBaseRef<const Type> mType; void * mPtr; @@ -118,7 +136,8 @@ protected: private: void init(Context *rsc, const Type *); - + void upload2DTexture(bool isFirstUpload); + void uploadCubeTexture(bool isFirstUpload); }; } |