38 lines
805 B
C++
38 lines
805 B
C++
#pragma once
|
|
#include "render_resource.h"
|
|
#include "rhi_defintion.h"
|
|
|
|
enum class lock_state
|
|
{
|
|
NONE,
|
|
WRITE,
|
|
READ,
|
|
READ_WRITE
|
|
};
|
|
|
|
class render_target : public render_resource
|
|
{
|
|
public:
|
|
int get_height() const override { return height_; }
|
|
int get_width() const override { return width_; }
|
|
|
|
virtual void init(int width, int height, texture_format format) = 0;
|
|
|
|
virtual void resize(const int width, const int height)
|
|
{
|
|
if (width_ == width && height_ == height)
|
|
return;
|
|
|
|
width_ = width;
|
|
height_ = height;
|
|
on_resize(width, height);
|
|
}
|
|
|
|
virtual void* lock(lock_state state) = 0;
|
|
virtual void unlock() = 0;
|
|
protected:
|
|
virtual void on_resize(int width, int height) = 0;
|
|
int width_ = 0;
|
|
int height_ = 0;
|
|
};
|