mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-28 22:45:53 +00:00
Add extensions of pipeline statistics and timestamp queries. Bug: dawn:434 Change-Id: I1a472ee4819bd36ce629034cf5175430bab1febc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22100 Commit-Queue: Hao Li <hao.x.li@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
42 lines
1.8 KiB
C++
42 lines
1.8 KiB
C++
// Copyright 2019 The Dawn Authors
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#include "dawn_wire/Wire.h"
|
|
#include "gtest/gtest.h"
|
|
|
|
#include <vector>
|
|
|
|
class WireWGPUDevicePropertiesTests : public testing::Test {};
|
|
|
|
// Test that the serialization and deserialization of WGPUDeviceProperties can work correctly.
|
|
TEST_F(WireWGPUDevicePropertiesTests, SerializeWGPUDeviceProperties) {
|
|
WGPUDeviceProperties sentWGPUDeviceProperties;
|
|
sentWGPUDeviceProperties.textureCompressionBC = true;
|
|
// Set false to test that the serialization can handle both true and false correctly.
|
|
sentWGPUDeviceProperties.pipelineStatisticsQuery = false;
|
|
sentWGPUDeviceProperties.timestampQuery = true;
|
|
|
|
size_t sentWGPUDevicePropertiesSize =
|
|
dawn_wire::SerializedWGPUDevicePropertiesSize(&sentWGPUDeviceProperties);
|
|
std::vector<char> buffer;
|
|
buffer.resize(sentWGPUDevicePropertiesSize);
|
|
dawn_wire::SerializeWGPUDeviceProperties(&sentWGPUDeviceProperties, buffer.data());
|
|
|
|
WGPUDeviceProperties receivedWGPUDeviceProperties;
|
|
dawn_wire::DeserializeWGPUDeviceProperties(&receivedWGPUDeviceProperties, buffer.data());
|
|
ASSERT_TRUE(receivedWGPUDeviceProperties.textureCompressionBC);
|
|
ASSERT_FALSE(receivedWGPUDeviceProperties.pipelineStatisticsQuery);
|
|
ASSERT_TRUE(receivedWGPUDeviceProperties.timestampQuery);
|
|
}
|