Don't leak the new pipelines

This commit is contained in:
Henrik Rydgård 2018-12-20 11:14:50 +01:00
parent d047955686
commit 0f28b66a70
2 changed files with 11 additions and 5 deletions

View File

@ -51,6 +51,7 @@ GPUDriverTestScreen::~GPUDriverTestScreen() {
discardWriteDepth_->Release(); discardWriteDepth_->Release();
if (discardWriteStencil_) if (discardWriteStencil_)
discardWriteStencil_->Release(); discardWriteStencil_->Release();
if (drawTestStencilEqualDepthAlways_) if (drawTestStencilEqualDepthAlways_)
drawTestStencilEqualDepthAlways_->Release(); drawTestStencilEqualDepthAlways_->Release();
if (drawTestStencilNotEqualDepthAlways_) if (drawTestStencilNotEqualDepthAlways_)
@ -63,8 +64,13 @@ GPUDriverTestScreen::~GPUDriverTestScreen() {
drawTestStencilAlwaysDepthLessEqual_->Release(); drawTestStencilAlwaysDepthLessEqual_->Release();
if (drawTestStencilAlwaysDepthGreater_) if (drawTestStencilAlwaysDepthGreater_)
drawTestStencilAlwaysDepthGreater_->Release(); drawTestStencilAlwaysDepthGreater_->Release();
if (discard_) if (drawTestDepthLessEqual_)
discard_->Release(); drawTestDepthLessEqual_->Release();
if (drawTestDepthGreater_)
drawTestDepthGreater_->Release();
if (discardFragShader_)
discardFragShader_->Release();
if (samplerNearest_) if (samplerNearest_)
samplerNearest_->Release(); samplerNearest_->Release();
} }
@ -95,7 +101,7 @@ void GPUDriverTestScreen::DiscardTest() {
// Create the special shader module. // Create the special shader module.
discard_ = CreateShader(draw, Draw::ShaderStage::FRAGMENT, fsDiscard); discardFragShader_ = CreateShader(draw, Draw::ShaderStage::FRAGMENT, fsDiscard);
InputLayout *inputLayout = ui_draw2d.CreateInputLayout(draw); InputLayout *inputLayout = ui_draw2d.CreateInputLayout(draw);
BlendState *blendOff = draw->CreateBlendState({ false, 0xF }); BlendState *blendOff = draw->CreateBlendState({ false, 0xF });
@ -169,7 +175,7 @@ void GPUDriverTestScreen::DiscardTest() {
PipelineDesc discardDesc{ PipelineDesc discardDesc{
Primitive::TRIANGLE_LIST, Primitive::TRIANGLE_LIST,
{ draw->GetVshaderPreset(VS_TEXTURE_COLOR_2D), discard_ }, { draw->GetVshaderPreset(VS_TEXTURE_COLOR_2D), discardFragShader_ },
inputLayout, depthStencilWrite, blendOff, rasterNoCull, &vsColBufDesc, inputLayout, depthStencilWrite, blendOff, rasterNoCull, &vsColBufDesc,
}; };
discardWriteDepthStencil_ = draw->CreateGraphicsPipeline(discardDesc); discardWriteDepthStencil_ = draw->CreateGraphicsPipeline(discardDesc);

View File

@ -23,7 +23,7 @@ public:
private: private:
void DiscardTest(); void DiscardTest();
Draw::ShaderModule *discard_ = nullptr; Draw::ShaderModule *discardFragShader_ = nullptr;
Draw::Pipeline *discardWriteDepthStencil_ = nullptr; Draw::Pipeline *discardWriteDepthStencil_ = nullptr;
Draw::Pipeline *discardWriteDepth_ = nullptr; Draw::Pipeline *discardWriteDepth_ = nullptr;
Draw::Pipeline *discardWriteStencil_ = nullptr; Draw::Pipeline *discardWriteStencil_ = nullptr;