diff --git a/src/common/gl/program.cpp b/src/common/gl/program.cpp index 99b67cef9..84c9ccfbe 100644 --- a/src/common/gl/program.cpp +++ b/src/common/gl/program.cpp @@ -5,11 +5,11 @@ #include Log_SetChannel(GL); -static u32 s_next_bad_shader_id = 1; -static GLuint s_last_program_id = 0; - namespace GL { +GLuint Program::s_last_program_id = 0; +static GLuint s_next_bad_shader_id = 1; + Program::Program() = default; Program::~Program() diff --git a/src/common/gl/program.h b/src/common/gl/program.h index 668f57333..ece24daaa 100644 --- a/src/common/gl/program.h +++ b/src/common/gl/program.h @@ -1,6 +1,6 @@ #pragma once -#include "glad.h" #include "../types.h" +#include "glad.h" #include #include @@ -15,6 +15,7 @@ public: static void ResetLastProgram(); bool IsVaild() const { return m_program_id != 0; } + bool IsBound() const { return s_last_program_id == m_program_id; } bool Compile(const std::string_view vertex_shader, const std::string_view fragment_shader); @@ -78,6 +79,8 @@ public: void BindUniformBlock(const char* name, u32 index); private: + static u32 s_last_program_id; + GLuint m_program_id = 0; GLuint m_vertex_shader_id = 0; GLuint m_fragment_shader_id = 0;