Fix some leaking builder objects in common backend.

Delete the TextureBuilder created in SwapChainBase::GetNextTexture().
Delete the InputStateBuilder and DepthStencilStateBuilder created in
RenderPipelineBuilder::GetResultImpl().
This commit is contained in:
Stephen White 2018-04-26 11:03:53 -04:00 committed by Corentin Wallez
parent 18ae692a21
commit 22b862e052
3 changed files with 10 additions and 3 deletions

View File

@ -59,9 +59,11 @@ namespace backend {
// the device once we have a cache of BGL
for (size_t group = 0; group < kMaxBindGroups; ++group) {
if (!mBindGroupLayouts[group]) {
mBindGroupLayouts[group] = mDevice->CreateBindGroupLayoutBuilder()->GetResult();
auto builder = mDevice->CreateBindGroupLayoutBuilder();
mBindGroupLayouts[group] = builder->GetResult();
// Remove the external ref objects are created with
mBindGroupLayouts[group]->Release();
builder->Release();
}
}

View File

@ -88,14 +88,18 @@ namespace backend {
// TODO(cwallez@chromium.org): the layout should be required, and put the default objects in
// the device
if (!mInputState) {
mInputState = mDevice->CreateInputStateBuilder()->GetResult();
auto builder = mDevice->CreateInputStateBuilder();
mInputState = builder->GetResult();
// Remove the external ref objects are created with
mInputState->Release();
builder->Release();
}
if (!mDepthStencilState) {
mDepthStencilState = mDevice->CreateDepthStencilStateBuilder()->GetResult();
auto builder = mDevice->CreateDepthStencilStateBuilder();
mDepthStencilState = builder->GetResult();
// Remove the external ref objects are created with
mDepthStencilState->Release();
builder->Release();
}
if (!mRenderPass) {
HandleError("Pipeline render pass not set");

View File

@ -68,6 +68,7 @@ namespace backend {
auto* texture = GetNextTextureImpl(builder);
mLastNextTexture = texture;
builder->Release();
return texture;
}