mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-15 11:51:22 +00:00
Allow usage chromium_disable_uniformity_analysis
Only when unsafe APIs are allowed. Bug: None Change-Id: Idbe0494bec29bb623c0af39d3fb65d4995bb1a9b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104100 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
9b31b02cdf
commit
00aced1bbf
@ -1311,13 +1311,16 @@ bool DeviceBase::HasFeature(Feature feature) const {
|
|||||||
|
|
||||||
void DeviceBase::SetWGSLExtensionAllowList() {
|
void DeviceBase::SetWGSLExtensionAllowList() {
|
||||||
// Set the WGSL extensions allow list based on device's enabled features and other
|
// Set the WGSL extensions allow list based on device's enabled features and other
|
||||||
// propority.
|
// properties.
|
||||||
if (mEnabledFeatures.IsEnabled(Feature::ChromiumExperimentalDp4a)) {
|
if (mEnabledFeatures.IsEnabled(Feature::ChromiumExperimentalDp4a)) {
|
||||||
mWGSLExtensionAllowList.insert("chromium_experimental_dp4a");
|
mWGSLExtensionAllowList.insert("chromium_experimental_dp4a");
|
||||||
}
|
}
|
||||||
if (mEnabledFeatures.IsEnabled(Feature::ShaderF16)) {
|
if (mEnabledFeatures.IsEnabled(Feature::ShaderF16)) {
|
||||||
mWGSLExtensionAllowList.insert("f16");
|
mWGSLExtensionAllowList.insert("f16");
|
||||||
}
|
}
|
||||||
|
if (!IsToggleEnabled(Toggle::DisallowUnsafeAPIs)) {
|
||||||
|
mWGSLExtensionAllowList.insert("chromium_disable_uniformity_analysis");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WGSLExtensionSet DeviceBase::GetWGSLExtensionAllowList() const {
|
WGSLExtensionSet DeviceBase::GetWGSLExtensionAllowList() const {
|
||||||
|
@ -870,6 +870,31 @@ TEST_P(ShaderTests, ConflictingBindingsDueToTransformOrder) {
|
|||||||
device.CreateRenderPipeline(&desc);
|
device.CreateRenderPipeline(&desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check that chromium_disable_uniformity_analysis can be used. It is normally disallowed as unsafe
|
||||||
|
// but DawnTests allow all unsafe APIs by default.
|
||||||
|
TEST_P(ShaderTests, CheckUsageOf_chromium_disable_uniformity_analysis) {
|
||||||
|
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||||
|
enable chromium_disable_uniformity_analysis;
|
||||||
|
|
||||||
|
@compute @workgroup_size(8) fn uniformity_error(
|
||||||
|
@builtin(local_invocation_id) local_invocation_id : vec3<u32>
|
||||||
|
) {
|
||||||
|
if (local_invocation_id.x == 0u) {
|
||||||
|
workgroupBarrier();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
|
||||||
|
@compute @workgroup_size(8) fn uniformity_error(
|
||||||
|
@builtin(local_invocation_id) local_invocation_id : vec3<u32>
|
||||||
|
) {
|
||||||
|
if (local_invocation_id.x == 0u) {
|
||||||
|
workgroupBarrier();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)"));
|
||||||
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(ShaderTests,
|
DAWN_INSTANTIATE_TEST(ShaderTests,
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
|
@ -95,3 +95,18 @@ TEST_F(UnsafeQueryAPIValidationTest, TimestampQueryDisallowed) {
|
|||||||
ASSERT_DEVICE_ERROR(device.CreateQuerySet(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateQuerySet(&descriptor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check chromium_disable_uniformity_analysis is an unsafe API.
|
||||||
|
TEST_F(UnsafeAPIValidationTest, chromium_disable_uniformity_analysis) {
|
||||||
|
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, R"(
|
||||||
|
enable chromium_disable_uniformity_analysis;
|
||||||
|
|
||||||
|
@compute @workgroup_size(8) fn uniformity_error(
|
||||||
|
@builtin(local_invocation_id) local_invocation_id : vec3<u32>
|
||||||
|
) {
|
||||||
|
if (local_invocation_id.x == 0u) {
|
||||||
|
workgroupBarrier();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)"));
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user