2017-09-08 09:42:56 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-09-08 09:42:56 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <memory>
|
2019-05-30 07:07:40 +00:00
|
|
|
#include <string_view>
|
2017-09-08 09:42:56 +00:00
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
#include "Common/GL/GLUtil.h"
|
|
|
|
#include "VideoCommon/AbstractShader.h"
|
|
|
|
|
|
|
|
namespace OGL
|
|
|
|
{
|
|
|
|
class OGLShader final : public AbstractShader
|
|
|
|
{
|
|
|
|
public:
|
2019-04-20 13:39:54 +00:00
|
|
|
explicit OGLShader(ShaderStage stage, GLenum gl_type, GLuint gl_id, std::string source);
|
|
|
|
explicit OGLShader(GLuint gl_compute_program_id, std::string source);
|
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; }
|
2019-04-20 13:39:54 +00:00
|
|
|
const std::string& GetSource() const { return m_source; }
|
2017-09-08 09:42:56 +00:00
|
|
|
|
2019-05-30 07:07:40 +00:00
|
|
|
static std::unique_ptr<OGLShader> CreateFromSource(ShaderStage stage, std::string_view source);
|
2017-09-08 09:42:56 +00:00
|
|
|
|
|
|
|
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;
|
2019-04-20 13:39:54 +00:00
|
|
|
std::string m_source;
|
2017-09-08 09:42:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace OGL
|