stw: move get_proc_address and extension functions to shared

This commit is contained in:
Keith Whitwell 2009-01-28 17:07:15 +00:00
parent 54688ebdb2
commit 66059cd3c9
13 changed files with 55 additions and 99 deletions

View file

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

View file

@ -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 );

View file

@ -27,7 +27,7 @@
#include <windows.h>
#include "stw_wgl_arbextensionsstring.h"
#include "stw_arbextensionsstring.h"
WINGDIAPI const char * APIENTRY
wglGetExtensionsStringARB(

View file

@ -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;

View file

@ -28,6 +28,9 @@
#ifndef WGL_ARBPIXELFORMAT_H
#define WGL_ARBPIXELFORMAT_H
/* Extension functions for get_proc_address:
*/
WINGDIAPI BOOL APIENTRY
wglChoosePixelFormatARB(
HDC hdc,

View file

@ -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;

View file

@ -28,8 +28,9 @@
#include <windows.h>
#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;

View file

@ -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;
}

View file

@ -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 */

View file

@ -115,6 +115,12 @@ wglSwapLayerBuffers(
return FALSE;
}
WINGDIAPI PROC APIENTRY
wglGetProcAddress(
LPCSTR lpszProc )
{
return stw_get_proc_address( lpszProc );
}
WINGDIAPI BOOL APIENTRY

View file

@ -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 <windows.h>
#include "stw_wgl_arbmultisample.h"
int
wgl_query_sample_buffers( void )
{
return 1;
}
int
wgl_query_samples( void )
{
return 4;
}

View file

@ -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 */