def _make_specular_targets(self):
        """ Internal method to create the specular mip chain """
        self._targets_spec = []
        self._targets_spec_filter = []
        mip, mipsize = 0, self._size
        while mipsize >= 2:

            # Assuming an initial size of a power of 2, its safe to do this
            mipsize = mipsize // 2

            # Create the target which downsamples the mipmap
            target = self._stage.create_target("CF:SpecIBL-PreFilter-" + str(mipsize))
            target.size = mipsize * 6, mipsize
            target.prepare_buffer()

            if mip == 0:
                target.set_shader_input("SourceTex", self._specular_map)
            else:
                target.set_shader_input("SourceTex", self._spec_pref_map)
            target.set_shader_input("DestMipmap", self._spec_pref_map, False, True, -1, mip + 1, 0)
            target.set_shader_input("currentMip", mip)

            mip += 1

            # Create the target which filters the mipmap and removes the noise
            target_filter = self._stage.create_target("CF:SpecIBL-PostFilter-" + str(mipsize))
            target_filter.size = mipsize * 6, mipsize
            target_filter.prepare_buffer()
            target_filter.set_shader_inputs(currentMip=mip, SourceTex=self._spec_pref_map)
            target_filter.set_shader_input("DestMipmap", self._specular_map, False, True, -1, mip, 0)

            self._targets_spec.append(target)
            self._targets_spec_filter.append(target_filter)
 Internal method to create the specular mip chain 
metadrive/render_pipeline/rpcore/util/cubemap_filter.py