Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 The Android Open Source Project |
| 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 | #include "rsContext.h" |
| 18 | #include "rsScriptC.h" |
| 19 | #include "rsMatrix.h" |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 20 | |
| 21 | #include "acc/acc.h" |
| 22 | #include "utils/Timers.h" |
| 23 | |
| 24 | #define GL_GLEXT_PROTOTYPES |
| 25 | |
| 26 | #include <GLES/gl.h> |
| 27 | #include <GLES/glext.h> |
| 28 | #include <GLES2/gl2.h> |
| 29 | #include <GLES2/gl2ext.h> |
| 30 | |
| 31 | #include <time.h> |
| 32 | |
| 33 | using namespace android; |
| 34 | using namespace android::renderscript; |
| 35 | |
| 36 | #define GET_TLS() Context::ScriptTLSStruct * tls = \ |
| 37 | (Context::ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey); \ |
| 38 | Context * rsc = tls->mContext; \ |
| 39 | ScriptC * sc = (ScriptC *) tls->mScript |
| 40 | |
| 41 | |
| 42 | ////////////////////////////////////////////////////////////////////////////// |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 43 | // Context |
| 44 | ////////////////////////////////////////////////////////////////////////////// |
| 45 | |
| 46 | static void SC_bindTexture(RsProgramFragment vpf, uint32_t slot, RsAllocation va) |
| 47 | { |
| 48 | GET_TLS(); |
| 49 | rsi_ProgramBindTexture(rsc, |
| 50 | static_cast<ProgramFragment *>(vpf), |
| 51 | slot, |
| 52 | static_cast<Allocation *>(va)); |
| 53 | |
| 54 | } |
| 55 | |
| 56 | static void SC_bindSampler(RsProgramFragment vpf, uint32_t slot, RsSampler vs) |
| 57 | { |
| 58 | GET_TLS(); |
| 59 | rsi_ProgramBindSampler(rsc, |
| 60 | static_cast<ProgramFragment *>(vpf), |
| 61 | slot, |
| 62 | static_cast<Sampler *>(vs)); |
| 63 | |
| 64 | } |
| 65 | |
| 66 | static void SC_bindProgramStore(RsProgramStore pfs) |
| 67 | { |
| 68 | GET_TLS(); |
| 69 | rsi_ContextBindProgramStore(rsc, pfs); |
| 70 | } |
| 71 | |
| 72 | static void SC_bindProgramFragment(RsProgramFragment pf) |
| 73 | { |
| 74 | GET_TLS(); |
| 75 | rsi_ContextBindProgramFragment(rsc, pf); |
| 76 | } |
| 77 | |
| 78 | static void SC_bindProgramVertex(RsProgramVertex pv) |
| 79 | { |
| 80 | GET_TLS(); |
| 81 | rsi_ContextBindProgramVertex(rsc, pv); |
| 82 | } |
| 83 | |
| 84 | static void SC_bindProgramRaster(RsProgramRaster pv) |
| 85 | { |
| 86 | GET_TLS(); |
| 87 | rsi_ContextBindProgramRaster(rsc, pv); |
| 88 | } |
| 89 | |
| 90 | ////////////////////////////////////////////////////////////////////////////// |
| 91 | // VP |
| 92 | ////////////////////////////////////////////////////////////////////////////// |
| 93 | |
Jim Miller | d8e7620 | 2010-07-28 14:46:22 -0700 | [diff] [blame] | 94 | static void SC_vpLoadProjectionMatrix(const rsc_Matrix *m) |
| 95 | { |
| 96 | GET_TLS(); |
| 97 | rsc->getVertex()->setProjectionMatrix(m); |
| 98 | } |
| 99 | |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 100 | static void SC_vpLoadModelMatrix(const rsc_Matrix *m) |
| 101 | { |
| 102 | GET_TLS(); |
| 103 | rsc->getVertex()->setModelviewMatrix(m); |
| 104 | } |
| 105 | |
| 106 | static void SC_vpLoadTextureMatrix(const rsc_Matrix *m) |
| 107 | { |
| 108 | GET_TLS(); |
| 109 | rsc->getVertex()->setTextureMatrix(m); |
| 110 | } |
| 111 | |
| 112 | |
Jason Sams | 442a647 | 2010-08-04 17:50:20 -0700 | [diff] [blame] | 113 | static void SC_pfConstantColor(RsProgramFragment vpf, float r, float g, float b, float a) |
| 114 | { |
| 115 | //GET_TLS(); |
| 116 | ProgramFragment *pf = static_cast<ProgramFragment *>(vpf); |
| 117 | pf->setConstantColor(r, g, b, a); |
| 118 | } |
| 119 | |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 120 | |
| 121 | ////////////////////////////////////////////////////////////////////////////// |
| 122 | // Drawing |
| 123 | ////////////////////////////////////////////////////////////////////////////// |
| 124 | |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 125 | static void SC_drawQuadTexCoords(float x1, float y1, float z1, |
| 126 | float u1, float v1, |
| 127 | float x2, float y2, float z2, |
| 128 | float u2, float v2, |
| 129 | float x3, float y3, float z3, |
| 130 | float u3, float v3, |
| 131 | float x4, float y4, float z4, |
| 132 | float u4, float v4) |
| 133 | { |
| 134 | GET_TLS(); |
| 135 | if (!rsc->setupCheck()) { |
| 136 | return; |
| 137 | } |
| 138 | |
| 139 | //LOGE("Quad"); |
| 140 | //LOGE("%4.2f, %4.2f, %4.2f", x1, y1, z1); |
| 141 | //LOGE("%4.2f, %4.2f, %4.2f", x2, y2, z2); |
| 142 | //LOGE("%4.2f, %4.2f, %4.2f", x3, y3, z3); |
| 143 | //LOGE("%4.2f, %4.2f, %4.2f", x4, y4, z4); |
| 144 | |
| 145 | float vtx[] = {x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4}; |
| 146 | const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4}; |
| 147 | |
| 148 | VertexArray va; |
Jason Sams | 8cb39de | 2010-06-01 15:47:01 -0700 | [diff] [blame] | 149 | va.add(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "position"); |
| 150 | va.add(GL_FLOAT, 2, 8, false, (uint32_t)tex, "texture0"); |
| 151 | va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 152 | |
| 153 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); |
| 154 | } |
| 155 | |
| 156 | static void SC_drawQuad(float x1, float y1, float z1, |
| 157 | float x2, float y2, float z2, |
| 158 | float x3, float y3, float z3, |
| 159 | float x4, float y4, float z4) |
| 160 | { |
| 161 | SC_drawQuadTexCoords(x1, y1, z1, 0, 1, |
| 162 | x2, y2, z2, 1, 1, |
| 163 | x3, y3, z3, 1, 0, |
| 164 | x4, y4, z4, 0, 0); |
| 165 | } |
| 166 | |
| 167 | static void SC_drawSpriteScreenspace(float x, float y, float z, float w, float h) |
| 168 | { |
| 169 | GET_TLS(); |
| 170 | ObjectBaseRef<const ProgramVertex> tmp(rsc->getVertex()); |
| 171 | rsc->setVertex(rsc->getDefaultProgramVertex()); |
| 172 | //rsc->setupCheck(); |
| 173 | |
| 174 | //GLint crop[4] = {0, h, w, -h}; |
| 175 | |
| 176 | float sh = rsc->getHeight(); |
| 177 | |
| 178 | SC_drawQuad(x, sh - y, z, |
| 179 | x+w, sh - y, z, |
| 180 | x+w, sh - (y+h), z, |
| 181 | x, sh - (y+h), z); |
| 182 | rsc->setVertex((ProgramVertex *)tmp.get()); |
| 183 | } |
Jason Sams | 6d1cf41 | 2010-06-17 18:05:38 -0700 | [diff] [blame] | 184 | /* |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 185 | static void SC_drawSprite(float x, float y, float z, float w, float h) |
| 186 | { |
| 187 | GET_TLS(); |
| 188 | float vin[3] = {x, y, z}; |
| 189 | float vout[4]; |
| 190 | |
| 191 | //LOGE("ds in %f %f %f", x, y, z); |
| 192 | rsc->getVertex()->transformToScreen(rsc, vout, vin); |
| 193 | //LOGE("ds out %f %f %f %f", vout[0], vout[1], vout[2], vout[3]); |
| 194 | vout[0] /= vout[3]; |
| 195 | vout[1] /= vout[3]; |
| 196 | vout[2] /= vout[3]; |
| 197 | |
| 198 | vout[0] *= rsc->getWidth() / 2; |
| 199 | vout[1] *= rsc->getHeight() / 2; |
| 200 | vout[0] += rsc->getWidth() / 2; |
| 201 | vout[1] += rsc->getHeight() / 2; |
| 202 | |
| 203 | vout[0] -= w/2; |
| 204 | vout[1] -= h/2; |
| 205 | |
| 206 | //LOGE("ds out2 %f %f %f", vout[0], vout[1], vout[2]); |
| 207 | |
| 208 | // U, V, W, H |
| 209 | SC_drawSpriteScreenspace(vout[0], vout[1], z, h, w); |
| 210 | //rsc->setupCheck(); |
| 211 | } |
Jason Sams | 6d1cf41 | 2010-06-17 18:05:38 -0700 | [diff] [blame] | 212 | */ |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 213 | |
| 214 | static void SC_drawRect(float x1, float y1, |
| 215 | float x2, float y2, float z) |
| 216 | { |
| 217 | //LOGE("SC_drawRect %f,%f %f,%f %f", x1, y1, x2, y2, z); |
| 218 | SC_drawQuad(x1, y2, z, |
| 219 | x2, y2, z, |
| 220 | x2, y1, z, |
| 221 | x1, y1, z); |
| 222 | } |
| 223 | |
Alex Sakhartchouk | 164aaed | 2010-07-01 16:14:06 -0700 | [diff] [blame] | 224 | static void SC_drawMesh(RsMesh vsm) |
| 225 | { |
| 226 | GET_TLS(); |
| 227 | Mesh *sm = static_cast<Mesh *>(vsm); |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 228 | if (!rsc->setupCheck()) { |
| 229 | return; |
| 230 | } |
| 231 | sm->render(rsc); |
| 232 | } |
| 233 | |
Alex Sakhartchouk | 164aaed | 2010-07-01 16:14:06 -0700 | [diff] [blame] | 234 | static void SC_drawMeshPrimitive(RsMesh vsm, uint32_t primIndex) |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 235 | { |
| 236 | GET_TLS(); |
Alex Sakhartchouk | 164aaed | 2010-07-01 16:14:06 -0700 | [diff] [blame] | 237 | Mesh *sm = static_cast<Mesh *>(vsm); |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 238 | if (!rsc->setupCheck()) { |
| 239 | return; |
| 240 | } |
Alex Sakhartchouk | 164aaed | 2010-07-01 16:14:06 -0700 | [diff] [blame] | 241 | sm->renderPrimitive(rsc, primIndex); |
| 242 | } |
| 243 | |
| 244 | static void SC_drawMeshPrimitiveRange(RsMesh vsm, uint32_t primIndex, uint32_t start, uint32_t len) |
| 245 | { |
| 246 | GET_TLS(); |
| 247 | Mesh *sm = static_cast<Mesh *>(vsm); |
| 248 | if (!rsc->setupCheck()) { |
| 249 | return; |
| 250 | } |
| 251 | sm->renderPrimitiveRange(rsc, primIndex, start, len); |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 252 | } |
| 253 | |
Alex Sakhartchouk | a80145d | 2010-08-13 14:32:23 -0700 | [diff] [blame^] | 254 | static void SC_meshComputeBoundingBox(RsMesh vsm, float *minX, float *minY, float *minZ, |
| 255 | float *maxX, float *maxY, float *maxZ) |
| 256 | { |
| 257 | GET_TLS(); |
| 258 | Mesh *sm = static_cast<Mesh *>(vsm); |
| 259 | sm->computeBBox(); |
| 260 | *minX = sm->mBBoxMin[0]; |
| 261 | *minY = sm->mBBoxMin[1]; |
| 262 | *minZ = sm->mBBoxMin[2]; |
| 263 | *maxX = sm->mBBoxMax[0]; |
| 264 | *maxY = sm->mBBoxMax[1]; |
| 265 | *maxZ = sm->mBBoxMax[2]; |
| 266 | } |
| 267 | |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 268 | |
| 269 | ////////////////////////////////////////////////////////////////////////////// |
| 270 | // |
| 271 | ////////////////////////////////////////////////////////////////////////////// |
| 272 | |
| 273 | |
| 274 | static void SC_color(float r, float g, float b, float a) |
| 275 | { |
| 276 | GET_TLS(); |
Jason Sams | 442a647 | 2010-08-04 17:50:20 -0700 | [diff] [blame] | 277 | ProgramFragment *pf = (ProgramFragment *)rsc->getFragment(); |
| 278 | pf->setConstantColor(r, g, b, a); |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 279 | } |
| 280 | |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 281 | static void SC_uploadToTexture2(RsAllocation va, uint32_t baseMipLevel) |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 282 | { |
| 283 | GET_TLS(); |
| 284 | rsi_AllocationUploadToTexture(rsc, va, false, baseMipLevel); |
| 285 | } |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 286 | static void SC_uploadToTexture(RsAllocation va) |
| 287 | { |
| 288 | GET_TLS(); |
| 289 | rsi_AllocationUploadToTexture(rsc, va, false, 0); |
| 290 | } |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 291 | |
| 292 | static void SC_uploadToBufferObject(RsAllocation va) |
| 293 | { |
| 294 | GET_TLS(); |
| 295 | rsi_AllocationUploadToBufferObject(rsc, va); |
| 296 | } |
| 297 | |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 298 | static void SC_ClearColor(float r, float g, float b, float a) |
| 299 | { |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 300 | GET_TLS(); |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 301 | if (!rsc->setupCheck()) { |
| 302 | return; |
| 303 | } |
| 304 | |
| 305 | glClearColor(r, g, b, a); |
| 306 | glClear(GL_COLOR_BUFFER_BIT); |
| 307 | } |
| 308 | |
| 309 | static void SC_ClearDepth(float v) |
| 310 | { |
| 311 | GET_TLS(); |
| 312 | if (!rsc->setupCheck()) { |
| 313 | return; |
| 314 | } |
| 315 | |
| 316 | glClearDepthf(v); |
| 317 | glClear(GL_DEPTH_BUFFER_BIT); |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | static uint32_t SC_getWidth() |
| 321 | { |
| 322 | GET_TLS(); |
| 323 | return rsc->getWidth(); |
| 324 | } |
| 325 | |
| 326 | static uint32_t SC_getHeight() |
| 327 | { |
| 328 | GET_TLS(); |
| 329 | return rsc->getHeight(); |
| 330 | } |
| 331 | |
Alex Sakhartchouk | 9b949fc | 2010-06-24 17:15:34 -0700 | [diff] [blame] | 332 | static void SC_DrawTextAlloc(RsAllocation va, int x, int y) |
| 333 | { |
| 334 | GET_TLS(); |
| 335 | Allocation *alloc = static_cast<Allocation *>(va); |
| 336 | rsc->mStateFont.renderText(alloc, x, y); |
| 337 | } |
| 338 | |
| 339 | static void SC_DrawText(const char *text, int x, int y) |
| 340 | { |
| 341 | GET_TLS(); |
| 342 | rsc->mStateFont.renderText(text, x, y); |
| 343 | } |
| 344 | |
| 345 | static void SC_BindFont(RsFont font) |
| 346 | { |
| 347 | GET_TLS(); |
| 348 | rsi_ContextBindFont(rsc, font); |
| 349 | } |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 350 | |
Alex Sakhartchouk | fb10c16 | 2010-08-04 14:45:48 -0700 | [diff] [blame] | 351 | static void SC_FontColor(float r, float g, float b, float a) |
| 352 | { |
| 353 | GET_TLS(); |
| 354 | rsc->mStateFont.setFontColor(r, g, b, a); |
| 355 | } |
| 356 | |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 357 | ////////////////////////////////////////////////////////////////////////////// |
| 358 | // Class implementation |
| 359 | ////////////////////////////////////////////////////////////////////////////// |
| 360 | |
| 361 | // llvm name mangling ref |
| 362 | // <builtin-type> ::= v # void |
| 363 | // ::= b # bool |
| 364 | // ::= c # char |
| 365 | // ::= a # signed char |
| 366 | // ::= h # unsigned char |
| 367 | // ::= s # short |
| 368 | // ::= t # unsigned short |
| 369 | // ::= i # int |
| 370 | // ::= j # unsigned int |
| 371 | // ::= l # long |
| 372 | // ::= m # unsigned long |
| 373 | // ::= x # long long, __int64 |
| 374 | // ::= y # unsigned long long, __int64 |
| 375 | // ::= f # float |
| 376 | // ::= d # double |
| 377 | |
| 378 | static ScriptCState::SymbolTable_t gSyms[] = { |
Jason Sams | f0690c4 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 379 | { "_Z22rsgBindProgramFragment19rs_program_fragment", (void *)&SC_bindProgramFragment }, |
| 380 | { "_Z19rsgBindProgramStore16rs_program_store", (void *)&SC_bindProgramStore }, |
| 381 | { "_Z20rsgBindProgramVertex17rs_program_vertex", (void *)&SC_bindProgramVertex }, |
| 382 | { "_Z20rsgBindProgramRaster17rs_program_raster", (void *)&SC_bindProgramRaster }, |
| 383 | { "_Z14rsgBindSampler19rs_program_fragmentj10rs_sampler", (void *)&SC_bindSampler }, |
| 384 | { "_Z14rsgBindTexture19rs_program_fragmentj13rs_allocation", (void *)&SC_bindTexture }, |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 385 | |
Jason Sams | f0690c4 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 386 | { "_Z36rsgProgramVertexLoadProjectionMatrixPK12rs_matrix4x4", (void *)&SC_vpLoadProjectionMatrix }, |
| 387 | { "_Z31rsgProgramVertexLoadModelMatrixPK12rs_matrix4x4", (void *)&SC_vpLoadModelMatrix }, |
| 388 | { "_Z33rsgProgramVertexLoadTextureMatrixPK12rs_matrix4x4", (void *)&SC_vpLoadTextureMatrix }, |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 389 | |
Jason Sams | 442a647 | 2010-08-04 17:50:20 -0700 | [diff] [blame] | 390 | { "_Z31rsgProgramFragmentConstantColor19rs_program_fragmentffff", (void *)&SC_pfConstantColor }, |
| 391 | |
Jason Sams | f0690c4 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 392 | { "_Z11rsgGetWidthv", (void *)&SC_getWidth }, |
| 393 | { "_Z12rsgGetHeightv", (void *)&SC_getHeight }, |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 394 | |
Jason Sams | f0690c4 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 395 | { "_Z18rsgUploadToTexture13rs_allocationj", (void *)&SC_uploadToTexture2 }, |
Jason Sams | 96ed4cf | 2010-06-15 12:15:57 -0700 | [diff] [blame] | 396 | { "_Z18rsgUploadToTexture13rs_allocation", (void *)&SC_uploadToTexture }, |
Jason Sams | f0690c4 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 397 | { "_Z23rsgUploadToBufferObject13rs_allocation", (void *)&SC_uploadToBufferObject }, |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 398 | |
Jason Sams | f0690c4 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 399 | { "_Z11rsgDrawRectfffff", (void *)&SC_drawRect }, |
| 400 | { "_Z11rsgDrawQuadffffffffffff", (void *)&SC_drawQuad }, |
| 401 | { "_Z20rsgDrawQuadTexCoordsffffffffffffffffffff", (void *)&SC_drawQuadTexCoords }, |
| 402 | { "_Z24rsgDrawSpriteScreenspacefffff", (void *)&SC_drawSpriteScreenspace }, |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 403 | |
Alex Sakhartchouk | 164aaed | 2010-07-01 16:14:06 -0700 | [diff] [blame] | 404 | { "_Z11rsgDrawMesh7rs_mesh", (void *)&SC_drawMesh }, |
Jason Sams | f0690c4 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 405 | { "_Z11rsgDrawMesh7rs_meshj", (void *)&SC_drawMeshPrimitive }, |
| 406 | { "_Z11rsgDrawMesh7rs_meshjjj", (void *)&SC_drawMeshPrimitiveRange }, |
Alex Sakhartchouk | a80145d | 2010-08-13 14:32:23 -0700 | [diff] [blame^] | 407 | { "_Z25rsgMeshComputeBoundingBox7rs_meshPfS0_S0_S0_S0_S0_", (void *)&SC_meshComputeBoundingBox }, |
Alex Sakhartchouk | 164aaed | 2010-07-01 16:14:06 -0700 | [diff] [blame] | 408 | |
Jason Sams | f0690c4 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 409 | { "_Z13rsgClearColorffff", (void *)&SC_ClearColor }, |
| 410 | { "_Z13rsgClearDepthf", (void *)&SC_ClearDepth }, |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 411 | |
Alex Sakhartchouk | 9b949fc | 2010-06-24 17:15:34 -0700 | [diff] [blame] | 412 | { "_Z11rsgDrawTextPKcii", (void *)&SC_DrawText }, |
| 413 | { "_Z11rsgDrawText13rs_allocationii", (void *)&SC_DrawTextAlloc }, |
| 414 | |
Jason Sams | f0690c4 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 415 | { "_Z11rsgBindFont7rs_font", (void *)&SC_BindFont }, |
Alex Sakhartchouk | fb10c16 | 2010-08-04 14:45:48 -0700 | [diff] [blame] | 416 | { "_Z12rsgFontColorffff", (void *)&SC_FontColor }, |
Alex Sakhartchouk | 9b949fc | 2010-06-24 17:15:34 -0700 | [diff] [blame] | 417 | |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 418 | // misc |
Jason Sams | f0690c4 | 2010-07-29 17:31:14 -0700 | [diff] [blame] | 419 | { "_Z5colorffff", (void *)&SC_color }, |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 420 | |
Jason Sams | 536923d | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 421 | { NULL, NULL } |
| 422 | }; |
| 423 | |
| 424 | const ScriptCState::SymbolTable_t * ScriptCState::lookupSymbolGL(const char *sym) |
| 425 | { |
| 426 | ScriptCState::SymbolTable_t *syms = gSyms; |
| 427 | |
| 428 | while (syms->mPtr) { |
| 429 | if (!strcmp(syms->mName, sym)) { |
| 430 | return syms; |
| 431 | } |
| 432 | syms++; |
| 433 | } |
| 434 | return NULL; |
| 435 | } |
| 436 | |