OBS-Direct11数据结构
+ -

D3D11-obs数据结构类型大全

2024-06-19 24 0

OBS中对使用到的Direct11对象做了二次封装。这些被二次封装的对象都继随于结构体gs_obj。

struct gs_obj {
    gs_device_t *device;
    gs_type obj_type;
    gs_obj *next;
    gs_obj **prev_next;

    inline gs_obj() : device(nullptr), next(nullptr), prev_next(nullptr) {}

    gs_obj(gs_device_t *device, gs_type type);
    virtual ~gs_obj();
};
  • device:是显卡的所有导出函数集合。
  • obj_type:标识对象类型。这些对象类型有:
enum class gs_type {
    gs_vertex_buffer,
    gs_index_buffer,
    gs_texture_2d,
    gs_zstencil_buffer,
    gs_stage_surface,
    gs_sampler_state,
    gs_vertex_shader,
    gs_pixel_shader,
    gs_duplicator,
    gs_swap_chain,
    gs_timer,
    gs_timer_range,
    gs_texture_3d,
};

最后的两个指针,是用于OBS对象的二双向链表。


gs_obj::gs_obj(gs_device_t *device_, gs_type type)
    : device(device_),
      obj_type(type)
{
    prev_next = &device->first_obj;
    next = device->first_obj;
    device->first_obj = this;
    if (next)
        next->prev_next = &next;
}

gs_obj::~gs_obj()
{
    if (prev_next)
        *prev_next = next;
    if (next)
        next->prev_next = prev_next;
}

0 篇笔记 写笔记

作者信息
站长漫谈
取消
感谢您的支持,我会继续努力的!
扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

您的支持,是我们前进的动力!