OpenGLRenderer: Use generic DeviceObject

This commit is contained in:
Lynix
2020-04-26 16:26:08 +02:00
parent b4b15f826d
commit 1c23949608
6 changed files with 137 additions and 215 deletions

View File

@@ -10,22 +10,22 @@
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovableValue.hpp>
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/DeviceObject.hpp>
namespace Nz::GL
{
class Shader
class Shader : public DeviceObject<Shader, GL_SHADER, GLenum>
{
friend DeviceObject;
public:
Shader() = default;
Shader(const Shader&) = delete;
Shader(Shader&&) noexcept = default;
inline ~Shader();
~Shader() = default;
inline void Compile();
inline bool Create(OpenGLDevice& device, GLenum type);
inline void Destroy();
inline bool GetCompilationStatus(std::string* error = nullptr);
inline void SetBinarySource(GLenum binaryFormat, const void* binary, GLsizei length);
@@ -38,8 +38,8 @@ namespace Nz::GL
Shader& operator=(Shader&&) noexcept = default;
private:
MovablePtr<OpenGLDevice> m_device;
MovableValue<GLuint> m_shader;
static inline GLuint CreateHelper(OpenGLDevice& device, const Context& context, GLenum shaderStage);
static inline void DestroyHelper(OpenGLDevice& device, const Context& context, GLuint objectId);
};
}