# and remap all of the handles inside of the update structs
ud_body.append(' XGL_UPDATE_SAMPLERS* pUpdateChain = (XGL_UPDATE_SAMPLERS*)pPacket->pUpdateChain;')
ud_body.append(' void* pLocalUpdateChain = NULL;')
+ ud_body.append(' XGL_UPDATE_SAMPLERS* pPrev = NULL;')
ud_body.append(' void* pLocalUpdateChainHEAD = NULL;')
ud_body.append(' size_t blockSize = 0;')
ud_body.append(' while (pUpdateChain) {')
ud_body.append(' pLocalUpdateChain = (void*)malloc(blockSize);')
ud_body.append(' memcpy(pLocalUpdateChain, pUpdateChain, blockSize);')
ud_body.append(' for (uint32_t i = 0; i < ((XGL_UPDATE_SAMPLERS*)pLocalUpdateChain)->count; i++) {')
- ud_body.append(' XGL_SAMPLER localSampler = remap(((XGL_UPDATE_SAMPLERS*)pUpdateChain)->pSamplers[i]);')
- ud_body.append(' memcpy((void*)&((XGL_UPDATE_SAMPLERS*)pLocalUpdateChain)->pSamplers[i], &localSampler, sizeof(XGL_SAMPLER));')
+ ud_body.append(' XGL_SAMPLER* pLocalSampler = (XGL_SAMPLER*) &((XGL_UPDATE_SAMPLERS*)pLocalUpdateChain)->pSamplers[i];')
+ ud_body.append(' *pLocalSampler = remap(((XGL_UPDATE_SAMPLERS*)pUpdateChain)->pSamplers[i]);')
ud_body.append(' }')
ud_body.append(' break;')
ud_body.append(' case XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES:')
ud_body.append(' pLocalUpdateChain = malloc(blockSize);')
ud_body.append(' memcpy(pLocalUpdateChain, pUpdateChain, blockSize);')
ud_body.append(' for (uint32_t i = 0; i < ((XGL_UPDATE_IMAGES*)pLocalUpdateChain)->count; i++) {')
- ud_body.append(' XGL_IMAGE_VIEW localView = remap(((XGL_UPDATE_IMAGES*)pUpdateChain)->pImageViews[i]->view);')
- ud_body.append(' memcpy((void*)&((XGL_UPDATE_IMAGES*)pLocalUpdateChain)->pImageViews[i]->view, &localView, sizeof(XGL_IMAGE_VIEW));')
+ ud_body.append(' XGL_IMAGE_VIEW* pLocalView = (XGL_IMAGE_VIEW*) &((XGL_UPDATE_IMAGES*)pUpdateChain)->pImageViews[i]->view;')
+ ud_body.append(' *pLocalView = remap(((XGL_UPDATE_IMAGES*)pUpdateChain)->pImageViews[i]->view);')
ud_body.append(' }')
ud_body.append(' break;')
ud_body.append(' case XGL_STRUCTURE_TYPE_UPDATE_BUFFERS:')
ud_body.append(' pLocalUpdateChain = malloc(blockSize);')
ud_body.append(' memcpy(pLocalUpdateChain, pUpdateChain, blockSize);')
ud_body.append(' for (uint32_t i = 0; i < ((XGL_UPDATE_BUFFERS*)pLocalUpdateChain)->count; i++) {')
- ud_body.append(' XGL_BUFFER_VIEW localView = remap(((XGL_UPDATE_BUFFERS*)pUpdateChain)->pBufferViews[i]->view);')
- ud_body.append(' memcpy((void*)&((XGL_UPDATE_BUFFERS*)pLocalUpdateChain)->pBufferViews[i]->view, &localView, sizeof(XGL_BUFFER_VIEW));')
+ ud_body.append(' XGL_BUFFER_VIEW* pLocalView = (XGL_BUFFER_VIEW*) &((XGL_UPDATE_BUFFERS*)pUpdateChain)->pBufferViews[i]->view;')
+ ud_body.append(' *pLocalView = remap(((XGL_UPDATE_BUFFERS*)pUpdateChain)->pBufferViews[i]->view);')
ud_body.append(' }')
ud_body.append(' break;')
ud_body.append(' case XGL_STRUCTURE_TYPE_UPDATE_AS_COPY:')
ud_body.append(' if (NULL == pLocalUpdateChainHEAD) {')
ud_body.append(' pLocalUpdateChainHEAD = pLocalUpdateChain;')
ud_body.append(' }')
+ ud_body.append(' if (pPrev) {')
+ ud_body.append(' pPrev->pNext = pLocalUpdateChain;')
+ ud_body.append(' }')
+ ud_body.append(' pPrev = (XGL_UPDATE_SAMPLERS*)pLocalUpdateChain;')
ud_body.append(' pUpdateChain = (XGL_UPDATE_SAMPLERS*)pUpdateChain->pNext;')
- ud_body.append(' pLocalUpdateChain = (void*)((XGL_UPDATE_SAMPLERS*)pLocalUpdateChain)->pNext;')
ud_body.append(' }')
ud_body.append(' m_xglFuncs.real_xglUpdateDescriptors(remap(pPacket->descriptorSet), pLocalUpdateChainHEAD);')
ud_body.append(' pLocalUpdateChain = (XGL_UPDATE_SAMPLERS*)pLocalUpdateChainHEAD;')