Complete the sampler object to match WebGPU

WebGPUSampler is much more complete than Dawn's Sampler.
This patch implement the missing part.

BUG=dawn:47

Change-Id: Ief45cb9710493e9d79ddab60fe3be5a123b76ebd
Reviewed-on: https://dawn-review.googlesource.com/c/3540
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Yan, Shaobo
2019-01-04 04:56:08 +00:00
committed by Commit Bot service account
parent ea56333c1e
commit 93158ebede
21 changed files with 446 additions and 17 deletions

View File

@@ -23,12 +23,24 @@ namespace dawn_native {
if (descriptor->nextInChain != nullptr) {
return DAWN_VALIDATION_ERROR("nextInChain must be nullptr");
}
if (descriptor->lodMinClamp < 0 || descriptor->lodMaxClamp < 0) {
return DAWN_VALIDATION_ERROR("LOD must be positive");
}
if (descriptor->lodMinClamp > descriptor->lodMaxClamp) {
return DAWN_VALIDATION_ERROR(
"Min lod clamp value cannot greater than max lod clamp value");
}
DAWN_TRY(ValidateFilterMode(descriptor->minFilter));
DAWN_TRY(ValidateFilterMode(descriptor->magFilter));
DAWN_TRY(ValidateFilterMode(descriptor->mipmapFilter));
DAWN_TRY(ValidateAddressMode(descriptor->addressModeU));
DAWN_TRY(ValidateAddressMode(descriptor->addressModeV));
DAWN_TRY(ValidateAddressMode(descriptor->addressModeW));
DAWN_TRY(ValidateCompareFunction(descriptor->compareFunction));
DAWN_TRY(ValidateBorderColor(descriptor->borderColor));
return {};
}