nodes: rework so that jobs can be completely deferred

Big optimization requiring a lot of refactoring.
This commit is contained in:
itsmattkc
2022-09-24 18:44:59 -07:00
parent 658fe9da7e
commit c0d8ff403f
57 changed files with 593 additions and 588 deletions
+37 -4
View File
@@ -27,8 +27,12 @@
namespace olive {
class AcceleratedJob;
class Renderer;
class Texture;
using TexturePtr = std::shared_ptr<Texture>;
class Texture
{
public:
@@ -45,17 +49,26 @@ public:
*/
Texture(const VideoParams& param) :
renderer_(nullptr),
params_(param)
params_(param),
job_(nullptr)
{
}
template <typename T>
Texture(const VideoParams &p, const T &j) :
Texture(p)
{
job_ = new T(j);
}
/**
* @brief Construct a real texture linked to a renderer backend
*/
Texture(Renderer* renderer, const QVariant& native, const VideoParams& param) :
renderer_(renderer),
params_(param),
id_(native)
id_(native),
job_(nullptr)
{
}
@@ -71,6 +84,18 @@ public:
return params_;
}
template <typename T>
static TexturePtr Job(const VideoParams &p, const T &j)
{
return std::make_shared<Texture>(p, j);
}
template <typename T>
TexturePtr toJob(const T &job)
{
return Texture::Job(params_, job);
}
void Upload(void* data, int linesize);
void Download(void* data, int linesize);
@@ -90,6 +115,11 @@ public:
return params_.effective_height();
}
QVector2D virtual_resolution() const
{
return QVector2D(params_.square_pixel_width(), params_.height());
}
VideoParams::Format format() const
{
return params_.format();
@@ -115,6 +145,9 @@ public:
return renderer_;
}
bool IsJob() const { return job_; }
AcceleratedJob *job() const { return job_; }
private:
Renderer* renderer_;
@@ -122,9 +155,9 @@ private:
QVariant id_;
};
AcceleratedJob *job_;
using TexturePtr = std::shared_ptr<Texture>;
};
}