[dawn][tint] Rerun formatters on all C++-like and Python files A significant number of formatting errors had somehow crept in. Many of these were indentation that I believe is due to imprecision in `git cl format`'s heuristic to avoid reformatting unchanged lines. Some of them are most likely due to changes in clang-format itself. In addition to fixing incorrectly formatted code, this also makes it possible to use IDE/editor clang-format integrations, which won't have that heuristic. - First fixed a missing `// clang-format off` directive in `Format.cpp` - Then ran: git ls-tree -r main --name-only | grep -E '\.(h|c|cpp|cc|m|mm)$' | xargs clang-format -i git ls-tree -r main --name-only | grep -E '\.py$' | xargs yapf -i - Then reran `git cl format` to confirm that those commands used the correct config. Bug: None Change-Id: I685b6d00e0960934fd0ca9c9e7c5963e554f35bf Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/289816 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 567f1cc..4e61322 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py
@@ -86,6 +86,7 @@ LINT_FILTERS = [] + def _NonInclusiveFileFilter(file): """Filters files that are exempt from the non-inclusive language check.""" filter_list = [ @@ -387,9 +388,7 @@ # Check for formatting. results.extend( input_api.canned_checks.CheckPatchFormatted( - input_api, - output_api, - result_factory=result_factory)) + input_api, output_api, result_factory=result_factory)) results.extend( input_api.canned_checks.CheckGNFormatted(input_api, output_api)) results.extend(
diff --git a/generator/dawn_gpu_info_generator.py b/generator/dawn_gpu_info_generator.py index 8ad39bb..820f706 100644 --- a/generator/dawn_gpu_info_generator.py +++ b/generator/dawn_gpu_info_generator.py
@@ -39,6 +39,7 @@ class Name: + def __init__(self, name): self.name = name self.chunks = name.split(' ') @@ -78,6 +79,7 @@ class Architecture: + def __init__(self, name, json_data, mask): self.name = Name(name) self.devices = [] @@ -98,6 +100,7 @@ class DeviceSet: + def __init__(self, json_data): self.mask = None self.internal = False @@ -145,6 +148,7 @@ class Vendor: + def __init__(self, name, json_data): self.name = Name(name) self.name_override = None @@ -215,6 +219,7 @@ class DawnGpuInfoGenerator(Generator): + def get_description(self): return "Generates GPU Info Dawn code."
diff --git a/generator/dawn_json_generator.py b/generator/dawn_json_generator.py index 5b8f41e..b06e897 100644 --- a/generator/dawn_json_generator.py +++ b/generator/dawn_json_generator.py
@@ -39,6 +39,7 @@ class Metadata: + def __init__(self, metadata): self.api = metadata['api'] self.namespace = metadata['namespace'] @@ -48,7 +49,9 @@ self.native_namespace = metadata['native_namespace'] self.copyright_year = metadata.get('copyright_year', None) + class Name: + def __init__(self, name, native=False): self.native = native self.name = name @@ -99,6 +102,7 @@ result += chunk.lower() return result + def concat_names(*names): return ' '.join([name.canonical_case() for name in names]) @@ -121,6 +125,7 @@ class Type: + def __init__(self, name, json_data, native=False): self.json_data = json_data self.dict_name = name @@ -138,6 +143,7 @@ class EnumType(Type): + def __init__(self, is_enabled, name, json_data): Type.__init__(self, name, json_data) @@ -209,6 +215,7 @@ class BitmaskType(Type): + def __init__(self, is_enabled, name, json_data): Type.__init__(self, name, json_data) self.values = [ @@ -230,6 +237,7 @@ class FunctionPointerType(Type): + def __init__(self, is_enabled, name, json_data): Type.__init__(self, name, json_data) self.returns = None @@ -237,12 +245,14 @@ class TypedefType(Type): + def __init__(self, is_enabled, name, json_data): Type.__init__(self, name, json_data) self.type = None class NativeType(Type): + def __init__(self, is_enabled, name, json_data): Type.__init__(self, name, json_data, native=True) self.is_wire_transparent = json_data.get('wire transparent', True) @@ -318,6 +328,7 @@ class ObjectType(Type): + def __init__(self, is_enabled, name, json_data): json_data_override = {'methods': []} if 'methods' in json_data: @@ -328,12 +339,14 @@ class Record: + def __init__(self, name): self.name = Name(name) self.members = [] self.may_have_dawn_object = False def update_metadata(self): + def may_have_dawn_object(member): if isinstance(member.type, ObjectType): return True @@ -353,6 +366,7 @@ class StructureType(Record, Type): + def __init__(self, is_enabled, name, json_data): tags = validate_and_get_tags(json_data) if tags == ['emscripten']: @@ -422,12 +436,14 @@ class CallbackInfoType(StructureType): + def __init__(self, is_enabled, name, json_data): StructureType.__init__(self, is_enabled, name, json_data) self.extensible = 'in' class ConstantDefinition(): + def __init__(self, is_enabled, name, json_data): self.type = None self.value = json_data['value'] @@ -437,6 +453,7 @@ class FunctionDeclaration(): + def __init__(self, is_enabled, name, json_data, no_cpp=False): self.returns = None self.arguments = [] @@ -446,6 +463,7 @@ class Command(Record): + def __init__(self, name, members=None): Record.__init__(self, name) self.members = members or [] @@ -515,12 +533,15 @@ obj.methods = [make_method(m) for m in obj.json_data.get('methods', [])] obj.methods.sort(key=lambda method: method.name) + def link_structure(struct, types): struct.members = linked_record_members(struct.json_data['members'], types) for root in struct.json_data.get('chain roots', []): struct.chain_roots.append(types[root]) types[root].extensions.append(struct) - struct.chain_roots = [types[root] for root in struct.json_data.get('chain roots', [])] + struct.chain_roots = [ + types[root] for root in struct.json_data.get('chain roots', []) + ] assert all((root.category == 'structure' for root in struct.chain_roots)) @@ -551,6 +572,7 @@ function.arguments = linked_record_members( function.json_data.get('args', []), types) + # Sort structures so that if struct A has struct B as a member, then B is # listed before A. # @@ -968,7 +990,6 @@ yield member - # Calculate if we should, and can, provide a Kotlin default value for a given argument. # This will affect its order in the method parameter and structure field lists. def kotlin_default(arg): @@ -1194,6 +1215,7 @@ else: return c_prefix + name.CamelCase() + def as_cppType(name): # Special case for 'bool' because it has a typedef for compatibility. if name.native and name.get() != 'bool': @@ -1384,7 +1406,8 @@ def has_callback_arguments(method): - return any(arg.type.category == 'function pointer' for arg in method.arguments) + return any(arg.type.category == 'function pointer' + for arg in method.arguments) # TODO: crbug.com/dawn/2509 - Remove this helper when once we deprecate older APIs. @@ -1483,6 +1506,7 @@ class MultiGeneratorFromDawnJSON(Generator): + def get_description(self): return 'Generates code for various target from Dawn.json.' @@ -1750,24 +1774,27 @@ 'src/' + native_dir + '/ValidationUtils_autogen.h', frontend_params)) renders.append( - FileRender('dawn/native/ValidationUtils.cpp', - 'src/' + native_dir + '/ValidationUtils_autogen.cpp', - frontend_params)) + FileRender( + 'dawn/native/ValidationUtils.cpp', + 'src/' + native_dir + '/ValidationUtils_autogen.cpp', + frontend_params)) renders.append( - FileRender('dawn/native/dawn_platform.h', - 'src/' + native_dir + '/' + prefix + '_platform_autogen.h', - frontend_params)) + FileRender( + 'dawn/native/dawn_platform.h', + 'src/' + native_dir + '/' + prefix + '_platform_autogen.h', + frontend_params)) renders.append( - FileRender('dawn/native/api_structs.h', - 'src/' + native_dir + '/' + namespace + '_structs_autogen.h', - frontend_params)) + FileRender( + 'dawn/native/api_structs.h', 'src/' + native_dir + '/' + + namespace + '_structs_autogen.h', frontend_params)) renders.append( - FileRender('dawn/native/api_structs.cpp', - 'src/' + native_dir + '/' + namespace + '_structs_autogen.cpp', - frontend_params)) + FileRender( + 'dawn/native/api_structs.cpp', 'src/' + native_dir + '/' + + namespace + '_structs_autogen.cpp', frontend_params)) renders.append( FileRender('dawn/native/ProcTable.cpp', - 'src/' + native_dir + '/ProcTable.cpp', frontend_params)) + 'src/' + native_dir + '/ProcTable.cpp', + frontend_params)) renders.append( FileRender('dawn/native/ChainUtils.h', 'src/' + native_dir + '/ChainUtils_autogen.h', @@ -1785,13 +1812,14 @@ 'src/' + native_dir + '/Features_autogen.inl', frontend_params)) renders.append( - FileRender('dawn/native/api_absl_format.h', - 'src/' + native_dir + '/' + api + '_absl_format_autogen.h', - frontend_params)) + FileRender( + 'dawn/native/api_absl_format.h', + 'src/' + native_dir + '/' + api + '_absl_format_autogen.h', + frontend_params)) renders.append( - FileRender('dawn/native/api_absl_format.cpp', - 'src/' + native_dir + '/' + api + '_absl_format_autogen.cpp', - frontend_params)) + FileRender( + 'dawn/native/api_absl_format.cpp', 'src/' + native_dir + + '/' + api + '_absl_format_autogen.cpp', frontend_params)) renders.append( FileRender( 'dawn/native/api_StreamImpl.cpp', 'src/' + native_dir +
diff --git a/generator/dawn_version_generator.py b/generator/dawn_version_generator.py index 71a6fb7..4117747 100644 --- a/generator/dawn_version_generator.py +++ b/generator/dawn_version_generator.py
@@ -30,6 +30,7 @@ from generator_lib import Generator, run_generator, FileRender, GeneratorOutput + def get_git(): # Will find git, git.exe, git.bat... git_exec = shutil.which("git") @@ -83,7 +84,8 @@ stdout=subprocess.PIPE, cwd=dawn_dir) if result.returncode != 0: - raise Exception("Failed to execute git rev-parse to resolve git head:", result.stdout) + raise Exception("Failed to execute git rev-parse to resolve git head:", + result.stdout) resolved = os.path.join(dawn_dir, ".git", result.stdout.decode("utf-8").strip()) @@ -128,6 +130,7 @@ class DawnVersionGenerator(Generator): + def get_description(self): return ( "Generates version dependent Dawn code. Currently regenerated dependent on the version "
diff --git a/generator/generator_lib.py b/generator/generator_lib.py index f417190..45d90ab 100644 --- a/generator/generator_lib.py +++ b/generator/generator_lib.py
@@ -77,8 +77,10 @@ GeneratorOutput = namedtuple('GeneratorOutput', ['renders', 'imported_templates']) + # The interface that must be implemented by generators. class Generator: + def get_description(self): """Return generator description for --help.""" return ""
diff --git a/generator/opengl_loader_generator.py b/generator/opengl_loader_generator.py index 671e006..88dd09f 100644 --- a/generator/opengl_loader_generator.py +++ b/generator/opengl_loader_generator.py
@@ -34,6 +34,7 @@ class ProcName: + def __init__(self, gl_name, proc_name=None): assert gl_name.startswith('gl') if proc_name == None: @@ -59,6 +60,7 @@ class Proc: + def __init__(self, element): # Type declaration for return values and arguments all have the same # (weird) format. @@ -245,6 +247,7 @@ class OpenGLLoaderGenerator(Generator): + def get_description(self): return 'Generates code to load OpenGL function pointers'
diff --git a/go_presubmit_support.py b/go_presubmit_support.py index 61b2715..49285c7 100644 --- a/go_presubmit_support.py +++ b/go_presubmit_support.py
@@ -25,7 +25,6 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - from tools.python import cipd_deps
diff --git a/scripts/extract.py b/scripts/extract.py index ef04036..d27a7bf 100644 --- a/scripts/extract.py +++ b/scripts/extract.py
@@ -35,6 +35,7 @@ class FileEntry(object): + def __init__(self, path, mode, fileobj): self.path = path self.mode = mode @@ -42,6 +43,7 @@ class SymlinkEntry(object): + def __init__(self, path, mode, target): self.path = path self.mode = mode
diff --git a/src/dawn/common/Numeric.h b/src/dawn/common/Numeric.h index c90014c..fc1662b 100644 --- a/src/dawn/common/Numeric.h +++ b/src/dawn/common/Numeric.h
@@ -71,12 +71,12 @@ requires std::integral<T> bool RangesOverlap(T x0, T x1, T y0, T y1) { DAWN_ASSERT(x0 <= x1 && y0 <= y1); - // Two ranges DON'T have overlap if and only if: - // 1. [x0, x1] [y0, y1], or - // 2. [y0, y1] [x0, x1] - // which is (x1 < y0 || y1 < x0) - // The inverse of which ends in the following statement. - return x0 <= y1 && y0 <= x1; + // Two ranges DON'T have overlap if and only if: + // 1. [x0, x1] [y0, y1], or + // 2. [y0, y1] [x0, x1] + // which is (x1 < y0 || y1 < x0) + // The inverse of which ends in the following statement. + return x0 <= y1 && y0 <= x1; } } // namespace dawn
diff --git a/src/dawn/native/BindingInfo.cpp b/src/dawn/native/BindingInfo.cpp index 61de3aa..13bf96a 100644 --- a/src/dawn/native/BindingInfo.cpp +++ b/src/dawn/native/BindingInfo.cpp
@@ -66,7 +66,7 @@ bindingCounts->totalCount += arraySize; - uint32_t PerStageBindingCounts::*perStageBindingCountMember = nullptr; + uint32_t PerStageBindingCounts::* perStageBindingCountMember = nullptr; if (entry->buffer.type != wgpu::BufferBindingType::BindingNotUsed) { bindingCounts->bufferCount += arraySize;
diff --git a/src/dawn/native/Format.cpp b/src/dawn/native/Format.cpp index 3b85b02..82cc46f 100644 --- a/src/dawn/native/Format.cpp +++ b/src/dawn/native/Format.cpp
@@ -743,6 +743,8 @@ AddFormat(internalFormat); }; + // clang-format off + // Depth-stencil formats AddStencilFormat(wgpu::TextureFormat::Stencil8, Format::supported); AddDepthFormat(wgpu::TextureFormat::Depth16Unorm, 2, Format::supported); @@ -841,6 +843,7 @@ const UnsupportedReason multiPlanarFormatNv12aUnsupportedReason = device->HasFeature(Feature::MultiPlanarFormatNv12a) ? Format::supported : RequiresFeature{wgpu::FeatureName::MultiPlanarFormatNv12a}; AddMultiAspectFormat(wgpu::TextureFormat::R8BG8A8Triplanar420Unorm, TextureSubsampling::e420, Aspect::Plane0 | Aspect::Plane1 | Aspect::Plane2, multiPlanarCapabilities, multiPlanarFormatNv12aUnsupportedReason, ComponentCount(4), wgpu::TextureFormat::R8Unorm, wgpu::TextureFormat::RG8Unorm, wgpu::TextureFormat::R8Unorm); + // clang-format on // This checks that each format is set at least once, the second part of checking that all
diff --git a/src/dawn/native/ImmediateConstantsLayout.h b/src/dawn/native/ImmediateConstantsLayout.h index 88b9957..a9718ec 100644 --- a/src/dawn/native/ImmediateConstantsLayout.h +++ b/src/dawn/native/ImmediateConstantsLayout.h
@@ -94,7 +94,7 @@ // representing "userConstants: 4 | trivial_constants: 0 (2 at most)|clamp_frag:2", // maps to pipeline immediate constant layout: "userConstants:4 | clamp_frag:2 template <typename Object, typename Member> -uint32_t GetImmediateByteOffsetInPipeline(Member Object::*ptr, +uint32_t GetImmediateByteOffsetInPipeline(Member Object::* ptr, const ImmediateConstantMask& pipelineImmediateMask) { Object obj = {}; ptrdiff_t offset = reinterpret_cast<char*>(&(obj.*ptr)) - reinterpret_cast<char*>(&obj); @@ -106,7 +106,7 @@ } template <typename Object, typename Member> -bool HasImmediateConstants(Member Object::*ptr, +bool HasImmediateConstants(Member Object::* ptr, const ImmediateConstantMask& pipelineImmediateMask) { Object obj = {}; ptrdiff_t offset = reinterpret_cast<char*>(&(obj.*ptr)) - reinterpret_cast<char*>(&obj);
diff --git a/src/dawn/native/RenderPassWorkaroundsHelper.cpp b/src/dawn/native/RenderPassWorkaroundsHelper.cpp index efc907b..0ade00d 100644 --- a/src/dawn/native/RenderPassWorkaroundsHelper.cpp +++ b/src/dawn/native/RenderPassWorkaroundsHelper.cpp
@@ -321,20 +321,19 @@ attachmentInfo.resolveTarget = nullptr; } - passEndOperations.emplace_back( - [encoder, temporaryResolveAttachments = - std::move(temporaryResolveAttachments)]() -> MaybeError { - // Called once the render pass has been ended. - // Handles any separate resolve passes needed for the - // ResolveMultipleAttachmentInSeparatePasses workaround immediately after the - // render pass ends and before any additional commands are recorded. - for (auto& deferredResolve : temporaryResolveAttachments) { - ResolveWithRenderPass(encoder, deferredResolve.copySrc.Get(), - deferredResolve.copyDst.Get(), - deferredResolve.storeOp); - } - return {}; - }); + passEndOperations.emplace_back([encoder, + temporaryResolveAttachments = std::move( + temporaryResolveAttachments)]() -> MaybeError { + // Called once the render pass has been ended. + // Handles any separate resolve passes needed for the + // ResolveMultipleAttachmentInSeparatePasses workaround immediately after the + // render pass ends and before any additional commands are recorded. + for (auto& deferredResolve : temporaryResolveAttachments) { + ResolveWithRenderPass(encoder, deferredResolve.copySrc.Get(), + deferredResolve.copyDst.Get(), deferredResolve.storeOp); + } + return {}; + }); } }
diff --git a/src/dawn/native/WaitListEvent.cpp b/src/dawn/native/WaitListEvent.cpp index c06d2fe..c7af683 100644 --- a/src/dawn/native/WaitListEvent.cpp +++ b/src/dawn/native/WaitListEvent.cpp
@@ -34,8 +34,7 @@ namespace dawn::native { WaitListEvent::WaitListEvent(uint64_t requiredSignalCount) - : mRemainingSignalCount(requiredSignalCount) { -} + : mRemainingSignalCount(requiredSignalCount) {} WaitListEvent::~WaitListEvent() = default; bool WaitListEvent::IsSignaled() const {
diff --git a/src/dawn/native/d3d12/SamplerHeapCacheD3D12.cpp b/src/dawn/native/d3d12/SamplerHeapCacheD3D12.cpp index f6216f4..2732a07 100644 --- a/src/dawn/native/d3d12/SamplerHeapCacheD3D12.cpp +++ b/src/dawn/native/d3d12/SamplerHeapCacheD3D12.cpp
@@ -48,9 +48,7 @@ SamplerHeapCacheEntry::SamplerHeapCacheEntry(SamplerHeapCache* cache, std::vector<Sampler*> samplers, CPUDescriptorHeapAllocation allocation) - : mCPUAllocation(std::move(allocation)), - mSamplers(std::move(samplers)), - mCache(cache) { + : mCPUAllocation(std::move(allocation)), mSamplers(std::move(samplers)), mCache(cache) { DAWN_ASSERT(mCache != nullptr); DAWN_ASSERT(mCPUAllocation.IsValid()); DAWN_ASSERT(!mSamplers.empty());
diff --git a/src/dawn/native/metal/BackendMTL.mm b/src/dawn/native/metal/BackendMTL.mm index 73fd94a..b7d792d 100644 --- a/src/dawn/native/metal/BackendMTL.mm +++ b/src/dawn/native/metal/BackendMTL.mm
@@ -87,13 +87,13 @@ } #endif - // iOS only has a single device so MTLCopyAllDevices doesn't exist there. + // iOS only has a single device so MTLCopyAllDevices doesn't exist there. #if DAWN_PLATFORM_IS(IOS) - Ref<PhysicalDevice> physicalDevice = AcquireRef(new PhysicalDevice( - GetInstance(), AcquireNSPRef(MTLCreateSystemDefaultDevice()), metalValidationEnabled)); - if (!GetInstance()->ConsumedErrorAndWarnOnce(physicalDevice->Initialize())) { - mPhysicalDevices.push_back(std::move(physicalDevice)); - } + Ref<PhysicalDevice> physicalDevice = AcquireRef(new PhysicalDevice( + GetInstance(), AcquireNSPRef(MTLCreateSystemDefaultDevice()), metalValidationEnabled)); + if (!GetInstance()->ConsumedErrorAndWarnOnce(physicalDevice->Initialize())) { + mPhysicalDevices.push_back(std::move(physicalDevice)); + } #endif return std::vector<Ref<PhysicalDeviceBase>>{mPhysicalDevices};
diff --git a/src/dawn/native/metal/BufferMTL.mm b/src/dawn/native/metal/BufferMTL.mm index 68dd2c4..25750eb 100644 --- a/src/dawn/native/metal/BufferMTL.mm +++ b/src/dawn/native/metal/BufferMTL.mm
@@ -59,7 +59,7 @@ // static uint64_t Buffer::QueryMaxBufferLength(id<MTLDevice> mtlDevice) { - return [mtlDevice maxBufferLength]; + return [mtlDevice maxBufferLength]; } Buffer::Buffer(DeviceBase* dev, const UnpackedPtr<BufferDescriptor>& desc)
diff --git a/src/dawn/native/metal/TextureMTL.mm b/src/dawn/native/metal/TextureMTL.mm index 4ef9c91..eb991a3 100644 --- a/src/dawn/native/metal/TextureMTL.mm +++ b/src/dawn/native/metal/TextureMTL.mm
@@ -423,15 +423,15 @@ } void Texture::SynchronizeTextureBeforeUse(CommandRecordingContext* commandContext) { - SharedTextureMemoryBase::PendingFenceList fences; - SharedResourceMemoryContents* contents = GetSharedResourceMemoryContents(); - if (contents != nullptr) { - contents->AcquirePendingFences(&fences); - } - for (const auto& fence : fences) { - commandContext->WaitForSharedEvent(ToBackend(fence.object)->GetMTLSharedEvent(), - fence.signaledValue); - } + SharedTextureMemoryBase::PendingFenceList fences; + SharedResourceMemoryContents* contents = GetSharedResourceMemoryContents(); + if (contents != nullptr) { + contents->AcquirePendingFences(&fences); + } + for (const auto& fence : fences) { + commandContext->WaitForSharedEvent(ToBackend(fence.object)->GetMTLSharedEvent(), + fence.signaledValue); + } mLastSharedTextureMemoryUsageSerial = GetDevice()->GetQueue()->GetPendingCommandSerial(); }
diff --git a/src/dawn/native/metal/UtilsMetal.mm b/src/dawn/native/metal/UtilsMetal.mm index b1a2fa6..9c6ac19 100644 --- a/src/dawn/native/metal/UtilsMetal.mm +++ b/src/dawn/native/metal/UtilsMetal.mm
@@ -424,122 +424,122 @@ #endif case wgpu::TextureFormat::ETC2RGB8Unorm: - return MTLPixelFormatETC2_RGB8; + return MTLPixelFormatETC2_RGB8; case wgpu::TextureFormat::ETC2RGB8UnormSrgb: - return MTLPixelFormatETC2_RGB8_sRGB; + return MTLPixelFormatETC2_RGB8_sRGB; case wgpu::TextureFormat::ETC2RGB8A1Unorm: - return MTLPixelFormatETC2_RGB8A1; + return MTLPixelFormatETC2_RGB8A1; case wgpu::TextureFormat::ETC2RGB8A1UnormSrgb: - return MTLPixelFormatETC2_RGB8A1_sRGB; + return MTLPixelFormatETC2_RGB8A1_sRGB; case wgpu::TextureFormat::ETC2RGBA8Unorm: - return MTLPixelFormatEAC_RGBA8; + return MTLPixelFormatEAC_RGBA8; case wgpu::TextureFormat::ETC2RGBA8UnormSrgb: - return MTLPixelFormatEAC_RGBA8_sRGB; + return MTLPixelFormatEAC_RGBA8_sRGB; case wgpu::TextureFormat::EACR11Unorm: - return MTLPixelFormatEAC_R11Unorm; + return MTLPixelFormatEAC_R11Unorm; case wgpu::TextureFormat::EACR11Snorm: - return MTLPixelFormatEAC_R11Snorm; + return MTLPixelFormatEAC_R11Snorm; case wgpu::TextureFormat::EACRG11Unorm: - return MTLPixelFormatEAC_RG11Unorm; + return MTLPixelFormatEAC_RG11Unorm; case wgpu::TextureFormat::EACRG11Snorm: - return MTLPixelFormatEAC_RG11Snorm; + return MTLPixelFormatEAC_RG11Snorm; case wgpu::TextureFormat::ASTC4x4Unorm: - return MTLPixelFormatASTC_4x4_LDR; + return MTLPixelFormatASTC_4x4_LDR; case wgpu::TextureFormat::ASTC4x4UnormSrgb: - return MTLPixelFormatASTC_4x4_sRGB; + return MTLPixelFormatASTC_4x4_sRGB; case wgpu::TextureFormat::ASTC5x4Unorm: - return MTLPixelFormatASTC_5x4_LDR; + return MTLPixelFormatASTC_5x4_LDR; case wgpu::TextureFormat::ASTC5x4UnormSrgb: - return MTLPixelFormatASTC_5x4_sRGB; + return MTLPixelFormatASTC_5x4_sRGB; case wgpu::TextureFormat::ASTC5x5Unorm: - return MTLPixelFormatASTC_5x5_LDR; + return MTLPixelFormatASTC_5x5_LDR; case wgpu::TextureFormat::ASTC5x5UnormSrgb: - return MTLPixelFormatASTC_5x5_sRGB; + return MTLPixelFormatASTC_5x5_sRGB; case wgpu::TextureFormat::ASTC6x5Unorm: - return MTLPixelFormatASTC_6x5_LDR; + return MTLPixelFormatASTC_6x5_LDR; case wgpu::TextureFormat::ASTC6x5UnormSrgb: - return MTLPixelFormatASTC_6x5_sRGB; + return MTLPixelFormatASTC_6x5_sRGB; case wgpu::TextureFormat::ASTC6x6Unorm: - return MTLPixelFormatASTC_6x6_LDR; + return MTLPixelFormatASTC_6x6_LDR; case wgpu::TextureFormat::ASTC6x6UnormSrgb: - return MTLPixelFormatASTC_6x6_sRGB; + return MTLPixelFormatASTC_6x6_sRGB; case wgpu::TextureFormat::ASTC8x5Unorm: - return MTLPixelFormatASTC_8x5_LDR; + return MTLPixelFormatASTC_8x5_LDR; case wgpu::TextureFormat::ASTC8x5UnormSrgb: - return MTLPixelFormatASTC_8x5_sRGB; + return MTLPixelFormatASTC_8x5_sRGB; case wgpu::TextureFormat::ASTC8x6Unorm: - return MTLPixelFormatASTC_8x6_LDR; + return MTLPixelFormatASTC_8x6_LDR; case wgpu::TextureFormat::ASTC8x6UnormSrgb: - return MTLPixelFormatASTC_8x6_sRGB; + return MTLPixelFormatASTC_8x6_sRGB; case wgpu::TextureFormat::ASTC8x8Unorm: - return MTLPixelFormatASTC_8x8_LDR; + return MTLPixelFormatASTC_8x8_LDR; case wgpu::TextureFormat::ASTC8x8UnormSrgb: - return MTLPixelFormatASTC_8x8_sRGB; + return MTLPixelFormatASTC_8x8_sRGB; case wgpu::TextureFormat::ASTC10x5Unorm: - return MTLPixelFormatASTC_10x5_LDR; + return MTLPixelFormatASTC_10x5_LDR; case wgpu::TextureFormat::ASTC10x5UnormSrgb: - return MTLPixelFormatASTC_10x5_sRGB; + return MTLPixelFormatASTC_10x5_sRGB; case wgpu::TextureFormat::ASTC10x6Unorm: - return MTLPixelFormatASTC_10x6_LDR; + return MTLPixelFormatASTC_10x6_LDR; case wgpu::TextureFormat::ASTC10x6UnormSrgb: - return MTLPixelFormatASTC_10x6_sRGB; + return MTLPixelFormatASTC_10x6_sRGB; case wgpu::TextureFormat::ASTC10x8Unorm: - return MTLPixelFormatASTC_10x8_LDR; + return MTLPixelFormatASTC_10x8_LDR; case wgpu::TextureFormat::ASTC10x8UnormSrgb: - return MTLPixelFormatASTC_10x8_sRGB; + return MTLPixelFormatASTC_10x8_sRGB; case wgpu::TextureFormat::ASTC10x10Unorm: - return MTLPixelFormatASTC_10x10_LDR; + return MTLPixelFormatASTC_10x10_LDR; case wgpu::TextureFormat::ASTC10x10UnormSrgb: - return MTLPixelFormatASTC_10x10_sRGB; + return MTLPixelFormatASTC_10x10_sRGB; case wgpu::TextureFormat::ASTC12x10Unorm: - return MTLPixelFormatASTC_12x10_LDR; + return MTLPixelFormatASTC_12x10_LDR; case wgpu::TextureFormat::ASTC12x10UnormSrgb: - return MTLPixelFormatASTC_12x10_sRGB; + return MTLPixelFormatASTC_12x10_sRGB; case wgpu::TextureFormat::ASTC12x12Unorm: - return MTLPixelFormatASTC_12x12_LDR; + return MTLPixelFormatASTC_12x12_LDR; case wgpu::TextureFormat::ASTC12x12UnormSrgb: - return MTLPixelFormatASTC_12x12_sRGB; + return MTLPixelFormatASTC_12x12_sRGB; case wgpu::TextureFormat::R8BG8Biplanar420Unorm: case wgpu::TextureFormat::R8BG8Biplanar422Unorm:
diff --git a/src/dawn/native/vulkan/CommandBufferVk.cpp b/src/dawn/native/vulkan/CommandBufferVk.cpp index dfad685..2c8f540 100644 --- a/src/dawn/native/vulkan/CommandBufferVk.cpp +++ b/src/dawn/native/vulkan/CommandBufferVk.cpp
@@ -707,29 +707,29 @@ } } - DAWN_TRY_ASSIGN(framebuffer, - device->GetFramebufferCache()->GetOrCreate( - framebufferQuery, - [&](const FramebufferCacheQuery& query) - -> ResultOrError<VkFramebuffer> { - VkFramebufferCreateInfo createInfo; - createInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; - createInfo.pNext = nullptr; - createInfo.flags = 0; - createInfo.renderPass = renderPassVK; - createInfo.attachmentCount = query.attachmentCount; - createInfo.pAttachments = AsVkArray(query.attachments.data()); - createInfo.width = query.width; - createInfo.height = query.height; - createInfo.layers = 1; + DAWN_TRY_ASSIGN( + framebuffer, + device->GetFramebufferCache()->GetOrCreate( + framebufferQuery, + [&](const FramebufferCacheQuery& query) -> ResultOrError<VkFramebuffer> { + VkFramebufferCreateInfo createInfo; + createInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; + createInfo.pNext = nullptr; + createInfo.flags = 0; + createInfo.renderPass = renderPassVK; + createInfo.attachmentCount = query.attachmentCount; + createInfo.pAttachments = AsVkArray(query.attachments.data()); + createInfo.width = query.width; + createInfo.height = query.height; + createInfo.layers = 1; - VkFramebuffer framebuffer; - DAWN_TRY(CheckVkSuccess( - device->fn.CreateFramebuffer(device->GetVkDevice(), &createInfo, - nullptr, &*framebuffer), - "CreateFramebuffer")); - return framebuffer; - })); + VkFramebuffer framebuffer; + DAWN_TRY(CheckVkSuccess( + device->fn.CreateFramebuffer(device->GetVkDevice(), &createInfo, nullptr, + &*framebuffer), + "CreateFramebuffer")); + return framebuffer; + })); } VkRenderPassBeginInfo beginInfo;
diff --git a/src/dawn/node/binding/GPUShaderModule.cpp b/src/dawn/node/binding/GPUShaderModule.cpp index 315c5cc..4722659 100644 --- a/src/dawn/node/binding/GPUShaderModule.cpp +++ b/src/dawn/node/binding/GPUShaderModule.cpp
@@ -54,8 +54,7 @@ std::string message; explicit GPUCompilationMessage(const wgpu::CompilationMessage& m) - : lineNum(m.lineNum), - message(m.message) { + : lineNum(m.lineNum), message(m.message) { [[maybe_unused]] bool foundUtf16 = false; for (const auto* chain = m.nextInChain; chain != nullptr; chain = chain->nextInChain) { if (chain->sType == wgpu::SType::DawnCompilationMessageUtf16) {
diff --git a/src/dawn/tests/ParamGenerator.h b/src/dawn/tests/ParamGenerator.h index 27f101b..cdc783c 100644 --- a/src/dawn/tests/ParamGenerator.h +++ b/src/dawn/tests/ParamGenerator.h
@@ -101,11 +101,12 @@ : BaseStructName(param), DAWN_PP_CONCATENATE(_Dawn_, StructName) { \ std::forward<Args>(args)... \ } \ - {} \ + { \ + } \ }; \ inline std::ostream& operator<<(std::ostream& o, const StructName& param) { \ o << static_cast<const BaseStructName&>(param); \ - o << static_cast<const DAWN_PP_CONCATENATE(_Dawn_, StructName)&>(param); \ + o << static_cast<const DAWN_PP_CONCATENATE(_Dawn_, StructName) &>(param); \ return o; \ } \ static_assert(true, "require semicolon") @@ -136,10 +137,11 @@ StructName(Args&&... args) : DAWN_PP_CONCATENATE(_Dawn_, StructName) { \ std::forward<Args>(args)... \ } \ - {} \ + { \ + } \ }; \ inline std::ostream& operator<<(std::ostream& o, const StructName& param) { \ - o << static_cast<const DAWN_PP_CONCATENATE(_Dawn_, StructName)&>(param); \ + o << static_cast<const DAWN_PP_CONCATENATE(_Dawn_, StructName) &>(param); \ return o; \ } \ static_assert(true, "require semicolon")
diff --git a/src/dawn/tests/end2end/CopyTests.cpp b/src/dawn/tests/end2end/CopyTests.cpp index de6035b..410a657 100644 --- a/src/dawn/tests/end2end/CopyTests.cpp +++ b/src/dawn/tests/end2end/CopyTests.cpp
@@ -965,9 +965,7 @@ TextureSpec() { format = GetParam().mTextureFormat; } }; - void SetUp() override { - DawnTestWithParams<CopyTextureFormatParams>::SetUp(); - } + void SetUp() override { DawnTestWithParams<CopyTextureFormatParams>::SetUp(); } }; class CopyTests_T2T_Srgb : public CopyTests_T2TBase<DawnTestWithParams<CopyTextureFormatParams>> {
diff --git a/src/dawn/tests/end2end/DepthStencilStateTests.cpp b/src/dawn/tests/end2end/DepthStencilStateTests.cpp index e17337d..49b1234 100644 --- a/src/dawn/tests/end2end/DepthStencilStateTests.cpp +++ b/src/dawn/tests/end2end/DepthStencilStateTests.cpp
@@ -731,8 +731,8 @@ { {baseState, utils::RGBA8(255, 255, 255, 255), 1.f, 1}, // Triangle to set stencil value to 1 - {state, utils::RGBA8(0, 0, 0, 255), 0.f, - 2} // Triangle with stencil reference 2 fails the Less comparison function + {state, utils::RGBA8(0, 0, 0, 255), 0.f, 2} + // Triangle with stencil reference 2 fails the Less comparison function }, 2); // Replace the stencil on failure, so it should be 2 }
diff --git a/src/dawn/tests/end2end/EventTests.cpp b/src/dawn/tests/end2end/EventTests.cpp index efd6c19..b20bb75 100644 --- a/src/dawn/tests/end2end/EventTests.cpp +++ b/src/dawn/tests/end2end/EventTests.cpp
@@ -171,11 +171,11 @@ void UseSecondInstance() { wgpu::InstanceDescriptor desc; - static constexpr auto kTimedWaitAny = wgpu::InstanceFeatureName::TimedWaitAny; - desc.requiredFeatureCount = 1; - desc.requiredFeatures = &kTimedWaitAny; - std::tie(testInstance, testDevice) = CreateExtraInstance(GetWireHelper(), &desc); - testQueue = testDevice.GetQueue(); + static constexpr auto kTimedWaitAny = wgpu::InstanceFeatureName::TimedWaitAny; + desc.requiredFeatureCount = 1; + desc.requiredFeatures = &kTimedWaitAny; + std::tie(testInstance, testDevice) = CreateExtraInstance(GetWireHelper(), &desc); + testQueue = testDevice.GetQueue(); } void LoseTestDevice() {
diff --git a/src/dawn/tests/end2end/MultiDrawIndirectTests.cpp b/src/dawn/tests/end2end/MultiDrawIndirectTests.cpp index 805b711..9155690 100644 --- a/src/dawn/tests/end2end/MultiDrawIndirectTests.cpp +++ b/src/dawn/tests/end2end/MultiDrawIndirectTests.cpp
@@ -168,10 +168,7 @@ } // TODO(crbug.com/462151798): Implement MultiDraw*Indirect for WebGPU backend. -DAWN_INSTANTIATE_TEST(MultiDrawIndirectTest, - VulkanBackend(), - D3D12Backend(), - MetalBackend()); +DAWN_INSTANTIATE_TEST(MultiDrawIndirectTest, VulkanBackend(), D3D12Backend(), MetalBackend()); class MultiDrawIndirectUsingFirstVertexTest : public DawnTest { protected:
diff --git a/src/dawn/tests/unittests/RefBaseTests.cpp b/src/dawn/tests/unittests/RefBaseTests.cpp index 738c089..9ade439 100644 --- a/src/dawn/tests/unittests/RefBaseTests.cpp +++ b/src/dawn/tests/unittests/RefBaseTests.cpp
@@ -116,7 +116,9 @@ Ref ref(tracker1); events.clear(); - { ref.Acquire(tracker2); } + { + ref.Acquire(tracker2); + } EXPECT_THAT(events, testing::ElementsAre(Event{Action::kRelease, 1}, // release ref Event{Action::kAssign, 1, 2} // acquire tracker2 )); @@ -128,7 +130,9 @@ Ref ref(tracker); events.clear(); - { [[maybe_unused]] auto ptr = ref.Detach(); } + { + [[maybe_unused]] auto ptr = ref.Detach(); + } EXPECT_THAT(events, testing::ElementsAre(Event{Action::kAssign, 1, 0} // nullify ref )); } @@ -253,7 +257,9 @@ Ref& self = ref; events.clear(); - { ref = std::move(self); } + { + ref = std::move(self); + } EXPECT_THAT(events, testing::ElementsAre()); } @@ -278,7 +284,9 @@ Ref ref; events.clear(); - { ref = std::move(tracker); } + { + ref = std::move(tracker); + } EXPECT_THAT(events, testing::ElementsAre(Event{Action::kAddRef, 1}, // Event{Action::kAssign, 0, 1})); }
diff --git a/src/dawn/tests/unittests/SystemUtilsTests.cpp b/src/dawn/tests/unittests/SystemUtilsTests.cpp index f3ee60a..2397c57 100644 --- a/src/dawn/tests/unittests/SystemUtilsTests.cpp +++ b/src/dawn/tests/unittests/SystemUtilsTests.cpp
@@ -70,7 +70,9 @@ SetEnvironmentVar("ScopedEnvironmentVarForTest", "original"); // Test empty environment variable doesn't crash - { ScopedEnvironmentVar var; } + { + ScopedEnvironmentVar var; + } // Test setting empty environment variable {
diff --git a/src/dawn/tests/unittests/TypedIntegerTests.cpp b/src/dawn/tests/unittests/TypedIntegerTests.cpp index 18bdf45..29e0392 100644 --- a/src/dawn/tests/unittests/TypedIntegerTests.cpp +++ b/src/dawn/tests/unittests/TypedIntegerTests.cpp
@@ -429,24 +429,24 @@ TEST_F(TypedIntegerDeathTest, UnsignedAdditionOverflow) { Unsigned value(std::numeric_limits<uint32_t>::max() - 1); - value + Unsigned(1); // Doesn't overflow. - EXPECT_DEATH(value + Unsigned(2), ""); // Overflows. + value + Unsigned(1); // Doesn't overflow. + EXPECT_DEATH(value + Unsigned(2), ""); // Overflows. EXPECT_DEATH(value += Unsigned(2), ""); // Overflows. } TEST_F(TypedIntegerDeathTest, SignedAdditionOverflow) { Signed value(std::numeric_limits<int32_t>::max() - 1); - value + Signed(1); // Doesn't overflow. - EXPECT_DEATH(value + Signed(2), ""); // Overflows. + value + Signed(1); // Doesn't overflow. + EXPECT_DEATH(value + Signed(2), ""); // Overflows. EXPECT_DEATH(value += Signed(2), ""); // Overflows. } TEST_F(TypedIntegerDeathTest, SignedAdditionUnderflow) { Signed value(std::numeric_limits<int32_t>::min() + 1); - value + Signed(-1); // Doesn't underflow. - EXPECT_DEATH(value + Signed(-2), ""); // Underflows. + value + Signed(-1); // Doesn't underflow. + EXPECT_DEATH(value + Signed(-2), ""); // Underflows. EXPECT_DEATH(value += Signed(-2), ""); // Underflows. } @@ -461,16 +461,16 @@ TEST_F(TypedIntegerDeathTest, SignedSubtractionOverflow) { Signed value(std::numeric_limits<int32_t>::max() - 1); - value - Signed(-1); // Doesn't overflow. - EXPECT_DEATH(value - Signed(-2), ""); // Overflows. + value - Signed(-1); // Doesn't overflow. + EXPECT_DEATH(value - Signed(-2), ""); // Overflows. EXPECT_DEATH(value -= Signed(-2), ""); // Overflows. } TEST_F(TypedIntegerDeathTest, SignedSubtractionUnderflow) { Signed value(std::numeric_limits<int32_t>::min() + 1); - value - Signed(1); // Doesn't underflow. - EXPECT_DEATH(value - Signed(2), ""); // Underflows. + value - Signed(1); // Doesn't underflow. + EXPECT_DEATH(value - Signed(2), ""); // Underflows. EXPECT_DEATH(value -= Signed(2), ""); // Underflows. }
diff --git a/src/dawn/tests/unittests/d3d12/CopySplitTests.cpp b/src/dawn/tests/unittests/d3d12/CopySplitTests.cpp index 9e78c19..5de1b0d 100644 --- a/src/dawn/tests/unittests/d3d12/CopySplitTests.cpp +++ b/src/dawn/tests/unittests/d3d12/CopySplitTests.cpp
@@ -58,8 +58,8 @@ }; struct BufferSpec { - uint64_t offset; // byte offset into buffer to copy to/from - uint32_t bytesPerRow; // bytes per block row (multiples of 256), aka row pitch + uint64_t offset; // byte offset into buffer to copy to/from + uint32_t bytesPerRow; // bytes per block row (multiples of 256), aka row pitch BlockCount rowsPerImage; // bock rows per image slice (user-defined) };
diff --git a/src/dawn/tests/unittests/native/mocks/ShaderModuleMock.cpp b/src/dawn/tests/unittests/native/mocks/ShaderModuleMock.cpp index b8f3ea1..96e88e8 100644 --- a/src/dawn/tests/unittests/native/mocks/ShaderModuleMock.cpp +++ b/src/dawn/tests/unittests/native/mocks/ShaderModuleMock.cpp
@@ -53,7 +53,6 @@ Ref<ShaderModuleMock> ShaderModuleMock::Create( DeviceMock* device, const UnpackedPtr<ShaderModuleDescriptor>& descriptor) { - Ref<ShaderModuleMock> shaderModule = AcquireRef(new NiceMock<ShaderModuleMock>(device, descriptor)); shaderModule->Initialize();
diff --git a/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp b/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp index 0cfeafd..2dc2bf2 100644 --- a/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/BindGroupValidationTests.cpp
@@ -72,7 +72,9 @@ descriptor.usage = wgpu::BufferUsage::Storage; mSSBO = device.CreateBuffer(&descriptor); } - { mSampler = device.CreateSampler(); } + { + mSampler = device.CreateSampler(); + } { mSampledTexture = CreateTexture(wgpu::TextureUsage::TextureBinding, kDefaultTextureFormat, 1);
diff --git a/src/dawn/tests/unittests/validation/QueueWriteTextureValidationTests.cpp b/src/dawn/tests/unittests/validation/QueueWriteTextureValidationTests.cpp index 4a70af0..b2ad931 100644 --- a/src/dawn/tests/unittests/validation/QueueWriteTextureValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/QueueWriteTextureValidationTests.cpp
@@ -734,7 +734,9 @@ wgpu::Extent3D smallestValidExtent3D = {blockWidth, blockHeight, 1}; // Valid usages of ImageExtent in WriteTexture with compressed texture formats. - { TestWriteTexture(512, 0, 256, 4, texture, 0, {0, 0, 0}, smallestValidExtent3D); } + { + TestWriteTexture(512, 0, 256, 4, texture, 0, {0, 0, 0}, smallestValidExtent3D); + } // Valid usages of ImageExtent in WriteTexture with compressed texture formats // and non-zero mipmap levels.
diff --git a/src/dawn/tests/unittests/validation/SamplerValidationTests.cpp b/src/dawn/tests/unittests/validation/SamplerValidationTests.cpp index fd1aa4c..ae6b398 100644 --- a/src/dawn/tests/unittests/validation/SamplerValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/SamplerValidationTests.cpp
@@ -37,7 +37,9 @@ // Test NaN and INFINITY values are not allowed TEST_F(SamplerValidationTest, InvalidLOD) { - { device.CreateSampler(); } + { + device.CreateSampler(); + } { wgpu::SamplerDescriptor samplerDesc; samplerDesc.lodMinClamp = NAN; @@ -106,7 +108,9 @@ kValidAnisoSamplerDesc.minFilter = wgpu::FilterMode::Linear; kValidAnisoSamplerDesc.magFilter = wgpu::FilterMode::Linear; kValidAnisoSamplerDesc.mipmapFilter = wgpu::MipmapFilterMode::Linear; - { device.CreateSampler(); } + { + device.CreateSampler(); + } { wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc; samplerDesc.maxAnisotropy = 16; @@ -140,7 +144,9 @@ kValidAnisoSamplerDesc.minFilter = wgpu::FilterMode::Undefined; kValidAnisoSamplerDesc.magFilter = wgpu::FilterMode::Undefined; kValidAnisoSamplerDesc.mipmapFilter = wgpu::MipmapFilterMode::Undefined; - { device.CreateSampler(); } + { + device.CreateSampler(); + } } } // anonymous namespace
diff --git a/src/dawn/tests/unittests/validation/TextureViewValidationTests.cpp b/src/dawn/tests/unittests/validation/TextureViewValidationTests.cpp index 7d19ebe..ec6bc5d 100644 --- a/src/dawn/tests/unittests/validation/TextureViewValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/TextureViewValidationTests.cpp
@@ -463,7 +463,9 @@ constexpr uint32_t kDefaultArrayLayers = 8; wgpu::Texture texture = Create2DArrayTexture(device, kDefaultArrayLayers); - { texture.CreateView(); } + { + texture.CreateView(); + } { wgpu::TextureViewDescriptor descriptor; descriptor.format = wgpu::TextureFormat::Undefined; @@ -527,7 +529,9 @@ constexpr uint32_t kDefaultArrayLayers = 1; wgpu::Texture texture = Create2DArrayTexture(device, kDefaultArrayLayers); - { texture.CreateView(); } + { + texture.CreateView(); + } { wgpu::TextureViewDescriptor descriptor; descriptor.format = wgpu::TextureFormat::Undefined; @@ -570,7 +574,9 @@ TEST_F(TextureViewValidationTest, TextureViewDescriptorDefaults3D) { wgpu::Texture texture = Create3DTexture(device); - { texture.CreateView(); } + { + texture.CreateView(); + } { wgpu::TextureViewDescriptor descriptor; descriptor.format = wgpu::TextureFormat::Undefined;
diff --git a/src/dawn/tests/unittests/validation/YCbCrInfoValidationTests.cpp b/src/dawn/tests/unittests/validation/YCbCrInfoValidationTests.cpp index 284b9ac..86dbf0a 100644 --- a/src/dawn/tests/unittests/validation/YCbCrInfoValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/YCbCrInfoValidationTests.cpp
@@ -143,6 +143,5 @@ texture.CreateView(&descriptor); } - } // anonymous namespace } // namespace dawn
diff --git a/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp b/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp index eb644d7..c0978dc 100644 --- a/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp +++ b/src/dawn/tests/white_box/D3D12DescriptorHeapTests.cpp
@@ -296,7 +296,6 @@ return vec4f(0.0, 0.0, 0.0, 0.0); })"); - wgpu::Sampler sampler = device.CreateSampler(); Device* d3dDevice = reinterpret_cast<Device*>(device.Get());
diff --git a/src/dawn/tests/white_box/GPUTimestampCalibrationTests_Metal.mm b/src/dawn/tests/white_box/GPUTimestampCalibrationTests_Metal.mm index 70a5cd6..06b9237 100644 --- a/src/dawn/tests/white_box/GPUTimestampCalibrationTests_Metal.mm +++ b/src/dawn/tests/white_box/GPUTimestampCalibrationTests_Metal.mm
@@ -39,13 +39,10 @@ mBackendDevice = dawn::native::metal::ToBackend(dawn::native::FromAPI(device.Get())); } - bool IsSupported() const override { - return true; - } + bool IsSupported() const override { return true; } void GetTimestampCalibration(uint64_t* gpuTimestamp, uint64_t* cpuTimestamp) override { - [mBackendDevice->GetMTLDevice() sampleTimestamps:cpuTimestamp - gpuTimestamp:gpuTimestamp]; + [mBackendDevice->GetMTLDevice() sampleTimestamps:cpuTimestamp gpuTimestamp:gpuTimestamp]; } float GetTimestampPeriod() const override { return mBackendDevice->GetTimestampPeriodInNS(); }
diff --git a/src/emdawnwebgpu/pkg/emdawnwebgpu.port.py b/src/emdawnwebgpu/pkg/emdawnwebgpu.port.py index 651ea19..32db5ad 100644 --- a/src/emdawnwebgpu/pkg/emdawnwebgpu.port.py +++ b/src/emdawnwebgpu/pkg/emdawnwebgpu.port.py
@@ -130,6 +130,7 @@ # Hooks that affect linker invocations + def _compute_library_compile_flags(settings): # Emscripten automatically handles many necessary compile flags (LTO, PIC, # wasm64). The ones it does not handle are handled below.
diff --git a/src/tint/lang/core/ir/transform/conversion_polyfill.cc b/src/tint/lang/core/ir/transform/conversion_polyfill.cc index 1faf8b1..075c4e2 100644 --- a/src/tint/lang/core/ir/transform/conversion_polyfill.cc +++ b/src/tint/lang/core/ir/transform/conversion_polyfill.cc
@@ -117,7 +117,6 @@ ir::Constant* high_limit_f = nullptr; } limits; - // Largest integers representable in the source floating point format. if (src_el_ty->Is<type::F32>()) { // These values are chosen specifically to enable f32 clamping.
diff --git a/src/tint/lang/core/number_test.cc b/src/tint/lang/core/number_test.cc index 21fa1e2..5ed6676 100644 --- a/src/tint/lang/core/number_test.cc +++ b/src/tint/lang/core/number_test.cc
@@ -460,7 +460,8 @@ #undef OVERFLOW // corecrt_math.h :( #endif #define OVERFLOW \ - {} + { \ + } // An error value. IEEE 754 exceptions map to this, including overflow, // invalid operation, and division by zero.
diff --git a/src/tint/lang/wgsl/resolver/clip_distances_extension_test.cc b/src/tint/lang/wgsl/resolver/clip_distances_extension_test.cc index 357c07c..dde265a 100644 --- a/src/tint/lang/wgsl/resolver/clip_distances_extension_test.cc +++ b/src/tint/lang/wgsl/resolver/clip_distances_extension_test.cc
@@ -31,7 +31,7 @@ namespace tint::resolver { -using namespace tint::core::fluent_types; // NOLINT +using namespace tint::core::fluent_types; // NOLINT using namespace tint::core::number_suffixes; // NOLINT namespace {
diff --git a/src/tint/tint_gdb.py b/src/tint/tint_gdb.py index d98c9d9..02e7503 100644 --- a/src/tint/tint_gdb.py +++ b/src/tint/tint_gdb.py
@@ -43,7 +43,6 @@ # OTOH, it's less useful when using gdb/lldb's print command. _DISPLAY_MEMBERS_AS_CHILDREN = False - # Tips for debugging using VS Code: # - Set a breakpoint where you can view the types you want to debug/write pretty printers for. # - Debug Console: source /path/to/dawn/src/tint/tint_gdb.py @@ -57,7 +56,6 @@ # Types: https://sourceware.org/gdb/onlinedocs/gdb/Types-In-Python.html#Types-In-Python # Values: https://sourceware.org/gdb/onlinedocs/gdb/Values-From-Inferior.html#Values-From-Inferior - pp_set = gdb.printing.RegexpCollectionPrettyPrinter("tint") @@ -243,5 +241,4 @@ pp_set.add_printer('UtilsHashmap', '^tint::Hashmap<.*>$', UtilsHashmapPrinter) - gdb.printing.register_pretty_printer(gdb, pp_set, replace=_DEBUGGING)
diff --git a/src/tint/tint_lldb.py b/src/tint/tint_lldb.py index 989dc6c..ad53edd 100644 --- a/src/tint/tint_lldb.py +++ b/src/tint/tint_lldb.py
@@ -85,8 +85,10 @@ if sys.version_info[0] == 2: # python2-based LLDB accepts utf8-encoded ascii strings only. - def to_lldb_str(s): return s.encode( - 'utf8', 'backslashreplace') if isinstance(s, unicode) else s + def to_lldb_str(s): + return s.encode('utf8', 'backslashreplace') if isinstance( + s, unicode) else s + range = xrange else: to_lldb_str = str @@ -119,16 +121,17 @@ def attach_synthetic_to_type(synth_class, type_name, is_regex=False): global module, tint_category - synth = lldb.SBTypeSynthetic.CreateWithClassName( - __name__ + '.' + synth_class.__name__) + synth = lldb.SBTypeSynthetic.CreateWithClassName(__name__ + '.' + + synth_class.__name__) synth.SetOptions(lldb.eTypeOptionCascade) ret = tint_category.AddTypeSynthetic( lldb.SBTypeNameSpecifier(type_name, is_regex), synth) log.debug('attaching synthetic %s to "%s", is_regex=%s -> %s', synth_class.__name__, type_name, is_regex, ret) - def summary_fn(valobj, dict): return get_synth_summary( - synth_class, valobj, dict) + def summary_fn(valobj, dict): + return get_synth_summary(synth_class, valobj, dict) + # LLDB accesses summary fn's by name, so we need to create a unique one. summary_fn.__name__ = '_get_synth_summary_' + synth_class.__name__ setattr(module, summary_fn.__name__, summary_fn) @@ -137,8 +140,8 @@ def attach_summary_to_type(summary_fn, type_name, is_regex=False): global module, tint_category - summary = lldb.SBTypeSummary.CreateWithFunctionName( - __name__ + '.' + summary_fn.__name__) + summary = lldb.SBTypeSummary.CreateWithFunctionName(__name__ + '.' + + summary_fn.__name__) summary.SetOptions(lldb.eTypeOptionCascade) ret = tint_category.AddTypeSummary( lldb.SBTypeNameSpecifier(type_name, is_regex), summary) @@ -232,7 +235,8 @@ self.elem_size = self.elem_type.GetByteSize() def get_summary(self): - return 'length={} capacity={}'.format(self.len.GetValueAsUnsigned(), self.cap.GetValueAsUnsigned()) + return 'length={} capacity={}'.format(self.len.GetValueAsUnsigned(), + self.cap.GetValueAsUnsigned()) def num_children(self): # NOTE: VS Code on MacOS hangs if we try to expand something too large, so put an artificial limit @@ -248,7 +252,8 @@ return None # TODO: return self.value_at(index) offset = index * self.elem_size - return self.data.CreateChildAtOffset('[%s]' % index, offset, self.elem_type) + return self.data.CreateChildAtOffset('[%s]' % index, offset, + self.elem_type) except Exception as e: log.error('%s', e) raise @@ -256,7 +261,8 @@ def value_at(self, index): '''Returns array value at index''' offset = index * self.elem_size - return self.data.CreateChildAtOffset('[%s]' % index, offset, self.elem_type) + return self.data.CreateChildAtOffset('[%s]' % index, offset, + self.elem_type) class UtilsVectorPrinter(Printer): @@ -270,7 +276,8 @@ def get_summary(self): using_heap = self.cap.GetValueAsUnsigned() > self.fixed_size - return 'heap={} {}'.format(using_heap, self.slice_printer.get_summary()) + return 'heap={} {}'.format(using_heap, + self.slice_printer.get_summary()) def num_children(self): return self.slice_printer.num_children() @@ -294,7 +301,8 @@ self.can_move = self.member('can_move_') def get_summary(self): - return 'can_move={} {}'.format(self.can_move.GetValue(), self.slice_printer.get_summary()) + return 'can_move={} {}'.format(self.can_move.GetValue(), + self.slice_printer.get_summary()) def num_children(self): return self.slice_printer.num_children() @@ -344,7 +352,8 @@ # the default printer for std::optional. kvp = slot, entry - return kvp[1].CreateChildAtOffset('[{}]'.format(kvp[0]), 0, kvp[1].GetType()) + return kvp[1].CreateChildAtOffset('[{}]'.format(kvp[0]), 0, + kvp[1].GetType()) def try_read_std_optional(self, slot, entry): return None
diff --git a/src/tint/utils/bytes/swap.h b/src/tint/utils/bytes/swap.h index dcabecf..632f723 100644 --- a/src/tint/utils/bytes/swap.h +++ b/src/tint/utils/bytes/swap.h
@@ -35,7 +35,6 @@ #include "src/tint/utils/macros/compiler.h" - namespace tint::bytes { /// @returns the input value with all bytes reversed @@ -60,5 +59,4 @@ } // namespace tint::bytes - #endif // SRC_TINT_UTILS_BYTES_SWAP_H_
diff --git a/src/tint/utils/command/command_posix.cc b/src/tint/utils/command/command_posix.cc index f528c7a..ba510d3 100644 --- a/src/tint/utils/command/command_posix.cc +++ b/src/tint/utils/command/command_posix.cc
@@ -117,7 +117,7 @@ }; bool ExecutableExists(const std::string& path) { - struct stat s {}; + struct stat s{}; if (stat(path.c_str(), &s) != 0) { return false; }
diff --git a/src/tint/utils/diagnostic/source_test.cc b/src/tint/utils/diagnostic/source_test.cc index 4c9df84..36c0ada 100644 --- a/src/tint/utils/diagnostic/source_test.cc +++ b/src/tint/utils/diagnostic/source_test.cc
@@ -120,7 +120,7 @@ Source::FileContent fc("X" kLF // 1 "XX" kCR kLF // 2 "X" kCR // 3 - kLS // 4 + kLS // 4 "XX" // 5 ); auto& range = GetParam().first;
diff --git a/src/tint/utils/macros/defer_test.cc b/src/tint/utils/macros/defer_test.cc index e5c10b0..5fa69e4 100644 --- a/src/tint/utils/macros/defer_test.cc +++ b/src/tint/utils/macros/defer_test.cc
@@ -34,7 +34,9 @@ TEST(DeferTest, Basic) { bool deferCalled = false; - { TINT_DEFER(deferCalled = true); } + { + TINT_DEFER(deferCalled = true); + } ASSERT_TRUE(deferCalled); }
diff --git a/src/tint/utils/rtti/castable.h b/src/tint/utils/rtti/castable.h index 6a9cc0d..4c0a22d 100644 --- a/src/tint/utils/rtti/castable.h +++ b/src/tint/utils/rtti/castable.h
@@ -73,7 +73,8 @@ /// True if all template types that are not Ignore derive from CastableBase template <typename... TYPES> static constexpr bool IsCastable = - ((tint::traits::IsTypeOrDerived<TYPES, CastableBase> || std::is_same_v<TYPES, Ignore>)&&...) && + ((tint::traits::IsTypeOrDerived<TYPES, CastableBase> || std::is_same_v<TYPES, Ignore>) && + ...) && !(std::is_same_v<TYPES, Ignore> && ...); /// Helper macro to instantiate the TypeInfo<T> template for `CLASS`.
diff --git a/test/tint/parse_hlsl_errors.py b/test/tint/parse_hlsl_errors.py index 231b709..6234d8b 100644 --- a/test/tint/parse_hlsl_errors.py +++ b/test/tint/parse_hlsl_errors.py
@@ -44,6 +44,7 @@ parser.set_defaults(ir_only=False) args = parser.parse_args() + def add_error(error_to_files, error, file): error = error.strip() if not error in error_to_files: @@ -51,6 +52,7 @@ else: error_to_files[error].append(file) + def find_error(f, all_lines, error_to_files, is_fxc): # Search for specific errors from top to bottom for line in all_lines: @@ -71,13 +73,13 @@ # DXC if not is_fxc: if line.startswith('error: validation errors'): - continue # Skip line, next line should have better error + continue # Skip line, next line should have better error if line.startswith('error:'): add_error(error_to_files, line, f) return True - m = re.search('.*\.hlsl:[0-9]+:.*?(error.*)', line) # DXC??? + m = re.search('.*\.hlsl:[0-9]+:.*?(error.*)', line) # DXC??? if m: add_error(error_to_files, m.groups()[0], f) return True @@ -102,9 +104,9 @@ with open(f, "r") as fs: all_lines = fs.readlines() first_line = all_lines[0] - if not first_line.startswith("SKIP:"): # Only process SKIPs + if not first_line.startswith("SKIP:"): # Only process SKIPs continue - if first_line.startswith("SKIP: INVALID"): # Except for INVALIDs + if first_line.startswith("SKIP: INVALID"): # Except for INVALIDs continue found_error = find_error(f, all_lines, error_to_files, is_fxc) @@ -112,8 +114,9 @@ # If no error message was found, add the SKIP line as it may contain the reason for skipping add_error(error_to_files, first_line, f) - for error,files in sorted(error_to_files.items()): - print('[{}] {} (count: {})'.format('fxc' if is_fxc else 'dxc', error, len(files))) + for error, files in sorted(error_to_files.items()): + print('[{}] {} (count: {})'.format('fxc' if is_fxc else 'dxc', error, + len(files))) if args.list_files: for f in files: print('\t{}'.format(f))
diff --git a/tools/fetch_dawn_dependencies.py b/tools/fetch_dawn_dependencies.py index 151a26c..74bc7ce 100644 --- a/tools/fetch_dawn_dependencies.py +++ b/tools/fetch_dawn_dependencies.py
@@ -225,6 +225,7 @@ Mock Var class, that the content of DEPS files assume to exist when they are exec-ed. """ + def __init__(self, name): self.name = name