Add testing for 1D w/ level textureLoad overload

BUG=tint:516

Change-Id: Ic075dc52618bc6d2492e82538f0f02d45f925ddf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/42700
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
Ryan Harrison 2021-02-25 23:57:28 +00:00 committed by Commit Bot service account
parent 2aaf7b5c76
commit e5c105d40a
6 changed files with 132 additions and 1 deletions

View File

@ -1700,6 +1700,51 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
1); // coords 1); // coords
}, },
}, },
{
ValidTextureOverload::kLoad1dLevelF32,
"textureLoad(t : texture_1d<f32>,\n"
" coords : i32,\n"
" level : i32) -> vec4<f32>",
TextureKind::kRegular,
type::TextureDimension::k1d,
TextureDataType::kF32,
"textureLoad",
[](ProgramBuilder* b) {
return b->ExprList("texture", // t
1, // coords
3); // level
},
},
{
ValidTextureOverload::kLoad1dLevelU32,
"textureLoad(t : texture_1d<u32>,\n"
" coords : i32,\n"
" level : i32) -> vec4<u32>",
TextureKind::kRegular,
type::TextureDimension::k1d,
TextureDataType::kU32,
"textureLoad",
[](ProgramBuilder* b) {
return b->ExprList("texture", // t
1, // coords
3); // level
},
},
{
ValidTextureOverload::kLoad1dLevelI32,
"textureLoad(t : texture_1d<i32>,\n"
" coords : i32,\n"
" level : i32) -> vec4<i32>",
TextureKind::kRegular,
type::TextureDimension::k1d,
TextureDataType::kI32,
"textureLoad",
[](ProgramBuilder* b) {
return b->ExprList("texture", // t
1, // coords
3); // level
},
},
{ {
ValidTextureOverload::kLoad2dF32, ValidTextureOverload::kLoad2dF32,
"textureLoad(t : texture_2d<f32>,\n" "textureLoad(t : texture_2d<f32>,\n"

View File

@ -137,6 +137,9 @@ enum class ValidTextureOverload {
kLoad1dF32, kLoad1dF32,
kLoad1dU32, kLoad1dU32,
kLoad1dI32, kLoad1dI32,
kLoad1dLevelF32,
kLoad1dLevelU32,
kLoad1dLevelI32,
kLoad2dF32, kLoad2dF32,
kLoad2dU32, kLoad2dU32,
kLoad2dI32, kLoad2dI32,
@ -165,7 +168,7 @@ enum class ValidTextureOverload {
kLoadDepth2dLevelF32, kLoadDepth2dLevelF32,
kLoadDepth2dArrayF32, kLoadDepth2dArrayF32,
kLoadDepth2dArrayLevelF32, kLoadDepth2dArrayLevelF32,
kLoadStorageRO1dRgba32float, // Not permutated for all texel formats kLoadStorageRO1dRgba32float, // Not permutated for all texel formats
kLoadStorageRO2dRgba8unorm, kLoadStorageRO2dRgba8unorm,
kLoadStorageRO2dRgba8snorm, kLoadStorageRO2dRgba8snorm,
kLoadStorageRO2dRgba8uint, kLoadStorageRO2dRgba8uint,

View File

@ -3391,6 +3391,12 @@ const char* expected_texture_overload(
return R"(textureLoad(texture, coords))"; return R"(textureLoad(texture, coords))";
case ValidTextureOverload::kLoad1dI32: case ValidTextureOverload::kLoad1dI32:
return R"(textureLoad(texture, coords))"; return R"(textureLoad(texture, coords))";
case ValidTextureOverload::kLoad1dLevelF32:
return R"(textureLoad(texture, coords, level))";
case ValidTextureOverload::kLoad1dLevelU32:
return R"(textureLoad(texture, coords, level))";
case ValidTextureOverload::kLoad1dLevelI32:
return R"(textureLoad(texture, coords, level))";
case ValidTextureOverload::kLoad2dF32: case ValidTextureOverload::kLoad2dF32:
return R"(textureLoad(texture, coords))"; return R"(textureLoad(texture, coords))";
case ValidTextureOverload::kLoad2dU32: case ValidTextureOverload::kLoad2dU32:

View File

@ -311,6 +311,12 @@ texture_tint_0.GetDimensions(_tint_tmp.x, _tint_tmp.y, _tint_tmp.z, _tint_tmp.w)
return R"(texture_tint_0.Load(int2(1, 0)))"; return R"(texture_tint_0.Load(int2(1, 0)))";
case ValidTextureOverload::kLoad1dI32: case ValidTextureOverload::kLoad1dI32:
return R"(texture_tint_0.Load(int2(1, 0)))"; return R"(texture_tint_0.Load(int2(1, 0)))";
case ValidTextureOverload::kLoad1dLevelF32:
return R"(texture_tint_0.Load(int2(1, 0), 3))";
case ValidTextureOverload::kLoad1dLevelU32:
return R"(texture_tint_0.Load(int2(1, 0), 3))";
case ValidTextureOverload::kLoad1dLevelI32:
return R"(texture_tint_0.Load(int2(1, 0), 3))";
case ValidTextureOverload::kLoad2dF32: case ValidTextureOverload::kLoad2dF32:
return R"(texture_tint_0.Load(int3(1, 2, 0)))"; return R"(texture_tint_0.Load(int3(1, 2, 0)))";
case ValidTextureOverload::kLoad2dU32: case ValidTextureOverload::kLoad2dU32:

View File

@ -196,6 +196,12 @@ std::string expected_texture_overload(
return R"(texture_tint_0.read(1))"; return R"(texture_tint_0.read(1))";
case ValidTextureOverload::kLoad1dI32: case ValidTextureOverload::kLoad1dI32:
return R"(texture_tint_0.read(1))"; return R"(texture_tint_0.read(1))";
case ValidTextureOverload::kLoad1dLevelF32:
return R"(texture_tint_0.read(1, 3))";
case ValidTextureOverload::kLoad1dLevelU32:
return R"(texture_tint_0.read(1, 3))";
case ValidTextureOverload::kLoad1dLevelI32:
return R"(texture_tint_0.read(1, 3))";
case ValidTextureOverload::kLoad2dF32: case ValidTextureOverload::kLoad2dF32:
return R"(texture_tint_0.read(int2(1, 2)))"; return R"(texture_tint_0.read(int2(1, 2)))";
case ValidTextureOverload::kLoad2dU32: case ValidTextureOverload::kLoad2dU32:

View File

@ -2611,6 +2611,71 @@ OpCapability Sampled1D
)", )",
R"( R"(
OpCapability Sampled1D OpCapability Sampled1D
)"};
case ValidTextureOverload::kLoad1dLevelF32:
return {
R"(
%4 = OpTypeFloat 32
%3 = OpTypeImage %4 1D 0 0 0 1 Unknown
%2 = OpTypePointer UniformConstant %3
%1 = OpVariable %2 UniformConstant
%7 = OpTypeSampler
%6 = OpTypePointer UniformConstant %7
%5 = OpVariable %6 UniformConstant
%9 = OpTypeVector %4 4
%11 = OpTypeInt 32 1
%12 = OpConstant %11 1
%13 = OpConstant %11 3
)",
R"(
%10 = OpLoad %3 %1
%8 = OpImageFetch %9 %10 %12 Lod %13
)",
R"(
OpCapability Sampled1D
)"};
case ValidTextureOverload::kLoad1dLevelU32:
return {
R"(
%4 = OpTypeInt 32 0
%3 = OpTypeImage %4 1D 0 0 0 1 Unknown
%2 = OpTypePointer UniformConstant %3
%1 = OpVariable %2 UniformConstant
%7 = OpTypeSampler
%6 = OpTypePointer UniformConstant %7
%5 = OpVariable %6 UniformConstant
%9 = OpTypeVector %4 4
%11 = OpTypeInt 32 1
%12 = OpConstant %11 1
%13 = OpConstant %11 3
)",
R"(
%10 = OpLoad %3 %1
%8 = OpImageFetch %9 %10 %12 Lod %13
)",
R"(
OpCapability Sampled1D
)"};
case ValidTextureOverload::kLoad1dLevelI32:
return {
R"(
%4 = OpTypeInt 32 1
%3 = OpTypeImage %4 1D 0 0 0 1 Unknown
%2 = OpTypePointer UniformConstant %3
%1 = OpVariable %2 UniformConstant
%7 = OpTypeSampler
%6 = OpTypePointer UniformConstant %7
%5 = OpVariable %6 UniformConstant
%9 = OpTypeVector %4 4
%11 = OpConstant %4 1
%12 = OpConstant %4 3
)",
R"(
%10 = OpLoad %3 %1
%8 = OpImageFetch %9 %10 %11 Lod %12
)",
R"(
OpCapability Sampled1D
)"}; )"};
case ValidTextureOverload::kLoad2dF32: case ValidTextureOverload::kLoad2dF32:
return { return {