2017-09-08 09:42:56 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
#include "Common/GL/GLUtil.h"
|
|
|
|
#include "VideoCommon/AbstractShader.h"
|
|
|
|
|
|
|
|
namespace OGL
|
|
|
|
{
|
|
|
|
class OGLShader final : public AbstractShader
|
|
|
|
{
|
|
|
|
public:
|
2019-02-15 01:59:50 +00:00
|
|
|
explicit OGLShader(ShaderStage stage, GLenum gl_type, GLuint gl_id);
|
|
|
|
explicit OGLShader(GLuint gl_compute_program_id);
|
2017-09-08 09:42:56 +00:00
|
|
|
~OGLShader() override;
|
|
|
|
|
2019-02-15 01:59:50 +00:00
|
|
|
u64 GetID() const { return m_id; }
|
2017-09-08 09:42:56 +00:00
|
|
|
GLenum GetGLShaderType() const { return m_type; }
|
2019-02-15 01:59:50 +00:00
|
|
|
GLuint GetGLShaderID() const { return m_gl_id; }
|
|
|
|
GLuint GetGLComputeProgramID() const { return m_gl_compute_program_id; }
|
2017-09-08 09:42:56 +00:00
|
|
|
bool HasBinary() const override;
|
|
|
|
BinaryData GetBinary() const override;
|
|
|
|
|
|
|
|
static std::unique_ptr<OGLShader> CreateFromSource(ShaderStage stage, const char* source,
|
|
|
|
size_t length);
|
|
|
|
|
|
|
|
private:
|
2019-02-15 01:59:50 +00:00
|
|
|
u64 m_id;
|
2017-09-08 09:42:56 +00:00
|
|
|
GLenum m_type;
|
2019-02-15 01:59:50 +00:00
|
|
|
GLuint m_gl_id = 0;
|
|
|
|
GLuint m_gl_compute_program_id = 0;
|
2017-09-08 09:42:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace OGL
|