From 87b04ce59b3ed26988b54ca182fab2e9dce03c38 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 10:30:14 +0100 Subject: wgl: Move pixel format information into device structure. --- src/gallium/state_trackers/wgl/shared/stw_device.h | 12 ++++++++++- .../state_trackers/wgl/shared/stw_pixelformat.c | 24 +++++++++------------- .../state_trackers/wgl/shared/stw_pixelformat.h | 7 ++++--- 3 files changed, 25 insertions(+), 18 deletions(-) (limited to 'src/gallium/state_trackers/wgl/shared') diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.h b/src/gallium/state_trackers/wgl/shared/stw_device.h index 0ce0d54cac..66f0047232 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.h +++ b/src/gallium/state_trackers/wgl/shared/stw_device.h @@ -29,9 +29,15 @@ #define STW_DEVICE_H_ +#include + #include "pipe/p_compiler.h" #include "pipe/p_thread.h" #include "util/u_handle_table.h" +#include "stw_pixelformat.h" + + +#define STW_MAX_PIXELFORMATS 16 struct pipe_screen; @@ -46,7 +52,11 @@ struct stw_device #ifdef DEBUG boolean trace_running; #endif - + + struct stw_pixelformat_info pixelformats[STW_MAX_PIXELFORMATS]; + unsigned pixelformat_count; + unsigned pixelformat_extended_count; + pipe_mutex mutex; struct handle_table *ctx_table; diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 92f668433f..68291bd4bb 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -26,16 +26,12 @@ **************************************************************************/ #include "util/u_debug.h" + +#include "stw_device.h" #include "stw_pixelformat.h" #include "stw_public.h" #include "stw_tls.h" -#define STW_MAX_PIXELFORMATS 16 - -static struct stw_pixelformat_info stw_pixelformats[STW_MAX_PIXELFORMATS]; -static uint stw_pixelformat_count = 0; -static uint stw_pixelformat_extended_count = 0; - static void stw_add_standard_pixelformats( @@ -94,35 +90,35 @@ stw_add_standard_pixelformats( void stw_pixelformat_init( void ) { - struct stw_pixelformat_info *pf = stw_pixelformats; + struct stw_pixelformat_info *pf = stw_dev->pixelformats; stw_add_standard_pixelformats( &pf, 0 ); - stw_pixelformat_count = pf - stw_pixelformats; + stw_dev->pixelformat_count = pf - stw_dev->pixelformats; stw_add_standard_pixelformats( &pf, STW_PF_FLAG_MULTISAMPLED ); - stw_pixelformat_extended_count = pf - stw_pixelformats; + stw_dev->pixelformat_extended_count = pf - stw_dev->pixelformats; - assert( stw_pixelformat_extended_count <= STW_MAX_PIXELFORMATS ); + assert( stw_dev->pixelformat_extended_count <= STW_MAX_PIXELFORMATS ); } uint stw_pixelformat_get_count( void ) { - return stw_pixelformat_count; + return stw_dev->pixelformat_count; } uint stw_pixelformat_get_extended_count( void ) { - return stw_pixelformat_extended_count; + return stw_dev->pixelformat_extended_count; } const struct stw_pixelformat_info * stw_pixelformat_get_info( uint index ) { - assert( index < stw_pixelformat_extended_count ); + assert( index < stw_dev->pixelformat_extended_count ); - return &stw_pixelformats[index]; + return &stw_dev->pixelformats[index]; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h index b7807f712b..b33a688f5a 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h @@ -25,10 +25,11 @@ * **************************************************************************/ -#ifndef PIXELFORMAT_H -#define PIXELFORMAT_H +#ifndef STW_PIXELFORMAT_H +#define STW_PIXELFORMAT_H #include + #include "pipe/p_compiler.h" #define STW_PF_FLAG_DOUBLEBUFFER 0x00000001 @@ -75,4 +76,4 @@ int stw_query_sample_buffers( void ); int stw_query_samples( void ); -#endif /* PIXELFORMAT_H */ +#endif /* STW_PIXELFORMAT_H */ -- cgit v1.2.3