Jump to content
  • Advertisement
Sign in to follow this  
Fassbinderfan

Trying to get D3DDEVTYPE_REF going, backbufferformat error

This topic is 4010 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I can run a bunch directX samples on my laptop. It gives me that little warning about using REF in the upper left corner. So I've been trying to create a d3d device with D3DDEVTYPE_REF. But I keep getting "Invalid value for BackBufferFormat. ValidatePresentParameters fails". Heres the code. Thanks for any help. HWND hwnd = AfxGetMainWnd()->GetSafeHwnd(); if( NULL == ( pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) ) AfxMessageBox("fail1"); D3DDISPLAYMODE d3ddm; if(FAILED(pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm))) AfxMessageBox("fail2"); D3DPRESENT_PARAMETERS d3dpp; ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferFormat = d3ddm.Format;//D3DFMT_UNKNOWN; d3dpp.BackBufferCount = 1; d3dpp.hDeviceWindow = hwnd; if( FAILED( pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pd3dDevice ) ) ) AfxMessageBox("CreateDevice error");

Share this post


Link to post
Share on other sites
Advertisement
whats your adaptor display format set to at the moment? Does it work if you change

d3dpp.BackBufferFormat = d3ddm.Format;//D3DFMT_UNKNOWN;

to

d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;


Is there any reason why you need to use the same back buffer format as your current display mode?

Sorry if i have misunderstood. hope this helps

EDIT:
sorry just noticed you havent set the back buffer resolution:

d3dpp.BackBufferWidth = 800;
d3dpp.BackBufferHeight = 600;

Share this post


Link to post
Share on other sites
I changed d3dpp.BackBufferFormat to

d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;

And added backbuffer Height & Width

The part where it is failing is:

if( FAILED( pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hwnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &pd3dDevice ) ) )
AfxMessageBox("CreateDevice error");

The error message box pops up and output window shows:
Loaded 'C:\...d3dref.dll', No symbold loaded

Share this post


Link to post
Share on other sites
What's the value of d3ddm.Format after the GetAdapterDisplayMode() call? And what happens if you use a format of D3DFMT_UNKNOWN? That's valid for windowed mode.

jrmcv: In windowed mode, the backbuffer format has to match the display adater format.

Everything else looks correct to me (Apart from the width and height as jrmcv said). Does that code work with the HAL device, or do neither work?

Share this post


Link to post
Share on other sites
d3ddm.Format = D3DFMT_R8G8B8

If I use D3DFMT_UNKNOWN then I'll get "Invalid value for BackBufferFormat. ValidatePresentParameters fails" error.

If I try _HAL, i get same BackBufferFormat error.

Height and Width same as current display.

I've been going thru DirectX samples code since they work. But the beginner ones I've look at seems waaay out.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!