[3/5] wined3d: Make the offscreen render mode a registry setting

H. Verbeet hverbeet at gmail.com
Fri Nov 17 06:23:53 CST 2006


Currently support for pbuffers is enbled or disabled in the source.
This patch makes it a registry setting. The next patch will add FBOs
as offscreen rendering mode.

Changelog:
  - Make the offscreen render mode a registry setting
-------------- next part --------------
---

 dlls/wined3d/device.c          |    5 +----
 dlls/wined3d/wined3d_main.c    |   14 ++++++++++++++
 dlls/wined3d/wined3d_private.h |    4 ++++
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index ab529a9..239d15d 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -71,9 +71,6 @@ inline static Display *get_display( HDC 
     return display;
 }
 
-/* TODO: setup some flags in the regestry to enable, disable pbuffer support */
-/* enable pbuffer support for offscreen textures */
-BOOL pbuffer_support     = FALSE;
 /* allocate one pbuffer per surface */
 BOOL pbuffer_per_surface = FALSE;
 
@@ -7414,7 +7411,7 @@ #if defined(GL_VERSION_1_3)
 
     /* Offscreen rendering: PBuffers (currently disabled).
      * Also note that this path is never reached if FBOs are supported */
-    } else if (pbuffer_support &&
+    } else if (wined3d_settings.offscreen_rendering_mode == ORM_PBUFFER &&
                (cfgs = device_find_fbconfigs(This, implicitSwapchainImpl, RenderSurface)) != NULL) {
 
         /** ********************************************************************
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 6fe6a68..e339815 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -41,6 +41,7 @@ wined3d_settings_t wined3d_settings = 
     VBO_HW,         /* Hardware by default */
     FALSE,          /* Use of GLSL disabled by default */
     NP2_NATIVE,     /* Use native NPOT textures, when available */
+    ORM_BACKBUFFER, /* Use the backbuffer to do offscreen rendering */
     RTL_AUTO,       /* Automatically determine best locking method */
     64*1024*1024    /* 64MB texture memory by default */
 };
@@ -202,6 +203,19 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, 
                 }
                 /* There will be a couple of other choices for nonpow2, they are: TextureRecrangle and OpenGL 2 */
             }
+            if ( !get_config_key( hkey, appkey, "OffscreenRenderingMode", buffer, size) )
+            {
+                if (!strcmp(buffer,"backbuffer"))
+                {
+                    TRACE("Using the backbuffer for offscreen rendering\n");
+                    wined3d_settings.offscreen_rendering_mode = ORM_BACKBUFFER;
+                }
+                else if (!strcmp(buffer,"pbuffer"))
+                {
+                    TRACE("Using PBuffers for offscreen rendering\n");
+                    wined3d_settings.offscreen_rendering_mode = ORM_PBUFFER;
+                }
+            }
             if ( !get_config_key( hkey, appkey, "RenderTargetLockMode", buffer, size) )
             {
                 if (!strcmp(buffer,"disabled"))
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index aa38261..b3465a8 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -135,6 +135,9 @@ #define NP2_NONE   0
 #define NP2_REPACK 1
 #define NP2_NATIVE 2
 
+#define ORM_BACKBUFFER  0
+#define ORM_PBUFFER     1
+
 #define SHADER_SW   0
 #define SHADER_ARB  1
 #define SHADER_GLSL 2
@@ -160,6 +163,7 @@ typedef struct wined3d_settings_s {
   BOOL glslRequested;
 /* nonpower 2 function */
   int nonpower2_mode;
+  int offscreen_rendering_mode;
   int rendertargetlock_mode;
 /* Memory tracking and object counting */
   unsigned int emulated_textureram;


More information about the wine-patches mailing list