Hi,
- ok((desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) == DDSCAPS_ZBUFFER, "Expected caps containing %x, got %x.\n", DDSCAPS_ZBUFFER, desc.ddsCaps.dwCaps);
Style-only issue: You're just checking one flag here, so ok(dwCaps & ZBUFFER, "..."); is enough
- IDirectDrawSurface_Release(surface);
- memset(&desc, 0, sizeof(desc));
- desc.dwSize = sizeof(desc);
- desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
- desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
- desc.dwWidth = rc.right;
- desc.dwHeight = rc.bottom;
- hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL);
- ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
Minor issue: I don't think there's a reason to destroy and recreate the surface.
- IDirectDrawSurface_Release(d3drm_ds);
- IDirectDrawSurface_Release(d3drm_surface);
- IDirectDrawSurface_Release(ds);
What happens to the depth buffer here? Does it remain attached?
Stefan
On Fri, Jun 26, 2015 at 2:32 AM, Stefan Dösinger stefandoesinger@gmail.com wrote:
Minor issue: I don't think there's a reason to destroy and recreate the surface.
The other way afaik is to QI surface version >= 3 and then call SetSurfaceDesc. This seemed easier to do so. Is there some other way?
- IDirectDrawSurface_Release(d3drm_ds);
- IDirectDrawSurface_Release(d3drm_surface);
- IDirectDrawSurface_Release(ds);
What happens to the depth buffer here? Does it remain attached?
At this point (after releasing ds) the refcounts of both ds and render target (i.e. surface) become 1.
About the refcount of the depth surface after render target is destroyed: How about a simple NULL check for lpvtbl?
On Fri, Jun 26, 2015 at 5:32 PM, Aaryaman Vasishta < jem456.vasishta@gmail.com> wrote:
On Fri, Jun 26, 2015 at 2:32 AM, Stefan Dösinger < stefandoesinger@gmail.com> wrote:
Minor issue: I don't think there's a reason to destroy and recreate the surface.
The other way afaik is to QI surface version >= 3 and then call SetSurfaceDesc. This seemed easier to do so. Is there some other way?
- IDirectDrawSurface_Release(d3drm_ds);
- IDirectDrawSurface_Release(d3drm_surface);
- IDirectDrawSurface_Release(ds);
What happens to the depth buffer here? Does it remain attached?
At this point (after releasing ds) the refcounts of both ds and render target (i.e. surface) become 1.
I was corrected by Henri about that behaviour. I shouldn't use that as a check. Regardless, the tests do by themselves amount to the fact that the depth surface remains attached even after we explictly release all our references to it (therefore the refcount is 1 after calling release on the last reference). So after destroying the root surface, the attached surface is also destroyed as it's refcount was 1, and ddraw implicitly calls DeleteAttachedSurface which decrements that refcount to 0, in turn destroying it.
On Fri, Jun 26, 2015 at 6:26 PM, Aaryaman Vasishta < jem456.vasishta@gmail.com> wrote:
About the refcount of the depth surface after render target is destroyed: How about a simple NULL check for lpvtbl?
On Fri, Jun 26, 2015 at 5:32 PM, Aaryaman Vasishta < jem456.vasishta@gmail.com> wrote:
On Fri, Jun 26, 2015 at 2:32 AM, Stefan Dösinger < stefandoesinger@gmail.com> wrote:
Minor issue: I don't think there's a reason to destroy and recreate the surface.
The other way afaik is to QI surface version >= 3 and then call SetSurfaceDesc. This seemed easier to do so. Is there some other way?
- IDirectDrawSurface_Release(d3drm_ds);
- IDirectDrawSurface_Release(d3drm_surface);
- IDirectDrawSurface_Release(ds);
What happens to the depth buffer here? Does it remain attached?
At this point (after releasing ds) the refcounts of both ds and render target (i.e. surface) become 1.