MCPcopy Create free account
hub / github.com/GPUOpen-Tools/compressonator / GetMipLevel

Method GetMipLevel

cmp_framework/common/cmp_mips.cpp:810–874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

808}
809
810CMP_MipLevel* CMP_CMIPS::GetMipLevel(const CMP_MipSet* pMipSet, int nMipLevel, int nFaceOrSlice)
811{
812 if (!pMipSet)
813 {
814 assert(pMipSet);
815 return NULL;
816 }
817
818 if (!pMipSet->m_pMipLevelTable)
819 {
820 return NULL;
821 }
822
823 if (nMipLevel > MAX_MIPLEVEL_SUPPORTED)
824 {
825 return NULL;
826 }
827
828 if (nMipLevel > pMipSet->m_nMaxMipLevels)
829 {
830 assert(nMipLevel <= pMipSet->m_nMaxMipLevels);
831 return NULL;
832 }
833 if (nFaceOrSlice < 0)
834 {
835 return NULL; //not an error, indicates requested face doesn't exist
836 }
837 int nDepth = pMipSet->m_nDepth, index = 0, whichMipLevel = 0;
838
839 switch (pMipSet->m_TextureType)
840 {
841 case TT_1D:
842 case TT_2D:
843 if (nFaceOrSlice != 0)
844 {
845 return NULL;
846 }
847 return (pMipSet->m_pMipLevelTable)[nMipLevel];
848 case TT_CubeMap:
849 if (nFaceOrSlice > 6)
850 { //cubemap have at most 6 faces
851 assert(nFaceOrSlice > 6);
852 return NULL;
853 }
854 return (pMipSet->m_pMipLevelTable)[nMipLevel * nDepth + nFaceOrSlice];
855 case TT_VolumeTexture:
856 while (whichMipLevel <= nMipLevel)
857 {
858 if (whichMipLevel == nMipLevel)
859 {
860 return (pMipSet->m_pMipLevelTable)[index + nFaceOrSlice];
861 }
862 else
863 {
864 index += nDepth;
865 whichMipLevel++;
866 nDepth = nDepth > 1 ? nDepth >> 1 : 1;
867 }

Callers 15

CMP_ConvertMipTextureFunction · 0.80
loadMIPImageMethod · 0.80
keyPressEventMethod · 0.80
GetSourceBlockMethod · 0.80
onSaveViewAsMethod · 0.80
UpdatePixmapImageMethod · 0.80
Tree_AddImageFileMethod · 0.80
ReadBlockDataFunction · 0.80
WriteBlockHeaderFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected