rs_structs.h revision bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79
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; 48bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams 49bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams // Allocation adapter state 50bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams const void *baseAlloc; 51bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams uint32_t originX; 52bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams uint32_t originY; 53bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams uint32_t originZ; 54bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams uint32_t originLOD; 55bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams uint32_t originFace; 56bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams uint32_t originArray[4/*Type::mMaxArrays*/]; 575a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } state; 585a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 595a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct DrvState { 605a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct LodState { 615a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines void * mallocPtr; 625a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines size_t stride; 635a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t dimX; 645a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t dimY; 655a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t dimZ; 665a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } lod[16/*android::renderscript::Allocation::MAX_LOD*/]; 675a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines size_t faceOffset; 685a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t lodCount; 695a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t faceCount; 7061656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams 7161656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams struct YuvState { 7261656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams uint32_t shift; 7361656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams uint32_t step; 7461656a7c6fc13421679d0a1cdf8b5b861e286892Jason Sams } yuv; 75bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams 76bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams int grallocFlags; 77bc9dc27b84f4e5c72d4dbe8a8e01af87dd780f79Jason Sams uint32_t dimArray[4/*Type::mMaxArrays*/]; 785a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } drvState; 795a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } mHal; 805a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Allocation_t; 815a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 823ff0fe77fdba8ad4a920dc27157d8c1786bb3661Jason Sams#ifndef __LP64__ 835a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/***************************************************************************** 845a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION 855a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 865a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access 875a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class ProgramStore owned by librs. Unfortunately, 885a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any 895a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at 905a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever 915a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsProgramStore.h is modified. 925a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 935a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to 945a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsgProgramStoreGetDepthFunc(). Without this 955a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in 965a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on 975a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * program store. 985a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 995a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/ 1005a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct ProgramStore { 1015a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines char __pad[40]; 1025a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct { 1035a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct { 1045a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines bool ditherEnable; 1055a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines bool colorRWriteEnable; 1065a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines bool colorGWriteEnable; 1075a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines bool colorBWriteEnable; 1085a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines bool colorAWriteEnable; 1095a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_blend_src_func blendSrc; 1105a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_blend_dst_func blendDst; 1115a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines bool depthWriteEnable; 1125a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_depth_func depthFunc; 1135a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } state; 1145a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } mHal; 1155a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} ProgramStore_t; 1165a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 1175a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/***************************************************************************** 1185a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION 1195a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 1205a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access 1215a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class ProgramRaster owned by librs. Unfortunately, 1225a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any 1235a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at 1245a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever 1255a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsProgramRaster.h is modified. 1265a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 1275a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to 1285a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsgProgramRasterGetCullMode(). Without this 1295a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in 1305a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on 1315a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * program raster. 1325a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 1335a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/ 1345a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct ProgramRaster { 1355a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines char __pad[36]; 1365a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct { 1375a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines void * drv; 1385a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct { 1395a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines bool pointSprite; 1405a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_cull_mode cull; 1415a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } state; 1425a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } mHal; 1435a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} ProgramRaster_t; 1443ff0fe77fdba8ad4a920dc27157d8c1786bb3661Jason Sams#endif //__LP64__ 1455a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 1465a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/***************************************************************************** 1475a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION 1485a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 1495a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access 1505a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Sampler owned by librs. Unfortunately, 1515a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any 1525a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at 1535a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever 1545a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsSampler.h is modified. 1555a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 1565a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to 1575a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsgProgramRasterGetMagFilter(). Without this 1585a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in 1595a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on 1605a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * samplers. 1615a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 1625a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/ 1635a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Sampler { 164e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#ifndef __LP64__ 1655a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines char __pad[32]; 166e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#else 167e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray char __pad[56]; 168e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#endif 1695a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct { 1705a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines void *drv; 1715a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct { 1725a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_sampler_value magFilter; 1735a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_sampler_value minFilter; 1745a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_sampler_value wrapS; 1755a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_sampler_value wrapT; 1765a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_sampler_value wrapR; 1775a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines float aniso; 1785a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } state; 1795a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } mHal; 1805a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Sampler_t; 1815a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 1825a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/***************************************************************************** 1835a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION 1845a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 1855a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access 1865a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Element owned by librs. Unfortunately, 1875a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any 1885a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at 1895a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever 1905a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsElement.h is modified. 1915a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 1925a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to 1935a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsElementGetSubElementCount(). Without this 1945a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in 1955a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on 1965a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * elements. 1975a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 1985a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/ 1995a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Element { 200e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#ifndef __LP64__ 2015a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines char __pad[32]; 202e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#else 203e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray char __pad[56]; 204e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#endif 2055a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct { 2065a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines void *drv; 2075a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct { 2085a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_data_type dataType; 2095a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_data_kind dataKind; 2105a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t vectorSize; 2115a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t elementSizeBytes; 2125a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 2135a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines // Subelements 2145a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines const void **fields; 2155a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t *fieldArraySizes; 2165a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines const char **fieldNames; 2175a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t *fieldNameLengths; 2185a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t *fieldOffsetBytes; 2195a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t fieldsCount; 2205a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } state; 2215a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } mHal; 2225a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Element_t; 2235a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 2245a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/***************************************************************************** 2255a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION 2265a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 2275a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access 2285a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Type owned by librs. Unfortunately, 2295a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any 2305a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at 2315a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever 2325a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsType.h is modified. 2335a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 2345a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to 2355a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsAllocationGetElement(). Without this 2365a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in 2375a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on 2385a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * types. 2395a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 2405a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/ 2415a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Type { 242e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#ifndef __LP64__ 2435a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines char __pad[32]; 244e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#else 245e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray char __pad[56]; 246e3af53b643677c40d228ffd3624cf259f4dc68edTim Murray#endif 2475a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct { 2485a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines void *drv; 2495a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct { 2505a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines const void * element; 2515a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t dimX; 2525a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t dimY; 2535a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t dimZ; 2545a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t *lodDimX; 2555a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t *lodDimY; 2565a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t *lodDimZ; 257c7968a0ac24f05d978616a79a5068b6b16dbbda6Jason Sams uint32_t *arrays; 2585a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t lodCount; 259c7968a0ac24f05d978616a79a5068b6b16dbbda6Jason Sams uint32_t dimYuv; 260c7968a0ac24f05d978616a79a5068b6b16dbbda6Jason Sams uint32_t arrayCount; 2615a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines bool faces; 2625a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } state; 2635a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } mHal; 2645a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Type_t; 2655a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 2663ff0fe77fdba8ad4a920dc27157d8c1786bb3661Jason Sams#ifndef __LP64__ 2675a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines/***************************************************************************** 2685a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * CAUTION 2695a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 2705a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * The following structure layout provides a more efficient way to access 2715a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * internal members of the C++ class Mesh owned by librs. Unfortunately, 2725a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * since this class has virtual members, we can't simply use offsetof() or any 2735a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * other compiler trickery to dynamically get the appropriate values at 2745a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * build-time. This layout may need to be updated whenever 2755a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * frameworks/base/libs/rs/rsMesh.h is modified. 2765a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 2775a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * Having the layout information available in this file allows us to 2785a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * accelerate functionality like rsMeshGetVertexAllocationCount(). Without this 2795a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * information, we would not be able to inline the bitcode, thus resulting in 2805a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * potential runtime performance penalties for tight loops operating on 2815a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * meshes. 2825a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines * 2835a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines *****************************************************************************/ 2845a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinestypedef struct Mesh { 2855a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines char __pad[32]; 2865a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct { 2875a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines void *drv; 2885a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines struct { 2895a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines void **vertexBuffers; 2905a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t vertexBuffersCount; 2915a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 29244bef6fba6244292b751387f3d6c31cca96c28adChris Wailes // indexBuffers[i] could be nullptr, in which case only primitives[i] is used 2935a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines void **indexBuffers; 2945a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t indexBuffersCount; 2955a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_primitive *primitives; 2965a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines uint32_t primitivesCount; 2975a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } state; 2985a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines } mHal; 2995a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines} Mesh_t; 3003ff0fe77fdba8ad4a920dc27157d8c1786bb3661Jason Sams#endif //__LP64__ 3015a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines#endif // _RS_CORE_H_ 302