#pragma once
#include "dx_texture.h"
#include "core/renderer/renderer_texture_array.h"

class dx_texture;

class dx_texture_array : public renderer_texture_array {
public:
    dx_texture_array(const Eigen::Vector2i& size, texture_format format, const uint32_t count, device_memory_type in_memory_type): renderer_texture_array(format) {
        texture = new dx_texture(size, format, in_memory_type, count);
    }
    ~dx_texture_array() override { delete texture; }

    void* lock(const uint32_t index, uint32_t* out_row_pitch) override { return texture->lock(index, out_row_pitch); }
    void unlock(const uint32_t index) override { texture->unlock(index); }
    void update_subresource(const uint32_t index, const Eigen::AlignedBox2i& in_area, const void* in_buffer, uint32_t in_buffer_size) override {
        texture->update_subresource(index, in_area, in_buffer, in_buffer_size);
    }

    bool resize(const Eigen::Vector2i& size) override { return texture->resize(size); }
    Eigen::Vector2i size() override { return texture->size(); }

    void* get_native_handle() override { return texture->get_native_handle(); }
    void* get_shader_resource_view() override { return texture->get_shader_resource_view(); }
    
    [[nodiscard]] uint32_t get_count() override { return texture->get_count(); }
protected:
    void on_set_count(const uint32_t in_count) override { texture->set_count(in_count); }

private:
    dx_texture* texture;
};
