]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
sanity check the visual obtained
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 5 Apr 2011 17:28:32 +0000 (17:28 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 5 Apr 2011 17:28:32 +0000 (17:28 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11026 d7cf8633-e32d-0410-b094-e92efae38249

vid_glx.c

index b469e8e479317a1b51295292700e5869ae79434b..c0a7efc82bca7865aea6d9e99edeab660d8866ed 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -455,6 +455,31 @@ static keynum_t buttonremap[18] =
 static qboolean BuildXImages(int w, int h)
 {
        int i;
+       if(DefaultDepth(vidx11_display, vidx11_screen) != 32 && DefaultDepth(vidx11_display, vidx11_screen) != 24)
+       {
+               Con_Printf("Sorry, we only support 24bpp and 32bpp modes\n");
+               VID_Shutdown();
+               return false;
+       }
+       // match to dpsoftrast's specs
+       if(vidx11_visual->red_mask != 0x00FF0000)
+       {
+               Con_Printf("Sorry, we only support BGR visuals\n");
+               VID_Shutdown();
+               return false;
+       }
+       if(vidx11_visual->green_mask != 0x0000FF00)
+       {
+               Con_Printf("Sorry, we only support BGR visuals\n");
+               VID_Shutdown();
+               return false;
+       }
+       if(vidx11_visual->blue_mask != 0x000000FF)
+       {
+               Con_Printf("Sorry, we only support BGR visuals\n");
+               VID_Shutdown();
+               return false;
+       }
        if(vidx11_shmevent >= 0)
        {
                for(i = 0; i < 2; ++i)
@@ -467,6 +492,12 @@ static qboolean BuildXImages(int w, int h)
                                VID_Shutdown();
                                return false;
                        }
+                       if(vidx11_ximage[i]->bytes_per_line != w * 4)
+                       {
+                               Con_Printf("Sorry, we only support linear pixel layout\n");
+                               VID_Shutdown();
+                               return false;
+                       }
                        vidx11_shminfo[i].shmid = shmget(IPC_PRIVATE, vidx11_ximage[i]->bytes_per_line * vidx11_ximage[i]->height, IPC_CREAT|0777);
                        if(vidx11_shminfo[i].shmid < 0)
                        {
@@ -498,6 +529,12 @@ static qboolean BuildXImages(int w, int h)
                                VID_Shutdown();
                                return false;
                        }
+                       if(vidx11_ximage[i]->bytes_per_line != w * 4)
+                       {
+                               Con_Printf("Sorry, we only support linear pixel layout\n");
+                               VID_Shutdown();
+                               return false;
+                       }
                }
        }
        return true;