Jason Sams | 326e0dd | 2009-05-22 14:03:28 -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" |
Anatol Pomazau | e7b4b86 | 2010-09-07 17:33:01 -0700 | [diff] [blame] | 20 | #include "../../compile/libbcc/include/bcc/bcc.h" |
Joe Onorato | 9c4e4ca | 2009-08-09 11:39:02 -0700 | [diff] [blame] | 21 | #include "utils/Timers.h" |
Alex Sakhartchouk | b26fb04 | 2010-09-24 15:18:12 -0700 | [diff] [blame] | 22 | #include "utils/StopWatch.h" |
Jack Palevich | 1ef8b80 | 2009-05-28 15:53:04 -0700 | [diff] [blame] | 23 | |
Jason Sams | 1aa5a4e | 2009-06-22 17:15:15 -0700 | [diff] [blame] | 24 | #include <GLES/gl.h> |
| 25 | #include <GLES/glext.h> |
| 26 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 27 | using namespace android; |
| 28 | using namespace android::renderscript; |
| 29 | |
Jason Sams | e576910 | 2009-06-19 16:03:18 -0700 | [diff] [blame] | 30 | #define GET_TLS() Context::ScriptTLSStruct * tls = \ |
| 31 | (Context::ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey); \ |
| 32 | Context * rsc = tls->mContext; \ |
| 33 | ScriptC * sc = (ScriptC *) tls->mScript |
| 34 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 35 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 36 | ScriptC::ScriptC(Context *rsc) : Script(rsc) { |
Jason Sams | be36bf3 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 37 | mBccScript = NULL; |
Jason Sams | efb8de1 | 2009-06-08 15:20:31 -0700 | [diff] [blame] | 38 | memset(&mProgram, 0, sizeof(mProgram)); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 39 | } |
| 40 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 41 | ScriptC::~ScriptC() { |
Jason Sams | be36bf3 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 42 | if (mBccScript) { |
| 43 | bccDeleteScript(mBccScript); |
Jack Palevich | 1ef8b80 | 2009-05-28 15:53:04 -0700 | [diff] [blame] | 44 | } |
Jason Sams | e402ed3 | 2009-11-03 11:25:42 -0800 | [diff] [blame] | 45 | free(mEnviroment.mScriptText); |
| 46 | mEnviroment.mScriptText = NULL; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 47 | } |
| 48 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 49 | void ScriptC::setupScript(Context *rsc) { |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 50 | setupGLState(rsc); |
| 51 | mEnviroment.mStartTimeMillis |
| 52 | = nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC)); |
| 53 | |
Jason Sams | be36bf3 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 54 | for (uint32_t ct=0; ct < mEnviroment.mFieldCount; ct++) { |
Jason Sams | 900f161 | 2010-09-16 18:18:29 -0700 | [diff] [blame] | 55 | if (mSlots[ct].get() && !mTypes[ct].get()) { |
| 56 | mTypes[ct].set(mSlots[ct]->getType()); |
| 57 | } |
| 58 | |
| 59 | if (!mTypes[ct].get()) |
Jason Sams | be36bf3 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 60 | continue; |
Jason Sams | 900f161 | 2010-09-16 18:18:29 -0700 | [diff] [blame] | 61 | void *ptr = NULL; |
| 62 | if (mSlots[ct].get()) { |
| 63 | ptr = mSlots[ct]->getPtr(); |
| 64 | } |
Jason Sams | be36bf3 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 65 | void **dest = ((void ***)mEnviroment.mFieldAddress)[ct]; |
Jason Sams | be36bf3 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 66 | |
Jason Sams | b9077f4 | 2010-09-22 15:57:41 -0700 | [diff] [blame] | 67 | if (rsc->props.mLogScripts) { |
Jason Sams | 2fad7e4 | 2010-11-16 12:19:26 -0800 | [diff] [blame] | 68 | if (mSlots[ct].get() != NULL) { |
| 69 | LOGV("%p ScriptC::setupScript slot=%i dst=%p src=%p type=%p", rsc, ct, dest, ptr, mSlots[ct]->getType()); |
| 70 | } else { |
| 71 | LOGV("%p ScriptC::setupScript slot=%i dst=%p src=%p type=null", rsc, ct, dest, ptr); |
| 72 | } |
Jason Sams | b9077f4 | 2010-09-22 15:57:41 -0700 | [diff] [blame] | 73 | } |
Jason Sams | be36bf3 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 74 | |
| 75 | if (dest) { |
| 76 | *dest = ptr; |
Jason Sams | ada7f27 | 2009-09-24 14:55:38 -0700 | [diff] [blame] | 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 81 | const Allocation *ScriptC::ptrToAllocation(const void *ptr) const { |
Jason Sams | ce92d4b | 2010-05-17 14:55:34 -0700 | [diff] [blame] | 82 | if (!ptr) { |
| 83 | return NULL; |
| 84 | } |
| 85 | for (uint32_t ct=0; ct < mEnviroment.mFieldCount; ct++) { |
| 86 | if (!mSlots[ct].get()) |
| 87 | continue; |
| 88 | if (mSlots[ct]->getPtr() == ptr) { |
| 89 | return mSlots[ct].get(); |
| 90 | } |
| 91 | } |
| 92 | LOGE("ScriptC::ptrToAllocation, failed to find %p", ptr); |
| 93 | return NULL; |
| 94 | } |
| 95 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 96 | Script * ScriptC::setTLS(Script *sc) { |
Jason Sams | 22fa371 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 97 | Context::ScriptTLSStruct * tls = (Context::ScriptTLSStruct *) |
| 98 | pthread_getspecific(Context::gThreadTLSKey); |
| 99 | rsAssert(tls); |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 100 | Script *old = tls->mScript; |
| 101 | tls->mScript = sc; |
| 102 | return old; |
Jason Sams | 22fa371 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 103 | } |
| 104 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 105 | void ScriptC::setupGLState(Context *rsc) { |
Jason Sams | a0a1b6f | 2009-06-10 15:04:38 -0700 | [diff] [blame] | 106 | if (mEnviroment.mFragmentStore.get()) { |
Jason Sams | 6070925 | 2010-11-17 15:29:32 -0800 | [diff] [blame] | 107 | rsc->setProgramStore(mEnviroment.mFragmentStore.get()); |
Jason Sams | a0a1b6f | 2009-06-10 15:04:38 -0700 | [diff] [blame] | 108 | } |
| 109 | if (mEnviroment.mFragment.get()) { |
Jason Sams | 6070925 | 2010-11-17 15:29:32 -0800 | [diff] [blame] | 110 | rsc->setProgramFragment(mEnviroment.mFragment.get()); |
Jason Sams | a0a1b6f | 2009-06-10 15:04:38 -0700 | [diff] [blame] | 111 | } |
Jason Sams | 8ce125b | 2009-06-17 16:52:59 -0700 | [diff] [blame] | 112 | if (mEnviroment.mVertex.get()) { |
Jason Sams | 6070925 | 2010-11-17 15:29:32 -0800 | [diff] [blame] | 113 | rsc->setProgramVertex(mEnviroment.mVertex.get()); |
Jason Sams | 8ce125b | 2009-06-17 16:52:59 -0700 | [diff] [blame] | 114 | } |
Jason Sams | b681c8a | 2009-09-28 18:12:56 -0700 | [diff] [blame] | 115 | if (mEnviroment.mRaster.get()) { |
Jason Sams | 6070925 | 2010-11-17 15:29:32 -0800 | [diff] [blame] | 116 | rsc->setProgramRaster(mEnviroment.mRaster.get()); |
Jason Sams | b681c8a | 2009-09-28 18:12:56 -0700 | [diff] [blame] | 117 | } |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 118 | } |
Jason Sams | a0a1b6f | 2009-06-10 15:04:38 -0700 | [diff] [blame] | 119 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 120 | uint32_t ScriptC::run(Context *rsc) { |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 121 | if (mProgram.mRoot == NULL) { |
| 122 | rsc->setError(RS_ERROR_BAD_SCRIPT, "Attempted to run bad script"); |
| 123 | return 0; |
Joe Onorato | 9c4e4ca | 2009-08-09 11:39:02 -0700 | [diff] [blame] | 124 | } |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 125 | |
| 126 | setupScript(rsc); |
Jason Sams | 1d54f10 | 2009-09-03 15:43:13 -0700 | [diff] [blame] | 127 | |
Jason Sams | 2dca84d | 2009-12-09 11:05:45 -0800 | [diff] [blame] | 128 | uint32_t ret = 0; |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 129 | Script * oldTLS = setTLS(this); |
Jason Sams | b9077f4 | 2010-09-22 15:57:41 -0700 | [diff] [blame] | 130 | |
| 131 | if (rsc->props.mLogScripts) { |
| 132 | LOGV("%p ScriptC::run invoking root, ptr %p", rsc, mProgram.mRoot); |
| 133 | } |
| 134 | |
Jason Sams | be36bf3 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 135 | ret = mProgram.mRoot(); |
Jason Sams | b9077f4 | 2010-09-22 15:57:41 -0700 | [diff] [blame] | 136 | |
| 137 | if (rsc->props.mLogScripts) { |
| 138 | LOGV("%p ScriptC::run invoking complete, ret=%i", rsc, ret); |
| 139 | } |
| 140 | |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 141 | setTLS(oldTLS); |
Jason Sams | e45ac6e | 2009-07-20 14:31:06 -0700 | [diff] [blame] | 142 | return ret; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 143 | } |
| 144 | |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 145 | typedef struct { |
| 146 | Context *rsc; |
| 147 | ScriptC *script; |
| 148 | const Allocation * ain; |
| 149 | Allocation * aout; |
| 150 | const void * usr; |
| 151 | |
| 152 | uint32_t mSliceSize; |
| 153 | volatile int mSliceNum; |
| 154 | |
| 155 | const uint8_t *ptrIn; |
| 156 | uint32_t eStrideIn; |
| 157 | uint8_t *ptrOut; |
| 158 | uint32_t eStrideOut; |
| 159 | |
| 160 | uint32_t xStart; |
| 161 | uint32_t xEnd; |
| 162 | uint32_t yStart; |
| 163 | uint32_t yEnd; |
| 164 | uint32_t zStart; |
| 165 | uint32_t zEnd; |
| 166 | uint32_t arrayStart; |
| 167 | uint32_t arrayEnd; |
| 168 | |
| 169 | uint32_t dimX; |
| 170 | uint32_t dimY; |
| 171 | uint32_t dimZ; |
| 172 | uint32_t dimArray; |
| 173 | } MTLaunchStruct; |
| 174 | typedef int (*rs_t)(const void *, void *, const void *, uint32_t, uint32_t, uint32_t, uint32_t); |
| 175 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 176 | static void wc_xy(void *usr, uint32_t idx) { |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 177 | MTLaunchStruct *mtls = (MTLaunchStruct *)usr; |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 178 | |
| 179 | while (1) { |
| 180 | uint32_t slice = (uint32_t)android_atomic_inc(&mtls->mSliceNum); |
| 181 | uint32_t yStart = mtls->yStart + slice * mtls->mSliceSize; |
| 182 | uint32_t yEnd = yStart + mtls->mSliceSize; |
| 183 | yEnd = rsMin(yEnd, mtls->yEnd); |
| 184 | if (yEnd <= yStart) { |
| 185 | return; |
| 186 | } |
| 187 | |
| 188 | //LOGE("usr idx %i, x %i,%i y %i,%i", idx, mtls->xStart, mtls->xEnd, yStart, yEnd); |
Jason Sams | 8d957fa | 2010-09-28 14:41:22 -0700 | [diff] [blame] | 189 | //LOGE("usr ptr in %p, out %p", mtls->ptrIn, mtls->ptrOut); |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 190 | for (uint32_t y = yStart; y < yEnd; y++) { |
| 191 | uint32_t offset = mtls->dimX * y; |
| 192 | uint8_t *xPtrOut = mtls->ptrOut + (mtls->eStrideOut * offset); |
| 193 | const uint8_t *xPtrIn = mtls->ptrIn + (mtls->eStrideIn * offset); |
| 194 | |
| 195 | for (uint32_t x = mtls->xStart; x < mtls->xEnd; x++) { |
| 196 | ((rs_t)mtls->script->mProgram.mRoot) (xPtrIn, xPtrOut, mtls->usr, x, y, 0, 0); |
| 197 | xPtrIn += mtls->eStrideIn; |
| 198 | xPtrOut += mtls->eStrideOut; |
| 199 | } |
| 200 | } |
| 201 | } |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 202 | } |
| 203 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 204 | static void wc_x(void *usr, uint32_t idx) { |
Jason Sams | 177f844 | 2010-10-29 10:19:21 -0700 | [diff] [blame] | 205 | MTLaunchStruct *mtls = (MTLaunchStruct *)usr; |
| 206 | |
| 207 | while (1) { |
| 208 | uint32_t slice = (uint32_t)android_atomic_inc(&mtls->mSliceNum); |
| 209 | uint32_t xStart = mtls->xStart + slice * mtls->mSliceSize; |
| 210 | uint32_t xEnd = xStart + mtls->mSliceSize; |
| 211 | xEnd = rsMin(xEnd, mtls->xEnd); |
| 212 | if (xEnd <= xStart) { |
| 213 | return; |
| 214 | } |
| 215 | |
| 216 | //LOGE("usr idx %i, x %i,%i y %i,%i", idx, mtls->xStart, mtls->xEnd, yStart, yEnd); |
| 217 | //LOGE("usr ptr in %p, out %p", mtls->ptrIn, mtls->ptrOut); |
| 218 | uint8_t *xPtrOut = mtls->ptrOut + (mtls->eStrideOut * xStart); |
| 219 | const uint8_t *xPtrIn = mtls->ptrIn + (mtls->eStrideIn * xStart); |
| 220 | for (uint32_t x = xStart; x < xEnd; x++) { |
| 221 | ((rs_t)mtls->script->mProgram.mRoot) (xPtrIn, xPtrOut, mtls->usr, x, 0, 0, 0); |
| 222 | xPtrIn += mtls->eStrideIn; |
| 223 | xPtrOut += mtls->eStrideOut; |
| 224 | } |
| 225 | } |
Jason Sams | 177f844 | 2010-10-29 10:19:21 -0700 | [diff] [blame] | 226 | } |
| 227 | |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 228 | void ScriptC::runForEach(Context *rsc, |
| 229 | const Allocation * ain, |
| 230 | Allocation * aout, |
| 231 | const void * usr, |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 232 | const RsScriptCall *sc) { |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 233 | MTLaunchStruct mtls; |
| 234 | memset(&mtls, 0, sizeof(mtls)); |
Jason Sams | 6070925 | 2010-11-17 15:29:32 -0800 | [diff] [blame] | 235 | Context::PushState ps(rsc); |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 236 | |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 237 | if (ain) { |
| 238 | mtls.dimX = ain->getType()->getDimX(); |
| 239 | mtls.dimY = ain->getType()->getDimY(); |
| 240 | mtls.dimZ = ain->getType()->getDimZ(); |
| 241 | //mtls.dimArray = ain->getType()->getDimArray(); |
| 242 | } else if (aout) { |
| 243 | mtls.dimX = aout->getType()->getDimX(); |
| 244 | mtls.dimY = aout->getType()->getDimY(); |
| 245 | mtls.dimZ = aout->getType()->getDimZ(); |
| 246 | //mtls.dimArray = aout->getType()->getDimArray(); |
| 247 | } else { |
| 248 | rsc->setError(RS_ERROR_BAD_SCRIPT, "rsForEach called with null allocations"); |
| 249 | return; |
| 250 | } |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 251 | |
| 252 | if (!sc || (sc->xEnd == 0)) { |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 253 | mtls.xEnd = mtls.dimX; |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 254 | } else { |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 255 | rsAssert(sc->xStart < mtls.dimX); |
| 256 | rsAssert(sc->xEnd <= mtls.dimX); |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 257 | rsAssert(sc->xStart < sc->xEnd); |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 258 | mtls.xStart = rsMin(mtls.dimX, sc->xStart); |
| 259 | mtls.xEnd = rsMin(mtls.dimX, sc->xEnd); |
| 260 | if (mtls.xStart >= mtls.xEnd) return; |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | if (!sc || (sc->yEnd == 0)) { |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 264 | mtls.yEnd = mtls.dimY; |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 265 | } else { |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 266 | rsAssert(sc->yStart < mtls.dimY); |
| 267 | rsAssert(sc->yEnd <= mtls.dimY); |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 268 | rsAssert(sc->yStart < sc->yEnd); |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 269 | mtls.yStart = rsMin(mtls.dimY, sc->yStart); |
| 270 | mtls.yEnd = rsMin(mtls.dimY, sc->yEnd); |
| 271 | if (mtls.yStart >= mtls.yEnd) return; |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 272 | } |
| 273 | |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 274 | mtls.xEnd = rsMax((uint32_t)1, mtls.xEnd); |
| 275 | mtls.yEnd = rsMax((uint32_t)1, mtls.yEnd); |
| 276 | mtls.zEnd = rsMax((uint32_t)1, mtls.zEnd); |
| 277 | mtls.arrayEnd = rsMax((uint32_t)1, mtls.arrayEnd); |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 278 | |
| 279 | rsAssert(ain->getType()->getDimZ() == 0); |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 280 | |
| 281 | setupScript(rsc); |
| 282 | Script * oldTLS = setTLS(this); |
| 283 | |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 284 | mtls.rsc = rsc; |
| 285 | mtls.ain = ain; |
| 286 | mtls.aout = aout; |
| 287 | mtls.script = this; |
| 288 | mtls.usr = usr; |
| 289 | mtls.mSliceSize = 10; |
| 290 | mtls.mSliceNum = 0; |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 291 | |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 292 | mtls.ptrIn = NULL; |
| 293 | mtls.eStrideIn = 0; |
| 294 | if (ain) { |
| 295 | mtls.ptrIn = (const uint8_t *)ain->getPtr(); |
| 296 | mtls.eStrideIn = ain->getType()->getElementSizeBytes(); |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 297 | } |
| 298 | |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 299 | mtls.ptrOut = NULL; |
| 300 | mtls.eStrideOut = 0; |
| 301 | if (aout) { |
| 302 | mtls.ptrOut = (uint8_t *)aout->getPtr(); |
| 303 | mtls.eStrideOut = aout->getType()->getElementSizeBytes(); |
| 304 | } |
| 305 | |
Jason Sams | 177f844 | 2010-10-29 10:19:21 -0700 | [diff] [blame] | 306 | if ((rsc->getWorkerPoolSize() > 1) && mEnviroment.mIsThreadable) { |
| 307 | if (mtls.dimY > 1) { |
| 308 | rsc->launchThreads(wc_xy, &mtls); |
| 309 | } else { |
| 310 | rsc->launchThreads(wc_x, &mtls); |
| 311 | } |
Jason Sams | 1813340 | 2010-07-20 15:09:00 -0700 | [diff] [blame] | 312 | |
| 313 | //LOGE("launch 1"); |
Jason Sams | 1813340 | 2010-07-20 15:09:00 -0700 | [diff] [blame] | 314 | } else { |
Jason Sams | 8d957fa | 2010-09-28 14:41:22 -0700 | [diff] [blame] | 315 | //LOGE("launch 3"); |
Jason Sams | 1813340 | 2010-07-20 15:09:00 -0700 | [diff] [blame] | 316 | for (uint32_t ar = mtls.arrayStart; ar < mtls.arrayEnd; ar++) { |
| 317 | for (uint32_t z = mtls.zStart; z < mtls.zEnd; z++) { |
| 318 | for (uint32_t y = mtls.yStart; y < mtls.yEnd; y++) { |
| 319 | uint32_t offset = mtls.dimX * mtls.dimY * mtls.dimZ * ar + |
| 320 | mtls.dimX * mtls.dimY * z + |
| 321 | mtls.dimX * y; |
| 322 | uint8_t *xPtrOut = mtls.ptrOut + (mtls.eStrideOut * offset); |
| 323 | const uint8_t *xPtrIn = mtls.ptrIn + (mtls.eStrideIn * offset); |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 324 | |
Jason Sams | 1813340 | 2010-07-20 15:09:00 -0700 | [diff] [blame] | 325 | for (uint32_t x = mtls.xStart; x < mtls.xEnd; x++) { |
| 326 | ((rs_t)mProgram.mRoot) (xPtrIn, xPtrOut, usr, x, y, z, ar); |
| 327 | xPtrIn += mtls.eStrideIn; |
| 328 | xPtrOut += mtls.eStrideOut; |
| 329 | } |
Jason Sams | ace3e01 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 330 | } |
| 331 | } |
| 332 | } |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 333 | } |
Jason Sams | 1813340 | 2010-07-20 15:09:00 -0700 | [diff] [blame] | 334 | |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 335 | setTLS(oldTLS); |
| 336 | } |
| 337 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 338 | void ScriptC::Invoke(Context *rsc, uint32_t slot, const void *data, uint32_t len) { |
Jason Sams | 22fa371 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 339 | //LOGE("rsi_ScriptInvoke %i", slot); |
| 340 | if ((slot >= mEnviroment.mInvokeFunctionCount) || |
| 341 | (mEnviroment.mInvokeFunctions[slot] == NULL)) { |
| 342 | rsc->setError(RS_ERROR_BAD_SCRIPT, "Calling invoke on bad script"); |
| 343 | return; |
| 344 | } |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 345 | setupScript(rsc); |
| 346 | Script * oldTLS = setTLS(this); |
Jason Sams | 22fa371 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 347 | |
Jason Sams | b9077f4 | 2010-09-22 15:57:41 -0700 | [diff] [blame] | 348 | if (rsc->props.mLogScripts) { |
| 349 | LOGV("%p ScriptC::Invoke invoking slot %i, ptr %p", rsc, slot, mEnviroment.mInvokeFunctions[slot]); |
| 350 | } |
Jason Sams | 2a63bf6 | 2010-06-08 15:40:48 -0700 | [diff] [blame] | 351 | ((void (*)(const void *, uint32_t)) |
| 352 | mEnviroment.mInvokeFunctions[slot])(data, len); |
Jason Sams | b9077f4 | 2010-09-22 15:57:41 -0700 | [diff] [blame] | 353 | if (rsc->props.mLogScripts) { |
| 354 | LOGV("%p ScriptC::Invoke complete", rsc); |
| 355 | } |
Jason Sams | 2a63bf6 | 2010-06-08 15:40:48 -0700 | [diff] [blame] | 356 | |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 357 | setTLS(oldTLS); |
Jason Sams | 22fa371 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 358 | } |
| 359 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 360 | ScriptCState::ScriptCState() { |
Stephen Hines | 01b7d29 | 2010-09-28 15:45:45 -0700 | [diff] [blame] | 361 | mScript.clear(); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 362 | } |
| 363 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 364 | ScriptCState::~ScriptCState() { |
Stephen Hines | 01b7d29 | 2010-09-28 15:45:45 -0700 | [diff] [blame] | 365 | mScript.clear(); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 366 | } |
| 367 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 368 | void ScriptCState::init(Context *rsc) { |
Stephen Hines | 01b7d29 | 2010-09-28 15:45:45 -0700 | [diff] [blame] | 369 | clear(rsc); |
| 370 | } |
| 371 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 372 | void ScriptCState::clear(Context *rsc) { |
Stephen Hines | 01b7d29 | 2010-09-28 15:45:45 -0700 | [diff] [blame] | 373 | rsAssert(rsc); |
Stephen Hines | 01b7d29 | 2010-09-28 15:45:45 -0700 | [diff] [blame] | 374 | mScript.clear(); |
| 375 | mScript.set(new ScriptC(rsc)); |
Jason Sams | 1f52633 | 2009-06-05 17:35:09 -0700 | [diff] [blame] | 376 | } |
| 377 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 378 | static BCCvoid* symbolLookup(BCCvoid* pContext, const BCCchar* name) { |
Jason Sams | aeb094b | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 379 | const ScriptCState::SymbolTable_t *sym; |
Jason Sams | dd663fa | 2010-08-11 13:26:28 -0700 | [diff] [blame] | 380 | ScriptC *s = (ScriptC *)pContext; |
Shih-wei Liao | f17b13b | 2010-12-07 13:44:10 -0800 | [diff] [blame] | 381 | if (!strcmp(name, "__isThreadable")) { |
| 382 | return (BCCvoid*) s->mEnviroment.mIsThreadable; |
| 383 | } else if (!strcmp(name, "__clearThreadable")) { |
| 384 | s->mEnviroment.mIsThreadable = false; |
| 385 | return NULL; |
| 386 | } |
Jason Sams | aeb094b | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 387 | sym = ScriptCState::lookupSymbol(name); |
Jason Sams | 6bfc1b9 | 2010-11-01 14:26:30 -0700 | [diff] [blame] | 388 | if (!sym) { |
| 389 | sym = ScriptCState::lookupSymbolCL(name); |
Jason Sams | aeb094b | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 390 | } |
Jason Sams | 6bfc1b9 | 2010-11-01 14:26:30 -0700 | [diff] [blame] | 391 | if (!sym) { |
| 392 | sym = ScriptCState::lookupSymbolGL(name); |
Jason Sams | aeb094b | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 393 | } |
Jason Sams | 29df66f | 2009-07-16 15:08:06 -0700 | [diff] [blame] | 394 | if (sym) { |
Jason Sams | 6bfc1b9 | 2010-11-01 14:26:30 -0700 | [diff] [blame] | 395 | s->mEnviroment.mIsThreadable &= sym->threadable; |
Jason Sams | 29df66f | 2009-07-16 15:08:06 -0700 | [diff] [blame] | 396 | return sym->mPtr; |
| 397 | } |
Jason Sams | 29df66f | 2009-07-16 15:08:06 -0700 | [diff] [blame] | 398 | LOGE("ScriptC sym lookup failed for %s", name); |
Jason Sams | 29df66f | 2009-07-16 15:08:06 -0700 | [diff] [blame] | 399 | return NULL; |
| 400 | } |
Jason Sams | a4a54e4 | 2009-06-10 18:39:40 -0700 | [diff] [blame] | 401 | |
Shih-wei Liao | 1f9ba73 | 2010-10-23 02:15:57 -0700 | [diff] [blame] | 402 | extern const char rs_runtime_lib_bc[]; |
| 403 | extern unsigned rs_runtime_lib_bc_size; |
| 404 | |
Shih-wei Liao | 9503b66 | 2010-11-08 01:33:59 -0800 | [diff] [blame] | 405 | void ScriptCState::runCompiler(Context *rsc, ScriptC *s, const char *resName) { |
Alex Sakhartchouk | b26fb04 | 2010-09-24 15:18:12 -0700 | [diff] [blame] | 406 | { |
Alex Sakhartchouk | b26fb04 | 2010-09-24 15:18:12 -0700 | [diff] [blame] | 407 | s->mBccScript = bccCreateScript(); |
| 408 | s->mEnviroment.mIsThreadable = true; |
Alex Sakhartchouk | b26fb04 | 2010-09-24 15:18:12 -0700 | [diff] [blame] | 409 | bccRegisterSymbolCallback(s->mBccScript, symbolLookup, s); |
Shih-wei Liao | 9503b66 | 2010-11-08 01:33:59 -0800 | [diff] [blame] | 410 | // bccReadBC() reads in the BitCode, if no cache file corresponding to |
| 411 | // the resName is found. Otherwise, bccReadBC() returns a negative value |
| 412 | // and the "else" branch will be taken. |
| 413 | if (bccReadBC(s->mBccScript, |
| 414 | s->mEnviroment.mScriptText, |
| 415 | s->mEnviroment.mScriptTextLength, |
| 416 | resName) >= 0) { |
| 417 | //bccLinkBC(s->mBccScript, rs_runtime_lib_bc, rs_runtime_lib_bc_size); |
| 418 | bccCompileBC(s->mBccScript); |
| 419 | } else { |
| 420 | // bccReadBC returns a neagative value: Didn't read any script, |
| 421 | // So, use cached binary instead |
| 422 | bccLoadBinary(s->mBccScript); |
| 423 | } |
Alex Sakhartchouk | b26fb04 | 2010-09-24 15:18:12 -0700 | [diff] [blame] | 424 | bccGetScriptLabel(s->mBccScript, "root", (BCCvoid**) &s->mProgram.mRoot); |
| 425 | bccGetScriptLabel(s->mBccScript, "init", (BCCvoid**) &s->mProgram.mInit); |
| 426 | } |
Jason Sams | b9077f4 | 2010-09-22 15:57:41 -0700 | [diff] [blame] | 427 | LOGV("%p ScriptCState::runCompiler root %p, init %p", rsc, s->mProgram.mRoot, s->mProgram.mInit); |
Jason Sams | f168504 | 2009-07-16 17:47:40 -0700 | [diff] [blame] | 428 | |
Jason Sams | 8c6bc69 | 2009-09-16 15:04:38 -0700 | [diff] [blame] | 429 | if (s->mProgram.mInit) { |
| 430 | s->mProgram.mInit(); |
Jason Sams | 1d54f10 | 2009-09-03 15:43:13 -0700 | [diff] [blame] | 431 | } |
| 432 | |
Jason Sams | 8c88090 | 2010-06-15 12:15:57 -0700 | [diff] [blame] | 433 | bccGetExportFuncs(s->mBccScript, (BCCsizei*) &s->mEnviroment.mInvokeFunctionCount, 0, NULL); |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 434 | if (s->mEnviroment.mInvokeFunctionCount <= 0) |
Jason Sams | 8c88090 | 2010-06-15 12:15:57 -0700 | [diff] [blame] | 435 | s->mEnviroment.mInvokeFunctions = NULL; |
| 436 | else { |
| 437 | s->mEnviroment.mInvokeFunctions = (Script::InvokeFunc_t*) calloc(s->mEnviroment.mInvokeFunctionCount, sizeof(Script::InvokeFunc_t)); |
| 438 | bccGetExportFuncs(s->mBccScript, NULL, s->mEnviroment.mInvokeFunctionCount, (BCCvoid **) s->mEnviroment.mInvokeFunctions); |
Jason Sams | 1d54f10 | 2009-09-03 15:43:13 -0700 | [diff] [blame] | 439 | } |
| 440 | |
Shih-wei Liao | a226b16 | 2010-07-20 16:43:25 -0700 | [diff] [blame] | 441 | bccGetExportVars(s->mBccScript, (BCCsizei*) &s->mEnviroment.mFieldCount, 0, NULL); |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 442 | if (s->mEnviroment.mFieldCount <= 0) |
Shih-wei Liao | a226b16 | 2010-07-20 16:43:25 -0700 | [diff] [blame] | 443 | s->mEnviroment.mFieldAddress = NULL; |
| 444 | else { |
| 445 | s->mEnviroment.mFieldAddress = (void **) calloc(s->mEnviroment.mFieldCount, sizeof(void *)); |
| 446 | bccGetExportVars(s->mBccScript, NULL, s->mEnviroment.mFieldCount, (BCCvoid **) s->mEnviroment.mFieldAddress); |
Alex Sakhartchouk | 700ba38 | 2010-10-08 15:00:05 -0700 | [diff] [blame] | 447 | s->initSlots(); |
Shih-wei Liao | a226b16 | 2010-07-20 16:43:25 -0700 | [diff] [blame] | 448 | } |
Jason Sams | a4a54e4 | 2009-06-10 18:39:40 -0700 | [diff] [blame] | 449 | |
Jason Sams | 8c6bc69 | 2009-09-16 15:04:38 -0700 | [diff] [blame] | 450 | s->mEnviroment.mFragment.set(rsc->getDefaultProgramFragment()); |
| 451 | s->mEnviroment.mVertex.set(rsc->getDefaultProgramVertex()); |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 452 | s->mEnviroment.mFragmentStore.set(rsc->getDefaultProgramStore()); |
Jason Sams | b681c8a | 2009-09-28 18:12:56 -0700 | [diff] [blame] | 453 | s->mEnviroment.mRaster.set(rsc->getDefaultProgramRaster()); |
Jason Sams | 8c6bc69 | 2009-09-16 15:04:38 -0700 | [diff] [blame] | 454 | |
Jason Sams | be36bf3 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 455 | if (s->mProgram.mRoot) { |
Jason Sams | 1030893 | 2009-06-09 12:15:30 -0700 | [diff] [blame] | 456 | const static int pragmaMax = 16; |
Jason Sams | be36bf3 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 457 | BCCsizei pragmaCount; |
| 458 | BCCchar * str[pragmaMax]; |
| 459 | bccGetPragmas(s->mBccScript, &pragmaCount, pragmaMax, &str[0]); |
Jason Sams | 1030893 | 2009-06-09 12:15:30 -0700 | [diff] [blame] | 460 | |
Jason Sams | 1030893 | 2009-06-09 12:15:30 -0700 | [diff] [blame] | 461 | for (int ct=0; ct < pragmaCount; ct+=2) { |
Jason Sams | aeb094b | 2010-05-18 13:35:45 -0700 | [diff] [blame] | 462 | //LOGE("pragme %s %s", str[ct], str[ct+1]); |
Jason Sams | 1030893 | 2009-06-09 12:15:30 -0700 | [diff] [blame] | 463 | if (!strcmp(str[ct], "version")) { |
| 464 | continue; |
Jason Sams | 1030893 | 2009-06-09 12:15:30 -0700 | [diff] [blame] | 465 | } |
| 466 | |
Jason Sams | 1030893 | 2009-06-09 12:15:30 -0700 | [diff] [blame] | 467 | if (!strcmp(str[ct], "stateVertex")) { |
Jason Sams | 8ce125b | 2009-06-17 16:52:59 -0700 | [diff] [blame] | 468 | if (!strcmp(str[ct+1], "default")) { |
| 469 | continue; |
| 470 | } |
| 471 | if (!strcmp(str[ct+1], "parent")) { |
Jason Sams | 8c6bc69 | 2009-09-16 15:04:38 -0700 | [diff] [blame] | 472 | s->mEnviroment.mVertex.clear(); |
Jason Sams | 8ce125b | 2009-06-17 16:52:59 -0700 | [diff] [blame] | 473 | continue; |
| 474 | } |
Jason Sams | 1030893 | 2009-06-09 12:15:30 -0700 | [diff] [blame] | 475 | LOGE("Unreconized value %s passed to stateVertex", str[ct+1]); |
| 476 | } |
| 477 | |
| 478 | if (!strcmp(str[ct], "stateRaster")) { |
Jason Sams | b681c8a | 2009-09-28 18:12:56 -0700 | [diff] [blame] | 479 | if (!strcmp(str[ct+1], "default")) { |
| 480 | continue; |
| 481 | } |
| 482 | if (!strcmp(str[ct+1], "parent")) { |
| 483 | s->mEnviroment.mRaster.clear(); |
| 484 | continue; |
| 485 | } |
Jason Sams | 1030893 | 2009-06-09 12:15:30 -0700 | [diff] [blame] | 486 | LOGE("Unreconized value %s passed to stateRaster", str[ct+1]); |
| 487 | } |
| 488 | |
| 489 | if (!strcmp(str[ct], "stateFragment")) { |
Jason Sams | 8ce125b | 2009-06-17 16:52:59 -0700 | [diff] [blame] | 490 | if (!strcmp(str[ct+1], "default")) { |
| 491 | continue; |
| 492 | } |
| 493 | if (!strcmp(str[ct+1], "parent")) { |
Jason Sams | 8c6bc69 | 2009-09-16 15:04:38 -0700 | [diff] [blame] | 494 | s->mEnviroment.mFragment.clear(); |
Jason Sams | 8ce125b | 2009-06-17 16:52:59 -0700 | [diff] [blame] | 495 | continue; |
| 496 | } |
Jason Sams | 1030893 | 2009-06-09 12:15:30 -0700 | [diff] [blame] | 497 | LOGE("Unreconized value %s passed to stateFragment", str[ct+1]); |
| 498 | } |
| 499 | |
Jason Sams | b681c8a | 2009-09-28 18:12:56 -0700 | [diff] [blame] | 500 | if (!strcmp(str[ct], "stateStore")) { |
Jason Sams | 8ce125b | 2009-06-17 16:52:59 -0700 | [diff] [blame] | 501 | if (!strcmp(str[ct+1], "default")) { |
| 502 | continue; |
| 503 | } |
| 504 | if (!strcmp(str[ct+1], "parent")) { |
Jason Sams | 8c6bc69 | 2009-09-16 15:04:38 -0700 | [diff] [blame] | 505 | s->mEnviroment.mFragmentStore.clear(); |
Jason Sams | 8ce125b | 2009-06-17 16:52:59 -0700 | [diff] [blame] | 506 | continue; |
| 507 | } |
Jason Sams | b681c8a | 2009-09-28 18:12:56 -0700 | [diff] [blame] | 508 | LOGE("Unreconized value %s passed to stateStore", str[ct+1]); |
Jason Sams | 1030893 | 2009-06-09 12:15:30 -0700 | [diff] [blame] | 509 | } |
| 510 | |
| 511 | } |
| 512 | |
Jason Sams | d34b725 | 2009-08-04 16:58:20 -0700 | [diff] [blame] | 513 | |
Jason Sams | 1030893 | 2009-06-09 12:15:30 -0700 | [diff] [blame] | 514 | } else { |
| 515 | // Deal with an error. |
| 516 | } |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 517 | } |
| 518 | |
| 519 | namespace android { |
| 520 | namespace renderscript { |
| 521 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 522 | void rsi_ScriptCBegin(Context * rsc) { |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 523 | ScriptCState *ss = &rsc->mScriptC; |
Stephen Hines | 01b7d29 | 2010-09-28 15:45:45 -0700 | [diff] [blame] | 524 | ss->clear(rsc); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 525 | } |
| 526 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 527 | void rsi_ScriptCSetText(Context *rsc, const char *text, uint32_t len) { |
Jason Sams | 1f52633 | 2009-06-05 17:35:09 -0700 | [diff] [blame] | 528 | ScriptCState *ss = &rsc->mScriptC; |
Jason Sams | e402ed3 | 2009-11-03 11:25:42 -0800 | [diff] [blame] | 529 | |
| 530 | char *t = (char *)malloc(len + 1); |
| 531 | memcpy(t, text, len); |
| 532 | t[len] = 0; |
| 533 | ss->mScript->mEnviroment.mScriptText = t; |
Jason Sams | 8c6bc69 | 2009-09-16 15:04:38 -0700 | [diff] [blame] | 534 | ss->mScript->mEnviroment.mScriptTextLength = len; |
Jason Sams | 1f52633 | 2009-06-05 17:35:09 -0700 | [diff] [blame] | 535 | } |
| 536 | |
Shih-wei Liao | 9503b66 | 2010-11-08 01:33:59 -0800 | [diff] [blame] | 537 | RsScript rsi_ScriptCCreate(Context * rsc, const char *resName) |
| 538 | { |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 539 | ScriptCState *ss = &rsc->mScriptC; |
| 540 | |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 541 | ObjectBaseRef<ScriptC> s(ss->mScript); |
Stephen Hines | 01b7d29 | 2010-09-28 15:45:45 -0700 | [diff] [blame] | 542 | ss->mScript.clear(); |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 543 | s->incUserRef(); |
Jason Sams | 1f52633 | 2009-06-05 17:35:09 -0700 | [diff] [blame] | 544 | |
Shih-wei Liao | 9503b66 | 2010-11-08 01:33:59 -0800 | [diff] [blame] | 545 | ss->runCompiler(rsc, s.get(), resName); |
Stephen Hines | 01b7d29 | 2010-09-28 15:45:45 -0700 | [diff] [blame] | 546 | ss->clear(rsc); |
| 547 | return s.get(); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 548 | } |
| 549 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 550 | } |
| 551 | } |