Add InsertBraces: true to .clang-format

Bug: none
Change-Id: I4b4f2a4abfea7adcea406f458bc4e4a13b0e8c43
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: dan sinclair <dsinclair@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Austin Eng 2022-05-19 20:08:19 +00:00 committed by Dawn LUCI CQ
parent 2081ee43bf
commit 86a617f110
18 changed files with 654 additions and 336 deletions

View File

@ -7,4 +7,4 @@ ColumnLimit: 100
IndentWidth: 4 IndentWidth: 4
ObjCBlockIndentWidth: 4 ObjCBlockIndentWidth: 4
AccessModifierOffset: -2 AccessModifierOffset: -2
InsertBraces: true

View File

@ -103,11 +103,12 @@ class StackAllocator : public std::allocator<T> {
// Free: when trying to free the stack buffer, just mark it as free. For // Free: when trying to free the stack buffer, just mark it as free. For
// non-stack-buffer pointers, just fall though to the standard allocator. // non-stack-buffer pointers, just fall though to the standard allocator.
void deallocate(pointer p, size_type n) { void deallocate(pointer p, size_type n) {
if (source_ && p == source_->stack_buffer()) if (source_ && p == source_->stack_buffer()) {
source_->used_stack_buffer_ = false; source_->used_stack_buffer_ = false;
else } else {
std::allocator<T>::deallocate(p, n); std::allocator<T>::deallocate(p, n);
} }
}
private: private:
Source* source_; Source* source_;

View File

@ -25,8 +25,9 @@
namespace { namespace {
// TODO(amaiorano): Move to utility header // TODO(amaiorano): Move to utility header
std::vector<std::string> Split(const std::string& s, char delim) { std::vector<std::string> Split(const std::string& s, char delim) {
if (s.empty()) if (s.empty()) {
return {}; return {};
}
std::vector<std::string> result; std::vector<std::string> result;
const size_t lastIndex = s.length() - 1; const size_t lastIndex = s.length() - 1;
@ -36,14 +37,16 @@ std::vector<std::string> Split(const std::string& s, char delim) {
while (i <= lastIndex) { while (i <= lastIndex) {
if (s[i] == delim) { if (s[i] == delim) {
auto token = s.substr(startIndex, i - startIndex); auto token = s.substr(startIndex, i - startIndex);
if (!token.empty()) // Discard empty tokens if (!token.empty()) { // Discard empty tokens
result.push_back(token); result.push_back(token);
}
startIndex = i + 1; startIndex = i + 1;
} else if (i == lastIndex) { } else if (i == lastIndex) {
auto token = s.substr(startIndex, i - startIndex + 1); auto token = s.substr(startIndex, i - startIndex + 1);
if (!token.empty()) // Discard empty tokens if (!token.empty()) { // Discard empty tokens
result.push_back(token); result.push_back(token);
} }
}
++i; ++i;
} }
return result; return result;
@ -151,7 +154,8 @@ GPUAdapter::GPUAdapter(dawn::native::Adapter a, const Flags& flags) : adapter_(a
name_ = props.name; name_ = props.name;
} }
// TODO(dawn:1133): Avoid the extra copy by making the generator make a virtual method with const std::string& // TODO(dawn:1133): Avoid the extra copy by making the generator make a virtual method with const
// std::string&
std::string GPUAdapter::getName(Napi::Env) { std::string GPUAdapter::getName(Napi::Env) {
return name_; return name_;
} }

View File

@ -921,9 +921,10 @@ class TraceEndOnScopeClose {
// Note: members of m_data intentionally left uninitialized. See initialize. // Note: members of m_data intentionally left uninitialized. See initialize.
TraceEndOnScopeClose() : m_pdata(0) {} TraceEndOnScopeClose() : m_pdata(0) {}
~TraceEndOnScopeClose() { ~TraceEndOnScopeClose() {
if (m_pdata) if (m_pdata) {
addEventIfEnabled(); addEventIfEnabled();
} }
}
void initialize(dawn::platform::Platform* platform, void initialize(dawn::platform::Platform* platform,
const unsigned char* categoryEnabled, const unsigned char* categoryEnabled,

View File

@ -978,8 +978,7 @@ std::pair<wgpu::Device, WGPUDevice> DawnTestBase::CreateDeviceImpl(std::string i
mDeviceErrorCallback.MakeUserdata(device.Get())); mDeviceErrorCallback.MakeUserdata(device.Get()));
device.SetDeviceLostCallback(mDeviceLostCallback.Callback(), device.SetDeviceLostCallback(mDeviceLostCallback.Callback(),
mDeviceLostCallback.MakeUserdata(device.Get())); mDeviceLostCallback.MakeUserdata(device.Get()));
EXPECT_CALL(mDeviceLostCallback, EXPECT_CALL(mDeviceLostCallback, Call(WGPUDeviceLostReason_Destroyed, testing::_, device.Get()))
Call(WGPUDeviceLostReason_Destroyed, testing::_, device.Get()))
.Times(testing::AtMost(1)); .Times(testing::AtMost(1));
device.SetLoggingCallback( device.SetLoggingCallback(

View File

@ -84,9 +84,10 @@ class VideoViewsTestBackendGbm : public VideoViewsTestBackend {
for (uint32_t i = kRenderNodeStart; i < kRenderNodeEnd; i++) { for (uint32_t i = kRenderNodeStart; i < kRenderNodeEnd; i++) {
std::string renderNode = kRenderNodeTemplate + std::to_string(i); std::string renderNode = kRenderNodeTemplate + std::to_string(i);
renderNodeFd = open(renderNode.c_str(), O_RDWR); renderNodeFd = open(renderNode.c_str(), O_RDWR);
if (renderNodeFd >= 0) if (renderNodeFd >= 0) {
break; break;
} }
}
ASSERT(renderNodeFd > 0); ASSERT(renderNodeFd > 0);
gbm_device* gbmDevice = gbm_create_device(renderNodeFd); gbm_device* gbmDevice = gbm_create_device(renderNodeFd);

View File

@ -47,8 +47,9 @@ TEST(StackContainer, Vector) {
} }
// The array should still be in order. // The array should still be in order.
for (int i = 0; i < stack_size * 2; i++) for (int i = 0; i < stack_size * 2; i++) {
EXPECT_EQ(i, vect.container()[i]); EXPECT_EQ(i, vect.container()[i]);
}
// Resize to smaller. Our STL implementation won't reallocate in this case, // Resize to smaller. Our STL implementation won't reallocate in this case,
// otherwise it might use our stack buffer. We reserve right after the resize // otherwise it might use our stack buffer. We reserve right after the resize
@ -64,9 +65,10 @@ TEST(StackContainer, Vector) {
std::vector<int, StackAllocator<int, stack_size>> other(vect.container()); std::vector<int, StackAllocator<int, stack_size>> other(vect.container());
EXPECT_EQ(stack_buffer, &other.front()); EXPECT_EQ(stack_buffer, &other.front());
EXPECT_TRUE(vect.stack_data().used_stack_buffer_); EXPECT_TRUE(vect.stack_data().used_stack_buffer_);
for (int i = 0; i < stack_size; i++) for (int i = 0; i < stack_size; i++) {
EXPECT_EQ(i, other[i]); EXPECT_EQ(i, other[i]);
} }
}
TEST(StackContainer, VectorDoubleDelete) { TEST(StackContainer, VectorDoubleDelete) {
// Regression testing for double-delete. // Regression testing for double-delete.

View File

@ -154,9 +154,10 @@ class VulkanImageWrappingTestBackendDmaBuf : public VulkanImageWrappingTestBacke
for (uint32_t i = kRenderNodeStart; i < kRenderNodeEnd; i++) { for (uint32_t i = kRenderNodeStart; i < kRenderNodeEnd; i++) {
std::string renderNode = kRenderNodeTemplate + std::to_string(i); std::string renderNode = kRenderNodeTemplate + std::to_string(i);
renderNodeFd = open(renderNode.c_str(), O_RDWR); renderNodeFd = open(renderNode.c_str(), O_RDWR);
if (renderNodeFd >= 0) if (renderNodeFd >= 0) {
break; break;
} }
}
EXPECT_GE(renderNodeFd, 0) << "Failed to get file descriptor for render node"; EXPECT_GE(renderNodeFd, 0) << "Failed to get file descriptor for render node";
gbm_device* gbmDevice = gbm_create_device(renderNodeFd); gbm_device* gbmDevice = gbm_create_device(renderNodeFd);
@ -167,8 +168,9 @@ class VulkanImageWrappingTestBackendDmaBuf : public VulkanImageWrappingTestBacke
private: private:
gbm_bo* CreateGbmBo(uint32_t width, uint32_t height, bool linear) { gbm_bo* CreateGbmBo(uint32_t width, uint32_t height, bool linear) {
uint32_t flags = GBM_BO_USE_RENDERING; uint32_t flags = GBM_BO_USE_RENDERING;
if (linear) if (linear) {
flags |= GBM_BO_USE_LINEAR; flags |= GBM_BO_USE_LINEAR;
}
gbm_bo* gbmBo = gbm_bo_create(mGbmDevice, width, height, GBM_FORMAT_XBGR8888, flags); gbm_bo* gbmBo = gbm_bo_create(mGbmDevice, width, height, GBM_FORMAT_XBGR8888, flags);
EXPECT_NE(gbmBo, nullptr) << "Failed to create GBM buffer object"; EXPECT_NE(gbmBo, nullptr) << "Failed to create GBM buffer object";
return gbmBo; return gbmBo;

View File

@ -125,30 +125,36 @@ Format parse_format(const std::string& fmt) {
(void)fmt; (void)fmt;
#if TINT_BUILD_SPV_WRITER #if TINT_BUILD_SPV_WRITER
if (fmt == "spirv") if (fmt == "spirv") {
return Format::kSpirv; return Format::kSpirv;
if (fmt == "spvasm") }
if (fmt == "spvasm") {
return Format::kSpvAsm; return Format::kSpvAsm;
}
#endif // TINT_BUILD_SPV_WRITER #endif // TINT_BUILD_SPV_WRITER
#if TINT_BUILD_WGSL_WRITER #if TINT_BUILD_WGSL_WRITER
if (fmt == "wgsl") if (fmt == "wgsl") {
return Format::kWgsl; return Format::kWgsl;
}
#endif // TINT_BUILD_WGSL_WRITER #endif // TINT_BUILD_WGSL_WRITER
#if TINT_BUILD_MSL_WRITER #if TINT_BUILD_MSL_WRITER
if (fmt == "msl") if (fmt == "msl") {
return Format::kMsl; return Format::kMsl;
}
#endif // TINT_BUILD_MSL_WRITER #endif // TINT_BUILD_MSL_WRITER
#if TINT_BUILD_HLSL_WRITER #if TINT_BUILD_HLSL_WRITER
if (fmt == "hlsl") if (fmt == "hlsl") {
return Format::kHlsl; return Format::kHlsl;
}
#endif // TINT_BUILD_HLSL_WRITER #endif // TINT_BUILD_HLSL_WRITER
#if TINT_BUILD_GLSL_WRITER #if TINT_BUILD_GLSL_WRITER
if (fmt == "glsl") if (fmt == "glsl") {
return Format::kGlsl; return Format::kGlsl;
}
#endif // TINT_BUILD_GLSL_WRITER #endif // TINT_BUILD_GLSL_WRITER
return Format::kNone; return Format::kNone;

View File

@ -602,10 +602,12 @@ class StructuredTraverser {
// header, we will visit its merge block, then its continue target (if any). // header, we will visit its merge block, then its continue target (if any).
// Also records the post order ordering. // Also records the post order ordering.
void VisitBackward(uint32_t id) { void VisitBackward(uint32_t id) {
if (id == 0) if (id == 0) {
return; return;
if (visited_.count(id)) }
if (visited_.count(id)) {
return; return;
}
visited_.insert(id); visited_.insert(id);
const spvtools::opt::BasicBlock* bb = id_to_block_[id]; // non-null for valid modules const spvtools::opt::BasicBlock* bb = id_to_block_[id]; // non-null for valid modules
@ -1600,8 +1602,9 @@ bool FunctionEmitter::RegisterMerges() {
bool is_single_block_loop = false; bool is_single_block_loop = false;
block_info->basic_block->ForEachSuccessorLabel( block_info->basic_block->ForEachSuccessorLabel(
[&is_single_block_loop, block_id](const uint32_t succ) { [&is_single_block_loop, block_id](const uint32_t succ) {
if (block_id == succ) if (block_id == succ) {
is_single_block_loop = true; is_single_block_loop = true;
}
}); });
const auto ct = block_info->continue_for_header; const auto ct = block_info->continue_for_header;
block_info->is_continue_entire_loop = ct == block_id; block_info->is_continue_entire_loop = ct == block_id;

View File

@ -232,8 +232,9 @@ bool Lexer::is_hex(char ch) const {
} }
bool Lexer::matches(size_t pos, std::string_view sub_string) { bool Lexer::matches(size_t pos, std::string_view sub_string) {
if (pos >= length()) if (pos >= length()) {
return false; return false;
}
return substr(pos, sub_string.size()) == sub_string; return substr(pos, sub_string.size()) == sub_string;
} }
@ -265,9 +266,10 @@ Token Lexer::skip_blankspace_and_comments() {
// If the cursor didn't advance we didn't remove any blankspace // If the cursor didn't advance we didn't remove any blankspace
// so we're done. // so we're done.
if (loc == location_) if (loc == location_) {
break; break;
} }
}
if (is_eof()) { if (is_eof()) {
return {Token::Type::kEOF, begin_source()}; return {Token::Type::kEOF, begin_source()};
} }
@ -1043,110 +1045,159 @@ Token Lexer::try_punctuation() {
} }
Token Lexer::check_keyword(const Source& source, std::string_view str) { Token Lexer::check_keyword(const Source& source, std::string_view str) {
if (str == "array") if (str == "array") {
return {Token::Type::kArray, source, "array"}; return {Token::Type::kArray, source, "array"};
if (str == "atomic") }
if (str == "atomic") {
return {Token::Type::kAtomic, source, "atomic"}; return {Token::Type::kAtomic, source, "atomic"};
if (str == "bitcast") }
if (str == "bitcast") {
return {Token::Type::kBitcast, source, "bitcast"}; return {Token::Type::kBitcast, source, "bitcast"};
if (str == "bool") }
if (str == "bool") {
return {Token::Type::kBool, source, "bool"}; return {Token::Type::kBool, source, "bool"};
if (str == "break") }
if (str == "break") {
return {Token::Type::kBreak, source, "break"}; return {Token::Type::kBreak, source, "break"};
if (str == "case") }
if (str == "case") {
return {Token::Type::kCase, source, "case"}; return {Token::Type::kCase, source, "case"};
if (str == "continue") }
if (str == "continue") {
return {Token::Type::kContinue, source, "continue"}; return {Token::Type::kContinue, source, "continue"};
if (str == "continuing") }
if (str == "continuing") {
return {Token::Type::kContinuing, source, "continuing"}; return {Token::Type::kContinuing, source, "continuing"};
if (str == "discard") }
if (str == "discard") {
return {Token::Type::kDiscard, source, "discard"}; return {Token::Type::kDiscard, source, "discard"};
if (str == "default") }
if (str == "default") {
return {Token::Type::kDefault, source, "default"}; return {Token::Type::kDefault, source, "default"};
if (str == "else") }
if (str == "else") {
return {Token::Type::kElse, source, "else"}; return {Token::Type::kElse, source, "else"};
if (str == "enable") }
if (str == "enable") {
return {Token::Type::kEnable, source, "enable"}; return {Token::Type::kEnable, source, "enable"};
if (str == "f16") }
if (str == "f16") {
return {Token::Type::kF16, source, "f16"}; return {Token::Type::kF16, source, "f16"};
if (str == "f32") }
if (str == "f32") {
return {Token::Type::kF32, source, "f32"}; return {Token::Type::kF32, source, "f32"};
if (str == "fallthrough") }
if (str == "fallthrough") {
return {Token::Type::kFallthrough, source, "fallthrough"}; return {Token::Type::kFallthrough, source, "fallthrough"};
if (str == "false") }
if (str == "false") {
return {Token::Type::kFalse, source, "false"}; return {Token::Type::kFalse, source, "false"};
if (str == "fn") }
if (str == "fn") {
return {Token::Type::kFn, source, "fn"}; return {Token::Type::kFn, source, "fn"};
if (str == "for") }
if (str == "for") {
return {Token::Type::kFor, source, "for"}; return {Token::Type::kFor, source, "for"};
if (str == "function") }
if (str == "function") {
return {Token::Type::kFunction, source, "function"}; return {Token::Type::kFunction, source, "function"};
if (str == "i32") }
if (str == "i32") {
return {Token::Type::kI32, source, "i32"}; return {Token::Type::kI32, source, "i32"};
if (str == "if") }
if (str == "if") {
return {Token::Type::kIf, source, "if"}; return {Token::Type::kIf, source, "if"};
if (str == "import") }
if (str == "import") {
return {Token::Type::kImport, source, "import"}; return {Token::Type::kImport, source, "import"};
if (str == "let") }
if (str == "let") {
return {Token::Type::kLet, source, "let"}; return {Token::Type::kLet, source, "let"};
if (str == "loop") }
if (str == "loop") {
return {Token::Type::kLoop, source, "loop"}; return {Token::Type::kLoop, source, "loop"};
if (str == "mat2x2") }
if (str == "mat2x2") {
return {Token::Type::kMat2x2, source, "mat2x2"}; return {Token::Type::kMat2x2, source, "mat2x2"};
if (str == "mat2x3") }
if (str == "mat2x3") {
return {Token::Type::kMat2x3, source, "mat2x3"}; return {Token::Type::kMat2x3, source, "mat2x3"};
if (str == "mat2x4") }
if (str == "mat2x4") {
return {Token::Type::kMat2x4, source, "mat2x4"}; return {Token::Type::kMat2x4, source, "mat2x4"};
if (str == "mat3x2") }
if (str == "mat3x2") {
return {Token::Type::kMat3x2, source, "mat3x2"}; return {Token::Type::kMat3x2, source, "mat3x2"};
if (str == "mat3x3") }
if (str == "mat3x3") {
return {Token::Type::kMat3x3, source, "mat3x3"}; return {Token::Type::kMat3x3, source, "mat3x3"};
if (str == "mat3x4") }
if (str == "mat3x4") {
return {Token::Type::kMat3x4, source, "mat3x4"}; return {Token::Type::kMat3x4, source, "mat3x4"};
if (str == "mat4x2") }
if (str == "mat4x2") {
return {Token::Type::kMat4x2, source, "mat4x2"}; return {Token::Type::kMat4x2, source, "mat4x2"};
if (str == "mat4x3") }
if (str == "mat4x3") {
return {Token::Type::kMat4x3, source, "mat4x3"}; return {Token::Type::kMat4x3, source, "mat4x3"};
if (str == "mat4x4") }
if (str == "mat4x4") {
return {Token::Type::kMat4x4, source, "mat4x4"}; return {Token::Type::kMat4x4, source, "mat4x4"};
if (str == "override") }
if (str == "override") {
return {Token::Type::kOverride, source, "override"}; return {Token::Type::kOverride, source, "override"};
if (str == "private") }
if (str == "private") {
return {Token::Type::kPrivate, source, "private"}; return {Token::Type::kPrivate, source, "private"};
if (str == "ptr") }
if (str == "ptr") {
return {Token::Type::kPtr, source, "ptr"}; return {Token::Type::kPtr, source, "ptr"};
if (str == "return") }
if (str == "return") {
return {Token::Type::kReturn, source, "return"}; return {Token::Type::kReturn, source, "return"};
if (str == "sampler") }
if (str == "sampler") {
return {Token::Type::kSampler, source, "sampler"}; return {Token::Type::kSampler, source, "sampler"};
if (str == "sampler_comparison") }
if (str == "sampler_comparison") {
return {Token::Type::kComparisonSampler, source, "sampler_comparison"}; return {Token::Type::kComparisonSampler, source, "sampler_comparison"};
if (str == "storage_buffer" || str == "storage") }
if (str == "storage_buffer" || str == "storage") {
return {Token::Type::kStorage, source, "storage"}; return {Token::Type::kStorage, source, "storage"};
if (str == "struct") }
if (str == "struct") {
return {Token::Type::kStruct, source, "struct"}; return {Token::Type::kStruct, source, "struct"};
if (str == "switch") }
if (str == "switch") {
return {Token::Type::kSwitch, source, "switch"}; return {Token::Type::kSwitch, source, "switch"};
if (str == "texture_1d") }
if (str == "texture_1d") {
return {Token::Type::kTextureSampled1d, source, "texture_1d"}; return {Token::Type::kTextureSampled1d, source, "texture_1d"};
if (str == "texture_2d") }
if (str == "texture_2d") {
return {Token::Type::kTextureSampled2d, source, "texture_2d"}; return {Token::Type::kTextureSampled2d, source, "texture_2d"};
if (str == "texture_2d_array") }
if (str == "texture_2d_array") {
return {Token::Type::kTextureSampled2dArray, source, "texture_2d_array"}; return {Token::Type::kTextureSampled2dArray, source, "texture_2d_array"};
if (str == "texture_3d") }
if (str == "texture_3d") {
return {Token::Type::kTextureSampled3d, source, "texture_3d"}; return {Token::Type::kTextureSampled3d, source, "texture_3d"};
if (str == "texture_cube") }
if (str == "texture_cube") {
return {Token::Type::kTextureSampledCube, source, "texture_cube"}; return {Token::Type::kTextureSampledCube, source, "texture_cube"};
}
if (str == "texture_cube_array") { if (str == "texture_cube_array") {
return {Token::Type::kTextureSampledCubeArray, source, "texture_cube_array"}; return {Token::Type::kTextureSampledCubeArray, source, "texture_cube_array"};
} }
if (str == "texture_depth_2d") if (str == "texture_depth_2d") {
return {Token::Type::kTextureDepth2d, source, "texture_depth_2d"}; return {Token::Type::kTextureDepth2d, source, "texture_depth_2d"};
}
if (str == "texture_depth_2d_array") { if (str == "texture_depth_2d_array") {
return {Token::Type::kTextureDepth2dArray, source, "texture_depth_2d_array"}; return {Token::Type::kTextureDepth2dArray, source, "texture_depth_2d_array"};
} }
if (str == "texture_depth_cube") if (str == "texture_depth_cube") {
return {Token::Type::kTextureDepthCube, source, "texture_depth_cube"}; return {Token::Type::kTextureDepthCube, source, "texture_depth_cube"};
}
if (str == "texture_depth_cube_array") { if (str == "texture_depth_cube_array") {
return {Token::Type::kTextureDepthCubeArray, source, "texture_depth_cube_array"}; return {Token::Type::kTextureDepthCubeArray, source, "texture_depth_cube_array"};
} }
@ -1171,24 +1222,33 @@ Token Lexer::check_keyword(const Source& source, std::string_view str) {
if (str == "texture_storage_3d") { if (str == "texture_storage_3d") {
return {Token::Type::kTextureStorage3d, source, "texture_storage_3d"}; return {Token::Type::kTextureStorage3d, source, "texture_storage_3d"};
} }
if (str == "true") if (str == "true") {
return {Token::Type::kTrue, source, "true"}; return {Token::Type::kTrue, source, "true"};
if (str == "type") }
if (str == "type") {
return {Token::Type::kType, source, "type"}; return {Token::Type::kType, source, "type"};
if (str == "u32") }
if (str == "u32") {
return {Token::Type::kU32, source, "u32"}; return {Token::Type::kU32, source, "u32"};
if (str == "uniform") }
if (str == "uniform") {
return {Token::Type::kUniform, source, "uniform"}; return {Token::Type::kUniform, source, "uniform"};
if (str == "var") }
if (str == "var") {
return {Token::Type::kVar, source, "var"}; return {Token::Type::kVar, source, "var"};
if (str == "vec2") }
if (str == "vec2") {
return {Token::Type::kVec2, source, "vec2"}; return {Token::Type::kVec2, source, "vec2"};
if (str == "vec3") }
if (str == "vec3") {
return {Token::Type::kVec3, source, "vec3"}; return {Token::Type::kVec3, source, "vec3"};
if (str == "vec4") }
if (str == "vec4") {
return {Token::Type::kVec4, source, "vec4"}; return {Token::Type::kVec4, source, "vec4"};
if (str == "workgroup") }
if (str == "workgroup") {
return {Token::Type::kWorkgroup, source, "workgroup"}; return {Token::Type::kWorkgroup, source, "workgroup"};
}
return {}; return {};
} }

File diff suppressed because it is too large Load Diff

View File

@ -67,4 +67,3 @@ const char* str(CtorConvIntrinsic i) {
} }
} // namespace tint::resolver } // namespace tint::resolver

View File

@ -34,8 +34,9 @@ Symbol SymbolTable::Register(const std::string& name) {
TINT_ASSERT(Symbol, !name.empty()); TINT_ASSERT(Symbol, !name.empty());
auto it = name_to_symbol_.find(name); auto it = name_to_symbol_.find(name);
if (it != name_to_symbol_.end()) if (it != name_to_symbol_.end()) {
return it->second; return it->second;
}
#if TINT_SYMBOL_STORE_DEBUG_NAME #if TINT_SYMBOL_STORE_DEBUG_NAME
Symbol sym(next_symbol_, program_id_, name); Symbol sym(next_symbol_, program_id_, name);

View File

@ -1464,8 +1464,9 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
out << "("; out << "(";
if (!EmitExpression(out, texture)) if (!EmitExpression(out, texture)) {
return false; return false;
}
out << ", "; out << ", ";
@ -2601,8 +2602,10 @@ bool GeneratorImpl::EmitType(std::ostream& out,
if (storage && storage->access() != ast::Access::kRead) { if (storage && storage->access() != ast::Access::kRead) {
out << "writeonly "; out << "writeonly ";
} }
auto* subtype = auto* subtype = sampled ? sampled->type()
sampled ? sampled->type() : storage ? storage->type() : ms ? ms->type() : nullptr; : storage ? storage->type()
: ms ? ms->type()
: nullptr;
if (!subtype || subtype->Is<sem::F32>()) { if (!subtype || subtype->Is<sem::F32>()) {
} else if (subtype->Is<sem::I32>()) { } else if (subtype->Is<sem::I32>()) {
out << "i"; out << "i";

View File

@ -2324,8 +2324,9 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
break; break;
} }
if (!EmitExpression(out, texture)) if (!EmitExpression(out, texture)) {
return false; return false;
}
// If pack_level_in_coords is true, then the mip level will be appended as the // If pack_level_in_coords is true, then the mip level will be appended as the
// last value of the coordinates argument. If the WGSL builtin overload does // last value of the coordinates argument. If the WGSL builtin overload does
@ -2397,8 +2398,9 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
} }
if (auto* sampler = arg(Usage::kSampler)) { if (auto* sampler = arg(Usage::kSampler)) {
if (!EmitExpression(out, sampler)) if (!EmitExpression(out, sampler)) {
return false; return false;
}
out << ", "; out << ", ";
} }

View File

@ -1043,8 +1043,9 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
} }
} }
if (!EmitExpression(out, e->Declaration())) if (!EmitExpression(out, e->Declaration())) {
return false; return false;
}
if (casted) { if (casted) {
out << ")"; out << ")";

View File

@ -55,8 +55,9 @@ const char kGLSLstd450[] = "GLSL.std.450";
uint32_t size_of(const InstructionList& instructions) { uint32_t size_of(const InstructionList& instructions) {
uint32_t size = 0; uint32_t size = 0;
for (const auto& inst : instructions) for (const auto& inst : instructions) {
size += inst.word_length(); size += inst.word_length();
}
return size; return size;
} }