rs_structs.h revision e3af53b643677c40d228ffd3624cf259f4dc68ed
15a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines#ifndef _RS_STRUCTS_H_
25a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines#define _RS_STRUCTS_H_
35a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
45a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
55a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
65a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
75a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
85a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Allocation owned by librs. Unfortunately,
95a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
105a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
115a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
125a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsAllocation.h is modified.
135a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
145a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
155a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsAllocationGetDimX(). Without this
165a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
175a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
185a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * allocations.
195a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
205a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
215a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef enum {
225a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    RS_ALLOCATION_MIPMAP_NONE = 0,
235a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    RS_ALLOCATION_MIPMAP_FULL = 1,
245a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE = 2
255a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} rs_allocation_mipmap_control;
265a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
275a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Allocation {
28e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#ifndef __LP64__
295a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
30e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#else
31e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray    char __pad[56];
32e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#endif
335a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
345a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void * drv;
355a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
365a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            const void *type;
375a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t usageFlags;
385a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_allocation_mipmap_control mipmapControl;
395a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t yuv;
405a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t elementSizeBytes;
415a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool hasMipmaps;
425a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool hasFaces;
435a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool hasReferences;
445a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            void * usrPtr;
455a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            int32_t surfaceTextureID;
46ddceab9a001f07a3395226c5e06e3b420720af0fJason Sams            void * nativeBuffer;
47ddceab9a001f07a3395226c5e06e3b420720af0fJason Sams            int64_t timestamp;
485a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
495a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
505a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct DrvState {
515a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            struct LodState {
525a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                void * mallocPtr;
535a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                size_t stride;
545a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                uint32_t dimX;
555a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                uint32_t dimY;
565a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                uint32_t dimZ;
575a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            } lod[16/*android::renderscript::Allocation::MAX_LOD*/];
585a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            size_t faceOffset;
595a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t lodCount;
605a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t faceCount;
6161656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams
6261656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams            struct YuvState {
6361656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams                uint32_t shift;
6461656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams                uint32_t step;
6561656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams            } yuv;
665a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } drvState;
675a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
685a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Allocation_t;
695a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
703ff0fe77fdba8ad4a920dc27157d8c1786bb3661Jason Sams#ifndef __LP64__
715a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
725a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
735a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
745a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
755a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class ProgramStore owned by librs. Unfortunately,
765a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
775a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
785a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
795a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsProgramStore.h is modified.
805a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
815a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
825a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsgProgramStoreGetDepthFunc(). Without this
835a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
845a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
855a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * program store.
865a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
875a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
885a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct ProgramStore {
895a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[40];
905a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
915a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
925a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool ditherEnable;
935a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool colorRWriteEnable;
945a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool colorGWriteEnable;
955a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool colorBWriteEnable;
965a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool colorAWriteEnable;
975a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_blend_src_func blendSrc;
985a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_blend_dst_func blendDst;
995a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool depthWriteEnable;
1005a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_depth_func depthFunc;
1015a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
1025a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
1035a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} ProgramStore_t;
1045a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
1055a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
1065a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
1075a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1085a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
1095a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class ProgramRaster owned by librs. Unfortunately,
1105a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
1115a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
1125a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
1135a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsProgramRaster.h is modified.
1145a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1155a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
1165a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsgProgramRasterGetCullMode(). Without this
1175a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
1185a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
1195a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * program raster.
1205a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1215a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
1225a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct ProgramRaster {
1235a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[36];
1245a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
1255a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void * drv;
1265a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
1275a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool pointSprite;
1285a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_cull_mode cull;
1295a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
1305a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
1315a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} ProgramRaster_t;
1323ff0fe77fdba8ad4a920dc27157d8c1786bb3661Jason Sams#endif //__LP64__
1335a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
1345a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
1355a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
1365a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1375a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
1385a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Sampler owned by librs. Unfortunately,
1395a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
1405a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
1415a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
1425a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsSampler.h is modified.
1435a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1445a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
1455a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsgProgramRasterGetMagFilter(). Without this
1465a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
1475a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
1485a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * samplers.
1495a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1505a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
1515a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Sampler {
152e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#ifndef __LP64__
1535a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
154e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#else
155e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray    char __pad[56];
156e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#endif
1575a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
1585a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void *drv;
1595a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
1605a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value magFilter;
1615a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value minFilter;
1625a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value wrapS;
1635a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value wrapT;
1645a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value wrapR;
1655a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            float aniso;
1665a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
1675a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
1685a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Sampler_t;
1695a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
1705a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
1715a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
1725a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1735a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
1745a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Element owned by librs. Unfortunately,
1755a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
1765a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
1775a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
1785a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsElement.h is modified.
1795a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1805a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
1815a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsElementGetSubElementCount(). Without this
1825a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
1835a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
1845a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * elements.
1855a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1865a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
1875a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Element {
188e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#ifndef __LP64__
1895a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
190e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#else
191e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray    char __pad[56];
192e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#endif
1935a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
1945a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void *drv;
1955a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
1965a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_data_type dataType;
1975a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_data_kind dataKind;
1985a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t vectorSize;
1995a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t elementSizeBytes;
2005a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
2015a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            // Subelements
2025a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            const void **fields;
2035a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *fieldArraySizes;
2045a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            const char **fieldNames;
2055a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *fieldNameLengths;
2065a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *fieldOffsetBytes;
2075a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t fieldsCount;
2085a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
2095a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
2105a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Element_t;
2115a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
2125a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
2135a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
2145a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2155a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
2165a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Type owned by librs. Unfortunately,
2175a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
2185a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
2195a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
2205a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsType.h is modified.
2215a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2225a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
2235a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsAllocationGetElement(). Without this
2245a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
2255a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
2265a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * types.
2275a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2285a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
2295a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Type {
230e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#ifndef __LP64__
2315a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
232e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#else
233e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray    char __pad[56];
234e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#endif
2355a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
2365a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void *drv;
2375a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
2385a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            const void * element;
2395a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t dimX;
2405a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t dimY;
2415a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t dimZ;
2425a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *lodDimX;
2435a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *lodDimY;
2445a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *lodDimZ;
2455a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *lodOffset;
2465a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t lodCount;
2475a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool faces;
2485a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
2495a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
2505a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Type_t;
2515a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
2523ff0fe77fdba8ad4a920dc27157d8c1786bb3661Jason Sams#ifndef __LP64__
2535a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
2545a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
2555a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2565a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
2575a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Mesh owned by librs. Unfortunately,
2585a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
2595a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
2605a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
2615a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsMesh.h is modified.
2625a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2635a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
2645a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsMeshGetVertexAllocationCount(). Without this
2655a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
2665a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
2675a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * meshes.
2685a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2695a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
2705a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Mesh {
2715a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
2725a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
2735a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void *drv;
2745a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
2755a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            void **vertexBuffers;
2765a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t vertexBuffersCount;
2775a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
2785a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            // indexBuffers[i] could be NULL, in which case only primitives[i] is used
2795a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            void **indexBuffers;
2805a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t indexBuffersCount;
2815a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_primitive *primitives;
2825a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t primitivesCount;
2835a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
2845a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
2855a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Mesh_t;
2863ff0fe77fdba8ad4a920dc27157d8c1786bb3661Jason Sams#endif //__LP64__
2875a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines#endif // _RS_CORE_H_
288