Mesa (master): wgl: Move pixel format information into device structure.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri Apr 10 12:26:41 UTC 2009


Module: Mesa
Branch: master
Commit: 87b04ce59b3ed26988b54ca182fab2e9dce03c38
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=87b04ce59b3ed26988b54ca182fab2e9dce03c38

Author: José Fonseca <jfonseca at vmware.com>
Date:   Fri Apr 10 10:30:14 2009 +0100

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(-)

diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.h b/src/gallium/state_trackers/wgl/shared/stw_device.h
index 0ce0d54..66f0047 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 <windows.h>
+
 #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 92f6684..68291bd 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 b7807f7..b33a688 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 <windows.h>
+
 #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 */




More information about the mesa-commit mailing list