rs_structs.h revision 5a47020542c52af3e879c1cd67674ca979ff0a18
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 {
285a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
295a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
305a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void * drv;
315a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
325a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            const void *type;
335a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t usageFlags;
345a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_allocation_mipmap_control mipmapControl;
355a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t yuv;
365a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t elementSizeBytes;
375a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool hasMipmaps;
385a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool hasFaces;
395a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool hasReferences;
405a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            void * usrPtr;
415a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            int32_t surfaceTextureID;
425a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            void * wndSurface;
435a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            void * surfaceTexture;
445a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
455a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
465a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct DrvState {
475a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            struct LodState {
485a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                void * mallocPtr;
495a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                size_t stride;
505a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                uint32_t dimX;
515a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                uint32_t dimY;
525a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                uint32_t dimZ;
535a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            } lod[16/*android::renderscript::Allocation::MAX_LOD*/];
545a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            size_t faceOffset;
555a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t lodCount;
565a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t faceCount;
575a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } drvState;
585a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
595a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Allocation_t;
605a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
615a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
625a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
635a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
645a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
655a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class ProgramStore owned by librs. Unfortunately,
665a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
675a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
685a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
695a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsProgramStore.h is modified.
705a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
715a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
725a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsgProgramStoreGetDepthFunc(). Without this
735a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
745a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
755a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * program store.
765a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
775a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
785a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct ProgramStore {
795a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[40];
805a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
815a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
825a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool ditherEnable;
835a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool colorRWriteEnable;
845a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool colorGWriteEnable;
855a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool colorBWriteEnable;
865a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool colorAWriteEnable;
875a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_blend_src_func blendSrc;
885a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_blend_dst_func blendDst;
895a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool depthWriteEnable;
905a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_depth_func depthFunc;
915a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
925a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
935a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} ProgramStore_t;
945a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
955a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
965a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
975a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
985a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
995a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class ProgramRaster owned by librs. Unfortunately,
1005a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
1015a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
1025a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
1035a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsProgramRaster.h is modified.
1045a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1055a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
1065a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsgProgramRasterGetCullMode(). Without this
1075a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
1085a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
1095a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * program raster.
1105a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1115a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
1125a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct ProgramRaster {
1135a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[36];
1145a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
1155a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void * drv;
1165a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
1175a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool pointSprite;
1185a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_cull_mode cull;
1195a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
1205a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
1215a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} ProgramRaster_t;
1225a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
1235a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
1245a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
1255a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1265a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
1275a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Sampler owned by librs. Unfortunately,
1285a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
1295a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
1305a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
1315a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsSampler.h is modified.
1325a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1335a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
1345a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsgProgramRasterGetMagFilter(). Without this
1355a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
1365a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
1375a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * samplers.
1385a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1395a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
1405a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Sampler {
1415a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
1425a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
1435a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void *drv;
1445a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
1455a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value magFilter;
1465a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value minFilter;
1475a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value wrapS;
1485a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value wrapT;
1495a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value wrapR;
1505a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            float aniso;
1515a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
1525a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
1535a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Sampler_t;
1545a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
1555a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
1565a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
1575a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1585a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
1595a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Element owned by librs. Unfortunately,
1605a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
1615a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
1625a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
1635a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsElement.h is modified.
1645a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1655a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
1665a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsElementGetSubElementCount(). Without this
1675a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
1685a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
1695a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * elements.
1705a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1715a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
1725a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Element {
1735a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
1745a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
1755a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void *drv;
1765a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
1775a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_data_type dataType;
1785a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_data_kind dataKind;
1795a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t vectorSize;
1805a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t elementSizeBytes;
1815a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
1825a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            // Subelements
1835a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            const void **fields;
1845a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *fieldArraySizes;
1855a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            const char **fieldNames;
1865a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *fieldNameLengths;
1875a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *fieldOffsetBytes;
1885a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t fieldsCount;
1895a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
1905a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
1915a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Element_t;
1925a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
1935a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
1945a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
1955a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1965a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
1975a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Type owned by librs. Unfortunately,
1985a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
1995a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
2005a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
2015a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsType.h is modified.
2025a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2035a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
2045a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsAllocationGetElement(). Without this
2055a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
2065a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
2075a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * types.
2085a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2095a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
2105a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Type {
2115a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
2125a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
2135a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void *drv;
2145a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
2155a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            const void * element;
2165a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t dimX;
2175a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t dimY;
2185a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t dimZ;
2195a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *lodDimX;
2205a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *lodDimY;
2215a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *lodDimZ;
2225a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *lodOffset;
2235a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t lodCount;
2245a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool faces;
2255a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
2265a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
2275a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Type_t;
2285a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
2295a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
2305a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
2315a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2325a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
2335a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Mesh owned by librs. Unfortunately,
2345a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
2355a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
2365a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
2375a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsMesh.h is modified.
2385a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2395a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
2405a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsMeshGetVertexAllocationCount(). Without this
2415a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
2425a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
2435a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * meshes.
2445a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2455a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
2465a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Mesh {
2475a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
2485a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
2495a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void *drv;
2505a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
2515a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            void **vertexBuffers;
2525a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t vertexBuffersCount;
2535a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
2545a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            // indexBuffers[i] could be NULL, in which case only primitives[i] is used
2555a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            void **indexBuffers;
2565a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t indexBuffersCount;
2575a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_primitive *primitives;
2585a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t primitivesCount;
2595a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
2605a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
2615a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Mesh_t;
2625a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines#endif // _RS_CORE_H_
263