• Advertisement
Sign in to follow this  

Short question about ID3D10ShaderResourceView

This topic is 3135 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 only a short question about ID3D10ShaderResourceView How can I test if a variable of the ID3D10ShaderResourceView type is set yet or not so for example i have the variable ID3D10ShaderResourceView pTexture now I want to test if pTexture has assigned any value yet or not if I want it to test with: if(pTexture == NULL) oder if(!pTexture) this has no effect for me. The if statement is always false and the block after the statement is never executed (I have pTexture stored in a struct and at the beginning of the application i allocate memory for a array of this struct. So there are some ID3D10ShaderResourceView variables in memory which shouldn't have any value right now)

Share this post


Link to post
Share on other sites
Advertisement
I am not sure what you are doing. Can you show us some of your initialization code?

Share this post


Link to post
Share on other sites
ok I want to code a simple TextureManager
therefore i have the following struct

struct TextureManager
{
LPCWSTR textureName;
ID3D10ShaderResourceView* pTextureRV;
};


After program start I allocate an array of this struct. Lets say 15 elements for the beginning
When I want to add a new Texture to that array I have to check the array and find a free index (where pTextureRV is empty). And here is my problem: How can i check if the pTextureRV is empty or already filled? (pTexture == NULL or !pTexture doesn't work)

Share this post


Link to post
Share on other sites
Now I understand your problem. C++ doesn’t fill newly allocated memory with useful values. It will contain garbage. Therefore you are responsible to set initial values (in your case NULL) to all elements in the array after memory allocation.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement