mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Use a hash table for finding Polymer buckets
git-svn-id: https://svn.eduke32.com/eduke32@5479 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
242b6bf870
commit
61059816b8
2 changed files with 14 additions and 10 deletions
|
@ -2206,24 +2206,26 @@ static void polymer_emptybuckets(void)
|
|||
prcanbucket = 0;
|
||||
}
|
||||
|
||||
static hashtable_t h_buckets ={ 2048, NULL };
|
||||
|
||||
static _prbucket* polymer_findbucket(int16_t tilenum, char pal)
|
||||
{
|
||||
_prbucket *bucketptr = prbuckethead;
|
||||
char propstr[16];
|
||||
|
||||
Bsprintf(propstr, "%d_%d", tilenum, pal);
|
||||
|
||||
_prbucket *bucketptr = prbuckethead ? (_prbucket *)hash_find(&h_buckets, propstr) : NULL;
|
||||
|
||||
// find bucket
|
||||
while (bucketptr != NULL)
|
||||
{
|
||||
if (bucketptr->tilenum == tilenum && bucketptr->pal == pal)
|
||||
break;
|
||||
|
||||
bucketptr = bucketptr->next;
|
||||
}
|
||||
|
||||
// no buckets or no bucket found, create one
|
||||
if (bucketptr == NULL)
|
||||
if (bucketptr == NULL || (intptr_t)bucketptr == -1)
|
||||
{
|
||||
bucketptr = (_prbucket *)Xmalloc(sizeof (_prbucket));
|
||||
|
||||
if (h_buckets.items == NULL)
|
||||
hash_init(&h_buckets);
|
||||
|
||||
// insert, since most likely to use same pattern next frame
|
||||
// will need to reorder by MRU first every once in a while
|
||||
// or move to hashing lookup
|
||||
|
@ -2238,6 +2240,8 @@ static _prbucket* polymer_findbucket(int16_t tilenum, char pal)
|
|||
bucketptr->count = 0;
|
||||
bucketptr->buffersize = 1024;
|
||||
bucketptr->indices = (GLuint *)Xmalloc(bucketptr->buffersize * sizeof(GLuint));
|
||||
|
||||
hash_add(&h_buckets, propstr, (intptr_t)bucketptr, 1);
|
||||
}
|
||||
|
||||
return bucketptr;
|
||||
|
|
|
@ -5778,7 +5778,7 @@ void polymost_initosdfuncs(void)
|
|||
{ "r_pr_verbosity", "verbosity level of the polymer renderer", (void *) &pr_verbosity, CVAR_INT, 0, 3 },
|
||||
{ "r_pr_wireframe", "toggles wireframe mode", (void *) &pr_wireframe, CVAR_INT | CVAR_NOSAVE, 0, 1 },
|
||||
{ "r_pr_vbos", "contols Vertex Buffer Object usage. 0: no VBOs. 1: VBOs for map data. 2: VBOs for model data.", (void *) &pr_vbos, CVAR_INT | CVAR_RESTARTVID, 0, 2 },
|
||||
{ "r_pr_buckets", "controls batching of primitives. 0: no batching. 1: buckets of materials.", (void *)&pr_buckets, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
|
||||
{ "r_pr_buckets", "controls batching of primitives. 0: no batching. 1: buckets of materials.", (void *)&pr_buckets, CVAR_BOOL | CVAR_NOSAVE | CVAR_RESTARTVID, 0, 1 },
|
||||
{ "r_pr_gpusmoothing", "toggles model animation interpolation", (void *)&pr_gpusmoothing, CVAR_INT, 0, 1 },
|
||||
{ "r_pr_overrideparallax", "overrides parallax mapping scale and bias values with values from the pr_parallaxscale and pr_parallaxbias cvars; use it to fine-tune DEF tokens", (void *) &pr_overrideparallax, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
|
||||
{ "r_pr_parallaxscale", "overriden parallax mapping offset scale", (void *) &pr_parallaxscale, CVAR_FLOAT | CVAR_NOSAVE, -10, 10 },
|
||||
|
|
Loading…
Reference in a new issue