mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 01:41:10 +00:00
Use the recursive set allocator for mightsee.
This completely removes the lock used to protect the set allocation code while keeping the use of the set api clean.
This commit is contained in:
parent
247f3be0c0
commit
1c20a49dba
3 changed files with 7 additions and 6 deletions
|
@ -129,6 +129,7 @@ typedef struct threaddata_s {
|
|||
portal_t *base; ///< portal for which this thread is being run
|
||||
pstack_t pstack_head;
|
||||
sep_t *sep_freelist; ///< per-thread list of free separators
|
||||
set_pool_t set_pool;
|
||||
} threaddata_t;
|
||||
|
||||
extern int numportals;
|
||||
|
|
|
@ -75,15 +75,13 @@ CheckStack (cluster_t *cluster, threaddata_t *thread)
|
|||
}
|
||||
|
||||
static pstack_t *
|
||||
new_stack (void)
|
||||
new_stack (threaddata_t *td)
|
||||
{
|
||||
pstack_t *stack;
|
||||
|
||||
stack = malloc (sizeof (pstack_t));
|
||||
stack->next = 0;
|
||||
LOCK;
|
||||
stack->mightsee = set_new_size (portalclusters);
|
||||
UNLOCK;
|
||||
stack->mightsee = set_new_size_r (&td->set_pool, portalclusters);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
@ -286,7 +284,7 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
|
|||
thread->stats.chains++;
|
||||
|
||||
if (!prevstack->next)
|
||||
prevstack->next = new_stack ();
|
||||
prevstack->next = new_stack (thread);
|
||||
stack = prevstack->next;
|
||||
stack->cluster = 0;
|
||||
|
||||
|
@ -465,9 +463,10 @@ PortalFlow (threaddata_t *data, portal_t *portal)
|
|||
if (portal->status != stat_selected)
|
||||
Sys_Error ("PortalFlow: reflowed");
|
||||
portal->status = stat_working;
|
||||
portal->visbits = set_new_size (portalclusters);
|
||||
UNLOCK;
|
||||
|
||||
portal->visbits = set_new_size_r (&data->set_pool, portalclusters);
|
||||
|
||||
data->clustervis = portal->visbits;
|
||||
data->base = portal;
|
||||
|
||||
|
|
|
@ -363,6 +363,7 @@ LeafThread (void *_thread)
|
|||
threaddata_t data;
|
||||
|
||||
memset (&data, 0, sizeof (data));
|
||||
set_pool_init (&data.set_pool);
|
||||
do {
|
||||
portal = GetNextPortal ();
|
||||
if (!portal)
|
||||
|
|
Loading…
Reference in a new issue