Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_d3drender.c @ 2972:0a4b70368372
Query available formats before advertising them.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 03 Jan 2009 04:33:19 +0000 |
parents | 73f84b1e25e5 |
children | ab0c00f1b070 |
comparison
equal
deleted
inserted
replaced
2971:a3012c6652ff | 2972:0a4b70368372 |
---|---|
86 SDL_TEXTUREMODULATE_ALPHA), | 86 SDL_TEXTUREMODULATE_ALPHA), |
87 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | | 87 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | |
88 SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), | 88 SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), |
89 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST | | 89 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST | |
90 SDL_TEXTURESCALEMODE_SLOW | SDL_TEXTURESCALEMODE_BEST), | 90 SDL_TEXTURESCALEMODE_SLOW | SDL_TEXTURESCALEMODE_BEST), |
91 12, | 91 0, |
92 { | 92 {0}, |
93 SDL_PIXELFORMAT_INDEX8, | |
94 SDL_PIXELFORMAT_RGB332, | |
95 SDL_PIXELFORMAT_RGB444, | |
96 SDL_PIXELFORMAT_RGB555, | |
97 SDL_PIXELFORMAT_ARGB4444, | |
98 SDL_PIXELFORMAT_ARGB1555, | |
99 SDL_PIXELFORMAT_RGB565, | |
100 SDL_PIXELFORMAT_RGB888, | |
101 SDL_PIXELFORMAT_ARGB8888, | |
102 SDL_PIXELFORMAT_ARGB2101010, | |
103 SDL_PIXELFORMAT_YUY2, | |
104 SDL_PIXELFORMAT_UYVY}, | |
105 0, | 93 0, |
106 0} | 94 0} |
107 }; | 95 }; |
108 | 96 |
109 typedef struct | 97 typedef struct |
240 | 228 |
241 void | 229 void |
242 D3D_AddRenderDriver(_THIS) | 230 D3D_AddRenderDriver(_THIS) |
243 { | 231 { |
244 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; | 232 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
233 SDL_RendererInfo *info = &D3D_RenderDriver.info; | |
234 SDL_DisplayMode *mode = &SDL_CurrentDisplay.desktop_mode; | |
245 | 235 |
246 if (data->d3d) { | 236 if (data->d3d) { |
237 int i; | |
238 int formats[] = { | |
239 SDL_PIXELFORMAT_INDEX8, | |
240 SDL_PIXELFORMAT_RGB332, | |
241 SDL_PIXELFORMAT_RGB444, | |
242 SDL_PIXELFORMAT_RGB555, | |
243 SDL_PIXELFORMAT_ARGB4444, | |
244 SDL_PIXELFORMAT_ARGB1555, | |
245 SDL_PIXELFORMAT_RGB565, | |
246 SDL_PIXELFORMAT_RGB888, | |
247 SDL_PIXELFORMAT_ARGB8888, | |
248 SDL_PIXELFORMAT_ARGB2101010, | |
249 SDL_PIXELFORMAT_YUY2, | |
250 SDL_PIXELFORMAT_UYVY, | |
251 }; | |
252 HRESULT result; | |
253 | |
254 for (i = 0; i < SDL_arraysize(formats); ++i) { | |
255 result = IDirect3D9_CheckDeviceFormat(data->d3d, | |
256 D3DADAPTER_DEFAULT, /* FIXME */ | |
257 D3DDEVTYPE_HAL, | |
258 PixelFormatToD3DFMT(mode->format), | |
259 0, | |
260 D3DRTYPE_TEXTURE, | |
261 PixelFormatToD3DFMT(formats[i])); | |
262 if (!FAILED(result)) { | |
263 info->texture_formats[info->num_texture_formats++] = formats[i]; | |
264 } | |
265 } | |
266 | |
247 SDL_AddRenderDriver(0, &D3D_RenderDriver); | 267 SDL_AddRenderDriver(0, &D3D_RenderDriver); |
248 } | 268 } |
249 } | 269 } |
250 | 270 |
251 SDL_Renderer * | 271 SDL_Renderer * |