Fix all warnings when building with CMake + clang
Change-Id: I987b4580f5f99584649b2b189369a0b962b0c3d4 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31721 Commit-Queue: dan sinclair <dsinclair@chromium.org> Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
a28d19b18d
commit
f8bd106041
|
@ -46,7 +46,8 @@ class BlockStatement : public Statement {
|
|||
/// @param index the index to insert at
|
||||
/// @param stmt the statement to insert
|
||||
void insert(size_t index, std::unique_ptr<ast::Statement> stmt) {
|
||||
statements_.insert(statements_.begin() + index, std::move(stmt));
|
||||
auto offset = static_cast<decltype(statements_)::difference_type>(index);
|
||||
statements_.insert(statements_.begin() + offset, std::move(stmt));
|
||||
}
|
||||
|
||||
/// @returns true if the block is empty
|
||||
|
|
|
@ -59,8 +59,8 @@ uint64_t ArrayType::MinBufferBindingSize(MemoryLayout mem_layout) const {
|
|||
uint64_t ArrayType::BaseAlignment(MemoryLayout mem_layout) const {
|
||||
if (mem_layout == MemoryLayout::kUniformBuffer) {
|
||||
float aligment = 16; // for a vec4
|
||||
float unaligned = subtype_->BaseAlignment(mem_layout);
|
||||
return aligment * std::ceil(unaligned / aligment);
|
||||
float unaligned = static_cast<float>(subtype_->BaseAlignment(mem_layout));
|
||||
return static_cast<uint64_t>(aligment * std::ceil(unaligned / aligment));
|
||||
} else if (mem_layout == MemoryLayout::kStorageBuffer) {
|
||||
return subtype_->BaseAlignment(mem_layout);
|
||||
}
|
||||
|
|
|
@ -30,11 +30,11 @@ std::string I32Type::type_name() const {
|
|||
return "__i32";
|
||||
}
|
||||
|
||||
uint64_t I32Type::MinBufferBindingSize(MemoryLayout mem_layout) const {
|
||||
uint64_t I32Type::MinBufferBindingSize(MemoryLayout) const {
|
||||
return 4;
|
||||
}
|
||||
|
||||
uint64_t I32Type::BaseAlignment(MemoryLayout mem_layout) const {
|
||||
uint64_t I32Type::BaseAlignment(MemoryLayout) const {
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ uint64_t StructType::MinBufferBindingSize(MemoryLayout mem_layout) const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
float unaligned = last_member->offset() + size;
|
||||
float alignment = BaseAlignment(mem_layout);
|
||||
float unaligned = static_cast<float>(last_member->offset() + size);
|
||||
float alignment = static_cast<float>(BaseAlignment(mem_layout));
|
||||
|
||||
return alignment * std::ceil(unaligned / alignment);
|
||||
return static_cast<uint64_t>(alignment * std::ceil(unaligned / alignment));
|
||||
}
|
||||
|
||||
uint64_t StructType::BaseAlignment(MemoryLayout mem_layout) const {
|
||||
|
@ -75,7 +75,8 @@ uint64_t StructType::BaseAlignment(MemoryLayout mem_layout) const {
|
|||
|
||||
if (mem_layout == MemoryLayout::kUniformBuffer) {
|
||||
// Round up to a vec4.
|
||||
return 16 * std::ceil(static_cast<float>(max) / 16.0f);
|
||||
return static_cast<uint64_t>(16 *
|
||||
std::ceil(static_cast<float>(max) / 16.0f));
|
||||
} else if (mem_layout == MemoryLayout::kStorageBuffer) {
|
||||
return max;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue