From 66059cd3c95bf5eba7922a4a09c2596514e5e956 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 28 Jan 2009 17:07:15 +0000 Subject: [PATCH] stw: move get_proc_address and extension functions to shared --- src/gallium/state_trackers/wgl/SConscript | 14 ++++--- src/gallium/state_trackers/wgl/icd/stw_icd.c | 2 +- .../stw_arbextensionsstring.c} | 2 +- .../stw_arbextensionsstring.h} | 0 .../stw_arbpixelformat.c} | 13 ++++-- .../stw_arbpixelformat.h} | 3 ++ .../state_trackers/wgl/shared/stw_context.c | 3 +- .../stw_getprocaddress.c} | 9 ++-- .../wgl/shared/stw_pixelformat.c | 18 ++++++++ .../wgl/shared/stw_pixelformat.h | 3 ++ src/gallium/state_trackers/wgl/wgl/stw_wgl.c | 6 +++ .../wgl/wgl/stw_wgl_arbmultisample.c | 41 ------------------- .../wgl/wgl/stw_wgl_arbmultisample.h | 40 ------------------ 13 files changed, 55 insertions(+), 99 deletions(-) rename src/gallium/state_trackers/wgl/{wgl/stw_wgl_arbextensionsstring.c => shared/stw_arbextensionsstring.c} (97%) rename src/gallium/state_trackers/wgl/{wgl/stw_wgl_arbextensionsstring.h => shared/stw_arbextensionsstring.h} (100%) rename src/gallium/state_trackers/wgl/{wgl/stw_wgl_arbpixelformat.c => shared/stw_arbpixelformat.c} (98%) rename src/gallium/state_trackers/wgl/{wgl/stw_wgl_arbpixelformat.h => shared/stw_arbpixelformat.h} (97%) rename src/gallium/state_trackers/wgl/{wgl/stw_wgl_getprocaddress.c => shared/stw_getprocaddress.c} (94%) delete mode 100644 src/gallium/state_trackers/wgl/wgl/stw_wgl_arbmultisample.c delete mode 100644 src/gallium/state_trackers/wgl/wgl/stw_wgl_arbmultisample.h diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript index 18ccc5ad41c..1915e3921af 100644 --- a/src/gallium/state_trackers/wgl/SConscript +++ b/src/gallium/state_trackers/wgl/SConscript @@ -20,18 +20,20 @@ if env['platform'] in ['windows']: sources = [ 'stw.c', + 'icd/stw_icd.c', + + 'wgl/stw_wgl.c', + 'wgl/stw_wgl_pixelformat.c', + 'shared/stw_context.c', 'shared/stw_device.c', 'shared/stw_framebuffer.c', 'shared/stw_pixelformat.c', 'shared/stw_quirks.c', - 'wgl/stw_wgl_arbextensionsstring.c', - 'wgl/stw_wgl_arbmultisample.c', - 'wgl/stw_wgl_arbpixelformat.c', - 'wgl/stw_wgl.c', - 'wgl/stw_wgl_getprocaddress.c', - 'wgl/stw_wgl_pixelformat.c', + 'shared/stw_arbextensionsstring.c', + 'shared/stw_getprocaddress.c', + 'shared/stw_arbpixelformat.c', ] wgl = env.ConvenienceLibrary( diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c index e8ddefccf87..62d6adc7347 100644 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.c +++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c @@ -207,7 +207,7 @@ DrvGetProcAddress( { PROC r; - r = wglGetProcAddress( lpszProc ); + r = stw_get_proc_address( lpszProc ); debug_printf( "%s( \", __FUNCTION__%s\" ) = 0x%p\n", lpszProc, r ); diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbextensionsstring.c b/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c similarity index 97% rename from src/gallium/state_trackers/wgl/wgl/stw_wgl_arbextensionsstring.c rename to src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c index 04865796ec8..b3934cb4643 100644 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbextensionsstring.c +++ b/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c @@ -27,7 +27,7 @@ #include -#include "stw_wgl_arbextensionsstring.h" +#include "stw_arbextensionsstring.h" WINGDIAPI const char * APIENTRY wglGetExtensionsStringARB( diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbextensionsstring.h b/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.h similarity index 100% rename from src/gallium/state_trackers/wgl/wgl/stw_wgl_arbextensionsstring.h rename to src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.h diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbpixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c similarity index 98% rename from src/gallium/state_trackers/wgl/wgl/stw_wgl_arbpixelformat.c rename to src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c index 6adb05ea1fc..d373ed0809b 100644 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbpixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c @@ -30,8 +30,7 @@ #include "pipe/p_compiler.h" #include "util/u_memory.h" #include "shared/stw_public.h" -#include "stw_wgl_arbmultisample.h" -#include "stw_wgl_arbpixelformat.h" +#include "stw_arbpixelformat.h" #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 #define WGL_DRAW_TO_WINDOW_ARB 0x2001 @@ -86,6 +85,12 @@ #define WGL_TYPE_RGBA_ARB 0x202B #define WGL_TYPE_COLORINDEX_ARB 0x202C +/* From arb_multisample: + */ +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 + + static boolean query_attrib( int iPixelFormat, @@ -253,14 +258,14 @@ query_attrib( case WGL_SAMPLE_BUFFERS_ARB: if (pf->flags & PF_FLAG_MULTISAMPLED) - *pvalue = wgl_query_sample_buffers(); + *pvalue = stw_query_sample_buffers(); else *pvalue = 0; break; case WGL_SAMPLES_ARB: if (pf->flags & PF_FLAG_MULTISAMPLED) - *pvalue = wgl_query_samples(); + *pvalue = stw_query_samples(); else *pvalue = 0; break; diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbpixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.h similarity index 97% rename from src/gallium/state_trackers/wgl/wgl/stw_wgl_arbpixelformat.h rename to src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.h index 5e480b822b3..a6c42599424 100644 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbpixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.h @@ -28,6 +28,9 @@ #ifndef WGL_ARBPIXELFORMAT_H #define WGL_ARBPIXELFORMAT_H + +/* Extension functions for get_proc_address: + */ WINGDIAPI BOOL APIENTRY wglChoosePixelFormatARB( HDC hdc, diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index b2cb6124168..e17abd73f51 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -37,7 +37,6 @@ #include "shared/stw_winsys.h" #include "shared/stw_framebuffer.h" #include "shared/stw_pixelformat.h" -#include "wgl/stw_wgl_arbmultisample.h" #include "stw_context.h" //#include "stw_wgl.h" @@ -103,7 +102,7 @@ stw_create_context( 0, 0, 0, - (pf->flags & PF_FLAG_MULTISAMPLED) ? wgl_query_samples() : 0 ); + (pf->flags & PF_FLAG_MULTISAMPLED) ? stw_query_samples() : 0 ); if (visual == NULL) { FREE( ctx ); return NULL; diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl_getprocaddress.c b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c similarity index 94% rename from src/gallium/state_trackers/wgl/wgl/stw_wgl_getprocaddress.c rename to src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c index ec92d2dfce2..ac2d6fc2605 100644 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl_getprocaddress.c +++ b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c @@ -28,8 +28,9 @@ #include #include "glapi/glapi.h" -#include "stw_wgl_arbextensionsstring.h" -#include "stw_wgl_arbpixelformat.h" +#include "stw_arbextensionsstring.h" +#include "stw_arbpixelformat.h" +#include "stw_public.h" struct extension_entry { @@ -52,8 +53,8 @@ static struct extension_entry extension_entries[] = { { NULL, NULL } }; -WINGDIAPI PROC APIENTRY -wglGetProcAddress( +PROC +stw_get_proc_address( LPCSTR lpszProc ) { struct extension_entry *entry; diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 76fe7cb9fe3..4ba763d9336 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -205,3 +205,21 @@ stw_pixelformat_set( currentpixelformat = iPixelFormat; return TRUE; } + + + +/* XXX: this needs to be turned into queries on pipe_screen or + * stw_winsys. + */ +int +stw_query_sample_buffers( void ) +{ + return 1; +} + +int +stw_query_samples( void ) +{ + return 4; +} + diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h index ab5dcfc6726..ed855f08fd1 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h @@ -93,5 +93,8 @@ stw_pixelformat_set( HDC hdc, int iPixelFormat ); +int stw_query_sample_buffers( void ); +int stw_query_samples( void ); + #endif /* PIXELFORMAT_H */ diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c index 1a33c7f4538..d89d0898220 100644 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c +++ b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c @@ -115,6 +115,12 @@ wglSwapLayerBuffers( return FALSE; } +WINGDIAPI PROC APIENTRY +wglGetProcAddress( + LPCSTR lpszProc ) +{ + return stw_get_proc_address( lpszProc ); +} WINGDIAPI BOOL APIENTRY diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbmultisample.c b/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbmultisample.c deleted file mode 100644 index aad04e3e8a2..00000000000 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbmultisample.c +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include -#include "stw_wgl_arbmultisample.h" - -int -wgl_query_sample_buffers( void ) -{ - return 1; -} - -int -wgl_query_samples( void ) -{ - return 4; -} diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbmultisample.h b/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbmultisample.h deleted file mode 100644 index de3e2cc6a33..00000000000 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl_arbmultisample.h +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef WGL_ARBMULTISAMPLE_H -#define WGL_ARBMULTISAMPLE_H - -#define WGL_SAMPLE_BUFFERS_ARB 0x2041 -#define WGL_SAMPLES_ARB 0x2042 - -int -wgl_query_sample_buffers( void ); - -int -wgl_query_samples( void ); - -#endif /* WGL_ARBMULTISAMPLE_H */ -- 2.30.2