tint: Validate no f16 sampled textures
Bug: chromium:1370417 Change-Id: Id78178ab61cd882ff8fcbbe96aa8123de512f9aa Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105120 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Auto-Submit: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
3e1501af29
commit
cc636273da
|
@ -1000,22 +1000,27 @@ static constexpr TypeParams type_cases[] = {
|
||||||
TypeParamsFor<i32>(true),
|
TypeParamsFor<i32>(true),
|
||||||
TypeParamsFor<u32>(true),
|
TypeParamsFor<u32>(true),
|
||||||
TypeParamsFor<f32>(true),
|
TypeParamsFor<f32>(true),
|
||||||
|
TypeParamsFor<f16>(false),
|
||||||
|
|
||||||
TypeParamsFor<alias<bool>>(false),
|
TypeParamsFor<alias<bool>>(false),
|
||||||
TypeParamsFor<alias<i32>>(true),
|
TypeParamsFor<alias<i32>>(true),
|
||||||
TypeParamsFor<alias<u32>>(true),
|
TypeParamsFor<alias<u32>>(true),
|
||||||
TypeParamsFor<alias<f32>>(true),
|
TypeParamsFor<alias<f32>>(true),
|
||||||
|
TypeParamsFor<alias<f16>>(false),
|
||||||
|
|
||||||
TypeParamsFor<vec3<f32>>(false),
|
TypeParamsFor<vec3<f32>>(false),
|
||||||
TypeParamsFor<mat3x3<f32>>(false),
|
TypeParamsFor<mat3x3<f32>>(false),
|
||||||
|
TypeParamsFor<mat3x3<f16>>(false),
|
||||||
|
|
||||||
TypeParamsFor<alias<vec3<f32>>>(false),
|
TypeParamsFor<alias<vec3<f32>>>(false),
|
||||||
TypeParamsFor<alias<mat3x3<f32>>>(false),
|
TypeParamsFor<alias<mat3x3<f32>>>(false),
|
||||||
|
TypeParamsFor<alias<mat3x3<f16>>>(false),
|
||||||
};
|
};
|
||||||
|
|
||||||
using SampledTextureTypeTest = ResolverTestWithParam<TypeParams>;
|
using SampledTextureTypeTest = ResolverTestWithParam<TypeParams>;
|
||||||
TEST_P(SampledTextureTypeTest, All) {
|
TEST_P(SampledTextureTypeTest, All) {
|
||||||
auto& params = GetParam();
|
auto& params = GetParam();
|
||||||
|
Enable(ast::Extension::kF16);
|
||||||
GlobalVar(
|
GlobalVar(
|
||||||
"a",
|
"a",
|
||||||
ty.sampled_texture(Source{{12, 34}}, ast::TextureDimension::k2d, params.type_func(*this)),
|
ty.sampled_texture(Source{{12, 34}}, ast::TextureDimension::k2d, params.type_func(*this)),
|
||||||
|
@ -1035,6 +1040,7 @@ INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest,
|
||||||
using MultisampledTextureTypeTest = ResolverTestWithParam<TypeParams>;
|
using MultisampledTextureTypeTest = ResolverTestWithParam<TypeParams>;
|
||||||
TEST_P(MultisampledTextureTypeTest, All) {
|
TEST_P(MultisampledTextureTypeTest, All) {
|
||||||
auto& params = GetParam();
|
auto& params = GetParam();
|
||||||
|
Enable(ast::Extension::kF16);
|
||||||
GlobalVar("a",
|
GlobalVar("a",
|
||||||
ty.multisampled_texture(Source{{12, 34}}, ast::TextureDimension::k2d,
|
ty.multisampled_texture(Source{{12, 34}}, ast::TextureDimension::k2d,
|
||||||
params.type_func(*this)),
|
params.type_func(*this)),
|
||||||
|
|
|
@ -287,7 +287,7 @@ bool Validator::StorageTexture(const ast::StorageTexture* t) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Validator::SampledTexture(const sem::SampledTexture* t, const Source& source) const {
|
bool Validator::SampledTexture(const sem::SampledTexture* t, const Source& source) const {
|
||||||
if (!t->type()->UnwrapRef()->is_numeric_scalar()) {
|
if (!t->type()->UnwrapRef()->IsAnyOf<sem::F32, sem::I32, sem::U32>()) {
|
||||||
AddError("texture_2d<type>: type must be f32, i32 or u32", source);
|
AddError("texture_2d<type>: type must be f32, i32 or u32", source);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ bool Validator::MultisampledTexture(const sem::MultisampledTexture* t, const Sou
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!t->type()->UnwrapRef()->is_numeric_scalar()) {
|
if (!t->type()->UnwrapRef()->IsAnyOf<sem::F32, sem::I32, sem::U32>()) {
|
||||||
AddError("texture_multisampled_2d<type>: type must be f32, i32 or u32", source);
|
AddError("texture_multisampled_2d<type>: type must be f32, i32 or u32", source);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue