diff options
Diffstat (limited to '9/platforms/android-19/arch-x86/usr/include')
59 files changed, 0 insertions, 7129 deletions
diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/cpp/rsCppInternal.h b/9/platforms/android-19/arch-x86/usr/include/rs/cpp/rsCppInternal.h deleted file mode 100644 index ae43d47..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/cpp/rsCppInternal.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_CPP_INTERNAL_H -#define ANDROID_RS_CPP_INTERNAL_H - -#define LOG_TAG "rsC++" -#include "rsCppUtils.h" - -#define tryDispatch(rs, dispatch) \ - if (rs->getError() == RS_SUCCESS) { \ - dispatch; \ - } - -#define createDispatch(rs, dispatch) \ - rs->getError() == RS_SUCCESS ? dispatch : NULL - -#undef LOG_TAG -#undef LOG_NDEBUG -#define LOG_NDEBUG 0 -#define LOG_TAG "rsC++" - -#endif diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rs.h b/9/platforms/android-19/arch-x86/usr/include/rs/rs.h deleted file mode 100644 index 566d9ea..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rs.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RENDER_SCRIPT_H -#define RENDER_SCRIPT_H - -#include <stdint.h> -#include <sys/types.h> - -#include "rsDefines.h" - -// Legacy graphics functions -// Not extern C because not used from C++ API -RsObjectBase rsaFileA3DGetEntryByIndex(RsContext, uint32_t idx, RsFile); -RsFile rsaFileA3DCreateFromMemory(RsContext, const void *data, uint32_t len); -RsFile rsaFileA3DCreateFromAsset(RsContext, void *asset); -RsFile rsaFileA3DCreateFromFile(RsContext, const char *path); -void rsaFileA3DGetNumIndexEntries(RsContext, int32_t *numEntries, RsFile); -void rsaFileA3DGetIndexEntries(RsContext, RsFileIndexEntry *fileEntries, - uint32_t numEntries, RsFile); -// Mesh update functions -void rsaMeshGetVertexBufferCount(RsContext, RsMesh, int32_t *vtxCount); -void rsaMeshGetIndexCount(RsContext, RsMesh, int32_t *idxCount); -void rsaMeshGetVertices(RsContext, RsMesh, RsAllocation *vtxData, uint32_t vtxDataCount); -void rsaMeshGetIndices(RsContext, RsMesh, RsAllocation *va, - uint32_t *primType, uint32_t idxDataCount); -RsContext rsContextCreateGL(RsDevice dev, uint32_t version, uint32_t sdkVersion, - RsSurfaceConfig sc, uint32_t dpi); - -extern "C" { - void rsaGetName(RsContext, void * obj, const char **name); - // Allocation update - const void* rsaAllocationGetType(RsContext con, RsAllocation va); - // Type update - void rsaTypeGetNativeData(RsContext, RsType, uint32_t *typeData, uint32_t typeDataSize); - // Element update - void rsaElementGetNativeData(RsContext, RsElement, uint32_t *elemData, uint32_t elemDataSize); - void rsaElementGetSubElements(RsContext, RsElement, uint32_t *ids, const char **names, - uint32_t *arraySizes, uint32_t dataSize); - - RsDevice rsDeviceCreate(); - void rsDeviceDestroy(RsDevice dev); - void rsDeviceSetConfig(RsDevice dev, RsDeviceParam p, int32_t value); - RsContext rsContextCreate(RsDevice dev, uint32_t version, uint32_t sdkVersion, - RsContextType ct, uint32_t flags); -} -#include "rsgApiFuncDecl.h" - -#endif // RENDER_SCRIPT_H - - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rs.spec b/9/platforms/android-19/arch-x86/usr/include/rs/rs.spec deleted file mode 100644 index d765866..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rs.spec +++ /dev/null @@ -1,401 +0,0 @@ - -ContextDestroy { - direct -} - -ContextGetMessage { - direct - param void *data - param size_t *receiveLen - param uint32_t *usrID - ret RsMessageToClientType -} - -ContextPeekMessage { - direct - param size_t *receiveLen - param uint32_t *usrID - ret RsMessageToClientType -} - -ContextSendMessage { - param uint32_t id - param const uint8_t *data -} - -ContextInitToClient { - direct -} - -ContextDeinitToClient { - direct -} - -TypeCreate { - direct - param RsElement e - param uint32_t dimX - param uint32_t dimY - param uint32_t dimZ - param bool mipmaps - param bool faces - param uint32_t yuv - ret RsType -} - -AllocationCreateTyped { - direct - param RsType vtype - param RsAllocationMipmapControl mipmaps - param uint32_t usages - param uintptr_t ptr - ret RsAllocation -} - -AllocationCreateFromBitmap { - direct - param RsType vtype - param RsAllocationMipmapControl mipmaps - param const void *data - param uint32_t usages - ret RsAllocation -} - -AllocationCubeCreateFromBitmap { - direct - param RsType vtype - param RsAllocationMipmapControl mipmaps - param const void *data - param uint32_t usages - ret RsAllocation -} - -AllocationGetSurface { - param RsAllocation alloc - sync - ret RsNativeWindow -} - -AllocationSetSurface { - param RsAllocation alloc - param RsNativeWindow sur - sync - } - -ContextFinish { - sync - } - -ContextDump { - param int32_t bits -} - -ContextSetPriority { - param int32_t priority - } - -ContextDestroyWorker { - sync -} - -AssignName { - param RsObjectBase obj - param const char *name - } - -ObjDestroy { - param RsAsyncVoidPtr objPtr - } - -ElementCreate { - direct - param RsDataType mType - param RsDataKind mKind - param bool mNormalized - param uint32_t mVectorSize - ret RsElement - } - -ElementCreate2 { - direct - param const RsElement * elements - param const char ** names - param const uint32_t * arraySize - ret RsElement - } - -AllocationCopyToBitmap { - param RsAllocation alloc - param void * data - } - - -Allocation1DData { - param RsAllocation va - param uint32_t xoff - param uint32_t lod - param uint32_t count - param const void *data - } - -Allocation1DElementData { - param RsAllocation va - param uint32_t x - param uint32_t lod - param const void *data - param size_t comp_offset - } - -Allocation2DData { - param RsAllocation va - param uint32_t xoff - param uint32_t yoff - param uint32_t lod - param RsAllocationCubemapFace face - param uint32_t w - param uint32_t h - param const void *data - param size_t stride - } - -Allocation3DData { - param RsAllocation va - param uint32_t xoff - param uint32_t yoff - param uint32_t zoff - param uint32_t lod - param uint32_t w - param uint32_t h - param uint32_t d - param const void *data - param size_t stride - } - -AllocationGenerateMipmaps { - param RsAllocation va -} - -AllocationRead { - param RsAllocation va - param void * data - } - -Allocation1DRead { - param RsAllocation va - param uint32_t xoff - param uint32_t lod - param uint32_t count - param void *data - } - -Allocation2DRead { - param RsAllocation va - param uint32_t xoff - param uint32_t yoff - param uint32_t lod - param RsAllocationCubemapFace face - param uint32_t w - param uint32_t h - param void *data - param size_t stride -} - - -AllocationSyncAll { - param RsAllocation va - param RsAllocationUsageType src -} - -AllocationResize1D { - param RsAllocation va - param uint32_t dimX - } - -AllocationCopy2DRange { - param RsAllocation dest - param uint32_t destXoff - param uint32_t destYoff - param uint32_t destMip - param uint32_t destFace - param uint32_t width - param uint32_t height - param RsAllocation src - param uint32_t srcXoff - param uint32_t srcYoff - param uint32_t srcMip - param uint32_t srcFace - } - -AllocationCopy3DRange { - param RsAllocation dest - param uint32_t destXoff - param uint32_t destYoff - param uint32_t destZoff - param uint32_t destMip - param uint32_t width - param uint32_t height - param uint32_t depth - param RsAllocation src - param uint32_t srcXoff - param uint32_t srcYoff - param uint32_t srcZoff - param uint32_t srcMip - } - - -SamplerCreate { - direct - param RsSamplerValue magFilter - param RsSamplerValue minFilter - param RsSamplerValue wrapS - param RsSamplerValue wrapT - param RsSamplerValue wrapR - param float mAniso - ret RsSampler -} - -ScriptBindAllocation { - param RsScript vtm - param RsAllocation va - param uint32_t slot - } - -ScriptSetTimeZone { - param RsScript s - param const char * timeZone - } - -ScriptInvoke { - param RsScript s - param uint32_t slot - } - -ScriptInvokeV { - param RsScript s - param uint32_t slot - param const void * data - } - -ScriptForEach { - param RsScript s - param uint32_t slot - param RsAllocation ain - param RsAllocation aout - param const void * usr - param const RsScriptCall * sc -} - -ScriptSetVarI { - param RsScript s - param uint32_t slot - param int value - } - -ScriptSetVarObj { - param RsScript s - param uint32_t slot - param RsObjectBase value - } - -ScriptSetVarJ { - param RsScript s - param uint32_t slot - param int64_t value - } - -ScriptSetVarF { - param RsScript s - param uint32_t slot - param float value - } - -ScriptSetVarD { - param RsScript s - param uint32_t slot - param double value - } - -ScriptSetVarV { - param RsScript s - param uint32_t slot - param const void * data - } - -ScriptGetVarV { - param RsScript s - param uint32_t slot - param void * data - sync - } - -ScriptSetVarVE { - param RsScript s - param uint32_t slot - param const void * data - param RsElement e - param const size_t * dims - } - - -ScriptCCreate { - param const char * resName - param const char * cacheDir - param const char * text - ret RsScript - } - -ScriptIntrinsicCreate { - param uint32_t id - param RsElement eid - ret RsScript - } - -ScriptKernelIDCreate { - direct - param RsScript sid - param int slot - param int sig - ret RsScriptKernelID - } - -ScriptFieldIDCreate { - direct - param RsScript sid - param int slot - ret RsScriptFieldID - } - -ScriptGroupCreate { - direct - param RsScriptKernelID * kernels - param RsScriptKernelID * src - param RsScriptKernelID * dstK - param RsScriptFieldID * dstF - param const RsType * type - ret RsScriptGroup -} - -ScriptGroupSetOutput { - param RsScriptGroup group - param RsScriptKernelID kernel - param RsAllocation alloc -} - -ScriptGroupSetInput { - param RsScriptGroup group - param RsScriptKernelID kernel - param RsAllocation alloc -} - -ScriptGroupExecute { - param RsScriptGroup group -} - -AllocationIoSend { - param RsAllocation alloc - } - -AllocationIoReceive { - param RsAllocation alloc - } - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsAdapter.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsAdapter.h deleted file mode 100644 index 7b189cf..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsAdapter.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_ADAPTER_H -#define ANDROID_RS_ADAPTER_H - -#include "rsAllocation.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - - -class Adapter1D : public ObjectBase { - -public: - // By policy this allocation will hold a pointer to the type - // but will not destroy it on destruction. - Adapter1D(Context *); - Adapter1D(Context *, Allocation *); - void reset(); - - void setAllocation(Allocation *a) {mAllocation.set(a);} - - uint32_t getDimX() const {return mAllocation->getType()->getLODDimX(mLOD);} - - const Type * getBaseType() const {return mAllocation->getType();} - - inline void setY(uint32_t y) {mY = y;} - inline void setZ(uint32_t z) {mZ = z;} - inline void setLOD(uint32_t lod) {mLOD = lod;} - inline void setFace(RsAllocationCubemapFace face) {mFace = face;} - - void data(Context *rsc, uint32_t xoff, uint32_t count, const void *data, size_t sizeBytes); - - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_ADAPTER_1D; } - static Adapter1D *createFromStream(Context *rsc, IStream *stream); - -protected: - ObjectBaseRef<Allocation> mAllocation; - uint32_t mY; - uint32_t mZ; - uint32_t mLOD; - RsAllocationCubemapFace mFace; -}; - -class Adapter2D : public ObjectBase { - -public: - // By policy this allocation will hold a pointer to the type - // but will not destroy it on destruction. - Adapter2D(Context *); - Adapter2D(Context *, Allocation *); - void reset(); - - uint32_t getDimX() const {return mAllocation->getType()->getLODDimX(mLOD);} - uint32_t getDimY() const {return mAllocation->getType()->getLODDimY(mLOD);} - const Type * getBaseType() const {return mAllocation->getType();} - - void setAllocation(Allocation *a) {mAllocation.set(a);} - inline void setZ(uint32_t z) {mZ = z;} - inline void setLOD(uint32_t lod) {mLOD = lod;} - inline void setFace(RsAllocationCubemapFace face) {mFace = face;} - - void data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, - const void *data, size_t sizeBytes); - - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_ADAPTER_2D; } - static Adapter2D *createFromStream(Context *rsc, IStream *stream); - -protected: - ObjectBaseRef<Allocation> mAllocation; - uint32_t mZ; - uint32_t mLOD; - RsAllocationCubemapFace mFace; -}; - -} -} -#endif - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsAllocation.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsAllocation.h deleted file mode 100644 index b0f2f9e..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsAllocation.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_STRUCTURED_ALLOCATION_H -#define ANDROID_STRUCTURED_ALLOCATION_H - -#include "rsType.h" - -#if !defined(RS_SERVER) && !defined(RS_COMPATIBILITY_LIB) -#include <ui/GraphicBuffer.h> -#include "rsGrallocConsumer.h" -#include "gui/CpuConsumer.h" -#include "gui/GLConsumer.h" -#else -struct ANativeWindowBuffer; -#endif - -// --------------------------------------------------------------------------- -namespace android { - -namespace renderscript { - -class Program; - -/***************************************************************************** - * CAUTION - * - * Any layout changes for this class may require a corresponding change to be - * made to frameworks/compile/libbcc/lib/ScriptCRT/rs_core.c, which contains - * a partial copy of the information below. - * - *****************************************************************************/ -class Allocation : public ObjectBase { - // The graphics equivalent of malloc. The allocation contains a structure of elements. - -public: - const static int MAX_LOD = 16; - - struct Hal { - void * drv; - - struct State { - const Type * type; - - uint32_t usageFlags; - RsAllocationMipmapControl mipmapControl; - - // Cached fields from the Type and Element - // to prevent pointer chasing in critical loops. - uint32_t yuv; - uint32_t elementSizeBytes; - bool hasMipmaps; - bool hasFaces; - bool hasReferences; - void * userProvidedPtr; - int32_t surfaceTextureID; - ANativeWindowBuffer *nativeBuffer; - int64_t timestamp; - }; - State state; - - struct DrvState { - struct LodState { - void * mallocPtr; - size_t stride; - uint32_t dimX; - uint32_t dimY; - uint32_t dimZ; - } lod[android::renderscript::Allocation::MAX_LOD]; - size_t faceOffset; - uint32_t lodCount; - uint32_t faceCount; - - struct YuvState { - uint32_t shift; - uint32_t step; - } yuv; - }; - mutable DrvState drvState; - - }; - Hal mHal; - - void operator delete(void* ptr); - - static Allocation * createAllocation(Context *rsc, const Type *, uint32_t usages, - RsAllocationMipmapControl mc = RS_ALLOCATION_MIPMAP_NONE, - void *ptr = 0); - virtual ~Allocation(); - void updateCache(); - - const Type * getType() const {return mHal.state.type;} - - void syncAll(Context *rsc, RsAllocationUsageType src); - - 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(Context *rsc, uint32_t xoff, uint32_t lod, uint32_t count, const void *data, size_t sizeBytes); - void data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face, - uint32_t w, uint32_t h, const void *data, size_t sizeBytes, size_t stride); - void data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod, - uint32_t w, uint32_t h, uint32_t d, const void *data, size_t sizeBytes, size_t stride); - - void read(Context *rsc, uint32_t xoff, uint32_t lod, uint32_t count, void *data, size_t sizeBytes); - void read(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face, - uint32_t w, uint32_t h, void *data, size_t sizeBytes, size_t stride); - void read(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod, - uint32_t w, uint32_t h, uint32_t d, void *data, size_t sizeBytes, size_t stride); - - void elementData(Context *rsc, uint32_t x, - const void *data, uint32_t elementOff, size_t sizeBytes); - void elementData(Context *rsc, uint32_t x, uint32_t y, - const void *data, uint32_t elementOff, size_t sizeBytes); - - void addProgramToDirty(const Program *); - void removeProgramToDirty(const Program *); - - virtual void dumpLOGV(const char *prefix) const; - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_ALLOCATION; } - static Allocation *createFromStream(Context *rsc, IStream *stream); - - bool getIsScript() const { - return (mHal.state.usageFlags & RS_ALLOCATION_USAGE_SCRIPT) != 0; - } - bool getIsTexture() const { - return (mHal.state.usageFlags & RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE) != 0; - } - bool getIsRenderTarget() const { - return (mHal.state.usageFlags & RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET) != 0; - } - bool getIsBufferObject() const { - return (mHal.state.usageFlags & RS_ALLOCATION_USAGE_GRAPHICS_VERTEX) != 0; - } - - 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; - virtual bool freeChildren(); - - void sendDirty(const Context *rsc) const; - bool getHasGraphicsMipmaps() const { - return mHal.state.mipmapControl != RS_ALLOCATION_MIPMAP_NONE; - } - - void * getSurface(const Context *rsc); - void setSurface(const Context *rsc, RsNativeWindow sur); - void ioSend(const Context *rsc); - void ioReceive(const Context *rsc); - -protected: - Vector<const Program *> mToDirtyList; - ObjectBaseRef<const Type> mType; - void setType(const Type *t) { - mType.set(t); - mHal.state.type = t; - } - -#if !defined(RS_SERVER) && !defined(RS_COMPATIBILITY_LIB) - class NewBufferListener : public android::ConsumerBase::FrameAvailableListener { - public: - const android::renderscript::Context *rsc; - const android::renderscript::Allocation *alloc; - - virtual void onFrameAvailable(); - }; - - sp<NewBufferListener> mBufferListener; - sp< GrallocConsumer > mGrallocConsumer; -#endif - - -private: - void freeChildrenUnlocked(); - Allocation(Context *rsc, const Type *, uint32_t usages, RsAllocationMipmapControl mc, void *ptr); - - uint32_t getPackedSize() const; - static void writePackedData(Context *rsc, const Type *type, uint8_t *dst, - const uint8_t *src, bool dstPadded); - void unpackVec3Allocation(Context *rsc, const void *data, size_t dataSize); - void packVec3Allocation(Context *rsc, OStream *stream) const; -}; - -} -} -#endif - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsAnimation.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsAnimation.h deleted file mode 100644 index 4e0cc89..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsAnimation.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_ANIMATION_H -#define ANDROID_RS_ANIMATION_H - -#include "rsUtils.h" -#include "rsObjectBase.h" -#include "rsDefines.h" -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - - -class Animation : public ObjectBase { -public: - ~Animation(); - - static Animation * create(Context *rsc, - const float *inValues, const float *outValues, - uint32_t valueCount, RsAnimationInterpolation, - RsAnimationEdge pre, RsAnimationEdge post); - - float eval(float) const; - - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_ANIMATION; } - static Animation *createFromStream(Context *rsc, IStream *stream); - -protected: - Animation(Context *rsc); - - - - float evalInRange(float) const; - - - - const float *mValuesInput; - const float *mValuesOutput; - uint32_t mValueCount; - RsAnimationInterpolation mInterpolation; - RsAnimationEdge mEdgePre; - RsAnimationEdge mEdgePost; - - // derived - float mInputMin; - float mInputMax; -}; - -} -} -#endif //ANDROID_STRUCTURED_ELEMENT_H - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsCompatibilityLib.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsCompatibilityLib.h deleted file mode 100644 index 4abc011..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsCompatibilityLib.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _RS_RSCOMPATIBILITYLIB_H -#define _RS_RSCOMPATIBILITYLIB_H - -#ifndef RS_COMPATIBILITY_LIB -#error "THIS HEADER IS ONLY VALID FOR BUILDING OUR COMPATIBILITY LIBRARY" -#endif - -// from system/graphics.h -enum { - HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar - HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21 -}; - -// from cutils/properties.h -#define PROPERTY_KEY_MAX 32 -#define PROPERTY_VALUE_MAX 92 - -int property_get(const char *key, char *value, const char *default_value); - -#endif // _RS_RSCOMPATIBILITYLIB_H diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsComponent.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsComponent.h deleted file mode 100644 index 4d11718..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsComponent.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_COMPONENT_H -#define ANDROID_COMPONENT_H - -#include "rsUtils.h" -#include "rsDefines.h" -#include "rsStream.h" -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - - -// An element is a group of Components that occupies one cell in a structure. -class Component { -public: - Component(); - ~Component(); - - void set(RsDataType dt, RsDataKind dk, bool norm, uint32_t vecSize=1); - - void dumpLOGV(const char *prefix) const; - - RsDataType getType() const {return mType;} - RsDataKind getKind() const {return mKind;} - bool getIsNormalized() const {return mNormalized;} - uint32_t getVectorSize() const {return mVectorSize;} - bool getIsFloat() const {return mIsFloat;} - bool getIsSigned() const {return mIsSigned;} - uint32_t getBits() const {return mBits;} - uint32_t getBitsUnpadded() const {return mBitsUnpadded;} - - // Helpers for reading / writing this class out - void serialize(OStream *stream) const; - void loadFromStream(IStream *stream); - - bool isReference() const; - -protected: - RsDataType mType; - RsDataKind mKind; - bool mNormalized; - uint32_t mVectorSize; - - // derived - uint32_t mBits; - uint32_t mBitsUnpadded; - uint32_t mTypeBits; - bool mIsFloat; - bool mIsSigned; - bool mIsPixel; -}; - -} -} - -#endif - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsContext.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsContext.h deleted file mode 100644 index ab56c27..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsContext.h +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_CONTEXT_H -#define ANDROID_RS_CONTEXT_H - -#include "rsUtils.h" -#include "rs_hal.h" -#include <string.h> - -#include "rsThreadIO.h" -#include "rsScriptC.h" -#include "rsScriptGroup.h" -#include "rsSampler.h" - -#if !defined(RS_SERVER) && !defined(RS_COMPATIBILITY_LIB) -#define ATRACE_TAG ATRACE_TAG_RS -#include "utils/Trace.h" -#else -#define ATRACE_ENABLED(...) false -#define ATRACE_NAME(...) -#define ATRACE_CALL(...) -#endif - -#ifndef RS_COMPATIBILITY_LIB -#include "rsFont.h" -#include "rsPath.h" -#include "rsProgramFragment.h" -#include "rsProgramStore.h" -#include "rsProgramRaster.h" -#include "rsProgramVertex.h" -#include "rsFBOCache.h" - -#endif - - -// --------------------------------------------------------------------------- -namespace android { - -namespace renderscript { - -class Device; - -#if 0 -#define CHECK_OBJ(o) { \ - GET_TLS(); \ - if (!ObjectBase::isValid(rsc, (const ObjectBase *)o)) { \ - ALOGE("Bad object %p at %s, %i", o, __FILE__, __LINE__); \ - } \ -} -#define CHECK_OBJ_OR_NULL(o) { \ - GET_TLS(); \ - if (o && !ObjectBase::isValid(rsc, (const ObjectBase *)o)) { \ - ALOGE("Bad object %p at %s, %i", o, __FILE__, __LINE__); \ - } \ -} -#else -#define CHECK_OBJ(o) -#define CHECK_OBJ_OR_NULL(o) -#endif - - - -class Context { -public: - struct Hal { - void * drv; - - RsdHalFunctions funcs; - }; - Hal mHal; - - static Context * createContext(Device *, const RsSurfaceConfig *sc, - RsContextType ct = RS_CONTEXT_TYPE_NORMAL, - uint32_t flags = 0); - static Context * createContextLite(); - ~Context(); - - static pthread_mutex_t gMessageMutex; - static pthread_mutex_t gInitMutex; - // Library mutex (for providing thread-safe calls from the runtime) - static pthread_mutex_t gLibMutex; - - class PushState { - public: - PushState(Context *); - ~PushState(); - - private: -#ifndef RS_COMPATIBILITY_LIB - ObjectBaseRef<ProgramFragment> mFragment; - ObjectBaseRef<ProgramVertex> mVertex; - ObjectBaseRef<ProgramStore> mStore; - ObjectBaseRef<ProgramRaster> mRaster; - ObjectBaseRef<Font> mFont; -#endif - Context *mRsc; - }; - - RsSurfaceConfig mUserSurfaceConfig; - - ElementState mStateElement; - TypeState mStateType; - SamplerState mStateSampler; - - ScriptCState mScriptC; - bool isSynchronous() {return mSynchronous;} - bool setupCheck(); - -#ifndef RS_COMPATIBILITY_LIB - FBOCache mFBOCache; - ProgramFragmentState mStateFragment; - ProgramStoreState mStateFragmentStore; - ProgramRasterState mStateRaster; - ProgramVertexState mStateVertex; - FontState mStateFont; - - - void swapBuffers(); - void setRootScript(Script *); - void setProgramRaster(ProgramRaster *); - void setProgramVertex(ProgramVertex *); - void setProgramFragment(ProgramFragment *); - void setProgramStore(ProgramStore *); - void setFont(Font *); - - void updateSurface(void *sur); - - ProgramFragment * getProgramFragment() {return mFragment.get();} - ProgramStore * getProgramStore() {return mFragmentStore.get();} - ProgramRaster * getProgramRaster() {return mRaster.get();} - ProgramVertex * getProgramVertex() {return mVertex.get();} - Font * getFont() {return mFont.get();} - - void setupProgramStore(); - - void pause(); - void resume(); - void setSurface(uint32_t w, uint32_t h, RsNativeWindow sur); -#endif - void finish(); - - void setPriority(int32_t p); - void destroyWorkerThreadResources(); - - void assignName(ObjectBase *obj, const char *name, uint32_t len); - void removeName(ObjectBase *obj); - - RsMessageToClientType peekMessageToClient(size_t *receiveLen, uint32_t *subID); - RsMessageToClientType getMessageToClient(void *data, size_t *receiveLen, uint32_t *subID, size_t bufferLen); - bool sendMessageToClient(const void *data, RsMessageToClientType cmdID, uint32_t subID, size_t len, bool waitForSpace) const; - uint32_t runScript(Script *s); - - void initToClient(); - void deinitToClient(); - -#ifndef RS_COMPATIBILITY_LIB - ProgramFragment * getDefaultProgramFragment() const { - return mStateFragment.mDefault.get(); - } - ProgramVertex * getDefaultProgramVertex() const { - return mStateVertex.mDefault.get(); - } - ProgramStore * getDefaultProgramStore() const { - return mStateFragmentStore.mDefault.get(); - } - ProgramRaster * getDefaultProgramRaster() const { - return mStateRaster.mDefault.get(); - } - Font* getDefaultFont() const { - return mStateFont.mDefault.get(); - } - - uint32_t getWidth() const {return mWidth;} - uint32_t getHeight() const {return mHeight;} - - uint32_t getCurrentSurfaceWidth() const; - uint32_t getCurrentSurfaceHeight() const; - - void setWatchdogGL(const char *cmd, uint32_t line, const char *file) const { - watchdog.command = cmd; - watchdog.file = file; - watchdog.line = line; - } -#endif - - mutable ThreadIO mIO; - - // Timers - enum Timers { - RS_TIMER_IDLE, - RS_TIMER_INTERNAL, - RS_TIMER_SCRIPT, - RS_TIMER_CLEAR_SWAP, - _RS_TIMER_TOTAL - }; - uint64_t getTime() const; - void timerInit(); - void timerReset(); - void timerSet(Timers); - void timerPrint(); - void timerFrame(); - - struct { - bool mLogTimes; - bool mLogScripts; - bool mLogObjects; - bool mLogShaders; - bool mLogShadersAttr; - bool mLogShadersUniforms; - bool mLogVisual; - uint32_t mDebugMaxThreads; - } props; - - mutable struct { - bool inRoot; - const char *command; - const char *file; - uint32_t line; - } watchdog; - static void printWatchdogInfo(void *ctx); - - void dumpDebug() const; - void setError(RsError e, const char *msg = NULL) const; - - mutable const ObjectBase * mObjHead; - - uint32_t getDPI() const {return mDPI;} - void setDPI(uint32_t dpi) {mDPI = dpi;} - - uint32_t getTargetSdkVersion() const {return mTargetSdkVersion;} - void setTargetSdkVersion(uint32_t sdkVer) {mTargetSdkVersion = sdkVer;} - - RsContextType getContextType() const { return mContextType; } - void setContextType(RsContextType ct) { mContextType = ct; } - - Device *mDev; -protected: - - uint32_t mTargetSdkVersion; - uint32_t mDPI; - uint32_t mWidth; - uint32_t mHeight; - int32_t mThreadPriority; - bool mIsGraphicsContext; - - bool mForceCpu; - - RsContextType mContextType; - - bool mRunning; - bool mExit; - bool mPaused; - mutable RsError mError; - - pthread_t mThreadId; - pid_t mNativeThreadId; - - ObjectBaseRef<Script> mRootScript; -#ifndef RS_COMPATIBILITY_LIB - ObjectBaseRef<ProgramFragment> mFragment; - ObjectBaseRef<ProgramVertex> mVertex; - ObjectBaseRef<ProgramStore> mFragmentStore; - ObjectBaseRef<ProgramRaster> mRaster; - ObjectBaseRef<Font> mFont; -#endif - - void displayDebugStats(); - -private: - Context(); - bool initContext(Device *, const RsSurfaceConfig *sc); - - bool mSynchronous; - bool initGLThread(); - void deinitEGL(); - - uint32_t runRootScript(); - - static bool loadRuntime(const char* filename, Context* rsc); - static void * threadProc(void *); - static void * helperThreadProc(void *); - - bool mHasSurface; - bool mIsContextLite; - - Vector<ObjectBase *> mNames; - - uint64_t mTimers[_RS_TIMER_TOTAL]; - Timers mTimerActive; - uint64_t mTimeLast; - uint64_t mTimeFrame; - uint64_t mTimeLastFrame; - uint32_t mTimeMSLastFrame; - uint32_t mTimeMSLastScript; - uint32_t mTimeMSLastSwap; - uint32_t mAverageFPSFrameCount; - uint64_t mAverageFPSStartTime; - uint32_t mAverageFPS; -}; - -} // renderscript -} // android -#endif diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsCppUtils.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsCppUtils.h deleted file mode 100644 index 71cf077..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsCppUtils.h +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_CPP_UTILS_H -#define ANDROID_RS_CPP_UTILS_H - -#if !defined(RS_SERVER) && !defined(RS_COMPATIBILITY_LIB) -#include <utils/Log.h> -#include <utils/String8.h> -#include <utils/Vector.h> -#include <cutils/atomic.h> -#endif - -#include <stdint.h> - -#include <stdlib.h> -#include <pthread.h> -#include <time.h> - -#include <math.h> - -#ifdef RS_COMPATIBILITY_LIB -#include <android/log.h> -#endif - -#if defined(RS_SERVER) || defined(RS_COMPATIBILITY_LIB) - -#define ATRACE_TAG -#define ATRACE_CALL(...) - -#include <string> -#include <vector> -#include <algorithm> - -#define ALOGE(...) \ - __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__); -#define ALOGW(...) \ - __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__); -#define ALOGD(...) \ - __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__); -#define ALOGV(...) \ - __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__); - -namespace android { - - // server has no Vector or String8 classes; implement on top of STL - class String8: public std::string { - public: - String8(const char *ptr) : std::string(ptr) { - - } - String8(const char *ptr, size_t len) : std::string(ptr, len) { - - } - String8() : std::string() { - - } - - const char* string() const { - return this->c_str(); - } - - void setTo(const char* str, ssize_t len) { - this->assign(str, len); - } - void setTo(const char* str) { - this->assign(str); - } - String8 getPathDir(void) const { - const char* cp; - const char*const str = this->c_str(); - - cp = strrchr(str, OS_PATH_SEPARATOR); - if (cp == NULL) - return String8(""); - else - return String8(str, cp - str); - } - }; - - template <class T> class Vector: public std::vector<T> { - public: - void push(T obj) { - this->push_back(obj); - } - void removeAt(uint32_t index) { - this->erase(this->begin() + index); - } - ssize_t add(const T& obj) { - this->push_back(obj); - return this->size() - 1; - } - void setCapacity(ssize_t capacity) { - this->resize(capacity); - } - - T* editArray() { - return (T*)(this->begin()); - } - - const T* array() { - return (const T*)(this->begin()); - } - - }; - - template<> class Vector<bool>: public std::vector<char> { - public: - void push(bool obj) { - this->push_back(obj); - } - void removeAt(uint32_t index) { - this->erase(this->begin() + index); - } - ssize_t add(const bool& obj) { - this->push_back(obj); - return this->size() - 1; - } - void setCapacity(ssize_t capacity) { - this->resize(capacity); - } - - bool* editArray() { - return (bool*)(this->begin()); - } - - const bool* array() { - return (const bool*)(this->begin()); - } - }; - -} - -typedef int64_t nsecs_t; // nano-seconds - -enum { - SYSTEM_TIME_REALTIME = 0, // system-wide realtime clock - SYSTEM_TIME_MONOTONIC = 1, // monotonic time since unspecified starting point - SYSTEM_TIME_PROCESS = 2, // high-resolution per-process clock - SYSTEM_TIME_THREAD = 3, // high-resolution per-thread clock -}; - -static inline nsecs_t systemTime(int clock) -{ -#if defined(HAVE_POSIX_CLOCKS) - static const clockid_t clocks[] = { - CLOCK_REALTIME, - CLOCK_MONOTONIC, - CLOCK_PROCESS_CPUTIME_ID, - CLOCK_THREAD_CPUTIME_ID - }; - struct timespec t; - t.tv_sec = t.tv_nsec = 0; - clock_gettime(clocks[clock], &t); - return nsecs_t(t.tv_sec)*1000000000LL + t.tv_nsec; -#else - // we don't support the clocks here. - struct timeval t; - t.tv_sec = t.tv_usec = 0; - gettimeofday(&t, NULL); - return nsecs_t(t.tv_sec)*1000000000LL + nsecs_t(t.tv_usec)*1000LL; -#endif -} - -static inline nsecs_t nanoseconds_to_milliseconds(nsecs_t secs) -{ - return secs/1000000; -} - - -#endif // RS_SERVER || RS_COMPATIBILITY_LIB - -namespace android { -namespace renderscript { - -const char * rsuCopyString(const char *name); -const char * rsuCopyString(const char *name, size_t len); - -#if 1 -#define rsAssert(v) do {if(!(v)) ALOGE("rsAssert failed: %s, in %s at %i", #v, __FILE__, __LINE__);} while (0) -#else -#define rsAssert(v) while (0) -#endif - -template<typename T> -T rsMin(T in1, T in2) -{ - if (in1 > in2) { - return in2; - } - return in1; -} - -template<typename T> -T rsMax(T in1, T in2) { - if (in1 < in2) { - return in2; - } - return in1; -} - -template<typename T> -T rsFindHighBit(T val) { - uint32_t bit = 0; - while (val > 1) { - bit++; - val>>=1; - } - return bit; -} - -template<typename T> -bool rsIsPow2(T val) { - return (val & (val-1)) == 0; -} - -template<typename T> -T rsHigherPow2(T v) { - if (rsIsPow2(v)) { - return v; - } - return 1 << (rsFindHighBit(v) + 1); -} - -template<typename T> -T rsLowerPow2(T v) { - if (rsIsPow2(v)) { - return v; - } - return 1 << rsFindHighBit(v); -} - -template<typename T> -T rsRound(T v, unsigned int r) { - // Only valid for rounding up to powers of 2. - if ((r & (r - 1)) != 0) { - rsAssert(false && "Must be power of 2 for rounding up"); - return v; - } - T res = v + (r - 1); - if (res < v) { - rsAssert(false && "Overflow of rounding operation"); - return v; - } - res &= ~(r - 1); - return res; -} - -static inline uint16_t rs888to565(uint32_t r, uint32_t g, uint32_t b) { - uint16_t t = 0; - t |= b >> 3; - t |= (g >> 2) << 5; - t |= (r >> 3) << 11; - return t; -} - -static inline uint16_t rsBoxFilter565(uint16_t i1, uint16_t i2, uint16_t i3, uint16_t i4) { - uint32_t r = ((i1 & 0x1f) + (i2 & 0x1f) + (i3 & 0x1f) + (i4 & 0x1f)); - uint32_t g = ((i1 >> 5) & 0x3f) + ((i2 >> 5) & 0x3f) + ((i3 >> 5) & 0x3f) + ((i4 >> 5) & 0x3f); - uint32_t b = ((i1 >> 11) + (i2 >> 11) + (i3 >> 11) + (i4 >> 11)); - return (r >> 2) | ((g >> 2) << 5) | ((b >> 2) << 11); -} - -static inline uint32_t rsBoxFilter8888(uint32_t i1, uint32_t i2, uint32_t i3, uint32_t i4) { - uint32_t r = (i1 & 0xff) + (i2 & 0xff) + (i3 & 0xff) + (i4 & 0xff); - uint32_t g = ((i1 >> 8) & 0xff) + ((i2 >> 8) & 0xff) + ((i3 >> 8) & 0xff) + ((i4 >> 8) & 0xff); - uint32_t b = ((i1 >> 16) & 0xff) + ((i2 >> 16) & 0xff) + ((i3 >> 16) & 0xff) + ((i4 >> 16) & 0xff); - uint32_t a = ((i1 >> 24) & 0xff) + ((i2 >> 24) & 0xff) + ((i3 >> 24) & 0xff) + ((i4 >> 24) & 0xff); - return (r >> 2) | ((g >> 2) << 8) | ((b >> 2) << 16) | ((a >> 2) << 24); -} - -} -} - -#endif //ANDROID_RS_OBJECT_BASE_H - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsDebugHelper.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsDebugHelper.h deleted file mode 100644 index 2ac9afd..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsDebugHelper.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_DEBUG_HELPER_H -#define ANDROID_RS_DEBUG_HELPER_H - -#include "rsUtils.h" -#include "rsDefines.h" - -#ifndef RS_SERVER -// This shouldn't ever be defined with RS_SERVER -#define RS_OBJECT_DEBUG 0 -#endif - -#if RS_OBJECT_DEBUG -#include <utils/CallStack.h> -#endif - -namespace android { -namespace renderscript { - -#if RS_OBJECT_DEBUG - -class DebugHelper { -public: - DebugHelper() { - mStack.update(2); - } - - void dump() { - mStack.dump(); - } - -private: - CallStack mStack; -}; - -#else - -class DebugHelper { -public: - DebugHelper() { } -}; - -#endif - -} // namespace renderscript -} // namespace android - -#endif //ANDROID_RS_DEBUG_HELPER_H - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsDevice.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsDevice.h deleted file mode 100644 index ffb514b..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsDevice.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_DEVICE_H -#define ANDROID_RS_DEVICE_H - -#include "rsUtils.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -class Context; - -class Device { -public: - Device(); - ~Device(); - - void addContext(Context *); - void removeContext(Context *); - - bool mForceSW; - -protected: - Vector<Context *> mContexts; -}; - -} -} -#endif diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsElement.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsElement.h deleted file mode 100644 index b97dfe5..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsElement.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_STRUCTURED_ELEMENT_H -#define ANDROID_STRUCTURED_ELEMENT_H - -#include "rsComponent.h" -#include "rsUtils.h" -#include "rsDefines.h" -#include "rsObjectBase.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { -/***************************************************************************** - * CAUTION - * - * Any layout changes for this class may require a corresponding change to be - * made to frameworks/compile/libbcc/lib/ScriptCRT/rs_core.c, which contains - * a partial copy of the information below. - * - *****************************************************************************/ -// An element is a group of Components that occupies one cell in a structure. -class Element : public ObjectBase { -public: - struct Hal { - mutable void *drv; - - struct State { - RsDataType dataType; - RsDataKind dataKind; - uint32_t vectorSize; - uint32_t elementSizeBytes; - - // Subelements - const Element **fields; - uint32_t *fieldArraySizes; - const char **fieldNames; - uint32_t *fieldNameLengths; - uint32_t *fieldOffsetBytes; - uint32_t fieldsCount; - }; - State state; - }; - Hal mHal; - - 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; - } - - size_t getFieldOffsetBits(uint32_t componentNumber) const { - return mFields[componentNumber].offsetBits; - } - size_t getFieldOffsetBytes(uint32_t componentNumber) const { - 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;} - uint32_t getFieldArraySize(uint32_t idx) const {return mFields[idx].arraySize;} - - const Component & getComponent() const {return mComponent;} - RsDataType getType() const {return mComponent.getType();} - RsDataKind getKind() const {return mComponent.getKind();} - uint32_t getBits() const {return mBits;} - uint32_t getBitsUnpadded() const {return mBitsUnpadded;} - uint32_t getVectorSize() const {return mComponent.getVectorSize();} - - void dumpLOGV(const char *prefix) const; - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_ELEMENT; } - static Element *createFromStream(Context *rsc, IStream *stream); - - static ObjectBaseRef<const Element> createRef(Context *rsc, - RsDataType dt, - RsDataKind dk, - bool isNorm, - uint32_t vecSize); - static ObjectBaseRef<const Element> createRef(Context *rsc, size_t count, - const Element **, - const char **, - const size_t * lengths, - const uint32_t *asin); - - static const Element* create(Context *rsc, - RsDataType dt, - RsDataKind dk, - bool isNorm, - uint32_t vecSize) { - ObjectBaseRef<const Element> elem = createRef(rsc, dt, dk, isNorm, vecSize); - elem->incUserRef(); - return elem.get(); - } - static const Element* create(Context *rsc, size_t count, - const Element **ein, - const char **nin, - const size_t * lengths = NULL, - const uint32_t *asin = NULL) { - ObjectBaseRef<const Element> elem = createRef(rsc, count, ein, nin, lengths, asin); - elem->incUserRef(); - return elem.get(); - } - - void incRefs(const void *) const; - void decRefs(const void *) const; - bool getHasReferences() const {return mHasReference;} - -protected: - // deallocate any components that are part of this element. - void clear(); - - typedef struct { - const char *name; - ObjectBaseRef<const Element> e; - uint32_t offsetBits; - uint32_t offsetBitsUnpadded; - uint32_t arraySize; - } ElementField_t; - ElementField_t *mFields; - size_t mFieldCount; - bool mHasReference; - - - virtual ~Element(); - Element(Context *); - - Component mComponent; - uint32_t mBitsUnpadded; - uint32_t mBits; - - void compute(); - - virtual void preDestroy() const; -}; - - -class ElementState { -public: - ElementState(); - ~ElementState(); - - // Cache of all existing elements. - Vector<Element *> mElements; -}; - - -} -} -#endif //ANDROID_STRUCTURED_ELEMENT_H diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsEnv.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsEnv.h deleted file mode 100644 index b82eaf1..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsEnv.h +++ /dev/null @@ -1,29 +0,0 @@ -#include <stdint.h> - - -typedef void * RsAdapter1D; -typedef void * RsAdapter2D; -typedef void * RsAllocation; -typedef void * RsContext; -typedef void * RsDevice; -typedef void * RsElement; -typedef void * RsSampler; -typedef void * RsScript; -typedef void * RsMesh; -typedef void * RsType; -typedef void * RsProgramFragment; -typedef void * RsProgramStore; - -typedef struct { - float m[16]; -} rsc_Matrix; - - -typedef struct { - float v[4]; -} rsc_Vector4; - -#define RS_PROGRAM_VERTEX_MODELVIEW_OFFSET 0 -#define RS_PROGRAM_VERTEX_PROJECTION_OFFSET 16 -#define RS_PROGRAM_VERTEX_TEXTURE_OFFSET 32 -#define RS_PROGRAM_VERTEX_MVP_OFFSET 48 diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsFBOCache.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsFBOCache.h deleted file mode 100644 index abb84de..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsFBOCache.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_FRAME_BUFFER_OBJECT_CACHE_H -#define ANDROID_FRAME_BUFFER_OBJECT_CACHE_H - -#include "rsObjectBase.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -class Allocation; - -class FBOCache { -public: - FBOCache(); - ~FBOCache(); - - void init(Context *rsc); - void deinit(Context *rsc); - - void bindColorTarget(Context *rsc, Allocation *a, uint32_t slot); - void bindDepthTarget(Context *, Allocation *a); - void resetAll(Context *); - - void setup(Context *); - void updateSize() { mDirty = true; } - - struct Hal { - mutable void *drv; - - struct State { - Allocation **colorTargets; - uint32_t colorTargetsCount; - Allocation *depthTarget; - }; - State state; - }; - Hal mHal; - -protected: - ObjectBaseRef<Allocation> *mColorTargets; - ObjectBaseRef<Allocation> mDepthTarget; - bool mDirty; - void checkError(Context *); - void setColorAttachment(Context *rsc); - void setDepthAttachment(Context *rsc); - bool renderToFramebuffer(); - -}; - -} // renderscript -} // android - -#endif //ANDROID_FRAME_BUFFER_OBJECT_CACHE_H diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsFifo.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsFifo.h deleted file mode 100644 index 911f446..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsFifo.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_FIFO_H -#define ANDROID_RS_FIFO_H - - -#include "rsUtils.h" - -namespace android { -namespace renderscript { - - -// A simple FIFO to be used as a producer / consumer between two -// threads. One is writer and one is reader. The common cases -// will not require locking. It is not threadsafe for multiple -// readers or writers by design. - -class Fifo { -protected: - Fifo(); - virtual ~Fifo(); - -public: - bool virtual writeAsync(const void *data, size_t bytes, bool waitForSpace = true) = 0; - void virtual writeWaitReturn(void *ret, size_t retSize) = 0; - size_t virtual read(void *data, size_t bytes, bool doWait = true, uint64_t timeToWait = 0) = 0; - void virtual readReturn(const void *data, size_t bytes) = 0; - - void virtual flush() = 0; - -}; - -} -} -#endif diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsFifoSocket.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsFifoSocket.h deleted file mode 100644 index cac0a75..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsFifoSocket.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_FIFO_SOCKET_H -#define ANDROID_RS_FIFO_SOCKET_H - - -#include "rsFifo.h" - -namespace android { -namespace renderscript { - - -class FifoSocket { -public: - FifoSocket(); - virtual ~FifoSocket(); - - bool init(bool supportNonBlocking = true, - bool supportReturnValues = true, - size_t maxDataSize = 0); - void shutdown(); - - bool writeAsync(const void *data, size_t bytes, bool waitForSpace = true); - void writeWaitReturn(void *ret, size_t retSize); - size_t read(void *data, size_t bytes); - void readReturn(const void *data, size_t bytes); - bool isEmpty(); - - int getWriteFd() {return sv[0];} - int getReadFd() {return sv[1];} - -protected: - int sv[2]; - bool mShutdown; -}; - -} -} - -#endif diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsFileA3D.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsFileA3D.h deleted file mode 100644 index 8bf36b9..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsFileA3D.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_FILE_A3D_H -#define ANDROID_RS_FILE_A3D_H - -#include "rsMesh.h" - -#include "rsStream.h" -#include <stdio.h> - -#define A3D_MAGIC_KEY "Android3D_ff" - -// --------------------------------------------------------------------------- -namespace android { - class Asset; - -namespace renderscript { - -class FileA3D : public ObjectBase { -public: - FileA3D(Context *rsc); - ~FileA3D(); - - uint32_t mMajorVersion; - uint32_t mMinorVersion; - uint64_t mIndexOffset; - uint64_t mStringTableOffset; - bool mUse64BitOffsets; - - class A3DIndexEntry { - const char *mObjectName; - RsA3DClassID mType; - uint64_t mOffset; - uint64_t mLength; - ObjectBase *mRsObj; - public: - friend class FileA3D; - const char *getObjectName() const { - return mObjectName; - } - RsA3DClassID getType() const { - return mType; - } - - ~A3DIndexEntry(); - }; - - bool load(FILE *f); - bool load(Asset *asset); - bool load(const void *data, size_t length); - - size_t getNumIndexEntries() const; - const A3DIndexEntry* getIndexEntry(size_t index) const; - ObjectBase *initializeFromEntry(size_t index); - - void appendToFile(Context *rsc, ObjectBase *obj); - bool writeFile(const char *filename); - - // Currently files do not get serialized, - // but we need to inherit from ObjectBase for ref tracking - virtual void serialize(Context *rsc, OStream *stream) const { - } - virtual RsA3DClassID getClassId() const { - return RS_A3D_CLASS_ID_UNKNOWN; - } - -protected: - - void parseHeader(IStream *headerStream); - - const uint8_t * mData; - void * mAlloc; - uint64_t mDataSize; - Asset *mAsset; - - OStream *mWriteStream; - Vector<A3DIndexEntry*> mWriteIndex; - - IStream *mReadStream; - Vector<A3DIndexEntry*> mIndex; -}; - - -} -} -#endif //ANDROID_RS_FILE_A3D_H - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsFont.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsFont.h deleted file mode 100644 index 7bac508..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsFont.h +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_FONT_H -#define ANDROID_RS_FONT_H - -#include "rsStream.h" -#include <utils/Vector.h> -#include <utils/KeyedVector.h> - -struct FT_LibraryRec_; -struct FT_FaceRec_; -struct FT_Bitmap_; - -// --------------------------------------------------------------------------- -namespace android { - -namespace renderscript { - -// Gamma (>= 1.0, <= 10.0) -#define PROPERTY_TEXT_GAMMA "ro.text_gamma" -#define PROPERTY_TEXT_BLACK_GAMMA_THRESHOLD "ro.text_gamma.black_threshold" -#define PROPERTY_TEXT_WHITE_GAMMA_THRESHOLD "ro.text_gamma.white_threshold" - -#define DEFAULT_TEXT_GAMMA 1.4f -#define DEFAULT_TEXT_BLACK_GAMMA_THRESHOLD 64 -#define DEFAULT_TEXT_WHITE_GAMMA_THRESHOLD 192 - -class FontState; - -class Font : public ObjectBase { -public: - enum RenderMode { - FRAMEBUFFER, - BITMAP, - MEASURE, - }; - - struct Rect { - int32_t left; - int32_t top; - int32_t right; - int32_t bottom; - void set(int32_t l, int32_t r, int32_t t, int32_t b) { - left = l; - right = r; - top = t; - bottom = b; - } - }; - - ~Font(); - - // Currently files do not get serialized, - // but we need to inherit from ObjectBase for ref tracking - virtual void serialize(Context *rsc, OStream *stream) const { - } - virtual RsA3DClassID getClassId() const { - return RS_A3D_CLASS_ID_UNKNOWN; - } - - static Font * create(Context *rsc, const char *name, float fontSize, uint32_t dpi, - const void *data = NULL, uint32_t dataLen = 0); - -protected: - - friend class FontState; - - // Pointer to the utf data, length of data, where to start, number of glyphs ot read - // (each glyph may be longer than a char because we are dealing with utf data) - // Last two variables are the initial pen position - void renderUTF(const char *text, uint32_t len, int32_t x, int32_t y, - uint32_t start, int32_t numGlyphs, - RenderMode mode = FRAMEBUFFER, Rect *bounds = NULL, - uint8_t *bitmap = NULL, uint32_t bitmapW = 0, uint32_t bitmapH = 0); - - void invalidateTextureCache(); - struct CachedGlyphInfo - { - // Has the cache been invalidated? - bool mIsValid; - // Location of the cached glyph in the bitmap - // in case we need to resize the texture - uint32_t mBitmapMinX; - uint32_t mBitmapMinY; - uint32_t mBitmapWidth; - uint32_t mBitmapHeight; - // Also cache texture coords for the quad - float mBitmapMinU; - float mBitmapMinV; - float mBitmapMaxU; - float mBitmapMaxV; - // Minimize how much we call freetype - int32_t mGlyphIndex; - int32_t mAdvanceX; - int32_t mAdvanceY; - // Values below contain a glyph's origin in the bitmap - int32_t mBitmapLeft; - int32_t mBitmapTop; - }; - - const char *mFontName; - float mFontSize; - uint32_t mDpi; - - Font(Context *rsc); - bool init(const char *name, float fontSize, uint32_t dpi, const void *data = NULL, uint32_t dataLen = 0); - - virtual void preDestroy() const; - FT_FaceRec_ *mFace; - bool mInitialized; - bool mHasKerning; - - DefaultKeyedVector<uint32_t, CachedGlyphInfo* > mCachedGlyphs; - CachedGlyphInfo* getCachedUTFChar(int32_t utfChar); - - CachedGlyphInfo *cacheGlyph(uint32_t glyph); - void updateGlyphCache(CachedGlyphInfo *glyph); - void measureCachedGlyph(CachedGlyphInfo *glyph, int32_t x, int32_t y, Rect *bounds); - void drawCachedGlyph(CachedGlyphInfo *glyph, int32_t x, int32_t y); - void drawCachedGlyph(CachedGlyphInfo *glyph, int32_t x, int32_t y, - uint8_t *bitmap, uint32_t bitmapW, uint32_t bitmapH); -}; - -class FontState { -public: - FontState(); - ~FontState(); - - void init(Context *rsc); - void deinit(Context *rsc); - - ObjectBaseRef<Font> mDefault; - - void renderText(const char *text, uint32_t len, int32_t x, int32_t y, - uint32_t startIndex = 0, int numGlyphs = -1, - Font::RenderMode mode = Font::FRAMEBUFFER, - Font::Rect *bounds = NULL, - uint8_t *bitmap = NULL, uint32_t bitmapW = 0, uint32_t bitmapH = 0); - - void measureText(const char *text, uint32_t len, Font::Rect *bounds); - - void setFontColor(float r, float g, float b, float a); - void getFontColor(float *r, float *g, float *b, float *a) const; - -protected: - - float mSurfaceWidth; - float mSurfaceHeight; - - friend class Font; - - struct CacheTextureLine { - uint32_t mMaxHeight; - uint32_t mMaxWidth; - uint32_t mCurrentRow; - uint32_t mCurrentCol; - bool mDirty; - - CacheTextureLine(uint32_t maxHeight, uint32_t maxWidth, uint32_t currentRow, uint32_t currentCol) - : mMaxHeight(maxHeight), mMaxWidth(maxWidth), mCurrentRow(currentRow), - mCurrentCol(currentCol), mDirty(false) { - } - - bool fitBitmap(FT_Bitmap_ *bitmap, uint32_t *retOriginX, uint32_t *retOriginY); - }; - - Vector<CacheTextureLine*> mCacheLines; - uint32_t getRemainingCacheCapacity(); - - void precacheLatin(Font *font); - const char *mLatinPrecache; - - Context *mRSC; - - struct { - float mFontColor[4]; - float mGamma; - } mConstants; - bool mConstantsDirty; - - float mBlackGamma; - float mWhiteGamma; - - float mBlackThreshold; - float mWhiteThreshold; - - // Free type library, we only need one copy -#ifndef ANDROID_RS_SERIALIZE - FT_LibraryRec_ *mLibrary; - FT_LibraryRec_ *getLib(); -#endif //ANDROID_RS_SERIALIZE - Vector<Font*> mActiveFonts; - - // Render state for the font - ObjectBaseRef<Allocation> mFontShaderFConstant; - ObjectBaseRef<ProgramFragment> mFontShaderF; - ObjectBaseRef<Sampler> mFontSampler; - ObjectBaseRef<ProgramStore> mFontProgramStore; - void initRenderState(); - - // Texture to cache glyph bitmaps - ObjectBaseRef<Allocation> mTextTexture; - uint8_t *mCacheBuffer; - uint32_t mCacheWidth; - uint32_t mCacheHeight; - - void initTextTexture(); - -#ifndef ANDROID_RS_SERIALIZE - bool cacheBitmap(FT_Bitmap_ *bitmap, uint32_t *retOriginX, uint32_t *retOriginY); -#endif //ANDROID_RS_SERIALIZE - const Type* getCacheTextureType() { - return mTextTexture->getType(); - } - - void flushAllAndInvalidate(); - - // Pointer to vertex data to speed up frame to frame work - float *mTextMeshPtr; - uint32_t mCurrentQuadIndex; - uint32_t mMaxNumberOfQuads; - - void initVertexArrayBuffers(); - ObjectBaseRef<Mesh> mMesh; - - bool mInitialized; - - void checkInit(); - - void issueDrawCommand(); - - void appendMeshQuad(float x1, float y1, float z1, - float u1, float v1, - float x2, float y2, float z2, - float u2, float v2, - float x3, float y3, float z3, - float u3, float v3, - float x4, float y4, float z4, - float u4, float v4); -}; - -} -} - -#endif diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsGrallocConsumer.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsGrallocConsumer.h deleted file mode 100644 index 9e4fc58..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsGrallocConsumer.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_GRALLOC_CONSUMER_H -#define ANDROID_RS_GRALLOC_CONSUMER_H - -#include <gui/ConsumerBase.h> - -#include <ui/GraphicBuffer.h> - -#include <utils/String8.h> -#include <utils/Vector.h> -#include <utils/threads.h> - - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -class Allocation; - -/** - * CpuConsumer is a BufferQueue consumer endpoint that allows direct CPU - * access to the underlying gralloc buffers provided by BufferQueue. Multiple - * buffers may be acquired by it at once, to be used concurrently by the - * CpuConsumer owner. Sets gralloc usage flags to be software-read-only. - * This queue is synchronous by default. - */ -class GrallocConsumer : public ConsumerBase -{ - public: - typedef ConsumerBase::FrameAvailableListener FrameAvailableListener; - - GrallocConsumer(Allocation *, const sp<IGraphicBufferConsumer>& bq); - - virtual ~GrallocConsumer(); - status_t lockNextBuffer(); - status_t unlockBuffer(); - - private: - status_t releaseAcquiredBufferLocked(); - Allocation *mAlloc; - - // Tracking for buffers acquired by the user - struct AcquiredBuffer { - // Need to track the original mSlot index and the buffer itself because - // the mSlot entry may be freed/reused before the acquired buffer is - // released. - int mSlot; - sp<GraphicBuffer> mGraphicBuffer; - void *mBufferPointer; - - AcquiredBuffer() : - mSlot(BufferQueue::INVALID_BUFFER_SLOT), - mBufferPointer(NULL) { - } - }; - AcquiredBuffer mAcquiredBuffer; -}; - -} // namespace renderscript -} // namespace android - -#endif // ANDROID_RS_GRALLOC_CONSUMER_H - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsMatrix2x2.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsMatrix2x2.h deleted file mode 100644 index 4fbd1c2..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsMatrix2x2.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2011-2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_MATRIX_2x2_H -#define ANDROID_RS_MATRIX_2x2_H - -#include "rsType.h" - - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -struct Matrix2x2 : public rs_matrix2x2 { - inline float get(uint32_t x, uint32_t y) const { - return m[x*2 + y]; - } - - inline void set(uint32_t x, uint32_t y, float v) { - m[x*2 + y] = v; - } - - void loadIdentity(); - void load(const float *); - void load(const rs_matrix2x2 *); - - void loadMultiply(const rs_matrix2x2 *lhs, const rs_matrix2x2 *rhs); - - void transpose(); - - void multiply(const rs_matrix2x2 *rhs) { - Matrix2x2 tmp; - tmp.loadMultiply(this, rhs); - load(&tmp); - } -}; - -} -} - -#endif // ANDROID_RS_MATRIX_2x2_H diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsMatrix3x3.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsMatrix3x3.h deleted file mode 100644 index 05249b1..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsMatrix3x3.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2011-2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_MATRIX_3x3_H -#define ANDROID_RS_MATRIX_3x3_H - -#include "rsType.h" - - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -struct Matrix3x3 : public rs_matrix3x3 { - inline float get(uint32_t x, uint32_t y) const { - return m[x*3 + y]; - } - - inline void set(uint32_t x, uint32_t y, float v) { - m[x*3 + y] = v; - } - - void loadIdentity(); - void load(const float *); - void load(const rs_matrix3x3 *); - - void loadMultiply(const rs_matrix3x3 *lhs, const rs_matrix3x3 *rhs); - - void transpose(); - - void multiply(const rs_matrix3x3 *rhs) { - Matrix3x3 tmp; - tmp.loadMultiply(this, rhs); - load(&tmp); - } -}; - -} -} - -#endif // ANDROID_RS_MATRIX_3x3_H diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsMatrix4x4.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsMatrix4x4.h deleted file mode 100644 index 44c33d1..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsMatrix4x4.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2009-2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_MATRIX_4x4_H -#define ANDROID_RS_MATRIX_4x4_H - -#include "rsType.h" - - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -struct Matrix4x4 : public rs_matrix4x4 { - float get(uint32_t x, uint32_t y) const { - return m[x*4 + y]; - } - - void set(uint32_t x, uint32_t y, float v) { - m[x*4 + y] = v; - } - - void loadIdentity(); - void load(const float *); - void load(const rs_matrix4x4 *); - void load(const rs_matrix3x3 *); - void load(const rs_matrix2x2 *); - - void loadRotate(float rot, float x, float y, float z); - void loadScale(float x, float y, float z); - void loadTranslate(float x, float y, float z); - void loadMultiply(const rs_matrix4x4 *lhs, const rs_matrix4x4 *rhs); - - void loadOrtho(float l, float r, float b, float t, float n, float f); - void loadFrustum(float l, float r, float b, float t, float n, float f); - void loadPerspective(float fovy, float aspect, float near, float far); - - void vectorMultiply(float *v4out, const float *v3in) const; - - bool inverse(); - bool inverseTranspose(); - void transpose(); - - void logv(const char *s) const; - - - void multiply(const rs_matrix4x4 *rhs) { - Matrix4x4 tmp; - tmp.loadMultiply(this, rhs); - load(&tmp); - } - void rotate(float rot, float x, float y, float z) { - Matrix4x4 tmp; - tmp.loadRotate(rot, x, y, z); - multiply(&tmp); - } - void scale(float x, float y, float z) { - Matrix4x4 tmp; - tmp.loadScale(x, y, z); - multiply(&tmp); - } - void translate(float x, float y, float z) { - Matrix4x4 tmp; - tmp.loadTranslate(x, y, z); - multiply(&tmp); - } -}; - -} -} - -#endif // ANDROID_RS_MATRIX_4x4_H diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsMesh.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsMesh.h deleted file mode 100644 index 9b61ebe..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsMesh.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_MESH_H -#define ANDROID_RS_MESH_H - - -#include "rsObjectBase.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { -/***************************************************************************** - * CAUTION - * - * Any layout changes for this class may require a corresponding change to be - * made to frameworks/compile/libbcc/lib/ScriptCRT/rs_core.c, which contains - * a partial copy of the information below. - * - *****************************************************************************/ - -// An element is a group of Components that occupies one cell in a structure. -class Mesh : public ObjectBase { -public: - struct Hal { - mutable void *drv; - - struct State { - // Contains vertex data - // Position, normal, texcoord, etc could either be strided in one allocation - // of provided separetely in multiple ones - Allocation **vertexBuffers; - uint32_t vertexBuffersCount; - - // indexBuffers[i] could be NULL, in which case only primitives[i] is used - Allocation **indexBuffers; - uint32_t indexBuffersCount; - RsPrimitive *primitives; - uint32_t primitivesCount; - }; - State state; - }; - Hal mHal; - - Mesh(Context *); - Mesh(Context *, uint32_t vertexBuffersCount, uint32_t primitivesCount); - ~Mesh(); - - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_MESH; } - static Mesh *createFromStream(Context *rsc, IStream *stream); - void init(); - - void setVertexBuffer(Allocation *vb, uint32_t index) { - mVertexBuffers[index].set(vb); - mHal.state.vertexBuffers[index] = vb; - } - - void setPrimitive(Allocation *idx, RsPrimitive prim, uint32_t index) { - mIndexBuffers[index].set(idx); - mHal.state.indexBuffers[index] = idx; - mHal.state.primitives[index] = prim; - } - - void render(Context *) const; - void renderPrimitive(Context *, uint32_t primIndex) const; - void renderPrimitiveRange(Context *, uint32_t primIndex, uint32_t start, uint32_t len) const; - void uploadAll(Context *); - - // Bounding volumes - float mBBoxMin[3]; - float mBBoxMax[3]; - void computeBBox(Context *rsc); -protected: - ObjectBaseRef<Allocation> *mVertexBuffers; - ObjectBaseRef<Allocation> *mIndexBuffers; - bool mInitialized; -}; - -class MeshContext { -public: - MeshContext() { - } - ~MeshContext() { - } -}; - -} -} -#endif //ANDROID_RS_MESH_H - - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsMutex.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsMutex.h deleted file mode 100644 index 47725d7..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsMutex.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_MUTEX_H -#define ANDROID_RS_MUTEX_H - - -#include "rsUtils.h" - -namespace android { -namespace renderscript { - -class Mutex { -public: - Mutex(); - ~Mutex(); - - bool init(); - bool lock(); - bool unlock(); - -protected: - pthread_mutex_t mMutex; -}; - -} -} - -#endif - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsObjectBase.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsObjectBase.h deleted file mode 100644 index 85f8fd8..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsObjectBase.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_OBJECT_BASE_H -#define ANDROID_RS_OBJECT_BASE_H - -#include "rsUtils.h" -#include "rsDefines.h" -#include "rsDebugHelper.h" - -namespace android { -namespace renderscript { - -class Context; -class OStream; - -// An element is a group of Components that occupies one cell in a structure. -class ObjectBase { -public: - ObjectBase(Context *rsc); - - void incSysRef() const; - bool decSysRef() const; - - void incUserRef() const; - bool decUserRef() const; - bool zeroUserRef() const; - - static bool checkDelete(const ObjectBase *); - - const char * getName() const { - return mName; - } - void assignName(const char *s) {mName = s;} - void setName(const char *); - void setName(const char *, uint32_t len); - - Context * getContext() const {return mRSC;} - virtual bool freeChildren(); - - static void zeroAllUserRef(Context *rsc); - static void freeAllChildren(Context *rsc); - static void dumpAll(Context *rsc); - - virtual void dumpLOGV(const char *prefix) const; - virtual void serialize(Context *rsc, OStream *stream) const = 0; - virtual RsA3DClassID getClassId() const = 0; - - static bool isValid(const Context *rsc, const ObjectBase *obj); - - // The async lock is taken during object creation in non-rs threads - // and object deletion in the rs thread. - static void asyncLock(); - static void asyncUnlock(); - -protected: - // Called inside the async lock for any object list management that is - // necessary in derived classes. - virtual void preDestroy() const; - - Context *mRSC; - virtual ~ObjectBase(); - -private: - static pthread_mutex_t gObjectInitMutex; - - void add() const; - void remove() const; - - const char* mName; - mutable int32_t mSysRefCount; - mutable int32_t mUserRefCount; - - mutable const ObjectBase * mPrev; - mutable const ObjectBase * mNext; - - DebugHelper *mDH; -}; - -template<class T> -class ObjectBaseRef { -public: - ObjectBaseRef() { - mRef = NULL; - } - - ObjectBaseRef(const ObjectBaseRef &ref) { - mRef = ref.get(); - if (mRef) { - mRef->incSysRef(); - } - } - - ObjectBaseRef(T *ref) { - mRef = ref; - if (mRef) { - ref->incSysRef(); - } - } - - ObjectBaseRef & operator= (const ObjectBaseRef &ref) { - if (&ref != this) { - set(ref); - } - return *this; - } - - ~ObjectBaseRef() { - clear(); - } - - void set(T *ref) { - if (mRef != ref) { - clear(); - mRef = ref; - if (mRef) { - ref->incSysRef(); - } - } - } - - void set(const ObjectBaseRef &ref) { - set(ref.mRef); - } - - void clear() { - if (mRef) { - mRef->decSysRef(); - } - mRef = NULL; - } - - inline T * get() const { - return mRef; - } - - inline T * operator-> () const { - return mRef; - } - -protected: - T * mRef; -}; - -} -} - -#endif //ANDROID_RS_OBJECT_BASE_H - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsPath.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsPath.h deleted file mode 100644 index ea14335..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsPath.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_PATH_H -#define ANDROID_RS_PATH_H - - -#include "rsObjectBase.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -class Path : public ObjectBase { -public: - struct { - mutable void * drv; - - struct State { - RsPathPrimitive primitive; - float quality; - }; - State state; - } mHal; - - Path(Context *); - Path(Context *, uint32_t vertexBuffersCount, uint32_t primitivesCount); - Path(Context *, RsPathPrimitive pp, bool isStatic, Allocation *vtx, Allocation *loop, float q); - - ~Path(); - - void render(Context *); - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const; - -private: - - - typedef struct { - float x[4]; - float y[4]; - } BezierSegment_t; - - bool subdivideCheck(const BezierSegment_t *s, float u1, float u2); - - void rasterize(const BezierSegment_t *s, uint32_t num, Allocation *alloc); - - -}; - -} -} -#endif //ANDROID_RS_PATH_H - - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsProgram.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsProgram.h deleted file mode 100644 index be5631f..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsProgram.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_PROGRAM_H -#define ANDROID_RS_PROGRAM_H - -#include "rsProgramBase.h" -#include "rsElement.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -#define RS_SHADER_INTERNAL "//rs_shader_internal\n" -#define RS_SHADER_ATTR "ATTRIB_" -#define RS_SHADER_UNI "UNI_" - -class Program : public ProgramBase { -public: - struct Hal { - mutable void *drv; - - struct State { - // The difference between Textures and Constants is how they are accessed - // Texture lookups go though a sampler which in effect converts normalized - // coordinates into type specific. Multiple samples may also be taken - // and filtered. - // - // Constants are strictly accessed by the shader code - Allocation **textures; - RsTextureTarget *textureTargets; - uint32_t texturesCount; - - Sampler **samplers; - uint32_t samplersCount; - - Allocation **constants; - Type **constantTypes; - uint32_t constantsCount; - - Element **inputElements; - uint32_t inputElementsCount; - }; - State state; - }; - Hal mHal; - - Program(Context *, const char * shaderText, size_t shaderLength, - const uint32_t * params, size_t paramLength); - virtual ~Program(); - virtual bool freeChildren(); - - void bindAllocation(Context *, Allocation *, uint32_t slot); - - bool isUserProgram() const {return !mIsInternal;} - - void bindTexture(Context *, uint32_t slot, Allocation *); - void bindSampler(Context *, uint32_t slot, Sampler *); - -protected: - ObjectBaseRef<Allocation> *mTextures; - ObjectBaseRef<Sampler> *mSamplers; - ObjectBaseRef<Allocation> *mConstants; - ObjectBaseRef<Type> *mConstantTypes; - ObjectBaseRef<Element> *mInputElements; - - bool mIsInternal; - const char *mUserShader; - size_t mUserShaderLen; - void initMemberVars(); -}; - -} -} -#endif // ANDROID_RS_PROGRAM_H - - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramBase.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramBase.h deleted file mode 100644 index 80da453..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramBase.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_PROGRAM_BASE_H -#define ANDROID_RS_PROGRAM_BASE_H - -#include "rsObjectBase.h" -#include "rsElement.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -class ProgramBase : public ObjectBase { -public: - ProgramBase(Context *rsc) : ObjectBase(rsc) { - mDirty = true; - } - - void forceDirty() const {mDirty = true;} - -protected: - mutable bool mDirty; -}; - -} -} -#endif // ANDROID_RS_PROGRAM_BASE_H - - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramFragment.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramFragment.h deleted file mode 100644 index d580252..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramFragment.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_PROGRAM_FRAGMENT_H -#define ANDROID_RS_PROGRAM_FRAGMENT_H - -#include "rsProgram.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -class ProgramFragmentState; - -class ProgramFragment : public Program { -public: - ProgramFragment(Context *rsc, const char * shaderText, size_t shaderLength, - const char** textureNames, size_t textureNamesCount, const size_t *textureNamesLength, - const uint32_t * params, size_t paramLength); - virtual ~ProgramFragment(); - - virtual void setup(Context *, ProgramFragmentState *); - - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_FRAGMENT; } - static ProgramFragment *createFromStream(Context *rsc, IStream *stream); - - void setConstantColor(Context *, float, float, float, float); - -protected: - float mConstantColor[4]; - int32_t mTextureUniformIndexStart; -}; - -class ProgramFragmentState { -public: - ProgramFragmentState(); - ~ProgramFragmentState(); - - ProgramFragment *mPF; - void init(Context *rsc); - void deinit(Context *rsc); - - ObjectBaseRef<ProgramFragment> mDefault; - Vector<ProgramFragment *> mPrograms; - - ObjectBaseRef<ProgramFragment> mLast; -}; - -} -} -#endif - - - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramRaster.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramRaster.h deleted file mode 100644 index e9a524b..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramRaster.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2009-2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_PROGRAM_RASTER_H -#define ANDROID_RS_PROGRAM_RASTER_H - -#include "rsProgramBase.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -class ProgramRasterState; -/***************************************************************************** - * CAUTION - * - * Any layout changes for this class may require a corresponding change to be - * made to frameworks/compile/libbcc/lib/ScriptCRT/rs_core.c, which contains - * a partial copy of the information below. - * - *****************************************************************************/ -class ProgramRaster : public ProgramBase { -public: - struct Hal { - mutable void *drv; - - struct State { - bool pointSprite; - RsCullMode cull; - }; - State state; - }; - Hal mHal; - - virtual void setup(const Context *, ProgramRasterState *); - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_RASTER; } - static ProgramRaster *createFromStream(Context *rsc, IStream *stream); - - static ObjectBaseRef<ProgramRaster> getProgramRaster(Context *rsc, - bool pointSprite, - RsCullMode cull); -protected: - virtual void preDestroy() const; - virtual ~ProgramRaster(); - -private: - ProgramRaster(Context *rsc, - bool pointSprite, - RsCullMode cull); - -}; - -class ProgramRasterState { -public: - ProgramRasterState(); - ~ProgramRasterState(); - void init(Context *rsc); - void deinit(Context *rsc); - - ObjectBaseRef<ProgramRaster> mDefault; - ObjectBaseRef<ProgramRaster> mLast; - - // Cache of all existing raster programs. - Vector<ProgramRaster *> mRasterPrograms; -}; - - -} -} -#endif - - - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramStore.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramStore.h deleted file mode 100644 index 9a7f7f1..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramStore.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_PROGRAM_FRAGMENT_STORE_H -#define ANDROID_RS_PROGRAM_FRAGMENT_STORE_H - -#include "rsProgramBase.h" -#include "rsStream.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -class ProgramStoreState; -/***************************************************************************** - * CAUTION - * - * Any layout changes for this class may require a corresponding change to be - * made to frameworks/compile/libbcc/lib/ScriptCRT/rs_core.c, which contains - * a partial copy of the information below. - * - *****************************************************************************/ -class ProgramStore : public ProgramBase { -public: - struct Hal { - mutable void *drv; - - struct State { - bool ditherEnable; - - //bool blendEnable; - bool colorRWriteEnable; - bool colorGWriteEnable; - bool colorBWriteEnable; - bool colorAWriteEnable; - RsBlendSrcFunc blendSrc; - RsBlendDstFunc blendDst; - - //bool depthTestEnable; - bool depthWriteEnable; - RsDepthFunc depthFunc; - }; - State state; - }; - Hal mHal; - - virtual void setup(const Context *, ProgramStoreState *); - - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_STORE; } - static ProgramStore *createFromStream(Context *rsc, IStream *stream); - static ObjectBaseRef<ProgramStore> getProgramStore(Context *, - bool colorMaskR, bool colorMaskG, - bool colorMaskB, bool colorMaskA, - bool depthMask, bool ditherEnable, - RsBlendSrcFunc srcFunc, RsBlendDstFunc destFunc, - RsDepthFunc depthFunc); - void init(); -protected: - virtual void preDestroy() const; - virtual ~ProgramStore(); - -private: - ProgramStore(Context *, - bool colorMaskR, bool colorMaskG, bool colorMaskB, bool colorMaskA, - bool depthMask, bool ditherEnable, - RsBlendSrcFunc srcFunc, RsBlendDstFunc destFunc, - RsDepthFunc depthFunc); -}; - -class ProgramStoreState { -public: - ProgramStoreState(); - ~ProgramStoreState(); - void init(Context *rsc); - void deinit(Context *rsc); - - ObjectBaseRef<ProgramStore> mDefault; - ObjectBaseRef<ProgramStore> mLast; - - // Cache of all existing store programs. - Vector<ProgramStore *> mStorePrograms; -}; - -} -} -#endif - - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramVertex.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramVertex.h deleted file mode 100644 index 105d065..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsProgramVertex.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_PROGRAM_VERTEX_H -#define ANDROID_RS_PROGRAM_VERTEX_H - -#include "rsProgram.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -class ProgramVertexState; - -class ProgramVertex : public Program { -public: - ProgramVertex(Context *,const char * shaderText, size_t shaderLength, - const char** textureNames, size_t textureNamesCount, const size_t *textureNamesLength, - const uint32_t * params, size_t paramLength); - virtual ~ProgramVertex(); - - virtual void setup(Context *rsc, ProgramVertexState *state); - - void setProjectionMatrix(Context *, const rsc_Matrix *) const; - void getProjectionMatrix(Context *, rsc_Matrix *) const; - void setModelviewMatrix(Context *, const rsc_Matrix *) const; - void setTextureMatrix(Context *, const rsc_Matrix *) const; - - void transformToScreen(Context *, float *v4out, const float *v3in) const; - - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_VERTEX; } - static ProgramVertex *createFromStream(Context *rsc, IStream *stream); -}; - -class ProgramVertexState { -public: - ProgramVertexState(); - ~ProgramVertexState(); - - void init(Context *rsc); - void deinit(Context *rsc); - void updateSize(Context *rsc); - - ObjectBaseRef<ProgramVertex> mDefault; - ObjectBaseRef<ProgramVertex> mLast; - ObjectBaseRef<Allocation> mDefaultAlloc; -}; - -} -} -#endif - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsRuntime.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsRuntime.h deleted file mode 100644 index 73cfefb..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsRuntime.h +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "rsContext.h" -#include "rsScriptC.h" - -#if !defined(RS_SERVER) && !defined(RS_COMPATIBILITY_LIB) -#include "utils/Timers.h" -#endif - -#include <time.h> - -namespace android { -namespace renderscript { - - -////////////////////////////////////////////////////////////////////////////// -// Context -////////////////////////////////////////////////////////////////////////////// - -void rsrAllocationSyncAll(Context *, Script *, Allocation *); - -#ifndef RS_COMPATIBILITY_LIB -void rsrBindTexture(Context *, ProgramFragment *, uint32_t slot, Allocation *); -void rsrBindConstant(Context *, ProgramFragment *, uint32_t slot, Allocation *); -void rsrBindConstant(Context *, ProgramVertex*, uint32_t slot, Allocation *); -void rsrBindSampler(Context *, ProgramFragment *, uint32_t slot, Sampler *); -void rsrBindProgramStore(Context *, ProgramStore *); -void rsrBindProgramFragment(Context *, ProgramFragment *); -void rsrBindProgramVertex(Context *, ProgramVertex *); -void rsrBindProgramRaster(Context *, ProgramRaster *); -void rsrBindFrameBufferObjectColorTarget(Context *, Allocation *, uint32_t slot); -void rsrBindFrameBufferObjectDepthTarget(Context *, Allocation *); -void rsrClearFrameBufferObjectColorTarget(Context *, uint32_t slot); -void rsrClearFrameBufferObjectDepthTarget(Context *); -void rsrClearFrameBufferObjectTargets(Context *); - -////////////////////////////////////////////////////////////////////////////// -// VP -////////////////////////////////////////////////////////////////////////////// - -void rsrVpLoadProjectionMatrix(Context *, const rsc_Matrix *m); -void rsrVpLoadModelMatrix(Context *, const rsc_Matrix *m); -void rsrVpLoadTextureMatrix(Context *, const rsc_Matrix *m); -void rsrPfConstantColor(Context *, ProgramFragment *, float r, float g, float b, float a); -void rsrVpGetProjectionMatrix(Context *, rsc_Matrix *m); - -////////////////////////////////////////////////////////////////////////////// -// Drawing -////////////////////////////////////////////////////////////////////////////// - -void rsrDrawPath(Context *, Path *); -void rsrDrawMesh(Context *, Mesh *); -void rsrDrawMeshPrimitive(Context *, Mesh *, uint32_t primIndex); -void rsrDrawMeshPrimitiveRange(Context *, Mesh *, - uint32_t primIndex, uint32_t start, uint32_t len); -void rsrMeshComputeBoundingBox(Context *, Mesh *, - float *minX, float *minY, float *minZ, - float *maxX, float *maxY, float *maxZ); - - -////////////////////////////////////////////////////////////////////////////// -// -////////////////////////////////////////////////////////////////////////////// - - -void rsrColor(Context *, float r, float g, float b, float a); -#endif - -void rsrAllocationCopy1DRange(Context *, Allocation *dstAlloc, - uint32_t dstOff, - uint32_t dstMip, - uint32_t count, - Allocation *srcAlloc, - uint32_t srcOff, uint32_t srcMip); -void rsrAllocationCopy2DRange(Context *, Allocation *dstAlloc, - uint32_t dstXoff, uint32_t dstYoff, - uint32_t dstMip, uint32_t dstFace, - uint32_t width, uint32_t height, - Allocation *srcAlloc, - uint32_t srcXoff, uint32_t srcYoff, - uint32_t srcMip, uint32_t srcFace); - -#ifndef RS_COMPATIBILITY_LIB -void rsrPrepareClear(Context *); -uint32_t rsrGetWidth(Context *); -uint32_t rsrGetHeight(Context *); -void rsrDrawTextAlloc(Context *, Allocation *, int x, int y); -void rsrDrawText(Context *, const char *text, int x, int y); -void rsrSetMetrics(Context *, Font::Rect *metrics, - int32_t *left, int32_t *right, int32_t *top, int32_t *bottom); -void rsrMeasureTextAlloc(Context *, Allocation *, - int32_t *left, int32_t *right, int32_t *top, int32_t *bottom); -void rsrMeasureText(Context *, const char *text, - int32_t *left, int32_t *right, int32_t *top, int32_t *bottom); -void rsrBindFont(Context *, Font *); -void rsrFontColor(Context *, float r, float g, float b, float a); - -#endif - -void rsrAllocationIoSend(Context *, Allocation *); -void rsrAllocationIoReceive(Context *, Allocation *); - -////////////////////////////////////////////////////////////////////////////// -// Time routines -////////////////////////////////////////////////////////////////////////////// - -float rsrGetDt(Context *, const Script *sc); -time_t rsrTime(Context *, time_t *timer); -tm* rsrLocalTime(Context *, tm *local, time_t *timer); -int64_t rsrUptimeMillis(Context *); -int64_t rsrUptimeNanos(Context *); - -////////////////////////////////////////////////////////////////////////////// -// Message routines -////////////////////////////////////////////////////////////////////////////// - -// Keep existing routines to not break current GPU drivers. -uint32_t __attribute((used)) rsrToClient(Context *, int cmdID, void *data, int len); -uint32_t __attribute((used)) rsrToClientBlocking(Context *, int cmdID, void *data, int len); - -uint32_t rsrToClient(Context *, int cmdID, const void *data, int len); -uint32_t rsrToClientBlocking(Context *, int cmdID, const void *data, int len); - -////////////////////////////////////////////////////////////////////////////// -// -////////////////////////////////////////////////////////////////////////////// - -void rsrSetObject(const Context *, ObjectBase **dst, ObjectBase * src); -void rsrClearObject(const Context *, ObjectBase **dst); -bool rsrIsObject(const Context *, const ObjectBase *src); - -void rsrAllocationIncRefs(const Context *, const Allocation *, void *ptr, - size_t elementCount, size_t startOffset); -void rsrAllocationDecRefs(const Context *, const Allocation *, void *ptr, - size_t elementCount, size_t startOffset); - - -void rsrAllocationSyncAll(Context *, Allocation *a, RsAllocationUsageType source); - - -void rsrForEach(Context *, Script *target, - Allocation *in, - Allocation *out, - const void *usr, - uint32_t usrBytes, - const RsScriptCall *call); - - -////////////////////////////////////////////////////////////////////////////// -// Heavy math functions -////////////////////////////////////////////////////////////////////////////// - - -void rsrMatrixSet(rs_matrix4x4 *m, uint32_t row, uint32_t col, float v); -float rsrMatrixGet(const rs_matrix4x4 *m, uint32_t row, uint32_t col); -void rsrMatrixSet(rs_matrix3x3 *m, uint32_t row, uint32_t col, float v); -float rsrMatrixGet(const rs_matrix3x3 *m, uint32_t row, uint32_t col); -void rsrMatrixSet(rs_matrix2x2 *m, uint32_t row, uint32_t col, float v); -float rsrMatrixGet(const rs_matrix2x2 *m, uint32_t row, uint32_t col); -void rsrMatrixLoadIdentity_4x4(rs_matrix4x4 *m); -void rsrMatrixLoadIdentity_3x3(rs_matrix3x3 *m); -void rsrMatrixLoadIdentity_2x2(rs_matrix2x2 *m); -void rsrMatrixLoad_4x4_f(rs_matrix4x4 *m, const float *v); -void rsrMatrixLoad_3x3_f(rs_matrix3x3 *m, const float *v); -void rsrMatrixLoad_2x2_f(rs_matrix2x2 *m, const float *v); -void rsrMatrixLoad_4x4_4x4(rs_matrix4x4 *m, const rs_matrix4x4 *v); -void rsrMatrixLoad_4x4_3x3(rs_matrix4x4 *m, const rs_matrix3x3 *v); -void rsrMatrixLoad_4x4_2x2(rs_matrix4x4 *m, const rs_matrix2x2 *v); -void rsrMatrixLoad_3x3_3x3(rs_matrix3x3 *m, const rs_matrix3x3 *v); -void rsrMatrixLoad_2x2_2x2(rs_matrix2x2 *m, const rs_matrix2x2 *v); -void rsrMatrixLoadRotate(rs_matrix4x4 *m, float rot, float x, float y, float z); -void rsrMatrixLoadScale(rs_matrix4x4 *m, float x, float y, float z); -void rsrMatrixLoadTranslate(rs_matrix4x4 *m, float x, float y, float z); -void rsrMatrixLoadMultiply_4x4_4x4_4x4(rs_matrix4x4 *m, const rs_matrix4x4 *lhs, - const rs_matrix4x4 *rhs); -void rsrMatrixMultiply_4x4_4x4(rs_matrix4x4 *m, const rs_matrix4x4 *rhs); -void rsrMatrixLoadMultiply_3x3_3x3_3x3(rs_matrix3x3 *m, const rs_matrix3x3 *lhs, - const rs_matrix3x3 *rhs); -void rsrMatrixMultiply_3x3_3x3(rs_matrix3x3 *m, const rs_matrix3x3 *rhs); -void rsrMatrixLoadMultiply_2x2_2x2_2x2(rs_matrix2x2 *m, const rs_matrix2x2 *lhs, - const rs_matrix2x2 *rhs); -void rsrMatrixMultiply_2x2_2x2(rs_matrix2x2 *m, const rs_matrix2x2 *rhs); -void rsrMatrixRotate(rs_matrix4x4 *m, float rot, float x, float y, float z); -void rsrMatrixScale(rs_matrix4x4 *m, float x, float y, float z); -void rsrMatrixTranslate(rs_matrix4x4 *m, float x, float y, float z); -void rsrMatrixLoadOrtho(rs_matrix4x4 *m, float left, float right, - float bottom, float top, float near, float far); -void rsrMatrixLoadFrustum(rs_matrix4x4 *m, float left, float right, - float bottom, float top, float near, float far); -void rsrMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far); - -// Returns true if the matrix was successfully inversed -bool rsrMatrixInverse_4x4(rs_matrix4x4 *m); -// Returns true if the matrix was successfully inversed -bool rsrMatrixInverseTranspose_4x4(rs_matrix4x4 *m); - -void rsrMatrixTranspose_4x4(rs_matrix4x4 *m); -void rsrMatrixTranspose_3x3(rs_matrix3x3 *m); -void rsrMatrixTranspose_2x2(rs_matrix2x2 *m); - -} -} diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsSampler.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsSampler.h deleted file mode 100644 index 2fdf707..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsSampler.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_SAMPLER_H -#define ANDROID_RS_SAMPLER_H - -#include "rsAllocation.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -const static uint32_t RS_MAX_SAMPLER_SLOT = 16; - -class SamplerState; -/***************************************************************************** - * CAUTION - * - * Any layout changes for this class may require a corresponding change to be - * made to frameworks/compile/libbcc/lib/ScriptCRT/rs_core.c, which contains - * a partial copy of the information below. - * - *****************************************************************************/ -class Sampler : public ObjectBase { -public: - struct Hal { - mutable void *drv; - - struct State { - RsSamplerValue magFilter; - RsSamplerValue minFilter; - RsSamplerValue wrapS; - RsSamplerValue wrapT; - RsSamplerValue wrapR; - float aniso; - }; - State state; - }; - Hal mHal; - - void operator delete(void* ptr); - - static ObjectBaseRef<Sampler> getSampler(Context *, - RsSamplerValue magFilter, - RsSamplerValue minFilter, - RsSamplerValue wrapS, - RsSamplerValue wrapT, - RsSamplerValue wrapR, - float aniso = 1.0f); - void bindToContext(SamplerState *, uint32_t slot); - void unbindFromContext(SamplerState *); - - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_SAMPLER; } - static Sampler *createFromStream(Context *rsc, IStream *stream); - -protected: - int32_t mBoundSlot; - - virtual void preDestroy() const; - virtual ~Sampler(); - -private: - Sampler(Context *); - Sampler(Context *, - RsSamplerValue magFilter, - RsSamplerValue minFilter, - RsSamplerValue wrapS, - RsSamplerValue wrapT, - RsSamplerValue wrapR, - float aniso = 1.0f); -}; - - -class SamplerState { -public: - ObjectBaseRef<Sampler> mSamplers[RS_MAX_SAMPLER_SLOT]; - void init(Context *rsc) { - } - void deinit(Context *rsc) { - for (uint32_t i = 0; i < RS_MAX_SAMPLER_SLOT; i ++) { - mSamplers[i].clear(); - } - } - // Cache of all existing raster programs. - Vector<Sampler *> mAllSamplers; -}; - -} -} -#endif //ANDROID_RS_SAMPLER_H - - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsScript.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsScript.h deleted file mode 100644 index ce4878a..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsScript.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2009-2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_SCRIPT_H -#define ANDROID_RS_SCRIPT_H - -#include "rsAllocation.h" - -#include <utility> - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -#ifndef RS_COMPATIBILITY_LIB -class ProgramVertex; -class ProgramFragment; -class ProgramRaster; -class ProgramStore; -#endif - -class ScriptKernelID : public ObjectBase { -public: - ScriptKernelID(Context *rsc, Script *s, int slot, int sig); - virtual ~ScriptKernelID(); - - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const; - - Script *mScript; - int mSlot; - bool mHasKernelInput; - bool mHasKernelOutput; -}; - -class ScriptFieldID : public ObjectBase { -public: - ScriptFieldID(Context *rsc, Script *s, int slot); - virtual ~ScriptFieldID(); - - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const; - - Script *mScript; - int mSlot; -}; - -class Script : public ObjectBase { -public: - - struct Hal { - void * drv; - - struct DriverInfo { - int mVersionMajor; - int mVersionMinor; - - size_t exportedVariableCount; - size_t exportedFunctionCount; - size_t exportedPragmaCount; - char const **exportedPragmaKeyList; - char const **exportedPragmaValueList; - const std::pair<const char *, uint32_t> *exportedForeachFuncList; - - int (* root)(); - }; - DriverInfo info; - }; - Hal mHal; - - typedef void (* InvokeFunc_t)(void); - - Script(Context *); - virtual ~Script(); - - struct Enviroment_t { - int64_t mStartTimeMillis; - mutable int64_t mLastDtTime; - -#ifndef RS_COMPATIBILITY_LIB - ObjectBaseRef<ProgramVertex> mVertex; - ObjectBaseRef<ProgramFragment> mFragment; - ObjectBaseRef<ProgramRaster> mRaster; - ObjectBaseRef<ProgramStore> mFragmentStore; -#endif - }; - Enviroment_t mEnviroment; - - void setSlot(uint32_t slot, Allocation *a); - void setVar(uint32_t slot, const void *val, size_t len); - void getVar(uint32_t slot, const void *val, size_t len); - void setVar(uint32_t slot, const void *val, size_t len, Element *e, - const size_t *dims, size_t dimLen); - void setVarObj(uint32_t slot, ObjectBase *val); - - virtual bool freeChildren(); - - virtual void runForEach(Context *rsc, - uint32_t slot, - const Allocation * ain, - Allocation * aout, - const void * usr, - size_t usrBytes, - const RsScriptCall *sc = NULL) = 0; - - virtual void Invoke(Context *rsc, uint32_t slot, const void *data, size_t len) = 0; - virtual void setupScript(Context *rsc) = 0; - virtual uint32_t run(Context *) = 0; - - bool hasObjectSlots() const { - return mHasObjectSlots; - } -protected: - bool mInitialized; - bool mHasObjectSlots; - ObjectBaseRef<Allocation> *mSlots; - ObjectBaseRef<const Type> *mTypes; - -}; - - -} -} -#endif - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsScriptC.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsScriptC.h deleted file mode 100644 index c1e3301..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsScriptC.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2009-2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_SCRIPT_C_H -#define ANDROID_RS_SCRIPT_C_H - -#include "rsScript.h" - -#include "rsEnv.h" - -#ifndef RS_COMPATIBILITY_LIB -#ifndef ANDROID_RS_SERIALIZE -#include "bcinfo/BitcodeTranslator.h" -#endif -#endif - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - - -class ScriptC : public Script { -public: - typedef int (*RunScript_t)(); - typedef void (*VoidFunc_t)(); - - ScriptC(Context *); - virtual ~ScriptC(); - - virtual void Invoke(Context *rsc, uint32_t slot, const void *data, size_t len); - - virtual uint32_t run(Context *); - - virtual void runForEach(Context *rsc, - uint32_t slot, - const Allocation * ain, - Allocation * aout, - const void * usr, - size_t usrBytes, - const RsScriptCall *sc = NULL); - - virtual void serialize(Context *rsc, OStream *stream) const { } - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_SCRIPT_C; } - static Type *createFromStream(Context *rsc, IStream *stream) { return NULL; } - - bool runCompiler(Context *rsc, const char *resName, const char *cacheDir, - const uint8_t *bitcode, size_t bitcodeLen); - -//protected: - void setupScript(Context *); - void setupGLState(Context *); -private: -#ifndef RS_COMPATIBILITY_LIB -#ifndef ANDROID_RS_SERIALIZE - bcinfo::BitcodeTranslator *BT; -#endif - - bool createCacheDir(const char *cacheDir); -#endif -}; - -class ScriptCState { -public: - ScriptCState(); - ~ScriptCState(); - - char * mScriptText; - size_t mScriptLen; - - struct SymbolTable_t { - const char * mName; - void * mPtr; - bool threadable; - }; - static const SymbolTable_t * lookupSymbol(const char *); - static const SymbolTable_t * lookupSymbolCL(const char *); - static const SymbolTable_t * lookupSymbolGL(const char *); -}; - - -} -} -#endif diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsScriptGroup.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsScriptGroup.h deleted file mode 100644 index d51b1db..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsScriptGroup.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_SCRIPT_GROUP_H -#define ANDROID_RS_SCRIPT_GROUP_H - -#include "rsAllocation.h" -#include "rsScript.h" - - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -class ProgramVertex; -class ProgramFragment; -class ProgramRaster; -class ProgramStore; - -class ScriptGroup : public ObjectBase { -public: - Vector<ObjectBaseRef<ScriptKernelID> > mKernels; - - class Link { - public: - ObjectBaseRef<const ScriptKernelID> mSource; - ObjectBaseRef<const ScriptKernelID> mDstKernel; - ObjectBaseRef<const ScriptFieldID> mDstField; - ObjectBaseRef<const Type> mType; - ObjectBaseRef<Allocation> mAlloc; - Link(); - ~Link(); - }; - - class Node { - public: - Node(Script *); - - Vector<const ScriptKernelID *> mKernels; - Vector<Link *> mOutputs; - Vector<Link *> mInputs; - bool mSeen; - int mOrder; - Script *mScript; - }; - - class IO { - public: - IO(const ScriptKernelID *); - - const ScriptKernelID *mKernel; - ObjectBaseRef<Allocation> mAlloc; - }; - - Vector<Link *> mLinks; - Vector<Node *> mNodes; - Vector<IO *> mInputs; - Vector<IO *> mOutputs; - - struct Hal { - void * drv; - - struct DriverInfo { - }; - DriverInfo info; - }; - Hal mHal; - - static ScriptGroup * create(Context *rsc, - ScriptKernelID ** kernels, size_t kernelsSize, - ScriptKernelID ** src, size_t srcSize, - ScriptKernelID ** dstK, size_t dstKSize, - ScriptFieldID ** dstF, size_t dstFSize, - const Type ** type, size_t typeSize); - - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const; - - void execute(Context *rsc); - void setInput(Context *rsc, ScriptKernelID *kid, Allocation *a); - void setOutput(Context *rsc, ScriptKernelID *kid, Allocation *a); - - -protected: - virtual ~ScriptGroup(); - bool mInitialized; - - -private: - bool calcOrderRecurse(Node *n, int depth); - bool calcOrder(); - Node * findNode(Script *s) const; - - ScriptGroup(Context *); -}; - - -} -} -#endif - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsScriptIntrinsic.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsScriptIntrinsic.h deleted file mode 100644 index 696f2db..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsScriptIntrinsic.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_SCRIPT_INTRINSIC_H -#define ANDROID_RS_SCRIPT_INTRINSIC_H - -#include "rsScript.h" - - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - - -class ScriptIntrinsic : public Script { -public: - - ObjectBaseRef<const Element> mElement; - - ScriptIntrinsic(Context *); - virtual ~ScriptIntrinsic(); - - bool init(Context *rsc, RsScriptIntrinsicID iid, Element *e); - - - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const; - virtual bool freeChildren(); - - virtual void runForEach(Context *rsc, - uint32_t slot, - const Allocation * ain, - Allocation * aout, - const void * usr, - size_t usrBytes, - const RsScriptCall *sc = NULL); - - virtual void Invoke(Context *rsc, uint32_t slot, const void *data, size_t len); - virtual void setupScript(Context *rsc); - virtual uint32_t run(Context *); -protected: - uint32_t mIntrinsicID; - -}; - - -} -} -#endif - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsSignal.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsSignal.h deleted file mode 100644 index fc31883..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsSignal.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_SIGNAL_H -#define ANDROID_RS_SIGNAL_H - - -#include "rsUtils.h" - -namespace android { -namespace renderscript { - -class Signal { -public: - Signal(); - ~Signal(); - - bool init(); - - void set(); - - // returns true if the signal occured - // false for timeout - bool wait(uint64_t timeout = 0); - -protected: - bool mSet; - pthread_mutex_t mMutex; - pthread_cond_t mCondition; -}; - -} -} - -#endif - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsStream.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsStream.h deleted file mode 100644 index d0ed62e..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsStream.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_STREAM_H -#define ANDROID_RS_STREAM_H - -#include <stdio.h> -#include "rsUtils.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -class IStream { -public: - IStream(const uint8_t *, bool use64); - - float loadF() { - mPos = (mPos + 3) & (~3); - float tmp = reinterpret_cast<const float *>(&mData[mPos])[0]; - mPos += sizeof(float); - return tmp; - } - int32_t loadI32() { - mPos = (mPos + 3) & (~3); - int32_t tmp = reinterpret_cast<const int32_t *>(&mData[mPos])[0]; - mPos += sizeof(int32_t); - return tmp; - } - uint32_t loadU32() { - mPos = (mPos + 3) & (~3); - uint32_t tmp = reinterpret_cast<const uint32_t *>(&mData[mPos])[0]; - mPos += sizeof(uint32_t); - return tmp; - } - uint16_t loadU16() { - mPos = (mPos + 1) & (~1); - uint16_t tmp = reinterpret_cast<const uint16_t *>(&mData[mPos])[0]; - mPos += sizeof(uint16_t); - return tmp; - } - inline uint8_t loadU8() { - uint8_t tmp = reinterpret_cast<const uint8_t *>(&mData[mPos])[0]; - mPos += sizeof(uint8_t); - return tmp; - } - void loadByteArray(void *dest, size_t numBytes); - uint64_t loadOffset(); - const char * loadString(); - uint64_t getPos() const { - return mPos; - } - void reset(uint64_t pos) { - mPos = pos; - } - void reset() { - mPos = 0; - } - - const uint8_t * getPtr() const { - return mData; - } -protected: - const uint8_t * mData; - uint64_t mPos; - bool mUse64; -}; - -class OStream { -public: - OStream(uint64_t length, bool use64); - ~OStream(); - - void align(uint32_t bytes) { - mPos = (mPos + (bytes - 1)) & (~(bytes - 1)); - if (mPos >= mLength) { - growSize(); - } - } - - void addF(float v) { - uint32_t uintV = *reinterpret_cast<uint32_t*> (&v); - addU32(uintV); - } - void addI32(int32_t v) { - mPos = (mPos + 3) & (~3); - if (mPos + sizeof(v) >= mLength) { - growSize(); - } - mData[mPos++] = (uint8_t)(v & 0xff); - mData[mPos++] = (uint8_t)((v >> 8) & 0xff); - mData[mPos++] = (uint8_t)((v >> 16) & 0xff); - mData[mPos++] = (uint8_t)((v >> 24) & 0xff); - } - void addU32(uint32_t v) { - mPos = (mPos + 3) & (~3); - if (mPos + sizeof(v) >= mLength) { - growSize(); - } - mData[mPos++] = (uint8_t)(v & 0xff); - mData[mPos++] = (uint8_t)((v >> 8) & 0xff); - mData[mPos++] = (uint8_t)((v >> 16) & 0xff); - mData[mPos++] = (uint8_t)((v >> 24) & 0xff); - } - void addU16(uint16_t v) { - mPos = (mPos + 1) & (~1); - if (mPos + sizeof(v) >= mLength) { - growSize(); - } - mData[mPos++] = (uint8_t)(v & 0xff); - mData[mPos++] = (uint8_t)(v >> 8); - } - inline void addU8(uint8_t v) { - if (mPos + 1 >= mLength) { - growSize(); - } - reinterpret_cast<uint8_t *>(&mData[mPos])[0] = v; - mPos ++; - } - void addByteArray(const void *src, size_t numBytes); - void addOffset(uint64_t v); - void addString(const char *name); - void addString(const char *name, size_t len); - uint64_t getPos() const { - return mPos; - } - void reset(uint64_t pos) { - mPos = pos; - } - void reset() { - mPos = 0; - } - const uint8_t * getPtr() const { - return mData; - } -protected: - void growSize(); - uint8_t * mData; - uint64_t mLength; - uint64_t mPos; - bool mUse64; -}; - - -} // renderscript -} // android -#endif //ANDROID_RS_STREAM_H - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsThreadIO.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsThreadIO.h deleted file mode 100644 index e0a108f..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsThreadIO.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_THREAD_IO_H -#define ANDROID_RS_THREAD_IO_H - -#include "rsUtils.h" -#include "rsFifoSocket.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { - -class Context; - -class ThreadIO { -public: - ThreadIO(); - ~ThreadIO(); - - void init(); - void shutdown(); - - size_t getMaxInlineSize() { - return mMaxInlineSize; - } - bool isPureFifo() { - return mPureFifo; - } - - // Plays back commands from the client. - // Returns true if any commands were processed. - bool playCoreCommands(Context *con, int waitFd); - - void setTimeoutCallback(void (*)(void *), void *, uint64_t timeout); - - void * coreHeader(uint32_t, size_t dataLen); - void coreCommit(); - - void coreSetReturn(const void *data, size_t dataLen); - void coreGetReturn(void *data, size_t dataLen); - void coreWrite(const void *data, size_t len); - void coreRead(void *data, size_t len); - - void asyncSetReturn(const void *data, size_t dataLen); - void asyncGetReturn(void *data, size_t dataLen); - void asyncWrite(const void *data, size_t len); - void asyncRead(void *data, size_t len); - - - RsMessageToClientType getClientHeader(size_t *receiveLen, uint32_t *usrID); - RsMessageToClientType getClientPayload(void *data, size_t *receiveLen, uint32_t *subID, size_t bufferLen); - bool sendToClient(RsMessageToClientType cmdID, uint32_t usrID, const void *data, size_t dataLen, bool waitForSpace); - void clientShutdown(); - - -protected: - typedef struct CoreCmdHeaderRec { - uint32_t cmdID; - uint32_t bytes; - } CoreCmdHeader; - typedef struct ClientCmdHeaderRec { - uint32_t cmdID; - uint32_t bytes; - uint32_t userID; - } ClientCmdHeader; - ClientCmdHeader mLastClientHeader; - - bool mRunning; - bool mPureFifo; - size_t mMaxInlineSize; - - FifoSocket mToClient; - FifoSocket mToCore; - - intptr_t mToCoreRet; - - size_t mSendLen; - uint8_t mSendBuffer[2 * 1024] __attribute__((aligned(sizeof(double)))); - -}; - - -} -} -#endif - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsType.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsType.h deleted file mode 100644 index 26dacfc..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsType.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_STRUCTURED_TYPE_H -#define ANDROID_STRUCTURED_TYPE_H - -#include "rsElement.h" - -// --------------------------------------------------------------------------- -namespace android { -namespace renderscript { -/***************************************************************************** - * CAUTION - * - * Any layout changes for this class may require a corresponding change to be - * made to frameworks/compile/libbcc/lib/ScriptCRT/rs_core.c, which contains - * a partial copy of the information below. - * - *****************************************************************************/ - -class Type : public ObjectBase { -public: - struct Hal { - mutable void *drv; - - struct State { - const Element * element; - - // Size of the structure in the various dimensions. A missing Dimension is - // specified as a 0 and not a 1. - uint32_t dimX; - uint32_t dimY; - uint32_t dimZ; - uint32_t *lodDimX; - uint32_t *lodDimY; - uint32_t *lodDimZ; - uint32_t *_unused; - uint32_t lodCount; - uint32_t dimYuv; - bool faces; - }; - State state; - }; - Hal mHal; - - Type * createTex2D(const Element *, size_t w, size_t h, bool mip); - - size_t getCellCount() const {return mCellCount;} - size_t getElementSizeBytes() const {return mElement->getSizeBytes();} - size_t getPackedSizeBytes() const {return mCellCount * mElement->getSizeBytes();} - const Element * getElement() const {return mElement.get();} - - uint32_t getDimX() const {return mHal.state.dimX;} - uint32_t getDimY() const {return mHal.state.dimY;} - uint32_t getDimZ() const {return mHal.state.dimZ;} - bool getDimLOD() const {return mDimLOD;} - bool getDimFaces() const {return mHal.state.faces;} - uint32_t getDimYuv() const {return mHal.state.dimYuv;} - - uint32_t getLODDimX(uint32_t lod) const { - rsAssert(lod < mHal.state.lodCount); - return mHal.state.lodDimX[lod]; - } - uint32_t getLODDimY(uint32_t lod) const { - rsAssert(lod < mHal.state.lodCount); - return mHal.state.lodDimY[lod]; - } - uint32_t getLODDimZ(uint32_t lod) const { - rsAssert(lod < mHal.state.lodCount); - return mHal.state.lodDimZ[lod]; - } - - uint32_t getLODCount() const {return mHal.state.lodCount;} - bool getIsNp2() const; - - void clear(); - void compute(); - - void dumpLOGV(const char *prefix) const; - virtual void serialize(Context *rsc, OStream *stream) const; - virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_TYPE; } - static Type *createFromStream(Context *rsc, IStream *stream); - - ObjectBaseRef<Type> cloneAndResize1D(Context *rsc, uint32_t dimX) const; - ObjectBaseRef<Type> cloneAndResize2D(Context *rsc, uint32_t dimX, uint32_t dimY) const; - - static ObjectBaseRef<Type> getTypeRef(Context *rsc, const Element *e, - uint32_t dimX, uint32_t dimY, uint32_t dimZ, - bool dimLOD, bool dimFaces, uint32_t dimYuv); - - static Type* getType(Context *rsc, const Element *e, - uint32_t dimX, uint32_t dimY, uint32_t dimZ, - bool dimLOD, bool dimFaces, uint32_t yuv) { - ObjectBaseRef<Type> type = getTypeRef(rsc, e, dimX, dimY, dimZ, dimLOD, dimFaces, yuv); - type->incUserRef(); - return type.get(); - } - - 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; - -protected: - void makeLODTable(); - bool mDimLOD; - - // Internal structure from most to least significant. - // * Array dimensions - // * Faces - // * Mipmaps - // * xyz - - ObjectBaseRef<const Element> mElement; - - // count of mipmap levels, 0 indicates no mipmapping - - size_t mCellCount; -protected: - virtual void preDestroy() const; - virtual ~Type(); - -private: - Type(Context *); - Type(const Type &); -}; - - -class TypeState { -public: - TypeState(); - ~TypeState(); - - // Cache of all existing types. - Vector<Type *> mTypes; -}; - - -} -} -#endif //ANDROID_STRUCTURED_TYPE diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsUtils.h b/9/platforms/android-19/arch-x86/usr/include/rs/rsUtils.h deleted file mode 100644 index d698928..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsUtils.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_RS_UTILS_H -#define ANDROID_RS_UTILS_H - -#define LOG_NDEBUG 0 -#define LOG_TAG "RenderScript" - -#ifdef RS_SERVER - -#define ALOGE(...) -#define ALOGV(...) -#define ALOGW(...) -#define ALOGD(...) - -#endif - -#include "rsCppUtils.h" - -#endif //ANDROID_RS_UTILS_H - - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rs_hal.h b/9/platforms/android-19/arch-x86/usr/include/rs/rs_hal.h deleted file mode 100644 index 9ae6fed..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rs_hal.h +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (C) 2011-2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RS_HAL_H -#define RS_HAL_H - -#include <rsDefines.h> - -struct ANativeWindow; - -namespace android { -namespace renderscript { - -class Context; -class ObjectBase; -class Element; -class Type; -class Allocation; -class Script; -class ScriptKernelID; -class ScriptFieldID; -class ScriptMethodID; -class ScriptC; -class ScriptGroup; -class Path; -class Program; -class ProgramStore; -class ProgramRaster; -class ProgramVertex; -class ProgramFragment; -class Mesh; -class Sampler; -class FBOCache; - -typedef void *(*RsHalSymbolLookupFunc)(void *usrptr, char const *symbolName); - -typedef struct { - const void *in; - void *out; - const void *usr; - size_t usrLen; - uint32_t x; - uint32_t y; - uint32_t z; - uint32_t lod; - RsAllocationCubemapFace face; - uint32_t ar[16]; - uint32_t lid; - - uint32_t dimX; - uint32_t dimY; - uint32_t dimZ; - uint32_t dimArray; - - const uint8_t *ptrIn; - uint8_t *ptrOut; - uint32_t eStrideIn; - uint32_t eStrideOut; - uint32_t yStrideIn; - uint32_t yStrideOut; - uint32_t slot; -} RsForEachStubParamStruct; - -/** - * Script management functions - */ -typedef struct { - bool (*initGraphics)(const Context *); - void (*shutdownGraphics)(const Context *); - bool (*setSurface)(const Context *, uint32_t w, uint32_t h, RsNativeWindow); - void (*swap)(const Context *); - - void (*shutdownDriver)(Context *); - void (*getVersion)(unsigned int *major, unsigned int *minor); - void (*setPriority)(const Context *, int32_t priority); - - void* (*allocRuntimeMem)(size_t size, uint32_t flags); - void (*freeRuntimeMem)(void* ptr); - - struct { - bool (*init)(const Context *rsc, ScriptC *s, - char const *resName, - char const *cacheDir, - uint8_t const *bitcode, - size_t bitcodeSize, - uint32_t flags); - bool (*initIntrinsic)(const Context *rsc, Script *s, - RsScriptIntrinsicID iid, - Element *e); - - void (*invokeFunction)(const Context *rsc, Script *s, - uint32_t slot, - const void *params, - size_t paramLength); - int (*invokeRoot)(const Context *rsc, Script *s); - void (*invokeForEach)(const Context *rsc, - Script *s, - uint32_t slot, - const Allocation * ain, - Allocation * aout, - const void * usr, - size_t usrLen, - const RsScriptCall *sc); - void (*invokeInit)(const Context *rsc, Script *s); - void (*invokeFreeChildren)(const Context *rsc, Script *s); - - void (*setGlobalVar)(const Context *rsc, const Script *s, - uint32_t slot, - void *data, - size_t dataLength); - void (*getGlobalVar)(const Context *rsc, const Script *s, - uint32_t slot, - void *data, - size_t dataLength); - void (*setGlobalVarWithElemDims)(const Context *rsc, const Script *s, - uint32_t slot, - void *data, - size_t dataLength, - const Element *e, - const size_t *dims, - size_t dimLength); - void (*setGlobalBind)(const Context *rsc, const Script *s, - uint32_t slot, - Allocation *data); - void (*setGlobalObj)(const Context *rsc, const Script *s, - uint32_t slot, - ObjectBase *data); - - void (*destroy)(const Context *rsc, Script *s); - } script; - - struct { - bool (*init)(const Context *rsc, Allocation *alloc, bool forceZero); - void (*destroy)(const Context *rsc, Allocation *alloc); - uint32_t (*grallocBits)(const Context *rsc, Allocation *alloc); - - void (*resize)(const Context *rsc, const Allocation *alloc, const Type *newType, - bool zeroNew); - void (*syncAll)(const Context *rsc, const Allocation *alloc, RsAllocationUsageType src); - void (*markDirty)(const Context *rsc, const Allocation *alloc); - - void (*setSurface)(const Context *rsc, Allocation *alloc, ANativeWindow *sur); - void (*ioSend)(const Context *rsc, Allocation *alloc); - - /** - * A new gralloc buffer is in use. The pointers and strides in - * mHal.drvState.lod[0-2] will be updated with the new values. - * - * The new gralloc handle is provided in mHal.state.nativeBuffer - * - */ - void (*ioReceive)(const Context *rsc, Allocation *alloc); - - void (*data1D)(const Context *rsc, const Allocation *alloc, - uint32_t xoff, uint32_t lod, size_t count, - const void *data, size_t sizeBytes); - void (*data2D)(const Context *rsc, const Allocation *alloc, - uint32_t xoff, uint32_t yoff, uint32_t lod, - RsAllocationCubemapFace face, uint32_t w, uint32_t h, - const void *data, size_t sizeBytes, size_t stride); - void (*data3D)(const Context *rsc, const Allocation *alloc, - uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod, - uint32_t w, uint32_t h, uint32_t d, const void *data, size_t sizeBytes, - size_t stride); - - void (*read1D)(const Context *rsc, const Allocation *alloc, - uint32_t xoff, uint32_t lod, size_t count, - void *data, size_t sizeBytes); - void (*read2D)(const Context *rsc, const Allocation *alloc, - uint32_t xoff, uint32_t yoff, uint32_t lod, - RsAllocationCubemapFace face, uint32_t w, uint32_t h, - void *data, size_t sizeBytes, size_t stride); - void (*read3D)(const Context *rsc, const Allocation *alloc, - uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod, - uint32_t w, uint32_t h, uint32_t d, void *data, size_t sizeBytes, - size_t stride); - - // Lock and unlock make a 1D region of memory available to the CPU - // for direct access by pointer. Once unlock is called control is - // returned to the SOC driver. - void * (*lock1D)(const Context *rsc, const Allocation *alloc); - void (*unlock1D)(const Context *rsc, const Allocation *alloc); - - // Allocation to allocation copies - void (*allocData1D)(const Context *rsc, - const Allocation *dstAlloc, - uint32_t dstXoff, uint32_t dstLod, size_t count, - const Allocation *srcAlloc, uint32_t srcXoff, uint32_t srcLod); - void (*allocData2D)(const Context *rsc, - const Allocation *dstAlloc, - uint32_t dstXoff, uint32_t dstYoff, uint32_t dstLod, - RsAllocationCubemapFace dstFace, uint32_t w, uint32_t h, - const Allocation *srcAlloc, - uint32_t srcXoff, uint32_t srcYoff, uint32_t srcLod, - RsAllocationCubemapFace srcFace); - void (*allocData3D)(const Context *rsc, - const Allocation *dstAlloc, - uint32_t dstXoff, uint32_t dstYoff, uint32_t dstZoff, - uint32_t dstLod, - uint32_t w, uint32_t h, uint32_t d, - const Allocation *srcAlloc, - uint32_t srcXoff, uint32_t srcYoff, uint32_t srcZoff, - uint32_t srcLod); - - void (*elementData1D)(const Context *rsc, const Allocation *alloc, uint32_t x, - const void *data, uint32_t elementOff, size_t sizeBytes); - void (*elementData2D)(const Context *rsc, const Allocation *alloc, uint32_t x, uint32_t y, - const void *data, uint32_t elementOff, size_t sizeBytes); - - void (*generateMipmaps)(const Context *rsc, const Allocation *alloc); - } allocation; - - struct { - bool (*init)(const Context *rsc, const ProgramStore *ps); - void (*setActive)(const Context *rsc, const ProgramStore *ps); - void (*destroy)(const Context *rsc, const ProgramStore *ps); - } store; - - struct { - bool (*init)(const Context *rsc, const ProgramRaster *ps); - void (*setActive)(const Context *rsc, const ProgramRaster *ps); - void (*destroy)(const Context *rsc, const ProgramRaster *ps); - } raster; - - struct { - bool (*init)(const Context *rsc, const ProgramVertex *pv, - const char* shader, size_t shaderLen, - const char** textureNames, size_t textureNamesCount, - const size_t *textureNamesLength); - void (*setActive)(const Context *rsc, const ProgramVertex *pv); - void (*destroy)(const Context *rsc, const ProgramVertex *pv); - } vertex; - - struct { - bool (*init)(const Context *rsc, const ProgramFragment *pf, - const char* shader, size_t shaderLen, - const char** textureNames, size_t textureNamesCount, - const size_t *textureNamesLength); - void (*setActive)(const Context *rsc, const ProgramFragment *pf); - void (*destroy)(const Context *rsc, const ProgramFragment *pf); - } fragment; - - struct { - bool (*init)(const Context *rsc, const Mesh *m); - void (*draw)(const Context *rsc, const Mesh *m, uint32_t primIndex, uint32_t start, uint32_t len); - void (*destroy)(const Context *rsc, const Mesh *m); - } mesh; - - struct { - bool (*initStatic)(const Context *rsc, const Path *m, const Allocation *vtx, const Allocation *loops); - bool (*initDynamic)(const Context *rsc, const Path *m); - void (*draw)(const Context *rsc, const Path *m); - void (*destroy)(const Context *rsc, const Path *m); - } path; - - struct { - bool (*init)(const Context *rsc, const Sampler *m); - void (*destroy)(const Context *rsc, const Sampler *m); - } sampler; - - struct { - bool (*init)(const Context *rsc, const FBOCache *fb); - void (*setActive)(const Context *rsc, const FBOCache *fb); - void (*destroy)(const Context *rsc, const FBOCache *fb); - } framebuffer; - - struct { - bool (*init)(const Context *rsc, ScriptGroup *sg); - void (*setInput)(const Context *rsc, const ScriptGroup *sg, - const ScriptKernelID *kid, Allocation *); - void (*setOutput)(const Context *rsc, const ScriptGroup *sg, - const ScriptKernelID *kid, Allocation *); - void (*execute)(const Context *rsc, const ScriptGroup *sg); - void (*destroy)(const Context *rsc, const ScriptGroup *sg); - } scriptgroup; - - void (*finish)(const Context *rsc); -} RsdHalFunctions; - - -} -} - -#ifdef __cplusplus -extern "C" { -#endif - -bool rsdHalInit(RsContext, uint32_t version_major, uint32_t version_minor); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rs_native.spec b/9/platforms/android-19/arch-x86/usr/include/rs/rs_native.spec deleted file mode 100644 index e69de29..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rs_native.spec +++ /dev/null diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsg.spec b/9/platforms/android-19/arch-x86/usr/include/rs/rsg.spec deleted file mode 100644 index 8ac73e8..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsg.spec +++ /dev/null @@ -1,123 +0,0 @@ -ProgramStoreCreate { - direct - param bool colorMaskR - param bool colorMaskG - param bool colorMaskB - param bool colorMaskA - param bool depthMask - param bool ditherEnable - param RsBlendSrcFunc srcFunc - param RsBlendDstFunc destFunc - param RsDepthFunc depthFunc - ret RsProgramStore - } - -ProgramRasterCreate { - direct - param bool pointSprite - param RsCullMode cull - ret RsProgramRaster -} - -ProgramBindConstants { - param RsProgram vp - param uint32_t slot - param RsAllocation constants - } - - -ProgramBindTexture { - param RsProgramFragment pf - param uint32_t slot - param RsAllocation a - } - -ProgramBindSampler { - param RsProgramFragment pf - param uint32_t slot - param RsSampler s - } - -ProgramFragmentCreate { - direct - param const char * shaderText - param const char ** textureNames - param const uint32_t * params - ret RsProgramFragment - } - -ProgramVertexCreate { - direct - param const char * shaderText - param const char ** textureNames - param const uint32_t * params - ret RsProgramVertex - } - -FontCreateFromFile { - param const char *name - param float fontSize - param uint32_t dpi - ret RsFont - } - -FontCreateFromMemory { - param const char *name - param float fontSize - param uint32_t dpi - param const void *data - ret RsFont - } - -MeshCreate { - param RsAllocation *vtx - param RsAllocation *idx - param uint32_t *primType - ret RsMesh - } - -PathCreate { - param RsPathPrimitive pp - param bool isStatic - param RsAllocation vertex - param RsAllocation loops - param float quality - ret RsPath - } - -ContextBindProgramStore { - param RsProgramStore pgm - } - -ContextBindProgramFragment { - param RsProgramFragment pgm - } - -ContextBindProgramVertex { - param RsProgramVertex pgm - } - -ContextBindProgramRaster { - param RsProgramRaster pgm - } - -ContextBindFont { - param RsFont pgm - } - -ContextSetSurface { - param uint32_t width - param uint32_t height - param RsNativeWindow sur - sync - } - -ContextBindRootScript { - param RsScript sampler - } - -ContextPause { - } - -ContextResume { - } diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsgApi.cpp.rsg b/9/platforms/android-19/arch-x86/usr/include/rs/rsgApi.cpp.rsg deleted file mode 100644 index 0cfbf08..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsgApi.cpp.rsg +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsgApiFuncDecl.h.rsg b/9/platforms/android-19/arch-x86/usr/include/rs/rsgApiFuncDecl.h.rsg deleted file mode 100644 index d00491f..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsgApiFuncDecl.h.rsg +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsgApiReplay.cpp.rsg b/9/platforms/android-19/arch-x86/usr/include/rs/rsgApiReplay.cpp.rsg deleted file mode 100644 index 00750ed..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsgApiReplay.cpp.rsg +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/rsgApiStructs.h.rsg b/9/platforms/android-19/arch-x86/usr/include/rs/rsgApiStructs.h.rsg deleted file mode 100644 index 573541a..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/rsgApiStructs.h.rsg +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/scriptc/rs_graphics.rsh b/9/platforms/android-19/arch-x86/usr/include/rs/scriptc/rs_graphics.rsh deleted file mode 100644 index 782b27f..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/scriptc/rs_graphics.rsh +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright (C) 2011-2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_graphics.rsh - * \brief RenderScript graphics API - * - * A set of graphics functions used by RenderScript. - * - */ -#ifndef __RS_GRAPHICS_RSH__ -#define __RS_GRAPHICS_RSH__ - -#include "rs_mesh.rsh" -#include "rs_program.rsh" - -#if (defined(RS_VERSION) && (RS_VERSION >= 14)) -/** - * Set the color target used for all subsequent rendering calls - * @param colorTarget - * @param slot - */ -extern void __attribute__((overloadable)) - rsgBindColorTarget(rs_allocation colorTarget, uint slot); - -/** - * Clear the previously set color target - * @param slot - */ -extern void __attribute__((overloadable)) - rsgClearColorTarget(uint slot); - -/** - * Set the depth target used for all subsequent rendering calls - * @param depthTarget - */ -extern void __attribute__((overloadable)) - rsgBindDepthTarget(rs_allocation depthTarget); - -/** - * Clear the previously set depth target - */ -extern void __attribute__((overloadable)) - rsgClearDepthTarget(void); - -/** - * Clear all color and depth targets and resume rendering into - * the framebuffer - */ -extern void __attribute__((overloadable)) - rsgClearAllRenderTargets(void); - -/** - * Force RenderScript to finish all rendering commands - */ -extern uint __attribute__((overloadable)) - rsgFinish(void); - -#endif //defined(RS_VERSION) && (RS_VERSION >= 14) - -/** - * Bind a new ProgramFragment to the rendering context. - * - * @param pf - */ -extern void __attribute__((overloadable)) - rsgBindProgramFragment(rs_program_fragment pf); - -/** - * Bind a new ProgramStore to the rendering context. - * - * @param ps - */ -extern void __attribute__((overloadable)) - rsgBindProgramStore(rs_program_store ps); - -/** - * Bind a new ProgramVertex to the rendering context. - * - * @param pv - */ -extern void __attribute__((overloadable)) - rsgBindProgramVertex(rs_program_vertex pv); - -/** - * Bind a new ProgramRaster to the rendering context. - * - * @param pr - */ -extern void __attribute__((overloadable)) - rsgBindProgramRaster(rs_program_raster pr); - -/** - * Bind a new Sampler object to a ProgramFragment. The sampler will - * operate on the texture bound at the matching slot. - * - * @param slot - */ -extern void __attribute__((overloadable)) - rsgBindSampler(rs_program_fragment, uint slot, rs_sampler); - -/** - * Bind a new Allocation object to a ProgramFragment. The - * Allocation must be a valid texture for the Program. The sampling - * of the texture will be controled by the Sampler bound at the - * matching slot. - * - * @param slot - */ -extern void __attribute__((overloadable)) - rsgBindTexture(rs_program_fragment, uint slot, rs_allocation); - -/** - * Load the projection matrix for a currently bound fixed function - * vertex program. Calling this function with a custom vertex shader - * would result in an error. - * @param proj projection matrix - */ -extern void __attribute__((overloadable)) - rsgProgramVertexLoadProjectionMatrix(const rs_matrix4x4 *proj); -/** - * Load the model matrix for a currently bound fixed function - * vertex program. Calling this function with a custom vertex shader - * would result in an error. - * @param model model matrix - */ -extern void __attribute__((overloadable)) - rsgProgramVertexLoadModelMatrix(const rs_matrix4x4 *model); -/** - * Load the texture matrix for a currently bound fixed function - * vertex program. Calling this function with a custom vertex shader - * would result in an error. - * @param tex texture matrix - */ -extern void __attribute__((overloadable)) - rsgProgramVertexLoadTextureMatrix(const rs_matrix4x4 *tex); -/** - * Get the projection matrix for a currently bound fixed function - * vertex program. Calling this function with a custom vertex shader - * would result in an error. - * @param proj matrix to store the current projection matrix into - */ -extern void __attribute__((overloadable)) - rsgProgramVertexGetProjectionMatrix(rs_matrix4x4 *proj); - -/** - * Set the constant color for a fixed function emulation program. - * - * @param pf - * @param r - * @param g - * @param b - * @param a - */ -extern void __attribute__((overloadable)) - rsgProgramFragmentConstantColor(rs_program_fragment pf, float r, float g, float b, float a); - -/** - * Bind a new Allocation object to a ProgramFragment. The - * Allocation must be a valid constant input for the Program. - * - * @param ps program object - * @param slot index of the constant buffer on the program - * @param c constants to bind - */ -extern void __attribute__((overloadable)) - rsgBindConstant(rs_program_fragment ps, uint slot, rs_allocation c); - -/** - * Bind a new Allocation object to a ProgramVertex. The - * Allocation must be a valid constant input for the Program. - * - * @param pv program object - * @param slot index of the constant buffer on the program - * @param c constants to bind - */ -extern void __attribute__((overloadable)) - rsgBindConstant(rs_program_vertex pv, uint slot, rs_allocation c); - -/** - * Get the width of the current rendering surface. - * - * @return uint - */ -extern uint __attribute__((overloadable)) - rsgGetWidth(void); - -/** - * Get the height of the current rendering surface. - * - * @return uint - */ -extern uint __attribute__((overloadable)) - rsgGetHeight(void); - - -/** - * Sync the contents of an allocation from its SCRIPT memory space to its HW - * memory spaces. - * - * @param alloc - */ -extern void __attribute__((overloadable)) - rsgAllocationSyncAll(rs_allocation alloc); - -#if (defined(RS_VERSION) && (RS_VERSION >= 14)) - -/** - * Sync the contents of an allocation from memory space - * specified by source. - * - * @param alloc - * @param source - */ -extern void __attribute__((overloadable)) - rsgAllocationSyncAll(rs_allocation alloc, - rs_allocation_usage_type source); - -#endif //defined(RS_VERSION) && (RS_VERSION >= 14) - -/** - * Low performance utility function for drawing a simple rectangle. Not - * intended for drawing large quantities of geometry. - * - * @param x1 - * @param y1 - * @param x2 - * @param y2 - * @param z - */ -extern void __attribute__((overloadable)) - rsgDrawRect(float x1, float y1, float x2, float y2, float z); - -/** - * Low performance utility function for drawing a simple quad. Not intended for - * drawing large quantities of geometry. - * - * @param x1 - * @param y1 - * @param z1 - * @param x2 - * @param y2 - * @param z2 - * @param x3 - * @param y3 - * @param z3 - * @param x4 - * @param y4 - * @param z4 - */ -extern void __attribute__((overloadable)) - rsgDrawQuad(float x1, float y1, float z1, - float x2, float y2, float z2, - float x3, float y3, float z3, - float x4, float y4, float z4); - - -/** - * Low performance utility function for drawing a textured quad. Not intended - * for drawing large quantities of geometry. - * - * @param x1 - * @param y1 - * @param z1 - * @param u1 - * @param v1 - * @param x2 - * @param y2 - * @param z2 - * @param u2 - * @param v2 - * @param x3 - * @param y3 - * @param z3 - * @param u3 - * @param v3 - * @param x4 - * @param y4 - * @param z4 - * @param u4 - * @param v4 - */ -extern void __attribute__((overloadable)) - rsgDrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1, - float x2, float y2, float z2, float u2, float v2, - float x3, float y3, float z3, float u3, float v3, - float x4, float y4, float z4, float u4, float v4); - - -/** - * Low performance function for drawing rectangles in screenspace. This - * function uses the default passthough ProgramVertex. Any bound ProgramVertex - * is ignored. This function has considerable overhead and should not be used - * for drawing in shipping applications. - * - * @param x - * @param y - * @param z - * @param w - * @param h - */ -extern void __attribute__((overloadable)) - rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h); - -extern void __attribute__((overloadable)) - rsgDrawPath(rs_path p); - -/** - * Draw a mesh using the current context state. The whole mesh is - * rendered. - * - * @param ism - */ -extern void __attribute__((overloadable)) - rsgDrawMesh(rs_mesh ism); -/** - * Draw part of a mesh using the current context state. - * @param ism mesh object to render - * @param primitiveIndex for meshes that contain multiple primitive groups - * this parameter specifies the index of the group to draw. - */ -extern void __attribute__((overloadable)) - rsgDrawMesh(rs_mesh ism, uint primitiveIndex); -/** - * Draw specified index range of part of a mesh using the current context state. - * @param ism mesh object to render - * @param primitiveIndex for meshes that contain multiple primitive groups - * this parameter specifies the index of the group to draw. - * @param start starting index in the range - * @param len number of indices to draw - */ -extern void __attribute__((overloadable)) - rsgDrawMesh(rs_mesh ism, uint primitiveIndex, uint start, uint len); - -/** - * Clears the rendering surface to the specified color. - * - * @param r - * @param g - * @param b - * @param a - */ -extern void __attribute__((overloadable)) - rsgClearColor(float r, float g, float b, float a); - -/** - * Clears the depth suface to the specified value. - */ -extern void __attribute__((overloadable)) - rsgClearDepth(float value); -/** - * Draws text given a string and location - */ -extern void __attribute__((overloadable)) - rsgDrawText(const char *, int x, int y); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsgDrawText(rs_allocation, int x, int y); -/** - * Binds the font object to be used for all subsequent font rendering calls - * @param font object to bind - */ -extern void __attribute__((overloadable)) - rsgBindFont(rs_font font); -/** - * Sets the font color for all subsequent rendering calls - * @param r red component - * @param g green component - * @param b blue component - * @param a alpha component - */ -extern void __attribute__((overloadable)) - rsgFontColor(float r, float g, float b, float a); -/** - * Returns the bounding box of the text relative to (0, 0) - * Any of left, right, top, bottom could be NULL - */ -extern void __attribute__((overloadable)) - rsgMeasureText(const char *, int *left, int *right, int *top, int *bottom); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsgMeasureText(rs_allocation, int *left, int *right, int *top, int *bottom); -/** - * Computes an axis aligned bounding box of a mesh object - */ -extern void __attribute__((overloadable)) - rsgMeshComputeBoundingBox(rs_mesh mesh, float *minX, float *minY, float *minZ, - float *maxX, float *maxY, float *maxZ); -/** - * \overload - */ -__inline__ static void __attribute__((overloadable, always_inline)) -rsgMeshComputeBoundingBox(rs_mesh mesh, float3 *bBoxMin, float3 *bBoxMax) { - float x1, y1, z1, x2, y2, z2; - rsgMeshComputeBoundingBox(mesh, &x1, &y1, &z1, &x2, &y2, &z2); - bBoxMin->x = x1; - bBoxMin->y = y1; - bBoxMin->z = z1; - bBoxMax->x = x2; - bBoxMax->y = y2; - bBoxMax->z = z2; -} - -#endif - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/scriptc/rs_mesh.rsh b/9/platforms/android-19/arch-x86/usr/include/rs/scriptc/rs_mesh.rsh deleted file mode 100644 index 0ecd786..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/scriptc/rs_mesh.rsh +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_mesh.rsh - * \brief Mesh routines - * - * - */ - -#ifndef __RS_MESH_RSH__ -#define __RS_MESH_RSH__ - -// New API's -#if (defined(RS_VERSION) && (RS_VERSION >= 16)) - -/** - * Returns the number of allocations in the mesh that contain - * vertex data - * - * @param m mesh to get data from - * @return number of allocations in the mesh that contain vertex - * data - */ -extern uint32_t __attribute__((overloadable)) - rsgMeshGetVertexAllocationCount(rs_mesh m); - -/** - * Meshes could have multiple index sets, this function returns - * the number. - * - * @param m mesh to get data from - * @return number of primitive groups in the mesh. This would - * include simple primitives as well as allocations - * containing index data - */ -extern uint32_t __attribute__((overloadable)) - rsgMeshGetPrimitiveCount(rs_mesh m); - -/** - * Returns an allocation that is part of the mesh and contains - * vertex data, e.g. positions, normals, texcoords - * - * @param m mesh to get data from - * @param index index of the vertex allocation - * @return allocation containing vertex data - */ -extern rs_allocation __attribute__((overloadable)) - rsgMeshGetVertexAllocation(rs_mesh m, uint32_t index); - -/** - * Returns an allocation containing index data or a null - * allocation if only the primitive is specified - * - * @param m mesh to get data from - * @param index index of the index allocation - * @return allocation containing index data - */ -extern rs_allocation __attribute__((overloadable)) - rsgMeshGetIndexAllocation(rs_mesh m, uint32_t index); - -/** - * Returns the primitive describing how a part of the mesh is - * rendered - * - * @param m mesh to get data from - * @param index index of the primitive - * @return primitive describing how the mesh is rendered - */ -extern rs_primitive __attribute__((overloadable)) - rsgMeshGetPrimitive(rs_mesh m, uint32_t index); - -#endif // (defined(RS_VERSION) && (RS_VERSION >= 16)) - -#endif // __RS_MESH_RSH__ - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/scriptc/rs_program.rsh b/9/platforms/android-19/arch-x86/usr/include/rs/scriptc/rs_program.rsh deleted file mode 100644 index 299aae6..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/scriptc/rs_program.rsh +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_program.rsh - * \brief Program object routines - * - * - */ - -#ifndef __RS_PROGRAM_RSH__ -#define __RS_PROGRAM_RSH__ - -#if (defined(RS_VERSION) && (RS_VERSION >= 16)) - -/** - * Get program store depth function - * - * @param ps program store to query - */ -extern rs_depth_func __attribute__((overloadable)) - rsgProgramStoreGetDepthFunc(rs_program_store ps); - -/** - * Get program store depth mask - * - * @param ps program store to query - */ -extern bool __attribute__((overloadable)) - rsgProgramStoreIsDepthMaskEnabled(rs_program_store ps); -/** - * Get program store red component color mask - * - * @param ps program store to query - */ -extern bool __attribute__((overloadable)) - rsgProgramStoreIsColorMaskRedEnabled(rs_program_store ps); - -/** - * Get program store green component color mask - * - * @param ps program store to query - */ -extern bool __attribute__((overloadable)) - rsgProgramStoreIsColorMaskGreenEnabled(rs_program_store ps); - -/** - * Get program store blur component color mask - * - * @param ps program store to query - */ -extern bool __attribute__((overloadable)) - rsgProgramStoreIsColorMaskBlueEnabled(rs_program_store ps); - -/** - * Get program store alpha component color mask - * - * @param ps program store to query - */ -extern bool __attribute__((overloadable)) - rsgProgramStoreIsColorMaskAlphaEnabled(rs_program_store ps); - -/** - * Get program store blend source function - * - * @param ps program store to query - */ -extern rs_blend_src_func __attribute__((overloadable)) - rsgProgramStoreGetBlendSrcFunc(rs_program_store ps); - -/** - * Get program store blend destination function - * - * @param ps program store to query - */ -extern rs_blend_dst_func __attribute__((overloadable)) - rsgProgramStoreGetBlendDstFunc(rs_program_store ps); - -/** - * Get program store dither state - * - * @param ps program store to query - */ -extern bool __attribute__((overloadable)) - rsgProgramStoreIsDitherEnabled(rs_program_store ps); - -/** - * Get program raster point sprite state - * - * @param pr program raster to query - */ -extern bool __attribute__((overloadable)) - rsgProgramRasterIsPointSpriteEnabled(rs_program_raster pr); - -/** - * Get program raster cull mode - * - * @param pr program raster to query - */ -extern rs_cull_mode __attribute__((overloadable)) - rsgProgramRasterGetCullMode(rs_program_raster pr); - -#endif // (defined(RS_VERSION) && (RS_VERSION >= 16)) - -#endif // __RS_PROGRAM_RSH__ - diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/server/RefBase.h b/9/platforms/android-19/arch-x86/usr/include/rs/server/RefBase.h deleted file mode 100644 index e1e5007..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/server/RefBase.h +++ /dev/null @@ -1,528 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_REF_BASE_H -#define ANDROID_REF_BASE_H - - -#include <stdint.h> -#include <sys/types.h> -#include <stdlib.h> -#include <string.h> - -#include "StrongPointer.h" -#include "TypeHelpers.h" - -// --------------------------------------------------------------------------- -namespace android { - -class TextOutput; -TextOutput& printWeakPointer(TextOutput& to, const void* val); - -// --------------------------------------------------------------------------- - -#define COMPARE_WEAK(_op_) \ -inline bool operator _op_ (const sp<T>& o) const { \ - return m_ptr _op_ o.m_ptr; \ -} \ -inline bool operator _op_ (const T* o) const { \ - return m_ptr _op_ o; \ -} \ -template<typename U> \ -inline bool operator _op_ (const sp<U>& o) const { \ - return m_ptr _op_ o.m_ptr; \ -} \ -template<typename U> \ -inline bool operator _op_ (const U* o) const { \ - return m_ptr _op_ o; \ -} - -// --------------------------------------------------------------------------- -class ReferenceMover; -class ReferenceConverterBase { -public: - virtual size_t getReferenceTypeSize() const = 0; - virtual void* getReferenceBase(void const*) const = 0; - inline virtual ~ReferenceConverterBase() { } -}; - -// --------------------------------------------------------------------------- - -class RefBase -{ -public: - void incStrong(const void* id) const; - void decStrong(const void* id) const; - - void forceIncStrong(const void* id) const; - - //! DEBUGGING ONLY: Get current strong ref count. - int32_t getStrongCount() const; - - class weakref_type - { - public: - RefBase* refBase() const; - - void incWeak(const void* id); - void decWeak(const void* id); - - // acquires a strong reference if there is already one. - bool attemptIncStrong(const void* id); - - // acquires a weak reference if there is already one. - // This is not always safe. see ProcessState.cpp and BpBinder.cpp - // for proper use. - bool attemptIncWeak(const void* id); - - //! DEBUGGING ONLY: Get current weak ref count. - int32_t getWeakCount() const; - - //! DEBUGGING ONLY: Print references held on object. - void printRefs() const; - - //! DEBUGGING ONLY: Enable tracking for this object. - // enable -- enable/disable tracking - // retain -- when tracking is enable, if true, then we save a stack trace - // for each reference and dereference; when retain == false, we - // match up references and dereferences and keep only the - // outstanding ones. - - void trackMe(bool enable, bool retain); - }; - - weakref_type* createWeak(const void* id) const; - - weakref_type* getWeakRefs() const; - - //! DEBUGGING ONLY: Print references held on object. - inline void printRefs() const { getWeakRefs()->printRefs(); } - - //! DEBUGGING ONLY: Enable tracking of object. - inline void trackMe(bool enable, bool retain) - { - getWeakRefs()->trackMe(enable, retain); - } - - typedef RefBase basetype; - -protected: - RefBase(); - virtual ~RefBase(); - - //! Flags for extendObjectLifetime() - enum { - OBJECT_LIFETIME_STRONG = 0x0000, - OBJECT_LIFETIME_WEAK = 0x0001, - OBJECT_LIFETIME_MASK = 0x0001 - }; - - void extendObjectLifetime(int32_t mode); - - //! Flags for onIncStrongAttempted() - enum { - FIRST_INC_STRONG = 0x0001 - }; - - virtual void onFirstRef(); - virtual void onLastStrongRef(const void* id); - virtual bool onIncStrongAttempted(uint32_t flags, const void* id); - virtual void onLastWeakRef(const void* id); - -private: - friend class ReferenceMover; - static void moveReferences(void* d, void const* s, size_t n, - const ReferenceConverterBase& caster); - -private: - friend class weakref_type; - class weakref_impl; - - RefBase(const RefBase& o); - RefBase& operator=(const RefBase& o); - - weakref_impl* const mRefs; -}; - -// --------------------------------------------------------------------------- - -template <class T> -class LightRefBase -{ -public: - inline LightRefBase() : mCount(0) { } - inline void incStrong(__attribute__((unused)) const void* id) const { - __sync_fetch_and_add(&mCount, 1); - } - inline void decStrong(__attribute__((unused)) const void* id) const { - if (__sync_fetch_and_sub(&mCount, 1) == 1) { - delete static_cast<const T*>(this); - } - } - //! DEBUGGING ONLY: Get current strong ref count. - inline int32_t getStrongCount() const { - return mCount; - } - - typedef LightRefBase<T> basetype; - -protected: - inline ~LightRefBase() { } - -private: - friend class ReferenceMover; - inline static void moveReferences(void* d, void const* s, size_t n, - const ReferenceConverterBase& caster) { } - -private: - mutable volatile int32_t mCount; -}; - -// --------------------------------------------------------------------------- - -template <typename T> -class wp -{ -public: - typedef typename RefBase::weakref_type weakref_type; - - inline wp() : m_ptr(0) { } - - wp(T* other); - wp(const wp<T>& other); - wp(const sp<T>& other); - template<typename U> wp(U* other); - template<typename U> wp(const sp<U>& other); - template<typename U> wp(const wp<U>& other); - - ~wp(); - - // Assignment - - wp& operator = (T* other); - wp& operator = (const wp<T>& other); - wp& operator = (const sp<T>& other); - - template<typename U> wp& operator = (U* other); - template<typename U> wp& operator = (const wp<U>& other); - template<typename U> wp& operator = (const sp<U>& other); - - void set_object_and_refs(T* other, weakref_type* refs); - - // promotion to sp - - sp<T> promote() const; - - // Reset - - void clear(); - - // Accessors - - inline weakref_type* get_refs() const { return m_refs; } - - inline T* unsafe_get() const { return m_ptr; } - - // Operators - - COMPARE_WEAK(==) - COMPARE_WEAK(!=) - COMPARE_WEAK(>) - COMPARE_WEAK(<) - COMPARE_WEAK(<=) - COMPARE_WEAK(>=) - - inline bool operator == (const wp<T>& o) const { - return (m_ptr == o.m_ptr) && (m_refs == o.m_refs); - } - template<typename U> - inline bool operator == (const wp<U>& o) const { - return m_ptr == o.m_ptr; - } - - inline bool operator > (const wp<T>& o) const { - return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr); - } - template<typename U> - inline bool operator > (const wp<U>& o) const { - return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr); - } - - inline bool operator < (const wp<T>& o) const { - return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr); - } - template<typename U> - inline bool operator < (const wp<U>& o) const { - return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr); - } - inline bool operator != (const wp<T>& o) const { return m_refs != o.m_refs; } - template<typename U> inline bool operator != (const wp<U>& o) const { return !operator == (o); } - inline bool operator <= (const wp<T>& o) const { return !operator > (o); } - template<typename U> inline bool operator <= (const wp<U>& o) const { return !operator > (o); } - inline bool operator >= (const wp<T>& o) const { return !operator < (o); } - template<typename U> inline bool operator >= (const wp<U>& o) const { return !operator < (o); } - -private: - template<typename Y> friend class sp; - template<typename Y> friend class wp; - - T* m_ptr; - weakref_type* m_refs; -}; - -template <typename T> -TextOutput& operator<<(TextOutput& to, const wp<T>& val); - -#undef COMPARE_WEAK - -// --------------------------------------------------------------------------- -// No user serviceable parts below here. - -template<typename T> -wp<T>::wp(T* other) - : m_ptr(other) -{ - if (other) m_refs = other->createWeak(this); -} - -template<typename T> -wp<T>::wp(const wp<T>& other) - : m_ptr(other.m_ptr), m_refs(other.m_refs) -{ - if (m_ptr) m_refs->incWeak(this); -} - -template<typename T> -wp<T>::wp(const sp<T>& other) - : m_ptr(other.m_ptr) -{ - if (m_ptr) { - m_refs = m_ptr->createWeak(this); - } -} - -template<typename T> template<typename U> -wp<T>::wp(U* other) - : m_ptr(other) -{ - if (other) m_refs = other->createWeak(this); -} - -template<typename T> template<typename U> -wp<T>::wp(const wp<U>& other) - : m_ptr(other.m_ptr) -{ - if (m_ptr) { - m_refs = other.m_refs; - m_refs->incWeak(this); - } -} - -template<typename T> template<typename U> -wp<T>::wp(const sp<U>& other) - : m_ptr(other.m_ptr) -{ - if (m_ptr) { - m_refs = m_ptr->createWeak(this); - } -} - -template<typename T> -wp<T>::~wp() -{ - if (m_ptr) m_refs->decWeak(this); -} - -template<typename T> -wp<T>& wp<T>::operator = (T* other) -{ - weakref_type* newRefs = - other ? other->createWeak(this) : 0; - if (m_ptr) m_refs->decWeak(this); - m_ptr = other; - m_refs = newRefs; - return *this; -} - -template<typename T> -wp<T>& wp<T>::operator = (const wp<T>& other) -{ - weakref_type* otherRefs(other.m_refs); - T* otherPtr(other.m_ptr); - if (otherPtr) otherRefs->incWeak(this); - if (m_ptr) m_refs->decWeak(this); - m_ptr = otherPtr; - m_refs = otherRefs; - return *this; -} - -template<typename T> -wp<T>& wp<T>::operator = (const sp<T>& other) -{ - weakref_type* newRefs = - other != NULL ? other->createWeak(this) : 0; - T* otherPtr(other.m_ptr); - if (m_ptr) m_refs->decWeak(this); - m_ptr = otherPtr; - m_refs = newRefs; - return *this; -} - -template<typename T> template<typename U> -wp<T>& wp<T>::operator = (U* other) -{ - weakref_type* newRefs = - other ? other->createWeak(this) : 0; - if (m_ptr) m_refs->decWeak(this); - m_ptr = other; - m_refs = newRefs; - return *this; -} - -template<typename T> template<typename U> -wp<T>& wp<T>::operator = (const wp<U>& other) -{ - weakref_type* otherRefs(other.m_refs); - U* otherPtr(other.m_ptr); - if (otherPtr) otherRefs->incWeak(this); - if (m_ptr) m_refs->decWeak(this); - m_ptr = otherPtr; - m_refs = otherRefs; - return *this; -} - -template<typename T> template<typename U> -wp<T>& wp<T>::operator = (const sp<U>& other) -{ - weakref_type* newRefs = - other != NULL ? other->createWeak(this) : 0; - U* otherPtr(other.m_ptr); - if (m_ptr) m_refs->decWeak(this); - m_ptr = otherPtr; - m_refs = newRefs; - return *this; -} - -template<typename T> -void wp<T>::set_object_and_refs(T* other, weakref_type* refs) -{ - if (other) refs->incWeak(this); - if (m_ptr) m_refs->decWeak(this); - m_ptr = other; - m_refs = refs; -} - -template<typename T> -sp<T> wp<T>::promote() const -{ - sp<T> result; - if (m_ptr && m_refs->attemptIncStrong(&result)) { - result.set_pointer(m_ptr); - } - return result; -} - -template<typename T> -void wp<T>::clear() -{ - if (m_ptr) { - m_refs->decWeak(this); - m_ptr = 0; - } -} - -template <typename T> -inline TextOutput& operator<<(TextOutput& to, const wp<T>& val) -{ - return printWeakPointer(to, val.unsafe_get()); -} - -// --------------------------------------------------------------------------- - -// this class just serves as a namespace so TYPE::moveReferences can stay -// private. - -class ReferenceMover { - // StrongReferenceCast and WeakReferenceCast do the impedance matching - // between the generic (void*) implementation in Refbase and the strongly typed - // template specializations below. - - template <typename TYPE> - struct StrongReferenceCast : public ReferenceConverterBase { - virtual size_t getReferenceTypeSize() const { return sizeof( sp<TYPE> ); } - virtual void* getReferenceBase(void const* p) const { - sp<TYPE> const* sptr(reinterpret_cast<sp<TYPE> const*>(p)); - return static_cast<typename TYPE::basetype *>(sptr->get()); - } - }; - - template <typename TYPE> - struct WeakReferenceCast : public ReferenceConverterBase { - virtual size_t getReferenceTypeSize() const { return sizeof( wp<TYPE> ); } - virtual void* getReferenceBase(void const* p) const { - wp<TYPE> const* sptr(reinterpret_cast<wp<TYPE> const*>(p)); - return static_cast<typename TYPE::basetype *>(sptr->unsafe_get()); - } - }; - -public: - template<typename TYPE> static inline - void move_references(sp<TYPE>* d, sp<TYPE> const* s, size_t n) { - memmove(d, s, n*sizeof(sp<TYPE>)); - StrongReferenceCast<TYPE> caster; - TYPE::moveReferences(d, s, n, caster); - } - template<typename TYPE> static inline - void move_references(wp<TYPE>* d, wp<TYPE> const* s, size_t n) { - memmove(d, s, n*sizeof(wp<TYPE>)); - WeakReferenceCast<TYPE> caster; - TYPE::moveReferences(d, s, n, caster); - } -}; - -// specialization for moving sp<> and wp<> types. -// these are used by the [Sorted|Keyed]Vector<> implementations -// sp<> and wp<> need to be handled specially, because they do not -// have trivial copy operation in the general case (see RefBase.cpp -// when DEBUG ops are enabled), but can be implemented very -// efficiently in most cases. - -template<typename TYPE> inline -void move_forward_type(sp<TYPE>* d, sp<TYPE> const* s, size_t n) { - ReferenceMover::move_references(d, s, n); -} - -template<typename TYPE> inline -void move_backward_type(sp<TYPE>* d, sp<TYPE> const* s, size_t n) { - ReferenceMover::move_references(d, s, n); -} - -template<typename TYPE> inline -void move_forward_type(wp<TYPE>* d, wp<TYPE> const* s, size_t n) { - ReferenceMover::move_references(d, s, n); -} - -template<typename TYPE> inline -void move_backward_type(wp<TYPE>* d, wp<TYPE> const* s, size_t n) { - ReferenceMover::move_references(d, s, n); -} - - -}; // namespace android - -// --------------------------------------------------------------------------- - -#endif // ANDROID_REF_BASE_H diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/server/StrongPointer.h b/9/platforms/android-19/arch-x86/usr/include/rs/server/StrongPointer.h deleted file mode 100644 index 8983bd7..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/server/StrongPointer.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_STRONG_POINTER_H -#define ANDROID_STRONG_POINTER_H - -//#include <cutils/atomic.h> - -#include <stdint.h> -#include <sys/types.h> -#include <stdlib.h> - -// --------------------------------------------------------------------------- -namespace android { - -class TextOutput; -TextOutput& printStrongPointer(TextOutput& to, const void* val); - -template<typename T> class wp; - -// --------------------------------------------------------------------------- - -#define COMPARE(_op_) \ -inline bool operator _op_ (const sp<T>& o) const { \ - return m_ptr _op_ o.m_ptr; \ -} \ -inline bool operator _op_ (const T* o) const { \ - return m_ptr _op_ o; \ -} \ -template<typename U> \ -inline bool operator _op_ (const sp<U>& o) const { \ - return m_ptr _op_ o.m_ptr; \ -} \ -template<typename U> \ -inline bool operator _op_ (const U* o) const { \ - return m_ptr _op_ o; \ -} \ -inline bool operator _op_ (const wp<T>& o) const { \ - return m_ptr _op_ o.m_ptr; \ -} \ -template<typename U> \ -inline bool operator _op_ (const wp<U>& o) const { \ - return m_ptr _op_ o.m_ptr; \ -} - -// --------------------------------------------------------------------------- - -template <typename T> -class sp -{ -public: - inline sp() : m_ptr(0) { } - - sp(T* other); - sp(const sp<T>& other); - template<typename U> sp(U* other); - template<typename U> sp(const sp<U>& other); - - ~sp(); - - // Assignment - - sp& operator = (T* other); - sp& operator = (const sp<T>& other); - - template<typename U> sp& operator = (const sp<U>& other); - template<typename U> sp& operator = (U* other); - - //! Special optimization for use by ProcessState (and nobody else). - void force_set(T* other); - - // Reset - - void clear(); - - // Accessors - - inline T& operator* () const { return *m_ptr; } - inline T* operator-> () const { return m_ptr; } - inline T* get() const { return m_ptr; } - - // Operators - - COMPARE(==) - COMPARE(!=) - COMPARE(>) - COMPARE(<) - COMPARE(<=) - COMPARE(>=) - -private: - template<typename Y> friend class sp; - template<typename Y> friend class wp; - void set_pointer(T* ptr); - T* m_ptr; -}; - -#undef COMPARE - -template <typename T> -TextOutput& operator<<(TextOutput& to, const sp<T>& val); - -// --------------------------------------------------------------------------- -// No user serviceable parts below here. - -template<typename T> -sp<T>::sp(T* other) -: m_ptr(other) - { - if (other) other->incStrong(this); - } - -template<typename T> -sp<T>::sp(const sp<T>& other) -: m_ptr(other.m_ptr) - { - if (m_ptr) m_ptr->incStrong(this); - } - -template<typename T> template<typename U> -sp<T>::sp(U* other) : m_ptr(other) -{ - if (other) ((T*)other)->incStrong(this); -} - -template<typename T> template<typename U> -sp<T>::sp(const sp<U>& other) -: m_ptr(other.m_ptr) - { - if (m_ptr) m_ptr->incStrong(this); - } - -template<typename T> -sp<T>::~sp() -{ - if (m_ptr) m_ptr->decStrong(this); -} - -template<typename T> -sp<T>& sp<T>::operator = (const sp<T>& other) { - T* otherPtr(other.m_ptr); - if (otherPtr) otherPtr->incStrong(this); - if (m_ptr) m_ptr->decStrong(this); - m_ptr = otherPtr; - return *this; -} - -template<typename T> -sp<T>& sp<T>::operator = (T* other) -{ - if (other) other->incStrong(this); - if (m_ptr) m_ptr->decStrong(this); - m_ptr = other; - return *this; -} - -template<typename T> template<typename U> -sp<T>& sp<T>::operator = (const sp<U>& other) -{ - T* otherPtr(other.m_ptr); - if (otherPtr) otherPtr->incStrong(this); - if (m_ptr) m_ptr->decStrong(this); - m_ptr = otherPtr; - return *this; -} - -template<typename T> template<typename U> -sp<T>& sp<T>::operator = (U* other) -{ - if (other) ((T*)other)->incStrong(this); - if (m_ptr) m_ptr->decStrong(this); - m_ptr = other; - return *this; -} - -template<typename T> -void sp<T>::force_set(T* other) -{ - other->forceIncStrong(this); - m_ptr = other; -} - -template<typename T> -void sp<T>::clear() -{ - if (m_ptr) { - m_ptr->decStrong(this); - m_ptr = 0; - } -} - -template<typename T> -void sp<T>::set_pointer(T* ptr) { - m_ptr = ptr; -} - -template <typename T> -inline TextOutput& operator<<(TextOutput& to, const sp<T>& val) -{ - return printStrongPointer(to, val.get()); -} - -}; // namespace android - -// --------------------------------------------------------------------------- - -#endif // ANDROID_STRONG_POINTER_H diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/server/TypeHelpers.h b/9/platforms/android-19/arch-x86/usr/include/rs/server/TypeHelpers.h deleted file mode 100644 index c74f945..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/server/TypeHelpers.h +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_TYPE_HELPERS_H -#define ANDROID_TYPE_HELPERS_H - -#include <new> -#include <stdint.h> -#include <string.h> -#include <sys/types.h> - -// --------------------------------------------------------------------------- - -namespace android { - -/* - * Types traits - */ - -template <typename T> struct trait_trivial_ctor { enum { value = false }; }; -template <typename T> struct trait_trivial_dtor { enum { value = false }; }; -template <typename T> struct trait_trivial_copy { enum { value = false }; }; -template <typename T> struct trait_trivial_move { enum { value = false }; }; -template <typename T> struct trait_pointer { enum { value = false }; }; -template <typename T> struct trait_pointer<T*> { enum { value = true }; }; - -template <typename TYPE> -struct traits { - enum { - // whether this type is a pointer - is_pointer = trait_pointer<TYPE>::value, - // whether this type's constructor is a no-op - has_trivial_ctor = is_pointer || trait_trivial_ctor<TYPE>::value, - // whether this type's destructor is a no-op - has_trivial_dtor = is_pointer || trait_trivial_dtor<TYPE>::value, - // whether this type type can be copy-constructed with memcpy - has_trivial_copy = is_pointer || trait_trivial_copy<TYPE>::value, - // whether this type can be moved with memmove - has_trivial_move = is_pointer || trait_trivial_move<TYPE>::value - }; -}; - -template <typename T, typename U> -struct aggregate_traits { - enum { - is_pointer = false, - has_trivial_ctor = - traits<T>::has_trivial_ctor && traits<U>::has_trivial_ctor, - has_trivial_dtor = - traits<T>::has_trivial_dtor && traits<U>::has_trivial_dtor, - has_trivial_copy = - traits<T>::has_trivial_copy && traits<U>::has_trivial_copy, - has_trivial_move = - traits<T>::has_trivial_move && traits<U>::has_trivial_move - }; -}; - -#define ANDROID_TRIVIAL_CTOR_TRAIT( T ) \ - template<> struct trait_trivial_ctor< T > { enum { value = true }; }; - -#define ANDROID_TRIVIAL_DTOR_TRAIT( T ) \ - template<> struct trait_trivial_dtor< T > { enum { value = true }; }; - -#define ANDROID_TRIVIAL_COPY_TRAIT( T ) \ - template<> struct trait_trivial_copy< T > { enum { value = true }; }; - -#define ANDROID_TRIVIAL_MOVE_TRAIT( T ) \ - template<> struct trait_trivial_move< T > { enum { value = true }; }; - -#define ANDROID_BASIC_TYPES_TRAITS( T ) \ - ANDROID_TRIVIAL_CTOR_TRAIT( T ) \ - ANDROID_TRIVIAL_DTOR_TRAIT( T ) \ - ANDROID_TRIVIAL_COPY_TRAIT( T ) \ - ANDROID_TRIVIAL_MOVE_TRAIT( T ) - -// --------------------------------------------------------------------------- - -/* - * basic types traits - */ - -ANDROID_BASIC_TYPES_TRAITS( void ) -ANDROID_BASIC_TYPES_TRAITS( bool ) -ANDROID_BASIC_TYPES_TRAITS( char ) -ANDROID_BASIC_TYPES_TRAITS( unsigned char ) -ANDROID_BASIC_TYPES_TRAITS( short ) -ANDROID_BASIC_TYPES_TRAITS( unsigned short ) -ANDROID_BASIC_TYPES_TRAITS( int ) -ANDROID_BASIC_TYPES_TRAITS( unsigned int ) -ANDROID_BASIC_TYPES_TRAITS( long ) -ANDROID_BASIC_TYPES_TRAITS( unsigned long ) -ANDROID_BASIC_TYPES_TRAITS( long long ) -ANDROID_BASIC_TYPES_TRAITS( unsigned long long ) -ANDROID_BASIC_TYPES_TRAITS( float ) -ANDROID_BASIC_TYPES_TRAITS( double ) - -// --------------------------------------------------------------------------- - - -/* - * compare and order types - */ - -template<typename TYPE> inline -int strictly_order_type(const TYPE& lhs, const TYPE& rhs) { - return (lhs < rhs) ? 1 : 0; -} - -template<typename TYPE> inline -int compare_type(const TYPE& lhs, const TYPE& rhs) { - return strictly_order_type(rhs, lhs) - strictly_order_type(lhs, rhs); -} - -/* - * create, destroy, copy and move types... - */ - -template<typename TYPE> inline -void construct_type(TYPE* p, size_t n) { - if (!traits<TYPE>::has_trivial_ctor) { - while (n--) { - new(p++) TYPE; - } - } -} - -template<typename TYPE> inline -void destroy_type(TYPE* p, size_t n) { - if (!traits<TYPE>::has_trivial_dtor) { - while (n--) { - p->~TYPE(); - p++; - } - } -} - -template<typename TYPE> inline -void copy_type(TYPE* d, const TYPE* s, size_t n) { - if (!traits<TYPE>::has_trivial_copy) { - while (n--) { - new(d) TYPE(*s); - d++, s++; - } - } else { - memcpy(d,s,n*sizeof(TYPE)); - } -} - -template<typename TYPE> inline -void splat_type(TYPE* where, const TYPE* what, size_t n) { - if (!traits<TYPE>::has_trivial_copy) { - while (n--) { - new(where) TYPE(*what); - where++; - } - } else { - while (n--) { - *where++ = *what; - } - } -} - -template<typename TYPE> inline -void move_forward_type(TYPE* d, const TYPE* s, size_t n = 1) { - if ((traits<TYPE>::has_trivial_dtor && traits<TYPE>::has_trivial_copy) - || traits<TYPE>::has_trivial_move) - { - memmove(d,s,n*sizeof(TYPE)); - } else { - d += n; - s += n; - while (n--) { - --d, --s; - if (!traits<TYPE>::has_trivial_copy) { - new(d) TYPE(*s); - } else { - *d = *s; - } - if (!traits<TYPE>::has_trivial_dtor) { - s->~TYPE(); - } - } - } -} - -template<typename TYPE> inline -void move_backward_type(TYPE* d, const TYPE* s, size_t n = 1) { - if ((traits<TYPE>::has_trivial_dtor && traits<TYPE>::has_trivial_copy) - || traits<TYPE>::has_trivial_move) - { - memmove(d,s,n*sizeof(TYPE)); - } else { - while (n--) { - if (!traits<TYPE>::has_trivial_copy) { - new(d) TYPE(*s); - } else { - *d = *s; - } - if (!traits<TYPE>::has_trivial_dtor) { - s->~TYPE(); - } - d++, s++; - } - } -} - -// --------------------------------------------------------------------------- - -/* - * a key/value pair - */ - -template <typename KEY, typename VALUE> -struct key_value_pair_t { - typedef KEY key_t; - typedef VALUE value_t; - - KEY key; - VALUE value; - key_value_pair_t() { } - key_value_pair_t(const key_value_pair_t& o) : key(o.key), value(o.value) { } - key_value_pair_t(const KEY& k, const VALUE& v) : key(k), value(v) { } - key_value_pair_t(const KEY& k) : key(k) { } - inline bool operator < (const key_value_pair_t& o) const { - return strictly_order_type(key, o.key); - } - inline const KEY& getKey() const { - return key; - } - inline const VALUE& getValue() const { - return value; - } -}; - -template <typename K, typename V> -struct trait_trivial_ctor< key_value_pair_t<K, V> > -{ enum { value = aggregate_traits<K,V>::has_trivial_ctor }; }; -template <typename K, typename V> -struct trait_trivial_dtor< key_value_pair_t<K, V> > -{ enum { value = aggregate_traits<K,V>::has_trivial_dtor }; }; -template <typename K, typename V> -struct trait_trivial_copy< key_value_pair_t<K, V> > -{ enum { value = aggregate_traits<K,V>::has_trivial_copy }; }; -template <typename K, typename V> -struct trait_trivial_move< key_value_pair_t<K, V> > -{ enum { value = aggregate_traits<K,V>::has_trivial_move }; }; - -// --------------------------------------------------------------------------- - -/* - * Hash codes. - */ -typedef uint32_t hash_t; - -template <typename TKey> -hash_t hash_type(const TKey& key); - -/* Built-in hash code specializations. - * Assumes pointers are 32bit. */ -#define ANDROID_INT32_HASH(T) \ - template <> inline hash_t hash_type(const T& value) { return hash_t(value); } -#define ANDROID_INT64_HASH(T) \ - template <> inline hash_t hash_type(const T& value) { \ - return hash_t((value >> 32) ^ value); } -#define ANDROID_REINTERPRET_HASH(T, R) \ - template <> inline hash_t hash_type(const T& value) { \ - return hash_type(*reinterpret_cast<const R*>(&value)); } - -ANDROID_INT32_HASH(bool) -ANDROID_INT32_HASH(int8_t) -ANDROID_INT32_HASH(uint8_t) -ANDROID_INT32_HASH(int16_t) -ANDROID_INT32_HASH(uint16_t) -ANDROID_INT32_HASH(int32_t) -ANDROID_INT32_HASH(uint32_t) -ANDROID_INT64_HASH(int64_t) -ANDROID_INT64_HASH(uint64_t) -ANDROID_REINTERPRET_HASH(float, uint32_t) -ANDROID_REINTERPRET_HASH(double, uint64_t) - -template <typename T> inline hash_t hash_type(T* const & value) { - return hash_type(uintptr_t(value)); -} - -}; // namespace android - -// --------------------------------------------------------------------------- - -#endif // ANDROID_TYPE_HELPERS_H diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/spec.h b/9/platforms/android-19/arch-x86/usr/include/rs/spec.h deleted file mode 100644 index ecc5cc7..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/spec.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef SPEC_H -#define SPEC_H - -#include <string.h> -#include <stdlib.h> - -#if __cplusplus -extern "C" { -#endif - -extern int num_lines; - -typedef struct { - int isConst; - int type; - int bits; - int ptrLevel; - char name[256]; - char typeName[256]; -} VarType; - -extern VarType *currType; - -typedef struct { - char name[256]; - int sync; - int handcodeApi; - int direct; - int nocontext; - int paramCount; - VarType ret; - VarType params[16]; -} ApiEntry; - -extern ApiEntry apis[128]; -extern int apiCount; - -extern int typeNextState; - -#if __cplusplus -} // extern "C" -#endif - -#endif // SPEC_H diff --git a/9/platforms/android-19/arch-x86/usr/include/rs/spec.l b/9/platforms/android-19/arch-x86/usr/include/rs/spec.l deleted file mode 100644 index a24bfd3..0000000 --- a/9/platforms/android-19/arch-x86/usr/include/rs/spec.l +++ /dev/null @@ -1,198 +0,0 @@ -%option stack - -%x comment -%x api_entry -%x api_entry2 -%x api_entry_param -%x var_type - -DIGIT [0-9] -ID [a-zA-Z_][a-zA-Z0-9_]* - - #include "spec.h" - - int num_lines = 0; - - VarType *currType = 0; - - ApiEntry apis[128]; - int apiCount = 0; - - int typeNextState; - - void checkPointerType() { - VarType *baseType = currType; - int curPtrLevel = 0; - while (curPtrLevel < baseType->ptrLevel) { - currType = &apis[apiCount].params[apis[apiCount].paramCount]; - currType->type = 4; - currType->ptrLevel = curPtrLevel; - if (currType->ptrLevel > 0) { - currType->isConst = 1; - } - sprintf(currType->typeName, "%s", "size_t"); - switch(baseType->ptrLevel - curPtrLevel) { - case 1: - sprintf(currType->name, "%s_length", baseType->name); - break; - case 2: - sprintf(currType->name, "%s_length_length", baseType->name); - break; - } - apis[apiCount].paramCount++; - curPtrLevel ++; - } - } - - extern "C" int yylex(); - -%% - -"/*" BEGIN(comment); -<comment>[^*\n]* /* eat anything that's not a '*' */ -<comment>"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */ -<comment>\n ++num_lines; -<comment>"*"+"/" BEGIN(INITIAL); - -<*>" " //printf("found ' '\n"); -<*>"\t" //printf("found ' '\n"); -<*>"\n" ++num_lines; //printf("found lf \n"); - -{ID} { - memset(&apis[apiCount], 0, sizeof(ApiEntry)); - memcpy(apis[apiCount].name, yytext, yyleng); - BEGIN(api_entry); - } - -<api_entry>"{" { - BEGIN(api_entry2); - } - -<api_entry2>"sync" { - apis[apiCount].sync = 1; - } - -<api_entry2>"handcodeApi" { - apis[apiCount].handcodeApi = 1; - } - -<api_entry2>"direct" { - apis[apiCount].direct = 1; - } - -<api_entry2>"nocontext" { - apis[apiCount].nocontext = 1; - } - -<api_entry2>"ret" { - currType = &apis[apiCount].ret; - typeNextState = api_entry2; - BEGIN(var_type); - } - -<api_entry2>"param" { - currType = &apis[apiCount].params[apis[apiCount].paramCount]; - apis[apiCount].paramCount++; - typeNextState = api_entry_param; - BEGIN(var_type); - } - -<var_type>"const" { - currType->isConst = 1; - } - -<var_type>"i8" { - currType->type = 1; - currType->bits = 8; - BEGIN(typeNextState); - } - -<var_type>"i16" { - currType->type = 1; - currType->bits = 16; - BEGIN(typeNextState); - } - -<var_type>"i32" { - currType->type = 1; - currType->bits = 32; - BEGIN(typeNextState); - } - -<var_type>"i64" { - currType->type = 1; - currType->bits = 64; - BEGIN(typeNextState); - } - -<var_type>"u8" { - currType->type = 2; - currType->bits = 8; - BEGIN(typeNextState); - } - -<var_type>"u16" { - currType->type = 2; - currType->bits = 16; - BEGIN(typeNextState); - } - -<var_type>"u32" { - currType->type = 2; - currType->bits = 32; - BEGIN(typeNextState); - } - -<var_type>"u64" { - currType->type = 2; - currType->bits = 64; - BEGIN(typeNextState); - } - -<var_type>"f" { - currType->type = 3; - currType->bits = 32; - BEGIN(typeNextState); - } - -<var_type>"d" { - currType->type = 3; - currType->bits = 64; - BEGIN(typeNextState); - } - -<var_type>{ID} { - currType->type = 4; - currType->bits = 32; - memcpy(currType->typeName, yytext, yyleng); - BEGIN(typeNextState); - } - -<api_entry_param>"*" { - currType->ptrLevel ++; - } - -<api_entry_param>{ID} { - memcpy(currType->name, yytext, yyleng); - checkPointerType(); - BEGIN(api_entry2); - } - -<api_entry2>"*" { - currType->ptrLevel ++; - } - -<api_entry2>"}" { - apiCount++; - BEGIN(INITIAL); - } - - -%% - - -int yywrap() -{ - return 1; -} - |