diff options
| author | Jon Ashburn <jon@lunarg.com> | 2015-07-06 14:17:01 -0600 |
|---|---|---|
| committer | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-07-07 17:57:49 -0600 |
| commit | 4e5235139fc1327d5d8a93ae4c079738578e515e (patch) | |
| tree | 61d881e67f5348086cab6cde32a45434fe8537f3 | |
| parent | 05adc95d81a95572016d67c953a59cf3e6bcf8f2 (diff) | |
| download | usermoji-4e5235139fc1327d5d8a93ae4c079738578e515e.tar.xz | |
DrawState: Remove the DOT file dumping and GraphViz stuff
| -rw-r--r-- | layers/draw_state.cpp | 288 |
1 files changed, 2 insertions, 286 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index 41a34501..1f8b4056 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -1138,234 +1138,7 @@ static void printPipeline(const VkCmdBuffer cb) } } } -// Common Dot dumping code -static void dsCoreDumpDot(const VkDescriptorSet ds, FILE* pOutFile) -{ -#if 0 - SET_NODE* pSet = getSetNode(ds); - if (pSet) { - POOL_NODE* pPool = getPoolNode(pSet->pool); - char tmp_str[4*1024]; - fprintf(pOutFile, "subgraph cluster_DescriptorPool\n{\nlabel=\"Descriptor Pool\"\n"); - sprintf(tmp_str, "Pool (%p)", pPool->pool); - char* pGVstr = vk_gv_print_vkdescriptorpoolcreateinfo(&pPool->createInfo, tmp_str); - fprintf(pOutFile, "%s", pGVstr); - free(pGVstr); - fprintf(pOutFile, "subgraph cluster_DescriptorSet\n{\nlabel=\"Descriptor Set (%p)\"\n", pSet->set); - sprintf(tmp_str, "Descriptor Set (%p)", pSet->set); - LAYOUT_NODE* pLayout = pSet->pLayout; - uint32_t layout_index = 0; - ++layout_index; - sprintf(tmp_str, "LAYOUT%u", layout_index); - pGVstr = vk_gv_print_vkdescriptorsetlayoutcreateinfo(&pLayout->createInfo, tmp_str); - fprintf(pOutFile, "%s", pGVstr); - free(pGVstr); - if (pSet->pUpdateStructs) { - pGVstr = dynamic_gv_display(pSet->pUpdateStructs, "Descriptor Updates"); - fprintf(pOutFile, "%s", pGVstr); - free(pGVstr); - } - if (pSet->ppDescriptors) { - fprintf(pOutFile, "\"DESCRIPTORS\" [\nlabel=<<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\"> <TR><TD COLSPAN=\"2\" PORT=\"desc\">DESCRIPTORS</TD></TR>"); - uint32_t i = 0; - for (i=0; i < pSet->descriptorCount; i++) { - if (pSet->ppDescriptors[i]) { - fprintf(pOutFile, "<TR><TD PORT=\"slot%u\">slot%u</TD><TD>%s</TD></TR>", i, i, string_VkStructureType(pSet->ppDescriptors[i]->sType)); - } - } -#define NUM_COLORS 7 - vector<string> edgeColors; - edgeColors.push_back("0000ff"); - edgeColors.push_back("ff00ff"); - edgeColors.push_back("ffff00"); - edgeColors.push_back("00ff00"); - edgeColors.push_back("000000"); - edgeColors.push_back("00ffff"); - edgeColors.push_back("ff0000"); - uint32_t colorIdx = 0; - fprintf(pOutFile, "</TABLE>>\n];\n"); - // Now add the views that are mapped to active descriptors - VkUpdateSamplers* pUS = NULL; - VkUpdateSamplerTextures* pUST = NULL; - VkUpdateImages* pUI = NULL; - VkUpdateBuffers* pUB = NULL; - VkUpdateAsCopy* pUAC = NULL; - VkSamplerCreateInfo* pSCI = NULL; - VkImageViewCreateInfo* pIVCI = NULL; - VkBufferViewCreateInfo* pBVCI = NULL; - void** ppNextPtr = NULL; - void* pSaveNext = NULL; - for (i=0; i < pSet->descriptorCount; i++) { - if (pSet->ppDescriptors[i]) { - switch (pSet->ppDescriptors[i]->sType) - { - case VK_STRUCTURE_TYPE_UPDATE_SAMPLERS: - pUS = (VkUpdateSamplers*)pSet->ppDescriptors[i]; - pSCI = getSamplerCreateInfo(pUS->pSamplers[i-pUS->arrayIndex]); - if (pSCI) { - sprintf(tmp_str, "SAMPLER%u", i); - fprintf(pOutFile, "%s", vk_gv_print_vksamplercreateinfo(pSCI, tmp_str)); - fprintf(pOutFile, "\"DESCRIPTORS\":slot%u -> \"%s\" [color=\"#%s\"];\n", i, tmp_str, edgeColors[colorIdx].c_str()); - } - break; - case VK_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES: - pUST = (VkUpdateSamplerTextures*)pSet->ppDescriptors[i]; - pSCI = getSamplerCreateInfo(pUST->pSamplerImageViews[i-pUST->arrayIndex].sampler); - if (pSCI) { - sprintf(tmp_str, "SAMPLER%u", i); - fprintf(pOutFile, "%s", vk_gv_print_vksamplercreateinfo(pSCI, tmp_str)); - fprintf(pOutFile, "\"DESCRIPTORS\":slot%u -> \"%s\" [color=\"#%s\"];\n", i, tmp_str, edgeColors[colorIdx].c_str()); - } - pIVCI = getImageViewCreateInfo(pUST->pSamplerImageViews[i-pUST->arrayIndex].pImageView->view); - if (pIVCI) { - sprintf(tmp_str, "IMAGE_VIEW%u", i); - fprintf(pOutFile, "%s", vk_gv_print_vkimageviewcreateinfo(pIVCI, tmp_str)); - fprintf(pOutFile, "\"DESCRIPTORS\":slot%u -> \"%s\" [color=\"#%s\"];\n", i, tmp_str, edgeColors[colorIdx].c_str()); - } - break; - case VK_STRUCTURE_TYPE_UPDATE_IMAGES: - pUI = (VkUpdateImages*)pSet->ppDescriptors[i]; - pIVCI = getImageViewCreateInfo(pUI->pImageViews[i-pUI->arrayIndex].view); - if (pIVCI) { - sprintf(tmp_str, "IMAGE_VIEW%u", i); - fprintf(pOutFile, "%s", vk_gv_print_vkimageviewcreateinfo(pIVCI, tmp_str)); - fprintf(pOutFile, "\"DESCRIPTORS\":slot%u -> \"%s\" [color=\"#%s\"];\n", i, tmp_str, edgeColors[colorIdx].c_str()); - } - break; - case VK_STRUCTURE_TYPE_UPDATE_BUFFERS: - pUB = (VkUpdateBuffers*)pSet->ppDescriptors[i]; - pBVCI = getBufferViewCreateInfo(pUB->pBufferViews[i-pUB->arrayIndex].view); - if (pBVCI) { - sprintf(tmp_str, "BUFFER_VIEW%u", i); - fprintf(pOutFile, "%s", vk_gv_print_vkbufferviewcreateinfo(pBVCI, tmp_str)); - fprintf(pOutFile, "\"DESCRIPTORS\":slot%u -> \"%s\" [color=\"#%s\"];\n", i, tmp_str, edgeColors[colorIdx].c_str()); - } - break; - case VK_STRUCTURE_TYPE_UPDATE_AS_COPY: - pUAC = (VkUpdateAsCopy*)pSet->ppDescriptors[i]; - // TODO : Need to validate this code - // Save off pNext and set to NULL while printing this struct, then restore it - ppNextPtr = (void**)&pUAC->pNext; - pSaveNext = *ppNextPtr; - *ppNextPtr = NULL; - sprintf(tmp_str, "UPDATE_AS_COPY%u", i); - fprintf(pOutFile, "%s", vk_gv_print_vkupdateascopy(pUAC, tmp_str)); - fprintf(pOutFile, "\"DESCRIPTORS\":slot%u -> \"%s\" [color=\"#%s\"];\n", i, tmp_str, edgeColors[colorIdx].c_str()); - // Restore next ptr - *ppNextPtr = pSaveNext; - break; - default: - break; - } - colorIdx = (colorIdx+1) % NUM_COLORS; - } - } - } - fprintf(pOutFile, "}\n"); - fprintf(pOutFile, "}\n"); - } -#endif -} -// Dump subgraph w/ DS info -static void dsDumpDot(const VkCmdBuffer cb, FILE* pOutFile) -{ - GLOBAL_CB_NODE* pCB = getCBNode(cb); - if (pCB && pCB->lastBoundDescriptorSet) { - dsCoreDumpDot(pCB->lastBoundDescriptorSet, pOutFile); - } -} -// Dump a GraphViz dot file showing the Cmd Buffers -static void cbDumpDotFile(string outFileName) -{ - // Print CB Chain for each CB - FILE* pOutFile; - pOutFile = fopen(outFileName.c_str(), "w"); - fprintf(pOutFile, "digraph g {\ngraph [\nrankdir = \"TB\"\n];\nnode [\nfontsize = \"16\"\nshape = \"plaintext\"\n];\nedge [\n];\n"); - fprintf(pOutFile, "subgraph cluster_cmdBuffers\n{\nlabel=\"Command Buffers\"\n"); - GLOBAL_CB_NODE* pCB = NULL; - for (uint32_t i = 0; i < NUM_COMMAND_BUFFERS_TO_DISPLAY; i++) { - pCB = g_pLastTouchedCB[i]; - if (pCB && pCB->pCmds.size() > 0) { - fprintf(pOutFile, "subgraph cluster_cmdBuffer%u\n{\nlabel=\"Command Buffer #%u\"\n", i, i); - uint32_t instNum = 0; - vector<CMD_NODE*> cmd_list = pCB->pCmds; - for (vector<CMD_NODE*>::iterator ii= cmd_list.begin(); ii!= cmd_list.end(); ++ii) { - if (instNum) { - fprintf(pOutFile, "\"CB%pCMD%u\" -> \"CB%pCMD%u\" [];\n", (void*)pCB->cmdBuffer, instNum-1, (void*)pCB->cmdBuffer, instNum); - } - if (pCB == g_lastGlobalCB) { - fprintf(pOutFile, "\"CB%pCMD%u\" [\nlabel=<<TABLE BGCOLOR=\"#00FF00\" BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\"> <TR><TD>CMD#</TD><TD>%u</TD></TR><TR><TD>CMD Type</TD><TD>%s</TD></TR></TABLE>>\n];\n", (void*)pCB->cmdBuffer, instNum, instNum, cmdTypeToString((*ii)->type).c_str()); - } else { - fprintf(pOutFile, "\"CB%pCMD%u\" [\nlabel=<<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\"> <TR><TD>CMD#</TD><TD>%u</TD></TR><TR><TD>CMD Type</TD><TD>%s</TD></TR></TABLE>>\n];\n", (void*)pCB->cmdBuffer, instNum, instNum, cmdTypeToString((*ii)->type).c_str()); - } - ++instNum; - } - fprintf(pOutFile, "}\n"); - } - } - fprintf(pOutFile, "}\n"); - fprintf(pOutFile, "}\n"); // close main graph "g" - fclose(pOutFile); -} -// Dump a GraphViz dot file showing the pipeline for last bound global state -static void dumpGlobalDotFile(char *outFileName) -{ - PIPELINE_NODE *pPipeTrav = g_lastBoundPipeline; - if (pPipeTrav) { - FILE* pOutFile; - pOutFile = fopen(outFileName, "w"); - fprintf(pOutFile, "digraph g {\ngraph [\nrankdir = \"TB\"\n];\nnode [\nfontsize = \"16\"\nshape = \"plaintext\"\n];\nedge [\n];\n"); - fprintf(pOutFile, "subgraph cluster_dynamicState\n{\nlabel=\"Dynamic State\"\n"); - char* pGVstr = NULL; - for (uint32_t i = 0; i < VK_NUM_STATE_BIND_POINT; i++) { - if (g_lastBoundDynamicState[i] && g_lastBoundDynamicState[i]->pCreateInfo) { - pGVstr = dynamic_gv_display(g_lastBoundDynamicState[i]->pCreateInfo, string_VkStateBindPoint((VkStateBindPoint)i)); - fprintf(pOutFile, "%s", pGVstr); - free(pGVstr); - } - } - fprintf(pOutFile, "}\n"); // close dynamicState subgraph - fprintf(pOutFile, "subgraph cluster_PipelineStateObject\n{\nlabel=\"Pipeline State Object\"\n"); - pGVstr = vk_gv_print_vkgraphicspipelinecreateinfo(&pPipeTrav->graphicsPipelineCI, "PSO HEAD"); - fprintf(pOutFile, "%s", pGVstr); - free(pGVstr); - fprintf(pOutFile, "}\n"); - dsCoreDumpDot(g_lastBoundDescriptorSet, pOutFile); - fprintf(pOutFile, "}\n"); // close main graph "g" - fclose(pOutFile); - } -} -// Dump a GraphViz dot file showing the pipeline for a given CB -static void dumpDotFile(const VkCmdBuffer cb, string outFileName) -{ - GLOBAL_CB_NODE* pCB = getCBNode(cb); - if (pCB) { - PIPELINE_NODE *pPipeTrav = getPipeline(pCB->lastBoundPipeline); - if (pPipeTrav) { - FILE* pOutFile; - pOutFile = fopen(outFileName.c_str(), "w"); - fprintf(pOutFile, "digraph g {\ngraph [\nrankdir = \"TB\"\n];\nnode [\nfontsize = \"16\"\nshape = \"plaintext\"\n];\nedge [\n];\n"); - fprintf(pOutFile, "subgraph cluster_dynamicState\n{\nlabel=\"Dynamic State\"\n"); - char* pGVstr = NULL; - for (uint32_t i = 0; i < VK_NUM_STATE_BIND_POINT; i++) { - if (pCB->lastBoundDynamicState[i] && pCB->lastBoundDynamicState[i]->pCreateInfo) { - pGVstr = dynamic_gv_display(pCB->lastBoundDynamicState[i]->pCreateInfo, string_VkStateBindPoint((VkStateBindPoint)i)); - fprintf(pOutFile, "%s", pGVstr); - free(pGVstr); - } - } - fprintf(pOutFile, "}\n"); // close dynamicState subgraph - fprintf(pOutFile, "subgraph cluster_PipelineStateObject\n{\nlabel=\"Pipeline State Object\"\n"); - pGVstr = vk_gv_print_vkgraphicspipelinecreateinfo(&pPipeTrav->graphicsPipelineCI, "PSO HEAD"); - fprintf(pOutFile, "%s", pGVstr); - free(pGVstr); - fprintf(pOutFile, "}\n"); - dsDumpDot(cb, pOutFile); - fprintf(pOutFile, "}\n"); // close main graph "g" - fclose(pOutFile); - } - } -} + // Verify bound Pipeline State Object static bool validateBoundPipeline(const VkCmdBuffer cb) { @@ -1474,21 +1247,7 @@ static void synchAndPrintDSConfig(const VkCmdBuffer cb) printDSConfig(cb); printPipeline(cb); printDynamicState(cb); - static int autoDumpOnce = 0; - if (autoDumpOnce) { - autoDumpOnce = 0; - dumpDotFile(cb, "pipeline_dump.dot"); - cbDumpDotFile("cb_dump.dot"); -#if defined(_WIN32) -// FIXME: NEED WINDOWS EQUIVALENT -#else // WIN32 - // Convert dot to svg if dot available - if(access( "/usr/bin/dot", X_OK) != -1) { - int retval = system("/usr/bin/dot pipeline_dump.dot -Tsvg -o pipeline_dump.svg"); - assert(retval != -1); - } -#endif // WIN32 - } + } static void init_draw_state(layer_data *my_data) @@ -2809,41 +2568,6 @@ VK_LAYER_EXPORT VkResult VKAPI vkDbgSetObjectName(VkDevice device, VkObjectType debug_marker_dispatch_table(device)->DbgSetObjectName(device, objType, object, nameSize, pName); } -// TODO : Want to pass in a cmdBuffer here based on which state to display -void drawStateDumpDotFile(char* outFileName) -{ - // TODO : Currently just setting cmdBuffer based on global var - //dumpDotFile(g_lastDrawStateCmdBuffer, outFileName); - dumpGlobalDotFile(outFileName); -} - -void drawStateDumpCommandBufferDotFile(char* outFileName) -{ - cbDumpDotFile(outFileName); -} - -void drawStateDumpPngFile(const VkDevice device, char* outFileName) -{ -#if defined(_WIN32) -// FIXME: NEED WINDOWS EQUIVALENT - log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, DRAWSTATE_MISSING_DOT_PROGRAM, "DS", - "Cannot execute dot program yet on Windows."); -#else // WIN32 - char dotExe[32] = "/usr/bin/dot"; - if( access(dotExe, X_OK) != -1) { - dumpDotFile(g_lastCmdBuffer[getTIDIndex()], "/tmp/tmp.dot"); - char dotCmd[1024]; - sprintf(dotCmd, "%s /tmp/tmp.dot -Tpng -o %s", dotExe, outFileName); - int retval = system(dotCmd); - assert(retval != -1); - remove("/tmp/tmp.dot"); - } else { - log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, DRAWSTATE_MISSING_DOT_PROGRAM, "DS", - "Cannot execute dot program at (%s) to dump requested %s file.", dotExe, outFileName); - } -#endif // WIN32 -} - VK_LAYER_EXPORT void* VKAPI vkGetDeviceProcAddr(VkDevice dev, const char* funcName) { if (dev == NULL) @@ -2964,14 +2688,6 @@ VK_LAYER_EXPORT void* VKAPI vkGetDeviceProcAddr(VkDevice dev, const char* funcNa return (void*) vkCmdBeginRenderPass; if (!strcmp(funcName, "vkCmdEndRenderPass")) return (void*) vkCmdEndRenderPass; - if (!strcmp(funcName, "vkCmdExecuteCommands")) - return (void*) vkCmdExecuteCommands; - if (!strcmp("drawStateDumpDotFile", funcName)) - return (void*) drawStateDumpDotFile; - if (!strcmp("drawStateDumpCommandBufferDotFile", funcName)) - return (void*) drawStateDumpCommandBufferDotFile; - if (!strcmp("drawStateDumpPngFile", funcName)) - return (void*) drawStateDumpPngFile; VkLayerDispatchTable* pTable = get_dispatch_table(draw_state_device_table_map, dev); if (deviceExtMap.size() == 0 || deviceExtMap[pTable].debug_marker_enabled) |
