072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* $Id$ */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#include <float.h>
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#include "cr_dlm.h"
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#include "cr_mem.h"
072f0b86f23a38efb7454da3144cbce76805be76vboxsync#include "dlm.h"
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* This file defines the display list functions such as NewList, EndList,
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * IsList, DeleteLists, etc.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * Generally, SPUs will call these as needed to implement display lists.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * See the expando, replicate, and tilesort SPUs for examples.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync *
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * The functions which compile GL functions into our display lists are named:
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * void DLM_APIENTRY crdlm_<function name>
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * where <function_name> is the Chromium function name (which in
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * turn is the GL function name with the "gl" prefix removed).
072f0b86f23a38efb7454da3144cbce76805be76vboxsync *
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * All these entry points require that a CRDLMContextState structure
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * be created (with crDLMNewContext()) and assigned to the current
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * thread (with crDLMSetCurrentState()).
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/*
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * Begin compiling a list.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncvoid DLM_APIENTRY
072f0b86f23a38efb7454da3144cbce76805be76vboxsynccrDLMNewList(GLuint listIdentifier, GLenum mode)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync{
072f0b86f23a38efb7454da3144cbce76805be76vboxsync DLMListInfo *listInfo;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRDLMContextState *listState = CURRENT_STATE();
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync /* Error checks: 0 is not a valid identifier, and
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * we can't call NewList if NewList has been called
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * more recently than EndList.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync *
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * The caller is expected to check for an improper
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * mode parameter (GL_INVALID_ENUM), or for a NewList
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * within a glBegin/glEnd (GL_INVALID_OPERATION).
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (listState == NULL)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crWarning("DLM error: NewList(%d,%d) called with no current state (%s line %d)\n",
072f0b86f23a38efb7454da3144cbce76805be76vboxsync (int) listIdentifier, (int) mode, __FILE__, __LINE__);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (listIdentifier == 0)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crdlm_error(__LINE__, __FILE__, GL_INVALID_VALUE,
072f0b86f23a38efb7454da3144cbce76805be76vboxsync "NewList called with a list identifier of 0");
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (listState->currentListInfo != NULL)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync char msg[1000];
072f0b86f23a38efb7454da3144cbce76805be76vboxsync sprintf(msg, "NewList called with display list %d while display list %d was already open",
072f0b86f23a38efb7454da3144cbce76805be76vboxsync (int) listIdentifier, (int) listState->currentListIdentifier);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crdlm_error(__LINE__, __FILE__, GL_INVALID_OPERATION, msg);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo = (DLMListInfo *) crCalloc(sizeof(DLMListInfo));
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (!(listInfo))
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync char msg[1000];
072f0b86f23a38efb7454da3144cbce76805be76vboxsync sprintf(msg, "could not allocate %u bytes of memory in NewList",
072f0b86f23a38efb7454da3144cbce76805be76vboxsync (unsigned) sizeof(DLMListInfo));
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crdlm_error(__LINE__, __FILE__, GL_OUT_OF_MEMORY, msg);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo->first = listInfo->last = NULL;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo->stateFirst = listInfo->stateLast = NULL;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo->references = crAllocHashtable();
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (!(listInfo->references))
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crFree(listInfo);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crdlm_error(__LINE__, __FILE__, GL_OUT_OF_MEMORY,
072f0b86f23a38efb7454da3144cbce76805be76vboxsync "could not allocate memory in NewList");
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo->numInstances = 0;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo->listSent = GL_FALSE;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo->bbox.xmin = FLT_MAX;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo->bbox.xmax = -FLT_MAX;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo->bbox.ymin = FLT_MAX;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo->bbox.ymax = -FLT_MAX;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo->bbox.zmin = FLT_MAX;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo->bbox.zmax = -FLT_MAX;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listState->currentListInfo = listInfo;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listState->currentListIdentifier = listIdentifier;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listState->currentListMode = mode;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync}
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* This small utility routine is used to traverse a buffer
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * list, freeing each buffer. It is used to free the buffer
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * list in the DLMListInfo structure, both when freeing the
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * entire structure and when freeing just the retained content.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncstatic void free_instance_list(DLMInstanceList * instance)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync{
072f0b86f23a38efb7454da3144cbce76805be76vboxsync while (instance)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync DLMInstanceList *nextInstance = instance->next;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crFree(instance);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync instance = nextInstance;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync}
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync/* This utility routine frees a DLMListInfo structure and all
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * of its components. It is used directly, when deleting a
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * single list; it is also used as a callback function for
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * hash tree operations (Free and Replace).
072f0b86f23a38efb7454da3144cbce76805be76vboxsync *
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * The parameter is listed as a (void *) instead of a (DLMListInfo *)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * in order that the function can be used as a callback routine for
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * the hash table functions. The (void *) designation causes no
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * other harm, save disabling type-checking on the pointer argument
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * of the function.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncvoid crdlm_free_list(void *parm)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync{
072f0b86f23a38efb7454da3144cbce76805be76vboxsync DLMListInfo *listInfo = (DLMListInfo *) parm;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync free_instance_list(listInfo->first);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listInfo->first = listInfo->last = NULL;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync /* The references list has no allocated information; it's
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * just a set of entries. So we don't need to free any
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * information as each entry is deleted.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crFreeHashtable(listInfo->references, NULL);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crFree(listInfo);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync}
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncvoid DLM_APIENTRY crDLMEndList(void)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync{
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRDLMContextState *listState = CURRENT_STATE();
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync /* Error check: cannot call EndList without a (successful)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * preceding NewList.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync *
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * The caller is expected to check for glNewList within
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * a glBegin/glEnd sequence.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (listState == NULL)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crWarning("DLM error: EndList called with no current state (%s line %d)\n",
072f0b86f23a38efb7454da3144cbce76805be76vboxsync __FILE__, __LINE__);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (listState->currentListInfo == NULL)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crdlm_error(__LINE__, __FILE__, GL_INVALID_OPERATION,
072f0b86f23a38efb7454da3144cbce76805be76vboxsync "EndList called while no display list was open");
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync DLM_LOCK(listState->dlm)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync /* This function will either replace the list information that's
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * already present with our new list information, freeing the
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * former list information; or will add the new information
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * to the set of display lists, depending on whether the
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * list already exists or not.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crHashtableReplace(listState->dlm->displayLists,
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listState->currentListIdentifier,
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listState->currentListInfo, crdlm_free_list);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync DLM_UNLOCK(listState->dlm)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync /* reset the current state to show the list had been ended */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listState->currentListIdentifier = 0;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listState->currentListInfo = NULL;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listState->currentListMode = GL_FALSE;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync}
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncvoid DLM_APIENTRY crDLMDeleteLists(GLuint firstListIdentifier, GLsizei range)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync{
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRDLMContextState *listState = CURRENT_STATE();
072f0b86f23a38efb7454da3144cbce76805be76vboxsync register int i;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (listState == NULL)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crWarning
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ("DLM error: DeleteLists(%d,%d) called with no current state (%s line %d)\n",
072f0b86f23a38efb7454da3144cbce76805be76vboxsync (int) firstListIdentifier, (int) range, __FILE__, __LINE__);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (range < 0)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync char msg[1000];
072f0b86f23a38efb7454da3144cbce76805be76vboxsync sprintf(msg, "DeleteLists called with range (%d) less than zero", (int) range);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crdlm_error(__LINE__, __FILE__, GL_INVALID_VALUE, msg);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync /* Interestingly, there doesn't seem to be an error for deleting
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * display list 0, which cannot exist.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync *
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * We could delete the desired lists by walking the entire hash of
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * display lists and looking for and deleting any in our range; or we
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * could delete lists one by one. The former is faster if the hashing
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * algorithm is inefficient or if we're deleting all or most of our
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * lists; the latter is faster if we're deleting a relatively small
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * number of lists.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync *
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * For now, we'll go with the latter; it's also easier to implement
072f0b86f23a38efb7454da3144cbce76805be76vboxsync * given the current functions available.
072f0b86f23a38efb7454da3144cbce76805be76vboxsync */
072f0b86f23a38efb7454da3144cbce76805be76vboxsync DLM_LOCK(listState->dlm)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync for (i = 0; i < range; i++)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crHashtableDelete(listState->dlm->displayLists,
072f0b86f23a38efb7454da3144cbce76805be76vboxsync firstListIdentifier + i, crdlm_free_list);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync DLM_UNLOCK(listState->dlm)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync}
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncGLboolean DLM_APIENTRY crDLMIsList(GLuint list)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync{
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRDLMContextState *listState = CURRENT_STATE();
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (listState == NULL)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crWarning
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ("DLM error: IsLists(%d) called with no current state (%s line %d)\n",
072f0b86f23a38efb7454da3144cbce76805be76vboxsync (int) list, __FILE__, __LINE__);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return 0;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (list == 0)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return GL_FALSE;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return crHashtableIsKeyUsed(listState->dlm->displayLists, list);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync}
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncGLuint DLM_APIENTRY crDLMGenLists(GLsizei range)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync{
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRDLMContextState *listState = CURRENT_STATE();
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (listState == NULL)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crWarning
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ("DLM error: GenLists(%d) called with no current state (%s line %d)\n",
072f0b86f23a38efb7454da3144cbce76805be76vboxsync (int) range, __FILE__, __LINE__);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return 0;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return crHashtableAllocKeys(listState->dlm->displayLists, range);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync}
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsyncvoid DLM_APIENTRY crDLMListBase( GLuint base )
072f0b86f23a38efb7454da3144cbce76805be76vboxsync{
072f0b86f23a38efb7454da3144cbce76805be76vboxsync CRDLMContextState *listState = CURRENT_STATE();
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync if (listState == NULL)
072f0b86f23a38efb7454da3144cbce76805be76vboxsync {
072f0b86f23a38efb7454da3144cbce76805be76vboxsync crWarning
072f0b86f23a38efb7454da3144cbce76805be76vboxsync ("DLM error: ListBase(%d) called with no current state (%s line %d)\n",
072f0b86f23a38efb7454da3144cbce76805be76vboxsync (int) base, __FILE__, __LINE__);
072f0b86f23a38efb7454da3144cbce76805be76vboxsync return;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync }
072f0b86f23a38efb7454da3144cbce76805be76vboxsync
072f0b86f23a38efb7454da3144cbce76805be76vboxsync listState->listBase = base;
072f0b86f23a38efb7454da3144cbce76805be76vboxsync}