gl_resource_manager: add OGLPipeline

This commit is contained in:
wwylele 2018-04-10 00:29:52 +03:00
parent 4f9b9c4b80
commit bdab18d2d9

View file

@ -158,6 +158,38 @@ public:
GLuint handle = 0; GLuint handle = 0;
}; };
class OGLPipeline : private NonCopyable {
public:
OGLPipeline() = default;
OGLPipeline(OGLPipeline&& o) {
handle = std::exchange<GLuint>(o.handle, 0);
}
~OGLPipeline() {
Release();
}
OGLPipeline& operator=(OGLPipeline&& o) {
Release();
handle = std::exchange<GLuint>(o.handle, 0);
return *this;
}
void Create() {
if (handle != 0)
return;
glGenProgramPipelines(1, &handle);
}
void Release() {
if (handle == 0)
return;
glDeleteProgramPipelines(1, &handle);
OpenGLState::GetCurState().ResetPipeline(handle).Apply();
handle = 0;
}
GLuint handle = 0;
};
class OGLBuffer : private NonCopyable { class OGLBuffer : private NonCopyable {
public: public:
OGLBuffer() = default; OGLBuffer() = default;