spirv-reader: test texture builtins over arrayed textures

Tested:
 - textureSample
 - textureSampleBias
 - textureSampleLevel
 - textureSampleGrad
 - textureSampleCompare

Fixed: tint:349
Change-Id: Ibb45883b88c8eeec6ba40170f47d78613e150db7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34102
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
This commit is contained in:
David Neto 2020-11-27 17:00:03 +00:00 committed by Commit Bot service account
parent e5aa390e15
commit a8b6f87cca
1 changed files with 450 additions and 4 deletions

View File

@ -1333,6 +1333,49 @@ INSTANTIATE_TEST_SUITE_P(
) )
})"}, })"},
// OpImageSampleImplicitLod arrayed
SampledImageCase{"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords123",
R"(
DecoratedVariable{
Decorations{
SetDecoration{0}
BindingDecoration{0}
}
x_10
uniform_constant
__sampler_sampler
}
DecoratedVariable{
Decorations{
SetDecoration{2}
BindingDecoration{1}
}
x_20
uniform_constant
__sampled_texture_2d_array__f32
})",
R"(
Call[not set]{
Identifier[not set]{textureSample}
(
Identifier[not set]{x_20}
Identifier[not set]{x_10}
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{xy}
}
TypeConstructor[not set]{
__u32
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{z}
}
}
)
})"},
// OpImageSampleImplicitLod with ConstOffset // OpImageSampleImplicitLod with ConstOffset
SampledImageCase{ SampledImageCase{
"%float 2D 0 0 0 1 Unknown", "%float 2D 0 0 0 1 Unknown",
@ -1368,6 +1411,51 @@ INSTANTIATE_TEST_SUITE_P(
) )
})"}, })"},
// OpImageSampleImplicitLod arrayed with ConstOffset
SampledImageCase{
"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords123 ConstOffset %offsets2d",
R"(
DecoratedVariable{
Decorations{
SetDecoration{0}
BindingDecoration{0}
}
x_10
uniform_constant
__sampler_sampler
}
DecoratedVariable{
Decorations{
SetDecoration{2}
BindingDecoration{1}
}
x_20
uniform_constant
__sampled_texture_2d_array__f32
})",
R"(
Call[not set]{
Identifier[not set]{textureSample}
(
Identifier[not set]{x_20}
Identifier[not set]{x_10}
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{xy}
}
TypeConstructor[not set]{
__u32
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{z}
}
}
Identifier[not set]{offsets2d}
)
})"},
// OpImageSampleImplicitLod with Bias // OpImageSampleImplicitLod with Bias
SampledImageCase{"%float 2D 0 0 0 1 Unknown", SampledImageCase{"%float 2D 0 0 0 1 Unknown",
"%result = OpImageSampleImplicitLod " "%result = OpImageSampleImplicitLod "
@ -1402,6 +1490,50 @@ INSTANTIATE_TEST_SUITE_P(
) )
})"}, })"},
// OpImageSampleImplicitLod arrayed with Bias
SampledImageCase{"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords123 Bias %float_7",
R"(
DecoratedVariable{
Decorations{
SetDecoration{0}
BindingDecoration{0}
}
x_10
uniform_constant
__sampler_sampler
}
DecoratedVariable{
Decorations{
SetDecoration{2}
BindingDecoration{1}
}
x_20
uniform_constant
__sampled_texture_2d_array__f32
})",
R"(
Call[not set]{
Identifier[not set]{textureSampleBias}
(
Identifier[not set]{x_20}
Identifier[not set]{x_10}
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{xy}
}
TypeConstructor[not set]{
__u32
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{z}
}
}
ScalarConstructor[not set]{7.000000}
)
})"},
// OpImageSampleImplicitLod with Bias and ConstOffset // OpImageSampleImplicitLod with Bias and ConstOffset
// TODO(dneto): OpImageSampleImplicitLod with Bias and unsigned // TODO(dneto): OpImageSampleImplicitLod with Bias and unsigned
// ConstOffset // ConstOffset
@ -1438,6 +1570,51 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{7.000000} ScalarConstructor[not set]{7.000000}
Identifier[not set]{offsets2d} Identifier[not set]{offsets2d}
) )
})"},
// OpImageSampleImplicitLod arrayed with Bias
SampledImageCase{"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords123 Bias|ConstOffset "
"%float_7 %offsets2d",
R"(
DecoratedVariable{
Decorations{
SetDecoration{0}
BindingDecoration{0}
}
x_10
uniform_constant
__sampler_sampler
}
DecoratedVariable{
Decorations{
SetDecoration{2}
BindingDecoration{1}
}
x_20
uniform_constant
__sampled_texture_2d_array__f32
})",
R"(
Call[not set]{
Identifier[not set]{textureSampleBias}
(
Identifier[not set]{x_20}
Identifier[not set]{x_10}
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{xy}
}
TypeConstructor[not set]{
__u32
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{z}
}
}
ScalarConstructor[not set]{7.000000}
Identifier[not set]{offsets2d}
)
})"})); })"}));
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
@ -1558,7 +1735,49 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{0.200000} ScalarConstructor[not set]{0.200000}
) )
})"}, })"},
// ImageSampleDrefImplicitLod - arrayed
SampledImageCase{"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleDrefImplicitLod "
"%v4float %sampled_image %coords123 %depth",
R"(
DecoratedVariable{
Decorations{
SetDecoration{0}
BindingDecoration{0}
}
x_10
uniform_constant
__sampler_comparison
}
DecoratedVariable{
Decorations{
SetDecoration{2}
BindingDecoration{1}
}
x_20
uniform_constant
__depth_texture_2d_array
})",
R"(
Call[not set]{
Identifier[not set]{textureSampleCompare}
(
Identifier[not set]{x_20}
Identifier[not set]{x_10}
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{xy}
}
TypeConstructor[not set]{
__u32
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{z}
}
}
ScalarConstructor[not set]{0.200000}
)
})"},
// ImageSampleDrefImplicitLod with ConstOffset // ImageSampleDrefImplicitLod with ConstOffset
SampledImageCase{ SampledImageCase{
"%float 2D 0 0 0 1 Unknown", "%float 2D 0 0 0 1 Unknown",
@ -1593,9 +1812,52 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{0.200000} ScalarConstructor[not set]{0.200000}
Identifier[not set]{offsets2d} Identifier[not set]{offsets2d}
) )
})"} })"},
// ImageSampleDrefImplicitLod arrayed with ConstOffset
)); SampledImageCase{
"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleDrefImplicitLod %v4float "
"%sampled_image %coords123 %depth ConstOffset %offsets2d",
R"(
DecoratedVariable{
Decorations{
SetDecoration{0}
BindingDecoration{0}
}
x_10
uniform_constant
__sampler_comparison
}
DecoratedVariable{
Decorations{
SetDecoration{2}
BindingDecoration{1}
}
x_20
uniform_constant
__depth_texture_2d_array
})",
R"(
Call[not set]{
Identifier[not set]{textureSampleCompare}
(
Identifier[not set]{x_20}
Identifier[not set]{x_10}
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{xy}
}
TypeConstructor[not set]{
__u32
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{z}
}
}
ScalarConstructor[not set]{0.200000}
Identifier[not set]{offsets2d}
)
})"}));
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
ImageSampleExplicitLod, ImageSampleExplicitLod,
@ -1636,6 +1898,50 @@ INSTANTIATE_TEST_SUITE_P(
) )
})"}, })"},
// OpImageSampleExplicitLod arrayed - using Lod
SampledImageCase{"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords123 Lod %float_null",
R"(
DecoratedVariable{
Decorations{
SetDecoration{0}
BindingDecoration{0}
}
x_10
uniform_constant
__sampler_sampler
}
DecoratedVariable{
Decorations{
SetDecoration{2}
BindingDecoration{1}
}
x_20
uniform_constant
__sampled_texture_2d_array__f32
})",
R"(
Call[not set]{
Identifier[not set]{textureSampleLevel}
(
Identifier[not set]{x_20}
Identifier[not set]{x_10}
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{xy}
}
TypeConstructor[not set]{
__u32
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{z}
}
}
ScalarConstructor[not set]{0.000000}
)
})"},
// OpImageSampleExplicitLod - using Lod and ConstOffset // OpImageSampleExplicitLod - using Lod and ConstOffset
// TODO(dneto) OpImageSampleExplicitLod - using Lod and unsigned // TODO(dneto) OpImageSampleExplicitLod - using Lod and unsigned
// ConstOffset // ConstOffset
@ -1674,6 +1980,52 @@ INSTANTIATE_TEST_SUITE_P(
) )
})"}, })"},
// OpImageSampleExplicitLod arrayed - using Lod and ConstOffset
SampledImageCase{"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords123 Lod|ConstOffset "
"%float_null %offsets2d",
R"(
DecoratedVariable{
Decorations{
SetDecoration{0}
BindingDecoration{0}
}
x_10
uniform_constant
__sampler_sampler
}
DecoratedVariable{
Decorations{
SetDecoration{2}
BindingDecoration{1}
}
x_20
uniform_constant
__sampled_texture_2d_array__f32
})",
R"(
Call[not set]{
Identifier[not set]{textureSampleLevel}
(
Identifier[not set]{x_20}
Identifier[not set]{x_10}
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{xy}
}
TypeConstructor[not set]{
__u32
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{z}
}
}
ScalarConstructor[not set]{0.000000}
Identifier[not set]{offsets2d}
)
})"},
// OpImageSampleExplicitLod - using Grad // OpImageSampleExplicitLod - using Grad
SampledImageCase{ SampledImageCase{
"%float 2D 0 0 0 1 Unknown", "%float 2D 0 0 0 1 Unknown",
@ -1710,6 +2062,52 @@ INSTANTIATE_TEST_SUITE_P(
) )
})"}, })"},
// OpImageSampleExplicitLod arrayed - using Grad
SampledImageCase{
"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords123 Grad %float_7 %float_null",
R"(
DecoratedVariable{
Decorations{
SetDecoration{0}
BindingDecoration{0}
}
x_10
uniform_constant
__sampler_sampler
}
DecoratedVariable{
Decorations{
SetDecoration{2}
BindingDecoration{1}
}
x_20
uniform_constant
__sampled_texture_2d_array__f32
})",
R"(
Call[not set]{
Identifier[not set]{textureSampleGrad}
(
Identifier[not set]{x_20}
Identifier[not set]{x_10}
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{xy}
}
TypeConstructor[not set]{
__u32
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{z}
}
}
ScalarConstructor[not set]{7.000000}
ScalarConstructor[not set]{0.000000}
)
})"},
// OpImageSampleExplicitLod - using Grad and ConstOffset // OpImageSampleExplicitLod - using Grad and ConstOffset
// TODO(dneto): OpImageSampleExplicitLod - using Grad and unsigned // TODO(dneto): OpImageSampleExplicitLod - using Grad and unsigned
// ConstOffset // ConstOffset
@ -1747,6 +2145,54 @@ INSTANTIATE_TEST_SUITE_P(
ScalarConstructor[not set]{0.000000} ScalarConstructor[not set]{0.000000}
Identifier[not set]{offsets2d} Identifier[not set]{offsets2d}
) )
})"},
// OpImageSampleExplicitLod arrayed - using Grad and ConstOffset
// TODO(dneto): OpImageSampleExplicitLod - using Grad and unsigned
// ConstOffset
SampledImageCase{"%float 2D 0 1 0 1 Unknown",
"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords123 Grad|ConstOffset "
"%float_7 %float_null %offsets2d",
R"(
DecoratedVariable{
Decorations{
SetDecoration{0}
BindingDecoration{0}
}
x_10
uniform_constant
__sampler_sampler
}
DecoratedVariable{
Decorations{
SetDecoration{2}
BindingDecoration{1}
}
x_20
uniform_constant
__sampled_texture_2d_array__f32
})",
R"(
Call[not set]{
Identifier[not set]{textureSampleGrad}
(
Identifier[not set]{x_20}
Identifier[not set]{x_10}
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{xy}
}
TypeConstructor[not set]{
__u32
MemberAccessor[not set]{
Identifier[not set]{coords123}
Identifier[not set]{z}
}
}
ScalarConstructor[not set]{7.000000}
ScalarConstructor[not set]{0.000000}
Identifier[not set]{offsets2d}
)
})"})); })"}));
struct ImageCoordsCase { struct ImageCoordsCase {