dolphin/Source/Core/VideoBackends/OGL/OGLShader.h
Lioncash 882d1c1256 OGLShader: Ensure m_id and m_compute_program_id are always initialized
Depending on which constructor is invoked, m_id or m_compute_program_id
can end up in an uninitialized state. We should ensure that the object
is completely initialized to something deterministic regardless of the
constructor taken.
2018-03-16 17:49:34 -04:00

39 lines
1004 B
C++

// 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:
explicit OGLShader(ShaderStage stage, GLenum gl_type, GLuint shader_id);
explicit OGLShader(GLuint compute_program_id);
~OGLShader() override;
GLenum GetGLShaderType() const { return m_type; }
GLuint GetGLShaderID() const { return m_id; }
GLuint GetGLComputeProgramID() const { return m_compute_program_id; }
bool HasBinary() const override;
BinaryData GetBinary() const override;
static std::unique_ptr<OGLShader> CreateFromSource(ShaderStage stage, const char* source,
size_t length);
private:
GLenum m_type;
GLuint m_id = 0;
GLuint m_compute_program_id = 0;
};
} // namespace OGL