dawn_native: don't uncache error objects
Error objects that are cached still have mIsBlueprint to false and would try to uncache themselves, which isn't valid. Also adds a regression test. BUG=dawn:143 Change-Id: Icd8bab52982b8520519d52296fffa6ed85088b8e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6900 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
1152bbaf8e
commit
00f6b1af41
|
@ -98,8 +98,7 @@ namespace dawn_native {
|
|||
|
||||
BindGroupLayoutBase::~BindGroupLayoutBase() {
|
||||
// Do not uncache the actual cached object if we are a blueprint
|
||||
if (!mIsBlueprint) {
|
||||
ASSERT(!IsError());
|
||||
if (!mIsBlueprint && !IsError()) {
|
||||
GetDevice()->UncacheBindGroupLayout(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,8 +49,7 @@ namespace dawn_native {
|
|||
|
||||
ComputePipelineBase::~ComputePipelineBase() {
|
||||
// Do not uncache the actual cached object if we are a blueprint
|
||||
if (!mIsBlueprint) {
|
||||
ASSERT(!IsError());
|
||||
if (!mIsBlueprint && !IsError()) {
|
||||
GetDevice()->UncacheComputePipeline(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,8 +57,7 @@ namespace dawn_native {
|
|||
|
||||
PipelineLayoutBase::~PipelineLayoutBase() {
|
||||
// Do not uncache the actual cached object if we are a blueprint
|
||||
if (!mIsBlueprint) {
|
||||
ASSERT(!IsError());
|
||||
if (!mIsBlueprint && !IsError()) {
|
||||
GetDevice()->UncachePipelineLayout(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,8 +82,7 @@ namespace dawn_native {
|
|||
|
||||
ShaderModuleBase::~ShaderModuleBase() {
|
||||
// Do not uncache the actual cached object if we are a blueprint
|
||||
if (!mIsBlueprint) {
|
||||
ASSERT(!IsError());
|
||||
if (!mIsBlueprint && !IsError()) {
|
||||
GetDevice()->UncacheShaderModule(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,14 @@ TEST_P(ObjectCachingTest, BindGroupLayoutDeduplication) {
|
|||
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
|
||||
}
|
||||
|
||||
// Test that an error object doesn't try to uncache itself
|
||||
TEST_P(ObjectCachingTest, ErrorObjectDoesntUncache) {
|
||||
ASSERT_DEVICE_ERROR(
|
||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||
device, {{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer},
|
||||
{0, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer}}));
|
||||
}
|
||||
|
||||
// Test that PipelineLayouts are correctly deduplicated.
|
||||
TEST_P(ObjectCachingTest, PipelineLayoutDeduplication) {
|
||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||
|
|
Loading…
Reference in New Issue