Sign in to follow this  

DirectDraw - Backbuffer Problems

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

This topic is 3837 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.

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