mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Bug 1843250: fix(webgpu): clamp required limits properly r=webgpu-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D183938
This commit is contained in:
parent
d115221b55
commit
ea65de7c7b
@ -7,6 +7,7 @@
|
||||
#include "mozilla/dom/WebGPUBinding.h"
|
||||
#include "Adapter.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "Device.h"
|
||||
#include "Instance.h"
|
||||
#include "SupportedFeatures.h"
|
||||
@ -407,7 +408,7 @@ already_AddRefed<dom::Promise> Adapter::RequestDevice(
|
||||
}
|
||||
|
||||
const auto& limit = itr->second;
|
||||
const auto& requestedValue = entry.mValue;
|
||||
uint64_t requestedValue = entry.mValue;
|
||||
const auto supportedValueF64 = GetLimit(*mLimits->mFfi, limit);
|
||||
const auto supportedValue = static_cast<uint64_t>(supportedValueF64);
|
||||
if (StringBeginsWith(keyU8, "max"_ns)) {
|
||||
@ -420,6 +421,10 @@ already_AddRefed<dom::Promise> Adapter::RequestDevice(
|
||||
promise->MaybeRejectWithOperationError(msg);
|
||||
return;
|
||||
}
|
||||
// Clamp to default if lower than default
|
||||
requestedValue =
|
||||
std::max(requestedValue,
|
||||
static_cast<uint64_t>(GetLimit(deviceLimits, limit)));
|
||||
} else {
|
||||
MOZ_ASSERT(StringBeginsWith(keyU8, "min"_ns));
|
||||
if (requestedValue < supportedValue) {
|
||||
@ -442,6 +447,10 @@ already_AddRefed<dom::Promise> Adapter::RequestDevice(
|
||||
return;
|
||||
}
|
||||
}
|
||||
/// Clamp to default if higher than default
|
||||
requestedValue =
|
||||
std::min(requestedValue,
|
||||
static_cast<uint64_t>(GetLimit(deviceLimits, limit)));
|
||||
}
|
||||
|
||||
SetLimit(&deviceLimits, limit, requestedValue);
|
||||
|
@ -91,87 +91,9 @@
|
||||
|
||||
|
||||
[cts.https.html?q=webgpu:api,operation,adapter,requestDevice:limit,worse_than_default:*]
|
||||
[:limit="maxTextureDimension1D"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxTextureDimension2D"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxTextureDimension3D"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxTextureArrayLayers"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxBindGroups"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxDynamicUniformBuffersPerPipelineLayout"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxDynamicStorageBuffersPerPipelineLayout"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxSampledTexturesPerShaderStage"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxSamplersPerShaderStage"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxStorageBuffersPerShaderStage"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxStorageTexturesPerShaderStage"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxUniformBuffersPerShaderStage"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxUniformBufferBindingSize"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxStorageBufferBindingSize"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="minUniformBufferOffsetAlignment"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="minStorageBufferOffsetAlignment"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxVertexBuffers"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxBufferSize"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxVertexAttributes"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxVertexBufferArrayStride"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxInterStageShaderComponents"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxComputeWorkgroupStorageSize"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxComputeInvocationsPerWorkgroup"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxComputeWorkgroupSizeX"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxComputeWorkgroupSizeY"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxComputeWorkgroupSizeZ"]
|
||||
expected: FAIL
|
||||
|
||||
[:limit="maxComputeWorkgroupsPerDimension"]
|
||||
expected: FAIL
|
||||
|
||||
# See <https://bugzilla.mozilla.org/show_bug.cgi?id=1844230>.
|
||||
[:limit="maxBindingsPerBindGroup"]
|
||||
disabled: true
|
||||
|
||||
[cts.https.html?q=webgpu:api,operation,buffers,map:mapAsync,read,typedArrayAccess:*]
|
||||
[:mapAsyncRegionLeft="default-expand";mapAsyncRegionRight="default-expand"]
|
||||
|
Loading…
Reference in New Issue
Block a user