rc_body.append(' XGL_SHADER *addr;')
rc_body.append(' XGL_SHADER val;')
rc_body.append(' };')
- rc_body.append(' struct eventPair {')
- rc_body.append(' XGL_EVENT *addr;')
- rc_body.append(' XGL_EVENT val;')
- rc_body.append(' };')
rc_body.append(' struct validationMsg {')
rc_body.append(' XGL_VALIDATION_LEVEL validationLevel;')
rc_body.append(' XGL_BASE_OBJECT srcObject;')
def _gen_replay_cmd_wait_events(self):
cwe_body = []
- cwe_body.append(' struct eventPair saveEvent[100];')
- cwe_body.append(' uint32_t idx = 0;')
+ cwe_body.append(' XGL_EVENT saveEvent[100];')
+ cwe_body.append(' uint32_t idx, numRemapBuf=0, numRemapImg=0;')
cwe_body.append(' assert(pPacket->pWaitInfo && pPacket->pWaitInfo->eventCount <= 100);')
cwe_body.append(' for (idx = 0; idx < pPacket->pWaitInfo->eventCount; idx++)')
cwe_body.append(' {')
- cwe_body.append(' saveEvent[idx].val = pPacket->pWaitInfo->pEvents[idx];')
- cwe_body.append(' saveEvent[idx].addr = (XGL_EVENT*)&pPacket->pWaitInfo->pEvents[idx];')
- cwe_body.append(' *(saveEvent[idx].addr) = remap(pPacket->pWaitInfo->pEvents[idx]);')
+ cwe_body.append(' XGL_EVENT *pEvent = (XGL_EVENT *) &(pPacket->pWaitInfo->pEvents[idx]);')
+ cwe_body.append(' saveEvent[idx] = pPacket->pWaitInfo->pEvents[idx];')
+ cwe_body.append(' *pEvent = remap(pPacket->pWaitInfo->pEvents[idx]);')
+ cwe_body.append(' }')
+ cwe_body.append('')
+ cwe_body.append(' XGL_BUFFER saveBuf[100];')
+ cwe_body.append(' XGL_IMAGE saveImg[100];')
+ cwe_body.append(' for (idx = 0; idx < pPacket->pWaitInfo->memBarrierCount; idx++)')
+ cwe_body.append(' {')
+ cwe_body.append(' XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];')
+ cwe_body.append(' assert(pNext);')
+ cwe_body.append(' if (pNext->sType == XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER) {')
+ cwe_body.append(' XGL_BUFFER_MEMORY_BARRIER *pNextBuf = (XGL_BUFFER_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];')
+ cwe_body.append(' assert(numRemapBuf < 100);')
+ cwe_body.append(' saveBuf[numRemapBuf++] = pNextBuf->buffer;')
+ cwe_body.append(' pNextBuf->buffer = remap(pNextBuf->buffer);')
+ cwe_body.append(' } else if (pNext->sType == XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {')
+ cwe_body.append(' XGL_IMAGE_MEMORY_BARRIER *pNextImg = (XGL_IMAGE_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];')
+ cwe_body.append(' assert(numRemapImg < 100);')
+ cwe_body.append(' saveImg[numRemapImg++] = pNextImg->image;')
+ cwe_body.append(' pNextImg->image = remap(pNextImg->image);')
+ cwe_body.append(' }')
cwe_body.append(' }')
cwe_body.append(' m_xglFuncs.real_xglCmdWaitEvents(remap(pPacket->cmdBuffer), pPacket->pWaitInfo);')
- cwe_body.append(' for (uint32_t i = 0; i < idx; i++)')
- cwe_body.append(' *(saveEvent[i].addr) = saveEvent[i].val;')
+ cwe_body.append(' for (idx = 0; idx < pPacket->pWaitInfo->memBarrierCount; idx++) {')
+ cwe_body.append(' XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];')
+ cwe_body.append(' if (pNext->sType == XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER) {')
+ cwe_body.append(' XGL_BUFFER_MEMORY_BARRIER *pNextBuf = (XGL_BUFFER_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];')
+ cwe_body.append(' pNextBuf->buffer = saveBuf[idx];')
+ cwe_body.append(' } else if (pNext->sType == XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {')
+ cwe_body.append(' XGL_IMAGE_MEMORY_BARRIER *pNextImg = (XGL_IMAGE_MEMORY_BARRIER *) pPacket->pWaitInfo->ppMemBarriers[idx];')
+ cwe_body.append(' pNextImg->image = saveImg[idx];')
+ cwe_body.append(' }')
+ cwe_body.append(' }')
+ cwe_body.append(' for (idx = 0; idx < pPacket->pWaitInfo->eventCount; idx++) {')
+ cwe_body.append(' XGL_EVENT *pEvent = (XGL_EVENT *) &(pPacket->pWaitInfo->pEvents[idx]);')
+ cwe_body.append(' *pEvent = saveEvent[idx];')
+ cwe_body.append(' }')
return "\n".join(cwe_body)
+ def _gen_replay_cmd_pipeline_barrier(self):
+ cpb_body = []
+ cpb_body.append(' uint32_t idx, numRemapBuf=0, numRemapImg=0;')
+ cpb_body.append(' XGL_BUFFER saveBuf[100];')
+ cpb_body.append(' XGL_IMAGE saveImg[100];')
+ cpb_body.append(' for (idx = 0; idx < pPacket->pBarrier->memBarrierCount; idx++)')
+ cpb_body.append(' {')
+ cpb_body.append(' XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];')
+ cpb_body.append(' assert(pNext);')
+ cpb_body.append(' if (pNext->sType == XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER) {')
+ cpb_body.append(' XGL_BUFFER_MEMORY_BARRIER *pNextBuf = (XGL_BUFFER_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];')
+ cpb_body.append(' assert(numRemapBuf < 100);')
+ cpb_body.append(' saveBuf[numRemapBuf++] = pNextBuf->buffer;')
+ cpb_body.append(' pNextBuf->buffer = remap(pNextBuf->buffer);')
+ cpb_body.append(' } else if (pNext->sType == XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {')
+ cpb_body.append(' XGL_IMAGE_MEMORY_BARRIER *pNextImg = (XGL_IMAGE_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];')
+ cpb_body.append(' assert(numRemapImg < 100);')
+ cpb_body.append(' saveImg[numRemapImg++] = pNextImg->image;')
+ cpb_body.append(' pNextImg->image = remap(pNextImg->image);')
+ cpb_body.append(' }')
+ cpb_body.append(' }')
+ cpb_body.append(' m_xglFuncs.real_xglCmdPipelineBarrier(remap(pPacket->cmdBuffer), pPacket->pBarrier);')
+ cpb_body.append(' for (idx = 0; idx < pPacket->pBarrier->memBarrierCount; idx++) {')
+ cpb_body.append(' XGL_MEMORY_BARRIER *pNext = (XGL_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];')
+ cpb_body.append(' if (pNext->sType == XGL_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER) {')
+ cpb_body.append(' XGL_BUFFER_MEMORY_BARRIER *pNextBuf = (XGL_BUFFER_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];')
+ cpb_body.append(' pNextBuf->buffer = saveBuf[idx];')
+ cpb_body.append(' } else if (pNext->sType == XGL_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {')
+ cpb_body.append(' XGL_IMAGE_MEMORY_BARRIER *pNextImg = (XGL_IMAGE_MEMORY_BARRIER *) pPacket->pBarrier->ppMemBarriers[idx];')
+ cpb_body.append(' pNextImg->image = saveImg[idx];')
+ cpb_body.append(' }')
+ cpb_body.append(' }')
+ return "\n".join(cpb_body)
+
def _gen_replay_create_framebuffer(self):
cf_body = []
cf_body.append(' XGL_FRAMEBUFFER_CREATE_INFO *pInfo = (XGL_FRAMEBUFFER_CREATE_INFO *) pPacket->pCreateInfo;')
'CmdBindDynamicMemoryView': self._gen_replay_bind_dynamic_memory_view,
'UpdateDescriptors': self._gen_replay_update_descriptors,
'CreateDescriptorSetLayout': self._gen_replay_create_descriptor_set_layout,
- 'CmdWaitEvents': self._gen_replay_cmd_wait_events}
+ 'CmdWaitEvents': self._gen_replay_cmd_wait_events,
+ 'CmdPipelineBarrier': self._gen_replay_cmd_pipeline_barrier}
# TODO : Need to guard CreateInstance with "if (!m_display->m_initedXGL)" check
# Despite returning a value, don't check these funcs b/c custom code includes check already
custom_check_ret_val = ['EnumerateGpus', 'GetGpuInfo', 'CreateDevice', 'GetExtensionSupport']