Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 1 | /* |
Stephen Hines | 2980f07 | 2012-04-09 18:26:29 -0700 | [diff] [blame] | 2 | * Copyright (C) 2011-2012 The Android Open Source Project |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef RS_HAL_H |
| 18 | #define RS_HAL_H |
| 19 | |
Jason Sams | 3715b00 | 2012-02-16 16:07:49 -0800 | [diff] [blame] | 20 | #include <rsDefines.h> |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 21 | |
Jason Sams | 7ac2a4d | 2012-02-15 12:04:24 -0800 | [diff] [blame] | 22 | struct ANativeWindow; |
| 23 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 24 | namespace android { |
| 25 | namespace renderscript { |
| 26 | |
| 27 | class Context; |
| 28 | class ObjectBase; |
| 29 | class Element; |
| 30 | class Type; |
| 31 | class Allocation; |
| 32 | class Script; |
Jason Sams | dbe66d6 | 2012-09-17 13:54:41 -0700 | [diff] [blame] | 33 | class ScriptKernelID; |
| 34 | class ScriptFieldID; |
| 35 | class ScriptMethodID; |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 36 | class ScriptC; |
Jason Sams | dbe66d6 | 2012-09-17 13:54:41 -0700 | [diff] [blame] | 37 | class ScriptGroup; |
Jason Sams | 9e0afb5 | 2011-10-31 13:23:43 -0700 | [diff] [blame] | 38 | class Path; |
Alex Sakhartchouk | 7f126c7 | 2011-05-05 16:56:27 -0700 | [diff] [blame] | 39 | class Program; |
Jason Sams | 8feea4e | 2011-03-18 15:03:25 -0700 | [diff] [blame] | 40 | class ProgramStore; |
Jason Sams | 721acc4 | 2011-04-06 11:23:54 -0700 | [diff] [blame] | 41 | class ProgramRaster; |
Alex Sakhartchouk | a04e30d | 2011-04-29 16:49:08 -0700 | [diff] [blame] | 42 | class ProgramVertex; |
| 43 | class ProgramFragment; |
| 44 | class Mesh; |
Alex Sakhartchouk | 7f126c7 | 2011-05-05 16:56:27 -0700 | [diff] [blame] | 45 | class Sampler; |
Alex Sakhartchouk | da6d34a | 2011-05-13 14:53:34 -0700 | [diff] [blame] | 46 | class FBOCache; |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 47 | |
Jason Sams | a36c50a | 2014-06-17 12:06:06 -0700 | [diff] [blame] | 48 | /** |
| 49 | * Define the internal object types. This ia a mirror of the |
| 50 | * definition in rs_types.rsh except with the p value typed |
| 51 | * correctly. |
| 52 | * |
| 53 | * p = pointer to internal object implementation |
| 54 | * r = reserved by libRS runtime |
| 55 | * v1 = Mirror of p->mHal.drv |
| 56 | * v2 = reserved for use by vendor drivers |
| 57 | */ |
| 58 | |
| 59 | #ifndef __LP64__ |
| 60 | #define RS_BASE_OBJ(_t_) typedef struct { const _t_* p; } __attribute__((packed, aligned(4))) |
| 61 | #else |
| 62 | #define RS_BASE_OBJ(_t_) typedef struct { const _t_* p; const void* r; const void* v1; const void* v2; } |
| 63 | #endif |
| 64 | |
Jason Sams | 05ef73f | 2014-08-05 14:59:22 -0700 | [diff] [blame] | 65 | RS_BASE_OBJ(ObjectBase) rs_object_base; |
Jason Sams | a36c50a | 2014-06-17 12:06:06 -0700 | [diff] [blame] | 66 | RS_BASE_OBJ(Element) rs_element; |
| 67 | RS_BASE_OBJ(Type) rs_type; |
| 68 | RS_BASE_OBJ(Allocation) rs_allocation; |
| 69 | RS_BASE_OBJ(Sampler) rs_sampler; |
| 70 | RS_BASE_OBJ(Script) rs_script; |
| 71 | RS_BASE_OBJ(ScriptGroup) rs_script_group; |
| 72 | |
| 73 | #ifndef __LP64__ |
| 74 | typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_mesh; |
| 75 | typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_path; |
| 76 | typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_fragment; |
| 77 | typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_vertex; |
| 78 | typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_raster; |
| 79 | typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_program_store; |
| 80 | typedef struct { const int* p; } __attribute__((packed, aligned(4))) rs_font; |
| 81 | #endif // __LP64__ |
| 82 | |
| 83 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 84 | typedef void *(*RsHalSymbolLookupFunc)(void *usrptr, char const *symbolName); |
| 85 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 86 | /** |
| 87 | * Script management functions |
| 88 | */ |
| 89 | typedef struct { |
Jason Sams | 4b3de47 | 2011-04-06 17:52:23 -0700 | [diff] [blame] | 90 | bool (*initGraphics)(const Context *); |
| 91 | void (*shutdownGraphics)(const Context *); |
Alex Sakhartchouk | 7257c7e | 2011-05-17 12:32:47 -0700 | [diff] [blame] | 92 | bool (*setSurface)(const Context *, uint32_t w, uint32_t h, RsNativeWindow); |
Jason Sams | 4b3de47 | 2011-04-06 17:52:23 -0700 | [diff] [blame] | 93 | void (*swap)(const Context *); |
| 94 | |
Jason Sams | cdfdb8f | 2011-03-17 16:12:47 -0700 | [diff] [blame] | 95 | void (*shutdownDriver)(Context *); |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 96 | void (*getVersion)(unsigned int *major, unsigned int *minor); |
Jason Sams | cdfdb8f | 2011-03-17 16:12:47 -0700 | [diff] [blame] | 97 | void (*setPriority)(const Context *, int32_t priority); |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 98 | |
Tim Murray | 3468938 | 2013-03-11 12:12:03 -0700 | [diff] [blame] | 99 | void* (*allocRuntimeMem)(size_t size, uint32_t flags); |
| 100 | void (*freeRuntimeMem)(void* ptr); |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 101 | |
| 102 | struct { |
Jason Sams | 8feea4e | 2011-03-18 15:03:25 -0700 | [diff] [blame] | 103 | bool (*init)(const Context *rsc, ScriptC *s, |
| 104 | char const *resName, |
| 105 | char const *cacheDir, |
| 106 | uint8_t const *bitcode, |
| 107 | size_t bitcodeSize, |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 108 | uint32_t flags); |
Jason Sams | 8eaba4f | 2012-08-14 14:38:05 -0700 | [diff] [blame] | 109 | bool (*initIntrinsic)(const Context *rsc, Script *s, |
Stephen Hines | 41d6c76 | 2012-08-21 17:07:38 -0700 | [diff] [blame] | 110 | RsScriptIntrinsicID iid, |
Jason Sams | 8eaba4f | 2012-08-14 14:38:05 -0700 | [diff] [blame] | 111 | Element *e); |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 112 | |
Jason Sams | cdfdb8f | 2011-03-17 16:12:47 -0700 | [diff] [blame] | 113 | void (*invokeFunction)(const Context *rsc, Script *s, |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 114 | uint32_t slot, |
| 115 | const void *params, |
| 116 | size_t paramLength); |
Jason Sams | cdfdb8f | 2011-03-17 16:12:47 -0700 | [diff] [blame] | 117 | int (*invokeRoot)(const Context *rsc, Script *s); |
| 118 | void (*invokeForEach)(const Context *rsc, |
| 119 | Script *s, |
Jason Sams | 35e429e | 2011-07-13 11:26:26 -0700 | [diff] [blame] | 120 | uint32_t slot, |
Jason Sams | cdfdb8f | 2011-03-17 16:12:47 -0700 | [diff] [blame] | 121 | const Allocation * ain, |
| 122 | Allocation * aout, |
| 123 | const void * usr, |
Tim Murray | 099bc26 | 2013-03-20 16:54:03 -0700 | [diff] [blame] | 124 | size_t usrLen, |
Jason Sams | cdfdb8f | 2011-03-17 16:12:47 -0700 | [diff] [blame] | 125 | const RsScriptCall *sc); |
| 126 | void (*invokeInit)(const Context *rsc, Script *s); |
Stephen Hines | 4ee16ff | 2011-08-31 17:41:39 -0700 | [diff] [blame] | 127 | void (*invokeFreeChildren)(const Context *rsc, Script *s); |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 128 | |
| 129 | void (*setGlobalVar)(const Context *rsc, const Script *s, |
| 130 | uint32_t slot, |
| 131 | void *data, |
| 132 | size_t dataLength); |
Tim Murray | 9c64239 | 2013-04-11 13:29:59 -0700 | [diff] [blame] | 133 | void (*getGlobalVar)(const Context *rsc, const Script *s, |
| 134 | uint32_t slot, |
| 135 | void *data, |
| 136 | size_t dataLength); |
Stephen Hines | 2980f07 | 2012-04-09 18:26:29 -0700 | [diff] [blame] | 137 | void (*setGlobalVarWithElemDims)(const Context *rsc, const Script *s, |
| 138 | uint32_t slot, |
| 139 | void *data, |
| 140 | size_t dataLength, |
| 141 | const Element *e, |
Stephen Hines | ac8d146 | 2014-06-25 00:01:23 -0700 | [diff] [blame] | 142 | const uint32_t *dims, |
Stephen Hines | 2980f07 | 2012-04-09 18:26:29 -0700 | [diff] [blame] | 143 | size_t dimLength); |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 144 | void (*setGlobalBind)(const Context *rsc, const Script *s, |
| 145 | uint32_t slot, |
Jason Sams | 807fdc4 | 2012-07-25 17:55:39 -0700 | [diff] [blame] | 146 | Allocation *data); |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 147 | void (*setGlobalObj)(const Context *rsc, const Script *s, |
| 148 | uint32_t slot, |
| 149 | ObjectBase *data); |
| 150 | |
| 151 | void (*destroy)(const Context *rsc, Script *s); |
Chris Wailes | 4b3c34e | 2014-06-11 12:00:29 -0700 | [diff] [blame] | 152 | void (*invokeForEachMulti)(const Context *rsc, |
| 153 | Script *s, |
| 154 | uint32_t slot, |
| 155 | const Allocation ** ains, |
| 156 | size_t inLen, |
| 157 | Allocation * aout, |
| 158 | const void * usr, |
| 159 | size_t usrLen, |
| 160 | const RsScriptCall *sc); |
Jason Sams | a36c50a | 2014-06-17 12:06:06 -0700 | [diff] [blame] | 161 | void (*updateCachedObject)(const Context *rsc, const Script *, rs_script *obj); |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 162 | } script; |
| 163 | |
Jason Sams | 8feea4e | 2011-03-18 15:03:25 -0700 | [diff] [blame] | 164 | struct { |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 165 | bool (*init)(const Context *rsc, Allocation *alloc, bool forceZero); |
| 166 | void (*destroy)(const Context *rsc, Allocation *alloc); |
Jason Sams | ddceab9 | 2013-08-07 13:02:32 -0700 | [diff] [blame] | 167 | uint32_t (*grallocBits)(const Context *rsc, Allocation *alloc); |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 168 | |
| 169 | void (*resize)(const Context *rsc, const Allocation *alloc, const Type *newType, |
| 170 | bool zeroNew); |
| 171 | void (*syncAll)(const Context *rsc, const Allocation *alloc, RsAllocationUsageType src); |
| 172 | void (*markDirty)(const Context *rsc, const Allocation *alloc); |
Jason Sams | 7ac2a4d | 2012-02-15 12:04:24 -0800 | [diff] [blame] | 173 | |
Jason Sams | 733396b | 2013-02-22 12:46:18 -0800 | [diff] [blame] | 174 | void (*setSurface)(const Context *rsc, Allocation *alloc, ANativeWindow *sur); |
Jason Sams | 7ac2a4d | 2012-02-15 12:04:24 -0800 | [diff] [blame] | 175 | void (*ioSend)(const Context *rsc, Allocation *alloc); |
Jason Sams | ddceab9 | 2013-08-07 13:02:32 -0700 | [diff] [blame] | 176 | |
| 177 | /** |
| 178 | * A new gralloc buffer is in use. The pointers and strides in |
| 179 | * mHal.drvState.lod[0-2] will be updated with the new values. |
| 180 | * |
| 181 | * The new gralloc handle is provided in mHal.state.nativeBuffer |
| 182 | * |
| 183 | */ |
Jason Sams | 7ac2a4d | 2012-02-15 12:04:24 -0800 | [diff] [blame] | 184 | void (*ioReceive)(const Context *rsc, Allocation *alloc); |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 185 | |
| 186 | void (*data1D)(const Context *rsc, const Allocation *alloc, |
Tim Murray | 099bc26 | 2013-03-20 16:54:03 -0700 | [diff] [blame] | 187 | uint32_t xoff, uint32_t lod, size_t count, |
Alex Sakhartchouk | c794cd5 | 2012-02-13 11:57:32 -0800 | [diff] [blame] | 188 | const void *data, size_t sizeBytes); |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 189 | void (*data2D)(const Context *rsc, const Allocation *alloc, |
| 190 | uint32_t xoff, uint32_t yoff, uint32_t lod, |
| 191 | RsAllocationCubemapFace face, uint32_t w, uint32_t h, |
Tim Murray | 358747a | 2012-11-26 13:52:04 -0800 | [diff] [blame] | 192 | const void *data, size_t sizeBytes, size_t stride); |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 193 | void (*data3D)(const Context *rsc, const Allocation *alloc, |
Jason Sams | 3bbc0fd | 2013-04-09 14:16:13 -0700 | [diff] [blame] | 194 | uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod, |
| 195 | uint32_t w, uint32_t h, uint32_t d, const void *data, size_t sizeBytes, |
| 196 | size_t stride); |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 197 | |
Jason Sams | 807fdc4 | 2012-07-25 17:55:39 -0700 | [diff] [blame] | 198 | void (*read1D)(const Context *rsc, const Allocation *alloc, |
Tim Murray | 099bc26 | 2013-03-20 16:54:03 -0700 | [diff] [blame] | 199 | uint32_t xoff, uint32_t lod, size_t count, |
Jason Sams | 807fdc4 | 2012-07-25 17:55:39 -0700 | [diff] [blame] | 200 | void *data, size_t sizeBytes); |
| 201 | void (*read2D)(const Context *rsc, const Allocation *alloc, |
| 202 | uint32_t xoff, uint32_t yoff, uint32_t lod, |
| 203 | RsAllocationCubemapFace face, uint32_t w, uint32_t h, |
Tim Murray | 358747a | 2012-11-26 13:52:04 -0800 | [diff] [blame] | 204 | void *data, size_t sizeBytes, size_t stride); |
Jason Sams | 807fdc4 | 2012-07-25 17:55:39 -0700 | [diff] [blame] | 205 | void (*read3D)(const Context *rsc, const Allocation *alloc, |
Jason Sams | 3bbc0fd | 2013-04-09 14:16:13 -0700 | [diff] [blame] | 206 | uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod, |
| 207 | uint32_t w, uint32_t h, uint32_t d, void *data, size_t sizeBytes, |
| 208 | size_t stride); |
Jason Sams | 807fdc4 | 2012-07-25 17:55:39 -0700 | [diff] [blame] | 209 | |
| 210 | // Lock and unlock make a 1D region of memory available to the CPU |
| 211 | // for direct access by pointer. Once unlock is called control is |
| 212 | // returned to the SOC driver. |
| 213 | void * (*lock1D)(const Context *rsc, const Allocation *alloc); |
| 214 | void (*unlock1D)(const Context *rsc, const Allocation *alloc); |
| 215 | |
Alex Sakhartchouk | 74a8279 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 216 | // Allocation to allocation copies |
| 217 | void (*allocData1D)(const Context *rsc, |
| 218 | const Allocation *dstAlloc, |
Tim Murray | 099bc26 | 2013-03-20 16:54:03 -0700 | [diff] [blame] | 219 | uint32_t dstXoff, uint32_t dstLod, size_t count, |
Alex Sakhartchouk | 74a8279 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 220 | const Allocation *srcAlloc, uint32_t srcXoff, uint32_t srcLod); |
| 221 | void (*allocData2D)(const Context *rsc, |
| 222 | const Allocation *dstAlloc, |
| 223 | uint32_t dstXoff, uint32_t dstYoff, uint32_t dstLod, |
| 224 | RsAllocationCubemapFace dstFace, uint32_t w, uint32_t h, |
| 225 | const Allocation *srcAlloc, |
| 226 | uint32_t srcXoff, uint32_t srcYoff, uint32_t srcLod, |
| 227 | RsAllocationCubemapFace srcFace); |
| 228 | void (*allocData3D)(const Context *rsc, |
| 229 | const Allocation *dstAlloc, |
| 230 | uint32_t dstXoff, uint32_t dstYoff, uint32_t dstZoff, |
Jason Sams | 3bbc0fd | 2013-04-09 14:16:13 -0700 | [diff] [blame] | 231 | uint32_t dstLod, |
Alex Sakhartchouk | 74a8279 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 232 | uint32_t w, uint32_t h, uint32_t d, |
| 233 | const Allocation *srcAlloc, |
| 234 | uint32_t srcXoff, uint32_t srcYoff, uint32_t srcZoff, |
Jason Sams | 3bbc0fd | 2013-04-09 14:16:13 -0700 | [diff] [blame] | 235 | uint32_t srcLod); |
Alex Sakhartchouk | 74a8279 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 236 | |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 237 | void (*elementData1D)(const Context *rsc, const Allocation *alloc, uint32_t x, |
Alex Sakhartchouk | c794cd5 | 2012-02-13 11:57:32 -0800 | [diff] [blame] | 238 | const void *data, uint32_t elementOff, size_t sizeBytes); |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 239 | void (*elementData2D)(const Context *rsc, const Allocation *alloc, uint32_t x, uint32_t y, |
Alex Sakhartchouk | c794cd5 | 2012-02-13 11:57:32 -0800 | [diff] [blame] | 240 | const void *data, uint32_t elementOff, size_t sizeBytes); |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 241 | |
Jason Sams | 61a4bb7 | 2012-07-25 19:33:43 -0700 | [diff] [blame] | 242 | void (*generateMipmaps)(const Context *rsc, const Allocation *alloc); |
Jason Sams | a36c50a | 2014-06-17 12:06:06 -0700 | [diff] [blame] | 243 | |
| 244 | void (*updateCachedObject)(const Context *rsc, const Allocation *alloc, rs_allocation *obj); |
Jason Sams | eb4fe18 | 2011-05-26 16:33:01 -0700 | [diff] [blame] | 245 | } allocation; |
| 246 | |
| 247 | struct { |
Jason Sams | 8feea4e | 2011-03-18 15:03:25 -0700 | [diff] [blame] | 248 | bool (*init)(const Context *rsc, const ProgramStore *ps); |
| 249 | void (*setActive)(const Context *rsc, const ProgramStore *ps); |
| 250 | void (*destroy)(const Context *rsc, const ProgramStore *ps); |
| 251 | } store; |
| 252 | |
Jason Sams | 721acc4 | 2011-04-06 11:23:54 -0700 | [diff] [blame] | 253 | struct { |
| 254 | bool (*init)(const Context *rsc, const ProgramRaster *ps); |
| 255 | void (*setActive)(const Context *rsc, const ProgramRaster *ps); |
| 256 | void (*destroy)(const Context *rsc, const ProgramRaster *ps); |
| 257 | } raster; |
Jason Sams | 8feea4e | 2011-03-18 15:03:25 -0700 | [diff] [blame] | 258 | |
Alex Sakhartchouk | a04e30d | 2011-04-29 16:49:08 -0700 | [diff] [blame] | 259 | struct { |
| 260 | bool (*init)(const Context *rsc, const ProgramVertex *pv, |
Alex Sakhartchouk | 748eb07 | 2012-02-15 16:21:46 -0800 | [diff] [blame] | 261 | const char* shader, size_t shaderLen, |
| 262 | const char** textureNames, size_t textureNamesCount, |
| 263 | const size_t *textureNamesLength); |
Alex Sakhartchouk | a04e30d | 2011-04-29 16:49:08 -0700 | [diff] [blame] | 264 | void (*setActive)(const Context *rsc, const ProgramVertex *pv); |
| 265 | void (*destroy)(const Context *rsc, const ProgramVertex *pv); |
| 266 | } vertex; |
| 267 | |
| 268 | struct { |
| 269 | bool (*init)(const Context *rsc, const ProgramFragment *pf, |
Alex Sakhartchouk | 748eb07 | 2012-02-15 16:21:46 -0800 | [diff] [blame] | 270 | const char* shader, size_t shaderLen, |
| 271 | const char** textureNames, size_t textureNamesCount, |
| 272 | const size_t *textureNamesLength); |
Alex Sakhartchouk | a04e30d | 2011-04-29 16:49:08 -0700 | [diff] [blame] | 273 | void (*setActive)(const Context *rsc, const ProgramFragment *pf); |
| 274 | void (*destroy)(const Context *rsc, const ProgramFragment *pf); |
| 275 | } fragment; |
| 276 | |
| 277 | struct { |
| 278 | bool (*init)(const Context *rsc, const Mesh *m); |
| 279 | void (*draw)(const Context *rsc, const Mesh *m, uint32_t primIndex, uint32_t start, uint32_t len); |
| 280 | void (*destroy)(const Context *rsc, const Mesh *m); |
| 281 | } mesh; |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 282 | |
Alex Sakhartchouk | 7f126c7 | 2011-05-05 16:56:27 -0700 | [diff] [blame] | 283 | struct { |
Jason Sams | 9e0afb5 | 2011-10-31 13:23:43 -0700 | [diff] [blame] | 284 | bool (*initStatic)(const Context *rsc, const Path *m, const Allocation *vtx, const Allocation *loops); |
| 285 | bool (*initDynamic)(const Context *rsc, const Path *m); |
| 286 | void (*draw)(const Context *rsc, const Path *m); |
| 287 | void (*destroy)(const Context *rsc, const Path *m); |
| 288 | } path; |
| 289 | |
| 290 | struct { |
Alex Sakhartchouk | 7f126c7 | 2011-05-05 16:56:27 -0700 | [diff] [blame] | 291 | bool (*init)(const Context *rsc, const Sampler *m); |
| 292 | void (*destroy)(const Context *rsc, const Sampler *m); |
Jason Sams | a36c50a | 2014-06-17 12:06:06 -0700 | [diff] [blame] | 293 | void (*updateCachedObject)(const Context *rsc, const Sampler *s, rs_sampler *obj); |
Alex Sakhartchouk | 7f126c7 | 2011-05-05 16:56:27 -0700 | [diff] [blame] | 294 | } sampler; |
| 295 | |
Alex Sakhartchouk | da6d34a | 2011-05-13 14:53:34 -0700 | [diff] [blame] | 296 | struct { |
| 297 | bool (*init)(const Context *rsc, const FBOCache *fb); |
| 298 | void (*setActive)(const Context *rsc, const FBOCache *fb); |
| 299 | void (*destroy)(const Context *rsc, const FBOCache *fb); |
| 300 | } framebuffer; |
| 301 | |
Jason Sams | dbe66d6 | 2012-09-17 13:54:41 -0700 | [diff] [blame] | 302 | struct { |
Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 303 | bool (*init)(const Context *rsc, ScriptGroup *sg); |
Jason Sams | dbe66d6 | 2012-09-17 13:54:41 -0700 | [diff] [blame] | 304 | void (*setInput)(const Context *rsc, const ScriptGroup *sg, |
| 305 | const ScriptKernelID *kid, Allocation *); |
| 306 | void (*setOutput)(const Context *rsc, const ScriptGroup *sg, |
| 307 | const ScriptKernelID *kid, Allocation *); |
| 308 | void (*execute)(const Context *rsc, const ScriptGroup *sg); |
| 309 | void (*destroy)(const Context *rsc, const ScriptGroup *sg); |
Jason Sams | a36c50a | 2014-06-17 12:06:06 -0700 | [diff] [blame] | 310 | void (*updateCachedObject)(const Context *rsc, const ScriptGroup *sg, rs_script_group *obj); |
Jason Sams | dbe66d6 | 2012-09-17 13:54:41 -0700 | [diff] [blame] | 311 | } scriptgroup; |
| 312 | |
Jason Sams | a36c50a | 2014-06-17 12:06:06 -0700 | [diff] [blame] | 313 | struct { |
| 314 | bool (*init)(const Context *rsc, const Type *m); |
| 315 | void (*destroy)(const Context *rsc, const Type *m); |
| 316 | void (*updateCachedObject)(const Context *rsc, const Type *s, rs_type *obj); |
| 317 | } type; |
| 318 | |
| 319 | struct { |
| 320 | bool (*init)(const Context *rsc, const Element *m); |
| 321 | void (*destroy)(const Context *rsc, const Element *m); |
| 322 | void (*updateCachedObject)(const Context *rsc, const Element *s, rs_element *obj); |
| 323 | } element; |
| 324 | |
Jason Sams | 9761c3f | 2013-11-26 18:10:59 -0800 | [diff] [blame] | 325 | void (*finish)(const Context *rsc); |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 326 | } RsdHalFunctions; |
| 327 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 328 | |
| 329 | } |
| 330 | } |
| 331 | |
Stephen Hines | 414a461 | 2012-09-05 18:05:08 -0700 | [diff] [blame] | 332 | #ifdef __cplusplus |
| 333 | extern "C" { |
| 334 | #endif |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 335 | |
Stephen Hines | 414a461 | 2012-09-05 18:05:08 -0700 | [diff] [blame] | 336 | bool rsdHalInit(RsContext, uint32_t version_major, uint32_t version_minor); |
| 337 | |
| 338 | #ifdef __cplusplus |
| 339 | } |
| 340 | #endif |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 341 | |
| 342 | #endif |