layers: intercept xglCmdBindVertexData() in DrawState and MemTracker
authorChia-I Wu <olv@lunarg.com>
Mon, 5 Jan 2015 05:42:56 +0000 (13:42 +0800)
committerCourtney Goeltzenleuchter <courtney@LunarG.com>
Thu, 5 Feb 2015 00:58:04 +0000 (17:58 -0700)
layers/draw_state.c
layers/mem_tracker.c

index c821a1d..e8f432c 100644 (file)
@@ -2039,6 +2039,8 @@ XGL_LAYER_EXPORT XGL_VOID* XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL
         return xglCmdBindDescriptorSet;
     else if (!strncmp("xglCmdBindDynamicMemoryView", funcName, sizeof("xglCmdBindDynamicMemoryView")))
         return xglCmdBindDynamicMemoryView;
+    else if (!strncmp("xglCmdBindVertexData", funcName, sizeof("xglCmdBindVertexData")))
+        return xglCmdBindVertexData;
     else if (!strncmp("xglCmdBindIndexData", funcName, sizeof("xglCmdBindIndexData")))
         return xglCmdBindIndexData;
     else if (!strncmp("xglCmdBindAttachments", funcName, sizeof("xglCmdBindAttachments")))
index a49b543..a846308 100644 (file)
@@ -862,8 +862,6 @@ static void initMemTracker()
 
     GetProcAddrType fpGetProcAddr = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetProcAddr");
     nextTable.GetProcAddr = fpGetProcAddr;
-
-    nextTable.CmdBindVertexData = NULL;
 }
 
 
@@ -1449,6 +1447,17 @@ XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindDynamicMemoryView(XGL_CMD_BUFFER cmdB
     nextTable.CmdBindDynamicMemoryView(cmdBuffer, pipelineBindPoint, pMemView);
 }
 
+XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindVertexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT binding)
+{
+    // Track this memory. What exactly is this call doing?
+    if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) {
+        char str[1024];
+        sprintf(str, "In xglCmdBindVertexData() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer);
+        layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str);
+    }
+    nextTable.CmdBindVertexData(cmdBuffer, mem, offset, binding);
+}
+
 XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindIndexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType)
 {
     // Track this memory. What exactly is this call doing?
@@ -2036,6 +2045,8 @@ XGL_LAYER_EXPORT XGL_VOID* XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL
         return xglCmdBindDescriptorSet;
     else if (!strncmp("xglCmdBindDynamicMemoryView", funcName, sizeof("xglCmdBindDynamicMemoryView")))
         return xglCmdBindDynamicMemoryView;
+    else if (!strncmp("xglCmdBindVertexData", funcName, sizeof("xglCmdBindVertexData")))
+        return xglCmdBindVertexData;
     else if (!strncmp("xglCmdBindIndexData", funcName, sizeof("xglCmdBindIndexData")))
         return xglCmdBindIndexData;
     else if (!strncmp("xglCmdBindAttachments", funcName, sizeof("xglCmdBindAttachments")))