Fix tests so they only exercise legal texture overloads
textureLoad(): * Does not operate on cube textures * Does not have a `level` parameter for storage textures * Requires an `array_index` argument for arrayed texture types textureSample(): * Only supports f32 data types for sampled textures Bug: tint:449 Change-Id: I30b3a0c32245d5e6c4b1f3aeef112a67ffb1d055 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/40506 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
599d8f8c0d
commit
3b4f3d2860
|
@ -579,20 +579,24 @@ class InspectorHelper : public ProgramBuilder {
|
||||||
/// Gets an appropriate type for the coords parameter depending the the
|
/// Gets an appropriate type for the coords parameter depending the the
|
||||||
/// dimensionality of the texture being sampled.
|
/// dimensionality of the texture being sampled.
|
||||||
/// @param dim dimensionality of the texture being sampled
|
/// @param dim dimensionality of the texture being sampled
|
||||||
/// @param sampled_kind type of data in the texture
|
/// @param scalar the scalar type
|
||||||
/// @returns a pointer to a type appropriate for the coord param
|
/// @returns a pointer to a type appropriate for the coord param
|
||||||
type::Type* GetCoordsType(type::TextureDimension dim,
|
type::Type* GetCoordsType(type::TextureDimension dim, type::Type* scalar) {
|
||||||
ResourceBinding::SampledKind sampled_kind) {
|
switch (dim) {
|
||||||
type::Type* base_type = GetBaseType(sampled_kind);
|
case type::TextureDimension::k1d:
|
||||||
if (dim == type::TextureDimension::k1d) {
|
case type::TextureDimension::k1dArray:
|
||||||
return base_type;
|
return scalar;
|
||||||
} else if (dim == type::TextureDimension::k1dArray ||
|
case type::TextureDimension::k2d:
|
||||||
dim == type::TextureDimension::k2d) {
|
case type::TextureDimension::k2dArray:
|
||||||
return vec_type(base_type, 2);
|
return create<type::Vector>(scalar, 2);
|
||||||
} else if (dim == type::TextureDimension::kCubeArray) {
|
case type::TextureDimension::k3d:
|
||||||
return vec_type(base_type, 4);
|
case type::TextureDimension::kCube:
|
||||||
|
case type::TextureDimension::kCubeArray:
|
||||||
|
return create<type::Vector>(scalar, 3);
|
||||||
|
default:
|
||||||
|
[=]() { FAIL() << "Unsupported texture dimension: " << dim; }();
|
||||||
}
|
}
|
||||||
return vec_type(base_type, 3);
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Inspector& Build() {
|
Inspector& Build() {
|
||||||
|
@ -1900,7 +1904,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, SkipsComparisonSamplers) {
|
||||||
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
||||||
AddDepthTexture("foo_texture", depth_texture_type);
|
AddDepthTexture("foo_texture", depth_texture_type);
|
||||||
AddComparisonSampler("foo_sampler", 0, 1);
|
AddComparisonSampler("foo_sampler", 0, 1);
|
||||||
AddGlobalVariable("foo_coords", ty.f32());
|
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
||||||
AddGlobalVariable("foo_depth", ty.f32());
|
AddGlobalVariable("foo_depth", ty.f32());
|
||||||
|
|
||||||
MakeComparisonSamplerReferenceBodyFunction(
|
MakeComparisonSamplerReferenceBodyFunction(
|
||||||
|
@ -1921,7 +1925,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, Simple) {
|
||||||
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
||||||
AddDepthTexture("foo_texture", depth_texture_type);
|
AddDepthTexture("foo_texture", depth_texture_type);
|
||||||
AddComparisonSampler("foo_sampler", 0, 1);
|
AddComparisonSampler("foo_sampler", 0, 1);
|
||||||
AddGlobalVariable("foo_coords", ty.f32());
|
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
||||||
AddGlobalVariable("foo_depth", ty.f32());
|
AddGlobalVariable("foo_depth", ty.f32());
|
||||||
|
|
||||||
MakeComparisonSamplerReferenceBodyFunction(
|
MakeComparisonSamplerReferenceBodyFunction(
|
||||||
|
@ -1958,7 +1962,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, InFunction) {
|
||||||
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
||||||
AddDepthTexture("foo_texture", depth_texture_type);
|
AddDepthTexture("foo_texture", depth_texture_type);
|
||||||
AddComparisonSampler("foo_sampler", 0, 1);
|
AddComparisonSampler("foo_sampler", 0, 1);
|
||||||
AddGlobalVariable("foo_coords", ty.f32());
|
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
||||||
AddGlobalVariable("foo_depth", ty.f32());
|
AddGlobalVariable("foo_depth", ty.f32());
|
||||||
|
|
||||||
MakeComparisonSamplerReferenceBodyFunction("foo_func", "foo_texture",
|
MakeComparisonSamplerReferenceBodyFunction("foo_func", "foo_texture",
|
||||||
|
@ -1985,7 +1989,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, UnknownEntryPoint) {
|
||||||
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
||||||
AddDepthTexture("foo_texture", depth_texture_type);
|
AddDepthTexture("foo_texture", depth_texture_type);
|
||||||
AddComparisonSampler("foo_sampler", 0, 1);
|
AddComparisonSampler("foo_sampler", 0, 1);
|
||||||
AddGlobalVariable("foo_coords", ty.f32());
|
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
||||||
AddGlobalVariable("foo_depth", ty.f32());
|
AddGlobalVariable("foo_depth", ty.f32());
|
||||||
|
|
||||||
MakeComparisonSamplerReferenceBodyFunction(
|
MakeComparisonSamplerReferenceBodyFunction(
|
||||||
|
@ -2040,8 +2044,7 @@ TEST_P(InspectorGetSampledTextureResourceBindingsTestWithParam, textureSample) {
|
||||||
GetParam().type_dim, GetBaseType(GetParam().sampled_kind));
|
GetParam().type_dim, GetBaseType(GetParam().sampled_kind));
|
||||||
AddSampledTexture("foo_texture", sampled_texture_type, 0, 0);
|
AddSampledTexture("foo_texture", sampled_texture_type, 0, 0);
|
||||||
AddSampler("foo_sampler", 0, 1);
|
AddSampler("foo_sampler", 0, 1);
|
||||||
auto* coord_type =
|
auto* coord_type = GetCoordsType(GetParam().type_dim, ty.f32());
|
||||||
GetCoordsType(GetParam().type_dim, GetParam().sampled_kind);
|
|
||||||
AddGlobalVariable("foo_coords", coord_type);
|
AddGlobalVariable("foo_coords", coord_type);
|
||||||
|
|
||||||
MakeSamplerReferenceBodyFunction(
|
MakeSamplerReferenceBodyFunction(
|
||||||
|
@ -2078,50 +2081,18 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
type::TextureDimension::k1d,
|
type::TextureDimension::k1d,
|
||||||
inspector::ResourceBinding::TextureDimension::k1d,
|
inspector::ResourceBinding::TextureDimension::k1d,
|
||||||
inspector::ResourceBinding::SampledKind::kFloat},
|
inspector::ResourceBinding::SampledKind::kFloat},
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::k1d,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k1d,
|
|
||||||
inspector::ResourceBinding::SampledKind::kSInt},
|
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::k1d,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k1d,
|
|
||||||
inspector::ResourceBinding::SampledKind::kUInt},
|
|
||||||
GetSampledTextureTestParams{
|
GetSampledTextureTestParams{
|
||||||
type::TextureDimension::k2d,
|
type::TextureDimension::k2d,
|
||||||
inspector::ResourceBinding::TextureDimension::k2d,
|
inspector::ResourceBinding::TextureDimension::k2d,
|
||||||
inspector::ResourceBinding::SampledKind::kFloat},
|
inspector::ResourceBinding::SampledKind::kFloat},
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::k2d,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k2d,
|
|
||||||
inspector::ResourceBinding::SampledKind::kSInt},
|
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::k2d,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k2d,
|
|
||||||
inspector::ResourceBinding::SampledKind::kUInt},
|
|
||||||
GetSampledTextureTestParams{
|
GetSampledTextureTestParams{
|
||||||
type::TextureDimension::k3d,
|
type::TextureDimension::k3d,
|
||||||
inspector::ResourceBinding::TextureDimension::k3d,
|
inspector::ResourceBinding::TextureDimension::k3d,
|
||||||
inspector::ResourceBinding::SampledKind::kFloat},
|
inspector::ResourceBinding::SampledKind::kFloat},
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::k3d,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k3d,
|
|
||||||
inspector::ResourceBinding::SampledKind::kSInt},
|
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::k3d,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k3d,
|
|
||||||
inspector::ResourceBinding::SampledKind::kUInt},
|
|
||||||
GetSampledTextureTestParams{
|
GetSampledTextureTestParams{
|
||||||
type::TextureDimension::kCube,
|
type::TextureDimension::kCube,
|
||||||
inspector::ResourceBinding::TextureDimension::kCube,
|
inspector::ResourceBinding::TextureDimension::kCube,
|
||||||
inspector::ResourceBinding::SampledKind::kFloat},
|
inspector::ResourceBinding::SampledKind::kFloat}));
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::kCube,
|
|
||||||
inspector::ResourceBinding::TextureDimension::kCube,
|
|
||||||
inspector::ResourceBinding::SampledKind::kSInt},
|
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::kCube,
|
|
||||||
inspector::ResourceBinding::TextureDimension::kCube,
|
|
||||||
inspector::ResourceBinding::SampledKind::kUInt}));
|
|
||||||
|
|
||||||
TEST_P(InspectorGetSampledArrayTextureResourceBindingsTestWithParam,
|
TEST_P(InspectorGetSampledArrayTextureResourceBindingsTestWithParam,
|
||||||
textureSample) {
|
textureSample) {
|
||||||
|
@ -2129,10 +2100,9 @@ TEST_P(InspectorGetSampledArrayTextureResourceBindingsTestWithParam,
|
||||||
GetParam().type_dim, GetBaseType(GetParam().sampled_kind));
|
GetParam().type_dim, GetBaseType(GetParam().sampled_kind));
|
||||||
AddSampledTexture("foo_texture", sampled_texture_type, 0, 0);
|
AddSampledTexture("foo_texture", sampled_texture_type, 0, 0);
|
||||||
AddSampler("foo_sampler", 0, 1);
|
AddSampler("foo_sampler", 0, 1);
|
||||||
auto* coord_type =
|
auto* coord_type = GetCoordsType(GetParam().type_dim, ty.f32());
|
||||||
GetCoordsType(GetParam().type_dim, GetParam().sampled_kind);
|
|
||||||
AddGlobalVariable("foo_coords", coord_type);
|
AddGlobalVariable("foo_coords", coord_type);
|
||||||
AddGlobalVariable("foo_array_index", ty.u32());
|
AddGlobalVariable("foo_array_index", ty.i32());
|
||||||
|
|
||||||
MakeSamplerReferenceBodyFunction(
|
MakeSamplerReferenceBodyFunction(
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_array_index",
|
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_array_index",
|
||||||
|
@ -2161,52 +2131,29 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
type::TextureDimension::k1dArray,
|
type::TextureDimension::k1dArray,
|
||||||
inspector::ResourceBinding::TextureDimension::k1dArray,
|
inspector::ResourceBinding::TextureDimension::k1dArray,
|
||||||
inspector::ResourceBinding::SampledKind::kFloat},
|
inspector::ResourceBinding::SampledKind::kFloat},
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::k1dArray,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k1dArray,
|
|
||||||
inspector::ResourceBinding::SampledKind::kSInt},
|
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::k1dArray,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k1dArray,
|
|
||||||
inspector::ResourceBinding::SampledKind::kUInt},
|
|
||||||
GetSampledTextureTestParams{
|
GetSampledTextureTestParams{
|
||||||
type::TextureDimension::k2dArray,
|
type::TextureDimension::k2dArray,
|
||||||
inspector::ResourceBinding::TextureDimension::k2dArray,
|
inspector::ResourceBinding::TextureDimension::k2dArray,
|
||||||
inspector::ResourceBinding::SampledKind::kFloat},
|
inspector::ResourceBinding::SampledKind::kFloat},
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::k2dArray,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k2dArray,
|
|
||||||
inspector::ResourceBinding::SampledKind::kSInt},
|
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::k2dArray,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k2dArray,
|
|
||||||
inspector::ResourceBinding::SampledKind::kUInt},
|
|
||||||
GetSampledTextureTestParams{
|
GetSampledTextureTestParams{
|
||||||
type::TextureDimension::kCubeArray,
|
type::TextureDimension::kCubeArray,
|
||||||
inspector::ResourceBinding::TextureDimension::kCubeArray,
|
inspector::ResourceBinding::TextureDimension::kCubeArray,
|
||||||
inspector::ResourceBinding::SampledKind::kFloat},
|
inspector::ResourceBinding::SampledKind::kFloat}));
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::kCubeArray,
|
|
||||||
inspector::ResourceBinding::TextureDimension::kCubeArray,
|
|
||||||
inspector::ResourceBinding::SampledKind::kSInt},
|
|
||||||
GetSampledTextureTestParams{
|
|
||||||
type::TextureDimension::kCubeArray,
|
|
||||||
inspector::ResourceBinding::TextureDimension::kCubeArray,
|
|
||||||
inspector::ResourceBinding::SampledKind::kUInt}));
|
|
||||||
|
|
||||||
TEST_P(InspectorGetMultisampledTextureResourceBindingsTestWithParam,
|
TEST_P(InspectorGetMultisampledTextureResourceBindingsTestWithParam,
|
||||||
textureSample) {
|
textureLoad) {
|
||||||
auto* multisampled_texture_type = MakeMultisampledTextureType(
|
auto* multisampled_texture_type = MakeMultisampledTextureType(
|
||||||
GetParam().type_dim, GetBaseType(GetParam().sampled_kind));
|
GetParam().type_dim, GetBaseType(GetParam().sampled_kind));
|
||||||
AddMultisampledTexture("foo_texture", multisampled_texture_type, 0, 0);
|
AddMultisampledTexture("foo_texture", multisampled_texture_type, 0, 0);
|
||||||
AddSampler("foo_sampler", 0, 1);
|
auto* coord_type = GetCoordsType(GetParam().type_dim, ty.i32());
|
||||||
auto* coord_type =
|
|
||||||
GetCoordsType(GetParam().type_dim, GetParam().sampled_kind);
|
|
||||||
AddGlobalVariable("foo_coords", coord_type);
|
AddGlobalVariable("foo_coords", coord_type);
|
||||||
|
AddGlobalVariable("foo_sample_index", ty.i32());
|
||||||
|
|
||||||
MakeSamplerReferenceBodyFunction(
|
Func("ep", ast::VariableList(), ty.void_(),
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords",
|
ast::StatementList{
|
||||||
GetBaseType(GetParam().sampled_kind),
|
create<ast::CallStatement>(Call("textureLoad", "foo_texture",
|
||||||
|
"foo_coords", "foo_sample_index")),
|
||||||
|
},
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
@ -2234,18 +2181,6 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
InspectorGetMultisampledTextureResourceBindingsTest,
|
InspectorGetMultisampledTextureResourceBindingsTest,
|
||||||
InspectorGetMultisampledTextureResourceBindingsTestWithParam,
|
InspectorGetMultisampledTextureResourceBindingsTestWithParam,
|
||||||
testing::Values(
|
testing::Values(
|
||||||
GetMultisampledTextureTestParams{
|
|
||||||
type::TextureDimension::k1d,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k1d,
|
|
||||||
inspector::ResourceBinding::SampledKind::kFloat},
|
|
||||||
GetMultisampledTextureTestParams{
|
|
||||||
type::TextureDimension::k1d,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k1d,
|
|
||||||
inspector::ResourceBinding::SampledKind::kSInt},
|
|
||||||
GetMultisampledTextureTestParams{
|
|
||||||
type::TextureDimension::k1d,
|
|
||||||
inspector::ResourceBinding::TextureDimension::k1d,
|
|
||||||
inspector::ResourceBinding::SampledKind::kUInt},
|
|
||||||
GetMultisampledTextureTestParams{
|
GetMultisampledTextureTestParams{
|
||||||
type::TextureDimension::k2d,
|
type::TextureDimension::k2d,
|
||||||
inspector::ResourceBinding::TextureDimension::k2d,
|
inspector::ResourceBinding::TextureDimension::k2d,
|
||||||
|
@ -2274,15 +2209,14 @@ TEST_F(InspectorGetMultisampledArrayTextureResourceBindingsTest, Empty) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(InspectorGetMultisampledArrayTextureResourceBindingsTestWithParam,
|
TEST_P(InspectorGetMultisampledArrayTextureResourceBindingsTestWithParam,
|
||||||
textureSample) {
|
DISABLED_textureSample) {
|
||||||
auto* multisampled_texture_type = MakeMultisampledTextureType(
|
auto* multisampled_texture_type = MakeMultisampledTextureType(
|
||||||
GetParam().type_dim, GetBaseType(GetParam().sampled_kind));
|
GetParam().type_dim, GetBaseType(GetParam().sampled_kind));
|
||||||
AddMultisampledTexture("foo_texture", multisampled_texture_type, 0, 0);
|
AddMultisampledTexture("foo_texture", multisampled_texture_type, 0, 0);
|
||||||
AddSampler("foo_sampler", 0, 1);
|
AddSampler("foo_sampler", 0, 1);
|
||||||
auto* coord_type =
|
auto* coord_type = GetCoordsType(GetParam().type_dim, ty.f32());
|
||||||
GetCoordsType(GetParam().type_dim, GetParam().sampled_kind);
|
|
||||||
AddGlobalVariable("foo_coords", coord_type);
|
AddGlobalVariable("foo_coords", coord_type);
|
||||||
AddGlobalVariable("foo_array_index", ty.u32());
|
AddGlobalVariable("foo_array_index", ty.i32());
|
||||||
|
|
||||||
MakeSamplerReferenceBodyFunction(
|
MakeSamplerReferenceBodyFunction(
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_array_index",
|
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_array_index",
|
||||||
|
|
|
@ -1377,23 +1377,27 @@ inline std::ostream& operator<<(std::ostream& out, TextureTestParams data) {
|
||||||
class Intrinsic_TextureOperation
|
class Intrinsic_TextureOperation
|
||||||
: public TypeDeterminerTestWithParam<TextureTestParams> {
|
: public TypeDeterminerTestWithParam<TextureTestParams> {
|
||||||
public:
|
public:
|
||||||
type::Type* get_coords_type(type::TextureDimension dim, type::Type* type) {
|
/// Gets an appropriate type for the coords parameter depending the the
|
||||||
if (dim == type::TextureDimension::k1d) {
|
/// dimensionality of the texture being sampled.
|
||||||
if (type->Is<type::I32>()) {
|
/// @param dim dimensionality of the texture being sampled
|
||||||
return create<type::I32>();
|
/// @param scalar the scalar type
|
||||||
} else if (type->Is<type::U32>()) {
|
/// @returns a pointer to a type appropriate for the coord param
|
||||||
return create<type::U32>();
|
type::Type* GetCoordsType(type::TextureDimension dim, type::Type* scalar) {
|
||||||
} else {
|
switch (dim) {
|
||||||
return create<type::F32>();
|
case type::TextureDimension::k1d:
|
||||||
}
|
case type::TextureDimension::k1dArray:
|
||||||
} else if (dim == type::TextureDimension::k1dArray ||
|
return scalar;
|
||||||
dim == type::TextureDimension::k2d) {
|
case type::TextureDimension::k2d:
|
||||||
return create<type::Vector>(type, 2);
|
case type::TextureDimension::k2dArray:
|
||||||
} else if (dim == type::TextureDimension::kCubeArray) {
|
return create<type::Vector>(scalar, 2);
|
||||||
return create<type::Vector>(type, 4);
|
case type::TextureDimension::k3d:
|
||||||
} else {
|
case type::TextureDimension::kCube:
|
||||||
return create<type::Vector>(type, 3);
|
case type::TextureDimension::kCubeArray:
|
||||||
|
return create<type::Vector>(scalar, 3);
|
||||||
|
default:
|
||||||
|
[=]() { FAIL() << "Unsupported texture dimension: " << dim; }();
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_call_param(std::string name,
|
void add_call_param(std::string name,
|
||||||
|
@ -1402,7 +1406,6 @@ class Intrinsic_TextureOperation
|
||||||
Global(name, ast::StorageClass::kNone, type);
|
Global(name, ast::StorageClass::kNone, type);
|
||||||
call_params->push_back(Expr(name));
|
call_params->push_back(Expr(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
type::Type* subtype(Texture type) {
|
type::Type* subtype(Texture type) {
|
||||||
if (type == Texture::kF32) {
|
if (type == Texture::kF32) {
|
||||||
return create<type::F32>();
|
return create<type::F32>();
|
||||||
|
@ -1420,7 +1423,7 @@ TEST_P(Intrinsic_StorageTextureOperation, TextureLoadRo) {
|
||||||
auto type = GetParam().type;
|
auto type = GetParam().type;
|
||||||
auto format = GetParam().format;
|
auto format = GetParam().format;
|
||||||
|
|
||||||
auto* coords_type = get_coords_type(dim, ty.i32());
|
auto* coords_type = GetCoordsType(dim, ty.i32());
|
||||||
|
|
||||||
auto* subtype = type::StorageTexture::SubtypeFor(format, this);
|
auto* subtype = type::StorageTexture::SubtypeFor(format, this);
|
||||||
type::Type* texture_type = create<type::StorageTexture>(dim, format, subtype);
|
type::Type* texture_type = create<type::StorageTexture>(dim, format, subtype);
|
||||||
|
@ -1429,7 +1432,10 @@ TEST_P(Intrinsic_StorageTextureOperation, TextureLoadRo) {
|
||||||
|
|
||||||
add_call_param("texture", texture_type, &call_params);
|
add_call_param("texture", texture_type, &call_params);
|
||||||
add_call_param("coords", coords_type, &call_params);
|
add_call_param("coords", coords_type, &call_params);
|
||||||
add_call_param("lod", ty.i32(), &call_params);
|
|
||||||
|
if (type::IsTextureArray(dim)) {
|
||||||
|
add_call_param("array_index", ty.i32(), &call_params);
|
||||||
|
}
|
||||||
|
|
||||||
auto* expr = Call("textureLoad", call_params);
|
auto* expr = Call("textureLoad", call_params);
|
||||||
WrapInFunction(expr);
|
WrapInFunction(expr);
|
||||||
|
@ -1489,7 +1495,7 @@ TEST_P(Intrinsic_SampledTextureOperation, TextureLoadSampled) {
|
||||||
auto type = GetParam().type;
|
auto type = GetParam().type;
|
||||||
|
|
||||||
type::Type* s = subtype(type);
|
type::Type* s = subtype(type);
|
||||||
auto* coords_type = get_coords_type(dim, ty.i32());
|
auto* coords_type = GetCoordsType(dim, ty.i32());
|
||||||
auto* texture_type = create<type::SampledTexture>(dim, s);
|
auto* texture_type = create<type::SampledTexture>(dim, s);
|
||||||
|
|
||||||
ast::ExpressionList call_params;
|
ast::ExpressionList call_params;
|
||||||
|
@ -1518,10 +1524,11 @@ TEST_P(Intrinsic_SampledTextureOperation, TextureLoadSampled) {
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
TypeDeterminerTest,
|
TypeDeterminerTest,
|
||||||
Intrinsic_SampledTextureOperation,
|
Intrinsic_SampledTextureOperation,
|
||||||
testing::Values(TextureTestParams{type::TextureDimension::k2d},
|
testing::Values(TextureTestParams{type::TextureDimension::k1d},
|
||||||
|
TextureTestParams{type::TextureDimension::k1dArray},
|
||||||
|
TextureTestParams{type::TextureDimension::k2d},
|
||||||
TextureTestParams{type::TextureDimension::k2dArray},
|
TextureTestParams{type::TextureDimension::k2dArray},
|
||||||
TextureTestParams{type::TextureDimension::kCube},
|
TextureTestParams{type::TextureDimension::k3d}));
|
||||||
TextureTestParams{type::TextureDimension::kCubeArray}));
|
|
||||||
|
|
||||||
TEST_F(TypeDeterminerTest, Intrinsic_Dot) {
|
TEST_F(TypeDeterminerTest, Intrinsic_Dot) {
|
||||||
Global("my_var", ast::StorageClass::kNone, ty.vec3<f32>());
|
Global("my_var", ast::StorageClass::kNone, ty.vec3<f32>());
|
||||||
|
|
Loading…
Reference in New Issue