   "unset" an effect variable
  There may be effects that contain variables that are not used by a particular technique, or perhaps they are not used because of some condition logic.For examplefloat4    diffuseColor;Texture2D diffuseTexture;Maybe my system assigns a negative value to diffuse color if a texture is supposed to be used and has a conditionif( diffuseColor < 0 ){   // Sample}I've run into a spot in my application code, where I am not sure what to do. I would really like to be able to "unset" the shader resource view that was bound to the effect's texture variable, in order to have D3D display its warnings and get a more expected behavior for when errors arise.As it is, I don't think I have a choice, but to leave the previously bound texture, bound to the effect.What can you do here?I hope you understand, that differant "materials" or rather effect variable collections in my application are bound to the same effect at different times. I am trying to handle the case where a previous "material" bound a texture to the effect, but a new material has none assigned to it.//----------------------------------------------------------------------------void Effect::UpdateTextures(const Material & material){   BaseException exception("Not Set",  "void Effect::UpdateTextures(const Material & material)",  "Effect.cpp");   for(EffectTextureVariables::iterator effectTextureItr = m_effectTextureVariables.begin();   effectTextureItr != m_effectTextureVariables.end(); ++effectTextureItr)   { std::string name = effectTextureItr->first; // Get the given material's texture name Material::TextureNames::const_iterator materialTextureItr = material.m_textureNames.end(); if( !material.m_textureNames.empty() ) {    materialTextureItr = material.m_textureNames.find(name); } if( materialTextureItr == material.m_textureNames.end() ) {    exception.m_msg = "Effect contains texture variable not found in given material: " + name;    throw exception; } // Get the current material's texture name Material::TextureNames::iterator curMaterialTextureItr = m_material.m_textureNames.end(); if( !m_material.m_textureNames.empty() ) {    curMaterialTextureItr = m_material.m_textureNames.find(name); } if( curMaterialTextureItr == m_material.m_textureNames.end() ) {    // The current material should always have an entry for the effect variable or it would never have become the current material    exception.m_msg = std::string("Current material does not contain a variable for effect texture variable: ") + name;    throw exception; }  // If the current material's texture name has not been initialized... if( !curMaterialTextureItr->second.m_initialized ) {    // ...and if the new material's texture name has been initialized    if( materialTextureItr->second.m_initialized )    {  // Set the effect's texture variable and the current material's texture name variable to that of the new material  m_textureManager.SetTextureEffectVariable(materialTextureItr->second.m_value, effectTextureItr->second); curMaterialTextureItr->second.m_value = materialTextureItr->second.m_value;  curMaterialTextureItr->second.m_initialized = true;    } } // The current material's texture name has been initialized // If the new material's texture name has been initialized... else if( materialTextureItr->second.m_initialized ) {    // ...and if the values of the current and new material's texture names do not match    if( curMaterialTextureItr->second.m_value != materialTextureItr->second.m_value )    {  // Set the effect's texture variable and the current material's texture name variable to that of the new material  m_textureManager.SetTextureEffectVariable(materialTextureItr->second.m_value, effectTextureItr->second); curMaterialTextureItr->second.m_value = materialTextureItr->second.m_value;  curMaterialTextureItr->second.m_initialized = true;    } } // The current material's texture name has been intialized and the new material's texture name has not else {    // This may have been intended by the developer, it depends on how the effect variable is used.    // Some effects contain variables that do not get used by certain techniques in the effect.   // TODO - Log a warning    // Set the effect's texture name to a default value.    //    // Not much we can do here, there is no way that I know of to 'unset' an effect variable    // We could assign a default texure, but that would probably cause more problems.    // Until something better is realized, the previous texture will be left bound to the effect.    std::string value = "Not Set";//  m_textureManager.SetTextureEffectVariable(value, effectTextureItr->second);    // Set the current material's texture name attribute to unintialized    curMaterialTextureItr->second.m_initialized = false;   }   }}