15a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines#ifndef _RS_STRUCTS_H_
25a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines#define _RS_STRUCTS_H_
35a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
4be2163801c33d6849ae580d42b919b8803d55095Jean-Luc Brouillet#include "rs_core.rsh"
5be2163801c33d6849ae580d42b919b8803d55095Jean-Luc Brouillet#include "rs_graphics.rsh"
6be2163801c33d6849ae580d42b919b8803d55095Jean-Luc Brouillet
75a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
85a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
95a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
105a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
115a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Allocation owned by librs. Unfortunately,
125a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
135a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
145a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
155a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsAllocation.h is modified.
165a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
175a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
185a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsAllocationGetDimX(). Without this
195a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
205a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
215a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * allocations.
225a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
235a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
245a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef enum {
255a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    RS_ALLOCATION_MIPMAP_NONE = 0,
265a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    RS_ALLOCATION_MIPMAP_FULL = 1,
275a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE = 2
285a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} rs_allocation_mipmap_control;
295a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
305a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Allocation {
31e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#ifndef __LP64__
325a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
33e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#else
34e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray    char __pad[56];
35e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#endif
365a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
375a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void * drv;
385a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
395a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            const void *type;
405a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t usageFlags;
415a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_allocation_mipmap_control mipmapControl;
425a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t yuv;
435a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t elementSizeBytes;
445a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool hasMipmaps;
455a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool hasFaces;
465a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool hasReferences;
475a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            void * usrPtr;
485a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            int32_t surfaceTextureID;
49ddceab9a001f07a3395226c5e06e3b420720af0fJason Sams            void * nativeBuffer;
50ddceab9a001f07a3395226c5e06e3b420720af0fJason Sams            int64_t timestamp;
51bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams
52bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams            // Allocation adapter state
53bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams            const void *baseAlloc;
54bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams            uint32_t originX;
55bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams            uint32_t originY;
56bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams            uint32_t originZ;
57bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams            uint32_t originLOD;
58bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams            uint32_t originFace;
59bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams            uint32_t originArray[4/*Type::mMaxArrays*/];
605a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
615a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
625a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct DrvState {
635a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            struct LodState {
645a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                void * mallocPtr;
655a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                size_t stride;
665a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                uint32_t dimX;
675a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                uint32_t dimY;
685a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines                uint32_t dimZ;
695a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            } lod[16/*android::renderscript::Allocation::MAX_LOD*/];
705a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            size_t faceOffset;
715a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t lodCount;
725a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t faceCount;
7361656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams
7461656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams            struct YuvState {
7561656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams                uint32_t shift;
7661656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams                uint32_t step;
7761656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams            } yuv;
78bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams
79bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams            int grallocFlags;
80bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams            uint32_t dimArray[4/*Type::mMaxArrays*/];
815a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } drvState;
825a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
835a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Allocation_t;
845a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
853ff0fe77fdba8ad4a920dc27157d8c1786bb3661Jason Sams#ifndef __LP64__
865a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
875a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
885a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
895a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
905a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class ProgramStore owned by librs. Unfortunately,
915a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
925a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
935a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
945a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsProgramStore.h is modified.
955a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
965a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
975a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsgProgramStoreGetDepthFunc(). Without this
985a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
995a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
1005a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * program store.
1015a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1025a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
1035a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct ProgramStore {
1045a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[40];
1055a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
1065a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
1075a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool ditherEnable;
1085a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool colorRWriteEnable;
1095a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool colorGWriteEnable;
1105a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool colorBWriteEnable;
1115a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool colorAWriteEnable;
1125a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_blend_src_func blendSrc;
1135a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_blend_dst_func blendDst;
1145a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool depthWriteEnable;
1155a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_depth_func depthFunc;
1165a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
1175a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
1185a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} ProgramStore_t;
1195a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
1205a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
1215a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
1225a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1235a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
1245a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class ProgramRaster owned by librs. Unfortunately,
1255a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
1265a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
1275a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
1285a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsProgramRaster.h is modified.
1295a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1305a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
1315a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsgProgramRasterGetCullMode(). Without this
1325a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
1335a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
1345a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * program raster.
1355a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1365a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
1375a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct ProgramRaster {
1385a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[36];
1395a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
1405a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void * drv;
1415a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
1425a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool pointSprite;
1435a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_cull_mode cull;
1445a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
1455a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
1465a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} ProgramRaster_t;
1473ff0fe77fdba8ad4a920dc27157d8c1786bb3661Jason Sams#endif //__LP64__
1485a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
1495a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
1505a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
1515a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1525a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
1535a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Sampler owned by librs. Unfortunately,
1545a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
1555a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
1565a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
1575a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsSampler.h is modified.
1585a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1595a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
1605a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsgProgramRasterGetMagFilter(). Without this
1615a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
1625a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
1635a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * samplers.
1645a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1655a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
1665a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Sampler {
167e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#ifndef __LP64__
1685a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
169e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#else
170e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray    char __pad[56];
171e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#endif
1725a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
1735a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void *drv;
1745a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
1755a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value magFilter;
1765a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value minFilter;
1775a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value wrapS;
1785a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value wrapT;
1795a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_sampler_value wrapR;
1805a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            float aniso;
1815a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
1825a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
1835a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Sampler_t;
1845a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
1855a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
1865a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
1875a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1885a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
1895a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Element owned by librs. Unfortunately,
1905a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
1915a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
1925a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
1935a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsElement.h is modified.
1945a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
1955a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
1965a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsElementGetSubElementCount(). Without this
1975a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
1985a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
1995a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * elements.
2005a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2015a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
2025a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Element {
203e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#ifndef __LP64__
2045a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
205e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#else
206e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray    char __pad[56];
207e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#endif
2085a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
2095a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void *drv;
2105a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
2115a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_data_type dataType;
2125a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_data_kind dataKind;
2135a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t vectorSize;
2145a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t elementSizeBytes;
2155a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
2165a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            // Subelements
2175a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            const void **fields;
2185a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *fieldArraySizes;
2195a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            const char **fieldNames;
2205a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *fieldNameLengths;
2215a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *fieldOffsetBytes;
2225a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t fieldsCount;
2235a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
2245a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
2255a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Element_t;
2265a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
2275a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
2285a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
2295a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2305a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
2315a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Type owned by librs. Unfortunately,
2325a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
2335a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
2345a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
2355a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsType.h is modified.
2365a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2375a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
2385a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsAllocationGetElement(). Without this
2395a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
2405a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
2415a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * types.
2425a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2435a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
2445a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Type {
245e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#ifndef __LP64__
2465a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
247e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#else
248e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray    char __pad[56];
249e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#endif
2505a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
2515a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void *drv;
2525a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
2535a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            const void * element;
2545a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t dimX;
2555a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t dimY;
2565a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t dimZ;
2575a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *lodDimX;
2585a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *lodDimY;
2595a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t *lodDimZ;
260c7968a0ac24f05d978616a79a5068b6b16dbbda6Jason Sams            uint32_t *arrays;
2615a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t lodCount;
262c7968a0ac24f05d978616a79a5068b6b16dbbda6Jason Sams            uint32_t dimYuv;
263c7968a0ac24f05d978616a79a5068b6b16dbbda6Jason Sams            uint32_t arrayCount;
2645a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            bool faces;
2655a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
2665a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
2675a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Type_t;
2685a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
2693ff0fe77fdba8ad4a920dc27157d8c1786bb3661Jason Sams#ifndef __LP64__
2705a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/*****************************************************************************
2715a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION
2725a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2735a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access
2745a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Mesh owned by librs. Unfortunately,
2755a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any
2765a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at
2775a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever
2785a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsMesh.h is modified.
2795a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2805a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to
2815a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsMeshGetVertexAllocationCount(). Without this
2825a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in
2835a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on
2845a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * meshes.
2855a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *
2865a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/
2875a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Mesh {
2885a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    char __pad[32];
2895a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    struct {
2905a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        void *drv;
2915a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        struct {
2925a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            void **vertexBuffers;
2935a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t vertexBuffersCount;
2945a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines
29544bef6fba6244292b751387f3d6c31cca96c28adChris Wailes            // indexBuffers[i] could be nullptr, in which case only primitives[i] is used
2965a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            void **indexBuffers;
2975a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t indexBuffersCount;
2985a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            rs_primitive *primitives;
2995a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines            uint32_t primitivesCount;
3005a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines        } state;
3015a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines    } mHal;
3025a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Mesh_t;
3033ff0fe77fdba8ad4a920dc27157d8c1786bb3661Jason Sams#endif //__LP64__
3045a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines#endif // _RS_CORE_H_
305