spirv-reader: Rename a test class

Bug: tint:109
Change-Id: I31ce88cc28e38a22cc7f83ad5653109b133d401a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33440
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
David Neto 2020-11-19 15:36:11 +00:00 committed by Commit Bot service account
parent 3bc06e3099
commit 36d9a061c8
1 changed files with 70 additions and 63 deletions

View File

@ -771,19 +771,20 @@ TEST_F(SpvParserTest, GetMemoryObjectDeclarationForHandle_FuncParam_Image) {
// Test RegisterHandleUsage, sampled image cases // Test RegisterHandleUsage, sampled image cases
struct SampledImageCase { struct UsageSampledImageCase {
std::string inst; std::string inst;
std::string expected_sampler_usage; std::string expected_sampler_usage;
std::string expected_image_usage; std::string expected_image_usage;
}; };
inline std::ostream& operator<<(std::ostream& out, const SampledImageCase& c) { inline std::ostream& operator<<(std::ostream& out,
out << "SampledImageCase(" << c.inst << ", " << c.expected_sampler_usage const UsageSampledImageCase& c) {
out << "UsageSampledImageCase(" << c.inst << ", " << c.expected_sampler_usage
<< ", " << c.expected_image_usage << ")"; << ", " << c.expected_image_usage << ")";
return out; return out;
} }
using SpvParserTest_RegisterHandleUsage_SampledImage = using SpvParserTest_RegisterHandleUsage_SampledImage =
SpvParserTestBase<::testing::TestWithParam<SampledImageCase>>; SpvParserTestBase<::testing::TestWithParam<UsageSampledImageCase>>;
TEST_P(SpvParserTest_RegisterHandleUsage_SampledImage, Variable) { TEST_P(SpvParserTest_RegisterHandleUsage_SampledImage, Variable) {
const auto assembly = Preamble() + CommonTypes() + R"( const auto assembly = Preamble() + CommonTypes() + R"(
@ -861,11 +862,12 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// OpImageGather // OpImageGather
SampledImageCase{"%result = OpImageGather " UsageSampledImageCase{"%result = OpImageGather "
"%v4float %sampled_image %coords %uint_1", "%v4float %sampled_image %coords %uint_1",
"Usage(Sampler( ))", "Usage(Texture( is_sampled ))"}, "Usage(Sampler( ))",
"Usage(Texture( is_sampled ))"},
// OpImageDrefGather // OpImageDrefGather
SampledImageCase{"%result = OpImageDrefGather " UsageSampledImageCase{"%result = OpImageDrefGather "
"%v4float %sampled_image %coords %depth", "%v4float %sampled_image %coords %depth",
"Usage(Sampler( comparison ))", "Usage(Sampler( comparison ))",
"Usage(Texture( is_sampled depth ))"}, "Usage(Texture( is_sampled depth ))"},
@ -873,20 +875,22 @@ INSTANTIATE_TEST_SUITE_P(
// Sample the texture. // Sample the texture.
// OpImageSampleImplicitLod // OpImageSampleImplicitLod
SampledImageCase{"%result = OpImageSampleImplicitLod " UsageSampledImageCase{"%result = OpImageSampleImplicitLod "
"%v4float %sampled_image %coords", "%v4float %sampled_image %coords",
"Usage(Sampler( ))", "Usage(Texture( is_sampled ))"}, "Usage(Sampler( ))",
"Usage(Texture( is_sampled ))"},
// OpImageSampleExplicitLod // OpImageSampleExplicitLod
SampledImageCase{"%result = OpImageSampleExplicitLod " UsageSampledImageCase{"%result = OpImageSampleExplicitLod "
"%v4float %sampled_image %coords Lod %float_null", "%v4float %sampled_image %coords Lod %float_null",
"Usage(Sampler( ))", "Usage(Texture( is_sampled ))"}, "Usage(Sampler( ))",
"Usage(Texture( is_sampled ))"},
// OpImageSampleDrefImplicitLod // OpImageSampleDrefImplicitLod
SampledImageCase{"%result = OpImageSampleDrefImplicitLod " UsageSampledImageCase{"%result = OpImageSampleDrefImplicitLod "
"%v4float %sampled_image %coords %depth", "%v4float %sampled_image %coords %depth",
"Usage(Sampler( comparison ))", "Usage(Sampler( comparison ))",
"Usage(Texture( is_sampled depth ))"}, "Usage(Texture( is_sampled depth ))"},
// OpImageSampleDrefExplicitLod // OpImageSampleDrefExplicitLod
SampledImageCase{ UsageSampledImageCase{
"%result = OpImageSampleDrefExplicitLod " "%result = OpImageSampleDrefExplicitLod "
"%v4float %sampled_image %coords %depth Lod %float_null", "%v4float %sampled_image %coords %depth Lod %float_null",
"Usage(Sampler( comparison ))", "Usage(Sampler( comparison ))",
@ -896,27 +900,29 @@ INSTANTIATE_TEST_SUITE_P(
// support them. // support them.
// OpImageSampleProjImplicitLod // OpImageSampleProjImplicitLod
SampledImageCase{"%result = OpImageSampleProjImplicitLod " UsageSampledImageCase{"%result = OpImageSampleProjImplicitLod "
"%v4float %sampled_image %coords", "%v4float %sampled_image %coords",
"Usage(Sampler( ))", "Usage(Texture( is_sampled ))"}, "Usage(Sampler( ))",
"Usage(Texture( is_sampled ))"},
// OpImageSampleProjExplicitLod // OpImageSampleProjExplicitLod
SampledImageCase{"%result = OpImageSampleProjExplicitLod " UsageSampledImageCase{"%result = OpImageSampleProjExplicitLod "
"%v4float %sampled_image %coords Lod %float_null", "%v4float %sampled_image %coords Lod %float_null",
"Usage(Sampler( ))", "Usage(Texture( is_sampled ))"}, "Usage(Sampler( ))",
"Usage(Texture( is_sampled ))"},
// OpImageSampleProjDrefImplicitLod // OpImageSampleProjDrefImplicitLod
SampledImageCase{"%result = OpImageSampleProjDrefImplicitLod " UsageSampledImageCase{"%result = OpImageSampleProjDrefImplicitLod "
"%v4float %sampled_image %coords %depth", "%v4float %sampled_image %coords %depth",
"Usage(Sampler( comparison ))", "Usage(Sampler( comparison ))",
"Usage(Texture( is_sampled depth ))"}, "Usage(Texture( is_sampled depth ))"},
// OpImageSampleProjDrefExplicitLod // OpImageSampleProjDrefExplicitLod
SampledImageCase{ UsageSampledImageCase{
"%result = OpImageSampleProjDrefExplicitLod " "%result = OpImageSampleProjDrefExplicitLod "
"%v4float %sampled_image %coords %depth Lod %float_null", "%v4float %sampled_image %coords %depth Lod %float_null",
"Usage(Sampler( comparison ))", "Usage(Sampler( comparison ))",
"Usage(Texture( is_sampled depth ))"}, "Usage(Texture( is_sampled depth ))"},
// OpImageQueryLod // OpImageQueryLod
SampledImageCase{ UsageSampledImageCase{
"%result = OpImageQueryLod %v2float %sampled_image %coords", "%result = OpImageQueryLod %v2float %sampled_image %coords",
"Usage(Sampler( ))", "Usage(Texture( is_sampled ))"})); "Usage(Sampler( ))", "Usage(Texture( is_sampled ))"}));
@ -924,19 +930,19 @@ INSTANTIATE_TEST_SUITE_P(
// For these we test the use of an image value directly, and not combined // For these we test the use of an image value directly, and not combined
// with the sampler. The image still could be of sampled image type. // with the sampler. The image still could be of sampled image type.
struct RawImageCase { struct UsageRawImageCase {
std::string type; // Example: f_storage_1d or f_texture_1d std::string type; // Example: f_storage_1d or f_texture_1d
std::string inst; std::string inst;
std::string expected_image_usage; std::string expected_image_usage;
}; };
inline std::ostream& operator<<(std::ostream& out, const RawImageCase& c) { inline std::ostream& operator<<(std::ostream& out, const UsageRawImageCase& c) {
out << "RawImageCase(" << c.type << ", " << c.inst << ", " out << "UsageRawImageCase(" << c.type << ", " << c.inst << ", "
<< c.expected_image_usage << ")"; << c.expected_image_usage << ")";
return out; return out;
} }
using SpvParserTest_RegisterHandleUsage_RawImage = using SpvParserTest_RegisterHandleUsage_RawImage =
SpvParserTestBase<::testing::TestWithParam<RawImageCase>>; SpvParserTestBase<::testing::TestWithParam<UsageRawImageCase>>;
TEST_P(SpvParserTest_RegisterHandleUsage_RawImage, Variable) { TEST_P(SpvParserTest_RegisterHandleUsage_RawImage, Variable) {
const auto assembly = Preamble() + CommonTypes() + R"( const auto assembly = Preamble() + CommonTypes() + R"(
@ -1005,16 +1011,17 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// OpImageRead // OpImageRead
RawImageCase{"f_storage_1d", UsageRawImageCase{"f_storage_1d",
"%result = OpImageRead %v4float %im %uint_1", "%result = OpImageRead %v4float %im %uint_1",
"Usage(Texture( read ))"}, "Usage(Texture( read ))"},
// OpImageWrite // OpImageWrite
RawImageCase{"f_storage_1d", "OpImageWrite %im %uint_1 %v4float_null", UsageRawImageCase{"f_storage_1d",
"OpImageWrite %im %uint_1 %v4float_null",
"Usage(Texture( write ))"}, "Usage(Texture( write ))"},
// OpImageFetch // OpImageFetch
RawImageCase{"f_texture_1d", UsageRawImageCase{"f_texture_1d",
"%result = OpImageFetch " "%result = OpImageFetch "
"%v4float %im %float_null", "%v4float %im %float_null",
"Usage(Texture( is_sampled ))"}, "Usage(Texture( is_sampled ))"},
@ -1023,26 +1030,26 @@ INSTANTIATE_TEST_SUITE_P(
// OpImageQuerySizeLod // OpImageQuerySizeLod
// Applies to NonReadable, hence write-only storage // Applies to NonReadable, hence write-only storage
RawImageCase{"f_storage_2d", UsageRawImageCase{"f_storage_2d",
"%result = OpImageQuerySizeLod " "%result = OpImageQuerySizeLod "
"%v2uint %im %uint_1", "%v2uint %im %uint_1",
"Usage(Texture( write ))"}, "Usage(Texture( write ))"},
// OpImageQuerySize // OpImageQuerySize
// Applies to NonReadable, hence write-only storage // Applies to NonReadable, hence write-only storage
RawImageCase{"f_storage_2d", UsageRawImageCase{"f_storage_2d",
"%result = OpImageQuerySize " "%result = OpImageQuerySize "
"%v2uint %im", "%v2uint %im",
"Usage(Texture( write ))"}, "Usage(Texture( write ))"},
// OpImageQueryLevels // OpImageQueryLevels
RawImageCase{"f_texture_2d", UsageRawImageCase{"f_texture_2d",
"%result = OpImageQueryLevels " "%result = OpImageQueryLevels "
"%uint %im", "%uint %im",
"Usage(Texture( ))"}, "Usage(Texture( ))"},
// OpImageQuerySamples // OpImageQuerySamples
RawImageCase{"f_texture_2d_ms", UsageRawImageCase{"f_texture_2d_ms",
"%result = OpImageQuerySamples " "%result = OpImageQuerySamples "
"%uint %im", "%uint %im",
"Usage(Texture( is_sampled ms ))"})); "Usage(Texture( is_sampled ms ))"}));