summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/wgl/shared/stw_device.c
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2009-03-20 15:45:00 +0100
committerMichal Krol <michal@vmware.com>2009-03-20 15:45:00 +0100
commit5465f3adf93bd58b528bd6703b2367eb00c78c31 (patch)
tree550d42d9b88454da27cb5e37d746ad6fe0b27444 /src/gallium/state_trackers/wgl/shared/stw_device.c
parent36e985e96e6da817042ba1b2dfadf96f85e32afb (diff)
stw: Use u_handle_table to maintain context list.
Diffstat (limited to 'src/gallium/state_trackers/wgl/shared/stw_device.c')
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_device.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c
index 4bec036fe3..3c1eb1ad39 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_device.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_device.c
@@ -94,6 +94,11 @@ st_init(const struct stw_winsys *stw_winsys)
pipe_mutex_init( stw_dev->mutex );
+ stw_dev->ctx_table = handle_table_create();
+ if (!stw_dev->ctx_table) {
+ goto error1;
+ }
+
pixelformat_init();
return TRUE;
@@ -135,9 +140,12 @@ st_cleanup(void)
pipe_mutex_lock( stw_dev->mutex );
{
/* Ensure all contexts are destroyed */
- for (i = 0; i < STW_CONTEXT_MAX; i++)
- if (stw_dev->ctx_array[i].ctx)
- stw_delete_context( i + 1 );
+ i = handle_table_get_first_handle(stw_dev->ctx_table);
+ while (i) {
+ stw_delete_context(i);
+ i = handle_table_get_next_handle(stw_dev->ctx_table, i);
+ }
+ handle_table_destroy(stw_dev->ctx_table);
}
pipe_mutex_unlock( stw_dev->mutex );
@@ -163,13 +171,12 @@ st_cleanup(void)
struct stw_context *
stw_lookup_context( UINT_PTR dhglrc )
{
- if (dhglrc == 0 ||
- dhglrc >= STW_CONTEXT_MAX)
+ if (dhglrc == 0)
return NULL;
if (stw_dev == NULL)
return NULL;
- return stw_dev->ctx_array[dhglrc - 1].ctx;
+ return (struct stw_context *) handle_table_get(stw_dev->ctx_table, dhglrc);
}