Add validation, storage, and querying of limits

Adds a way to store the limits on the Adapter and the
Device. For now, adapter limits are always the default
limits, and device limits are stored but not used.

This CL also adds usage of an ErrorObjectIdResolver and
Provider in the WGPUDeviceProperties serialization and
deserialization helpers. Serializing/deserializing this
struct should never have objects.

Bug: dawn:685
Change-Id: I1479b4407b0f9ec9f9b2bff62cad7caa693c99d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63983
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng
2021-09-13 18:49:09 +00:00
committed by Dawn LUCI CQ
parent caf6e8b3f0
commit 02fbf168e0
17 changed files with 375 additions and 4 deletions

View File

@@ -711,7 +711,8 @@ namespace dawn_wire {
WireResult result = serializeBuffer.Next(&transfer);
ASSERT(result == WireResult::Success);
result = WGPUDevicePropertiesSerialize(*deviceProperties, transfer, &serializeBuffer);
ErrorObjectIdProvider provider;
result = WGPUDevicePropertiesSerialize(*deviceProperties, transfer, &serializeBuffer, provider);
ASSERT(result == WireResult::Success);
}
@@ -724,8 +725,9 @@ namespace dawn_wire {
return false;
}
ErrorObjectIdResolver resolver;
return WGPUDevicePropertiesDeserialize(deviceProperties, transfer, &deserializeBuffer,
nullptr) == WireResult::Success;
nullptr, resolver) == WireResult::Success;
}
} // namespace dawn_wire

View File

@@ -77,6 +77,8 @@
// TODO(crbug.com/dawn/520): Remove WGPU_STRIDE_UNDEFINED in favor of WGPU_COPY_STRIDE_UNDEFINED.
#define WGPU_STRIDE_UNDEFINED (0xffffffffUL)
#define WGPU_COPY_STRIDE_UNDEFINED (0xffffffffUL)
#define WGPU_LIMIT_U32_UNDEFINED (0xffffffffUL)
#define WGPU_LIMIT_U64_UNDEFINED (0xffffffffffffffffULL)
typedef uint32_t WGPUFlags;

View File

@@ -23,6 +23,8 @@ namespace wgpu {
// TODO(crbug.com/520): Remove kStrideUndefined in favor of kCopyStrideUndefined.
static constexpr uint32_t kStrideUndefined = WGPU_STRIDE_UNDEFINED;
static constexpr uint32_t kCopyStrideUndefined = WGPU_COPY_STRIDE_UNDEFINED;
static constexpr uint32_t kLimitU32Undefined = WGPU_LIMIT_U32_UNDEFINED;
static constexpr uint64_t kLimitU64Undefined = WGPU_LIMIT_U64_UNDEFINED;
{% for type in by_category["enum"] %}
enum class {{as_cppType(type.name)}} : uint32_t {