2021-02-10 21:34:25 +00:00
|
|
|
// Copyright 2021 The Tint Authors.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
#include "src/intrinsic_table.h"
|
|
|
|
|
|
|
|
#include "gmock/gmock.h"
|
|
|
|
#include "src/program_builder.h"
|
2021-04-19 22:54:43 +00:00
|
|
|
#include "src/sem/depth_texture_type.h"
|
2021-04-22 22:47:03 +00:00
|
|
|
#include "src/sem/external_texture_type.h"
|
2021-04-19 22:54:43 +00:00
|
|
|
#include "src/sem/multisampled_texture_type.h"
|
2021-05-18 10:28:48 +00:00
|
|
|
#include "src/sem/reference_type.h"
|
2021-04-19 22:54:43 +00:00
|
|
|
#include "src/sem/sampled_texture_type.h"
|
|
|
|
#include "src/sem/storage_texture_type.h"
|
2021-02-10 21:34:25 +00:00
|
|
|
|
|
|
|
namespace tint {
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
using ::testing::ElementsAre;
|
|
|
|
using ::testing::HasSubstr;
|
|
|
|
|
2021-04-16 19:07:51 +00:00
|
|
|
using IntrinsicType = sem::IntrinsicType;
|
|
|
|
using Parameter = sem::Parameter;
|
2021-02-10 21:34:25 +00:00
|
|
|
|
|
|
|
class IntrinsicTableTest : public testing::Test, public ProgramBuilder {
|
|
|
|
public:
|
|
|
|
std::unique_ptr<IntrinsicTable> table = IntrinsicTable::Create();
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchF32) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kCos, {f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kCos);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), f32);
|
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(), ElementsAre(Parameter{f32}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchF32) {
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* i32 = create<sem::I32>();
|
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kCos, {i32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchU32) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* u32 = create<sem::U32>();
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* vec2_f32 = create<sem::Vector>(f32, 2);
|
2021-05-19 17:47:11 +00:00
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kUnpack2x16Float, {u32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kUnpack2x16Float);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), vec2_f32);
|
2021-05-19 17:47:11 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(), ElementsAre(Parameter{u32}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchU32) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kUnpack2x16Float, {f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchI32) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* i32 = create<sem::I32>();
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* vec4_f32 = create<sem::Vector>(f32, 4);
|
|
|
|
auto tex = ty.sampled_texture(ast::TextureDimension::k1d, f32);
|
2021-02-17 20:13:34 +00:00
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kTextureLoad,
|
2021-05-19 17:47:11 +00:00
|
|
|
{tex, i32, i32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kTextureLoad);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), vec4_f32);
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
|
|
|
ElementsAre(Parameter{tex, Parameter::Usage::kTexture},
|
2021-05-19 17:47:11 +00:00
|
|
|
Parameter{i32, Parameter::Usage::kCoords},
|
|
|
|
Parameter{i32, Parameter::Usage::kLevel}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchI32) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto tex = ty.sampled_texture(ast::TextureDimension::k1d, f32);
|
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kTextureLoad, {tex, f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchIU32AsI32) {
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* i32 = create<sem::I32>();
|
2021-02-17 20:13:34 +00:00
|
|
|
auto result =
|
2021-05-19 17:47:11 +00:00
|
|
|
table->Lookup(*this, IntrinsicType::kCountOneBits, {i32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kCountOneBits);
|
2021-05-19 17:47:11 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), i32);
|
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(), ElementsAre(Parameter{i32}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchIU32AsU32) {
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* u32 = create<sem::U32>();
|
2021-02-17 20:13:34 +00:00
|
|
|
auto result =
|
2021-05-19 17:47:11 +00:00
|
|
|
table->Lookup(*this, IntrinsicType::kCountOneBits, {u32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kCountOneBits);
|
2021-05-19 17:47:11 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), u32);
|
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(), ElementsAre(Parameter{u32}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchIU32) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-02-17 20:13:34 +00:00
|
|
|
auto result =
|
2021-05-19 19:51:22 +00:00
|
|
|
table->Lookup(*this, IntrinsicType::kCountOneBits, {f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchFIU32AsI32) {
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* i32 = create<sem::I32>();
|
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kClamp, {i32, i32, i32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kClamp);
|
2021-05-19 17:47:11 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), i32);
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
2021-05-19 17:47:11 +00:00
|
|
|
ElementsAre(Parameter{i32}, Parameter{i32}, Parameter{i32}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchFIU32AsU32) {
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* u32 = create<sem::U32>();
|
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kClamp, {u32, u32, u32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kClamp);
|
2021-05-19 17:47:11 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), u32);
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
2021-05-19 17:47:11 +00:00
|
|
|
ElementsAre(Parameter{u32}, Parameter{u32}, Parameter{u32}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchFIU32AsF32) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kClamp, {f32, f32, f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kClamp);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), f32);
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
2021-05-19 19:51:22 +00:00
|
|
|
ElementsAre(Parameter{f32}, Parameter{f32}, Parameter{f32}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchFIU32) {
|
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kClamp,
|
2021-02-17 20:13:34 +00:00
|
|
|
{ty.bool_(), ty.bool_(), ty.bool_()}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchBool) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-02-10 21:34:25 +00:00
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kSelect,
|
2021-05-19 19:51:22 +00:00
|
|
|
{f32, f32, ty.bool_()}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kSelect);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), f32);
|
|
|
|
EXPECT_THAT(
|
|
|
|
result.intrinsic->Parameters(),
|
|
|
|
ElementsAre(Parameter{f32}, Parameter{f32}, Parameter{ty.bool_()}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchBool) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kSelect, {f32, f32, f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchPointer) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto* ptr = create<sem::Pointer>(f32, ast::StorageClass::kNone);
|
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kModf, {f32, ptr}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kModf);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), f32);
|
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
|
|
|
ElementsAre(Parameter{f32}, Parameter{ptr}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchPointer) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kModf, {f32, f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchArray) {
|
2021-05-07 20:58:34 +00:00
|
|
|
auto* arr = create<sem::Array>(create<sem::U32>(), 0, 4, 4, 4, true);
|
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kArrayLength, {arr}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kArrayLength);
|
2021-05-19 17:47:11 +00:00
|
|
|
EXPECT_TRUE(result.intrinsic->ReturnType()->Is<sem::U32>());
|
2021-05-07 20:58:34 +00:00
|
|
|
ASSERT_EQ(result.intrinsic->Parameters().size(), 1u);
|
|
|
|
EXPECT_TRUE(result.intrinsic->Parameters()[0].type->Is<sem::Array>());
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchArray) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-02-17 20:13:34 +00:00
|
|
|
auto result =
|
2021-05-19 19:51:22 +00:00
|
|
|
table->Lookup(*this, IntrinsicType::kArrayLength, {f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchSampler) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto* vec2_f32 = create<sem::Vector>(f32, 2);
|
|
|
|
auto* vec4_f32 = create<sem::Vector>(f32, 4);
|
|
|
|
auto tex = ty.sampled_texture(ast::TextureDimension::k2d, f32);
|
2021-04-22 14:40:23 +00:00
|
|
|
auto sampler = ty.sampler(ast::SamplerKind::kSampler);
|
2021-02-10 21:34:25 +00:00
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kTextureSample,
|
2021-05-19 19:51:22 +00:00
|
|
|
{tex, sampler, vec2_f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kTextureSample);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), vec4_f32);
|
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
|
|
|
ElementsAre(Parameter{tex, Parameter::Usage::kTexture},
|
|
|
|
Parameter{sampler, Parameter::Usage::kSampler},
|
|
|
|
Parameter{vec2_f32, Parameter::Usage::kCoords}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchSampler) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto* vec2_f32 = create<sem::Vector>(f32, 2);
|
|
|
|
auto tex = ty.sampled_texture(ast::TextureDimension::k2d, f32);
|
2021-02-10 21:34:25 +00:00
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kTextureSample,
|
2021-05-19 19:51:22 +00:00
|
|
|
{tex, f32, vec2_f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchSampledTexture) {
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* i32 = create<sem::I32>();
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* vec2_i32 = create<sem::Vector>(i32, 2);
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* vec4_f32 = create<sem::Vector>(f32, 4);
|
|
|
|
auto tex = ty.sampled_texture(ast::TextureDimension::k2d, f32);
|
2021-02-17 20:13:34 +00:00
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kTextureLoad,
|
2021-05-19 17:47:11 +00:00
|
|
|
{tex, vec2_i32, i32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kTextureLoad);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), vec4_f32);
|
2021-03-02 20:31:58 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
|
|
|
ElementsAre(Parameter{tex, Parameter::Usage::kTexture},
|
2021-05-19 17:47:11 +00:00
|
|
|
Parameter{vec2_i32, Parameter::Usage::kCoords},
|
|
|
|
Parameter{i32, Parameter::Usage::kLevel}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchMultisampledTexture) {
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* i32 = create<sem::I32>();
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* vec2_i32 = create<sem::Vector>(i32, 2);
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* vec4_f32 = create<sem::Vector>(f32, 4);
|
|
|
|
auto* tex = create<sem::MultisampledTexture>(ast::TextureDimension::k2d, f32);
|
2021-02-10 21:34:25 +00:00
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kTextureLoad,
|
2021-05-19 17:47:11 +00:00
|
|
|
{tex, vec2_i32, i32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kTextureLoad);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), vec4_f32);
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
|
|
|
ElementsAre(Parameter{tex, Parameter::Usage::kTexture},
|
2021-05-19 17:47:11 +00:00
|
|
|
Parameter{vec2_i32, Parameter::Usage::kCoords},
|
|
|
|
Parameter{i32, Parameter::Usage::kSampleIndex}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchDepthTexture) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* i32 = create<sem::I32>();
|
|
|
|
auto* vec2_i32 = create<sem::Vector>(i32, 2);
|
2021-04-22 14:40:23 +00:00
|
|
|
auto tex = ty.depth_texture(ast::TextureDimension::k2d);
|
2021-02-17 20:13:34 +00:00
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kTextureLoad,
|
2021-05-19 17:47:11 +00:00
|
|
|
{tex, vec2_i32, i32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kTextureLoad);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), f32);
|
2021-03-02 20:31:58 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
|
|
|
ElementsAre(Parameter{tex, Parameter::Usage::kTexture},
|
2021-05-19 17:47:11 +00:00
|
|
|
Parameter{vec2_i32, Parameter::Usage::kCoords},
|
|
|
|
Parameter{i32, Parameter::Usage::kLevel}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
2021-04-22 22:47:03 +00:00
|
|
|
TEST_F(IntrinsicTableTest, MatchExternalTexture) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* i32 = create<sem::I32>();
|
|
|
|
auto* vec2_i32 = create<sem::Vector>(i32, 2);
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* vec4_f32 = create<sem::Vector>(f32, 4);
|
2021-04-22 22:47:03 +00:00
|
|
|
auto* tex = create<sem::ExternalTexture>();
|
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kTextureLoad,
|
2021-05-19 17:47:11 +00:00
|
|
|
{tex, vec2_i32}, Source{});
|
2021-04-22 22:47:03 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kTextureLoad);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), vec4_f32);
|
2021-05-19 17:47:11 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
|
|
|
ElementsAre(Parameter{tex, Parameter::Usage::kTexture},
|
|
|
|
Parameter{vec2_i32, Parameter::Usage::kCoords}));
|
2021-04-22 22:47:03 +00:00
|
|
|
}
|
|
|
|
|
2021-02-10 21:34:25 +00:00
|
|
|
TEST_F(IntrinsicTableTest, MatchROStorageTexture) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* i32 = create<sem::I32>();
|
|
|
|
auto* vec2_i32 = create<sem::Vector>(i32, 2);
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* vec4_f32 = create<sem::Vector>(f32, 4);
|
2021-05-14 17:51:13 +00:00
|
|
|
auto* subtype =
|
|
|
|
sem::StorageTexture::SubtypeFor(ast::ImageFormat::kR16Float, Types());
|
|
|
|
auto* tex = create<sem::StorageTexture>(
|
|
|
|
ast::TextureDimension::k2d, ast::ImageFormat::kR16Float,
|
|
|
|
ast::AccessControl::kReadOnly, subtype);
|
|
|
|
|
2021-02-10 21:34:25 +00:00
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kTextureLoad,
|
2021-05-19 17:47:11 +00:00
|
|
|
{tex, vec2_i32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kTextureLoad);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), vec4_f32);
|
2021-05-19 17:47:11 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
|
|
|
ElementsAre(Parameter{tex, Parameter::Usage::kTexture},
|
|
|
|
Parameter{vec2_i32, Parameter::Usage::kCoords}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchWOStorageTexture) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* i32 = create<sem::I32>();
|
|
|
|
auto* vec2_i32 = create<sem::Vector>(i32, 2);
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* vec4_f32 = create<sem::Vector>(f32, 4);
|
2021-05-14 17:51:13 +00:00
|
|
|
auto* subtype =
|
|
|
|
sem::StorageTexture::SubtypeFor(ast::ImageFormat::kR16Float, Types());
|
|
|
|
auto* tex = create<sem::StorageTexture>(
|
|
|
|
ast::TextureDimension::k2d, ast::ImageFormat::kR16Float,
|
|
|
|
ast::AccessControl::kWriteOnly, subtype);
|
|
|
|
|
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kTextureStore,
|
2021-05-19 19:51:22 +00:00
|
|
|
{tex, vec2_i32, vec4_f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kTextureStore);
|
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), ty.void_());
|
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
2021-05-14 17:51:13 +00:00
|
|
|
ElementsAre(Parameter{tex, Parameter::Usage::kTexture},
|
2021-05-19 17:47:11 +00:00
|
|
|
Parameter{vec2_i32, Parameter::Usage::kCoords},
|
2021-05-19 19:51:22 +00:00
|
|
|
Parameter{vec4_f32, Parameter::Usage::kValue}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchTexture) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* i32 = create<sem::I32>();
|
|
|
|
auto* vec2_i32 = create<sem::Vector>(i32, 2);
|
2021-02-10 21:34:25 +00:00
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kTextureLoad,
|
2021-05-19 19:51:22 +00:00
|
|
|
{f32, vec2_i32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
2021-05-18 10:28:48 +00:00
|
|
|
TEST_F(IntrinsicTableTest, ImplicitLoadOnReference) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-05-18 10:28:48 +00:00
|
|
|
auto result = table->Lookup(
|
|
|
|
*this, IntrinsicType::kCos,
|
2021-05-19 19:51:22 +00:00
|
|
|
{create<sem::Reference>(f32, ast::StorageClass::kNone)}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kCos);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), f32);
|
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(), ElementsAre(Parameter{f32}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchOpenType) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kClamp, {f32, f32, f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kClamp);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), f32);
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
2021-05-19 19:51:22 +00:00
|
|
|
ElementsAre(Parameter{f32}, Parameter{f32}, Parameter{f32}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchOpenType) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* u32 = create<sem::U32>();
|
2021-05-19 19:51:22 +00:00
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kClamp, {f32, u32, f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchOpenSizeVector) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto* vec2_f32 = create<sem::Vector>(f32, 2);
|
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kClamp,
|
|
|
|
{vec2_f32, vec2_f32, vec2_f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kClamp);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), vec2_f32);
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(),
|
2021-05-19 19:51:22 +00:00
|
|
|
ElementsAre(Parameter{vec2_f32}, Parameter{vec2_f32},
|
|
|
|
Parameter{vec2_f32}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchOpenSizeVector) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
2021-05-19 17:47:11 +00:00
|
|
|
auto* u32 = create<sem::U32>();
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* vec2_f32 = create<sem::Vector>(f32, 2);
|
2021-05-19 17:47:11 +00:00
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kClamp,
|
2021-05-19 19:51:22 +00:00
|
|
|
{vec2_f32, u32, vec2_f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MatchOpenSizeMatrix) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto* vec3_f32 = create<sem::Vector>(f32, 3);
|
|
|
|
auto* mat3_f32 = create<sem::Matrix>(vec3_f32, 3);
|
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kDeterminant, {mat3_f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_NE(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_EQ(result.diagnostics.str(), "");
|
2021-02-10 21:34:25 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->Type(), IntrinsicType::kDeterminant);
|
2021-05-19 19:51:22 +00:00
|
|
|
EXPECT_THAT(result.intrinsic->ReturnType(), f32);
|
|
|
|
EXPECT_THAT(result.intrinsic->Parameters(), ElementsAre(Parameter{mat3_f32}));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, MismatchOpenSizeMatrix) {
|
2021-05-19 19:51:22 +00:00
|
|
|
auto* f32 = create<sem::F32>();
|
|
|
|
auto* vec2_f32 = create<sem::Vector>(f32, 2);
|
|
|
|
auto* mat3x2_f32 = create<sem::Matrix>(vec2_f32, 3);
|
|
|
|
auto result =
|
|
|
|
table->Lookup(*this, IntrinsicType::kDeterminant, {mat3x2_f32}, Source{});
|
2021-02-10 21:34:25 +00:00
|
|
|
ASSERT_EQ(result.intrinsic, nullptr);
|
2021-02-17 20:13:34 +00:00
|
|
|
ASSERT_THAT(result.diagnostics.str(), HasSubstr("no matching call"));
|
2021-02-10 21:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, OverloadOrderByNumberOfParameters) {
|
|
|
|
// None of the arguments match, so expect the overloads with 2 parameters to
|
|
|
|
// come first
|
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kTextureDimensions,
|
2021-02-17 20:13:34 +00:00
|
|
|
{ty.bool_(), ty.bool_()}, Source{});
|
|
|
|
ASSERT_EQ(result.diagnostics.str(),
|
|
|
|
R"(error: no matching call to textureDimensions(bool, bool)
|
2021-02-10 21:34:25 +00:00
|
|
|
|
2021-04-22 22:47:03 +00:00
|
|
|
26 candidate functions:
|
2021-02-10 21:34:25 +00:00
|
|
|
textureDimensions(texture : texture_2d<T>, level : i32) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_2d_array<T>, level : i32) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_3d<T>, level : i32) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_cube<T>, level : i32) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_cube_array<T>, level : i32) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_depth_2d, level : i32) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_depth_2d_array, level : i32) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_depth_cube, level : i32) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_depth_cube_array, level : i32) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_1d<T>) -> i32
|
|
|
|
textureDimensions(texture : texture_2d<T>) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_2d_array<T>) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_3d<T>) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_cube<T>) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_cube_array<T>) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_multisampled_2d<T>) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_multisampled_2d_array<T>) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_depth_2d) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_depth_2d_array) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_depth_cube) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_depth_cube_array) -> vec3<i32>
|
2021-05-14 17:51:13 +00:00
|
|
|
textureDimensions(texture : texture_storage_1d<F, A>) -> i32
|
|
|
|
textureDimensions(texture : texture_storage_2d<F, A>) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_storage_2d_array<F, A>) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_storage_3d<F, A>) -> vec3<i32>
|
2021-04-22 22:47:03 +00:00
|
|
|
textureDimensions(texture : texture_external) -> vec2<i32>
|
2021-02-10 21:34:25 +00:00
|
|
|
)");
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(IntrinsicTableTest, OverloadOrderByMatchingParameter) {
|
2021-04-22 14:40:23 +00:00
|
|
|
auto tex = ty.depth_texture(ast::TextureDimension::k2d);
|
2021-02-10 21:34:25 +00:00
|
|
|
auto result = table->Lookup(*this, IntrinsicType::kTextureDimensions,
|
2021-02-17 20:13:34 +00:00
|
|
|
{tex, ty.bool_()}, Source{});
|
|
|
|
ASSERT_EQ(
|
|
|
|
result.diagnostics.str(),
|
|
|
|
R"(error: no matching call to textureDimensions(texture_depth_2d, bool)
|
2021-02-10 21:34:25 +00:00
|
|
|
|
2021-04-22 22:47:03 +00:00
|
|
|
26 candidate functions:
|
2021-02-10 21:34:25 +00:00
|
|
|
textureDimensions(texture : texture_depth_2d, level : i32) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_depth_2d) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_2d<T>, level : i32) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_2d_array<T>, level : i32) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_3d<T>, level : i32) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_cube<T>, level : i32) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_cube_array<T>, level : i32) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_depth_2d_array, level : i32) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_depth_cube, level : i32) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_depth_cube_array, level : i32) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_1d<T>) -> i32
|
|
|
|
textureDimensions(texture : texture_2d<T>) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_2d_array<T>) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_3d<T>) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_cube<T>) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_cube_array<T>) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_multisampled_2d<T>) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_multisampled_2d_array<T>) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_depth_2d_array) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_depth_cube) -> vec3<i32>
|
|
|
|
textureDimensions(texture : texture_depth_cube_array) -> vec3<i32>
|
2021-05-14 17:51:13 +00:00
|
|
|
textureDimensions(texture : texture_storage_1d<F, A>) -> i32
|
|
|
|
textureDimensions(texture : texture_storage_2d<F, A>) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_storage_2d_array<F, A>) -> vec2<i32>
|
|
|
|
textureDimensions(texture : texture_storage_3d<F, A>) -> vec3<i32>
|
2021-04-22 22:47:03 +00:00
|
|
|
textureDimensions(texture : texture_external) -> vec2<i32>
|
2021-02-10 21:34:25 +00:00
|
|
|
)");
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
} // namespace tint
|