mirror of https://github.com/snes9xgit/snes9x.git
Shaders: Try to clean up in case we reuse GLSLShader.
This commit is contained in:
parent
a569fbeabc
commit
f825f14a06
|
@ -96,6 +96,7 @@ bool GLSLShader::load_shader_preset_file(char *filename)
|
||||||
!strcasecmp(&filename[length - 6], ".slang")))
|
!strcasecmp(&filename[length - 6], ".slang")))
|
||||||
singlepass = true;
|
singlepass = true;
|
||||||
|
|
||||||
|
this->using_slang = false;
|
||||||
if (length > 7 && (!strcasecmp(&filename[length - 6], ".slang") ||
|
if (length > 7 && (!strcasecmp(&filename[length - 6], ".slang") ||
|
||||||
!strcasecmp(&filename[length - 7], ".slangp")))
|
!strcasecmp(&filename[length - 7], ".slangp")))
|
||||||
{
|
{
|
||||||
|
@ -1157,6 +1158,15 @@ void GLSLShader::destroy()
|
||||||
glDeleteProgram(pass[i].program);
|
glDeleteProgram(pass[i].program);
|
||||||
glDeleteTextures(1, &pass[i].texture);
|
glDeleteTextures(1, &pass[i].texture);
|
||||||
glDeleteFramebuffers(1, &pass[i].fbo);
|
glDeleteFramebuffers(1, &pass[i].fbo);
|
||||||
|
#ifdef USE_SLANG
|
||||||
|
if (using_slang)
|
||||||
|
{
|
||||||
|
if (pass[i].uses_feedback)
|
||||||
|
glDeleteTextures(1, &pass[i].feedback_texture);
|
||||||
|
if (pass[i].ubo_buffer.size() > 0)
|
||||||
|
glDeleteBuffers(1, &pass[i].ubo);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < lut.size(); i++)
|
for (unsigned int i = 0; i < lut.size(); i++)
|
||||||
|
@ -1169,6 +1179,8 @@ void GLSLShader::destroy()
|
||||||
glDeleteTextures(1, &prev_frame[i].texture);
|
glDeleteTextures(1, &prev_frame[i].texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glDeleteBuffers(1, &vbo);
|
||||||
|
|
||||||
param.clear();
|
param.clear();
|
||||||
pass.clear();
|
pass.clear();
|
||||||
lut.clear();
|
lut.clear();
|
||||||
|
|
|
@ -181,10 +181,8 @@ typedef struct
|
||||||
|
|
||||||
unsigned int frame_count;
|
unsigned int frame_count;
|
||||||
GLuint vbo;
|
GLuint vbo;
|
||||||
GLuint prev_fbo;
|
|
||||||
GLfloat *fa;
|
|
||||||
|
|
||||||
bool using_slang = false;
|
bool using_slang;
|
||||||
#ifdef USE_SLANG
|
#ifdef USE_SLANG
|
||||||
std::string slang_get_stage(std::vector<std::string> &lines,
|
std::string slang_get_stage(std::vector<std::string> &lines,
|
||||||
std::string name);
|
std::string name);
|
||||||
|
@ -194,7 +192,7 @@ typedef struct
|
||||||
void slang_set_shader_vars(int p, bool inverted);
|
void slang_set_shader_vars(int p, bool inverted);
|
||||||
void slang_clear_shader_vars();
|
void slang_clear_shader_vars();
|
||||||
|
|
||||||
bool using_feedback = false;
|
bool using_feedback;
|
||||||
#endif
|
#endif
|
||||||
} GLSLShader;
|
} GLSLShader;
|
||||||
|
|
||||||
|
|
|
@ -379,6 +379,7 @@ static inline bool isalldigits(std::string str)
|
||||||
void GLSLShader::slang_introspect()
|
void GLSLShader::slang_introspect()
|
||||||
{
|
{
|
||||||
max_prev_frame = 0;
|
max_prev_frame = 0;
|
||||||
|
using_feedback = false;
|
||||||
|
|
||||||
for (int i = 1; i < (int)pass.size(); i++)
|
for (int i = 1; i < (int)pass.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue