Fixup various warnings in Tint which were accidentally suppressed.
When enabling the SPIR-V reader or SPIR-V writer we were suppressing -Wnewline-eof, -Wold-style-cast, -Wsign-conversion, and -Wweak-vtables for the `libtint` cmake target and anything that depended on that target. Because we'd build all readers/ writers by default this caused us to never hit those warnings. A recent change to the cmake build sets the Tint backend based on the Dawn backend. So, there is a much higher chance of not building the SPIR-V support if you're on a Mac or Windows machine. This CL removes the suppression of the warnings, adds specific pragmas into the SPIR-V reader code which imports the SPIRV-Tools headers and fixes up the warnings which were then firing due to checking for the new warnings. Change-Id: I0d0be6aa3d0b692e939ce8ff924dfb82c82792fc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94901 Reviewed-by: Ben Clayton <bclayton@google.com> Auto-Submit: Dan Sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
ad10eb59d1
commit
3a2a279714
|
@ -22,18 +22,6 @@ function(tint_spvtools_compile_options TARGET)
|
|||
${spirv-tools_SOURCE_DIR}
|
||||
${spirv-tools_BINARY_DIR}
|
||||
)
|
||||
|
||||
if (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
|
||||
# The SPIRV-Tools code is conditioned against C++ and an older version of Clang.
|
||||
# Suppress warnings triggered in our current compilation environment.
|
||||
# TODO(dneto): Fix the issues upstream.
|
||||
target_compile_options(${TARGET} PRIVATE
|
||||
-Wno-newline-eof
|
||||
-Wno-sign-conversion
|
||||
-Wno-old-style-cast
|
||||
-Wno-weak-vtables
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
## Tint diagnostic utilities. Used by libtint and tint_utils_io.
|
||||
|
|
|
@ -62,7 +62,7 @@ TEST_F(AstArrayTest, FriendlyName_ConstantSized) {
|
|||
|
||||
TEST_F(AstArrayTest, FriendlyName_WithStride) {
|
||||
auto* i32 = create<I32>();
|
||||
auto* arr = create<Array>(i32, Expr(5_u), AttributeList{create<StrideAttribute>(32)});
|
||||
auto* arr = create<Array>(i32, Expr(5_u), AttributeList{create<StrideAttribute>(32u)});
|
||||
EXPECT_EQ(arr->FriendlyName(Symbols()), "@stride(32) array<i32, 5>");
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace {
|
|||
using BindingAttributeTest = TestHelper;
|
||||
|
||||
TEST_F(BindingAttributeTest, Creation) {
|
||||
auto* d = create<BindingAttribute>(2);
|
||||
auto* d = create<BindingAttribute>(2u);
|
||||
EXPECT_EQ(2u, d->value);
|
||||
}
|
||||
|
||||
|
|
|
@ -142,8 +142,8 @@ const ast::Type* TextureOverloadCase::BuildResultVectorComponentType(ProgramBuil
|
|||
|
||||
const ast::Variable* TextureOverloadCase::BuildTextureVariable(ProgramBuilder* b) const {
|
||||
AttributeList attrs = {
|
||||
b->create<ast::GroupAttribute>(0),
|
||||
b->create<ast::BindingAttribute>(0),
|
||||
b->create<ast::GroupAttribute>(0u),
|
||||
b->create<ast::BindingAttribute>(0u),
|
||||
};
|
||||
switch (texture_kind) {
|
||||
case ast::builtin::test::TextureKind::kRegular:
|
||||
|
@ -176,8 +176,8 @@ const ast::Variable* TextureOverloadCase::BuildTextureVariable(ProgramBuilder* b
|
|||
|
||||
const ast::Variable* TextureOverloadCase::BuildSamplerVariable(ProgramBuilder* b) const {
|
||||
AttributeList attrs = {
|
||||
b->create<ast::GroupAttribute>(0),
|
||||
b->create<ast::BindingAttribute>(1),
|
||||
b->create<ast::GroupAttribute>(0u),
|
||||
b->create<ast::BindingAttribute>(1u),
|
||||
};
|
||||
return b->GlobalVar("sampler", b->ty.sampler(sampler_kind), attrs);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace {
|
|||
using GroupAttributeTest = TestHelper;
|
||||
|
||||
TEST_F(GroupAttributeTest, Creation) {
|
||||
auto* d = create<GroupAttribute>(2);
|
||||
auto* d = create<GroupAttribute>(2u);
|
||||
EXPECT_EQ(2u, d->value);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace {
|
|||
using IdAttributeTest = TestHelper;
|
||||
|
||||
TEST_F(IdAttributeTest, Creation) {
|
||||
auto* d = create<IdAttribute>(12);
|
||||
auto* d = create<IdAttribute>(12u);
|
||||
EXPECT_EQ(12u, d->value);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace {
|
|||
using LocationAttributeTest = TestHelper;
|
||||
|
||||
TEST_F(LocationAttributeTest, Creation) {
|
||||
auto* d = create<LocationAttribute>(2);
|
||||
auto* d = create<LocationAttribute>(2u);
|
||||
EXPECT_EQ(2u, d->value);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ using AstMatrixTest = TestHelper;
|
|||
|
||||
TEST_F(AstMatrixTest, Creation) {
|
||||
auto* i32 = create<I32>();
|
||||
auto* m = create<Matrix>(i32, 2, 4);
|
||||
auto* m = create<Matrix>(i32, 2u, 4u);
|
||||
EXPECT_EQ(m->type, i32);
|
||||
EXPECT_EQ(m->rows, 2u);
|
||||
EXPECT_EQ(m->columns, 4u);
|
||||
|
@ -42,12 +42,12 @@ TEST_F(AstMatrixTest, Creation) {
|
|||
|
||||
TEST_F(AstMatrixTest, FriendlyName) {
|
||||
auto* i32 = create<I32>();
|
||||
auto* m = create<Matrix>(i32, 3, 2);
|
||||
auto* m = create<Matrix>(i32, 3u, 2u);
|
||||
EXPECT_EQ(m->FriendlyName(Symbols()), "mat2x3<i32>");
|
||||
}
|
||||
|
||||
TEST_F(AstMatrixTest, FriendlyName_WithoutType) {
|
||||
auto* m = create<Matrix>(nullptr, 3, 2);
|
||||
auto* m = create<Matrix>(nullptr, 3u, 2u);
|
||||
EXPECT_EQ(m->FriendlyName(Symbols()), "mat2x3");
|
||||
}
|
||||
|
||||
|
|
|
@ -20,13 +20,13 @@ namespace {
|
|||
using StrideAttributeTest = TestHelper;
|
||||
|
||||
TEST_F(StrideAttributeTest, Creation) {
|
||||
auto* d = create<StrideAttribute>(2);
|
||||
auto* d = create<StrideAttribute>(2u);
|
||||
EXPECT_EQ(2u, d->stride);
|
||||
}
|
||||
|
||||
TEST_F(StrideAttributeTest, Source) {
|
||||
auto* d = create<StrideAttribute>(
|
||||
Source{Source::Range{Source::Location{1, 2}, Source::Location{3, 4}}}, 2);
|
||||
Source{Source::Range{Source::Location{1, 2}, Source::Location{3, 4}}}, 2u);
|
||||
EXPECT_EQ(d->source.range.begin.line, 1u);
|
||||
EXPECT_EQ(d->source.range.begin.column, 2u);
|
||||
EXPECT_EQ(d->source.range.end.line, 3u);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace {
|
|||
using StructMemberAlignAttributeTest = TestHelper;
|
||||
|
||||
TEST_F(StructMemberAlignAttributeTest, Creation) {
|
||||
auto* d = create<StructMemberAlignAttribute>(2);
|
||||
auto* d = create<StructMemberAlignAttribute>(2u);
|
||||
EXPECT_EQ(2u, d->align);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace {
|
|||
using StructMemberOffsetAttributeTest = TestHelper;
|
||||
|
||||
TEST_F(StructMemberOffsetAttributeTest, Creation) {
|
||||
auto* d = create<StructMemberOffsetAttribute>(2);
|
||||
auto* d = create<StructMemberOffsetAttribute>(2u);
|
||||
EXPECT_EQ(2u, d->offset);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace {
|
|||
using StructMemberSizeAttributeTest = TestHelper;
|
||||
|
||||
TEST_F(StructMemberSizeAttributeTest, Creation) {
|
||||
auto* d = create<StructMemberSizeAttribute>(2);
|
||||
auto* d = create<StructMemberSizeAttribute>(2u);
|
||||
EXPECT_EQ(2u, d->size);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,9 +94,9 @@ TEST_F(VariableTest, Assert_DifferentProgramID_Constructor) {
|
|||
TEST_F(VariableTest, WithAttributes) {
|
||||
auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, nullptr,
|
||||
AttributeList{
|
||||
create<LocationAttribute>(1),
|
||||
create<LocationAttribute>(1u),
|
||||
create<BuiltinAttribute>(Builtin::kPosition),
|
||||
create<IdAttribute>(1200),
|
||||
create<IdAttribute>(1200u),
|
||||
});
|
||||
|
||||
auto& attributes = var->attributes;
|
||||
|
@ -112,8 +112,8 @@ TEST_F(VariableTest, WithAttributes) {
|
|||
TEST_F(VariableTest, BindingPoint) {
|
||||
auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, nullptr,
|
||||
AttributeList{
|
||||
create<BindingAttribute>(2),
|
||||
create<GroupAttribute>(1),
|
||||
create<BindingAttribute>(2u),
|
||||
create<GroupAttribute>(1u),
|
||||
});
|
||||
EXPECT_TRUE(var->BindingPoint());
|
||||
ASSERT_NE(var->BindingPoint().binding, nullptr);
|
||||
|
@ -132,7 +132,7 @@ TEST_F(VariableTest, BindingPointAttributes) {
|
|||
TEST_F(VariableTest, BindingPointMissingGroupAttribute) {
|
||||
auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, nullptr,
|
||||
AttributeList{
|
||||
create<BindingAttribute>(2),
|
||||
create<BindingAttribute>(2u),
|
||||
});
|
||||
EXPECT_FALSE(var->BindingPoint());
|
||||
ASSERT_NE(var->BindingPoint().binding, nullptr);
|
||||
|
@ -142,7 +142,7 @@ TEST_F(VariableTest, BindingPointMissingGroupAttribute) {
|
|||
|
||||
TEST_F(VariableTest, BindingPointMissingBindingAttribute) {
|
||||
auto* var = Var("my_var", ty.i32(), StorageClass::kFunction, nullptr,
|
||||
AttributeList{create<GroupAttribute>(1)});
|
||||
AttributeList{create<GroupAttribute>(1u)});
|
||||
EXPECT_FALSE(var->BindingPoint());
|
||||
ASSERT_NE(var->BindingPoint().group, nullptr);
|
||||
EXPECT_EQ(var->BindingPoint().group->value, 1u);
|
||||
|
|
|
@ -24,14 +24,14 @@ using AstVectorTest = TestHelper;
|
|||
|
||||
TEST_F(AstVectorTest, Creation) {
|
||||
auto* i32 = create<I32>();
|
||||
auto* v = create<Vector>(i32, 2);
|
||||
auto* v = create<Vector>(i32, 2u);
|
||||
EXPECT_EQ(v->type, i32);
|
||||
EXPECT_EQ(v->width, 2u);
|
||||
}
|
||||
|
||||
TEST_F(AstVectorTest, FriendlyName) {
|
||||
auto* f32 = create<F32>();
|
||||
auto* v = create<Vector>(f32, 3);
|
||||
auto* v = create<Vector>(f32, 3u);
|
||||
EXPECT_EQ(v->FriendlyName(Symbols()), "vec3<f32>");
|
||||
}
|
||||
|
||||
|
|
|
@ -26,4 +26,8 @@ const TypeInfo detail::TypeInfoOf<CastableBase>::info{
|
|||
tint::TypeInfo::FullHashCodeOf<CastableBase>(),
|
||||
};
|
||||
|
||||
CastableBase::CastableBase(const CastableBase&) = default;
|
||||
|
||||
CastableBase::~CastableBase() = default;
|
||||
|
||||
} // namespace tint
|
||||
|
|
|
@ -320,10 +320,10 @@ inline const TO* As(const FROM* obj) {
|
|||
class CastableBase {
|
||||
public:
|
||||
/// Copy constructor
|
||||
CastableBase(const CastableBase&) = default;
|
||||
CastableBase(const CastableBase&);
|
||||
|
||||
/// Destructor
|
||||
virtual ~CastableBase() = default;
|
||||
virtual ~CastableBase();
|
||||
|
||||
/// Copy assignment
|
||||
/// @param other the CastableBase to copy
|
||||
|
@ -626,7 +626,7 @@ inline void SwitchCases(T* object, RETURN_TYPE* result, std::tuple<CASES...>&& c
|
|||
|
||||
// Static assertions
|
||||
static constexpr bool kDefaultIsOK =
|
||||
kDefaultIndex == -1 || kDefaultIndex == std::tuple_size_v<Cases> - 1;
|
||||
kDefaultIndex == -1 || kDefaultIndex == static_cast<int>(std::tuple_size_v<Cases> - 1);
|
||||
static constexpr bool kReturnIsOK =
|
||||
kHasDefaultCase || !kHasReturnType || std::is_constructible_v<RETURN_TYPE>;
|
||||
static_assert(kDefaultIsOK, "Default case must be last in Switch()");
|
||||
|
|
|
@ -23,6 +23,10 @@ TINT_INSTANTIATE_TYPEINFO(tint::Cloneable);
|
|||
|
||||
namespace tint {
|
||||
|
||||
Cloneable::Cloneable() = default;
|
||||
Cloneable::Cloneable(Cloneable&&) = default;
|
||||
Cloneable::~Cloneable() = default;
|
||||
|
||||
CloneContext::ListTransforms::ListTransforms() = default;
|
||||
CloneContext::ListTransforms::~ListTransforms() = default;
|
||||
|
||||
|
|
|
@ -48,6 +48,13 @@ ProgramID ProgramIDOf(const ProgramBuilder*);
|
|||
/// Cloneable is the base class for all objects that can be cloned
|
||||
class Cloneable : public Castable<Cloneable> {
|
||||
public:
|
||||
/// Constructor
|
||||
Cloneable();
|
||||
/// Move constructor
|
||||
Cloneable(Cloneable&&);
|
||||
/// Destructor
|
||||
~Cloneable() override;
|
||||
|
||||
/// Performs a deep clone of this object using the CloneContext `ctx`.
|
||||
/// @param ctx the clone context
|
||||
/// @return the newly cloned object
|
||||
|
|
|
@ -49,7 +49,7 @@ std::string Demangler::Demangle(const SymbolTable& symbols, const std::string& s
|
|||
auto len = end_idx - start_idx;
|
||||
|
||||
auto id = str.substr(start_idx, len);
|
||||
Symbol sym(std::stoi(id), symbols.ProgramID());
|
||||
Symbol sym(static_cast<uint32_t>(std::stoi(id)), symbols.ProgramID());
|
||||
out << symbols.NameFor(sym);
|
||||
|
||||
pos = end_idx;
|
||||
|
|
|
@ -815,8 +815,8 @@ void Inspector::GenerateSamplerTargets() {
|
|||
continue;
|
||||
}
|
||||
|
||||
auto* t = c->args[texture_index];
|
||||
auto* s = c->args[sampler_index];
|
||||
auto* t = c->args[static_cast<size_t>(texture_index)];
|
||||
auto* s = c->args[static_cast<size_t>(sampler_index)];
|
||||
|
||||
GetOriginatingResources(
|
||||
std::array<const ast::Expression*, 2>{t, s},
|
||||
|
|
|
@ -3048,7 +3048,7 @@ TEST_F(InspectorGetWorkgroupStorageSizeTest, StructAlignment) {
|
|||
// here the struct is expected to occupy 1024 bytes of workgroup storage.
|
||||
const auto* wg_struct_type = MakeStructTypeFromMembers(
|
||||
"WgStruct",
|
||||
{MakeStructMember(0, ty.f32(), {create<ast::StructMemberAlignAttribute>(1024)})});
|
||||
{MakeStructMember(0, ty.f32(), {create<ast::StructMemberAlignAttribute>(1024u)})});
|
||||
|
||||
AddWorkgroupStorage("wg_struct_var", ty.Of(wg_struct_type));
|
||||
MakeStructVariableReferenceBodyFunction("wg_struct_func", "wg_struct_var", {{0, ty.f32()}});
|
||||
|
|
|
@ -285,11 +285,11 @@ const ast::Type* InspectorBuilder::GetCoordsType(ast::TextureDimension dim,
|
|||
return scalar;
|
||||
case ast::TextureDimension::k2d:
|
||||
case ast::TextureDimension::k2dArray:
|
||||
return create<ast::Vector>(scalar, 2);
|
||||
return create<ast::Vector>(scalar, 2u);
|
||||
case ast::TextureDimension::k3d:
|
||||
case ast::TextureDimension::kCube:
|
||||
case ast::TextureDimension::kCubeArray:
|
||||
return create<ast::Vector>(scalar, 3);
|
||||
return create<ast::Vector>(scalar, 3u);
|
||||
default:
|
||||
[=]() { FAIL() << "Unsupported texture dimension: " << dim; }();
|
||||
}
|
||||
|
|
|
@ -1024,11 +1024,13 @@ bool FunctionEmitter::EmitPipelineInput(std::string var_name,
|
|||
[&](const Struct* struct_type) -> bool {
|
||||
const auto& members = struct_type->members;
|
||||
index_prefix.push_back(0);
|
||||
for (int i = 0; i < static_cast<int>(members.size()); ++i) {
|
||||
index_prefix.back() = i;
|
||||
for (size_t i = 0; i < members.size(); ++i) {
|
||||
index_prefix.back() = static_cast<int>(i);
|
||||
ast::AttributeList member_attrs(*attrs);
|
||||
if (!parser_impl_.ConvertPipelineDecorations(
|
||||
struct_type, parser_impl_.GetMemberPipelineDecorations(*struct_type, i),
|
||||
struct_type,
|
||||
parser_impl_.GetMemberPipelineDecorations(*struct_type,
|
||||
static_cast<int>(i)),
|
||||
&member_attrs)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1078,7 +1080,7 @@ bool FunctionEmitter::EmitPipelineInput(std::string var_name,
|
|||
store_dest = builder_.MemberAccessor(
|
||||
store_dest,
|
||||
builder_.Expr(parser_impl_.GetMemberName(*struct_type, index)));
|
||||
current_type = struct_type->members[index];
|
||||
current_type = struct_type->members[static_cast<size_t>(index)];
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1174,8 +1176,9 @@ bool FunctionEmitter::EmitPipelineOutput(std::string var_name,
|
|||
&member_attrs)) {
|
||||
return false;
|
||||
}
|
||||
if (!EmitPipelineOutput(var_name, var_type, &member_attrs, index_prefix, members[i],
|
||||
forced_member_type, return_members, return_exprs)) {
|
||||
if (!EmitPipelineOutput(var_name, var_type, &member_attrs, index_prefix,
|
||||
members[static_cast<size_t>(i)], forced_member_type,
|
||||
return_members, return_exprs)) {
|
||||
return false;
|
||||
}
|
||||
// Copy the location as updated by nested expansion of the member.
|
||||
|
@ -1223,7 +1226,7 @@ bool FunctionEmitter::EmitPipelineOutput(std::string var_name,
|
|||
load_source = builder_.MemberAccessor(
|
||||
load_source,
|
||||
builder_.Expr(parser_impl_.GetMemberName(*struct_type, index)));
|
||||
current_type = struct_type->members[index];
|
||||
current_type = struct_type->members[static_cast<size_t>(index)];
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1825,7 +1828,7 @@ bool FunctionEmitter::LabelControlFlowConstructs() {
|
|||
// The current block is a header.
|
||||
const auto header = block_id;
|
||||
const auto* header_info = block_info;
|
||||
const auto depth = 1 + top->depth;
|
||||
const auto depth = static_cast<size_t>(1 + top->depth);
|
||||
const auto ct = header_info->continue_for_header;
|
||||
if (ct != 0) {
|
||||
// The current block is a loop header.
|
||||
|
@ -4310,7 +4313,7 @@ TypedExpression FunctionEmitter::MakeCompositeExtract(const spvtools::opt::Instr
|
|||
// This is structurally similar to creating an access chain, but
|
||||
// the SPIR-V instruction has literal indices instead of IDs for indices.
|
||||
|
||||
auto composite_index = 0;
|
||||
auto composite_index = 0u;
|
||||
auto first_index_position = 1;
|
||||
TypedExpression current_expr(MakeOperand(inst, composite_index));
|
||||
if (!current_expr) {
|
||||
|
@ -4354,13 +4357,14 @@ TypedExpression FunctionEmitter::MakeCompositeValueDecomposition(
|
|||
// hierarchy, maintaining |current_type_id| as the SPIR-V ID of the type of
|
||||
// the object pointed to after processing the previous indices.
|
||||
const auto num_in_operands = inst.NumInOperands();
|
||||
for (uint32_t index = index_start; index < num_in_operands; ++index) {
|
||||
for (uint32_t index = static_cast<uint32_t>(index_start); index < num_in_operands; ++index) {
|
||||
const uint32_t index_val = inst.GetSingleWordInOperand(index);
|
||||
|
||||
const auto* current_type_inst = def_use_mgr_->GetDef(current_type_id);
|
||||
if (!current_type_inst) {
|
||||
Fail() << "composite type %" << current_type_id << " is invalid after following "
|
||||
<< (index - index_start) << " indices: " << inst.PrettyPrint();
|
||||
<< (index - static_cast<uint32_t>(index_start))
|
||||
<< " indices: " << inst.PrettyPrint();
|
||||
return {};
|
||||
}
|
||||
const char* operation_name = nullptr;
|
||||
|
@ -4650,7 +4654,7 @@ void FunctionEmitter::FindValuesNeedingNamedOrHoistedDefinition() {
|
|||
// but only if they are defined in this function as well.
|
||||
auto require_named_const_def = [&](const spvtools::opt::Instruction& inst,
|
||||
int in_operand_index) {
|
||||
const auto id = inst.GetSingleWordInOperand(in_operand_index);
|
||||
const auto id = inst.GetSingleWordInOperand(static_cast<uint32_t>(in_operand_index));
|
||||
auto* const operand_def = GetDefInfo(id);
|
||||
if (operand_def) {
|
||||
operand_def->requires_named_const_def = true;
|
||||
|
@ -4918,7 +4922,7 @@ bool FunctionEmitter::EmitFunctionCall(const spvtools::opt::Instruction& inst) {
|
|||
|
||||
bool FunctionEmitter::EmitControlBarrier(const spvtools::opt::Instruction& inst) {
|
||||
uint32_t operands[3];
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (uint32_t i = 0; i < 3; i++) {
|
||||
auto id = inst.GetSingleWordInOperand(i);
|
||||
if (auto* constant = constant_mgr_->FindDeclaredConstant(id)) {
|
||||
operands[i] = constant->GetU32();
|
||||
|
@ -4936,7 +4940,7 @@ bool FunctionEmitter::EmitControlBarrier(const spvtools::opt::Instruction& inst)
|
|||
<< "expected Workgroup (2), got: " << execution;
|
||||
}
|
||||
if (semantics & SpvMemorySemanticsAcquireReleaseMask) {
|
||||
semantics &= ~SpvMemorySemanticsAcquireReleaseMask;
|
||||
semantics &= ~static_cast<uint32_t>(SpvMemorySemanticsAcquireReleaseMask);
|
||||
} else {
|
||||
return Fail() << "control barrier semantics requires acquire and release";
|
||||
}
|
||||
|
@ -4945,14 +4949,14 @@ bool FunctionEmitter::EmitControlBarrier(const spvtools::opt::Instruction& inst)
|
|||
return Fail() << "workgroupBarrier requires workgroup memory scope";
|
||||
}
|
||||
AddStatement(create<ast::CallStatement>(builder_.Call("workgroupBarrier")));
|
||||
semantics &= ~SpvMemorySemanticsWorkgroupMemoryMask;
|
||||
semantics &= ~static_cast<uint32_t>(SpvMemorySemanticsWorkgroupMemoryMask);
|
||||
}
|
||||
if (semantics & SpvMemorySemanticsUniformMemoryMask) {
|
||||
if (memory != SpvScopeDevice) {
|
||||
return Fail() << "storageBarrier requires device memory scope";
|
||||
}
|
||||
AddStatement(create<ast::CallStatement>(builder_.Call("storageBarrier")));
|
||||
semantics &= ~SpvMemorySemanticsUniformMemoryMask;
|
||||
semantics &= ~static_cast<uint32_t>(SpvMemorySemanticsUniformMemoryMask);
|
||||
}
|
||||
if (semantics) {
|
||||
return Fail() << "unsupported control barrier semantics: " << semantics;
|
||||
|
@ -5600,7 +5604,7 @@ ast::ExpressionList FunctionEmitter::MakeCoordinateOperandsForImageAccess(
|
|||
}
|
||||
ast::TextureDimension dim = texture_type->dims;
|
||||
// Number of regular coordinates.
|
||||
uint32_t num_axes = ast::NumCoordinateAxes(dim);
|
||||
uint32_t num_axes = static_cast<uint32_t>(ast::NumCoordinateAxes(dim));
|
||||
bool is_arrayed = ast::IsTextureArray(dim);
|
||||
if ((num_axes == 0) || (num_axes > 3)) {
|
||||
Fail() << "unsupported image dimensionality for " << texture_type->TypeInfo().name
|
||||
|
|
|
@ -816,7 +816,7 @@ bool ParserImpl::RegisterWorkgroupSizeBuiltin() {
|
|||
/// Returns false and emits a diagnostic on error.
|
||||
auto set_param = [this, composite_def](uint32_t* id_ptr, uint32_t* value_ptr,
|
||||
int index) -> bool {
|
||||
const auto id = composite_def->GetSingleWordInOperand(index);
|
||||
const auto id = composite_def->GetSingleWordInOperand(static_cast<uint32_t>(index));
|
||||
const auto* def = def_use_mgr_->GetDef(id);
|
||||
if (!def || (def->opcode() != SpvOpSpecConstant && def->opcode() != SpvOpConstant) ||
|
||||
(def->NumInOperands() != 1)) {
|
||||
|
@ -1336,7 +1336,7 @@ bool ParserImpl::EmitScalarSpecConstants() {
|
|||
},
|
||||
[&](const U32*) {
|
||||
return create<ast::IntLiteralExpression>(
|
||||
Source{}, static_cast<uint64_t>(literal_value),
|
||||
Source{}, static_cast<int64_t>(literal_value),
|
||||
ast::IntLiteralExpression::Suffix::kU);
|
||||
},
|
||||
[&](const F32*) {
|
||||
|
@ -1715,8 +1715,8 @@ DecorationList ParserImpl::GetMemberPipelineDecorations(const Struct& struct_typ
|
|||
int member_index) {
|
||||
// Yes, I could have used std::copy_if or std::copy_if.
|
||||
DecorationList result;
|
||||
for (const auto& deco :
|
||||
GetDecorationsForMember(struct_id_for_symbol_[struct_type.name], member_index)) {
|
||||
for (const auto& deco : GetDecorationsForMember(struct_id_for_symbol_[struct_type.name],
|
||||
static_cast<uint32_t>(member_index))) {
|
||||
if (IsPipelineDecoration(deco)) {
|
||||
result.emplace_back(deco);
|
||||
}
|
||||
|
@ -2721,7 +2721,7 @@ std::string ParserImpl::GetMemberName(const Struct& struct_type, int member_inde
|
|||
Fail() << "no structure type registered for symbol";
|
||||
return "";
|
||||
}
|
||||
return namer_.GetMemberName(where->second, member_index);
|
||||
return namer_.GetMemberName(where->second, static_cast<uint32_t>(member_index));
|
||||
}
|
||||
|
||||
WorkgroupSizeInfo::WorkgroupSizeInfo() = default;
|
||||
|
|
|
@ -22,8 +22,18 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "src/tint/utils/compiler_macros.h"
|
||||
|
||||
#if TINT_BUILD_SPV_READER
|
||||
TINT_BEGIN_DISABLE_WARNING(NEWLINE_EOF);
|
||||
TINT_BEGIN_DISABLE_WARNING(OLD_STYLE_CAST);
|
||||
TINT_BEGIN_DISABLE_WARNING(SIGN_CONVERSION);
|
||||
TINT_BEGIN_DISABLE_WARNING(WEAK_VTABLES);
|
||||
#include "source/opt/ir_context.h"
|
||||
TINT_END_DISABLE_WARNING(WEAK_VTABLES);
|
||||
TINT_END_DISABLE_WARNING(SIGN_CONVERSION);
|
||||
TINT_END_DISABLE_WARNING(OLD_STYLE_CAST);
|
||||
TINT_END_DISABLE_WARNING(NEWLINE_EOF);
|
||||
#endif
|
||||
|
||||
#include "src/tint/program_builder.h"
|
||||
|
|
|
@ -21,8 +21,18 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "src/tint/utils/compiler_macros.h"
|
||||
|
||||
#if TINT_BUILD_SPV_READER
|
||||
TINT_BEGIN_DISABLE_WARNING(NEWLINE_EOF);
|
||||
TINT_BEGIN_DISABLE_WARNING(OLD_STYLE_CAST);
|
||||
TINT_BEGIN_DISABLE_WARNING(SIGN_CONVERSION);
|
||||
TINT_BEGIN_DISABLE_WARNING(WEAK_VTABLES);
|
||||
#include "source/opt/ir_context.h"
|
||||
TINT_END_DISABLE_WARNING(WEAK_VTABLES);
|
||||
TINT_END_DISABLE_WARNING(SIGN_CONVERSION);
|
||||
TINT_END_DISABLE_WARNING(OLD_STYLE_CAST);
|
||||
TINT_END_DISABLE_WARNING(NEWLINE_EOF);
|
||||
#endif
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
|
|
@ -163,6 +163,12 @@ const ast::Type* I32::Build(ProgramBuilder& b) const {
|
|||
return b.ty.i32();
|
||||
}
|
||||
|
||||
Type::Type() = default;
|
||||
Type::Type(const Type&) = default;
|
||||
Type::~Type() = default;
|
||||
|
||||
Texture::~Texture() = default;
|
||||
|
||||
Pointer::Pointer(const Type* t, ast::StorageClass s) : type(t), storage_class(s) {}
|
||||
Pointer::Pointer(const Pointer&) = default;
|
||||
|
||||
|
|
|
@ -40,6 +40,13 @@ namespace tint::reader::spirv {
|
|||
/// Type is the base class for all types
|
||||
class Type : public Castable<Type> {
|
||||
public:
|
||||
/// Constructor
|
||||
Type();
|
||||
/// Copy constructor
|
||||
Type(const Type&);
|
||||
/// Destructor
|
||||
~Type() override;
|
||||
|
||||
/// @param b the ProgramBuilder used to construct the AST types
|
||||
/// @returns the constructed ast::Type node for the given type
|
||||
virtual const ast::Type* Build(ProgramBuilder& b) const = 0;
|
||||
|
@ -314,6 +321,8 @@ struct Sampler final : public Castable<Sampler, Type> {
|
|||
|
||||
/// Base class for texture types
|
||||
struct Texture : public Castable<Texture, Type> {
|
||||
~Texture() override;
|
||||
|
||||
/// Constructor
|
||||
/// @param d the texture dimensions
|
||||
explicit Texture(ast::TextureDimension d);
|
||||
|
|
|
@ -45,7 +45,7 @@ TEST_F(SpvParserTest, Usage_Trivial_Output) {
|
|||
}
|
||||
|
||||
TEST_F(SpvParserTest, Usage_Equality_OneDifference) {
|
||||
const int num_usages = 9;
|
||||
const size_t num_usages = 9u;
|
||||
std::vector<Usage> usages(num_usages);
|
||||
usages[1].AddSampler();
|
||||
usages[2].AddComparisonSampler();
|
||||
|
@ -55,8 +55,8 @@ TEST_F(SpvParserTest, Usage_Equality_OneDifference) {
|
|||
usages[6].AddDepthTexture();
|
||||
usages[7].AddStorageReadTexture();
|
||||
usages[8].AddStorageWriteTexture();
|
||||
for (int i = 0; i < num_usages; ++i) {
|
||||
for (int j = 0; j < num_usages; ++j) {
|
||||
for (size_t i = 0; i < num_usages; ++i) {
|
||||
for (size_t j = 0; j < num_usages; ++j) {
|
||||
const auto& lhs = usages[i];
|
||||
const auto& rhs = usages[j];
|
||||
if (i == j) {
|
||||
|
|
|
@ -412,7 +412,7 @@ Token Lexer::try_hex_float() {
|
|||
// clang-format on
|
||||
|
||||
// -?
|
||||
int64_t sign_bit = 0;
|
||||
uint64_t sign_bit = 0;
|
||||
if (matches(end, "-")) {
|
||||
sign_bit = 1;
|
||||
end++;
|
||||
|
@ -794,7 +794,7 @@ Token Lexer::build_token_from_int_if_possible(Source source, size_t start, int32
|
|||
const bool overflow = errno == ERANGE;
|
||||
|
||||
if (end_ptr) {
|
||||
advance(end_ptr - start_ptr);
|
||||
advance(static_cast<size_t>(end_ptr - start_ptr));
|
||||
}
|
||||
|
||||
if (matches(pos(), "u")) {
|
||||
|
|
|
@ -32,8 +32,8 @@ TEST_F(ResolverAssignmentValidationTest, ReadOnlyBuffer) {
|
|||
auto* s = Structure("S", {Member("m", ty.i32())});
|
||||
GlobalVar(Source{{12, 34}}, "a", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
WrapInFunction(Assign(Source{{56, 78}}, MemberAccessor("a", "m"), 1_i));
|
||||
|
@ -237,13 +237,13 @@ TEST_F(ResolverAssignmentValidationTest, AssignNonConstructible_Handle) {
|
|||
|
||||
GlobalVar("a", make_type(), ast::StorageClass::kNone,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
GlobalVar("b", make_type(), ast::StorageClass::kNone,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
WrapInFunction(Assign(Source{{56, 78}}, "a", "b"));
|
||||
|
@ -260,8 +260,8 @@ TEST_F(ResolverAssignmentValidationTest, AssignNonConstructible_Atomic) {
|
|||
auto* s = Structure("S", {Member("a", ty.atomic(ty.i32()))});
|
||||
GlobalVar(Source{{12, 34}}, "v", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
WrapInFunction(Assign(Source{{56, 78}}, MemberAccessor("v", "a"), MemberAccessor("v", "a")));
|
||||
|
@ -278,8 +278,8 @@ TEST_F(ResolverAssignmentValidationTest, AssignNonConstructible_RuntimeArray) {
|
|||
auto* s = Structure("S", {Member("a", ty.array(ty.f32()))});
|
||||
GlobalVar(Source{{12, 34}}, "v", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
WrapInFunction(Assign(Source{{56, 78}}, MemberAccessor("v", "a"), MemberAccessor("v", "a")));
|
||||
|
|
|
@ -48,8 +48,8 @@ TEST_F(ResolverAtomicTest, GlobalStorageStruct) {
|
|||
auto* s = Structure("s", {Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))});
|
||||
auto* g = GlobalVar("g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
|
|
@ -508,8 +508,8 @@ TEST_F(EntryPointParameterAttributeTest, DuplicateAttribute) {
|
|||
TEST_F(EntryPointParameterAttributeTest, DuplicateInternalAttribute) {
|
||||
auto* s = Param("s", ty.sampler(ast::SamplerKind::kSampler),
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
Disable(ast::DisabledValidation::kBindingPointCollision),
|
||||
Disable(ast::DisabledValidation::kEntryPointParameter),
|
||||
});
|
||||
|
@ -745,9 +745,9 @@ INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest,
|
|||
TEST_F(VariableAttributeTest, DuplicateAttribute) {
|
||||
GlobalVar("a", ty.sampler(ast::SamplerKind::kSampler),
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(Source{{12, 34}}, 2),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(Source{{56, 78}}, 3),
|
||||
create<ast::BindingAttribute>(Source{{12, 34}}, 2u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
create<ast::BindingAttribute>(Source{{56, 78}}, 3u),
|
||||
});
|
||||
|
||||
WrapInFunction();
|
||||
|
@ -761,7 +761,7 @@ TEST_F(VariableAttributeTest, DuplicateAttribute) {
|
|||
TEST_F(VariableAttributeTest, LocalVariable) {
|
||||
auto* v = Var("a", ty.f32(),
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(Source{{12, 34}}, 2),
|
||||
create<ast::BindingAttribute>(Source{{12, 34}}, 2u),
|
||||
});
|
||||
|
||||
WrapInFunction(v);
|
||||
|
@ -807,8 +807,8 @@ INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest,
|
|||
TEST_F(ConstantAttributeTest, DuplicateAttribute) {
|
||||
GlobalConst("a", ty.f32(), Expr(1.23_f),
|
||||
ast::AttributeList{
|
||||
create<ast::IdAttribute>(Source{{12, 34}}, 0),
|
||||
create<ast::IdAttribute>(Source{{56, 78}}, 1),
|
||||
create<ast::IdAttribute>(Source{{12, 34}}, 0u),
|
||||
create<ast::IdAttribute>(Source{{56, 78}}, 1u),
|
||||
});
|
||||
|
||||
WrapInFunction();
|
||||
|
@ -854,8 +854,8 @@ INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest,
|
|||
TEST_F(OverrideAttributeTest, DuplicateAttribute) {
|
||||
Override("a", ty.f32(), Expr(1.23_f),
|
||||
ast::AttributeList{
|
||||
create<ast::IdAttribute>(Source{{12, 34}}, 0),
|
||||
create<ast::IdAttribute>(Source{{56, 78}}, 1),
|
||||
create<ast::IdAttribute>(Source{{12, 34}}, 0u),
|
||||
create<ast::IdAttribute>(Source{{56, 78}}, 1u),
|
||||
});
|
||||
|
||||
WrapInFunction();
|
||||
|
@ -976,8 +976,8 @@ INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest,
|
|||
TEST_F(ArrayStrideTest, DuplicateAttribute) {
|
||||
auto* arr = ty.array(Source{{12, 34}}, ty.i32(), 4_u,
|
||||
{
|
||||
create<ast::StrideAttribute>(Source{{12, 34}}, 4_i),
|
||||
create<ast::StrideAttribute>(Source{{56, 78}}, 4_i),
|
||||
create<ast::StrideAttribute>(Source{{12, 34}}, 4u),
|
||||
create<ast::StrideAttribute>(Source{{56, 78}}, 4u),
|
||||
});
|
||||
|
||||
GlobalVar("myarray", arr, ast::StorageClass::kPrivate);
|
||||
|
@ -1035,7 +1035,7 @@ TEST_F(ResourceAttributeTest, BindingPairMissingBinding) {
|
|||
GlobalVar(Source{{12, 34}}, "G", ty.sampler(ast::SamplerKind::kSampler),
|
||||
ast::StorageClass::kNone,
|
||||
ast::AttributeList{
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
@ -1047,7 +1047,7 @@ TEST_F(ResourceAttributeTest, BindingPairMissingGroup) {
|
|||
GlobalVar(Source{{12, 34}}, "G", ty.sampler(ast::SamplerKind::kSampler),
|
||||
ast::StorageClass::kNone,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
@ -1059,14 +1059,14 @@ TEST_F(ResourceAttributeTest, BindingPointUsedTwiceByEntryPoint) {
|
|||
GlobalVar(Source{{12, 34}}, "A", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()),
|
||||
ast::StorageClass::kNone,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
GlobalVar(Source{{56, 78}}, "B", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()),
|
||||
ast::StorageClass::kNone,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("F", {}, ty.void_(),
|
||||
|
@ -1091,14 +1091,14 @@ TEST_F(ResourceAttributeTest, BindingPointUsedTwiceByDifferentEntryPoints) {
|
|||
GlobalVar(Source{{12, 34}}, "A", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()),
|
||||
ast::StorageClass::kNone,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
GlobalVar(Source{{56, 78}}, "B", ty.sampled_texture(ast::TextureDimension::k2d, ty.f32()),
|
||||
ast::StorageClass::kNone,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("F_A", {}, ty.void_(),
|
||||
|
@ -1124,8 +1124,8 @@ TEST_F(ResourceAttributeTest, BindingPointUsedTwiceByDifferentEntryPoints) {
|
|||
TEST_F(ResourceAttributeTest, BindingPointOnNonResource) {
|
||||
GlobalVar(Source{{12, 34}}, "G", ty.f32(), ast::StorageClass::kPrivate,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
|
|
@ -187,8 +187,8 @@ class ResolverBuiltinTest_TextureOperation : public ResolverTestWithParam<Textur
|
|||
if (type->IsAnyOf<ast::Texture, ast::Sampler>()) {
|
||||
GlobalVar(name, type,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
} else {
|
||||
|
@ -618,8 +618,8 @@ TEST_F(ResolverBuiltinDataTest, ArrayLength_Vector) {
|
|||
auto* str = Structure("S", {Member("x", ary)});
|
||||
GlobalVar("a", ty.Of(str), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
auto* call = Call("arrayLength", AddressOf(MemberAccessor("a", "x")));
|
||||
|
|
|
@ -257,11 +257,11 @@ TEST_P(BuiltinTextureConstExprArgValidationTest, Immediate) {
|
|||
err << "12:34 error: each component of the " << param.name
|
||||
<< " argument must be at least " << param.min << " and at most " << param.max
|
||||
<< ". " << param.name << " component " << expr.invalid_index << " is "
|
||||
<< std::to_string(expr.values[expr.invalid_index]);
|
||||
<< std::to_string(expr.values[static_cast<size_t>(expr.invalid_index)]);
|
||||
} else {
|
||||
err << "12:34 error: the " << param.name << " argument must be at least " << param.min
|
||||
<< " and at most " << param.max << ". " << param.name << " is "
|
||||
<< std::to_string(expr.values[expr.invalid_index]);
|
||||
<< std::to_string(expr.values[static_cast<size_t>(expr.invalid_index)]);
|
||||
}
|
||||
EXPECT_EQ(r()->error(), err.str());
|
||||
}
|
||||
|
|
|
@ -754,7 +754,7 @@ TEST_F(ResolverFunctionValidationTest, ParametersOverLimit) {
|
|||
TEST_F(ResolverFunctionValidationTest, ParameterVectorNoType) {
|
||||
// fn f(p : vec3) {}
|
||||
|
||||
Func(Source{{12, 34}}, "f", {Param("p", create<ast::Vector>(Source{{12, 34}}, nullptr, 3))},
|
||||
Func(Source{{12, 34}}, "f", {Param("p", create<ast::Vector>(Source{{12, 34}}, nullptr, 3u))},
|
||||
ty.void_(), {});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
@ -764,8 +764,8 @@ TEST_F(ResolverFunctionValidationTest, ParameterVectorNoType) {
|
|||
TEST_F(ResolverFunctionValidationTest, ParameterMatrixNoType) {
|
||||
// fn f(p : vec3) {}
|
||||
|
||||
Func(Source{{12, 34}}, "f", {Param("p", create<ast::Matrix>(Source{{12, 34}}, nullptr, 3, 3))},
|
||||
ty.void_(), {});
|
||||
Func(Source{{12, 34}}, "f",
|
||||
{Param("p", create<ast::Matrix>(Source{{12, 34}}, nullptr, 3u, 3u))}, ty.void_(), {});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "12:34 error: missing matrix element type");
|
||||
|
|
|
@ -28,8 +28,8 @@ TEST_F(ResolverHostShareableValidationTest, BoolMember) {
|
|||
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_FALSE(r()->Resolve());
|
||||
|
@ -46,8 +46,8 @@ TEST_F(ResolverHostShareableValidationTest, BoolVectorMember) {
|
|||
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_FALSE(r()->Resolve());
|
||||
|
@ -65,8 +65,8 @@ TEST_F(ResolverHostShareableValidationTest, Aliases) {
|
|||
auto* a2 = Alias("a2", ty.Of(s));
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.Of(a2), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_FALSE(r()->Resolve());
|
||||
|
@ -87,8 +87,8 @@ TEST_F(ResolverHostShareableValidationTest, NestedStructures) {
|
|||
|
||||
GlobalVar(Source{{9, 10}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_FALSE(r()->Resolve());
|
||||
|
@ -129,8 +129,8 @@ TEST_F(ResolverHostShareableValidationTest, NoError) {
|
|||
|
||||
GlobalVar(Source{{9, 10}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
WrapInFunction();
|
||||
|
||||
|
|
|
@ -1300,8 +1300,8 @@ const sem::CallTarget* Impl::Lookup(CtorConvIntrinsic type,
|
|||
// Conversion.
|
||||
return utils::GetOrCreate(converters, match, [&]() {
|
||||
auto param = builder.create<sem::Parameter>(
|
||||
nullptr, 0, match.parameters[0].type, ast::StorageClass::kNone, ast::Access::kUndefined,
|
||||
match.parameters[0].usage);
|
||||
nullptr, 0u, match.parameters[0].type, ast::StorageClass::kNone,
|
||||
ast::Access::kUndefined, match.parameters[0].usage);
|
||||
return builder.create<sem::TypeConversion>(match.return_type, param);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -63,13 +63,13 @@ TEST_F(ResolverPtrRefTest, DefaultPtrStorageClass) {
|
|||
auto* workgroup = GlobalVar("w", ty.i32(), ast::StorageClass::kWorkgroup);
|
||||
auto* uniform = GlobalVar("ub", ty.Of(buf), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
auto* storage = GlobalVar("sb", ty.Of(buf), ast::StorageClass::kStorage,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
auto* function_ptr =
|
||||
|
|
|
@ -145,8 +145,8 @@ TEST_F(ResolverPtrRefValidationTest, InferredPtrAccessMismatch) {
|
|||
auto* buf = Structure("S", {Member("inner", ty.Of(inner))});
|
||||
auto* storage = GlobalVar("s", ty.Of(buf), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
auto* expr = IndexAccessor(MemberAccessor(MemberAccessor(storage, "inner"), "arr"), 2_i);
|
||||
|
|
|
@ -857,7 +857,7 @@ sem::Function* Resolver::Function(const ast::Function* decl) {
|
|||
bool Resolver::WorkgroupSize(const ast::Function* func) {
|
||||
// Set work-group size defaults.
|
||||
sem::WorkgroupSize ws;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (size_t i = 0; i < 3; i++) {
|
||||
ws[i].value = 1;
|
||||
ws[i].overridable_const = nullptr;
|
||||
}
|
||||
|
@ -876,7 +876,7 @@ bool Resolver::WorkgroupSize(const ast::Function* func) {
|
|||
"workgroup_size argument must be either a literal, constant, or overridable of type "
|
||||
"abstract-integer, i32 or u32";
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (size_t i = 0; i < 3; i++) {
|
||||
// Each argument to this attribute can either be a literal, an identifier for a module-scope
|
||||
// constants, or nullptr if not specified.
|
||||
auto* value = values[i];
|
||||
|
@ -1731,12 +1731,13 @@ void Resolver::CollectTextureSamplerPairs(const sem::Builtin* builtin,
|
|||
if (texture_index == -1) {
|
||||
TINT_ICE(Resolver, diagnostics_) << "texture builtin without texture parameter";
|
||||
}
|
||||
auto* texture = args[texture_index]->As<sem::VariableUser>()->Variable();
|
||||
auto* texture = args[static_cast<size_t>(texture_index)]->As<sem::VariableUser>()->Variable();
|
||||
if (!texture->Type()->UnwrapRef()->Is<sem::StorageTexture>()) {
|
||||
int sampler_index = signature.IndexOf(sem::ParameterUsage::kSampler);
|
||||
const sem::Variable* sampler =
|
||||
sampler_index != -1 ? args[sampler_index]->As<sem::VariableUser>()->Variable()
|
||||
: nullptr;
|
||||
sampler_index != -1
|
||||
? args[static_cast<size_t>(sampler_index)]->As<sem::VariableUser>()->Variable()
|
||||
: nullptr;
|
||||
current_function_->AddTextureSamplerPair(texture, sampler);
|
||||
}
|
||||
}
|
||||
|
@ -2247,7 +2248,7 @@ sem::Array* Resolver::Array(const ast::Array* arr) {
|
|||
}
|
||||
}
|
||||
|
||||
auto size = std::max<uint64_t>(count, 1u) * stride;
|
||||
auto size = std::max<uint64_t>(static_cast<uint32_t>(count), 1u) * stride;
|
||||
if (size > std::numeric_limits<uint32_t>::max()) {
|
||||
std::stringstream msg;
|
||||
msg << "array size (0x" << std::hex << size << ") must not exceed 0xffffffff bytes";
|
||||
|
|
|
@ -779,8 +779,8 @@ TEST_F(ResolverTest, Function_RegisterInputOutputVariables) {
|
|||
auto* sb_var =
|
||||
GlobalVar("sb_var", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
auto* wg_var = GlobalVar("wg_var", ty.f32(), ast::StorageClass::kWorkgroup);
|
||||
auto* priv_var = GlobalVar("priv_var", ty.f32(), ast::StorageClass::kPrivate);
|
||||
|
@ -812,8 +812,8 @@ TEST_F(ResolverTest, Function_RegisterInputOutputVariables_SubFunction) {
|
|||
auto* sb_var =
|
||||
GlobalVar("sb_var", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
auto* wg_var = GlobalVar("wg_var", ty.f32(), ast::StorageClass::kWorkgroup);
|
||||
auto* priv_var = GlobalVar("priv_var", ty.f32(), ast::StorageClass::kPrivate);
|
||||
|
@ -1737,8 +1737,8 @@ TEST_F(ResolverTest, StorageClass_SetForSampler) {
|
|||
auto* t = ty.sampler(ast::SamplerKind::kSampler);
|
||||
auto* var = GlobalVar("var", t,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -1750,8 +1750,8 @@ TEST_F(ResolverTest, StorageClass_SetForTexture) {
|
|||
auto* t = ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
|
||||
auto* var = GlobalVar("var", t,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -1775,8 +1775,8 @@ TEST_F(ResolverTest, Access_SetForStorageBuffer) {
|
|||
auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.i32())});
|
||||
auto* var = GlobalVar(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -1789,10 +1789,10 @@ TEST_F(ResolverTest, BindingPoint_SetForResources) {
|
|||
// @group(3) @binding(4) var s2 : sampler;
|
||||
auto* s1 = GlobalVar(
|
||||
Sym(), ty.sampler(ast::SamplerKind::kSampler),
|
||||
ast::AttributeList{create<ast::GroupAttribute>(1), create<ast::BindingAttribute>(2)});
|
||||
ast::AttributeList{create<ast::GroupAttribute>(1u), create<ast::BindingAttribute>(2u)});
|
||||
auto* s2 = GlobalVar(
|
||||
Sym(), ty.sampler(ast::SamplerKind::kSampler),
|
||||
ast::AttributeList{create<ast::GroupAttribute>(3), create<ast::BindingAttribute>(4)});
|
||||
ast::AttributeList{create<ast::GroupAttribute>(3u), create<ast::BindingAttribute>(4u)});
|
||||
|
||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferBool) {
|
|||
// var<storage> g : bool;
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.bool_(), ast::StorageClass::kStorage,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_FALSE(r()->Resolve());
|
||||
|
@ -104,8 +104,8 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferPointer) {
|
|||
GlobalVar(Source{{56, 78}}, "g", ty.pointer(ty.f32(), ast::StorageClass::kPrivate),
|
||||
ast::StorageClass::kStorage,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_FALSE(r()->Resolve());
|
||||
|
@ -120,8 +120,8 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferIntScalar) {
|
|||
// var<storage> g : i32;
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.i32(), ast::StorageClass::kStorage,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -131,8 +131,8 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferVector) {
|
|||
// var<storage> g : vec4<f32>;
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.vec4<f32>(), ast::StorageClass::kStorage,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -144,8 +144,8 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferArray) {
|
|||
auto* a = ty.array(ty.Of(s), 3_u);
|
||||
GlobalVar(Source{{56, 78}}, "g", a, ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -157,8 +157,8 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferBoolAlias) {
|
|||
auto* a = Alias("a", ty.bool_());
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.Of(a), ast::StorageClass::kStorage,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_FALSE(r()->Resolve());
|
||||
|
@ -186,8 +186,8 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferNoError_Basic) {
|
|||
auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.i32())});
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_TRUE(r()->Resolve());
|
||||
|
@ -202,8 +202,8 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferNoError_Aliases) {
|
|||
auto* a2 = Alias("a2", ty.Of(a1));
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.Of(a2), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_TRUE(r()->Resolve());
|
||||
|
@ -217,8 +217,8 @@ TEST_F(ResolverStorageClassValidationTest, UniformBuffer_Struct_Runtime) {
|
|||
|
||||
GlobalVar(Source{{56, 78}}, "svar", ty.Of(s), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_FALSE(r()->Resolve());
|
||||
|
@ -232,8 +232,8 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferBool) {
|
|||
// var<uniform> g : bool;
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.bool_(), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_FALSE(r()->Resolve());
|
||||
|
@ -249,8 +249,8 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferPointer) {
|
|||
GlobalVar(Source{{56, 78}}, "g", ty.pointer(ty.f32(), ast::StorageClass::kPrivate),
|
||||
ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_FALSE(r()->Resolve());
|
||||
|
@ -265,8 +265,8 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferIntScalar) {
|
|||
// var<uniform> g : i32;
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.i32(), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -276,8 +276,8 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferVector) {
|
|||
// var<uniform> g : vec4<f32>;
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.vec4<f32>(), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -292,8 +292,8 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferArray) {
|
|||
auto* a = ty.array(ty.Of(s), 3_u);
|
||||
GlobalVar(Source{{56, 78}}, "g", a, ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -305,8 +305,8 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferBoolAlias) {
|
|||
auto* a = Alias("a", ty.bool_());
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.Of(a), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_FALSE(r()->Resolve());
|
||||
|
@ -323,8 +323,8 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferNoError_Basic) {
|
|||
auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.i32())});
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.Of(s), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -338,8 +338,8 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferNoError_Aliases) {
|
|||
auto* a1 = Alias("a1", ty.Of(s));
|
||||
GlobalVar(Source{{56, 78}}, "g", ty.Of(a1), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
|
|
@ -161,13 +161,13 @@ TEST_F(ResolverStorageClassUseTest, StructMultipleStorageClassUses) {
|
|||
auto* s = Structure("S", {Member("a", ty.f32())});
|
||||
GlobalVar("x", ty.Of(s), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
GlobalVar("y", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
WrapInFunction(Var("g", ty.Of(s)));
|
||||
|
||||
|
|
|
@ -1856,11 +1856,11 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
|||
TEST_F(ResolverTypeConstructorValidationTest, InferVec2ElementTypeFromScalars) {
|
||||
Enable(ast::Extension::kF16);
|
||||
|
||||
auto* vec2_bool = Construct(create<ast::Vector>(nullptr, 2), Expr(true), Expr(false));
|
||||
auto* vec2_i32 = Construct(create<ast::Vector>(nullptr, 2), Expr(1_i), Expr(2_i));
|
||||
auto* vec2_u32 = Construct(create<ast::Vector>(nullptr, 2), Expr(1_u), Expr(2_u));
|
||||
auto* vec2_f32 = Construct(create<ast::Vector>(nullptr, 2), Expr(1_f), Expr(2_f));
|
||||
auto* vec2_f16 = Construct(create<ast::Vector>(nullptr, 2), Expr(1_h), Expr(2_h));
|
||||
auto* vec2_bool = Construct(create<ast::Vector>(nullptr, 2u), Expr(true), Expr(false));
|
||||
auto* vec2_i32 = Construct(create<ast::Vector>(nullptr, 2u), Expr(1_i), Expr(2_i));
|
||||
auto* vec2_u32 = Construct(create<ast::Vector>(nullptr, 2u), Expr(1_u), Expr(2_u));
|
||||
auto* vec2_f32 = Construct(create<ast::Vector>(nullptr, 2u), Expr(1_f), Expr(2_f));
|
||||
auto* vec2_f16 = Construct(create<ast::Vector>(nullptr, 2u), Expr(1_h), Expr(2_h));
|
||||
WrapInFunction(vec2_bool, vec2_i32, vec2_u32, vec2_f32, vec2_f16);
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -1890,11 +1890,11 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec2ElementTypeFromScalars) {
|
|||
TEST_F(ResolverTypeConstructorValidationTest, InferVec2ElementTypeFromVec2) {
|
||||
Enable(ast::Extension::kF16);
|
||||
|
||||
auto* vec2_bool = Construct(create<ast::Vector>(nullptr, 2), vec2<bool>(true, false));
|
||||
auto* vec2_i32 = Construct(create<ast::Vector>(nullptr, 2), vec2<i32>(1_i, 2_i));
|
||||
auto* vec2_u32 = Construct(create<ast::Vector>(nullptr, 2), vec2<u32>(1_u, 2_u));
|
||||
auto* vec2_f32 = Construct(create<ast::Vector>(nullptr, 2), vec2<f32>(1_f, 2_f));
|
||||
auto* vec2_f16 = Construct(create<ast::Vector>(nullptr, 2), vec2<f16>(1_h, 2_h));
|
||||
auto* vec2_bool = Construct(create<ast::Vector>(nullptr, 2u), vec2<bool>(true, false));
|
||||
auto* vec2_i32 = Construct(create<ast::Vector>(nullptr, 2u), vec2<i32>(1_i, 2_i));
|
||||
auto* vec2_u32 = Construct(create<ast::Vector>(nullptr, 2u), vec2<u32>(1_u, 2_u));
|
||||
auto* vec2_f32 = Construct(create<ast::Vector>(nullptr, 2u), vec2<f32>(1_f, 2_f));
|
||||
auto* vec2_f16 = Construct(create<ast::Vector>(nullptr, 2u), vec2<f16>(1_h, 2_h));
|
||||
WrapInFunction(vec2_bool, vec2_i32, vec2_u32, vec2_f32, vec2_f16);
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -1925,11 +1925,11 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec3ElementTypeFromScalars) {
|
|||
Enable(ast::Extension::kF16);
|
||||
|
||||
auto* vec3_bool =
|
||||
Construct(create<ast::Vector>(nullptr, 3), Expr(true), Expr(false), Expr(true));
|
||||
auto* vec3_i32 = Construct(create<ast::Vector>(nullptr, 3), Expr(1_i), Expr(2_i), Expr(3_i));
|
||||
auto* vec3_u32 = Construct(create<ast::Vector>(nullptr, 3), Expr(1_u), Expr(2_u), Expr(3_u));
|
||||
auto* vec3_f32 = Construct(create<ast::Vector>(nullptr, 3), Expr(1_f), Expr(2_f), Expr(3_f));
|
||||
auto* vec3_f16 = Construct(create<ast::Vector>(nullptr, 3), Expr(1_h), Expr(2_h), Expr(3_h));
|
||||
Construct(create<ast::Vector>(nullptr, 3u), Expr(true), Expr(false), Expr(true));
|
||||
auto* vec3_i32 = Construct(create<ast::Vector>(nullptr, 3u), Expr(1_i), Expr(2_i), Expr(3_i));
|
||||
auto* vec3_u32 = Construct(create<ast::Vector>(nullptr, 3u), Expr(1_u), Expr(2_u), Expr(3_u));
|
||||
auto* vec3_f32 = Construct(create<ast::Vector>(nullptr, 3u), Expr(1_f), Expr(2_f), Expr(3_f));
|
||||
auto* vec3_f16 = Construct(create<ast::Vector>(nullptr, 3u), Expr(1_h), Expr(2_h), Expr(3_h));
|
||||
WrapInFunction(vec3_bool, vec3_i32, vec3_u32, vec3_f32, vec3_f16);
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -1959,11 +1959,11 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec3ElementTypeFromScalars) {
|
|||
TEST_F(ResolverTypeConstructorValidationTest, InferVec3ElementTypeFromVec3) {
|
||||
Enable(ast::Extension::kF16);
|
||||
|
||||
auto* vec3_bool = Construct(create<ast::Vector>(nullptr, 3), vec3<bool>(true, false, true));
|
||||
auto* vec3_i32 = Construct(create<ast::Vector>(nullptr, 3), vec3<i32>(1_i, 2_i, 3_i));
|
||||
auto* vec3_u32 = Construct(create<ast::Vector>(nullptr, 3), vec3<u32>(1_u, 2_u, 3_u));
|
||||
auto* vec3_f32 = Construct(create<ast::Vector>(nullptr, 3), vec3<f32>(1_f, 2_f, 3_f));
|
||||
auto* vec3_f16 = Construct(create<ast::Vector>(nullptr, 3), vec3<f16>(1_h, 2_h, 3_h));
|
||||
auto* vec3_bool = Construct(create<ast::Vector>(nullptr, 3u), vec3<bool>(true, false, true));
|
||||
auto* vec3_i32 = Construct(create<ast::Vector>(nullptr, 3u), vec3<i32>(1_i, 2_i, 3_i));
|
||||
auto* vec3_u32 = Construct(create<ast::Vector>(nullptr, 3u), vec3<u32>(1_u, 2_u, 3_u));
|
||||
auto* vec3_f32 = Construct(create<ast::Vector>(nullptr, 3u), vec3<f32>(1_f, 2_f, 3_f));
|
||||
auto* vec3_f16 = Construct(create<ast::Vector>(nullptr, 3u), vec3<f16>(1_h, 2_h, 3_h));
|
||||
WrapInFunction(vec3_bool, vec3_i32, vec3_u32, vec3_f32, vec3_f16);
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -1994,11 +1994,11 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec3ElementTypeFromScalarAndV
|
|||
Enable(ast::Extension::kF16);
|
||||
|
||||
auto* vec3_bool =
|
||||
Construct(create<ast::Vector>(nullptr, 3), Expr(true), vec2<bool>(false, true));
|
||||
auto* vec3_i32 = Construct(create<ast::Vector>(nullptr, 3), Expr(1_i), vec2<i32>(2_i, 3_i));
|
||||
auto* vec3_u32 = Construct(create<ast::Vector>(nullptr, 3), Expr(1_u), vec2<u32>(2_u, 3_u));
|
||||
auto* vec3_f32 = Construct(create<ast::Vector>(nullptr, 3), Expr(1_f), vec2<f32>(2_f, 3_f));
|
||||
auto* vec3_f16 = Construct(create<ast::Vector>(nullptr, 3), Expr(1_h), vec2<f16>(2_h, 3_h));
|
||||
Construct(create<ast::Vector>(nullptr, 3u), Expr(true), vec2<bool>(false, true));
|
||||
auto* vec3_i32 = Construct(create<ast::Vector>(nullptr, 3u), Expr(1_i), vec2<i32>(2_i, 3_i));
|
||||
auto* vec3_u32 = Construct(create<ast::Vector>(nullptr, 3u), Expr(1_u), vec2<u32>(2_u, 3_u));
|
||||
auto* vec3_f32 = Construct(create<ast::Vector>(nullptr, 3u), Expr(1_f), vec2<f32>(2_f, 3_f));
|
||||
auto* vec3_f16 = Construct(create<ast::Vector>(nullptr, 3u), Expr(1_h), vec2<f16>(2_h, 3_h));
|
||||
WrapInFunction(vec3_bool, vec3_i32, vec3_u32, vec3_f32, vec3_f16);
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -2028,16 +2028,16 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec3ElementTypeFromScalarAndV
|
|||
TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromScalars) {
|
||||
Enable(ast::Extension::kF16);
|
||||
|
||||
auto* vec4_bool = Construct(create<ast::Vector>(nullptr, 4), Expr(true), Expr(false),
|
||||
auto* vec4_bool = Construct(create<ast::Vector>(nullptr, 4u), Expr(true), Expr(false),
|
||||
Expr(true), Expr(false));
|
||||
auto* vec4_i32 =
|
||||
Construct(create<ast::Vector>(nullptr, 4), Expr(1_i), Expr(2_i), Expr(3_i), Expr(4_i));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), Expr(1_i), Expr(2_i), Expr(3_i), Expr(4_i));
|
||||
auto* vec4_u32 =
|
||||
Construct(create<ast::Vector>(nullptr, 4), Expr(1_u), Expr(2_u), Expr(3_u), Expr(4_u));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), Expr(1_u), Expr(2_u), Expr(3_u), Expr(4_u));
|
||||
auto* vec4_f32 =
|
||||
Construct(create<ast::Vector>(nullptr, 4), Expr(1_f), Expr(2_f), Expr(3_f), Expr(4_f));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), Expr(1_f), Expr(2_f), Expr(3_f), Expr(4_f));
|
||||
auto* vec4_f16 =
|
||||
Construct(create<ast::Vector>(nullptr, 4), Expr(1_h), Expr(2_h), Expr(3_h), Expr(4_h));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), Expr(1_h), Expr(2_h), Expr(3_h), Expr(4_h));
|
||||
WrapInFunction(vec4_bool, vec4_i32, vec4_u32, vec4_f32, vec4_f16);
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -2068,11 +2068,11 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromVec4) {
|
|||
Enable(ast::Extension::kF16);
|
||||
|
||||
auto* vec4_bool =
|
||||
Construct(create<ast::Vector>(nullptr, 4), vec4<bool>(true, false, true, false));
|
||||
auto* vec4_i32 = Construct(create<ast::Vector>(nullptr, 4), vec4<i32>(1_i, 2_i, 3_i, 4_i));
|
||||
auto* vec4_u32 = Construct(create<ast::Vector>(nullptr, 4), vec4<u32>(1_u, 2_u, 3_u, 4_u));
|
||||
auto* vec4_f32 = Construct(create<ast::Vector>(nullptr, 4), vec4<f32>(1_f, 2_f, 3_f, 4_f));
|
||||
auto* vec4_f16 = Construct(create<ast::Vector>(nullptr, 4), vec4<f16>(1_h, 2_h, 3_h, 4_h));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), vec4<bool>(true, false, true, false));
|
||||
auto* vec4_i32 = Construct(create<ast::Vector>(nullptr, 4u), vec4<i32>(1_i, 2_i, 3_i, 4_i));
|
||||
auto* vec4_u32 = Construct(create<ast::Vector>(nullptr, 4u), vec4<u32>(1_u, 2_u, 3_u, 4_u));
|
||||
auto* vec4_f32 = Construct(create<ast::Vector>(nullptr, 4u), vec4<f32>(1_f, 2_f, 3_f, 4_f));
|
||||
auto* vec4_f16 = Construct(create<ast::Vector>(nullptr, 4u), vec4<f16>(1_h, 2_h, 3_h, 4_h));
|
||||
WrapInFunction(vec4_bool, vec4_i32, vec4_u32, vec4_f32, vec4_f16);
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -2103,15 +2103,15 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromScalarAndV
|
|||
Enable(ast::Extension::kF16);
|
||||
|
||||
auto* vec4_bool =
|
||||
Construct(create<ast::Vector>(nullptr, 4), Expr(true), vec3<bool>(false, true, false));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), Expr(true), vec3<bool>(false, true, false));
|
||||
auto* vec4_i32 =
|
||||
Construct(create<ast::Vector>(nullptr, 4), Expr(1_i), vec3<i32>(2_i, 3_i, 4_i));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), Expr(1_i), vec3<i32>(2_i, 3_i, 4_i));
|
||||
auto* vec4_u32 =
|
||||
Construct(create<ast::Vector>(nullptr, 4), Expr(1_u), vec3<u32>(2_u, 3_u, 4_u));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), Expr(1_u), vec3<u32>(2_u, 3_u, 4_u));
|
||||
auto* vec4_f32 =
|
||||
Construct(create<ast::Vector>(nullptr, 4), Expr(1_f), vec3<f32>(2_f, 3_f, 4_f));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), Expr(1_f), vec3<f32>(2_f, 3_f, 4_f));
|
||||
auto* vec4_f16 =
|
||||
Construct(create<ast::Vector>(nullptr, 4), Expr(1_h), vec3<f16>(2_h, 3_h, 4_h));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), Expr(1_h), vec3<f16>(2_h, 3_h, 4_h));
|
||||
WrapInFunction(vec4_bool, vec4_i32, vec4_u32, vec4_f32, vec4_f16);
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -2141,16 +2141,16 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromScalarAndV
|
|||
TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromVec2AndVec2) {
|
||||
Enable(ast::Extension::kF16);
|
||||
|
||||
auto* vec4_bool = Construct(create<ast::Vector>(nullptr, 4), vec2<bool>(true, false),
|
||||
auto* vec4_bool = Construct(create<ast::Vector>(nullptr, 4u), vec2<bool>(true, false),
|
||||
vec2<bool>(true, false));
|
||||
auto* vec4_i32 =
|
||||
Construct(create<ast::Vector>(nullptr, 4), vec2<i32>(1_i, 2_i), vec2<i32>(3_i, 4_i));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), vec2<i32>(1_i, 2_i), vec2<i32>(3_i, 4_i));
|
||||
auto* vec4_u32 =
|
||||
Construct(create<ast::Vector>(nullptr, 4), vec2<u32>(1_u, 2_u), vec2<u32>(3_u, 4_u));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), vec2<u32>(1_u, 2_u), vec2<u32>(3_u, 4_u));
|
||||
auto* vec4_f32 =
|
||||
Construct(create<ast::Vector>(nullptr, 4), vec2<f32>(1_f, 2_f), vec2<f32>(3_f, 4_f));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), vec2<f32>(1_f, 2_f), vec2<f32>(3_f, 4_f));
|
||||
auto* vec4_f16 =
|
||||
Construct(create<ast::Vector>(nullptr, 4), vec2<f16>(1_h, 2_h), vec2<f16>(3_h, 4_h));
|
||||
Construct(create<ast::Vector>(nullptr, 4u), vec2<f16>(1_h, 2_h), vec2<f16>(3_h, 4_h));
|
||||
WrapInFunction(vec4_bool, vec4_i32, vec4_u32, vec4_f32, vec4_f16);
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -2178,14 +2178,14 @@ TEST_F(ResolverTypeConstructorValidationTest, InferVec4ElementTypeFromVec2AndVec
|
|||
}
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest, CannotInferVectorElementTypeWithoutArgs) {
|
||||
WrapInFunction(Construct(Source{{12, 34}}, create<ast::Vector>(nullptr, 3)));
|
||||
WrapInFunction(Construct(Source{{12, 34}}, create<ast::Vector>(nullptr, 3u)));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_THAT(r()->error(), HasSubstr("12:34 error: no matching constructor for vec3()"));
|
||||
}
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec2ElementTypeFromScalarsMismatch) {
|
||||
WrapInFunction(Construct(Source{{1, 1}}, create<ast::Vector>(nullptr, 2),
|
||||
WrapInFunction(Construct(Source{{1, 1}}, create<ast::Vector>(nullptr, 2u),
|
||||
Expr(Source{{1, 2}}, 1_i), //
|
||||
Expr(Source{{1, 3}}, 2_u)));
|
||||
|
||||
|
@ -2194,7 +2194,7 @@ TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec2ElementTypeFromScal
|
|||
}
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec3ElementTypeFromScalarsMismatch) {
|
||||
WrapInFunction(Construct(Source{{1, 1}}, create<ast::Vector>(nullptr, 3),
|
||||
WrapInFunction(Construct(Source{{1, 1}}, create<ast::Vector>(nullptr, 3u),
|
||||
Expr(Source{{1, 2}}, 1_i), //
|
||||
Expr(Source{{1, 3}}, 2_u), //
|
||||
Expr(Source{{1, 4}}, 3_i)));
|
||||
|
@ -2205,7 +2205,7 @@ TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec3ElementTypeFromScal
|
|||
}
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec3ElementTypeFromScalarAndVec2Mismatch) {
|
||||
WrapInFunction(Construct(Source{{1, 1}}, create<ast::Vector>(nullptr, 3),
|
||||
WrapInFunction(Construct(Source{{1, 1}}, create<ast::Vector>(nullptr, 3u),
|
||||
Expr(Source{{1, 2}}, 1_i), //
|
||||
Construct(Source{{1, 3}}, ty.vec2<f32>(), 2_f, 3_f)));
|
||||
|
||||
|
@ -2215,7 +2215,7 @@ TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec3ElementTypeFromScal
|
|||
}
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec4ElementTypeFromScalarsMismatch) {
|
||||
WrapInFunction(Construct(Source{{1, 1}}, create<ast::Vector>(nullptr, 4),
|
||||
WrapInFunction(Construct(Source{{1, 1}}, create<ast::Vector>(nullptr, 4u),
|
||||
Expr(Source{{1, 2}}, 1_i), //
|
||||
Expr(Source{{1, 3}}, 2_i), //
|
||||
Expr(Source{{1, 4}}, 3_f), //
|
||||
|
@ -2227,7 +2227,7 @@ TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec4ElementTypeFromScal
|
|||
}
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec4ElementTypeFromScalarAndVec3Mismatch) {
|
||||
WrapInFunction(Construct(Source{{1, 1}}, create<ast::Vector>(nullptr, 4),
|
||||
WrapInFunction(Construct(Source{{1, 1}}, create<ast::Vector>(nullptr, 4u),
|
||||
Expr(Source{{1, 2}}, 1_i), //
|
||||
Construct(Source{{1, 3}}, ty.vec3<u32>(), 2_u, 3_u, 4_u)));
|
||||
|
||||
|
@ -2237,7 +2237,7 @@ TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec4ElementTypeFromScal
|
|||
}
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest, CannotInferVec4ElementTypeFromVec2AndVec2Mismatch) {
|
||||
WrapInFunction(Construct(Source{{1, 1}}, create<ast::Vector>(nullptr, 4),
|
||||
WrapInFunction(Construct(Source{{1, 1}}, create<ast::Vector>(nullptr, 4u),
|
||||
Construct(Source{{1, 2}}, ty.vec2<i32>(), 3_i, 4_i), //
|
||||
Construct(Source{{1, 3}}, ty.vec2<u32>(), 3_u, 4_u)));
|
||||
|
||||
|
|
|
@ -402,7 +402,7 @@ TEST_F(ResolverTypeValidationTest, Struct_Member_VectorNoType) {
|
|||
// a: vec3;
|
||||
// };
|
||||
|
||||
Structure("S", {Member("a", create<ast::Vector>(Source{{12, 34}}, nullptr, 3))});
|
||||
Structure("S", {Member("a", create<ast::Vector>(Source{{12, 34}}, nullptr, 3u))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "12:34 error: missing vector element type");
|
||||
|
@ -412,7 +412,7 @@ TEST_F(ResolverTypeValidationTest, Struct_Member_MatrixNoType) {
|
|||
// struct S {
|
||||
// a: mat3x3;
|
||||
// };
|
||||
Structure("S", {Member("a", create<ast::Matrix>(Source{{12, 34}}, nullptr, 3, 3))});
|
||||
Structure("S", {Member("a", create<ast::Matrix>(Source{{12, 34}}, nullptr, 3u, 3u))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "12:34 error: missing matrix element type");
|
||||
|
|
|
@ -326,8 +326,8 @@ TEST_F(ResolverValidationTest, StorageClass_SamplerExplicitStorageClass) {
|
|||
auto* t = ty.sampler(ast::SamplerKind::kSampler);
|
||||
GlobalVar(Source{{12, 34}}, "var", t, ast::StorageClass::kHandle,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
@ -340,8 +340,8 @@ TEST_F(ResolverValidationTest, StorageClass_TextureExplicitStorageClass) {
|
|||
auto* t = ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
|
||||
GlobalVar(Source{{12, 34}}, "var", t, ast::StorageClass::kHandle,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve()) << r()->error();
|
||||
|
|
|
@ -1609,7 +1609,7 @@ bool Validator::TextureBuiltinFunction(const sem::Call* call) const {
|
|||
return true;
|
||||
}
|
||||
std::string name = sem::str(usage);
|
||||
auto* arg = call->Arguments()[index];
|
||||
auto* arg = call->Arguments()[static_cast<size_t>(index)];
|
||||
if (auto values = arg->ConstantValue()) {
|
||||
// Assert that the constant values are of the expected type.
|
||||
if (!values.Type()->IsAnyOf<sem::I32, sem::Vector>() ||
|
||||
|
@ -1631,7 +1631,8 @@ bool Validator::TextureBuiltinFunction(const sem::Call* call) const {
|
|||
return ast::TraverseAction::Stop;
|
||||
});
|
||||
if (is_const_expr) {
|
||||
auto vector = builtin->Parameters()[index]->Type()->Is<sem::Vector>();
|
||||
auto vector =
|
||||
builtin->Parameters()[static_cast<size_t>(index)]->Type()->Is<sem::Vector>();
|
||||
for (size_t i = 0, n = values.ElementCount(); i < n; i++) {
|
||||
auto value = values.Element<AInt>(i).value;
|
||||
if (value < min || value > max) {
|
||||
|
|
|
@ -472,8 +472,8 @@ TEST_F(ResolverVariableTest, LocalLet_InheritsAccessFromOriginatingVariable) {
|
|||
auto* buf = Structure("S", {Member("inner", ty.Of(inner))});
|
||||
auto* storage = GlobalVar("s", ty.Of(buf), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
auto* expr = IndexAccessor(MemberAccessor(MemberAccessor(storage, "inner"), "arr"), 4_i);
|
||||
|
@ -1049,18 +1049,18 @@ TEST_F(ResolverVariableTest, GlobalVar_StorageClass) {
|
|||
auto* workgroup = GlobalVar("w", ty.i32(), ast::StorageClass::kWorkgroup);
|
||||
auto* uniform = GlobalVar("ub", ty.Of(buf), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
auto* storage = GlobalVar("sb", ty.Of(buf), ast::StorageClass::kStorage,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
auto* handle = GlobalVar("h", ty.depth_texture(ast::TextureDimension::k2d),
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(2),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(2u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -1085,8 +1085,8 @@ TEST_F(ResolverVariableTest, GlobalVar_ExplicitStorageClass) {
|
|||
auto* storage =
|
||||
GlobalVar("sb", ty.Of(buf), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
ASSERT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
|
|
@ -245,8 +245,8 @@ TEST_F(ResolverVariableValidationTest, InferredPtrStorageAccessMismatch) {
|
|||
auto* buf = Structure("S", {Member("inner", ty.Of(inner))});
|
||||
auto* storage = GlobalVar("s", ty.Of(buf), ast::StorageClass::kStorage,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
auto* expr = IndexAccessor(MemberAccessor(MemberAccessor(storage, "inner"), "arr"), 2_i);
|
||||
|
@ -318,7 +318,7 @@ TEST_F(ResolverVariableValidationTest, InvalidStorageClassForInitializer) {
|
|||
|
||||
TEST_F(ResolverVariableValidationTest, VectorConstNoType) {
|
||||
// const a : mat3x3 = mat3x3<f32>();
|
||||
WrapInFunction(Const("a", create<ast::Vector>(Source{{12, 34}}, nullptr, 3), vec3<f32>()));
|
||||
WrapInFunction(Const("a", create<ast::Vector>(Source{{12, 34}}, nullptr, 3u), vec3<f32>()));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "12:34 error: missing vector element type");
|
||||
|
@ -326,7 +326,7 @@ TEST_F(ResolverVariableValidationTest, VectorConstNoType) {
|
|||
|
||||
TEST_F(ResolverVariableValidationTest, VectorLetNoType) {
|
||||
// let a : mat3x3 = mat3x3<f32>();
|
||||
WrapInFunction(Let("a", create<ast::Vector>(Source{{12, 34}}, nullptr, 3), vec3<f32>()));
|
||||
WrapInFunction(Let("a", create<ast::Vector>(Source{{12, 34}}, nullptr, 3u), vec3<f32>()));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "12:34 error: missing vector element type");
|
||||
|
@ -334,7 +334,7 @@ TEST_F(ResolverVariableValidationTest, VectorLetNoType) {
|
|||
|
||||
TEST_F(ResolverVariableValidationTest, VectorVarNoType) {
|
||||
// var a : mat3x3;
|
||||
WrapInFunction(Var("a", create<ast::Vector>(Source{{12, 34}}, nullptr, 3)));
|
||||
WrapInFunction(Var("a", create<ast::Vector>(Source{{12, 34}}, nullptr, 3u)));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "12:34 error: missing vector element type");
|
||||
|
@ -342,7 +342,8 @@ TEST_F(ResolverVariableValidationTest, VectorVarNoType) {
|
|||
|
||||
TEST_F(ResolverVariableValidationTest, MatrixConstNoType) {
|
||||
// const a : mat3x3 = mat3x3<f32>();
|
||||
WrapInFunction(Const("a", create<ast::Matrix>(Source{{12, 34}}, nullptr, 3, 3), mat3x3<f32>()));
|
||||
WrapInFunction(
|
||||
Const("a", create<ast::Matrix>(Source{{12, 34}}, nullptr, 3u, 3u), mat3x3<f32>()));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "12:34 error: missing matrix element type");
|
||||
|
@ -350,7 +351,7 @@ TEST_F(ResolverVariableValidationTest, MatrixConstNoType) {
|
|||
|
||||
TEST_F(ResolverVariableValidationTest, MatrixLetNoType) {
|
||||
// let a : mat3x3 = mat3x3<f32>();
|
||||
WrapInFunction(Let("a", create<ast::Matrix>(Source{{12, 34}}, nullptr, 3, 3), mat3x3<f32>()));
|
||||
WrapInFunction(Let("a", create<ast::Matrix>(Source{{12, 34}}, nullptr, 3u, 3u), mat3x3<f32>()));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "12:34 error: missing matrix element type");
|
||||
|
@ -358,7 +359,7 @@ TEST_F(ResolverVariableValidationTest, MatrixLetNoType) {
|
|||
|
||||
TEST_F(ResolverVariableValidationTest, MatrixVarNoType) {
|
||||
// var a : mat3x3;
|
||||
WrapInFunction(Var("a", create<ast::Matrix>(Source{{12, 34}}, nullptr, 3, 3)));
|
||||
WrapInFunction(Var("a", create<ast::Matrix>(Source{{12, 34}}, nullptr, 3u, 3u)));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "12:34 error: missing matrix element type");
|
||||
|
|
|
@ -91,4 +91,6 @@ VariableUser::VariableUser(const ast::IdentifierExpression* declaration,
|
|||
}
|
||||
}
|
||||
|
||||
VariableUser::~VariableUser() = default;
|
||||
|
||||
} // namespace tint::sem
|
||||
|
|
|
@ -226,6 +226,7 @@ class VariableUser final : public Castable<VariableUser, Expression> {
|
|||
VariableUser(const ast::IdentifierExpression* declaration,
|
||||
Statement* statement,
|
||||
sem::Variable* variable);
|
||||
~VariableUser() override;
|
||||
|
||||
/// @returns the variable that this expression refers to
|
||||
const sem::Variable* Variable() const { return variable_; }
|
||||
|
|
|
@ -225,19 +225,21 @@ struct CombineSamplers::State {
|
|||
// Replace all texture builtin calls.
|
||||
if (auto* builtin = call->Target()->As<sem::Builtin>()) {
|
||||
const auto& signature = builtin->Signature();
|
||||
int sampler_index = signature.IndexOf(sem::ParameterUsage::kSampler);
|
||||
int texture_index = signature.IndexOf(sem::ParameterUsage::kTexture);
|
||||
auto sampler_index = signature.IndexOf(sem::ParameterUsage::kSampler);
|
||||
auto texture_index = signature.IndexOf(sem::ParameterUsage::kTexture);
|
||||
if (texture_index == -1) {
|
||||
return nullptr;
|
||||
}
|
||||
const sem::Expression* texture = call->Arguments()[texture_index];
|
||||
const sem::Expression* texture =
|
||||
call->Arguments()[static_cast<size_t>(texture_index)];
|
||||
// We don't want to combine storage textures with anything, since
|
||||
// they never have associated samplers in GLSL.
|
||||
if (texture->Type()->UnwrapRef()->Is<sem::StorageTexture>()) {
|
||||
return nullptr;
|
||||
}
|
||||
const sem::Expression* sampler =
|
||||
sampler_index != -1 ? call->Arguments()[sampler_index] : nullptr;
|
||||
sampler_index != -1 ? call->Arguments()[static_cast<size_t>(sampler_index)]
|
||||
: nullptr;
|
||||
auto* texture_var = texture->As<sem::VariableUser>()->Variable();
|
||||
auto* sampler_var =
|
||||
sampler ? sampler->As<sem::VariableUser>()->Variable() : nullptr;
|
||||
|
|
|
@ -377,10 +377,10 @@ struct DecomposeMemoryAccess::State {
|
|||
auto* lhs_lit = tint::As<OffsetLiteral>(lhs);
|
||||
auto* rhs_lit = tint::As<OffsetLiteral>(rhs);
|
||||
if (lhs_lit && lhs_lit->literal == 0) {
|
||||
return offsets_.Create<OffsetLiteral>(0);
|
||||
return offsets_.Create<OffsetLiteral>(0u);
|
||||
}
|
||||
if (rhs_lit && rhs_lit->literal == 0) {
|
||||
return offsets_.Create<OffsetLiteral>(0);
|
||||
return offsets_.Create<OffsetLiteral>(0u);
|
||||
}
|
||||
if (lhs_lit && lhs_lit->literal == 1) {
|
||||
return rhs;
|
||||
|
@ -831,7 +831,7 @@ void DecomposeMemoryAccess::Run(CloneContext& ctx, const DataMap&, DataMap&) con
|
|||
if (swizzle->Indices().size() == 1) {
|
||||
if (auto access = state.TakeAccess(accessor->structure)) {
|
||||
auto* vec_ty = access.type->As<sem::Vector>();
|
||||
auto* offset = state.Mul(vec_ty->type()->Size(), swizzle->Indices()[0]);
|
||||
auto* offset = state.Mul(vec_ty->type()->Size(), swizzle->Indices()[0u]);
|
||||
state.AddAccess(accessor, {
|
||||
access.var,
|
||||
state.Add(access.offset, offset),
|
||||
|
|
|
@ -71,8 +71,8 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix) {
|
|||
"S", {
|
||||
b.Member("m", b.ty.mat2x2<f32>(),
|
||||
{
|
||||
b.create<ast::StructMemberOffsetAttribute>(16),
|
||||
b.create<ast::StrideAttribute>(32),
|
||||
b.create<ast::StructMemberOffsetAttribute>(16u),
|
||||
b.create<ast::StrideAttribute>(32u),
|
||||
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
|
||||
}),
|
||||
});
|
||||
|
@ -127,8 +127,8 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformColumn) {
|
|||
"S", {
|
||||
b.Member("m", b.ty.mat2x2<f32>(),
|
||||
{
|
||||
b.create<ast::StructMemberOffsetAttribute>(16),
|
||||
b.create<ast::StrideAttribute>(32),
|
||||
b.create<ast::StructMemberOffsetAttribute>(16u),
|
||||
b.create<ast::StrideAttribute>(32u),
|
||||
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
|
||||
}),
|
||||
});
|
||||
|
@ -180,8 +180,8 @@ TEST_F(DecomposeStridedMatrixTest, ReadUniformMatrix_DefaultStride) {
|
|||
"S", {
|
||||
b.Member("m", b.ty.mat2x2<f32>(),
|
||||
{
|
||||
b.create<ast::StructMemberOffsetAttribute>(16),
|
||||
b.create<ast::StrideAttribute>(8),
|
||||
b.create<ast::StructMemberOffsetAttribute>(16u),
|
||||
b.create<ast::StrideAttribute>(8u),
|
||||
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
|
||||
}),
|
||||
});
|
||||
|
@ -233,8 +233,8 @@ TEST_F(DecomposeStridedMatrixTest, ReadStorageMatrix) {
|
|||
"S", {
|
||||
b.Member("m", b.ty.mat2x2<f32>(),
|
||||
{
|
||||
b.create<ast::StructMemberOffsetAttribute>(8),
|
||||
b.create<ast::StrideAttribute>(32),
|
||||
b.create<ast::StructMemberOffsetAttribute>(8u),
|
||||
b.create<ast::StrideAttribute>(32u),
|
||||
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
|
||||
}),
|
||||
});
|
||||
|
@ -290,8 +290,8 @@ TEST_F(DecomposeStridedMatrixTest, ReadStorageColumn) {
|
|||
"S", {
|
||||
b.Member("m", b.ty.mat2x2<f32>(),
|
||||
{
|
||||
b.create<ast::StructMemberOffsetAttribute>(16),
|
||||
b.create<ast::StrideAttribute>(32),
|
||||
b.create<ast::StructMemberOffsetAttribute>(16u),
|
||||
b.create<ast::StrideAttribute>(32u),
|
||||
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
|
||||
}),
|
||||
});
|
||||
|
@ -344,8 +344,8 @@ TEST_F(DecomposeStridedMatrixTest, WriteStorageMatrix) {
|
|||
"S", {
|
||||
b.Member("m", b.ty.mat2x2<f32>(),
|
||||
{
|
||||
b.create<ast::StructMemberOffsetAttribute>(8),
|
||||
b.create<ast::StrideAttribute>(32),
|
||||
b.create<ast::StructMemberOffsetAttribute>(8u),
|
||||
b.create<ast::StrideAttribute>(32u),
|
||||
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
|
||||
}),
|
||||
});
|
||||
|
@ -402,8 +402,8 @@ TEST_F(DecomposeStridedMatrixTest, WriteStorageColumn) {
|
|||
"S", {
|
||||
b.Member("m", b.ty.mat2x2<f32>(),
|
||||
{
|
||||
b.create<ast::StructMemberOffsetAttribute>(8),
|
||||
b.create<ast::StrideAttribute>(32),
|
||||
b.create<ast::StructMemberOffsetAttribute>(8u),
|
||||
b.create<ast::StrideAttribute>(32u),
|
||||
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
|
||||
}),
|
||||
});
|
||||
|
@ -461,8 +461,8 @@ TEST_F(DecomposeStridedMatrixTest, ReadWriteViaPointerLets) {
|
|||
"S", {
|
||||
b.Member("m", b.ty.mat2x2<f32>(),
|
||||
{
|
||||
b.create<ast::StructMemberOffsetAttribute>(8),
|
||||
b.create<ast::StrideAttribute>(32),
|
||||
b.create<ast::StructMemberOffsetAttribute>(8u),
|
||||
b.create<ast::StrideAttribute>(32u),
|
||||
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
|
||||
}),
|
||||
});
|
||||
|
@ -532,8 +532,8 @@ TEST_F(DecomposeStridedMatrixTest, ReadPrivateMatrix) {
|
|||
"S", {
|
||||
b.Member("m", b.ty.mat2x2<f32>(),
|
||||
{
|
||||
b.create<ast::StructMemberOffsetAttribute>(8),
|
||||
b.create<ast::StrideAttribute>(32),
|
||||
b.create<ast::StructMemberOffsetAttribute>(8u),
|
||||
b.create<ast::StrideAttribute>(32u),
|
||||
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
|
||||
}),
|
||||
});
|
||||
|
@ -585,8 +585,8 @@ TEST_F(DecomposeStridedMatrixTest, WritePrivateMatrix) {
|
|||
"S", {
|
||||
b.Member("m", b.ty.mat2x2<f32>(),
|
||||
{
|
||||
b.create<ast::StructMemberOffsetAttribute>(8),
|
||||
b.create<ast::StrideAttribute>(32),
|
||||
b.create<ast::StructMemberOffsetAttribute>(8u),
|
||||
b.create<ast::StrideAttribute>(32u),
|
||||
b.Disable(ast::DisabledValidation::kIgnoreStrideAttribute),
|
||||
}),
|
||||
});
|
||||
|
|
|
@ -223,9 +223,9 @@ struct Robustness::State {
|
|||
auto array_idx = signature.IndexOf(sem::ParameterUsage::kArrayIndex);
|
||||
auto level_idx = signature.IndexOf(sem::ParameterUsage::kLevel);
|
||||
|
||||
auto* texture_arg = expr->args[texture_idx];
|
||||
auto* coords_arg = expr->args[coords_idx];
|
||||
auto* coords_ty = builtin->Parameters()[coords_idx]->Type();
|
||||
auto* texture_arg = expr->args[static_cast<size_t>(texture_idx)];
|
||||
auto* coords_arg = expr->args[static_cast<size_t>(coords_idx)];
|
||||
auto* coords_ty = builtin->Parameters()[static_cast<size_t>(coords_idx)]->Type();
|
||||
|
||||
// If the level is provided, then we need to clamp this. As the level is
|
||||
// used by textureDimensions() and the texture[Load|Store]() calls, we need
|
||||
|
@ -235,7 +235,7 @@ struct Robustness::State {
|
|||
std::function<const ast::Expression*()> level_arg;
|
||||
if (level_idx >= 0) {
|
||||
level_arg = [&] {
|
||||
auto* arg = expr->args[level_idx];
|
||||
auto* arg = expr->args[static_cast<size_t>(level_idx)];
|
||||
auto* num_levels = b.Call("textureNumLevels", ctx.Clone(texture_arg));
|
||||
auto* zero = b.Expr(0_i);
|
||||
auto* max = ctx.dst->Sub(num_levels, 1_i);
|
||||
|
@ -258,7 +258,7 @@ struct Robustness::State {
|
|||
|
||||
// Clamp the array_index argument, if provided
|
||||
if (array_idx >= 0) {
|
||||
auto* arg = expr->args[array_idx];
|
||||
auto* arg = expr->args[static_cast<size_t>(array_idx)];
|
||||
auto* num_layers = b.Call("textureNumLayers", ctx.Clone(texture_arg));
|
||||
auto* zero = b.Expr(0_i);
|
||||
auto* max = ctx.dst->Sub(num_layers, 1_i);
|
||||
|
@ -268,7 +268,7 @@ struct Robustness::State {
|
|||
|
||||
// Clamp the level argument, if provided
|
||||
if (level_idx >= 0) {
|
||||
auto* arg = expr->args[level_idx];
|
||||
auto* arg = expr->args[static_cast<size_t>(level_idx)];
|
||||
ctx.Replace(arg, level_arg ? level_arg() : ctx.dst->Expr(0_i));
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ TEST_F(BlockAllocatorTest, ObjectLifetime) {
|
|||
TEST_F(BlockAllocatorTest, MoveConstruct) {
|
||||
using Allocator = BlockAllocator<LifetimeCounter>;
|
||||
|
||||
for (size_t n : {0, 1, 10, 16, 20, 32, 50, 64, 100, 256, 300, 512, 500, 512}) {
|
||||
for (size_t n : {0u, 1u, 10u, 16u, 20u, 32u, 50u, 64u, 100u, 256u, 300u, 512u, 500u, 512u}) {
|
||||
size_t count = 0;
|
||||
{
|
||||
Allocator allocator_a;
|
||||
|
@ -87,7 +87,7 @@ TEST_F(BlockAllocatorTest, MoveConstruct) {
|
|||
TEST_F(BlockAllocatorTest, MoveAssign) {
|
||||
using Allocator = BlockAllocator<LifetimeCounter>;
|
||||
|
||||
for (size_t n : {0, 1, 10, 16, 20, 32, 50, 64, 100, 256, 300, 512, 500, 512}) {
|
||||
for (size_t n : {0u, 1u, 10u, 16u, 20u, 32u, 50u, 64u, 100u, 256u, 300u, 512u, 500u, 512u}) {
|
||||
size_t count_a = 0;
|
||||
size_t count_b = 0;
|
||||
|
||||
|
|
|
@ -25,7 +25,11 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define TINT_DISABLE_WARNING_CONSTANT_OVERFLOW __pragma(warning(disable : 4756))
|
||||
#define TINT_DISABLE_WARNING_MAYBE_UNINITIALIZED /* currently no-op */
|
||||
#define TINT_DISABLE_WARNING_NEWLINE_EOF /* currently no-op */
|
||||
#define TINT_DISABLE_WARNING_OLD_STYLE_CAST /* currently no-op */
|
||||
#define TINT_DISABLE_WARNING_SIGN_CONVERSION /* currently no-op */
|
||||
#define TINT_DISABLE_WARNING_UNREACHABLE_CODE __pragma(warning(disable : 4702))
|
||||
#define TINT_DISABLE_WARNING_WEAK_VTABLES /* currently no-op */
|
||||
|
||||
// clang-format off
|
||||
#define TINT_BEGIN_DISABLE_WARNING(name) \
|
||||
|
@ -42,7 +46,12 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define TINT_DISABLE_WARNING_CONSTANT_OVERFLOW /* currently no-op */
|
||||
#define TINT_DISABLE_WARNING_MAYBE_UNINITIALIZED /* currently no-op */
|
||||
#define TINT_DISABLE_WARNING_NEWLINE_EOF _Pragma("clang diagnostic ignored \"-Wnewline-eof\"")
|
||||
#define TINT_DISABLE_WARNING_OLD_STYLE_CAST _Pragma("clang diagnostic ignored \"-Wold-style-cast\"")
|
||||
#define TINT_DISABLE_WARNING_SIGN_CONVERSION \
|
||||
_Pragma("clang diagnostic ignored \"-Wsign-conversion\"")
|
||||
#define TINT_DISABLE_WARNING_UNREACHABLE_CODE /* currently no-op */
|
||||
#define TINT_DISABLE_WARNING_WEAK_VTABLES _Pragma("clang diagnostic ignored \"-Wweak-vtables\"")
|
||||
|
||||
// clang-format off
|
||||
#define TINT_BEGIN_DISABLE_WARNING(name) \
|
||||
|
@ -60,7 +69,11 @@
|
|||
#define TINT_DISABLE_WARNING_CONSTANT_OVERFLOW /* currently no-op */
|
||||
#define TINT_DISABLE_WARNING_MAYBE_UNINITIALIZED \
|
||||
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
||||
#define TINT_DISABLE_WARNING_NEWLINE_EOF /* currently no-op */
|
||||
#define TINT_DISABLE_WARNING_OLD_STYLE_CAST /* currently no-op */
|
||||
#define TINT_DISABLE_WARNING_SIGN_CONVERSION /* currently no-op */
|
||||
#define TINT_DISABLE_WARNING_UNREACHABLE_CODE /* currently no-op */
|
||||
#define TINT_DISABLE_WARNING_WEAK_VTABLES /* currently no-op */
|
||||
|
||||
// clang-format off
|
||||
#define TINT_BEGIN_DISABLE_WARNING(name) \
|
||||
|
|
|
@ -135,7 +135,7 @@ const sem::Call* AppendVector(ProgramBuilder* b,
|
|||
auto* scalar_cast_ast = b->Construct(packed_el_ast_ty, scalar_ast);
|
||||
auto* scalar_cast_target = b->create<sem::TypeConversion>(
|
||||
packed_el_sem_ty,
|
||||
b->create<sem::Parameter>(nullptr, 0, scalar_sem->Type()->UnwrapRef(),
|
||||
b->create<sem::Parameter>(nullptr, 0u, scalar_sem->Type()->UnwrapRef(),
|
||||
ast::StorageClass::kNone, ast::Access::kUndefined));
|
||||
auto* scalar_cast_sem = b->create<sem::Call>(
|
||||
scalar_cast_ast, scalar_cast_target, std::vector<const sem::Expression*>{scalar_sem},
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace {
|
|||
// - 0 sign if sign is 0, 1 otherwise
|
||||
// - 'exponent_bits' is placed in the exponent space.
|
||||
// So, the exponent bias must already be included.
|
||||
float MakeFloat(int sign, int biased_exponent, int mantissa) {
|
||||
float MakeFloat(uint32_t sign, uint32_t biased_exponent, uint32_t mantissa) {
|
||||
const uint32_t sign_bit = sign ? 0x80000000u : 0u;
|
||||
// The binary32 exponent is 8 bits, just below the sign.
|
||||
const uint32_t exponent_bits = (biased_exponent & 0xffu) << 23;
|
||||
|
|
|
@ -1349,8 +1349,8 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
|
|||
|
||||
// Returns the argument with the given usage
|
||||
auto arg = [&](Usage usage) {
|
||||
int idx = signature.IndexOf(usage);
|
||||
return (idx >= 0) ? arguments[idx] : nullptr;
|
||||
auto idx = signature.IndexOf(usage);
|
||||
return (idx >= 0) ? arguments[static_cast<size_t>(idx)] : nullptr;
|
||||
};
|
||||
|
||||
auto* texture = arg(Usage::kTexture);
|
||||
|
@ -2138,7 +2138,7 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) {
|
|||
// Emit the layout(local_size) attributes.
|
||||
auto wgsize = func_sem->WorkgroupSize();
|
||||
out << "layout(";
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (size_t i = 0; i < 3; i++) {
|
||||
if (i > 0) {
|
||||
out << ", ";
|
||||
}
|
||||
|
|
|
@ -351,8 +351,8 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_Uniform) {
|
|||
auto* ubo_ty = Structure("UBO", {Member("coord", ty.vec4<f32>())});
|
||||
auto* ubo = GlobalVar("ubo", ty.Of(ubo_ty), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
Func("sub_func",
|
||||
|
@ -405,8 +405,8 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_UniformStr
|
|||
|
||||
GlobalVar("uniforms", ty.Of(s), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
auto* var = Var("v", ty.f32(), ast::StorageClass::kNone,
|
||||
|
@ -450,8 +450,8 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RW_Storage
|
|||
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("coord", "b"));
|
||||
|
@ -500,8 +500,8 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RO_Storage
|
|||
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("coord", "b"));
|
||||
|
@ -551,8 +551,8 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_WO_Storage
|
|||
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
Func("frag_main", {}, ty.void_(),
|
||||
|
@ -599,8 +599,8 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_StorageBuf
|
|||
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
Func("frag_main", {}, ty.void_(),
|
||||
|
@ -643,8 +643,8 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_
|
|||
auto* s = Structure("S", {Member("x", ty.f32())});
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
Func("sub_func", {Param("param", ty.f32())}, ty.f32(),
|
||||
|
@ -692,8 +692,8 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_
|
|||
auto* s = Structure("S", {Member("x", ty.f32())});
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
Func("sub_func", {Param("param", ty.f32())}, ty.f32(),
|
||||
|
@ -921,8 +921,8 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Multiple_EntryPoint_With_Same_Module
|
|||
|
||||
GlobalVar("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
{
|
||||
|
|
|
@ -93,8 +93,8 @@ class GlslGeneratorImplTest_MemberAccessorBase : public BASE {
|
|||
|
||||
b.GlobalVar("data", b.ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
b.create<ast::BindingAttribute>(0),
|
||||
b.create<ast::GroupAttribute>(1),
|
||||
b.create<ast::BindingAttribute>(0u),
|
||||
b.create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ TEST_F(GlslSanitizerTest, Call_ArrayLength) {
|
|||
auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
@ -71,8 +71,8 @@ TEST_F(GlslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) {
|
|||
});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
@ -113,8 +113,8 @@ TEST_F(GlslSanitizerTest, Call_ArrayLength_ViaLets) {
|
|||
auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
auto* p = Let("p", nullptr, AddressOf("b"));
|
||||
|
|
|
@ -37,8 +37,8 @@ void TestAlign(ProgramBuilder* ctx) {
|
|||
});
|
||||
ctx->GlobalVar("nephews", ctx->ty.Of(nephews), ast::StorageClass::kStorage,
|
||||
ast::AttributeList{
|
||||
ctx->create<ast::BindingAttribute>(0),
|
||||
ctx->create<ast::GroupAttribute>(0),
|
||||
ctx->create<ast::BindingAttribute>(0u),
|
||||
ctx->create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -272,8 +272,8 @@ TEST_P(GlslDepthTexturesTest, Emit) {
|
|||
|
||||
GlobalVar("tex", t,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))},
|
||||
|
@ -299,8 +299,8 @@ TEST_F(GlslDepthMultisampledTexturesTest, Emit) {
|
|||
|
||||
GlobalVar("tex", t,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))},
|
||||
|
@ -342,8 +342,8 @@ TEST_P(GlslSampledTexturesTest, Emit) {
|
|||
|
||||
GlobalVar("tex", t,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))},
|
||||
|
@ -476,8 +476,8 @@ TEST_P(GlslStorageTexturesTest, Emit) {
|
|||
|
||||
GlobalVar("tex", t,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))},
|
||||
|
|
|
@ -2107,7 +2107,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
|
|||
// Returns the argument with the given usage
|
||||
auto arg = [&](Usage usage) {
|
||||
int idx = signature.IndexOf(usage);
|
||||
return (idx >= 0) ? arguments[idx] : nullptr;
|
||||
return (idx >= 0) ? arguments[static_cast<size_t>(idx)] : nullptr;
|
||||
};
|
||||
|
||||
auto* texture = arg(Usage::kTexture);
|
||||
|
@ -3039,7 +3039,7 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) {
|
|||
// Emit the workgroup_size attribute.
|
||||
auto wgsize = func_sem->WorkgroupSize();
|
||||
out << "[numthreads(";
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (size_t i = 0; i < 3; i++) {
|
||||
if (i > 0) {
|
||||
out << ", ";
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case_Default) {
|
|||
|
||||
gen.increment_indent();
|
||||
|
||||
ASSERT_TRUE(gen.EmitCase(s, 0_i)) << gen.error();
|
||||
ASSERT_TRUE(gen.EmitCase(s, 0u)) << gen.error();
|
||||
EXPECT_EQ(gen.result(), R"( default: {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -348,8 +348,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_Uniform) {
|
|||
auto* ubo_ty = Structure("UBO", {Member("coord", ty.vec4<f32>())});
|
||||
auto* ubo = GlobalVar("ubo", ty.Of(ubo_ty), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
Func("sub_func",
|
||||
|
@ -395,8 +395,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_UniformStr
|
|||
|
||||
GlobalVar("uniforms", ty.Of(s), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
auto* var = Var("v", ty.f32(), ast::StorageClass::kNone,
|
||||
|
@ -433,8 +433,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RW_Storage
|
|||
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("coord", "b"));
|
||||
|
@ -469,8 +469,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RO_Storage
|
|||
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("coord", "b"));
|
||||
|
@ -505,8 +505,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_WO_Storage
|
|||
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
Func("frag_main", {}, ty.void_(),
|
||||
|
@ -539,8 +539,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_StorageBuf
|
|||
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
Func("frag_main", {}, ty.void_(),
|
||||
|
@ -569,8 +569,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_
|
|||
auto* s = Structure("S", {Member("x", ty.f32())});
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
Func("sub_func",
|
||||
|
@ -615,8 +615,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_
|
|||
auto* s = Structure("S", {Member("x", ty.f32())});
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
|
||||
Func("sub_func",
|
||||
|
@ -861,8 +861,8 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Multiple_EntryPoint_With_Same_Module
|
|||
|
||||
GlobalVar("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
{
|
||||
|
|
|
@ -93,8 +93,8 @@ class HlslGeneratorImplTest_MemberAccessorBase : public BASE {
|
|||
|
||||
b.GlobalVar("data", b.ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
b.create<ast::BindingAttribute>(0),
|
||||
b.create<ast::GroupAttribute>(1),
|
||||
b.create<ast::BindingAttribute>(0u),
|
||||
b.create<ast::GroupAttribute>(1u),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ TEST_F(HlslSanitizerTest, Call_ArrayLength) {
|
|||
auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
@ -66,8 +66,8 @@ TEST_F(HlslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) {
|
|||
});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
@ -102,8 +102,8 @@ TEST_F(HlslSanitizerTest, Call_ArrayLength_ViaLets) {
|
|||
auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
auto* p = Let("p", nullptr, AddressOf("b"));
|
||||
|
@ -142,13 +142,13 @@ TEST_F(HlslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniform) {
|
|||
auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
GlobalVar("c", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(2),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(2u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
|
|
@ -155,8 +155,8 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl_OmittedIfStorageBuffer) {
|
|||
});
|
||||
GlobalVar("g", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -289,8 +289,8 @@ TEST_P(HlslDepthTexturesTest, Emit) {
|
|||
|
||||
GlobalVar("tex", t,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))},
|
||||
|
@ -319,8 +319,8 @@ TEST_F(HlslDepthMultisampledTexturesTest, Emit) {
|
|||
|
||||
GlobalVar("tex", t,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))},
|
||||
|
@ -362,8 +362,8 @@ TEST_P(HlslSampledTexturesTest, Emit) {
|
|||
|
||||
GlobalVar("tex", t,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("main", {}, ty.void_(), {CallStmt(Call("textureDimensions", "tex"))},
|
||||
|
|
|
@ -759,7 +759,7 @@ bool GeneratorImpl::EmitTypeConstructor(std::ostream& out,
|
|||
return false;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
size_t i = 0;
|
||||
for (auto* arg : call->Arguments()) {
|
||||
if (i > 0) {
|
||||
out << ", ";
|
||||
|
@ -920,7 +920,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
|
|||
// Returns the argument with the given usage
|
||||
auto arg = [&](Usage usage) {
|
||||
int idx = signature.IndexOf(usage);
|
||||
return (idx >= 0) ? arguments[idx] : nullptr;
|
||||
return (idx >= 0) ? arguments[static_cast<size_t>(idx)] : nullptr;
|
||||
};
|
||||
|
||||
auto* texture = arg(Usage::kTexture)->Declaration();
|
||||
|
|
|
@ -337,8 +337,8 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionAttribute_EntryPoint_With_RW_StorageBu
|
|||
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("coord", "b"));
|
||||
|
@ -379,8 +379,8 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionAttribute_EntryPoint_With_RO_StorageBu
|
|||
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
auto* var = Var("v", ty.f32(), ast::StorageClass::kNone, MemberAccessor("coord", "b"));
|
||||
|
@ -417,8 +417,8 @@ TEST_F(MslGeneratorImplTest, Emit_Attribute_Called_By_EntryPoint_With_Uniform) {
|
|||
auto* ubo_ty = Structure("UBO", {Member("coord", ty.vec4<f32>())});
|
||||
auto* ubo = GlobalVar("ubo", ty.Of(ubo_ty), ast::StorageClass::kUniform,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
Func("sub_func",
|
||||
|
@ -471,8 +471,8 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionAttribute_Called_By_EntryPoint_With_RW
|
|||
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
Func("sub_func",
|
||||
|
@ -526,8 +526,8 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionAttribute_Called_By_EntryPoint_With_RO
|
|||
|
||||
GlobalVar("coord", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
Func("sub_func",
|
||||
|
@ -667,8 +667,8 @@ TEST_F(MslGeneratorImplTest, Emit_Function_Multiple_EntryPoint_With_Same_ModuleV
|
|||
|
||||
GlobalVar("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
{
|
||||
|
|
|
@ -29,8 +29,8 @@ TEST_F(MslSanitizerTest, Call_ArrayLength) {
|
|||
auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
@ -87,8 +87,8 @@ TEST_F(MslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) {
|
|||
});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
@ -144,8 +144,8 @@ TEST_F(MslSanitizerTest, Call_ArrayLength_ViaLets) {
|
|||
auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
auto* p = Let("p", nullptr, AddressOf("b"));
|
||||
|
@ -204,13 +204,13 @@ TEST_F(MslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniform) {
|
|||
auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
GlobalVar("c", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(2),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(2u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
@ -269,13 +269,13 @@ TEST_F(MslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniformMissingBinding)
|
|||
auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
GlobalVar("c", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(2),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(2u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
|
|
@ -249,8 +249,8 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_NonComposites) {
|
|||
|
||||
GlobalVar("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -358,8 +358,8 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_Structures) {
|
|||
|
||||
GlobalVar("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -452,8 +452,8 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_ArrayDefaultStride) {
|
|||
|
||||
GlobalVar("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -538,8 +538,8 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_ArrayVec3DefaultStride) {
|
|||
|
||||
GlobalVar("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -602,8 +602,8 @@ TEST_F(MslGeneratorImplTest, AttemptTintPadSymbolCollision) {
|
|||
|
||||
GlobalVar("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -663,8 +663,8 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_WithAttribute) {
|
|||
|
||||
GlobalVar("G", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -830,8 +830,8 @@ TEST_P(MslStorageTexturesTest, Emit) {
|
|||
auto* s = ty.storage_texture(params.dim, ast::TexelFormat::kR32Float, ast::Access::kWrite);
|
||||
GlobalVar("test_var", s,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
|
|
@ -533,7 +533,7 @@ bool Builder::GenerateExecutionModes(const ast::Function* func, uint32_t id) {
|
|||
wgsize_ops.push_back(wgsize_result);
|
||||
|
||||
// Generate OpConstant instructions for each dimension.
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (size_t i = 0; i < 3; i++) {
|
||||
auto constant = ScalarConstant::U32(wgsize[i].value);
|
||||
if (wgsize[i].overridable_const) {
|
||||
// Make the constant specializable.
|
||||
|
@ -2688,7 +2688,7 @@ bool Builder::GenerateTextureBuiltin(const sem::Call* call,
|
|||
// Returns the argument with the given usage
|
||||
auto arg = [&](Usage usage) {
|
||||
int idx = signature.IndexOf(usage);
|
||||
return (idx >= 0) ? arguments[idx] : nullptr;
|
||||
return (idx >= 0) ? arguments[static_cast<size_t>(idx)] : nullptr;
|
||||
};
|
||||
|
||||
// Generates the argument with the given usage, returning the operand ID
|
||||
|
|
|
@ -453,14 +453,14 @@ TEST_F(BuiltinBuilderTest, Call_TextureSampleCompare_Twice) {
|
|||
|
||||
auto* tex = GlobalVar("texture", t,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
auto* sampler = GlobalVar("sampler", s,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
auto* expr1 = Call("textureSampleCompare", "texture", "sampler", vec2<f32>(1_f, 2_f), 2_f);
|
||||
|
@ -1587,8 +1587,8 @@ TEST_F(BuiltinBuilderTest, Call_ArrayLength) {
|
|||
auto* s = Structure("my_struct", {Member("a", ty.array<f32>(4))});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
auto* expr = Call("arrayLength", AddressOf(MemberAccessor("b", "a")));
|
||||
|
||||
|
@ -1634,8 +1634,8 @@ TEST_F(BuiltinBuilderTest, Call_ArrayLength_OtherMembersInStruct) {
|
|||
});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
auto* expr = Call("arrayLength", AddressOf(MemberAccessor("b", "a")));
|
||||
|
||||
|
@ -1678,8 +1678,8 @@ TEST_F(BuiltinBuilderTest, Call_ArrayLength_ViaLets) {
|
|||
auto* s = Structure("my_struct", {Member("a", ty.array<f32>(4))});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
auto* p = Let("p", nullptr, AddressOf("b"));
|
||||
|
@ -1738,8 +1738,8 @@ TEST_F(BuiltinBuilderTest, Call_ArrayLength_ViaLets_WithPtrNoise) {
|
|||
auto* s = Structure("my_struct", {Member("a", ty.array<f32>(4))});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
auto* p = Let("p", nullptr, AddressOf(Deref(AddressOf("b"))));
|
||||
|
@ -1803,8 +1803,8 @@ TEST_F(BuiltinBuilderTest, Call_AtomicLoad) {
|
|||
});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
@ -1867,8 +1867,8 @@ TEST_F(BuiltinBuilderTest, Call_AtomicStore) {
|
|||
});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
@ -1939,8 +1939,8 @@ TEST_P(Builtin_Builtin_AtomicRMW_i32, Test) {
|
|||
});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
@ -2012,8 +2012,8 @@ TEST_P(Builtin_Builtin_AtomicRMW_u32, Test) {
|
|||
});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
@ -2087,8 +2087,8 @@ TEST_F(BuiltinBuilderTest, Call_AtomicExchange) {
|
|||
});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
@ -2163,8 +2163,8 @@ TEST_F(BuiltinBuilderTest, Call_AtomicCompareExchangeWeak) {
|
|||
});
|
||||
GlobalVar("b", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
Func("a_func", {}, ty.void_(),
|
||||
|
|
|
@ -200,8 +200,8 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
|
|||
|
||||
GlobalVar("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
{
|
||||
|
|
|
@ -206,8 +206,8 @@ TEST_F(BuilderTest, GlobalVar_WithBindingAndGroup) {
|
|||
auto* v =
|
||||
GlobalVar("var", ty.sampler(ast::SamplerKind::kSampler), ast::StorageClass::kNone, nullptr,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(2),
|
||||
create<ast::GroupAttribute>(3),
|
||||
create<ast::BindingAttribute>(2u),
|
||||
create<ast::GroupAttribute>(3u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
@ -450,8 +450,8 @@ TEST_F(BuilderTest, GlobalVar_DeclReadOnly) {
|
|||
|
||||
GlobalVar("b", ty.Of(A), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = SanitizeAndBuild();
|
||||
|
@ -491,8 +491,8 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasDeclReadOnly) {
|
|||
auto* B = Alias("B", ty.Of(A));
|
||||
GlobalVar("b", ty.Of(B), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = SanitizeAndBuild();
|
||||
|
@ -530,8 +530,8 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasAssignReadOnly) {
|
|||
auto* B = Alias("B", ty.Of(A));
|
||||
GlobalVar("b", ty.Of(B), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = SanitizeAndBuild();
|
||||
|
@ -568,13 +568,13 @@ TEST_F(BuilderTest, GlobalVar_TwoVarDeclReadOnly) {
|
|||
auto* A = Structure("A", {Member("a", ty.i32())});
|
||||
GlobalVar("b", ty.Of(A), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
});
|
||||
GlobalVar("c", ty.Of(A), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = SanitizeAndBuild();
|
||||
|
@ -614,8 +614,8 @@ TEST_F(BuilderTest, GlobalVar_TextureStorageWriteOnly) {
|
|||
|
||||
auto* var_a = GlobalVar("a", type,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
@ -645,16 +645,16 @@ TEST_F(BuilderTest, DISABLED_GlobalVar_TextureStorageWithDifferentAccess) {
|
|||
ast::Access::kReadWrite);
|
||||
auto* var_a = GlobalVar("a", type_a, ast::StorageClass::kNone,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
auto* type_b = ty.storage_texture(ast::TextureDimension::k2d, ast::TexelFormat::kR32Uint,
|
||||
ast::Access::kWrite);
|
||||
auto* var_b = GlobalVar("b", type_b, ast::StorageClass::kNone,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
|
|
@ -30,8 +30,8 @@ TEST_F(BuilderTest_Type, GenerateRuntimeArray) {
|
|||
auto* str = Structure("S", {Member("x", ary)});
|
||||
GlobalVar("a", ty.Of(str), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
@ -50,8 +50,8 @@ TEST_F(BuilderTest_Type, ReturnsGeneratedRuntimeArray) {
|
|||
auto* str = Structure("S", {Member("x", ary)});
|
||||
GlobalVar("a", ty.Of(str), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
@ -783,8 +783,8 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_1d) {
|
|||
|
||||
GlobalVar("test_var", s,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
@ -802,8 +802,8 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_2d) {
|
|||
|
||||
GlobalVar("test_var", s,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
@ -821,8 +821,8 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_2dArray) {
|
|||
|
||||
GlobalVar("test_var", s,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
@ -840,8 +840,8 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_3d) {
|
|||
|
||||
GlobalVar("test_var", s,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
@ -859,8 +859,8 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_SampledTypeFloat_Format_r32floa
|
|||
|
||||
GlobalVar("test_var", s,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
@ -878,8 +878,8 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_SampledTypeSint_Format_r32sint)
|
|||
|
||||
GlobalVar("test_var", s,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
@ -897,8 +897,8 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_SampledTypeUint_Format_r32uint)
|
|||
|
||||
GlobalVar("test_var", s,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
|
|
@ -84,7 +84,7 @@ void TextGenerator::TextBuffer::Insert(const std::string& line, size_t before, u
|
|||
<< " lines.size(): " << lines.size();
|
||||
return;
|
||||
}
|
||||
lines.insert(lines.begin() + before, Line{indent, line});
|
||||
lines.insert(lines.begin() + static_cast<int64_t>(before), Line{indent, line});
|
||||
}
|
||||
|
||||
void TextGenerator::TextBuffer::Append(const TextBuffer& tb) {
|
||||
|
@ -105,7 +105,8 @@ void TextGenerator::TextBuffer::Insert(const TextBuffer& tb, size_t before, uint
|
|||
size_t idx = 0;
|
||||
for (auto& line : tb.lines) {
|
||||
// TODO(bclayton): inefficent, consider optimizing
|
||||
lines.insert(lines.begin() + before + idx, Line{indent + line.indent, line.content});
|
||||
lines.insert(lines.begin() + static_cast<int64_t>(before + idx),
|
||||
Line{indent + line.indent, line.content});
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -714,7 +714,7 @@ bool GeneratorImpl::EmitAttributes(std::ostream& out, const ast::AttributeList&
|
|||
[&](const ast::WorkgroupAttribute* workgroup) {
|
||||
auto values = workgroup->Values();
|
||||
out << "workgroup_size(";
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (size_t i = 0; i < 3; i++) {
|
||||
if (values[i]) {
|
||||
if (i > 0) {
|
||||
out << ", ";
|
||||
|
|
|
@ -162,8 +162,8 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_Multiple_EntryPoint_With_Same_Module
|
|||
|
||||
GlobalVar("data", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
{
|
||||
|
|
|
@ -103,8 +103,8 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalsInterleaved) {
|
|||
TEST_F(WgslGeneratorImplTest, Emit_Global_Sampler) {
|
||||
GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler),
|
||||
ast::AttributeList{
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -119,8 +119,8 @@ TEST_F(WgslGeneratorImplTest, Emit_Global_Texture) {
|
|||
auto* st = ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
|
||||
GlobalVar("t", st,
|
||||
ast::AttributeList{
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace {
|
|||
// - 0 sign if sign is 0, 1 otherwise
|
||||
// - 'exponent_bits' is placed in the exponent space.
|
||||
// So, the exponent bias must already be included.
|
||||
f32 MakeFloat(int sign, int biased_exponent, int mantissa) {
|
||||
f32 MakeFloat(uint32_t sign, uint32_t biased_exponent, uint32_t mantissa) {
|
||||
const uint32_t sign_bit = sign ? 0x80000000u : 0u;
|
||||
// The binary32 exponent is 8 bits, just below the sign.
|
||||
const uint32_t exponent_bits = (biased_exponent & 0xffu) << 23;
|
||||
|
|
|
@ -422,8 +422,8 @@ TEST_P(WgslGenerator_StorageTextureTest, EmitType_StorageTexture) {
|
|||
auto* t = ty.storage_texture(param.dim, param.fmt, param.access);
|
||||
GlobalVar("g", t,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(1),
|
||||
create<ast::GroupAttribute>(2),
|
||||
create<ast::BindingAttribute>(1u),
|
||||
create<ast::GroupAttribute>(2u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
|
|
@ -45,8 +45,8 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Access_Read) {
|
|||
auto* s = Structure("S", {Member("a", ty.i32())});
|
||||
auto* v = GlobalVar("a", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kRead,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -60,8 +60,8 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Access_Write) {
|
|||
auto* s = Structure("S", {Member("a", ty.i32())});
|
||||
auto* v = GlobalVar("a", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -75,8 +75,8 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Access_ReadWrite) {
|
|||
auto* s = Structure("S", {Member("a", ty.i32())});
|
||||
auto* v = GlobalVar("a", ty.Of(s), ast::StorageClass::kStorage, ast::Access::kReadWrite,
|
||||
ast::AttributeList{
|
||||
create<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
create<ast::BindingAttribute>(0u),
|
||||
create<ast::GroupAttribute>(0u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -90,8 +90,8 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Decorated) {
|
|||
auto* v =
|
||||
GlobalVar("a", ty.sampler(ast::SamplerKind::kSampler), ast::StorageClass::kNone, nullptr,
|
||||
ast::AttributeList{
|
||||
create<ast::GroupAttribute>(1),
|
||||
create<ast::BindingAttribute>(2),
|
||||
create<ast::GroupAttribute>(1u),
|
||||
create<ast::BindingAttribute>(2u),
|
||||
});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
|
Loading…
Reference in New Issue