Implement depth24unorm-stencil8 and depth32float-stencil8 formats

- Add format implementation on D3D12, Metal and Vulkan
- Add more formats in depth/stencil copy, sampling and load op tests and
  refactor them to test with parameters.

BUG=dawn:690

Change-Id: I829d1eea3ce35ffb39417ea23fb8afba6d542769
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/73180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This commit is contained in:
Li Hao
2022-01-05 01:31:16 +00:00
committed by Dawn LUCI CQ
parent b61f09ec58
commit 538d8d5d1c
11 changed files with 481 additions and 216 deletions

View File

@@ -249,6 +249,19 @@ TEST(Math, IsFloat16NaN) {
ASSERT_TRUE(IsFloat16NaN(0xFFFF));
}
// Tests for FloatToUnorm
TEST(Math, FloatToUnorm) {
std::vector<float> kTestFloatValues = {0.0f, 0.4f, 0.5f, 1.0f};
std::vector<unsigned char> kExpectedCharValues = {0, 102, 127, 255};
std::vector<uint8_t> kExpectedUint8Values = {0, 102, 127, 255};
std::vector<uint16_t> kExpectedUint16Values = {0, 26214, 32767, 65535};
for (size_t i = 0; i < kTestFloatValues.size(); i++) {
ASSERT_EQ(FloatToUnorm<unsigned char>(kTestFloatValues[i]), kExpectedCharValues[i]);
ASSERT_EQ(FloatToUnorm<uint8_t>(kTestFloatValues[i]), kExpectedUint8Values[i]);
ASSERT_EQ(FloatToUnorm<uint16_t>(kTestFloatValues[i]), kExpectedUint16Values[i]);
}
}
// Tests for SRGBToLinear
TEST(Math, SRGBToLinear) {
ASSERT_EQ(SRGBToLinear(0.0f), 0.0f);