Mista, thanks for the tip.
I've been looking into it, and it results that it makes these calls:
CheckDeviceFormat(0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0x00000002, D3DRTYPE_SURFACE, D3DFMT_D24S8)
and
CheckDepthStencilMatch(0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DFMT_X8R8G8B8, D3DFMT_D24S8)
So it uses the same d3dformats as the previous sample.
I've made this final version with the msdn functions:
#include "DarkGDK.h"
#include "D3D9.h"
BOOL IsDepthFormatExisting ( D3DFORMAT DepthFormat,
D3DFORMAT AdapterFormat ) ;
BOOL IsDepthFormatOk ( D3DFORMAT DepthFormat,
D3DFORMAT AdapterFormat,
D3DFORMAT BackBufferFormat);
IDirect3D9* pD3D ;
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetDisplayMode (640, 480, 32);
//Assign the pointer
pD3D = dbGetDirect3D();
while ( LoopGDK ( ) )
{
dbSetCursor (0,0);
if ( IsDepthFormatExisting( D3DFMT_D24S8, D3DFMT_X8R8G8B8 ) )
{
dbPrint("Format exists");
if ( IsDepthFormatOk( D3DFMT_D24S8, D3DFMT_X8R8G8B8, D3DFMT_X8R8G8B8 ) )
{
dbPrint("Supported format");
}
else
{
dbPrint("Unsupported format");
}
}
else
{
dbPrint("Format does not exists");
}
dbSync ( );
}
return;
}
BOOL IsDepthFormatExisting( D3DFORMAT DepthFormat, D3DFORMAT AdapterFormat )
{
HRESULT hr = pD3D->CheckDeviceFormat( D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
AdapterFormat,
D3DUSAGE_DEPTHSTENCIL,
D3DRTYPE_SURFACE,
DepthFormat);
return SUCCEEDED( hr );
}
BOOL IsDepthFormatOk(D3DFORMAT DepthFormat,
D3DFORMAT AdapterFormat,
D3DFORMAT BackBufferFormat)
{
// Verify that the depth format exists
HRESULT hr = pD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, //0
D3DDEVTYPE_HAL, //D3DDEVTYPE_HAL
AdapterFormat, //D3DFMT_X8R8G8B8
D3DUSAGE_DEPTHSTENCIL, //0x00000002
D3DRTYPE_SURFACE, //D3DRTYPE_SURFACE
DepthFormat); //D3DFMT_D24S8
if(FAILED(hr)) return FALSE;
// Verify that the depth format is compatible
hr = pD3D->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, //0
D3DDEVTYPE_HAL, //D3DDEVTYPE_HAL
AdapterFormat, //D3DFMT_X8R8G8B8
BackBufferFormat, //D3DFMT_X8R8G8B8
DepthFormat); //D3DFMT_D24S8
return SUCCEEDED(hr);
}
However it still returns that the format exists and is supported in machines with shadows crashing.
How could it be in other way if DGDK eats it as well and tries to run the program?
Or there is something else to check, or the video drivers are too much happy