1 2 BOOL Test_GetAvailableVidMem (INT* passed, INT* failed) 3 { 4 LPDIRECTDRAW7 DirectDraw; 5 6 /* Preparations */ 7 if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) != DD_OK) 8 { 9 printf("ERROR: Failed to set up ddraw\n"); 10 return FALSE; 11 } 12 13 /* Here we go */ 14 DWORD Total, Free; 15 DDSCAPS2 Caps = { 0 }; 16 17 TEST (DirectDraw->GetAvailableVidMem(&Caps, NULL, NULL) == DDERR_INVALIDPARAMS); 18 TEST (DirectDraw->GetAvailableVidMem(NULL, &Total, &Free) == DDERR_INVALIDPARAMS); 19 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 20 21 /* testing caps */ 22 memset(&Caps,0,sizeof(DDSCAPS2)); 23 Caps.dwCaps = DDSCAPS_RESERVED1; 24 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 25 26 memset(&Caps,0,sizeof(DDSCAPS2)); 27 Caps.dwCaps = DDSCAPS_ALPHA; 28 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 29 30 memset(&Caps,0,sizeof(DDSCAPS2)); 31 Caps.dwCaps = DDSCAPS_BACKBUFFER; 32 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS ); 33 34 memset(&Caps,0,sizeof(DDSCAPS2)); 35 Caps.dwCaps = DDSCAPS_COMPLEX; 36 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS ); 37 38 memset(&Caps,0,sizeof(DDSCAPS2)); 39 Caps.dwCaps = DDSCAPS_FLIP; 40 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS ); 41 42 memset(&Caps,0,sizeof(DDSCAPS2)); 43 Caps.dwCaps = DDSCAPS_FRONTBUFFER; 44 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS ); 45 46 memset(&Caps,0,sizeof(DDSCAPS2)); 47 Caps.dwCaps = DDSCAPS_OFFSCREENPLAIN; 48 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 49 50 memset(&Caps,0,sizeof(DDSCAPS2)); 51 Caps.dwCaps = DDSCAPS_OVERLAY; 52 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 53 54 memset(&Caps,0,sizeof(DDSCAPS2)); 55 Caps.dwCaps = DDSCAPS_PALETTE; 56 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS ); 57 58 memset(&Caps,0,sizeof(DDSCAPS2)); 59 Caps.dwCaps = DDSCAPS_PRIMARYSURFACE; 60 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 61 62 memset(&Caps,0,sizeof(DDSCAPS2)); 63 Caps.dwCaps = DDSCAPS_RESERVED3; 64 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 65 66 memset(&Caps,0,sizeof(DDSCAPS2)); 67 Caps.dwCaps = DDSCAPS_SYSTEMMEMORY; 68 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS ); 69 70 memset(&Caps,0,sizeof(DDSCAPS2)); 71 Caps.dwCaps = DDSCAPS_TEXTURE; 72 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 73 74 memset(&Caps,0,sizeof(DDSCAPS2)); 75 Caps.dwCaps = DDSCAPS_3DDEVICE; 76 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 77 78 memset(&Caps,0,sizeof(DDSCAPS2)); 79 Caps.dwCaps = DDSCAPS_VIDEOMEMORY; 80 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 81 82 memset(&Caps,0,sizeof(DDSCAPS2)); 83 Caps.dwCaps = DDSCAPS_VISIBLE; 84 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS ); 85 86 memset(&Caps,0,sizeof(DDSCAPS2)); 87 Caps.dwCaps = DDSCAPS_WRITEONLY; 88 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS ); 89 90 memset(&Caps,0,sizeof(DDSCAPS2)); 91 Caps.dwCaps = DDSCAPS_ZBUFFER; 92 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 93 94 memset(&Caps,0,sizeof(DDSCAPS2)); 95 Caps.dwCaps = DDSCAPS_OWNDC; 96 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS ); 97 98 memset(&Caps,0,sizeof(DDSCAPS2)); 99 Caps.dwCaps = DDSCAPS_LIVEVIDEO; 100 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 101 102 memset(&Caps,0,sizeof(DDSCAPS2)); 103 Caps.dwCaps = DDSCAPS_HWCODEC; 104 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 105 106 memset(&Caps,0,sizeof(DDSCAPS2)); 107 Caps.dwCaps = DDSCAPS_MODEX; 108 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 109 110 memset(&Caps,0,sizeof(DDSCAPS2)); 111 Caps.dwCaps = DDSCAPS_MIPMAP; 112 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 113 114 memset(&Caps,0,sizeof(DDSCAPS2)); 115 Caps.dwCaps = DDSCAPS_RESERVED2; 116 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 117 118 memset(&Caps,0,sizeof(DDSCAPS2)); 119 Caps.dwCaps = DDSCAPS_ALLOCONLOAD; 120 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 121 122 memset(&Caps,0,sizeof(DDSCAPS2)); 123 Caps.dwCaps = DDSCAPS_VIDEOPORT; 124 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); 125 126 memset(&Caps,0,sizeof(DDSCAPS2)); 127 Caps.dwCaps = DDSCAPS_LOCALVIDMEM; 128 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 129 130 memset(&Caps,0,sizeof(DDSCAPS2)); 131 Caps.dwCaps = DDSCAPS_NONLOCALVIDMEM; 132 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 133 134 memset(&Caps,0,sizeof(DDSCAPS2)); 135 Caps.dwCaps2 = 0x01; 136 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDCAPS); 137 138 memset(&Caps,0,sizeof(DDSCAPS2)); 139 Caps.dwCaps2 = DDSCAPS2_RESERVED4; 140 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 141 142 memset(&Caps,0,sizeof(DDSCAPS2)); 143 Caps.dwCaps2 = DDSCAPS2_HINTDYNAMIC; 144 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 145 146 memset(&Caps,0,sizeof(DDSCAPS2)); 147 Caps.dwCaps2 = DDSCAPS2_HINTSTATIC; 148 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 149 150 memset(&Caps,0,sizeof(DDSCAPS2)); 151 Caps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE; 152 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 153 154 memset(&Caps,0,sizeof(DDSCAPS2)); 155 Caps.dwCaps2 = DDSCAPS2_RESERVED1; 156 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 157 158 memset(&Caps,0,sizeof(DDSCAPS2)); 159 Caps.dwCaps2 = DDSCAPS2_RESERVED2; 160 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 161 162 memset(&Caps,0,sizeof(DDSCAPS2)); 163 Caps.dwCaps2 = DDSCAPS2_OPAQUE; 164 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 165 166 memset(&Caps,0,sizeof(DDSCAPS2)); 167 Caps.dwCaps2 = DDSCAPS2_HINTANTIALIASING; 168 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 169 170 memset(&Caps,0,sizeof(DDSCAPS2)); 171 Caps.dwCaps2 = DDSCAPS2_CUBEMAP; 172 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 173 174 memset(&Caps,0,sizeof(DDSCAPS2)); 175 Caps.dwCaps2 = DDSCAPS2_CUBEMAP_POSITIVEX; 176 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 177 178 memset(&Caps,0,sizeof(DDSCAPS2)); 179 Caps.dwCaps2 = DDSCAPS2_CUBEMAP_NEGATIVEX; 180 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 181 182 memset(&Caps,0,sizeof(DDSCAPS2)); 183 Caps.dwCaps2 = DDSCAPS2_CUBEMAP_POSITIVEY; 184 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 185 186 memset(&Caps,0,sizeof(DDSCAPS2)); 187 Caps.dwCaps2 = DDSCAPS2_CUBEMAP_NEGATIVEY; 188 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 189 190 memset(&Caps,0,sizeof(DDSCAPS2)); 191 Caps.dwCaps2 = DDSCAPS2_CUBEMAP_POSITIVEZ; 192 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 193 194 memset(&Caps,0,sizeof(DDSCAPS2)); 195 Caps.dwCaps2 = DDSCAPS2_CUBEMAP_NEGATIVEZ; 196 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 197 198 memset(&Caps,0,sizeof(DDSCAPS2)); 199 Caps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL; 200 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 201 202 memset(&Caps,0,sizeof(DDSCAPS2)); 203 Caps.dwCaps2 = DDSCAPS2_D3DTEXTUREMANAGE; 204 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 205 206 memset(&Caps,0,sizeof(DDSCAPS2)); 207 Caps.dwCaps2 = DDSCAPS2_DONOTPERSIST; 208 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 209 210 memset(&Caps,0,sizeof(DDSCAPS2)); 211 Caps.dwCaps2 = DDSCAPS2_STEREOSURFACELEFT; 212 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 213 214 memset(&Caps,0,sizeof(DDSCAPS2)); 215 Caps.dwCaps2 = DDSCAPS2_VOLUME; 216 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 217 218 memset(&Caps,0,sizeof(DDSCAPS2)); 219 Caps.dwCaps2 = DDSCAPS2_NOTUSERLOCKABLE; 220 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 221 222 memset(&Caps,0,sizeof(DDSCAPS2)); 223 Caps.dwCaps2 = DDSCAPS2_POINTS; 224 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 225 226 memset(&Caps,0,sizeof(DDSCAPS2)); 227 Caps.dwCaps2 = DDSCAPS2_RTPATCHES; 228 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 229 230 memset(&Caps,0,sizeof(DDSCAPS2)); 231 Caps.dwCaps2 = DDSCAPS2_NPATCHES; 232 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 233 234 memset(&Caps,0,sizeof(DDSCAPS2)); 235 Caps.dwCaps2 = DDSCAPS2_RESERVED3; 236 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 237 238 memset(&Caps,0,sizeof(DDSCAPS2)); 239 Caps.dwCaps2 = DDSCAPS2_DISCARDBACKBUFFER; 240 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 241 242 memset(&Caps,0,sizeof(DDSCAPS2)); 243 Caps.dwCaps2 = DDSCAPS2_ENABLEALPHACHANNEL; 244 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 245 246 memset(&Caps,0,sizeof(DDSCAPS2)); 247 Caps.dwCaps2 = DDSCAPS2_EXTENDEDFORMATPRIMARY; 248 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 249 250 memset(&Caps,0,sizeof(DDSCAPS2)); 251 Caps.dwCaps2 = DDSCAPS2_ADDITIONALPRIMARY; 252 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 253 254 memset(&Caps,0,sizeof(DDSCAPS2)); 255 Caps.dwCaps3 = ~(DDSCAPS3_MULTISAMPLE_QUALITY_MASK | DDSCAPS3_MULTISAMPLE_MASK | DDSCAPS3_RESERVED1 | DDSCAPS3_RESERVED2 | DDSCAPS3_LIGHTWEIGHTMIPMAP | DDSCAPS3_AUTOGENMIPMAP | DDSCAPS3_DMAP); 256 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDCAPS); 257 258 memset(&Caps,0,sizeof(DDSCAPS2)); 259 Caps.dwCaps3 = (DDSCAPS3_MULTISAMPLE_QUALITY_MASK | DDSCAPS3_MULTISAMPLE_MASK | DDSCAPS3_RESERVED1 | DDSCAPS3_RESERVED2 | DDSCAPS3_LIGHTWEIGHTMIPMAP | DDSCAPS3_AUTOGENMIPMAP | DDSCAPS3_DMAP); 260 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK); 261 262 memset(&Caps,0,sizeof(DDSCAPS2)); 263 Caps.dwCaps4 = 1; 264 TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDCAPS ); 265 266 DirectDraw->Release(); 267 268 return TRUE; 269 } 270