Jump to content
  • Advertisement
Sign in to follow this  
Techieman

IASetVertexBuffers is unvalidating resources

This topic is 1108 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 have noticed something strange. Whenever my application closes, it releases all resources (theoretically).

It just loops over it:

                Context::~Context(){
                    for(int i = 0; i < _VertexBuffers.size(); i++){
                        _VertexBuffers[i].release();
                    }

                    for(int i = 0; i < _IndexBuffers.size(); i++){
                        _IndexBuffers[i].release();
                    }

                    pSwapChain->Release();
                    pRTV->Release();
                    pDevice->Release();
                    pContext->Release();

                    // TODO:
                    // Keep track of created resources and delete them then.
                }

The release method is defined is following:

                    virtual void release(){
                        if(valid && (pBuffer != nullptr)){
                            valid = false;
                            pBuffer->Release();
                        }
                    }

However, I am getting an "Access Violation" when trying to clean up, even though the "valid" flag is set to true. I made sure, that "valid" is only "true" when a buffer was created successfully.
I tried to eliminate the spots and as it seems

                void    Context::setVertexBuffer(const unsigned int buffer_id){
                    UINT stride = sizeof(float) * 7;
                    UINT offset = 0;

                    if(_VertexBuffers[buffer_id].isValid())
                        pContext->IASetVertexBuffers(0,
                                                    1,
                                                    &(_VertexBuffers[buffer_id].pBuffer),
                                                    &stride,
                                                    &offset);
                }

As it seems, "IASetVertexBuffer" is kind of invalidating the resource.
I am probably using it the wrong way, am I not?

Cheers, 
Julien

Share this post


Link to post
Share on other sites
Advertisement
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!