Jump to content
  • Advertisement
Sign in to follow this  
Milquetoasty

DirectDraw - Backbuffer Problems

This topic is 4088 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

HRESULT: 0x887600ff (2289434879) Name: DDERR_NOTFOUND Description: Requested item was not found Severity code: Failed Facility Code: FACILITY_D3D (2166) Error Code: 0x00ff (255) This error is propagated from a primarySurface->GetAttachedSurface(..) call. I use this code to create my surfaces
	DDSURFACEDESC2 ddsd;
	DDSCAPS2 ddscaps;
	HRESULT ddrval;

	memset( &ddsd, 0, sizeof(ddsd) );
	ddsd.dwSize = sizeof( ddsd );

	ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
	ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
	ddsd.dwBackBufferCount = 1;

	ddrval = idd->CreateSurface( &ddsd, &surfacePrimary, NULL );
	if( ddrval != DD_OK )
	{
		idd->Release();
	}

	// Get the pointer to the back buffer - fails
	ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
	ddrval = surfacePrimary->GetAttachedSurface(&ddscaps, &surfaceBack);
	if( ddrval != DD_OK )
	{
		surfacePrimary->Release();
		idd->Release();
	}

Share this post


Link to post
Share on other sites
Advertisement
Quote:
// Get the pointer to the back buffer - fails
ddscaps.dwCaps = DDSCAPS_BACKBUFFER;


So what are the other members of ddscaps set to?

If this is a debug build, they will most likely be set to 0xCCCCCCCC (the value put into uninitialised variables and members in debug builds).

That means your code (as presented) is asking DirectDraw for a back buffer AND whatever bizarre combination of caps flags 0xCCCCCCCC ends up mapping to.

Share this post


Link to post
Share on other sites
There is a DDSCAPS2 member in DDSURFACEDESC2, which is what I use to create a backbuffer. I dunno why you switched it from the primary surface (ddsd.ddsCaps) to the backbuffer (ddscaps). the DDSURFACEDESC2 is passed in by reference, so the first call probably alters it somehow, and by using a different object for the backbuffer, you get an error.


ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
if(FAILED(surfacePrimary->GetAttachedSurface(&ddsd.ddsCaps, &surfaceBack)))
{
// Handle the error
}



If it doesn't work, output what error ddrval gives. It will help you narrow down the problem.

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!