2008/9/19 Philip Nilsson pnilsson@nullref.se:
hr = IDirect3DDevice9_GetDirect3D(device, &d3d9);
if (hr != D3D_OK || !device)
return D3DERR_INVALIDCALL;
IDirect3D9_GetAdapterDisplayMode(d3d9, D3DADAPTER_DEFAULT, &d3ddm);
/* TODO: Use something more advanced that looks more like what's in MSDN. */
hr = IDirect3D9_CheckDeviceFormat(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, usage, D3DRTYPE_TEXTURE, *format);
You shouldn't guess the adapter, device type, etc., but use whatever the device was created with. IDirect3DDevice9_GetCreationParameters() should help there.
if (hr != D3D_OK) {
if (usage & D3DUSAGE_DEPTHSTENCIL) {
switch (*format) {
...
}
IDirect3D9_Release(d3d9);
- }
I'm not sure about the big switch statement there, but I do know that just changing the format isn't enough. There's no guarantee the new format will work, or if there is any format that will support that specific set of usage flags at all.
Hi!
On Fri, Sep 19, 2008 at 07:04:04PM +0200, Henri Verbeet wrote:
2008/9/19 Philip Nilsson pnilsson@nullref.se:
hr = IDirect3DDevice9_GetDirect3D(device, &d3d9);
if (hr != D3D_OK || !device)
return D3DERR_INVALIDCALL;
IDirect3D9_GetAdapterDisplayMode(d3d9, D3DADAPTER_DEFAULT, &d3ddm);
/* TODO: Use something more advanced that looks more like what's in MSDN. */
hr = IDirect3D9_CheckDeviceFormat(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, usage, D3DRTYPE_TEXTURE, *format);
You shouldn't guess the adapter, device type, etc., but use whatever the device was created with. IDirect3DDevice9_GetCreationParameters() should help there.
Thanks, I didn't know there was a way. It doesn't matter in the test though as I control the creation there, right?
if (hr != D3D_OK) {
if (usage & D3DUSAGE_DEPTHSTENCIL) {
switch (*format) {
...
}
IDirect3D9_Release(d3d9);
- }
I'm not sure about the big switch statement there, but I do know that just changing the format isn't enough. There's no guarantee the new format will work, or if there is any format that will support that specific set of usage flags at all.
Yes, it doesn't take much for it to go wrong. It's basically just correct for my settings.
A huge table containing the 12 different channels I know of might come in handy. I'm not looking forward to filling it out though. (I do however have some interesting ideas for the selection, so I'll do it as soon as I can.)
Regards.