Advertisement Jump to content
Sign in to follow this  
CdrTomalak

SlimDX D3D11 - Too many view objects.

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

Hi,

 

I've created a 2D game engine, and am now working on a few defects. The most concerning of which is the error:

 

D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS: There are too many unique view objects (-2005139453)

 

I've conducted a code review of my graphics methods.

 

Something I do repeatedly is this, in an example of my game board drawing code:

            testSRV = new SlimDX.Direct3D11.ShaderResourceView(graphics, SB_spriteTexture_blueBlock);

            foreach(TileToDraw tile in wallsToDraw_g)
            {            
                spriteRenderer.Draw(testSRV, tile.origin, new Vector2(rectangleSizeWall.Width,rectangleSizeWall.Height), CoordinateType.Absolute);
            }

            testSRV = new SlimDX.Direct3D11.ShaderResourceView(graphics, SB_spriteTexture_pill);

            foreach(TileToDraw tile in pillsToDraw_g)
            {            
                spriteRenderer.Draw(testSRV, tile.origin, new Vector2(rectangleSizePill.Width,rectangleSizePill.Height), CoordinateType.Absolute);
            }

So here I'm just drawing walls and pills on the game board (originated from pacman). I'm thinking that I should be doing something with the ShaderResourceView after I've used it - such as disposing it. Having tried this after the first foreach section (for walls) I find that the pills are not getting drawn at all. So I'm scratching my head wondering what next?

 

Any ideas? I've spent the last few months working on the game engine so I've not looked into the render methods for a loooong time.

 

Cheers!huh.png

 

Share this post


Link to post
Share on other sites
Advertisement

You shouldn't create new views every frame. Just create them once after loading the textures and dispose of them when you don't need them anymore (probably just before disposing the textures).

Share this post


Link to post
Share on other sites

Thanks Iwm! I went through the code and created a view for each texture as part of initialisation. The error has gone away now. I left the game running on 100 lives and it just keeps on going... smile.png

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!