Skip to content

Commit

Permalink
Save changes to autoroute
Browse files Browse the repository at this point in the history
  • Loading branch information
rj45 committed May 14, 2024
1 parent 7b3ef6e commit 91918cc
Showing 1 changed file with 2 additions and 42 deletions.
44 changes: 2 additions & 42 deletions src/autoroute/autoroute.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,17 @@

#define RT_PADDING 10.0f

typedef struct AnchorEnds {
uint32_t start;
uint32_t end;
} AnchorEnds;

struct AutoRoute {
CircuitView *view;

RT_Net *nets;
RT_Endpoint *endpoints;
RT_Waypoint *waypoints;

RT_BoundingBox *boxes;
AnchorEnds *anchorEnds;

arr(RT_Anchor) anchors;

arr(RT_Point) portPoints;
arr(uint32_t) portPointStarts;
arr(uint16_t) pathLengths;
arr(uint32_t) pathLengthStarts;

uint16_t threadCount;
size_t vertBufferCapacity;
RT_Graph *graph;

// arr(RT_VertexBuffer) vertexBuffers;
};

void autoroute_global_init() {
Expand All @@ -69,9 +53,6 @@ AutoRoute *autoroute_create(CircuitView *view) {
};
smap_add_synced_array(
&view->circuit.sm.components, (void **)&ar->boxes, sizeof(*ar->boxes));
smap_add_synced_array(
&view->circuit.sm.components, (void **)&ar->anchorEnds,
sizeof(*ar->anchorEnds));
smap_add_synced_array(
&view->circuit.sm.nets, (void **)&ar->nets, sizeof(*ar->nets));
smap_add_synced_array(
Expand All @@ -81,36 +62,15 @@ AutoRoute *autoroute_create(CircuitView *view) {
&view->circuit.sm.waypoints, (void **)&ar->waypoints,
sizeof(*ar->waypoints));

RT_Result res = RT_get_thread_count(&ar->threadCount);
RT_Result res = RT_graph_new(&ar->graph);
assert(res == RT_RESULT_SUCCESS);

res = RT_graph_new(&ar->graph);
assert(res == RT_RESULT_SUCCESS);

ar->vertBufferCapacity = 1024;

// for (size_t i = 0; i < ar->threadCount; i++) {
// arrput(
// ar->vertexBuffers,
// ((struct RT_VertexBuffer){
// .vertices = malloc(ar->vertBufferCapacity * sizeof(RT_Vertex)),
// .vertex_count = 0,
// }));
// }

return ar;
}

void autoroute_free(AutoRoute *ar) {
arrfree(ar->anchors);
arrfree(ar->portPointStarts);
arrfree(ar->portPoints);
arrfree(ar->pathLengths);
arrfree(ar->pathLengthStarts);
// for (size_t i = 0; i < arrlen(ar->vertexBuffers); i++) {
// free(ar->vertexBuffers[i].vertices);
// }
// arrfree(ar->vertexBuffers);

RT_Result res = RT_graph_free(ar->graph);
assert(res == RT_RESULT_SUCCESS);
free(ar);
Expand Down

0 comments on commit 91918cc

Please sign in to comment.