mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-02 09:31:12 +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
|
portal_t *base; ///< portal for which this thread is being run
|
||||||
pstack_t pstack_head;
|
pstack_t pstack_head;
|
||||||
sep_t *sep_freelist; ///< per-thread list of free separators
|
sep_t *sep_freelist; ///< per-thread list of free separators
|
||||||
|
set_pool_t set_pool;
|
||||||
} threaddata_t;
|
} threaddata_t;
|
||||||
|
|
||||||
extern int numportals;
|
extern int numportals;
|
||||||
|
|
|
@ -75,15 +75,13 @@ CheckStack (cluster_t *cluster, threaddata_t *thread)
|
||||||
}
|
}
|
||||||
|
|
||||||
static pstack_t *
|
static pstack_t *
|
||||||
new_stack (void)
|
new_stack (threaddata_t *td)
|
||||||
{
|
{
|
||||||
pstack_t *stack;
|
pstack_t *stack;
|
||||||
|
|
||||||
stack = malloc (sizeof (pstack_t));
|
stack = malloc (sizeof (pstack_t));
|
||||||
stack->next = 0;
|
stack->next = 0;
|
||||||
LOCK;
|
stack->mightsee = set_new_size_r (&td->set_pool, portalclusters);
|
||||||
stack->mightsee = set_new_size (portalclusters);
|
|
||||||
UNLOCK;
|
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +284,7 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
|
||||||
thread->stats.chains++;
|
thread->stats.chains++;
|
||||||
|
|
||||||
if (!prevstack->next)
|
if (!prevstack->next)
|
||||||
prevstack->next = new_stack ();
|
prevstack->next = new_stack (thread);
|
||||||
stack = prevstack->next;
|
stack = prevstack->next;
|
||||||
stack->cluster = 0;
|
stack->cluster = 0;
|
||||||
|
|
||||||
|
@ -465,9 +463,10 @@ PortalFlow (threaddata_t *data, portal_t *portal)
|
||||||
if (portal->status != stat_selected)
|
if (portal->status != stat_selected)
|
||||||
Sys_Error ("PortalFlow: reflowed");
|
Sys_Error ("PortalFlow: reflowed");
|
||||||
portal->status = stat_working;
|
portal->status = stat_working;
|
||||||
portal->visbits = set_new_size (portalclusters);
|
|
||||||
UNLOCK;
|
UNLOCK;
|
||||||
|
|
||||||
|
portal->visbits = set_new_size_r (&data->set_pool, portalclusters);
|
||||||
|
|
||||||
data->clustervis = portal->visbits;
|
data->clustervis = portal->visbits;
|
||||||
data->base = portal;
|
data->base = portal;
|
||||||
|
|
||||||
|
|
|
@ -363,6 +363,7 @@ LeafThread (void *_thread)
|
||||||
threaddata_t data;
|
threaddata_t data;
|
||||||
|
|
||||||
memset (&data, 0, sizeof (data));
|
memset (&data, 0, sizeof (data));
|
||||||
|
set_pool_init (&data.set_pool);
|
||||||
do {
|
do {
|
||||||
portal = GetNextPortal ();
|
portal = GetNextPortal ();
|
||||||
if (!portal)
|
if (!portal)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue