gl: when loading custom textures, don't delete regular textures until after the current frame
regular textures might be referenced by the current frame and deleting them cause gl errors Issue #144
This commit is contained in:
parent
7a889803fd
commit
a0b099df7c
|
@ -611,7 +611,6 @@ static void resize(int w, int h)
|
|||
|
||||
static bool RenderFrame()
|
||||
{
|
||||
DoCleanup();
|
||||
create_modvol_shader();
|
||||
|
||||
const bool is_rtt = pvrrc.isRTT;
|
||||
|
|
|
@ -1040,6 +1040,7 @@ bool ProcessFrame(TA_context* ctx)
|
|||
{
|
||||
if (KillTex)
|
||||
TexCache.Clear();
|
||||
TexCache.Cleanup();
|
||||
|
||||
if (ctx->rend.isRenderFramebuffer)
|
||||
{
|
||||
|
@ -1050,7 +1051,6 @@ bool ProcessFrame(TA_context* ctx)
|
|||
if (!ta_parse_vdrc(ctx))
|
||||
return false;
|
||||
}
|
||||
TexCache.CollectCleanup();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1075,7 +1075,6 @@ static void upload_vertex_indices()
|
|||
|
||||
bool RenderFrame()
|
||||
{
|
||||
DoCleanup();
|
||||
create_modvol_shader();
|
||||
|
||||
bool is_rtt = pvrrc.isRTT;
|
||||
|
|
|
@ -143,7 +143,6 @@ void SetupMatrices(float dc_width, float dc_height,
|
|||
float &ds2s_offs_x, glm::mat4& normal_mat, glm::mat4& scissor_mat);
|
||||
|
||||
text_info raw_GetTexture(TSP tsp, TCW tcw);
|
||||
void DoCleanup();
|
||||
void SetCull(u32 CullMode);
|
||||
s32 SetTileClip(u32 val, GLint uniform);
|
||||
void SetMVS_Mode(ModifierVolumeMode mv_mode, ISP_Modvol ispc);
|
||||
|
@ -228,6 +227,20 @@ public:
|
|||
|
||||
class TextureCache final : public BaseTextureCache<TextureCacheData>
|
||||
{
|
||||
public:
|
||||
void Cleanup()
|
||||
{
|
||||
if (!texturesToDelete.empty())
|
||||
{
|
||||
glcache.DeleteTextures((GLsizei)texturesToDelete.size(), &texturesToDelete[0]);
|
||||
texturesToDelete.clear();
|
||||
}
|
||||
CollectCleanup();
|
||||
}
|
||||
void DeleteLater(GLuint texId) { texturesToDelete.push_back(texId); }
|
||||
|
||||
private:
|
||||
std::vector<GLuint> texturesToDelete;
|
||||
};
|
||||
extern TextureCache TexCache;
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ u64 gl_GetTexture(TSP tsp, TCW tcw)
|
|||
{
|
||||
if (tf->IsCustomTextureAvailable())
|
||||
{
|
||||
glcache.DeleteTextures(1, &tf->texID);
|
||||
TexCache.DeleteLater(tf->texID);
|
||||
tf->texID = glcache.GenTexture();
|
||||
tf->CheckCustomTexture();
|
||||
}
|
||||
|
@ -340,10 +340,6 @@ u64 gl_GetTexture(TSP tsp, TCW tcw)
|
|||
return tf->texID;
|
||||
}
|
||||
|
||||
void DoCleanup()
|
||||
{
|
||||
}
|
||||
|
||||
GLuint fbTextureId;
|
||||
|
||||
void RenderFramebuffer()
|
||||
|
|
Loading…
Reference in New Issue