Sign in to follow this  
Chimmeke

Some DirectX Warnings

Recommended Posts

hi,

i get some directx warnings when probably when creating the d3ddevice9. firstly these warnings occur:
[code]Direct3D9: (WARN) :No SW device has been registered. GetAdapterCaps fails.
D3D9 Helper: IDirect3D9::GetDeviceCaps failed: D3DERR_NOTAVAILABLE
Direct3D9: (WARN) :Invalid backbuffer format specified[/code]

and finally i have thousands of these warnings which are always the same:
[code]Direct3D9: (WARN) :Stream 0 stride and vertex size, computed from the current vertex declaration or FVF, are different, which might not work with pre-DX8 drivers[/code]

and this error:

[code]
Direct3D9: (ERROR) :BitBlt or StretchBlt failed in Present[/code]

has anybody encountered this problem before?
many thanks in advance.

edit: for some reason the error doesn't occur anymore.

Share this post


Link to post
Share on other sites
As for the first two errors it would be useful to see the code that you are using to create for device, it seems that its complaining that there is not a Software Device registered, are you creating the device with the SOFTWARE or HARDWARE flag? The second error is comlpaining about the storage format of the backbuffer texture, it would be useful to see where you are creating that as some formats are not supported by all machines.

The third one seems to be that your FVF's that you used to create your vertex buffers do not fit the ones you are using to draw primitives with, again it would be useful to see where you create and define your FVF's and then how you use them in the draw call.

Cheers.

Share this post


Link to post
Share on other sites
thanks for your response! the code where i create the device:
[code]
ZeroMemory(&PresentParams, sizeof(D3DPRESENT_PARAMETERS));
PresentParams.BackBufferWidth = Config->Direct3D.Videomode.Width;
PresentParams.BackBufferHeight = Config->Direct3D.Videomode.Height;
PresentParams.BackBufferFormat = Config->Direct3D.BackbufferFormat;
PresentParams.BackBufferCount = 1;
PresentParams.MultiSampleType = Config->Direct3D.MultiSampleType;
PresentParams.MultiSampleQuality = Config->Direct3D.MultiSampleQuality-1;
PresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
PresentParams.hDeviceWindow = Window;
PresentParams.Windowed = Config->Direct3D.Windowed;
PresentParams.EnableAutoDepthStencil = TRUE;
PresentParams.AutoDepthStencilFormat = Config->Direct3D.ZStencilbufferFormat;
PresentParams.Flags = Config->Direct3D.Flags;
PresentParams.FullScreen_RefreshRateInHz = Config->Direct3D.Windowed ? D3DPRESENT_RATE_DEFAULT : Config->Direct3D.Videomode.RefreshRate;
PresentParams.PresentationInterval = Config->Direct3D.V_SyncEnabled ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;

// Create Device
HRESULT hRes;
if (FAILED(hRes = D3D->CreateDeviceEx(Config->Direct3D.AdapterID, Config->Direct3D.DeviceType,
Window, Config->Direct3D.Flags, &PresentParams, NULL, &D3DDevice)))
{
ex_ERROR_DIRECTX("Error when creating D3DDevice!", hRes);
return ex_ERROR;
}[/code]
[code]PDIRECT3DDEVICE9EX D3DDevice;
D3DPRESENT_PARAMETERS PresentParams;[/code]

this magic [i]Config [/i]is just a struct that contains the parameters for the presentation-struct. when i debugged the parameters were the following:
[code] PresentParams.BackBufferWidth = 1366;
PresentParams.BackBufferHeight = 768;
PresentParams.BackBufferFormat = D3DFMT_R5G6B5;;
PresentParams.BackBufferCount = 1;
PresentParams.MultiSampleType = D3DMULTISAMPLE_8_SAMPLES;
PresentParams.MultiSampleQuality = 0;
PresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
PresentParams.hDeviceWindow = Window;
PresentParams.Windowed = TRUE;
PresentParams.EnableAutoDepthStencil = TRUE;
PresentParams.AutoDepthStencilFormat = D3DFMT_D24S8;
PresentParams.Flags = D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE;
PresentParams.FullScreen_RefreshRateInHz = 0;
PresentParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;[/code]

the devicetype was D3DDEVTYPE_HAL.
my machine should support all these parameters. i took a look on the caps viewer to check the videomodes:
[img]http://img837.imageshack.us/img837/9861/capsi.jpg[/img]
the last entry shows that my settings are so far accepted. of course the rest (linke z-stencilbuffer format) aren't considered here, but i assure you that the rest is compatible.

now to the drawing of y triangle:

the vertexstruct:
[code]// +++++++++++++++++++++++++++
// Vertexstruct
struct TestVertex
{
exVector3 Position;
exColor Color;
static const DWORD FVF;
};

const DWORD TestVertex::FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE;

TestVertex Vertices[3];[/code]

the init:
[code] // Set FVF
if (FAILED(hRes = D3DDevice->SetFVF(TestVertex::FVF)))
{
ex_ERROR_DIRECTX("Error when setting FVF", hRes);
return ex_ERROR;
}[/code]

the drawing;
[code]
D3DDevice->BeginScene();

// Draw triangle
if (FAILED(hRes = D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 1, Vertices, sizeof(TestVertex))))
{
ex_ERROR_DIRECTX("Error when drawing the triangle!", hRes);
return ex_STOP;
}

D3DDevice->EndScene();[/code]

hope i havn't forgotten anything...

Share this post


Link to post
Share on other sites
[code]
// +++++++++++++++++++++++++++
// Vertexstruct
struct TestVertex
{
exVector3 Position;
exColor Color;
static const DWORD FVF;
};

const DWORD TestVertex::FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE;
[/code]

Will have to look at the other errors more, but as for this one; is it possible that your custom types 'exVector3' and 'exColor' are differently sized to the expected sizes defined by 'D3DFVF_XYZ' etc? Either through being explicitly different or something like structure padding? Would maybe worth trying just pain old D3DXVECTOR3 and D3DXCOLOR to see if that same thing happens.

Cheers.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this