2017-09-08 03:42:56 -06:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-04 19:22:19 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-09-08 03:42:56 -06:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <memory>
|
2019-05-30 01:07:40 -06:00
|
|
|
#include <string_view>
|
2017-09-08 03:42:56 -06: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 07:39:54 -06: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 03:42:56 -06:00
|
|
|
~OGLShader() override;
|
|
|
|
|
2019-02-14 18:59:50 -07:00
|
|
|
u64 GetID() const { return m_id; }
|
2017-09-08 03:42:56 -06:00
|
|
|
GLenum GetGLShaderType() const { return m_type; }
|
2019-02-14 18:59:50 -07:00
|
|
|
GLuint GetGLShaderID() const { return m_gl_id; }
|
|
|
|
GLuint GetGLComputeProgramID() const { return m_gl_compute_program_id; }
|
2019-04-20 07:39:54 -06:00
|
|
|
const std::string& GetSource() const { return m_source; }
|
2017-09-08 03:42:56 -06:00
|
|
|
|
2019-05-30 01:07:40 -06:00
|
|
|
static std::unique_ptr<OGLShader> CreateFromSource(ShaderStage stage, std::string_view source);
|
2017-09-08 03:42:56 -06:00
|
|
|
|
|
|
|
private:
|
2019-02-14 18:59:50 -07:00
|
|
|
u64 m_id;
|
2017-09-08 03:42:56 -06:00
|
|
|
GLenum m_type;
|
2019-02-14 18:59:50 -07:00
|
|
|
GLuint m_gl_id = 0;
|
|
|
|
GLuint m_gl_compute_program_id = 0;
|
2019-04-20 07:39:54 -06:00
|
|
|
std::string m_source;
|
2017-09-08 03:42:56 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace OGL
|