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