// Deletes and properly releases all asset library lists that contain
// unwrapped IUnknown DirectX objects.
//-----------------------------------------------------------------------------
void CPUTAssetLibraryOGLES::ReleaseAllLibraryLists()
{
    // TODO: we really need to wrap the DX assets so we don't need to distinguish their IUnknown type.
    SAFE_RELEASE_LIST(m_pPixelShaderList);
    SAFE_RELEASE_LIST(m_pVertexShaderList);
    SAFE_RELEASE_LIST(m_pGeometryShaderList);
    SAFE_RELEASE_LIST(m_pHullShaderList);
    SAFE_RELEASE_LIST(m_pDomainShaderList);

    // Call base class implementation to clean up the non-DX object lists
    return CPUTAssetLibrary::ReleaseAllLibraryLists();
}
//-----------------------------------------------------------------------------
void CPUTAssetLibrary::ReleaseAllLibraryLists()
{
    // Release philosophy:  Everyone that references releases.  If node refers to parent, then it should release parent, etc...
    // TODO: Traverse lists.  Print names and ref counts (as debug aid)
#undef SAFE_RELEASE_LIST
#define SAFE_RELEASE_LIST(x) {ReleaseList(x); x = NULL;}

    SAFE_RELEASE_LIST(mpAssetSetList);
    SAFE_RELEASE_LIST(mpMaterialList);
    SAFE_RELEASE_LIST(mpMaterialEffectList);
    SAFE_RELEASE_LIST(mpModelList);
    SAFE_RELEASE_LIST(mpLightList);
    SAFE_RELEASE_LIST(mpCameraList);
    SAFE_RELEASE_LIST(mpNullNodeList);
    SAFE_RELEASE_LIST(mpTextureList );
    SAFE_RELEASE_LIST(mpBufferList );
    SAFE_RELEASE_LIST(mpConstantBufferList );
    SAFE_RELEASE_LIST(mpRenderStateBlockList );
    SAFE_RELEASE_LIST(mpFontList);
	SAFE_RELEASE_LIST(mpAnimationSetList);

	mpAssetSetListTail = NULL;
	mpNullNodeListTail = NULL;
	mpModelListTail = NULL;
	mpCameraListTail = NULL;
	mpLightListTail = NULL;
	mpMaterialListTail = NULL;
	mpTextureListTail = NULL;
	mpBufferListTail = NULL;
	mpConstantBufferListTail = NULL;
	mpRenderStateBlockListTail = NULL;
	mpFontListTail = NULL;
	mpAnimationSetListTail = NULL;

    // The following -specific items are destroyed in the derived class
    // TODO.  Move their declaration and definition to the derived class too
    // SAFE_RELEASE_LIST(mpPixelShaderList);
    // SAFE_RELEASE_LIST(mpVertexShaderList);
    // SAFE_RELEASE_LIST(mpGeometryShaderList);
}