def create(self):

        if self.remove_fireflies:
            self.target_firefly = self.create_target("RemoveFireflies")
            self.target_firefly.add_color_attachment(bits=16)
            self.target_firefly.prepare_buffer()

        self.scene_target_img = Image.create_2d("BloomDownsample", 0, 0, "RGBA16")
        self.scene_target_img.set_minfilter(SamplerState.FT_linear_mipmap_linear)
        self.scene_target_img.set_magfilter(SamplerState.FT_linear)
        self.scene_target_img.set_wrap_u(SamplerState.WM_clamp)
        self.scene_target_img.set_wrap_v(SamplerState.WM_clamp)
        self.scene_target_img.set_clear_color(Vec4(0.1, 0.0, 0.0, 1.0))
        self.scene_target_img.clear_image()

        self.target_extract = self.create_target("ExtractBrightSpots")
        self.target_extract.prepare_buffer()
        self.target_extract.set_shader_input("DestTex", self.scene_target_img, False, True, -1, 0)

        if self.remove_fireflies:
            self.target_extract.set_shader_input("ShadedScene", self.target_firefly.color_tex, 1000)

        self.downsample_targets = []
        self.upsample_targets = []

        # Downsample passes
        for i in range(self.num_mips):
            scale_multiplier = 2 ** (1 + i)
            target = self.create_target("Downsample:Step-" + str(i))
            target.size = -scale_multiplier, -scale_multiplier
            target.prepare_buffer()
            target.set_shader_input("sourceMip", i)
            target.set_shader_input("SourceTex", self.scene_target_img)
            target.set_shader_input("DestTex", self.scene_target_img, False, True, -1, i + 1)
            self.downsample_targets.append(target)

        # Upsample passes
        for i in range(self.num_mips):
            scale_multiplier = 2 ** (self.num_mips - i - 1)
            target = self.create_target("Upsample:Step-" + str(i))
            target.size = -scale_multiplier, -scale_multiplier
            target.prepare_buffer()
            target.set_shader_input("FirstUpsamplePass", i == 0)

            target.set_shader_input("sourceMip", self.num_mips - i)
            target.set_shader_input("SourceTex", self.scene_target_img)
            target.set_shader_input("DestTex", self.scene_target_img,
                                    False, True, -1, self.num_mips - i - 1)
            self.upsample_targets.append(target)

        self.target_apply = self.create_target("ApplyBloom")
        self.target_apply.add_color_attachment(bits=16)
        self.target_apply.prepare_buffer()
        self.target_apply.set_shader_input("BloomTex", self.scene_target_img)
dataset/ETHPy150Open tobspr/RenderPipeline/rpplugins/bloom/bloom_stage.py/BloomStage.create/original