RenderPipeline: validate depth bias params are not NaN

Also changes the sampler validation to allow INFINITY and only check for
NaN.

BUG=dawn:296

Change-Id: I2a61df807d37dcaf280b12a1ffe56dc670d0f455
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14480
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Corentin Wallez
2019-12-12 11:41:02 +00:00
committed by Commit Bot service account
parent ab4485f86c
commit 69cdaf94df
4 changed files with 74 additions and 10 deletions

View File

@@ -27,12 +27,12 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR("nextInChain must be nullptr");
}
if (!std::isfinite(descriptor->lodMinClamp) || !std::isfinite(descriptor->lodMaxClamp)) {
return DAWN_VALIDATION_ERROR("LOD must be finite");
if (std::isnan(descriptor->lodMinClamp) || std::isnan(descriptor->lodMaxClamp)) {
return DAWN_VALIDATION_ERROR("LOD clamp bounds must not be NaN");
}
if (descriptor->lodMinClamp < 0 || descriptor->lodMaxClamp < 0) {
return DAWN_VALIDATION_ERROR("LOD must be positive");
return DAWN_VALIDATION_ERROR("LOD clamp bounds must be positive");
}
if (descriptor->lodMinClamp > descriptor->lodMaxClamp) {
@@ -101,10 +101,10 @@ namespace dawn_native {
return true;
}
ASSERT(std::isfinite(a->mLodMinClamp));
ASSERT(std::isfinite(b->mLodMinClamp));
ASSERT(std::isfinite(a->mLodMaxClamp));
ASSERT(std::isfinite(b->mLodMaxClamp));
ASSERT(!std::isnan(a->mLodMinClamp));
ASSERT(!std::isnan(b->mLodMinClamp));
ASSERT(!std::isnan(a->mLodMaxClamp));
ASSERT(!std::isnan(b->mLodMaxClamp));
return a->mAddressModeU == b->mAddressModeU && a->mAddressModeV == b->mAddressModeV &&
a->mAddressModeW == b->mAddressModeW && a->mMagFilter == b->mMagFilter &&