Remove destroyed sampler states from the current samplers list

master
Palana 2014-04-19 05:21:00 +02:00
parent d56432304e
commit 12f0877ebc
2 changed files with 18 additions and 0 deletions

View File

@ -1641,6 +1641,15 @@ void zstencil_destroy(zstencil_t zstencil)
void samplerstate_destroy(samplerstate_t samplerstate)
{
if (!samplerstate)
return;
if (samplerstate->device)
for (int i = 0; i < GS_MAX_TEXTURES; i++)
if (samplerstate->device->curSamplers[i] ==
samplerstate)
samplerstate->device->curSamplers[i] = nullptr;
delete samplerstate;
}

View File

@ -1304,5 +1304,14 @@ enum gs_color_format volumetexture_getcolorformat(texture_t voltex)
void samplerstate_destroy(samplerstate_t samplerstate)
{
if (!samplerstate)
return;
if (samplerstate->device)
for (int i = 0; i < GS_MAX_TEXTURES; i++)
if (samplerstate->device->cur_samplers[i] ==
samplerstate)
samplerstate->device->cur_samplers[i] = NULL;
samplerstate_release(samplerstate);
}