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 // the device once we have a cache of BGL
for (size_t group = 0; group < kMaxBindGroups; ++group) { for (size_t group = 0; group < kMaxBindGroups; ++group) {
if (!mBindGroupLayouts[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 // Remove the external ref objects are created with
mBindGroupLayouts[group]->Release(); 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 // TODO(cwallez@chromium.org): the layout should be required, and put the default objects in
// the device // the device
if (!mInputState) { if (!mInputState) {
mInputState = mDevice->CreateInputStateBuilder()->GetResult(); auto builder = mDevice->CreateInputStateBuilder();
mInputState = builder->GetResult();
// Remove the external ref objects are created with // Remove the external ref objects are created with
mInputState->Release(); mInputState->Release();
builder->Release();
} }
if (!mDepthStencilState) { if (!mDepthStencilState) {
mDepthStencilState = mDevice->CreateDepthStencilStateBuilder()->GetResult(); auto builder = mDevice->CreateDepthStencilStateBuilder();
mDepthStencilState = builder->GetResult();
// Remove the external ref objects are created with // Remove the external ref objects are created with
mDepthStencilState->Release(); mDepthStencilState->Release();
builder->Release();
} }
if (!mRenderPass) { if (!mRenderPass) {
HandleError("Pipeline render pass not set"); HandleError("Pipeline render pass not set");

View File

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