You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: backend_horizon.rs
    path of file: ./repos/doukutsu-rs/src/framework
    
    the code of the file until where you have to start completion: use std::any::Any;
use std::cell::{RefCell, UnsafeCell};
use std::fmt::format;
use std::mem;
use std::pin::Pin;
use std::ptr::slice_from_raw_parts_mut;

use imgui::{DrawData, TextureId, Ui};
use itertools::all;
use lazy_static::lazy_static;

use deko3d::{
    make_texture_handle, Barrier, BlendFactor, BlendOp, BlendState, CmdBuf, CmdBufMaker, ColorMask, ColorState,
    ColorWriteState, CopyBuf, DepthStencilState, DeviceMaker, Face, Filter, Image, ImageDescriptor, ImageFlags,
    ImageFormat, ImageLayout, ImageLayoutMaker, ImageRect, ImageView, InvalidateFlags, MemBlock, MemBlockFlags,
    MemBlockMaker, MipFilter, Primitive, QueueFlags, QueueMaker, RasterizerState, ResHandle, Sampler,
    SamplerDescriptor, Scissor, Shader, ShaderMaker, Stage, StageFlag, SwapchainMaker, Viewport, VtxAttribSize,
    VtxAttribState, VtxAttribType, VtxBufferState, WrapMode, DK_CMDMEM_ALIGNMENT, DK_MEMBLOCK_ALIGNMENT,
    DK_SHADER_CODE_ALIGNMENT, DK_SHADER_CODE_UNUSABLE_SIZE, DK_UNIFORM_BUF_ALIGNMENT,
};

use crate::common::{Color, Rect};
use crate::framework::backend::{
    Backend, BackendEventLoop, BackendGamepad, BackendRenderer, BackendShader, BackendTexture, SpriteBatchCommand,
    VertexData,
};
use crate::framework::context::Context;
use crate::framework::error::{GameError, GameResult};
use crate::framework::gamepad;
use crate::framework::gamepad::{Axis, Button, GamepadType};
use crate::framework::graphics::BlendMode;
use crate::framework::util::field_offset;
use crate::game::shared_game_state::SharedGameState;
use crate::game::Game;

    
    fn create_texture_mutable(&mut self, width: u16, height: u16) -> GameResult<Box<dyn BackendTexture>> {
        let img_total = width as u32 * height as u32 * 4;
        let desc_memory = MemBlockMaker::new(
            &self.device,
            align(std::mem::size_of::<Deko3DTextureDesc>() as u32, DK_MEMBLOCK_ALIGNMENT),
        )
        .set_flags(MemBlockFlags::CpuUncached | MemBlockFlags::GpuCached)
        .create();

        let mut desc_cpu = unsafe { &mut *(desc_memory.get_cpu_addr() as *mut Deko3DTextureDesc) };
        desc_cpu.sampler = SamplerDescriptor::new();
        desc_cpu.image = ImageDescriptor::new();

        let mut layout = ImageLayout::new();
        ImageLayoutMaker::new(&self.device)
            .set_flags(ImageFlags::UsageRender | ImageFlags::BlockLinear)
            .set_format(ImageFormat::RGBA8Unorm)
            .set_dimensions(width as u32, height as u32, 0)
            .initialize(&mut layout);

        let memory = MemBlockMaker::new(
            &self.device,
            align(layout.get_size() as u32, DK_MEMBLOCK_ALIGNMENT.max(layout.get_alignment())),
        )
        .set_flags(MemBlockFlags::Image | MemBlockFlags::GpuCached)
        .create();

        let mut image = Image::new();
        image.initialize(&layout, &memory, 0);

        desc_cpu.image.initialize(&ImageView::new(&image), false, false);
        desc_cpu.sampler.initialize(
            &Sampler::new().set_filter(Filter::Nearest, Filter::Nearest, MipFilter::None).set_wrap_mode(
                WrapMode::ClampToEdge,
                WrapMode::ClampToEdge,
                WrapMode::ClampToEdge,
            ),
        );

        let vbo = Deko3DVertexBuffer::new(&self.device)?;

        Ok(Box::new(Deko3DTexture {
            dimensions: (width, height),
            desc_memory,
            memory,
            image,
            vertices: Vec::new(),
            vbo,
            renderer: self,
        }))
    }