mirror of https://github.com/RPCS3/rpcs3.git
gl: Avoid issuing glDelete calls with m_id == GL_NONE
Applies GL_NONE macro usage where it makes sense
This commit is contained in:
parent
d4333788e2
commit
3ad12cf5f8
|
@ -201,14 +201,17 @@ namespace gl
|
||||||
}
|
}
|
||||||
|
|
||||||
void fbo::remove()
|
void fbo::remove()
|
||||||
|
{
|
||||||
|
if (m_id != GL_NONE)
|
||||||
{
|
{
|
||||||
glDeleteFramebuffers(1, &m_id);
|
glDeleteFramebuffers(1, &m_id);
|
||||||
m_id = 0;
|
m_id = GL_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fbo::created() const
|
bool fbo::created() const
|
||||||
{
|
{
|
||||||
return m_id != 0;
|
return m_id != GL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fbo::check() const
|
bool fbo::check() const
|
||||||
|
|
|
@ -897,9 +897,12 @@ namespace gl
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove()
|
void remove()
|
||||||
|
{
|
||||||
|
if (m_id != GL_NONE)
|
||||||
{
|
{
|
||||||
glDeleteBuffers(1, &m_id);
|
glDeleteBuffers(1, &m_id);
|
||||||
m_id = 0;
|
m_id = GL_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLsizeiptr size() const
|
GLsizeiptr size() const
|
||||||
|
@ -919,7 +922,7 @@ namespace gl
|
||||||
|
|
||||||
bool created() const
|
bool created() const
|
||||||
{
|
{
|
||||||
return m_id != 0;
|
return m_id != GL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit operator bool() const
|
explicit operator bool() const
|
||||||
|
@ -1039,8 +1042,12 @@ namespace gl
|
||||||
m_size = 0;
|
m_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (m_id != GL_NONE)
|
||||||
|
{
|
||||||
glDeleteBuffers(1, &m_id);
|
glDeleteBuffers(1, &m_id);
|
||||||
m_id = 0;
|
m_id = GL_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void reserve_storage_on_heap(u32 /*alloc_size*/) {}
|
virtual void reserve_storage_on_heap(u32 /*alloc_size*/) {}
|
||||||
|
@ -1307,10 +1314,13 @@ namespace gl
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove() noexcept
|
void remove() noexcept
|
||||||
|
{
|
||||||
|
if (m_id != GL_NONE)
|
||||||
{
|
{
|
||||||
glDeleteVertexArrays(1, &m_id);
|
glDeleteVertexArrays(1, &m_id);
|
||||||
m_id = GL_NONE;
|
m_id = GL_NONE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint id() const noexcept
|
uint id() const noexcept
|
||||||
{
|
{
|
||||||
|
@ -1573,7 +1583,7 @@ namespace gl
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GLuint m_id = 0;
|
GLuint m_id = GL_NONE;
|
||||||
GLuint m_width = 0;
|
GLuint m_width = 0;
|
||||||
GLuint m_height = 0;
|
GLuint m_height = 0;
|
||||||
GLuint m_depth = 0;
|
GLuint m_depth = 0;
|
||||||
|
@ -1727,8 +1737,12 @@ namespace gl
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~texture()
|
virtual ~texture()
|
||||||
|
{
|
||||||
|
if (m_id != GL_NONE)
|
||||||
{
|
{
|
||||||
glDeleteTextures(1, &m_id);
|
glDeleteTextures(1, &m_id);
|
||||||
|
m_id = GL_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_native_component_layout(const std::array<GLenum, 4>& layout)
|
void set_native_component_layout(const std::array<GLenum, 4>& layout)
|
||||||
|
@ -1765,7 +1779,7 @@ namespace gl
|
||||||
|
|
||||||
explicit operator bool() const noexcept
|
explicit operator bool() const noexcept
|
||||||
{
|
{
|
||||||
return (m_id != 0);
|
return (m_id != GL_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint width() const
|
GLuint width() const
|
||||||
|
@ -1927,7 +1941,7 @@ namespace gl
|
||||||
|
|
||||||
class texture_view
|
class texture_view
|
||||||
{
|
{
|
||||||
GLuint m_id = 0;
|
GLuint m_id = GL_NONE;
|
||||||
GLenum m_target = 0;
|
GLenum m_target = 0;
|
||||||
GLenum m_format = 0;
|
GLenum m_format = 0;
|
||||||
GLenum m_aspect_flags = 0;
|
GLenum m_aspect_flags = 0;
|
||||||
|
@ -2004,8 +2018,12 @@ namespace gl
|
||||||
}
|
}
|
||||||
|
|
||||||
~texture_view()
|
~texture_view()
|
||||||
|
{
|
||||||
|
if (m_id != GL_NONE)
|
||||||
{
|
{
|
||||||
glDeleteTextures(1, &m_id);
|
glDeleteTextures(1, &m_id);
|
||||||
|
m_id = GL_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint id() const
|
GLuint id() const
|
||||||
|
@ -2099,7 +2117,7 @@ public:
|
||||||
|
|
||||||
class rbo
|
class rbo
|
||||||
{
|
{
|
||||||
GLuint m_id = 0;
|
GLuint m_id = GL_NONE;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
rbo() = default;
|
rbo() = default;
|
||||||
|
@ -2171,9 +2189,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove()
|
void remove()
|
||||||
|
{
|
||||||
|
if (m_id != GL_NONE)
|
||||||
{
|
{
|
||||||
glDeleteRenderbuffers(1, &m_id);
|
glDeleteRenderbuffers(1, &m_id);
|
||||||
m_id = 0;
|
m_id = GL_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint id() const
|
uint id() const
|
||||||
|
@ -2188,7 +2209,7 @@ public:
|
||||||
|
|
||||||
bool created() const
|
bool created() const
|
||||||
{
|
{
|
||||||
return m_id != 0;
|
return m_id != GL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit operator bool() const
|
explicit operator bool() const
|
||||||
|
@ -2289,7 +2310,7 @@ public:
|
||||||
return found->second;
|
return found->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GL_NONE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator = (const rbo& rhs)
|
void operator = (const rbo& rhs)
|
||||||
|
@ -2521,9 +2542,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove()
|
void remove()
|
||||||
|
{
|
||||||
|
if (m_id != GL_NONE)
|
||||||
{
|
{
|
||||||
glDeleteShader(m_id);
|
glDeleteShader(m_id);
|
||||||
m_id = 0;
|
m_id = GL_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint id() const
|
uint id() const
|
||||||
|
@ -2538,7 +2562,7 @@ public:
|
||||||
|
|
||||||
bool created() const
|
bool created() const
|
||||||
{
|
{
|
||||||
return m_id != 0;
|
return m_id != GL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit operator bool() const
|
explicit operator bool() const
|
||||||
|
@ -2549,7 +2573,7 @@ public:
|
||||||
|
|
||||||
class program
|
class program
|
||||||
{
|
{
|
||||||
GLuint m_id = 0;
|
GLuint m_id = GL_NONE;
|
||||||
fence m_fence;
|
fence m_fence;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -2696,9 +2720,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove()
|
void remove()
|
||||||
|
{
|
||||||
|
if (m_id != GL_NONE)
|
||||||
{
|
{
|
||||||
glDeleteProgram(m_id);
|
glDeleteProgram(m_id);
|
||||||
m_id = 0;
|
m_id = GL_NONE;
|
||||||
|
}
|
||||||
uniforms.clear();
|
uniforms.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2784,7 +2811,7 @@ public:
|
||||||
|
|
||||||
bool created() const
|
bool created() const
|
||||||
{
|
{
|
||||||
return m_id != 0;
|
return m_id != GL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sync()
|
void sync()
|
||||||
|
|
Loading…
Reference in New Issue