correctly destroy stuff
This commit is contained in:
@@ -84,21 +84,7 @@ void DitherGen(DitherData& data, int32_t recursion)
|
||||
}
|
||||
|
||||
// Upload textures
|
||||
if (isValid(data.PreviewTex))
|
||||
{
|
||||
bgfx::destroy(data.PreviewTex);
|
||||
data.PreviewTex = BGFX_INVALID_HANDLE;
|
||||
}
|
||||
if (isValid(data.FinalTex))
|
||||
{
|
||||
bgfx::destroy(data.FinalTex);
|
||||
data.FinalTex = BGFX_INVALID_HANDLE;
|
||||
}
|
||||
if (isValid(data.RampTex))
|
||||
{
|
||||
bgfx::destroy(data.RampTex);
|
||||
data.RampTex = BGFX_INVALID_HANDLE;
|
||||
}
|
||||
CleanupDitherData(data);
|
||||
const bgfx::Memory* memPreview = bgfx::makeRef(data.DitherTex, texPixelCount * sizeof(Vec4));
|
||||
const bgfx::Memory* memFinal = bgfx::makeRef(data.DitherTex, texPixelCount * sizeof(Vec4));
|
||||
const bgfx::Memory* memRamp = bgfx::makeRef(data.BrightnessRamp, sizeof(data.BrightnessRamp));
|
||||
@@ -123,3 +109,22 @@ void DitherGen(DitherData& data, int32_t recursion)
|
||||
data.RampSampler = bgfx::createUniform("s_rampSampler", bgfx::UniformType::Sampler);
|
||||
}
|
||||
}
|
||||
|
||||
void CleanupDitherData(DitherData& data)
|
||||
{
|
||||
if (isValid(data.PreviewTex))
|
||||
{
|
||||
bgfx::destroy(data.PreviewTex);
|
||||
data.PreviewTex = BGFX_INVALID_HANDLE;
|
||||
}
|
||||
if (isValid(data.FinalTex))
|
||||
{
|
||||
bgfx::destroy(data.FinalTex);
|
||||
data.FinalTex = BGFX_INVALID_HANDLE;
|
||||
}
|
||||
if (isValid(data.RampTex))
|
||||
{
|
||||
bgfx::destroy(data.RampTex);
|
||||
data.RampTex = BGFX_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user