• 12
• 14
• 13
• 10
• 11

# Nested for loops hlsl(SOLVED)

This topic is 716 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey guys, so I've been having this issue with compiling my compute shader code for SM5 A* path finding, and by issue I mean my D3D11CompileFromFile has been running for roughly 8 hours. Below is the essence of my code. I wanted to know if anyone has anyways to help me fix the issue, I've done as much as I possibly can to remove branches and for loops, but it still won't compile in a reasonable timespan. The search for the lowest F - Value compiles in about two minutes, but once I add the code for the neighbor search, it is stuck compiling. I have gone through many iterations of the neighbor for loop, from linear searching of data, to instant access through cpu side knowledge of grid layout, from if statements to switch statements, and I still can't seem to fix the issue. a Thank you.



#define MAX_NAV_NODE_SEARCH_COUNT (80)

{

int OpenListCount = 0;

//add the start node to the search open list
.....
OpenListCount++;

for(int nodeCheckIndex = 0; (nodeCheckIndex < MAX_NAV_NODE_SEARCH_COUNT && OpenListCount >0); nodeCheckIndex++)
{
//find the lowest F value
....
for(int i = 0; i < MAX_NAV_NODE_COUNT; i++)
{
{
...
}
}

//traverse the neighbors
for(i = 0; i < CurrAreaData.NeighborCount; i++)
{
//get neighbor data from Structured Buffer
//no a walkable neighbor, continue
if(!NeighborStaticData.IsWalkable)
{
continue;
}

//check what state the neighbor is in
{
//it is in the closed list so ignore it
case NAVPATH_CLOSED:
{
break;
}
//is is in the open list, so update it's nav data
case NAVPATH_OPEN:
{
....
}
//it hasn't been reached yet, so add it to the open list
case NAVPATH_INVALID:
{
....
}
}
}

}

}

Edited by AThompson