mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-15 20:01:22 +00:00
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() {
|
BindGroupLayoutBase::~BindGroupLayoutBase() {
|
||||||
// Do not uncache the actual cached object if we are a blueprint
|
// Do not uncache the actual cached object if we are a blueprint
|
||||||
if (!mIsBlueprint) {
|
if (!mIsBlueprint && !IsError()) {
|
||||||
ASSERT(!IsError());
|
|
||||||
GetDevice()->UncacheBindGroupLayout(this);
|
GetDevice()->UncacheBindGroupLayout(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,7 @@ namespace dawn_native {
|
|||||||
|
|
||||||
ComputePipelineBase::~ComputePipelineBase() {
|
ComputePipelineBase::~ComputePipelineBase() {
|
||||||
// Do not uncache the actual cached object if we are a blueprint
|
// Do not uncache the actual cached object if we are a blueprint
|
||||||
if (!mIsBlueprint) {
|
if (!mIsBlueprint && !IsError()) {
|
||||||
ASSERT(!IsError());
|
|
||||||
GetDevice()->UncacheComputePipeline(this);
|
GetDevice()->UncacheComputePipeline(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,7 @@ namespace dawn_native {
|
|||||||
|
|
||||||
PipelineLayoutBase::~PipelineLayoutBase() {
|
PipelineLayoutBase::~PipelineLayoutBase() {
|
||||||
// Do not uncache the actual cached object if we are a blueprint
|
// Do not uncache the actual cached object if we are a blueprint
|
||||||
if (!mIsBlueprint) {
|
if (!mIsBlueprint && !IsError()) {
|
||||||
ASSERT(!IsError());
|
|
||||||
GetDevice()->UncachePipelineLayout(this);
|
GetDevice()->UncachePipelineLayout(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,7 @@ namespace dawn_native {
|
|||||||
|
|
||||||
ShaderModuleBase::~ShaderModuleBase() {
|
ShaderModuleBase::~ShaderModuleBase() {
|
||||||
// Do not uncache the actual cached object if we are a blueprint
|
// Do not uncache the actual cached object if we are a blueprint
|
||||||
if (!mIsBlueprint) {
|
if (!mIsBlueprint && !IsError()) {
|
||||||
ASSERT(!IsError());
|
|
||||||
GetDevice()->UncacheShaderModule(this);
|
GetDevice()->UncacheShaderModule(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,14 @@ TEST_P(ObjectCachingTest, BindGroupLayoutDeduplication) {
|
|||||||
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
|
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 that PipelineLayouts are correctly deduplicated.
|
||||||
TEST_P(ObjectCachingTest, PipelineLayoutDeduplication) {
|
TEST_P(ObjectCachingTest, PipelineLayoutDeduplication) {
|
||||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user