|
From: Andreas R. <and...@us...> - 2002-09-05 19:30:48
|
Update of /cvsroot/squeak/squeak/platforms/win32/plugins/B3DAcceleratorPlugin
In directory usw-pr-cvs1:/tmp/cvs-serv8628
Modified Files:
sqWin32D3D.c sqWin32DualB3DX.c sqWin32OpenGL.c
Log Message:
Added renderer creation flags
Index: sqWin32D3D.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/win32/plugins/B3DAcceleratorPlugin/sqWin32D3D.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** sqWin32D3D.c 16 Jun 2002 18:25:07 -0000 1.7
--- sqWin32D3D.c 5 Sep 2002 19:30:45 -0000 1.8
***************
*** 106,111 ****
/* device description of renderer */
! BOOL fAllowSoftware;
! BOOL fAllowHardware;
BOOL fDeviceFound;
D3DDEVICEDESC7 ddDesc;
--- 106,110 ----
/* device description of renderer */
! int devFlags; /* device flags from CreateRenderer */
BOOL fDeviceFound;
D3DDEVICEDESC7 ddDesc;
***************
*** 391,397 ****
/* The device must match hw/sw constraints from the renderer */
if(fIsHardware) {
! if(!renderer->fAllowHardware) return D3DENUMRET_OK;
} else {
! if(!renderer->fAllowSoftware) return D3DENUMRET_OK;
}
--- 390,396 ----
/* The device must match hw/sw constraints from the renderer */
if(fIsHardware) {
! if(!(renderer->devFlags & B3D_HARDWARE_RENDERER)) return D3DENUMRET_OK;
} else {
! if(!(renderer->devFlags & B3D_HARDWARE_RENDERER)) return D3DENUMRET_OK;
}
***************
*** 845,852 ****
}
! int d3dCreateRenderer(int allowSoftware, int allowHardware,
! int x, int y, int w, int h) {
int i, index;
d3dRenderer *renderer;
DPRINTF(3, (fp, "---- Initializing D3D ----\n"));
for(i=0; i < MAX_RENDERER; i++) {
--- 844,860 ----
}
! #define SUPPORTED_FLAGS (\
! B3D_HARDWARE_RENDERER \
! | B3D_SOFTWARE_RENDERER)
!
! int d3dCreateRendererFlags(int x, int y, int w, int h, int flags) {
int i, index;
d3dRenderer *renderer;
+
+ if(flags & ~SUPPORTED_FLAGS) {
+ DPRINTF(1, (fp, "ERROR: Unsupported flags requested( %d)\n", flags));
+ return -1;
+ }
+
DPRINTF(3, (fp, "---- Initializing D3D ----\n"));
for(i=0; i < MAX_RENDERER; i++) {
***************
*** 855,859 ****
if(i >= MAX_RENDERER) {
DPRINTF(1, (fp, "ERROR: Maximum number of renderers (%d) exceeded\n", MAX_RENDERER));
! return 0;
}
index = i;
--- 863,867 ----
if(i >= MAX_RENDERER) {
DPRINTF(1, (fp, "ERROR: Maximum number of renderers (%d) exceeded\n", MAX_RENDERER));
! return -1;
}
index = i;
***************
*** 865,870 ****
renderer->bufferRect[2] = w;
renderer->bufferRect[3] = h;
! renderer->fAllowSoftware = allowSoftware;
! renderer->fAllowHardware = allowHardware;
if(!d3dInitializePrimary()) {
/* disable DX if we cannot create the primary objects */
--- 873,877 ----
renderer->bufferRect[2] = w;
renderer->bufferRect[3] = h;
! renderer->devFlags = flags;
if(!d3dInitializePrimary()) {
/* disable DX if we cannot create the primary objects */
Index: sqWin32DualB3DX.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/win32/plugins/B3DAcceleratorPlugin/sqWin32DualB3DX.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** sqWin32DualB3DX.c 6 May 2002 11:03:05 -0000 1.1
--- sqWin32DualB3DX.c 5 Sep 2002 19:30:45 -0000 1.2
***************
*** 12,15 ****
--- 12,28 ----
glMode = *ptr;
}
+
+ #ifdef TEA
+ #warning "**************************************************************"
+ #warning "**************************************************************"
+ #warning "**************************************************************"
+ #warning
+ #warning "TEA: D3D disabled"
+ #warning
+ #warning "**************************************************************"
+ #warning "**************************************************************"
+ #warning "**************************************************************"
+ glMode = 1;
+ #endif
if(glMode)
return glInitialize();
Index: sqWin32OpenGL.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/win32/plugins/B3DAcceleratorPlugin/sqWin32OpenGL.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** sqWin32OpenGL.c 29 May 2002 11:43:03 -0000 1.6
--- sqWin32OpenGL.c 5 Sep 2002 19:30:45 -0000 1.7
***************
*** 428,438 ****
#endif
! int glCreateRenderer(int allowSoftware, int allowHardware, int x, int y, int w, int h)
{
! PIXELFORMATDESCRIPTOR pfd, goodPFD;
int depth, i, goodIndex, max, index;
char *string;
glRenderer *renderer;
for(i=0; i < MAX_RENDERER; i++) {
if(allRenderer[i].used == 0) break;
--- 428,448 ----
#endif
! #define SUPPORTED_FLAGS (\
! B3D_HARDWARE_RENDERER \
! | B3D_SOFTWARE_RENDERER \
! | B3D_STENCIL_BUFFER)
!
! int glCreateRendererFlags(int x, int y, int w, int h, int flags)
{
! PIXELFORMATDESCRIPTOR pfd, goodPFD, matchPFD;
int depth, i, goodIndex, max, index;
char *string;
glRenderer *renderer;
+ if(flags & ~SUPPORTED_FLAGS) {
+ DPRINTF(1, (fp, "ERROR: Unsupported flags requested( %d)\n", flags));
+ return -1;
+ }
+
for(i=0; i < MAX_RENDERER; i++) {
if(allRenderer[i].used == 0) break;
***************
*** 440,444 ****
if(i >= MAX_RENDERER) {
DPRINTF(1, (fp, "ERROR: Maximum number of renderers (%d) exceeded\n", MAX_RENDERER));
! return 0;
}
index = i;
--- 450,454 ----
if(i >= MAX_RENDERER) {
DPRINTF(1, (fp, "ERROR: Maximum number of renderers (%d) exceeded\n", MAX_RENDERER));
! return -1;
}
index = i;
***************
*** 471,516 ****
goodIndex = 0;
for(i=1; i<= max; i++) {
DescribePixelFormat(renderer->hDC, i, sizeof(pfd), &pfd);
DPRINTF(3,(fp, "\n#### Checking pixel format %d:\n", i));
printPFD(&pfd, 3);
! if((pfd.dwFlags & PFD_DRAW_TO_WINDOW) == 0)
! continue; /* can't draw to window */
! if((pfd.dwFlags & PFD_SUPPORT_OPENGL) == 0)
! continue; /* can't use OpenGL */
! if((pfd.dwFlags & PFD_DOUBLEBUFFER) == 0)
! continue; /* can't double buffer */
if(pfd.iPixelType != PFD_TYPE_RGBA)
continue; /* not an RGBA format */
! if(pfd.cDepthBits < 16)
continue; /* no enough z-buffer */
if(pfd.iLayerType != PFD_MAIN_PLANE)
continue; /* overlay/underlay */
! #ifdef TEA
! #warning "**************************************************************"
! #warning "**************************************************************"
! #warning "**************************************************************"
! #warning
! #warning "TEA: Stencil buffer required"
! #warning
! #warning "**************************************************************"
! #warning "**************************************************************"
! #warning "**************************************************************"
! if(pfd.cStencilBits < 8)
! continue; /* need stencil bits */
! #endif
if((pfd.dwFlags & PFD_GENERIC_FORMAT) == 0) {
/* This indicates an accellerated driver */
! if(!allowHardware) continue;
DPRINTF(3,(fp,"===> This is an accelerated driver\n"));
- #ifdef ENABLE_FORCED_PFD
- if(forcedPFD > 0) {
- if(--forcedPFD == 0) {
- goodPFD = pfd; goodIndex = i;
- break;
- }
- }
- #endif
if(goodPFD.nSize == 0) {
goodPFD = pfd; goodIndex = i;
--- 481,517 ----
goodIndex = 0;
+ /* setup the matching PFD */
+ matchPFD.dwFlags = 0;
+ /* standard requirements */
+ matchPFD.dwFlags |= PFD_DRAW_TO_WINDOW;
+ matchPFD.dwFlags |= PFD_SUPPORT_OPENGL;
+ matchPFD.dwFlags |= PFD_TYPE_RGBA;
+ matchPFD.dwFlags |= PFD_DOUBLEBUFFER;
+
for(i=1; i<= max; i++) {
DescribePixelFormat(renderer->hDC, i, sizeof(pfd), &pfd);
DPRINTF(3,(fp, "\n#### Checking pixel format %d:\n", i));
printPFD(&pfd, 3);
!
! if((pfd.dwFlags & matchPFD.dwFlags) != matchPFD.dwFlags)
! continue; /* one of the basic requirements didn't work */
!
if(pfd.iPixelType != PFD_TYPE_RGBA)
continue; /* not an RGBA format */
!
! if(pfd.cDepthBits < 12)
continue; /* no enough z-buffer */
+
if(pfd.iLayerType != PFD_MAIN_PLANE)
continue; /* overlay/underlay */
!
! if(flags & B3D_STENCIL_BUFFER)
! if(pfd.cStencilBits == 0)
! continue; /* need stencil bits */
if((pfd.dwFlags & PFD_GENERIC_FORMAT) == 0) {
/* This indicates an accellerated driver */
! if((flags & B3D_HARDWARE_RENDERER) == 0) continue;
DPRINTF(3,(fp,"===> This is an accelerated driver\n"));
if(goodPFD.nSize == 0) {
goodPFD = pfd; goodIndex = i;
***************
*** 520,533 ****
} else if(pfd.dwFlags & PFD_GENERIC_ACCELERATED) {
/* This indicates an accellerated mini-driver */
! if(!allowHardware) continue;
DPRINTF(3,(fp,"===> This is an accelerated mini-driver\n"));
! #ifdef ENABLE_FORCED_PFD
! if(forcedPFD > 0) {
! if(--forcedPFD == 0) {
! goodPFD = pfd; goodIndex = i;
! break;
! }
! }
! #endif
if(goodPFD.nSize == 0) {
goodPFD = pfd; goodIndex = i;
--- 521,527 ----
} else if(pfd.dwFlags & PFD_GENERIC_ACCELERATED) {
/* This indicates an accellerated mini-driver */
! if((flags & B3D_HARDWARE_RENDERER) == 0) continue;
DPRINTF(3,(fp,"===> This is an accelerated mini-driver\n"));
!
if(goodPFD.nSize == 0) {
goodPFD = pfd; goodIndex = i;
***************
*** 540,554 ****
((pfd.dwFlags & PFD_GENERIC_ACCELERATED) == 0)) {
/* this indicates a non-accellerated driver */
! if(!allowSoftware) continue;
! if(goodPFD.nSize == 0) {
goodPFD = pfd; goodIndex = i;
! }
}
}
! if((goodPFD.nSize == 0)
! #ifdef ENABLE_FORCED_PFD
! || (forcedPFD > 0)
! #endif
! ) {
/* We didn't find an accellerated driver. */
DPRINTF(3,(fp,"#### WARNING: No accelerated driver found; bailing out\n"));
--- 534,544 ----
((pfd.dwFlags & PFD_GENERIC_ACCELERATED) == 0)) {
/* this indicates a non-accellerated driver */
! if((flags & B3D_SOFTWARE_RENDERER) == 0) continue;
! if(goodPFD.nSize == 0) {
goodPFD = pfd; goodIndex = i;
! }
}
}
! if((goodPFD.nSize == 0)) {
/* We didn't find an accellerated driver. */
DPRINTF(3,(fp,"#### WARNING: No accelerated driver found; bailing out\n"));
|