mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 10:49:14 +00:00
Only mark objects as cached right before inserting into the cache
This fixes bugs where we try to uncache objects that fail creation. Bug: dawn:249 Change-Id: Ic60b3ce702dfdda18baa6d263911885a43d3cda7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12820 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
fe221ac089
commit
84bcf44fae
@@ -52,10 +52,8 @@ namespace dawn_native {
|
||||
|
||||
// SamplerBase
|
||||
|
||||
SamplerBase::SamplerBase(DeviceBase* device,
|
||||
const SamplerDescriptor* descriptor,
|
||||
bool blueprint)
|
||||
: ObjectBase(device),
|
||||
SamplerBase::SamplerBase(DeviceBase* device, const SamplerDescriptor* descriptor)
|
||||
: CachedObject(device),
|
||||
mAddressModeU(descriptor->addressModeU),
|
||||
mAddressModeV(descriptor->addressModeV),
|
||||
mAddressModeW(descriptor->addressModeW),
|
||||
@@ -64,17 +62,15 @@ namespace dawn_native {
|
||||
mMipmapFilter(descriptor->mipmapFilter),
|
||||
mLodMinClamp(descriptor->lodMinClamp),
|
||||
mLodMaxClamp(descriptor->lodMaxClamp),
|
||||
mCompareFunction(descriptor->compare),
|
||||
mIsBlueprint(blueprint) {
|
||||
mCompareFunction(descriptor->compare) {
|
||||
}
|
||||
|
||||
SamplerBase::SamplerBase(DeviceBase* device, ObjectBase::ErrorTag tag)
|
||||
: ObjectBase(device, tag) {
|
||||
: CachedObject(device, tag) {
|
||||
}
|
||||
|
||||
SamplerBase::~SamplerBase() {
|
||||
// Do not uncache the actual cached object if we are a blueprint
|
||||
if (!mIsBlueprint && !IsError()) {
|
||||
if (IsCachedReference()) {
|
||||
GetDevice()->UncacheSampler(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user