Lines Matching defs:lod
94 uint32_t lod, RsAllocationCubemapFace face) {
95 uint8_t *ptr = (uint8_t *)alloc->mHal.drvState.lod[lod].mallocPtr;
97 ptr += zoff * alloc->mHal.drvState.lod[lod].dimY * alloc->mHal.drvState.lod[lod].stride;
98 ptr += yoff * alloc->mHal.drvState.lod[lod].stride;
105 uint32_t xoff, uint32_t yoff, uint32_t lod,
117 RSD_CALL_GL(glTexSubImage2D, t, lod, xoff, yoff, w, h, drv->glFormat, drv->glType, ptr);
136 for (uint32_t lod = 0; lod < alloc->mHal.state.type->getLODCount(); lod++) {
137 const uint8_t *p = GetOffsetPtr(alloc, 0, 0, 0, lod, (RsAllocationCubemapFace)face);
145 RSD_CALL_GL(glTexImage2D, t, lod, drv->glFormat,
146 alloc->mHal.state.type->getLODDimX(lod),
147 alloc->mHal.state.type->getLODDimY(lod),
150 RSD_CALL_GL(glTexSubImage2D, t, lod, 0, 0,
151 alloc->mHal.state.type->getLODDimX(lod),
152 alloc->mHal.state.type->getLODDimY(lod),
180 if (!alloc->mHal.drvState.lod[0].mallocPtr) {
194 if (alloc->mHal.drvState.lod[0].mallocPtr) {
195 free(alloc->mHal.drvState.lod[0].mallocPtr);
196 alloc->mHal.drvState.lod[0].mallocPtr = NULL;
222 alloc->mHal.drvState.lod[0].dimX, alloc->mHal.drvState.lod[0].dimY);
248 alloc->mHal.drvState.lod[0].mallocPtr, GL_DYNAMIC_DRAW);
259 state->lod[1].dimX = state->lod[0].dimX / 2;
260 state->lod[1].dimY = state->lod[0].dimY / 2;
261 state->lod[2].dimX = state->lod[0].dimX / 2;
262 state->lod[2].dimY = state->lod[0].dimY / 2;
270 state->lod[2].stride = rsRound(state->lod[0].stride >> 1, 16);
271 state->lod[2].mallocPtr = ((uint8_t *)state->lod[0].mallocPtr) +
272 (state->lod[0].stride * state->lod[0].dimY);
273 uvSize += state->lod[2].stride * state->lod[2].dimY;
275 state->lod[1].stride = state->lod[2].stride;
276 state->lod[1].mallocPtr = ((uint8_t *)state->lod[2].mallocPtr) +
277 (state->lod[2].stride * state->lod[2].dimY);
278 uvSize += state->lod[1].stride * state->lod[2].dimY;
281 //state->lod[1].dimX = state->lod[0].dimX;
282 state->lod[1].stride = state->lod[0].stride;
283 state->lod[2].stride = state->lod[0].stride;
284 state->lod[2].mallocPtr = ((uint8_t *)state->lod[0].mallocPtr) +
285 (state->lod[0].stride * state->lod[0].dimY);
286 state->lod[1].mallocPtr = ((uint8_t *)state->lod[2].mallocPtr) + 1;
287 uvSize += state->lod[1].stride * state->lod[1].dimY;
305 alloc->mHal.drvState.lod[0].dimX = type->getDimX();
306 alloc->mHal.drvState.lod[0].dimY = type->getDimY();
307 alloc->mHal.drvState.lod[0].dimZ = type->getDimZ();
308 alloc->mHal.drvState.lod[0].mallocPtr = 0;
310 size_t stride = alloc->mHal.drvState.lod[0].dimX * type->getElementSizeBytes();
311 alloc->mHal.drvState.lod[0].stride = rsRound(stride, 16);
318 size_t o = alloc->mHal.drvState.lod[0].stride * rsMax(alloc->mHal.drvState.lod[0].dimY, 1u) *
319 rsMax(alloc->mHal.drvState.lod[0].dimZ, 1u);
321 uint32_t tx = alloc->mHal.drvState.lod[0].dimX;
322 uint32_t ty = alloc->mHal.drvState.lod[0].dimY;
323 uint32_t tz = alloc->mHal.drvState.lod[0].dimZ;
324 for (uint32_t lod=1; lod < alloc->mHal.drvState.lodCount; lod++) {
325 alloc->mHal.drvState.lod[lod].dimX = tx;
326 alloc->mHal.drvState.lod[lod].dimY = ty;
327 alloc->mHal.drvState.lod[lod].dimZ = tz;
328 alloc->mHal.drvState.lod[lod].stride =
330 offsets[lod] = o;
331 o += alloc->mHal.drvState.lod[lod].stride * rsMax(ty, 1u) * rsMax(tz, 1u);
340 offsets[ct] = (size_t)alloc->mHal.drvState.lod[ct].mallocPtr;
346 alloc->mHal.drvState.lod[0].mallocPtr = ptr;
347 for (uint32_t lod=1; lod < alloc->mHal.drvState.lodCount; lod++) {
348 alloc->mHal.drvState.lod[lod].mallocPtr = ptr + offsets[lod];
389 // limitations: no faces, no LOD, USAGE_SCRIPT or SCRIPT+TEXTURE only
489 if (alloc->mHal.drvState.lod[0].mallocPtr) {
494 free(alloc->mHal.drvState.lod[0].mallocPtr);
496 alloc->mHal.drvState.lod[0].mallocPtr = NULL;
524 const uint32_t oldDimX = alloc->mHal.drvState.lod[0].dimX;
532 void * oldPtr = alloc->mHal.drvState.lod[0].mallocPtr;
545 memset(((uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr) + stride * oldDimX,
574 RSD_CALL_GL(glReadPixels, 0, 0, alloc->mHal.drvState.lod[0].dimX,
575 alloc->mHal.drvState.lod[0].dimY,
576 drv->glFormat, drv->glType, alloc->mHal.drvState.lod[0].mallocPtr);
646 alloc->mHal.drvState.lod[0].mallocPtr = dst;
647 alloc->mHal.drvState.lod[0].stride = drv->wndBuffer->stride * alloc->mHal.state.elementSizeBytes;
648 rsAssert((alloc->mHal.drvState.lod[0].stride & 0xf) == 0);
704 r = native_window_set_buffers_dimensions(nw, alloc->mHal.drvState.lod[0].dimX,
705 alloc->mHal.drvState.lod[0].dimY);
779 uint32_t xoff, uint32_t lod, size_t count,
799 uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
809 if (alloc->mHal.drvState.lod[0].mallocPtr) {
811 uint8_t *dst = GetOffsetPtr(alloc, xoff, yoff, 0, lod, face);
826 dst += alloc->mHal.drvState.lod[lod].stride;
830 int lod = 1;
836 lod = 2;
840 while (lod < maxLod) {
841 uint8_t *dst = GetOffsetPtr(alloc, xoff, yoff, 0, lod, face);
845 src += alloc->mHal.drvState.lod[lod].stride;
846 dst += alloc->mHal.drvState.lod[lod].stride;
848 lod++;
854 Update2DTexture(rsc, alloc, data, xoff, yoff, lod, face, w, h);
860 uint32_t lod,
871 if (alloc->mHal.drvState.lod[0].mallocPtr) {
874 uint8_t *dst = GetOffsetPtr(alloc, xoff, yoff, z, lod,
890 dst += alloc->mHal.drvState.lod[lod].stride;
898 uint32_t xoff, uint32_t lod, size_t count,
910 uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
918 if (alloc->mHal.drvState.lod[0].mallocPtr) {
920 lod, face);
930 src += alloc->mHal.drvState.lod[lod].stride;
940 uint32_t lod,
948 if (alloc->mHal.drvState.lod[0].mallocPtr) {
951 const uint8_t *src = GetOffsetPtr(alloc, xoff, yoff, z, lod,
962 src += alloc->mHal.drvState.lod[lod].stride;
970 return alloc->mHal.drvState.lod[0].mallocPtr;
1100 static void mip565(const Allocation *alloc, int lod, RsAllocationCubemapFace face) {
1101 uint32_t w = alloc->mHal.drvState.lod[lod + 1].dimX;
1102 uint32_t h = alloc->mHal.drvState.lod[lod + 1].dimY;
1105 uint16_t *oPtr = (uint16_t *)GetOffsetPtr(alloc, 0, y, 0, lod + 1, face);
1106 const uint16_t *i1 = (uint16_t *)GetOffsetPtr(alloc, 0, 0, y*2, lod, face);
1107 const uint16_t *i2 = (uint16_t *)GetOffsetPtr(alloc, 0, 0, y*2+1, lod, face);
1118 static void mip8888(const Allocation *alloc, int lod, RsAllocationCubemapFace face) {
1119 uint32_t w = alloc->mHal.drvState.lod[lod + 1].dimX;
1120 uint32_t h = alloc->mHal.drvState.lod[lod + 1].dimY;
1123 uint32_t *oPtr = (uint32_t *)GetOffsetPtr(alloc, 0, y, 0, lod + 1, face);
1124 const uint32_t *i1 = (uint32_t *)GetOffsetPtr(alloc, 0, y*2, 0, lod, face);
1125 const uint32_t *i2 = (uint32_t *)GetOffsetPtr(alloc, 0, y*2+1, 0, lod, face);
1136 static void mip8(const Allocation *alloc, int lod, RsAllocationCubemapFace face) {
1137 uint32_t w = alloc->mHal.drvState.lod[lod + 1].dimX;
1138 uint32_t h = alloc->mHal.drvState.lod[lod + 1].dimY;
1141 uint8_t *oPtr = GetOffsetPtr(alloc, 0, y, 0, lod + 1, face);
1142 const uint8_t *i1 = GetOffsetPtr(alloc, 0, y*2, 0, lod, face);
1143 const uint8_t *i2 = GetOffsetPtr(alloc, 0, y*2+1, 0, lod, face);
1155 if(!alloc->mHal.drvState.lod[0].mallocPtr) {
1160 for (uint32_t lod=0; lod < (alloc->getType()->getLODCount() -1); lod++) {
1163 mip8888(alloc, lod, (RsAllocationCubemapFace)face);
1166 mip565(alloc, lod, (RsAllocationCubemapFace)face);
1169 mip8(alloc, lod, (RsAllocationCubemapFace)face);