Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Incorrect DepthStencilView for DepthStencilBuffer with array size > 1. #210

Closed
MichaelKoivisto opened this issue Nov 22, 2013 · 1 comment
Labels

Comments

@MichaelKoivisto
Copy link

Hi all,

When I create a RenderTarget2D and corresponding DepthStencilBuffer with array size>1, the default DepthStencilView provided by DepthStencilBuffer is incorrect (corresponds to array size = 1).

Example code:

        int rtArraySize = 5;

        rt = RenderTarget2D.New(GraphicsDevice, w, h, 
            PixelFormat.R8G8B8A8.UNorm, 
            TextureFlags.RenderTarget,
            rtArraySize);
        dsb = DepthStencilBuffer.New(GraphicsDevice,
            rt.Width, rt.Height,
            DepthFormat.Depth16, false, rtArraySize);
        GraphicsDevice.SetTargets(dsb, rt);
        // then do some rendering...

The above code results in nothing being rendered, because RenderTarget2D is casted to a correct view with array size = 5, but DepthStencilBuffer is casted to a DepthStencilView with array size = 1.

I believe this is a bug. It can be fixed by changing the code in DepthStencilBuffer.InitializeViewsDelayed().

@ArtiomCiumac
Copy link
Contributor

This should be fixed now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants