rsdShader.cpp revision 7510992812e32c83114b98ea47fbb39876bdc223
1/* 2 * Copyright (C) 2011 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 <GLES2/gl2.h> 18#include <GLES2/gl2ext.h> 19 20#include <rs_hal.h> 21#include <rsContext.h> 22#include <rsProgram.h> 23 24#include "rsdCore.h" 25#include "rsdAllocation.h" 26#include "rsdShader.h" 27#include "rsdShaderCache.h" 28 29using namespace android; 30using namespace android::renderscript; 31 32RsdShader::RsdShader(const Program *p, uint32_t type, 33 const char * shaderText, uint32_t shaderLength) { 34 35 mUserShader.setTo(shaderText, shaderLength); 36 mRSProgram = p; 37 mType = type; 38 initMemberVars(); 39 initAttribAndUniformArray(); 40 init(); 41} 42 43RsdShader::~RsdShader() { 44 if (mShaderID) { 45 glDeleteShader(mShaderID); 46 } 47 48 delete[] mAttribNames; 49 delete[] mUniformNames; 50 delete[] mUniformArraySizes; 51 delete[] mTextureTargets; 52} 53 54void RsdShader::initMemberVars() { 55 mDirty = true; 56 mShaderID = 0; 57 mAttribCount = 0; 58 mUniformCount = 0; 59 60 mAttribNames = NULL; 61 mUniformNames = NULL; 62 mUniformArraySizes = NULL; 63 mTextureTargets = NULL; 64 65 mIsValid = false; 66} 67 68void RsdShader::init() { 69 uint32_t attribCount = 0; 70 uint32_t uniformCount = 0; 71 for (uint32_t ct=0; ct < mRSProgram->mHal.state.inputElementsCount; ct++) { 72 initAddUserElement(mRSProgram->mHal.state.inputElements[ct], mAttribNames, NULL, &attribCount, RS_SHADER_ATTR); 73 } 74 for (uint32_t ct=0; ct < mRSProgram->mHal.state.constantsCount; ct++) { 75 initAddUserElement(mRSProgram->mHal.state.constantTypes[ct]->getElement(), mUniformNames, mUniformArraySizes, &uniformCount, RS_SHADER_UNI); 76 } 77 78 mTextureUniformIndexStart = uniformCount; 79 char buf[256]; 80 for (uint32_t ct=0; ct < mRSProgram->mHal.state.texturesCount; ct++) { 81 snprintf(buf, sizeof(buf), "UNI_Tex%i", ct); 82 mUniformNames[uniformCount].setTo(buf); 83 mUniformArraySizes[uniformCount] = 1; 84 uniformCount++; 85 } 86 87} 88 89String8 RsdShader::getGLSLInputString() const { 90 String8 s; 91 for (uint32_t ct=0; ct < mRSProgram->mHal.state.inputElementsCount; ct++) { 92 const Element *e = mRSProgram->mHal.state.inputElements[ct]; 93 for (uint32_t field=0; field < e->getFieldCount(); field++) { 94 const Element *f = e->getField(field); 95 96 // Cannot be complex 97 rsAssert(!f->getFieldCount()); 98 switch (f->getComponent().getVectorSize()) { 99 case 1: s.append("attribute float ATTRIB_"); break; 100 case 2: s.append("attribute vec2 ATTRIB_"); break; 101 case 3: s.append("attribute vec3 ATTRIB_"); break; 102 case 4: s.append("attribute vec4 ATTRIB_"); break; 103 default: 104 rsAssert(0); 105 } 106 107 s.append(e->getFieldName(field)); 108 s.append(";\n"); 109 } 110 } 111 return s; 112} 113 114void RsdShader::appendAttributes() { 115 for (uint32_t ct=0; ct < mRSProgram->mHal.state.inputElementsCount; ct++) { 116 const Element *e = mRSProgram->mHal.state.inputElements[ct]; 117 for (uint32_t field=0; field < e->getFieldCount(); field++) { 118 const Element *f = e->getField(field); 119 const char *fn = e->getFieldName(field); 120 121 if (fn[0] == '#') { 122 continue; 123 } 124 125 // Cannot be complex 126 rsAssert(!f->getFieldCount()); 127 switch (f->getComponent().getVectorSize()) { 128 case 1: mShader.append("attribute float ATTRIB_"); break; 129 case 2: mShader.append("attribute vec2 ATTRIB_"); break; 130 case 3: mShader.append("attribute vec3 ATTRIB_"); break; 131 case 4: mShader.append("attribute vec4 ATTRIB_"); break; 132 default: 133 rsAssert(0); 134 } 135 136 mShader.append(fn); 137 mShader.append(";\n"); 138 } 139 } 140} 141 142void RsdShader::appendTextures() { 143 char buf[256]; 144 for (uint32_t ct=0; ct < mRSProgram->mHal.state.texturesCount; ct++) { 145 if (mRSProgram->mHal.state.textureTargets[ct] == RS_TEXTURE_2D) { 146 snprintf(buf, sizeof(buf), "uniform sampler2D UNI_Tex%i;\n", ct); 147 mTextureTargets[ct] = GL_TEXTURE_2D; 148 } else { 149 snprintf(buf, sizeof(buf), "uniform samplerCube UNI_Tex%i;\n", ct); 150 mTextureTargets[ct] = GL_TEXTURE_CUBE_MAP; 151 } 152 mShader.append(buf); 153 } 154} 155 156bool RsdShader::createShader() { 157 158 if (mType == GL_FRAGMENT_SHADER) { 159 mShader.append("precision mediump float;\n"); 160 } 161 appendUserConstants(); 162 appendAttributes(); 163 appendTextures(); 164 165 mShader.append(mUserShader); 166 167 return true; 168} 169 170bool RsdShader::loadShader(const Context *rsc) { 171 mShaderID = glCreateShader(mType); 172 rsAssert(mShaderID); 173 174 if (rsc->props.mLogShaders) { 175 ALOGV("Loading shader type %x, ID %i", mType, mShaderID); 176 ALOGV("%s", mShader.string()); 177 } 178 179 if (mShaderID) { 180 const char * ss = mShader.string(); 181 RSD_CALL_GL(glShaderSource, mShaderID, 1, &ss, NULL); 182 RSD_CALL_GL(glCompileShader, mShaderID); 183 184 GLint compiled = 0; 185 RSD_CALL_GL(glGetShaderiv, mShaderID, GL_COMPILE_STATUS, &compiled); 186 if (!compiled) { 187 GLint infoLen = 0; 188 RSD_CALL_GL(glGetShaderiv, mShaderID, GL_INFO_LOG_LENGTH, &infoLen); 189 if (infoLen) { 190 char* buf = (char*) malloc(infoLen); 191 if (buf) { 192 RSD_CALL_GL(glGetShaderInfoLog, mShaderID, infoLen, NULL, buf); 193 rsc->setError(RS_ERROR_FATAL_PROGRAM_LINK, buf); 194 free(buf); 195 } 196 RSD_CALL_GL(glDeleteShader, mShaderID); 197 mShaderID = 0; 198 return false; 199 } 200 } 201 } 202 203 if (rsc->props.mLogShaders) { 204 ALOGV("--Shader load result %x ", glGetError()); 205 } 206 mIsValid = true; 207 return true; 208} 209 210void RsdShader::appendUserConstants() { 211 for (uint32_t ct=0; ct < mRSProgram->mHal.state.constantsCount; ct++) { 212 const Element *e = mRSProgram->mHal.state.constantTypes[ct]->getElement(); 213 for (uint32_t field=0; field < e->getFieldCount(); field++) { 214 const Element *f = e->getField(field); 215 const char *fn = e->getFieldName(field); 216 217 if (fn[0] == '#') { 218 continue; 219 } 220 221 // Cannot be complex 222 rsAssert(!f->getFieldCount()); 223 if (f->getType() == RS_TYPE_MATRIX_4X4) { 224 mShader.append("uniform mat4 UNI_"); 225 } else if (f->getType() == RS_TYPE_MATRIX_3X3) { 226 mShader.append("uniform mat3 UNI_"); 227 } else if (f->getType() == RS_TYPE_MATRIX_2X2) { 228 mShader.append("uniform mat2 UNI_"); 229 } else { 230 switch (f->getComponent().getVectorSize()) { 231 case 1: mShader.append("uniform float UNI_"); break; 232 case 2: mShader.append("uniform vec2 UNI_"); break; 233 case 3: mShader.append("uniform vec3 UNI_"); break; 234 case 4: mShader.append("uniform vec4 UNI_"); break; 235 default: 236 rsAssert(0); 237 } 238 } 239 240 mShader.append(fn); 241 if (e->getFieldArraySize(field) > 1) { 242 mShader.appendFormat("[%d]", e->getFieldArraySize(field)); 243 } 244 mShader.append(";\n"); 245 } 246 } 247} 248 249void RsdShader::logUniform(const Element *field, const float *fd, uint32_t arraySize ) { 250 RsDataType dataType = field->getType(); 251 uint32_t elementSize = field->getSizeBytes() / sizeof(float); 252 for (uint32_t i = 0; i < arraySize; i ++) { 253 if (arraySize > 1) { 254 ALOGV("Array Element [%u]", i); 255 } 256 if (dataType == RS_TYPE_MATRIX_4X4) { 257 ALOGV("Matrix4x4"); 258 ALOGV("{%f, %f, %f, %f", fd[0], fd[4], fd[8], fd[12]); 259 ALOGV(" %f, %f, %f, %f", fd[1], fd[5], fd[9], fd[13]); 260 ALOGV(" %f, %f, %f, %f", fd[2], fd[6], fd[10], fd[14]); 261 ALOGV(" %f, %f, %f, %f}", fd[3], fd[7], fd[11], fd[15]); 262 } else if (dataType == RS_TYPE_MATRIX_3X3) { 263 ALOGV("Matrix3x3"); 264 ALOGV("{%f, %f, %f", fd[0], fd[3], fd[6]); 265 ALOGV(" %f, %f, %f", fd[1], fd[4], fd[7]); 266 ALOGV(" %f, %f, %f}", fd[2], fd[5], fd[8]); 267 } else if (dataType == RS_TYPE_MATRIX_2X2) { 268 ALOGV("Matrix2x2"); 269 ALOGV("{%f, %f", fd[0], fd[2]); 270 ALOGV(" %f, %f}", fd[1], fd[3]); 271 } else { 272 switch (field->getComponent().getVectorSize()) { 273 case 1: 274 ALOGV("Uniform 1 = %f", fd[0]); 275 break; 276 case 2: 277 ALOGV("Uniform 2 = %f %f", fd[0], fd[1]); 278 break; 279 case 3: 280 ALOGV("Uniform 3 = %f %f %f", fd[0], fd[1], fd[2]); 281 break; 282 case 4: 283 ALOGV("Uniform 4 = %f %f %f %f", fd[0], fd[1], fd[2], fd[3]); 284 break; 285 default: 286 rsAssert(0); 287 } 288 } 289 ALOGE("Element size %u data=%p", elementSize, fd); 290 fd += elementSize; 291 ALOGE("New data=%p", fd); 292 } 293} 294 295void RsdShader::setUniform(const Context *rsc, const Element *field, const float *fd, 296 int32_t slot, uint32_t arraySize ) { 297 RsDataType dataType = field->getType(); 298 if (dataType == RS_TYPE_MATRIX_4X4) { 299 RSD_CALL_GL(glUniformMatrix4fv, slot, arraySize, GL_FALSE, fd); 300 } else if (dataType == RS_TYPE_MATRIX_3X3) { 301 RSD_CALL_GL(glUniformMatrix3fv, slot, arraySize, GL_FALSE, fd); 302 } else if (dataType == RS_TYPE_MATRIX_2X2) { 303 RSD_CALL_GL(glUniformMatrix2fv, slot, arraySize, GL_FALSE, fd); 304 } else { 305 switch (field->getComponent().getVectorSize()) { 306 case 1: 307 RSD_CALL_GL(glUniform1fv, slot, arraySize, fd); 308 break; 309 case 2: 310 RSD_CALL_GL(glUniform2fv, slot, arraySize, fd); 311 break; 312 case 3: 313 RSD_CALL_GL(glUniform3fv, slot, arraySize, fd); 314 break; 315 case 4: 316 RSD_CALL_GL(glUniform4fv, slot, arraySize, fd); 317 break; 318 default: 319 rsAssert(0); 320 } 321 } 322} 323 324void RsdShader::setupSampler(const Context *rsc, const Sampler *s, const Allocation *tex) { 325 RsdHal *dc = (RsdHal *)rsc->mHal.drv; 326 327 GLenum trans[] = { 328 GL_NEAREST, //RS_SAMPLER_NEAREST, 329 GL_LINEAR, //RS_SAMPLER_LINEAR, 330 GL_LINEAR_MIPMAP_LINEAR, //RS_SAMPLER_LINEAR_MIP_LINEAR, 331 GL_REPEAT, //RS_SAMPLER_WRAP, 332 GL_CLAMP_TO_EDGE, //RS_SAMPLER_CLAMP 333 GL_LINEAR_MIPMAP_NEAREST, //RS_SAMPLER_LINEAR_MIP_NEAREST 334 }; 335 336 GLenum transNP[] = { 337 GL_NEAREST, //RS_SAMPLER_NEAREST, 338 GL_LINEAR, //RS_SAMPLER_LINEAR, 339 GL_LINEAR, //RS_SAMPLER_LINEAR_MIP_LINEAR, 340 GL_CLAMP_TO_EDGE, //RS_SAMPLER_WRAP, 341 GL_CLAMP_TO_EDGE, //RS_SAMPLER_CLAMP 342 GL_LINEAR, //RS_SAMPLER_LINEAR_MIP_NEAREST, 343 }; 344 345 // This tells us the correct texture type 346 DrvAllocation *drvTex = (DrvAllocation *)tex->mHal.drv; 347 const GLenum target = drvTex->glTarget; 348 349 if (!dc->gl.gl.OES_texture_npot && tex->getType()->getIsNp2()) { 350 if (tex->getHasGraphicsMipmaps() && 351 (dc->gl.gl.NV_texture_npot_2D_mipmap || dc->gl.gl.IMG_texture_npot)) { 352 if (dc->gl.gl.NV_texture_npot_2D_mipmap) { 353 RSD_CALL_GL(glTexParameteri, target, GL_TEXTURE_MIN_FILTER, 354 trans[s->mHal.state.minFilter]); 355 } else { 356 switch (trans[s->mHal.state.minFilter]) { 357 case GL_LINEAR_MIPMAP_LINEAR: 358 RSD_CALL_GL(glTexParameteri, target, GL_TEXTURE_MIN_FILTER, 359 GL_LINEAR_MIPMAP_NEAREST); 360 break; 361 default: 362 RSD_CALL_GL(glTexParameteri, target, GL_TEXTURE_MIN_FILTER, 363 trans[s->mHal.state.minFilter]); 364 break; 365 } 366 } 367 } else { 368 RSD_CALL_GL(glTexParameteri, target, GL_TEXTURE_MIN_FILTER, 369 transNP[s->mHal.state.minFilter]); 370 } 371 RSD_CALL_GL(glTexParameteri, target, GL_TEXTURE_MAG_FILTER, 372 transNP[s->mHal.state.magFilter]); 373 RSD_CALL_GL(glTexParameteri, target, GL_TEXTURE_WRAP_S, transNP[s->mHal.state.wrapS]); 374 RSD_CALL_GL(glTexParameteri, target, GL_TEXTURE_WRAP_T, transNP[s->mHal.state.wrapT]); 375 } else { 376 if (tex->getHasGraphicsMipmaps()) { 377 RSD_CALL_GL(glTexParameteri, target, GL_TEXTURE_MIN_FILTER, 378 trans[s->mHal.state.minFilter]); 379 } else { 380 RSD_CALL_GL(glTexParameteri, target, GL_TEXTURE_MIN_FILTER, 381 transNP[s->mHal.state.minFilter]); 382 } 383 RSD_CALL_GL(glTexParameteri, target, GL_TEXTURE_MAG_FILTER, trans[s->mHal.state.magFilter]); 384 RSD_CALL_GL(glTexParameteri, target, GL_TEXTURE_WRAP_S, trans[s->mHal.state.wrapS]); 385 RSD_CALL_GL(glTexParameteri, target, GL_TEXTURE_WRAP_T, trans[s->mHal.state.wrapT]); 386 } 387 388 float anisoValue = rsMin(dc->gl.gl.EXT_texture_max_aniso, s->mHal.state.aniso); 389 if (dc->gl.gl.EXT_texture_max_aniso > 1.0f) { 390 RSD_CALL_GL(glTexParameterf, target, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisoValue); 391 } 392 393 rsdGLCheckError(rsc, "Sampler::setup tex env"); 394} 395 396void RsdShader::setupTextures(const Context *rsc, RsdShaderCache *sc) { 397 if (mRSProgram->mHal.state.texturesCount == 0) { 398 return; 399 } 400 401 RsdHal *dc = (RsdHal *)rsc->mHal.drv; 402 403 uint32_t numTexturesToBind = mRSProgram->mHal.state.texturesCount; 404 uint32_t numTexturesAvailable = dc->gl.gl.maxFragmentTextureImageUnits; 405 if (numTexturesToBind >= numTexturesAvailable) { 406 ALOGE("Attempting to bind %u textures on shader id %u, but only %u are available", 407 mRSProgram->mHal.state.texturesCount, (uint32_t)this, numTexturesAvailable); 408 rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind more textuers than available"); 409 numTexturesToBind = numTexturesAvailable; 410 } 411 412 for (uint32_t ct=0; ct < numTexturesToBind; ct++) { 413 RSD_CALL_GL(glActiveTexture, GL_TEXTURE0 + ct); 414 RSD_CALL_GL(glUniform1i, sc->fragUniformSlot(mTextureUniformIndexStart + ct), ct); 415 416 if (!mRSProgram->mHal.state.textures[ct]) { 417 // if nothing is bound, reset to default GL texture 418 RSD_CALL_GL(glBindTexture, mTextureTargets[ct], 0); 419 continue; 420 } 421 422 DrvAllocation *drvTex = (DrvAllocation *)mRSProgram->mHal.state.textures[ct]->mHal.drv; 423 if (drvTex->glTarget != GL_TEXTURE_2D && drvTex->glTarget != GL_TEXTURE_CUBE_MAP) { 424 ALOGE("Attempting to bind unknown texture to shader id %u, texture unit %u", (uint)this, ct); 425 rsc->setError(RS_ERROR_BAD_SHADER, "Non-texture allocation bound to a shader"); 426 } 427 RSD_CALL_GL(glBindTexture, drvTex->glTarget, drvTex->textureID); 428 rsdGLCheckError(rsc, "ProgramFragment::setup tex bind"); 429 if (mRSProgram->mHal.state.samplers[ct]) { 430 setupSampler(rsc, mRSProgram->mHal.state.samplers[ct], 431 mRSProgram->mHal.state.textures[ct]); 432 } else { 433 RSD_CALL_GL(glTexParameteri, drvTex->glTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 434 RSD_CALL_GL(glTexParameteri, drvTex->glTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 435 RSD_CALL_GL(glTexParameteri, drvTex->glTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 436 RSD_CALL_GL(glTexParameteri, drvTex->glTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 437 rsdGLCheckError(rsc, "ProgramFragment::setup tex env"); 438 } 439 rsdGLCheckError(rsc, "ProgramFragment::setup uniforms"); 440 } 441 442 RSD_CALL_GL(glActiveTexture, GL_TEXTURE0); 443 mDirty = false; 444 rsdGLCheckError(rsc, "ProgramFragment::setup"); 445} 446 447void RsdShader::setupUserConstants(const Context *rsc, RsdShaderCache *sc, bool isFragment) { 448 uint32_t uidx = 0; 449 for (uint32_t ct=0; ct < mRSProgram->mHal.state.constantsCount; ct++) { 450 Allocation *alloc = mRSProgram->mHal.state.constants[ct]; 451 if (!alloc) { 452 ALOGE("Attempting to set constants on shader id %u, but alloc at slot %u is not set", 453 (uint32_t)this, ct); 454 rsc->setError(RS_ERROR_BAD_SHADER, "No constant allocation bound"); 455 continue; 456 } 457 458 const uint8_t *data = static_cast<const uint8_t *>(alloc->getPtr()); 459 const Element *e = mRSProgram->mHal.state.constantTypes[ct]->getElement(); 460 for (uint32_t field=0; field < e->getFieldCount(); field++) { 461 const Element *f = e->getField(field); 462 const char *fieldName = e->getFieldName(field); 463 // If this field is padding, skip it 464 if (fieldName[0] == '#') { 465 continue; 466 } 467 468 uint32_t offset = e->getFieldOffsetBytes(field); 469 const float *fd = reinterpret_cast<const float *>(&data[offset]); 470 471 int32_t slot = -1; 472 uint32_t arraySize = 1; 473 if (!isFragment) { 474 slot = sc->vtxUniformSlot(uidx); 475 arraySize = sc->vtxUniformSize(uidx); 476 } else { 477 slot = sc->fragUniformSlot(uidx); 478 arraySize = sc->fragUniformSize(uidx); 479 } 480 if (rsc->props.mLogShadersUniforms) { 481 ALOGV("Uniform slot=%i, offset=%i, constant=%i, field=%i, uidx=%i, name=%s", 482 slot, offset, ct, field, uidx, fieldName); 483 } 484 uidx ++; 485 if (slot < 0) { 486 continue; 487 } 488 489 if (rsc->props.mLogShadersUniforms) { 490 logUniform(f, fd, arraySize); 491 } 492 setUniform(rsc, f, fd, slot, arraySize); 493 } 494 } 495} 496 497void RsdShader::setup(const android::renderscript::Context *rsc, RsdShaderCache *sc) { 498 499 setupUserConstants(rsc, sc, mType == GL_FRAGMENT_SHADER); 500 setupTextures(rsc, sc); 501} 502 503void RsdShader::initAttribAndUniformArray() { 504 mAttribCount = 0; 505 for (uint32_t ct=0; ct < mRSProgram->mHal.state.inputElementsCount; ct++) { 506 const Element *elem = mRSProgram->mHal.state.inputElements[ct]; 507 for (uint32_t field=0; field < elem->getFieldCount(); field++) { 508 if (elem->getFieldName(field)[0] != '#') { 509 mAttribCount ++; 510 } 511 } 512 } 513 514 mUniformCount = 0; 515 for (uint32_t ct=0; ct < mRSProgram->mHal.state.constantsCount; ct++) { 516 const Element *elem = mRSProgram->mHal.state.constantTypes[ct]->getElement(); 517 518 for (uint32_t field=0; field < elem->getFieldCount(); field++) { 519 if (elem->getFieldName(field)[0] != '#') { 520 mUniformCount ++; 521 } 522 } 523 } 524 mUniformCount += mRSProgram->mHal.state.texturesCount; 525 526 if (mAttribCount) { 527 mAttribNames = new String8[mAttribCount]; 528 } 529 if (mUniformCount) { 530 mUniformNames = new String8[mUniformCount]; 531 mUniformArraySizes = new uint32_t[mUniformCount]; 532 } 533 534 mTextureCount = mRSProgram->mHal.state.texturesCount; 535 if (mTextureCount) { 536 mTextureTargets = new uint32_t[mTextureCount]; 537 } 538} 539 540void RsdShader::initAddUserElement(const Element *e, String8 *names, uint32_t *arrayLengths, 541 uint32_t *count, const char *prefix) { 542 rsAssert(e->getFieldCount()); 543 for (uint32_t ct=0; ct < e->getFieldCount(); ct++) { 544 const Element *ce = e->getField(ct); 545 if (ce->getFieldCount()) { 546 initAddUserElement(ce, names, arrayLengths, count, prefix); 547 } else if (e->getFieldName(ct)[0] != '#') { 548 String8 tmp(prefix); 549 tmp.append(e->getFieldName(ct)); 550 names[*count].setTo(tmp.string()); 551 if (arrayLengths) { 552 arrayLengths[*count] = e->getFieldArraySize(ct); 553 } 554 (*count)++; 555 } 556 } 557} 558