handle cleanup properly

This commit is contained in:
RSDuck 2023-04-13 23:38:38 +02:00
parent 7820658e1f
commit ea719ff4a4
2 changed files with 62 additions and 1 deletions

View File

@ -163,9 +163,63 @@ bool ComputeRenderer::Init()
void ComputeRenderer::DeInit()
{
ResetTexcache();
glDeleteBuffers(1, &YSpanSetupMemory);
glDeleteBuffers(1, &RenderPolygonMemory);
glDeleteBuffers(1, &TileMemory);
glDeleteBuffers(1, &XSpanSetupMemory);
glDeleteBuffers(1, &BinResultMemory);
glDeleteBuffers(1, &FinalTileMemory);
glDeleteBuffers(1, &YSpanIndicesTextureMemory);
glDeleteTextures(1, &YSpanIndicesTexture);
glDeleteTextures(1, &Framebuffer);
glDeleteBuffers(1, &MetaUniformMemory);
std::initializer_list<GLuint> allPrograms =
{
ShaderInterpXSpans[0],
ShaderInterpXSpans[1],
ShaderBinCombined,
ShaderDepthBlend[0],
ShaderDepthBlend[1],
ShaderRasteriseNoTexture[0],
ShaderRasteriseNoTexture[1],
ShaderRasteriseNoTextureToon[0],
ShaderRasteriseNoTextureToon[1],
ShaderRasteriseNoTextureHighlight[0],
ShaderRasteriseNoTextureHighlight[1],
ShaderRasteriseUseTextureDecal[0],
ShaderRasteriseUseTextureDecal[1],
ShaderRasteriseUseTextureModulate[0],
ShaderRasteriseUseTextureModulate[1],
ShaderRasteriseUseTextureToon[0],
ShaderRasteriseUseTextureToon[1],
ShaderRasteriseUseTextureHighlight[0],
ShaderRasteriseUseTextureHighlight[1],
ShaderRasteriseShadowMask[0],
ShaderRasteriseShadowMask[1],
ShaderClearCoarseBinMask,
ShaderClearIndirectWorkCount,
ShaderCalculateWorkListOffset,
ShaderSortWork,
ShaderFinalPass[0],
ShaderFinalPass[1],
ShaderFinalPass[2],
ShaderFinalPass[3],
ShaderFinalPass[4],
ShaderFinalPass[5],
ShaderFinalPass[6],
ShaderFinalPass[7],
};
for (GLuint program : allPrograms)
glDeleteProgram(program);
glDeleteSamplers(9, Samplers);
glDeleteBuffers(1, &PixelBuffer);
}
void ComputeRenderer::Reset()
void ComputeRenderer::ResetTexcache()
{
for (u32 i = 0; i < 8; i++)
{
@ -180,6 +234,11 @@ void ComputeRenderer::Reset()
TexCache.clear();
}
void ComputeRenderer::Reset()
{
ResetTexcache();
}
void ComputeRenderer::SetRenderSettings(GPU::RenderSettings& settings)
{

View File

@ -247,6 +247,8 @@ private:
TexCacheEntry& GetTexture(u32 textureParam, u32 paletteParam);
void ResetTexcache();
void SetupAttrs(SpanSetupY* span, Polygon* poly, int from, int to);
void SetupYSpan(int polynum, SpanSetupY* span, Polygon* poly, int from, int to, u32 y, int side);
void SetupYSpanDummy(SpanSetupY* span, Polygon* poly, int vertex, int side);