diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..7d5239b3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,350 @@ +# Remove the line below if you want to inherit .editorconfig settings from higher directories +root = true + +# All files +[*] + +#### Core EditorConfig Options #### + +# Encoding +charset = utf-8 + +# Indentation and spacing +tab_width = 4 +indent_size = 4 +indent_style = space + +# New line preferences +insert_final_newline = false +trim_trailing_whitespace = true + +#### Build files #### + +# Solution files +[*.{sln,slnx}] +tab_width = 4 +indent_size = 4 +indent_style = tab + +# Configuration files +[*.{json,xml,yml,config,runsettings}] +indent_size = 2 + +# MSBuild files +[*.{slnf,props,targets,projitems,csproj,shproj}] +indent_size = 2 + +#### Source files #### + +# Markdown files +[*.md] +indent_size = 2 +insert_final_newline = true + +# XAML files +[*.xaml] +indent_size = 4 + +# C# files +[*.cs] + +#### .NET Coding Conventions #### + +# this. and Me. preferences +dotnet_style_qualification_for_event = false:warning +dotnet_style_qualification_for_field = true:warning +dotnet_style_qualification_for_method = false:warning +dotnet_style_qualification_for_property = false:warning + +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true:warning +dotnet_style_predefined_type_for_member_access = true:warning + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning + +# Modifier preferences (set to silent until https://github.com/dotnet/roslyn/issues/52904 is resolved) +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent + +# Code block preferences +dotnet_style_allow_multiple_blank_lines_experimental = false:warning +dotnet_style_allow_statement_immediately_after_block_experimental = false:warning + +# Expression-level preferences +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_inlined_variable_declaration = true:warning +csharp_style_throw_expression = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_object_initializer = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:warning +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning +csharp_style_implicit_object_creation_when_type_is_apparent = true:warning + +# Field preferences +dotnet_style_readonly_field = true:warning + +#### C# Coding Conventions #### + +# var preferences +csharp_style_var_elsewhere = false:warning +csharp_style_var_for_built_in_types = false:warning +csharp_style_var_when_type_is_apparent = false:warning + +# Expression-bodied members +csharp_style_expression_bodied_accessors = when_on_single_line:warning +csharp_style_expression_bodied_constructors = false:warning +csharp_style_expression_bodied_indexers = when_on_single_line:warning +csharp_style_expression_bodied_lambdas = when_on_single_line:warning +csharp_style_expression_bodied_methods = false:warning +csharp_style_expression_bodied_operators = when_on_single_line:warning +csharp_style_expression_bodied_properties = when_on_single_line:warning + +# Pattern matching preferences +csharp_style_prefer_pattern_matching = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion + +# Null-checking preferences +csharp_style_conditional_delegate_call = true:suggestion + +# Modifier preferences +csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async + +# Code-block preferences +csharp_prefer_braces = true:suggestion +csharp_using_directive_placement = outside_namespace:warning +csharp_style_namespace_declarations = file_scoped:warning +csharp_style_unused_value_assignment_preference = discard_variable:warning +csharp_style_unused_value_expression_statement_preference = discard_variable:warning +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:warning + +# Expression-level preferences +csharp_prefer_simple_default_expression = true:suggestion +csharp_prefer_static_local_function = true:warning +csharp_style_pattern_local_over_anonymous_function = true:warning + +#### C# Formatting Rules #### + +# New line preferences +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = false +csharp_indent_labels = no_change +csharp_indent_switch_labels = true + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Wrapping preferences +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true + +# Naming Symbols + +# constant_fields - Define constant fields +dotnet_naming_symbols.constant_fields.applicable_accessibilities = * +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.required_modifiers = const +# static_readonly_fields - Define all static readonly fields +dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = * +dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly +# non_private_fields - Define all fields that are not private +dotnet_naming_symbols.non_private_fields.applicable_accessibilities = public, internal, protected, protected_internal, private_protected +dotnet_naming_symbols.non_private_fields.applicable_kinds = field +# private_fields - Define all private fields +dotnet_naming_symbols.private_fields.applicable_accessibilities = private +dotnet_naming_symbols.private_fields.applicable_kinds = field +# public_symbols - Define any public symbol +dotnet_naming_symbols.public_symbols.applicable_accessibilities = * +dotnet_naming_symbols.public_symbols.applicable_kinds = method, property, event, delegate, class, struct, enum, delegate +# parameters - Defines any parameter +dotnet_naming_symbols.parameters.applicable_accessibilities = * +dotnet_naming_symbols.parameters.applicable_kinds = parameter +# interface_types - Defines interfaces +dotnet_naming_symbols.interface_types.applicable_accessibilities = * +dotnet_naming_symbols.interface_types.applicable_kinds = interface + +# Naming Styles + +# camel_case - Define the camelCase style +dotnet_naming_style.camel_case.capitalization = camel_case +# pascal_case - Define the PascalCase style +dotnet_naming_style.pascal_case.capitalization = pascal_case +# prefix_interface_interface_with_i - Interfaces must be PascalCase and the first character of an interface must be an 'I' +dotnet_naming_style.prefix_interface_interface_with_i.capitalization = pascal_case +dotnet_naming_style.prefix_interface_interface_with_i.required_prefix = I + +# Naming Rules + +# Async methods should have the "Async" suffix (disabled because it can't currently exclude async void methods) +dotnet_naming_rule.async_methods_end_in_async.severity = none +dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods +dotnet_naming_rule.async_methods_end_in_async.style = end_in_async + +dotnet_naming_symbols.any_async_methods.applicable_kinds = method +dotnet_naming_symbols.any_async_methods.applicable_accessibilities = * +dotnet_naming_symbols.any_async_methods.required_modifiers = async + +dotnet_naming_style.end_in_async.required_suffix = Async +dotnet_naming_style.end_in_async.capitalization = pascal_case + +# Private fields must be camelCase +dotnet_naming_rule.private_fields_must_be_pascal_case.severity = warning +dotnet_naming_rule.private_fields_must_be_pascal_case.symbols = private_fields +dotnet_naming_rule.private_fields_must_be_pascal_case.style = camel_case +# Constant fields must be PascalCase +dotnet_naming_rule.constant_fields_must_be_pascal_case.severity = warning +dotnet_naming_rule.constant_fields_must_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_must_be_pascal_case.style = pascal_case +# Static readonly fields must be PascalCase +dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.severity = warning +dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.symbols = static_readonly_fields +dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.style = pascal_case +# Non private fields must be PascalCase +dotnet_naming_rule.non_private_fields_must_be_pascal_case.severity = warning +dotnet_naming_rule.non_private_fields_must_be_pascal_case.symbols = non_private_fields +dotnet_naming_rule.non_private_fields_must_be_pascal_case.style = pascal_case +# Public symbols must be capitalized +dotnet_naming_rule.public_symbols_must_be_capitalized.severity = warning +dotnet_naming_rule.public_symbols_must_be_capitalized.symbols = public_symbols +dotnet_naming_rule.public_symbols_must_be_capitalized.style = pascal_case +# Parameters must be camelCase (ignored because some use PascalCase to match Win32 parameter names) +dotnet_naming_rule.parameters_must_be_camel_case.severity = none +dotnet_naming_rule.parameters_must_be_camel_case.symbols = parameters +dotnet_naming_rule.parameters_must_be_camel_case.style = camel_case +# Interfaces must be PascalCase and start with an 'I' +dotnet_naming_rule.interface_types_must_be_prefixed_with_i.severity = warning +dotnet_naming_rule.interface_types_must_be_prefixed_with_i.symbols = interface_types +dotnet_naming_rule.interface_types_must_be_prefixed_with_i.style = prefix_interface_interface_with_i + +# .NET Code Analysis + +dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1009.severity = warning +dotnet_diagnostic.CA1016.severity = warning +dotnet_diagnostic.CA1033.severity = warning +dotnet_diagnostic.CA1049.severity = warning +dotnet_diagnostic.CA1060.severity = warning +dotnet_diagnostic.CA1061.severity = warning +dotnet_diagnostic.CA1063.severity = warning +dotnet_diagnostic.CA1065.severity = warning +dotnet_diagnostic.CA1301.severity = warning +dotnet_diagnostic.CA1400.severity = warning +dotnet_diagnostic.CA1401.severity = warning +dotnet_diagnostic.CA1403.severity = warning +dotnet_diagnostic.CA1404.severity = warning +dotnet_diagnostic.CA1405.severity = warning +dotnet_diagnostic.CA1410.severity = warning +dotnet_diagnostic.CA1415.severity = warning +dotnet_diagnostic.CA1821.severity = warning +dotnet_diagnostic.CA1900.severity = warning +dotnet_diagnostic.CA1901.severity = warning +dotnet_diagnostic.CA2002.severity = warning +dotnet_diagnostic.CA2100.severity = warning +dotnet_diagnostic.CA2101.severity = warning +dotnet_diagnostic.CA2108.severity = warning +dotnet_diagnostic.CA2111.severity = warning +dotnet_diagnostic.CA2112.severity = warning +dotnet_diagnostic.CA2114.severity = warning +dotnet_diagnostic.CA2116.severity = warning +dotnet_diagnostic.CA2117.severity = warning +dotnet_diagnostic.CA2122.severity = warning +dotnet_diagnostic.CA2123.severity = warning +dotnet_diagnostic.CA2124.severity = warning +dotnet_diagnostic.CA2126.severity = warning +dotnet_diagnostic.CA2131.severity = warning +dotnet_diagnostic.CA2132.severity = warning +dotnet_diagnostic.CA2133.severity = warning +dotnet_diagnostic.CA2134.severity = warning +dotnet_diagnostic.CA2137.severity = warning +dotnet_diagnostic.CA2138.severity = warning +dotnet_diagnostic.CA2140.severity = warning +dotnet_diagnostic.CA2141.severity = warning +dotnet_diagnostic.CA2146.severity = warning +dotnet_diagnostic.CA2147.severity = warning +dotnet_diagnostic.CA2149.severity = warning +dotnet_diagnostic.CA2200.severity = warning +dotnet_diagnostic.CA2202.severity = warning +dotnet_diagnostic.CA2207.severity = warning +dotnet_diagnostic.CA2212.severity = warning +dotnet_diagnostic.CA2213.severity = warning +dotnet_diagnostic.CA2214.severity = warning +dotnet_diagnostic.CA2216.severity = warning +dotnet_diagnostic.CA2220.severity = warning +dotnet_diagnostic.CA2229.severity = warning +dotnet_diagnostic.CA2231.severity = warning +dotnet_diagnostic.CA2232.severity = warning +dotnet_diagnostic.CA2235.severity = warning +dotnet_diagnostic.CA2236.severity = warning +dotnet_diagnostic.CA2237.severity = warning +dotnet_diagnostic.CA2238.severity = warning +dotnet_diagnostic.CA2240.severity = warning +dotnet_diagnostic.CA2241.severity = warning +dotnet_diagnostic.CA2242.severity = warning + +## CodeStyle Code Analysis + +dotnet_diagnostic.IDE0010.severity = none +dotnet_diagnostic.IDE0130.severity = none +dotnet_diagnostic.IDE0060.severity = none +dotnet_diagnostic.IDE1006.severity = none +dotnet_diagnostic.IDE0023.severity = none +dotnet_diagnostic.IDE0024.severity = none +dotnet_diagnostic.IDE0060.severity = none +dotnet_diagnostic.IDE0057.severity = none +dotnet_diagnostic.IDE0046.severity = none +dotnet_diagnostic.IDE0072.severity = none +dotnet_diagnostic.IDE0064.severity = none +dotnet_diagnostic.IDE0160.severity = none +dotnet_diagnostic.IDE0040.severity = none +dotnet_diagnostic.IDE0045.severity = none +dotnet_diagnostic.IDE0032.severity = none +dotnet_diagnostic.IDE0056.severity = none +dotnet_diagnostic.IDE0032.severity = none +dotnet_diagnostic.IDE0042.severity = none +dotnet_diagnostic.IDE0180.severity = none +dotnet_diagnostic.IDE0061.severity = none +dotnet_diagnostic.IDE0078.severity = none +dotnet_diagnostic.IDE0066.severity = none \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..a5096e90 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,51 @@ +# Set default file-type attributes + +# All file types +* text=auto + +# Markups +*.md text=auto diff=markdown +*.mdx text=auto diff=markdown + +# Solutions +*.sln text=auto eol=crlf +*.slnx text=auto + +# Projects +*.*proj text=auto +*.tasks text=auto +*.props text=auto +*.targets text=auto + +# Sources +*.cs text=auto diff=csharp +*.csx text=auto diff=csharp +*.fs text=auto diff=fsharp +*.resx text=auto + +# Scripts +*.in text eol=lf +*.sh text eol=lf +*.bat text eol=crlf +*.cmd text eol=crlf + +# Images +*.png binary +*.jpg binary +*.gif binary + +# Keys +*.snk binary +*.pfx binary +*.cer binary + +# Others + +# Preserve Line endings in diff and patch files +*.diff -text +*.patch -text + +# Exclude git meta files from exporting +.gitattributes export-ignore +.gitignore export-ignore +.gitkeep export-ignore \ No newline at end of file diff --git a/ComputeSharp.sln b/ComputeSharp.sln index 01972b73..85170bc5 100644 --- a/ComputeSharp.sln +++ b/ComputeSharp.sln @@ -19,6 +19,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Tests.Internal EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_SolutionItems", "_SolutionItems", "{1A9C4108-F61A-4ABE-B5CF-F524521EAE2D}" ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig .gitignore = .gitignore Directory.Build.props = Directory.Build.props src\Directory.Build.props = src\Directory.Build.props diff --git a/Directory.Build.props b/Directory.Build.props index e4ce4160..d1ad3df7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,13 +3,45 @@ true 11.0 enable - strict true + + + 7 + + + 7-all + + + strict + + + + + $(NoWarn);MSB3270 + + + $(NoWarn);CA1060 + @@ -37,7 +69,7 @@ - + true $([System.Text.RegularExpressions.Regex]::Match($(GITHUB_REF_NAME), $(ReleaseVersionParsingRegex)).Groups[1].Value) $([System.Text.RegularExpressions.Regex]::Match($(GITHUB_REF_NAME), $(ReleaseVersionParsingRegex)).Groups[2].Value) @@ -58,7 +90,7 @@ https://github.com/Sergio0694/ComputeSharp/ git true - https://github.com/Sergio0694/ComputeSharp/ + https://github.com/Sergio0694/ComputeSharp/ Sergio Pedri Sergio Pedri Sergio Pedri @@ -71,7 +103,7 @@ true - + diff --git a/samples/ComputeSharp.Benchmark/Blas/BlasBenchmark.cs b/samples/ComputeSharp.Benchmark/Blas/BlasBenchmark.cs index 326d0527..e786756b 100644 --- a/samples/ComputeSharp.Benchmark/Blas/BlasBenchmark.cs +++ b/samples/ComputeSharp.Benchmark/Blas/BlasBenchmark.cs @@ -1,8 +1,10 @@ -using System; +using System; using System.Buffers; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Engines; +#pragma warning disable CA1063 + namespace ComputeSharp.Benchmark.Blas; /// @@ -17,64 +19,64 @@ public class BlasBenchmark : IDisposable private const int C = 128; /// - /// The nummber of rows in the matrix. + /// The nummber of rows in the matrix. /// private const int N = 512; /// - /// The number of columns in the matrix (same as the number of rows in the matrix) + /// The number of columns in the matrix (same as the number of rows in the matrix) /// private const int M = 512; /// - /// The number of columns in the matrix. + /// The number of columns in the matrix. /// private const int P = 256; /// /// The input tensor. /// - private float[]? X; + private float[]? x; /// /// The weights tensor. /// - private float[]? W; + private float[]? w; /// /// The bias tensor. /// - private float[]? B; + private float[]? b; /// /// The result tensor. /// - private float[]? Y; + private float[]? y; /// /// The input tensor (GPU). /// - private ReadOnlyBuffer? BufferX; + private ReadOnlyBuffer? bufferX; /// /// The weights tensor (GPU). /// - private ReadOnlyBuffer? BufferW; + private ReadOnlyBuffer? bufferW; /// /// The bias tensor (GPU). /// - private ReadOnlyBuffer? BufferB; + private ReadOnlyBuffer? bufferB; /// /// The result tensor (GPU). /// - private ReadWriteBuffer? BufferY; + private ReadWriteBuffer? bufferY; /// /// A instance to initialize the tensors. /// - private readonly Random Random = new Random(); + private readonly Random random = new(); /// /// Initial setup for a benchmarking session. @@ -89,21 +91,21 @@ public class BlasBenchmark : IDisposable foreach (ref float x in array.AsSpan()) { - x = (float)Random.NextDouble(); + x = (float)this.random.NextDouble(); } return array; } - X = CreateRandomArray(C * N * M); - W = CreateRandomArray(M * P); - B = CreateRandomArray(P); - Y = CreateRandomArray(C * N * P); + this.x = CreateRandomArray(C * N * M); + this.w = CreateRandomArray(M * P); + this.b = CreateRandomArray(P); + this.y = CreateRandomArray(C * N * P); - BufferX = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(X); - BufferW = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(W); - BufferB = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(B); - BufferY = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(Y); + this.bufferX = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.x); + this.bufferW = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.w); + this.bufferB = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.b); + this.bufferY = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(this.y); Cpu(); GpuWithNoTemporaryBuffers(); @@ -114,15 +116,15 @@ public class BlasBenchmark : IDisposable [GlobalCleanup] public void Dispose() { - ArrayPool.Shared.Return(X!); - ArrayPool.Shared.Return(W!); - ArrayPool.Shared.Return(B!); - ArrayPool.Shared.Return(Y!); + ArrayPool.Shared.Return(this.x!); + ArrayPool.Shared.Return(this.w!); + ArrayPool.Shared.Return(this.b!); + ArrayPool.Shared.Return(this.y!); - BufferX!.Dispose(); - BufferW!.Dispose(); - BufferB!.Dispose(); - BufferY!.Dispose(); + this.bufferX!.Dispose(); + this.bufferW!.Dispose(); + this.bufferB!.Dispose(); + this.bufferY!.Dispose(); } /// @@ -131,7 +133,7 @@ public class BlasBenchmark : IDisposable [Benchmark(Baseline = true)] public void Cpu() { - BlasHelpers.FullyConnectedForwardCpu(C, N, M, P, X!, W!, B!, Y!); + BlasHelpers.FullyConnectedForwardCpu(C, N, M, P, this.x!, this.w!, this.b!, this.y!); } /// @@ -140,7 +142,7 @@ public class BlasBenchmark : IDisposable [Benchmark] public void GpuWithNoTemporaryBuffers() { - BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.GetDefault(), C, N, M, P, BufferX!, BufferW!, BufferB!, BufferY!); + BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.GetDefault(), C, N, M, P, this.bufferX!, this.bufferW!, this.bufferB!, this.bufferY!); } /// @@ -149,13 +151,13 @@ public class BlasBenchmark : IDisposable [Benchmark] public void GpuWithTemporaryBuffers() { - using ReadOnlyBuffer x = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(X!); - using ReadOnlyBuffer w = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(W!); - using ReadOnlyBuffer b = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(B!); - using ReadWriteBuffer y = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(Y!.Length); + using ReadOnlyBuffer x = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.x!); + using ReadOnlyBuffer w = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.w!); + using ReadOnlyBuffer b = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.b!); + using ReadWriteBuffer y = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(this.y!.Length); BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.GetDefault(), C, N, M, P, x, w, b, y); - y.CopyTo(Y); + y.CopyTo(this.y); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.Benchmark/Blas/BlasHelpers.cs b/samples/ComputeSharp.Benchmark/Blas/BlasHelpers.cs index b58acb8e..a2d94d21 100644 --- a/samples/ComputeSharp.Benchmark/Blas/BlasHelpers.cs +++ b/samples/ComputeSharp.Benchmark/Blas/BlasHelpers.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace ComputeSharp.Benchmark.Blas; @@ -39,7 +39,7 @@ internal static partial class BlasHelpers for (int k = 0; k < m; k++) { - result += Unsafe.Add(ref rx, x_offset + k) * Unsafe.Add(ref rw, k * p + j); + result += Unsafe.Add(ref rx, x_offset + k) * Unsafe.Add(ref rw, (k * p) + j); } Unsafe.Add(ref ry, y_offset + j) = result + Unsafe.Add(ref rb, j); @@ -47,7 +47,7 @@ internal static partial class BlasHelpers } } - Parallel.For(0, c, Kernel); + _ = Parallel.For(0, c, Kernel); } /// @@ -83,26 +83,26 @@ internal static partial class BlasHelpers [AutoConstructor] public readonly partial struct FullyConnectedForwardKernel : IComputeShader { - public readonly int n; - public readonly int m; - public readonly int p; - public readonly ReadOnlyBuffer x; - public readonly ReadOnlyBuffer w; - public readonly ReadOnlyBuffer b; - public readonly ReadWriteBuffer y; + private readonly int n; + private readonly int m; + private readonly int p; + private readonly ReadOnlyBuffer x; + private readonly ReadOnlyBuffer w; + private readonly ReadOnlyBuffer b; + private readonly ReadWriteBuffer y; /// public void Execute() { - int x_offset = ThreadIds.X * n * p + ThreadIds.Y * m; + int x_offset = (ThreadIds.X * this.n * this.p) + (ThreadIds.Y * this.m); float result = 0f; - for (int k = 0; k < m; k++) + for (int k = 0; k < this.m; k++) { - result += x[x_offset + k] * w[k * p + ThreadIds.Z]; + result += this.x[x_offset + k] * this.w[(k * this.p) + ThreadIds.Z]; } - y[ThreadIds.X * n * p + ThreadIds.Y * p + ThreadIds.Z] = result + b[ThreadIds.Z]; + this.y[(ThreadIds.X * this.n * this.p) + (ThreadIds.Y * this.p) + ThreadIds.Z] = result + this.b[ThreadIds.Z]; } } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.Benchmark/Dispatching/DispatchingBenchmark.cs b/samples/ComputeSharp.Benchmark/Dispatching/DispatchingBenchmark.cs index f7c71449..a3ec85a8 100644 --- a/samples/ComputeSharp.Benchmark/Dispatching/DispatchingBenchmark.cs +++ b/samples/ComputeSharp.Benchmark/Dispatching/DispatchingBenchmark.cs @@ -1,8 +1,10 @@ -using System; +using System; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; +#pragma warning disable CA1063 + namespace ComputeSharp.Benchmark.Blas; /// @@ -15,7 +17,7 @@ public partial class DispatchingBenchmark : IDisposable /// /// The test buffer. /// - private ReadWriteBuffer? Buffer; + private ReadWriteBuffer? buffer; /// /// Initial setup for a benchmarking session. @@ -23,14 +25,14 @@ public partial class DispatchingBenchmark : IDisposable [GlobalSetup] public void Setup() { - Buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(128); + this.buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(128); } /// [GlobalCleanup] public void Dispose() { - Buffer!.Dispose(); + this.buffer!.Dispose(); } /// @@ -40,7 +42,7 @@ public partial class DispatchingBenchmark : IDisposable [BenchmarkCategory("SINGLE")] public void Compute_Single() { - GraphicsDevice.GetDefault().For(64, new TestShader(Buffer!)); + GraphicsDevice.GetDefault().For(64, new TestShader(this.buffer!)); } /// @@ -50,9 +52,9 @@ public partial class DispatchingBenchmark : IDisposable [BenchmarkCategory("SINGLE")] public void Compute_Single_WithContext() { - using var context = GraphicsDevice.GetDefault().CreateComputeContext(); + using ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext(); - context.For(64, new TestShader(Buffer!)); + context.For(64, new TestShader(this.buffer!)); } /// @@ -62,9 +64,9 @@ public partial class DispatchingBenchmark : IDisposable [BenchmarkCategory("SINGLE")] public async Task Compute_Single_WithContext_Async() { - await using var context = GraphicsDevice.GetDefault().CreateComputeContext(); + await using ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext(); - context.For(64, new TestShader(Buffer!)); + context.For(64, new TestShader(this.buffer!)); } /// @@ -74,8 +76,8 @@ public partial class DispatchingBenchmark : IDisposable [BenchmarkCategory("MULTIPLE")] public void Compute_Multiple() { - GraphicsDevice.GetDefault().For(64, new TestShader(Buffer!)); - GraphicsDevice.GetDefault().For(64, new TestShader(Buffer!)); + GraphicsDevice.GetDefault().For(64, new TestShader(this.buffer!)); + GraphicsDevice.GetDefault().For(64, new TestShader(this.buffer!)); } /// @@ -85,11 +87,11 @@ public partial class DispatchingBenchmark : IDisposable [BenchmarkCategory("MULTIPLE")] public void Compute_Multiple_WithContext() { - using var context = GraphicsDevice.GetDefault().CreateComputeContext(); + using ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext(); - context.For(64, new TestShader(Buffer!)); - context.Barrier(Buffer!); - context.For(64, new TestShader(Buffer!)); + context.For(64, new TestShader(this.buffer!)); + context.Barrier(this.buffer!); + context.For(64, new TestShader(this.buffer!)); } /// @@ -99,21 +101,21 @@ public partial class DispatchingBenchmark : IDisposable [BenchmarkCategory("MULTIPLE")] public async Task Compute_Multiple_WithContext_Async() { - await using var context = GraphicsDevice.GetDefault().CreateComputeContext(); + await using ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext(); - context.For(64, new TestShader(Buffer!)); - context.Barrier(Buffer!); - context.For(64, new TestShader(Buffer!)); + context.For(64, new TestShader(this.buffer!)); + context.Barrier(this.buffer!); + context.For(64, new TestShader(this.buffer!)); } [AutoConstructor] internal readonly partial struct TestShader : IComputeShader { - public readonly ReadWriteBuffer buffer; + private readonly ReadWriteBuffer buffer; /// public void Execute() { } } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.Benchmark/Imaging/ImagingBenchmark.cs b/samples/ComputeSharp.Benchmark/Imaging/ImagingBenchmark.cs index 12ecc013..84ef323f 100644 --- a/samples/ComputeSharp.Benchmark/Imaging/ImagingBenchmark.cs +++ b/samples/ComputeSharp.Benchmark/Imaging/ImagingBenchmark.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Reflection; using BenchmarkDotNet.Attributes; @@ -10,6 +10,8 @@ using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Processors.Convolution; using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32; +#pragma warning disable CA1063 + namespace ComputeSharp.Benchmark.Imaging; /// @@ -89,4 +91,4 @@ public class ImagingBenchmark : IDisposable { this.image!.Mutate(c => c.ApplyProcessor(new HlslGaussianBlurProcessor(80))); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.Benchmark/Program.cs b/samples/ComputeSharp.Benchmark/Program.cs index c6be10ee..d095abb2 100644 --- a/samples/ComputeSharp.Benchmark/Program.cs +++ b/samples/ComputeSharp.Benchmark/Program.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using BenchmarkDotNet.Running; // ================= @@ -8,4 +8,4 @@ using BenchmarkDotNet.Running; // it as the startup project for the solution and run it without the debugger // (CTRL + F5), or compile it and then go to its bin\Release\net6.0 folder, // open a cmd prompt and run "dotnet ComputeSharp.Benchmark.dll". -BenchmarkSwitcher.FromAssembly(Assembly.GetExecutingAssembly()).Run(args); +BenchmarkSwitcher.FromAssembly(Assembly.GetExecutingAssembly()).Run(args); \ No newline at end of file diff --git a/samples/ComputeSharp.ImageProcessing/Primitives/Complex64.cs b/samples/ComputeSharp.ImageProcessing/Primitives/Complex64.cs index 37aeea99..03c2ab44 100644 --- a/samples/ComputeSharp.ImageProcessing/Primitives/Complex64.cs +++ b/samples/ComputeSharp.ImageProcessing/Primitives/Complex64.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors. +// Copyright (c) Six Labors. // Licensed under the Apache License, Version 2.0. using System.Runtime.CompilerServices; @@ -41,5 +41,5 @@ internal readonly struct Complex64 /// The scalar to use to multiply the value. /// The result. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Complex64 operator *(Complex64 value, float scalar) => new Complex64(value.Real * scalar, value.Imaginary * scalar); -} + public static Complex64 operator *(Complex64 value, float scalar) => new(value.Real * scalar, value.Imaginary * scalar); +} \ No newline at end of file diff --git a/samples/ComputeSharp.ImageProcessing/Primitives/ComplexVector4.cs b/samples/ComputeSharp.ImageProcessing/Primitives/ComplexVector4.cs index 3d3431f4..a7effc7b 100644 --- a/samples/ComputeSharp.ImageProcessing/Primitives/ComplexVector4.cs +++ b/samples/ComputeSharp.ImageProcessing/Primitives/ComplexVector4.cs @@ -1,9 +1,11 @@ -// Copyright (c) Six Labors. +// Copyright (c) Six Labors. // Licensed under the Apache License, Version 2.0. using System.Numerics; using System.Runtime.CompilerServices; +#pragma warning disable IDE0022 + namespace SixLabors.ImageSharp; /// diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.cs index f2b1f4c7..f6435bbc 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; @@ -77,8 +77,8 @@ public sealed partial class HlslBokehBlurProcessor : IImageProcessor ThrowHelper.ThrowInvalidOperationException("This processor only supports the RGBA32 pixel format."); } - var processor = new Implementation(this, configuration, Unsafe.As>(source), sourceRectangle); + Implementation processor = new(this, configuration, Unsafe.As>(source), sourceRectangle); return Unsafe.As>(processor); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs index 2677d2a2..cb4a3949 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Numerics; @@ -23,37 +23,37 @@ public sealed partial class HlslBokehBlurProcessor /// /// The instance in use. /// - private readonly GraphicsDevice GraphicsDevice; + private readonly GraphicsDevice graphicsDevice; /// /// The kernel radius. /// - private readonly int Radius; + private readonly int radius; /// /// The maximum size of the kernel in either direction. /// - private readonly int KernelSize; + private readonly int kernelSize; /// /// The number of components to use when applying the bokeh blur. /// - private readonly int ComponentsCount; + private readonly int componentsCount; /// /// The kernel parameters to use for the current instance (a: X, b: Y, A: Z, B: W) /// - private readonly Vector4[] KernelParameters; + private readonly Vector4[] kernelParameters; /// /// The kernel components for the current instance. /// - private readonly Complex64[][] Kernels; + private readonly Complex64[][] kernels; /// /// The scaling factor for kernel values. /// - private readonly float KernelsScale; + private readonly float kernelsScale; /// /// The mapping of initialized complex kernels and parameters, to speed up the initialization of new instances. @@ -70,29 +70,30 @@ public sealed partial class HlslBokehBlurProcessor public Implementation(HlslBokehBlurProcessor definition, Configuration configuration, Image source, Rectangle sourceRectangle) : base(configuration, source, sourceRectangle) { - GraphicsDevice = definition.GraphicsDevice; - Radius = definition.Radius; - KernelSize = Radius * 2 + 1; - ComponentsCount = definition.Components; + this.graphicsDevice = definition.GraphicsDevice; + this.radius = definition.Radius; + this.kernelSize = (this.radius * 2) + 1; + this.componentsCount = definition.Components; // Reuse the initialized values from the cache, if possible - var parameters = (Radius, ComponentsCount); - if (Cache.TryGetValue(parameters, out var info)) + (int radius, int componentsCount) parameters = (this.radius, this.componentsCount); + + if (Cache.TryGetValue(parameters, out (Vector4[] Parameters, float Scale, Complex64[][] Kernels) info)) { - KernelParameters = info.Parameters; - KernelsScale = info.Scale; - Kernels = info.Kernels; + this.kernelParameters = info.Parameters; + this.kernelsScale = info.Scale; + this.kernels = info.Kernels; } else { // Initialize the complex kernels and parameters with the current arguments - (KernelParameters, KernelsScale) = GetParameters(); - Kernels = CreateComplexKernels(); + (this.kernelParameters, this.kernelsScale) = GetParameters(); + this.kernels = CreateComplexKernels(); NormalizeKernels(); // Store them in the cache for future use - Cache.TryAdd(parameters, (KernelParameters, KernelsScale, Kernels)); + _ = Cache.TryAdd(parameters, (this.kernelParameters, this.kernelsScale, this.kernels)); } } @@ -161,7 +162,7 @@ public sealed partial class HlslBokehBlurProcessor private (Vector4[] Parameters, float Scale) GetParameters() { // Prepare the kernel components - int index = Math.Max(0, Math.Min(ComponentsCount - 1, KernelComponents.Count)); + int index = Math.Max(0, Math.Min(this.componentsCount - 1, KernelComponents.Count)); return (KernelComponents[index], KernelScales[index]); } @@ -171,10 +172,10 @@ public sealed partial class HlslBokehBlurProcessor /// private Complex64[][] CreateComplexKernels() { - var kernels = new Complex64[KernelParameters.Length][]; - ref Vector4 baseRef = ref MemoryMarshal.GetReference(KernelParameters.AsSpan()); + Complex64[][] kernels = new Complex64[this.kernelParameters.Length][]; + ref Vector4 baseRef = ref MemoryMarshal.GetReference(this.kernelParameters.AsSpan()); - for (int i = 0; i < KernelParameters.Length; i++) + for (int i = 0; i < this.kernelParameters.Length; i++) { ref Vector4 paramsRef = ref Unsafe.Add(ref baseRef, i); @@ -191,15 +192,15 @@ public sealed partial class HlslBokehBlurProcessor /// The angle component for each complex component. private Complex64[] CreateComplex1DKernel(float a, float b) { - var kernel = new Complex64[KernelSize]; + Complex64[] kernel = new Complex64[this.kernelSize]; ref Complex64 baseRef = ref MemoryMarshal.GetReference(kernel.AsSpan()); - int r = Radius; + int r = this.radius; int n = -r; - for (int i = 0; i < KernelSize; i++, n++) + for (int i = 0; i < this.kernelSize; i++, n++) { // Incrementally compute the range values - float value = n * KernelsScale * (1f / r); + float value = n * this.kernelsScale * (1f / r); value *= value; @@ -219,11 +220,11 @@ public sealed partial class HlslBokehBlurProcessor { // Calculate the complex weighted sum float total = 0; - Span kernelsSpan = Kernels.AsSpan(); + Span kernelsSpan = this.kernels.AsSpan(); ref Complex64[] baseKernelsRef = ref MemoryMarshal.GetReference(kernelsSpan); - ref Vector4 baseParamsRef = ref MemoryMarshal.GetReference(KernelParameters.AsSpan()); + ref Vector4 baseParamsRef = ref MemoryMarshal.GetReference(this.kernelParameters.AsSpan()); - for (int i = 0; i < KernelParameters.Length; i++) + for (int i = 0; i < this.kernelParameters.Length; i++) { ref Complex64[] kernelRef = ref Unsafe.Add(ref baseKernelsRef, i); int length = kernelRef.Length; @@ -238,8 +239,8 @@ public sealed partial class HlslBokehBlurProcessor ref Complex64 kRef = ref Unsafe.Add(ref valueRef, k); total += - paramsRef.Z * (jRef.Real * kRef.Real - jRef.Imaginary * kRef.Imaginary) - + paramsRef.W * (jRef.Real * kRef.Imaginary + jRef.Imaginary * kRef.Real); + (paramsRef.Z * ((jRef.Real * kRef.Real) - (jRef.Imaginary * kRef.Imaginary))) + + (paramsRef.W * ((jRef.Real * kRef.Imaginary) + (jRef.Imaginary * kRef.Real))); } } } @@ -270,23 +271,23 @@ public sealed partial class HlslBokehBlurProcessor Span span = MemoryMarshal.Cast(pixelMemory.Span); - using ReadWriteTexture2D texture = GraphicsDevice.AllocateReadWriteTexture2D(span, source.Width, source.Height); - using ReadWriteTexture2D temporary = GraphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height, AllocationMode.Clear); - using ReadWriteTexture2D reals = GraphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height); - using ReadWriteTexture2D imaginaries = GraphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height); - using ReadOnlyBuffer kernel = GraphicsDevice.AllocateReadOnlyBuffer(KernelSize); + using ReadWriteTexture2D texture = this.graphicsDevice.AllocateReadWriteTexture2D(span, source.Width, source.Height); + using ReadWriteTexture2D temporary = this.graphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height, AllocationMode.Clear); + using ReadWriteTexture2D reals = this.graphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height); + using ReadWriteTexture2D imaginaries = this.graphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height); + using ReadOnlyBuffer kernel = this.graphicsDevice.AllocateReadOnlyBuffer(this.kernelSize); // Preliminary gamma highlight pass - GraphicsDevice.For(source.Height, new(texture)); + this.graphicsDevice.For(source.Height, new(texture)); // Perform two 1D convolutions for each component in the current instance - for (int j = 0; j < Kernels.Length; j++) + for (int j = 0; j < this.kernels.Length; j++) { - Vector4 parameters = KernelParameters[j]; + Vector4 parameters = this.kernelParameters[j]; - kernel.CopyFrom(Kernels[j]); + kernel.CopyFrom(this.kernels[j]); - using var context = GraphicsDevice.CreateComputeContext(); + using ComputeContext context = this.graphicsDevice.CreateComputeContext(); context.For( source.Width, @@ -303,7 +304,7 @@ public sealed partial class HlslBokehBlurProcessor } // Apply the inverse gamma exposure pass - GraphicsDevice.For(source.Height, new(temporary, texture)); + this.graphicsDevice.For(source.Height, new(temporary, texture)); // Write the final pixel data texture.CopyTo(span); @@ -313,36 +314,36 @@ public sealed partial class HlslBokehBlurProcessor /// Kernel for the vertical convolution pass. /// [AutoConstructor] - internal partial struct VerticalConvolutionProcessor : IComputeShader + internal readonly partial struct VerticalConvolutionProcessor : IComputeShader { - public IReadWriteNormalizedTexture2D source; - public ReadWriteTexture2D reals; - public ReadWriteTexture2D imaginaries; - public ReadOnlyBuffer kernel; + private readonly IReadWriteNormalizedTexture2D source; + private readonly ReadWriteTexture2D reals; + private readonly ReadWriteTexture2D imaginaries; + private readonly ReadOnlyBuffer kernel; /// public void Execute() { float4 real = float4.Zero; float4 imaginary = float4.Zero; - int maxY = source.Height; - int maxX = source.Width; - int kernelLength = kernel.Length; + int maxY = this.source.Height; + int maxX = this.source.Width; + int kernelLength = this.kernel.Length; int radiusY = kernelLength >> 1; for (int i = 0; i < kernelLength; i++) { int offsetY = Hlsl.Clamp(ThreadIds.Y + i - radiusY, 0, maxY); int offsetX = Hlsl.Clamp(ThreadIds.X, 0, maxX); - float4 color = source[offsetX, offsetY]; - Complex64 factors = kernel[i]; + float4 color = this.source[offsetX, offsetY]; + Complex64 factors = this.kernel[i]; real += factors.Real * color; imaginary += factors.Imaginary * color; } - reals[ThreadIds.XY] = real; - imaginaries[ThreadIds.XY] = imaginary; + this.reals[ThreadIds.XY] = real; + this.imaginaries[ThreadIds.XY] = imaginary; } } @@ -350,22 +351,22 @@ public sealed partial class HlslBokehBlurProcessor /// Kernel for the horizontal convolution pass. /// [AutoConstructor] - internal partial struct HorizontalConvolutionAndAccumulatePartialsProcessor : IComputeShader + internal readonly partial struct HorizontalConvolutionAndAccumulatePartialsProcessor : IComputeShader { - public float z; - public float w; + private readonly float z; + private readonly float w; - public ReadWriteTexture2D reals; - public ReadWriteTexture2D imaginaries; - public ReadWriteTexture2D target; - public ReadOnlyBuffer kernel; + private readonly ReadWriteTexture2D reals; + private readonly ReadWriteTexture2D imaginaries; + private readonly ReadWriteTexture2D target; + private readonly ReadOnlyBuffer kernel; /// public void Execute() { - int maxY = target.Height; - int maxX = target.Width; - int kernelLength = kernel.Length; + int maxY = this.target.Height; + int maxX = this.target.Width; + int kernelLength = this.kernel.Length; int radiusX = kernelLength >> 1; int offsetY = Hlsl.Clamp(ThreadIds.Y, 0, maxY); ComplexVector4 result = default; @@ -373,15 +374,15 @@ public sealed partial class HlslBokehBlurProcessor for (int i = 0; i < kernelLength; i++) { int offsetX = Hlsl.Clamp(ThreadIds.X + i - radiusX, 0, maxX); - float4 sourceReal = reals[offsetX, offsetY]; - float4 sourceImaginary = imaginaries[offsetX, offsetY]; - Complex64 factors = kernel[i]; + float4 sourceReal = this.reals[offsetX, offsetY]; + float4 sourceImaginary = this.imaginaries[offsetX, offsetY]; + Complex64 factors = this.kernel[i]; - result.Real += (Vector4)(factors.Real * sourceReal - factors.Imaginary * sourceImaginary); - result.Imaginary += (Vector4)(factors.Real * sourceImaginary + factors.Imaginary * sourceReal); + result.Real += (Vector4)((factors.Real * sourceReal) - (factors.Imaginary * sourceImaginary)); + result.Imaginary += (Vector4)((factors.Real * sourceImaginary) + (factors.Imaginary * sourceReal)); } - target[ThreadIds.XY] += (float4)result.WeightedSum(z, w); + this.target[ThreadIds.XY] += (float4)result.WeightedSum(this.z, this.w); } } @@ -391,20 +392,20 @@ public sealed partial class HlslBokehBlurProcessor [AutoConstructor] internal readonly partial struct GammaHighlightProcessor : IComputeShader { - public readonly IReadWriteNormalizedTexture2D source; + private readonly IReadWriteNormalizedTexture2D source; /// public void Execute() { - int width = source.Width; + int width = this.source.Width; for (int i = 0; i < width; i++) { - float4 v = source[i, ThreadIds.X]; + float4 v = this.source[i, ThreadIds.X]; v.XYZ = v.XYZ * v.XYZ * v.XYZ; - source[i, ThreadIds.X] = v; + this.source[i, ThreadIds.X] = v; } } } @@ -415,24 +416,24 @@ public sealed partial class HlslBokehBlurProcessor [AutoConstructor] internal readonly partial struct InverseGammaHighlightProcessor : IComputeShader { - public readonly ReadWriteTexture2D source; - public readonly IReadWriteNormalizedTexture2D target; + private readonly ReadWriteTexture2D source; + private readonly IReadWriteNormalizedTexture2D target; /// public void Execute() { - int width = source.Width; + int width = this.source.Width; for (int i = 0; i < width; i++) { - float4 v = source[i, ThreadIds.X]; + float4 v = this.source[i, ThreadIds.X]; v = Hlsl.Clamp(v, 0, float.MaxValue); v.XYZ = Hlsl.Pow(v.XYZ, 1 / 3f); - target[i, ThreadIds.X] = v; + this.target[i, ThreadIds.X] = v; } } } } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs index b046b334..c2e67e9d 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; @@ -52,7 +52,8 @@ public sealed partial class HlslGaussianBlurProcessor : IImageProcessor /// The radius value representing the size of the area to sample (this should be at least twice the sigma value) public HlslGaussianBlurProcessor(GraphicsDevice device, float sigma, int radius) { - GraphicsDevice = device; + this.graphicsDevice = device; + Sigma = sigma; Radius = radius; } @@ -60,7 +61,7 @@ public sealed partial class HlslGaussianBlurProcessor : IImageProcessor /// /// The instance in use. /// - private readonly GraphicsDevice GraphicsDevice; + private readonly GraphicsDevice graphicsDevice; /// /// Gets the sigma value representing the weight of the blur. @@ -81,8 +82,8 @@ public sealed partial class HlslGaussianBlurProcessor : IImageProcessor ThrowHelper.ThrowInvalidOperationException("This processor only supports the RGBA32 pixel format."); } - var processor = new Implementation(this, configuration, Unsafe.As>(source), sourceRectangle); + Implementation processor = new(this, configuration, Unsafe.As>(source), sourceRectangle); return Unsafe.As>(processor); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs index d6edd6e6..e24a82a2 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using CommunityToolkit.Diagnostics; @@ -19,12 +19,12 @@ public sealed partial class HlslGaussianBlurProcessor /// /// The instance in use. /// - private readonly GraphicsDevice GraphicsDevice; + private readonly GraphicsDevice graphicsDevice; /// /// The 1D kernel to apply. /// - private readonly float[] Kernel; + private readonly float[] kernel; /// /// Initializes a new instance of the class. @@ -36,10 +36,10 @@ public sealed partial class HlslGaussianBlurProcessor public Implementation(HlslGaussianBlurProcessor definition, Configuration configuration, Image source, Rectangle sourceRectangle) : base(configuration, source, sourceRectangle) { - int kernelSize = definition.Radius * 2 + 1; + int kernelSize = (definition.Radius * 2) + 1; - GraphicsDevice = definition.GraphicsDevice; - Kernel = CreateGaussianBlurKernel(kernelSize, definition.Sigma); + this.graphicsDevice = definition.graphicsDevice; + this.kernel = CreateGaussianBlurKernel(kernelSize, definition.Sigma); } /// @@ -100,11 +100,11 @@ public sealed partial class HlslGaussianBlurProcessor Span span = MemoryMarshal.Cast(pixelMemory.Span); - using ReadWriteTexture2D sourceTexture = GraphicsDevice.AllocateReadWriteTexture2D(span, source.Width, source.Height); - using ReadWriteTexture2D firstPassTexture = GraphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height); - using ReadOnlyBuffer kernelBuffer = GraphicsDevice.AllocateReadOnlyBuffer(Kernel); + using ReadWriteTexture2D sourceTexture = this.graphicsDevice.AllocateReadWriteTexture2D(span, source.Width, source.Height); + using ReadWriteTexture2D firstPassTexture = this.graphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height); + using ReadOnlyBuffer kernelBuffer = this.graphicsDevice.AllocateReadOnlyBuffer(this.kernel); - using (var context = GraphicsDevice.CreateComputeContext()) + using (ComputeContext context = this.graphicsDevice.CreateComputeContext()) { context.For(source.Width, source.Height, new(sourceTexture, firstPassTexture, kernelBuffer)); context.Barrier(firstPassTexture); @@ -120,29 +120,29 @@ public sealed partial class HlslGaussianBlurProcessor [AutoConstructor] internal readonly partial struct VerticalConvolutionProcessor : IComputeShader { - public readonly IReadWriteNormalizedTexture2D source; - public readonly IReadWriteNormalizedTexture2D target; - public readonly ReadOnlyBuffer kernel; + private readonly IReadWriteNormalizedTexture2D source; + private readonly IReadWriteNormalizedTexture2D target; + private readonly ReadOnlyBuffer kernel; /// public void Execute() { float4 result = float4.Zero; - int maxY = source.Height - 1; - int maxX = source.Width - 1; - int kernelLength = kernel.Length; + int maxY = this.source.Height - 1; + int maxX = this.source.Width - 1; + int kernelLength = this.kernel.Length; int radiusY = kernelLength >> 1; for (int i = 0; i < kernelLength; i++) { int offsetY = Hlsl.Clamp(ThreadIds.Y + i - radiusY, 0, maxY); int offsetX = Hlsl.Clamp(ThreadIds.X, 0, maxX); - float4 color = source[offsetX, offsetY]; + float4 color = this.source[offsetX, offsetY]; - result += kernel[i] * color; + result += this.kernel[i] * color; } - target[ThreadIds.XY] = result; + this.target[ThreadIds.XY] = result; } } @@ -152,30 +152,30 @@ public sealed partial class HlslGaussianBlurProcessor [AutoConstructor] internal readonly partial struct HorizontalConvolutionProcessor : IComputeShader { - public readonly IReadWriteNormalizedTexture2D source; - public readonly IReadWriteNormalizedTexture2D target; - public readonly ReadOnlyBuffer kernel; + private readonly IReadWriteNormalizedTexture2D source; + private readonly IReadWriteNormalizedTexture2D target; + private readonly ReadOnlyBuffer kernel; /// public void Execute() { float4 result = float4.Zero; - int maxY = source.Height - 1; - int maxX = source.Width - 1; - int kernelLength = kernel.Length; + int maxY = this.source.Height - 1; + int maxX = this.source.Width - 1; + int kernelLength = this.kernel.Length; int radiusX = kernelLength >> 1; int offsetY = Hlsl.Clamp(ThreadIds.Y, 0, maxY); for (int i = 0; i < kernelLength; i++) { int offsetX = Hlsl.Clamp(ThreadIds.X + i - radiusX, 0, maxX); - float4 color = source[offsetX, offsetY]; + float4 color = this.source[offsetX, offsetY]; - result += kernel[i] * color; + result += this.kernel[i] * color; } - target[ThreadIds.XY] = result; + this.target[ThreadIds.XY] = result; } } } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.ImageProcessing/Program.cs b/samples/ComputeSharp.ImageProcessing/Program.cs index 9d862a93..7b764178 100644 --- a/samples/ComputeSharp.ImageProcessing/Program.cs +++ b/samples/ComputeSharp.ImageProcessing/Program.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Reflection; using ComputeSharp.BokehBlur.Processors; @@ -15,7 +15,7 @@ string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly() using Image image = Image.Load(path); // Apply a series of processors and save the results -foreach (var effect in new (string Name, IImageProcessor Processor)[] +foreach ((string Name, IImageProcessor Processor) effect in new (string Name, IImageProcessor Processor)[] { ("bokeh", new HlslBokehBlurProcessor(80, 2)), ("gaussian", new HlslGaussianBlurProcessor(80)) @@ -37,4 +37,4 @@ foreach (var effect in new (string Name, IImageProcessor Processor)[] targetPath = Path.Combine(targetPath, $"{Path.GetFileNameWithoutExtension(path)}_{effect.Name}{Path.GetExtension(path)}"); copy.Save(targetPath); -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.Sample.FSharp.Shaders/MultiplyByTwo.cs b/samples/ComputeSharp.Sample.FSharp.Shaders/MultiplyByTwo.cs index 4d20dfb6..3b9e6f98 100644 --- a/samples/ComputeSharp.Sample.FSharp.Shaders/MultiplyByTwo.cs +++ b/samples/ComputeSharp.Sample.FSharp.Shaders/MultiplyByTwo.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.Sample.FSharp.Shaders; +namespace ComputeSharp.Sample.FSharp.Shaders; /// /// A sample shader thaat just multiplies items in a buffer by two. @@ -6,11 +6,11 @@ [AutoConstructor] public readonly partial struct MultiplyByTwo : IComputeShader { - public readonly ReadWriteBuffer buffer; + private readonly ReadWriteBuffer buffer; /// public void Execute() { - buffer[ThreadIds.X] *= 2; + this.buffer[ThreadIds.X] *= 2; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.Sample/Helpers/Formatting.cs b/samples/ComputeSharp.Sample/Helpers/Formatting.cs index 6fbe1b6e..54c23634 100644 --- a/samples/ComputeSharp.Sample/Helpers/Formatting.cs +++ b/samples/ComputeSharp.Sample/Helpers/Formatting.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Globalization; using System.Linq; using CommunityToolkit.Diagnostics; @@ -34,12 +34,12 @@ internal static class Formatting for (int i = 0; i < height; i++) { - var row = array.AsSpan(i * width, width).ToArray(); - var text = string.Join(",", row.Select(x => x.ToString(CultureInfo.InvariantCulture).PadLeft(numberWidth))); + float[] row = array.AsSpan(i * width, width).ToArray(); + string text = string.Join(",", row.Select(x => x.ToString(CultureInfo.InvariantCulture).PadLeft(numberWidth))); Console.WriteLine(text); } Console.WriteLine(new string('=', 50)); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.Sample/Program.cs b/samples/ComputeSharp.Sample/Program.cs index 64294e81..21e050fa 100644 --- a/samples/ComputeSharp.Sample/Program.cs +++ b/samples/ComputeSharp.Sample/Program.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using ComputeSharp; using ComputeSharp.Sample; @@ -26,11 +26,11 @@ Formatting.PrintMatrix(array, 10, 10, "AFTER"); [AutoConstructor] internal readonly partial struct MultiplyByTwo : IComputeShader { - public readonly ReadWriteBuffer buffer; + private readonly ReadWriteBuffer buffer; /// public void Execute() { - buffer[ThreadIds.X] *= 2; + this.buffer[ThreadIds.X] *= 2; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Core.Shared/Constants/Error.cs b/samples/ComputeSharp.SwapChain.Core.Shared/Constants/Error.cs index fa6f2fce..3665d3dd 100644 --- a/samples/ComputeSharp.SwapChain.Core.Shared/Constants/Error.cs +++ b/samples/ComputeSharp.SwapChain.Core.Shared/Constants/Error.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Core.Constants; +namespace ComputeSharp.SwapChain.Core.Constants; /// /// A with the collection of tracked errors for analytics. @@ -7,4 +7,4 @@ public static class Error { public const string RenderingFailedOnMainPanel = "[SHELL] RenderingFailed (main panel)"; public const string RenderingFailedOnSelectionPanel = "[SHELL] RenderingFailed (selection panel)"; -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Core.Shared/Constants/Event.cs b/samples/ComputeSharp.SwapChain.Core.Shared/Constants/Event.cs index 171865b4..67d2b89d 100644 --- a/samples/ComputeSharp.SwapChain.Core.Shared/Constants/Event.cs +++ b/samples/ComputeSharp.SwapChain.Core.Shared/Constants/Event.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Core.Constants; +namespace ComputeSharp.SwapChain.Core.Constants; /// /// A with the collection of tracked events for analytics. @@ -12,4 +12,4 @@ public static class Event public const string IsRenderingPausedChanged = "[SETTINGS] IsRenderingPaused"; public const string OpenShaderSelectionPanel = "[SHELL] Open ShaderSelectionPanel"; public const string CloseShaderSelectionPanel = "[SHELL] Close ShaderSelectionPanel"; -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Core.Shared/Converters/RenderingPauseConverter.cs b/samples/ComputeSharp.SwapChain.Core.Shared/Converters/RenderingPauseConverter.cs index 18c8479b..3a04208c 100644 --- a/samples/ComputeSharp.SwapChain.Core.Shared/Converters/RenderingPauseConverter.cs +++ b/samples/ComputeSharp.SwapChain.Core.Shared/Converters/RenderingPauseConverter.cs @@ -1,4 +1,4 @@ -#if WINDOWS_UWP +#if WINDOWS_UWP using Windows.UI.Xaml.Controls; #else using Microsoft.UI.Xaml.Controls; @@ -20,4 +20,4 @@ public static class RenderingPauseConverter { return value ? Symbol.Play : Symbol.Pause; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Core.Shared/Converters/ResolutionScaleConverter.cs b/samples/ComputeSharp.SwapChain.Core.Shared/Converters/ResolutionScaleConverter.cs index b13c844a..a7be9a73 100644 --- a/samples/ComputeSharp.SwapChain.Core.Shared/Converters/ResolutionScaleConverter.cs +++ b/samples/ComputeSharp.SwapChain.Core.Shared/Converters/ResolutionScaleConverter.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Core.Converters; +namespace ComputeSharp.SwapChain.Core.Converters; /// /// A class with some static converters for resolution scale settings. @@ -24,4 +24,4 @@ public static class ResolutionScaleConverter { return value / 100.0; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Core.Shared/Services/DebugAnalyticsService.cs b/samples/ComputeSharp.SwapChain.Core.Shared/Services/DebugAnalyticsService.cs index c3945e56..d022277a 100644 --- a/samples/ComputeSharp.SwapChain.Core.Shared/Services/DebugAnalyticsService.cs +++ b/samples/ComputeSharp.SwapChain.Core.Shared/Services/DebugAnalyticsService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Text; @@ -16,13 +16,13 @@ public sealed class DebugAnalyticsService : IAnalyticsService { StringBuilder builder = new(); - builder.AppendLine($"[EVENT]: \"{title}\""); + _ = builder.AppendLine($"[EVENT]: \"{title}\""); if (data is not null) { - foreach (var info in data) + foreach ((string Property, object? Value) info in data) { - builder.AppendLine($">> {info.Property}: \"{info.Value ?? ""}\""); + _ = builder.AppendLine($">> {info.Property}: \"{info.Value ?? ""}\""); } } @@ -34,18 +34,18 @@ public sealed class DebugAnalyticsService : IAnalyticsService { StringBuilder builder = new(); - builder.AppendLine($"[EXCEPTION]: \"{exception.GetType()}\""); - builder.AppendLine(">> Stack trace"); - builder.AppendLine(exception.StackTrace); + _ = builder.AppendLine($"[EXCEPTION]: \"{exception.GetType()}\""); + _ = builder.AppendLine(">> Stack trace"); + _ = builder.AppendLine(exception.StackTrace); if (data is not null) { - foreach (var info in data) + foreach ((string Property, object? Value) info in data) { - builder.AppendLine($">> {info.Property}: \"{info.Value ?? ""}\""); + _ = builder.AppendLine($">> {info.Property}: \"{info.Value ?? ""}\""); } } Trace.Write(builder); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Core.Shared/Services/IAnalyticsService.cs b/samples/ComputeSharp.SwapChain.Core.Shared/Services/IAnalyticsService.cs index d5c0a92e..34313347 100644 --- a/samples/ComputeSharp.SwapChain.Core.Shared/Services/IAnalyticsService.cs +++ b/samples/ComputeSharp.SwapChain.Core.Shared/Services/IAnalyticsService.cs @@ -1,4 +1,4 @@ -using System; +using System; #nullable enable @@ -22,4 +22,4 @@ public interface IAnalyticsService /// The exception that has been thrown. /// The optional event properties. void Log(Exception exception, params (string Property, object? Value)[]? data); -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Core.Shared/Shaders/Runners/ContouredLayersRunner.cs b/samples/ComputeSharp.SwapChain.Core.Shared/Shaders/Runners/ContouredLayersRunner.cs index 09804b6b..43e65539 100644 --- a/samples/ComputeSharp.SwapChain.Core.Shared/Shaders/Runners/ContouredLayersRunner.cs +++ b/samples/ComputeSharp.SwapChain.Core.Shared/Shaders/Runners/ContouredLayersRunner.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using ComputeSharp.SwapChain.Shaders; #if WINDOWS_UWP @@ -39,4 +39,4 @@ public sealed class ContouredLayersRunner : IShaderRunner return true; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/MainViewModel.cs b/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/MainViewModel.cs index e4e2cbae..ebcd4a34 100644 --- a/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/MainViewModel.cs +++ b/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/MainViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using CommunityToolkit.Diagnostics; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; @@ -170,4 +170,4 @@ public sealed partial class MainViewModel : ObservableObject { IsRenderingPaused = !IsRenderingPaused; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/ShaderRunnerViewModel.cs b/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/ShaderRunnerViewModel.cs index c8cafd7c..7931cbd8 100644 --- a/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/ShaderRunnerViewModel.cs +++ b/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/ShaderRunnerViewModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using CommunityToolkit.Mvvm.ComponentModel; #if WINDOWS_UWP using ComputeSharp.Uwp; diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs index 13437cbd..932b1ffc 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Shaders; +namespace ComputeSharp.SwapChain.Shaders; /// /// A shader creating an abstract and colorful animation. @@ -15,7 +15,7 @@ internal readonly partial struct ColorfulInfinity : IPixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The total number of layers for the final animation. @@ -32,7 +32,7 @@ internal readonly partial struct ColorfulInfinity : IPixelShader /// private float4 Tex(float3 p) { - float t = time + 78.0f; + float t = this.time + 78.0f; float4 o = new(p.X, p.Y, p.Z, 3.0f * Hlsl.Sin(t * 0.1f)); float4 dec = new float4(1.0f, 0.9f, 0.1f, 0.15f) + @@ -40,7 +40,7 @@ internal readonly partial struct ColorfulInfinity : IPixelShader for (int i = 0; i++ < NumberOfIterations;) { - o.XZYW = Hlsl.Abs(o / Hlsl.Dot(o, o) - dec); + o.XZYW = Hlsl.Abs((o / Hlsl.Dot(o, o)) - dec); } return o; @@ -49,9 +49,9 @@ internal readonly partial struct ColorfulInfinity : IPixelShader /// public float4 Execute() { - float2 uv = (ThreadIds.XY - (float2)DispatchSize.XY * 0.5f) / DispatchSize.Y; + float2 uv = (ThreadIds.XY - ((float2)DispatchSize.XY * 0.5f)) / DispatchSize.Y; float3 col = 0; - float t = time * 0.3f; + float t = this.time * 0.3f; for (float i = 0.0f; i <= 1.0f; i += 1.0f / NumberOfLayers) { @@ -68,4 +68,4 @@ internal readonly partial struct ColorfulInfinity : IPixelShader return new(col.X, col.Y, col.Z, 1.0f); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs index 91b0b04d..04b6f7ab 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Shaders; +namespace ComputeSharp.SwapChain.Shaders; /// /// Constructing some concise contoured layers, then applying various edge and shading effects to produce some faux depth. @@ -14,12 +14,12 @@ internal readonly partial struct ContouredLayers : IPixelShader /// /// The current time Hlsl.Since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The background texture to sample. /// - public readonly IReadOnlyNormalizedTexture2D texture; + private readonly IReadOnlyNormalizedTexture2D texture; // float3 to float hash. private static float Hash21(float2 p) @@ -34,7 +34,7 @@ internal readonly partial struct ContouredLayers : IPixelShader p = Hlsl.Frac(new float2(262144, 32768) * n); - return Hlsl.Sin(p * 6.2831853f + time); + return Hlsl.Sin((p * 6.2831853f) + this.time); } // float2 to float2 hash. @@ -42,7 +42,7 @@ internal readonly partial struct ContouredLayers : IPixelShader { float n = Hlsl.Sin(Hlsl.Dot(p, new float2(41, 289))); - return Hlsl.Frac(new float2(262144, 32768) * n) * 2.0f - 1.0f; + return (Hlsl.Frac(new float2(262144, 32768) * n) * 2.0f) - 1.0f; } // Smooth 2D noise @@ -59,7 +59,7 @@ internal readonly partial struct ContouredLayers : IPixelShader v.Z = Hlsl.Dot(Hash22B(i + float2.UnitY), p - float2.UnitY); v.W = Hlsl.Dot(Hash22B(i + 1.0f), p - 1.0f); - p = p * p * (3.0f - 2.0f * p); + p = p * p * (3.0f - (2.0f * p)); return Hlsl.Lerp(Hlsl.Lerp(v.X, v.Y, p.X), Hlsl.Lerp(v.Z, v.W, p.X), p.Y); } @@ -68,7 +68,7 @@ internal readonly partial struct ContouredLayers : IPixelShader private float Noise2D3G(float2 p) { float2 i = Hlsl.Floor(p); - + p -= i; float4 v = default; @@ -78,7 +78,7 @@ internal readonly partial struct ContouredLayers : IPixelShader v.Z = Hlsl.Dot(Hash22(i + float2.UnitY), p - float2.UnitY); v.W = Hlsl.Dot(Hash22(i + 1.0f), p - 1.0f); - p = p * p * p * (p * (p * 6.0f - 15.0f) + 10.0f); + p = p * p * p * ((p * ((p * 6.0f) - 15.0f)) + 10.0f); return Hlsl.Lerp(Hlsl.Lerp(v.X, v.Y, p.X), Hlsl.Lerp(v.Z, v.W, p.X), p.Y); } @@ -86,7 +86,7 @@ internal readonly partial struct ContouredLayers : IPixelShader // Map function with noise layers private float MapNoise(float3 p, float i) { - return Noise2D3G(p.XY * 3.0f) * 0.66f + Noise2D3G(p.XY * 6.0f) * 0.34f + i / 10.0f * 1.0f - 0.15f; + return (Noise2D3G(p.XY * 3.0f) * 0.66f) + (Noise2D3G(p.XY * 6.0f) * 0.34f) + (i / 10.0f * 1.0f) - 0.15f; } // 2D derivative function. @@ -111,13 +111,13 @@ internal readonly partial struct ContouredLayers : IPixelShader // Layer color. Based on the shade, layer number and smoothing factor. private float3 GetColor(float2 p, float sh, float fi) { - float3 tx = texture.Sample(p + Hash21(new float2(sh, fi))).XYZ; - + float3 tx = this.texture.Sample(p + Hash21(new float2(sh, fi))).XYZ; + tx *= tx; float3 col; - col = (float3)1.0 * (1.0f - 0.75f / (1.0f + sh * sh * 2.0f)); + col = (float3)1.0 * (1.0f - (0.75f / (1.0f + (sh * sh * 2.0f)))); col = Hlsl.Min(col * tx * 3.0f, 1.0f); return col; @@ -128,12 +128,15 @@ internal readonly partial struct ContouredLayers : IPixelShader { p *= res / 16.0f; - float hatch = Hlsl.Clamp(Hlsl.Sin((p.X - p.Y) * 3.14159f * 200.0f) * 2.0f + 0.5f, 0.0f, 1.0f); + float hatch = Hlsl.Clamp((Hlsl.Sin((p.X - p.Y) * 3.14159f * 200.0f) * 2.0f) + 0.5f, 0.0f, 1.0f); float hRnd = Hash21(Hlsl.Floor(p * 6.0f) + 0.73f); - if (hRnd > 0.66f) hatch = hRnd; + if (hRnd > 0.66f) + { + hatch = hRnd; + } - hatch = hatch * 0.75f + 0.5f; + hatch = (hatch * 0.75f) + 0.5f; return hatch; } @@ -143,7 +146,7 @@ internal readonly partial struct ContouredLayers : IPixelShader { float2 fragCoord = new(ThreadIds.X, DispatchSize.Y - ThreadIds.Y); float res = Hlsl.Min(DispatchSize.Y, 700.0f); - float2 uv = (fragCoord - (float2)DispatchSize.XY * 0.5f) / res; + float2 uv = (fragCoord - ((float2)DispatchSize.XY * 0.5f)) / res; float sf = 1.0f / DispatchSize.Y; float3 col = GetColor(uv, 0.0f, 0.0f); float pL = 0.0f; @@ -161,8 +164,8 @@ internal readonly partial struct ContouredLayers : IPixelShader hatch = Hatch(uv + Hlsl.Sin(new float2(41.0f, 289.0f) * (fi + 1.0f)), res); float4 c = MapLayer(new float3(uv, 1.0f), fi); - float4 cSh = MapLayer(new float3(uv - new float2(0.03f, -0.03f) * ((flNum - fi) / flNum * 0.5f + 0.5f), 1.0f), fi); - float sh = (fi + 1.0f) / (flNum); + float4 cSh = MapLayer(new float3(uv - (new float2(0.03f, -0.03f) * (((flNum - fi) / flNum * 0.5f) + 0.5f)), 1.0f), fi); + float sh = (fi + 1.0f) / flNum; float3 lCol = GetColor(uv, sh, fi + 1.0f); float3 ld = Hlsl.Normalize(new float3(-1, 1, -0.25f)); float3 n = Hlsl.Normalize(new float3(0.0f, 0.0f, -1.0f) + c.YZW); @@ -178,17 +181,17 @@ internal readonly partial struct ContouredLayers : IPixelShader col = Hlsl.Lerp(col, float3.Zero, (1.0f - Hlsl.SmoothStep(0.0f, sfLSh, Hlsl.Max(cSh.X, pL))) * shF); col = Hlsl.Lerp(col, float3.Zero, (1.0f - Hlsl.SmoothStep(0.0f, sfL * 3.0f, c.X)) * 0.25f); col = Hlsl.Lerp(col, float3.Zero, (1.0f - Hlsl.SmoothStep(0.0f, sfL, c.X)) * 0.85f); - col = Hlsl.Lerp(col, eCol * hatch, (1.0f - Hlsl.SmoothStep(0.0f, sfL, c.X + Hlsl.Length(c.YZX) * 0.003f))); - col = Hlsl.Lerp(col, lCol * hatch, (1.0f - Hlsl.SmoothStep(0.0f, sfL, c.X + Hlsl.Length(c.YZX) * 0.006f))); + col = Hlsl.Lerp(col, eCol * hatch, 1.0f - Hlsl.SmoothStep(0.0f, sfL, c.X + (Hlsl.Length(c.YZX) * 0.003f))); + col = Hlsl.Lerp(col, lCol * hatch, 1.0f - Hlsl.SmoothStep(0.0f, sfL, c.X + (Hlsl.Length(c.YZX) * 0.006f))); pL = c.X; } col *= Hlsl.Lerp(new float3(1.8f, 1, 0.7f).ZYX, new float3(1.8f, 1, 0.7f).XZY, Noise2D(uv * 2.0f)); - float3 rn3 = Noise2D(uv * DispatchSize.Y / 1.0f + 1.7f) - Noise2D(uv * DispatchSize.Y / 1.0f + 3.4f); + float3 rn3 = Noise2D((uv * DispatchSize.Y / 1.0f) + 1.7f) - Noise2D((uv * DispatchSize.Y / 1.0f) + 3.4f); - col *= 0.93f + 0.07f * rn3.XYZ + 0.07f * Hlsl.Dot(rn3, new float3(0.299f, 0.587f, 0.114f)); + col *= 0.93f + (0.07f * rn3.XYZ) + (0.07f * Hlsl.Dot(rn3, new float3(0.299f, 0.587f, 0.114f))); uv = fragCoord / DispatchSize.XY; @@ -196,4 +199,4 @@ internal readonly partial struct ContouredLayers : IPixelShader return new float4(Hlsl.Sqrt(Hlsl.Max(col, 0.0f)), 1); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs index dbaf8d63..888530d8 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Shaders; +namespace ComputeSharp.SwapChain.Shaders; /// /// A basic extruded square grid-based blobby Truchet pattern. @@ -14,7 +14,7 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// /// Curve shape - Round: 0, Semi-round: 1, Octagonal: 2, Superellipse: 3, Straight: 4. @@ -48,11 +48,14 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader { return Hlsl.Length(p); } - else p = Hlsl.Abs(p); + else + { + p = Hlsl.Abs(p); + } switch (SHAPE) { - case 1: return Hlsl.Max(Hlsl.Length(p), (p.X + p.Y) * 0.7071f + 0.015f); + case 1: return Hlsl.Max(Hlsl.Length(p), ((p.X + p.Y) * 0.7071f) + 0.015f); case 2: return Hlsl.Max((p.X + p.Y) * 0.7071f, Hlsl.Max(p.X, p.Y)); case 3: return Hlsl.Pow(Hlsl.Dot(Hlsl.Pow(p, 3), 1), 1.0f / 3.0f); default: return (p.X + p.Y) * 0.7071f; @@ -62,7 +65,7 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader // GLSL's mod function private static float Mod(float x, float y) { - return x - y * Hlsl.Floor(x / y); + return x - (y * Hlsl.Floor(x / y)); } // A standard square grid 2D blobby Truchet routine: Render circles @@ -77,17 +80,27 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader float rnd = Hlsl.Frac(Hlsl.Sin(Hlsl.Dot(ip, new float2(1, 113))) * 45758.5453f); - if (rnd < 0.5f) p.Y = -p.Y; + if (rnd < 0.5f) + { + p.Y = -p.Y; + } - float d = Hlsl.Min(Distance(p - 0.5f * sc), Distance(p + 0.5f * sc)) - 0.5f * sc; + float d = Hlsl.Min(Distance(p - (0.5f * sc)), Distance(p + (0.5f * sc))) - (0.5f * sc); if (SHAPE == 4) { - d += (0.5f - 0.5f / Hlsl.Sqrt(2.0f)) * sc; + d += (0.5f - (0.5f / Hlsl.Sqrt(2.0f))) * sc; } - if (rnd < 0.5f) d = -d; - if (Mod(ip.X + ip.Y, 2.0f) < 0.5f) d = -d; + if (rnd < 0.5f) + { + d = -d; + } + + if (Mod(ip.X + ip.Y, 2.0f) < 0.5f) + { + d = -d; + } return d - 0.03f; } @@ -100,18 +113,18 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader float fl = -p.Z; float obj = Truchet(p.XY); - obj = Hlsl.Max(obj, Hlsl.Abs(p.Z) - 0.125f) - Hlsl.SmoothStep(0.03f, 0.25f, -obj) * 0.1f; + obj = Hlsl.Max(obj, Hlsl.Abs(p.Z) - 0.125f) - (Hlsl.SmoothStep(0.03f, 0.25f, -obj) * 0.1f); float studs = 1e5f; const float sc = 0.5f; - float2 q = p.XY + 0.5f * sc; + float2 q = p.XY + (0.5f * sc); float2 iq = Hlsl.Floor(q / sc) + 0.5f; q -= iq * sc; if (Mod(iq.X + iq.Y, 2.0f) > 0.5f) { - studs = Hlsl.Max(Hlsl.Length(q) - 0.1f * sc - 0.02f, Hlsl.Abs(p.Z) - 0.26f); + studs = Hlsl.Max(Hlsl.Length(q) - (0.1f * sc) - 0.02f, Hlsl.Abs(p.Z) - 0.26f); } objID = fl < obj && fl < studs ? 0 : obj < studs ? 1 : 2; @@ -136,18 +149,20 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader for (int i = 0; i < iter; i++) { - float d = M(ro + rd * t); + float d = M(ro + (rd * t)); shade = Hlsl.Min(shade, k * d / t); t += Hlsl.Clamp(d, 0.01f, 0.25f); - if (d < 0.0f || t > end) break; + if (d < 0.0f || t > end) + { + break; + } } return Hlsl.Max(shade, 0.0f); } - // I keep a collection of occlusion routines... OK, that sounded really nerdy. :) // Anyway, I like this one. I'm assuHlsl.Ming it's based on IQ's original. private float CalculateAO(in float3 p, in float3 n) @@ -155,15 +170,18 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader float sca = 2.0f; float occ = 0.0f; - for (int i = (int)Hlsl.Min(time, 0f); i < 5; i++) + for (int i = (int)Hlsl.Min(this.time, 0f); i < 5; i++) { float hr = (i + 1f) * 0.15f / 5.0f; - float d = M(p + n * hr); + float d = M(p + (n * hr)); occ += (hr - d) * sca; sca *= 0.7f; - if (sca > 1e5f) break; + if (sca > 1e5f) + { + break; + } } return Hlsl.Clamp(1.0f - occ, 0.0f, 1.0f); @@ -184,31 +202,34 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader public float4 Execute() { int2 coords = new(ThreadIds.X, DispatchSize.Y - ThreadIds.Y); - float2 u = (coords - (float2)DispatchSize.XY * 0.5f) / DispatchSize.Y; + float2 u = (coords - ((float2)DispatchSize.XY * 0.5f)) / DispatchSize.Y; float3 r = Hlsl.Normalize(new float3(u, 1)); - float3 o = new(0, time / 2.0f, -3); + float3 o = new(0, this.time / 2.0f, -3); float3 l = o + new float3(0.25f, 0.25f, 2.0f); r.YZ = Hlsl.Mul(Rotate2x2(0.15f), r.YZ); - r.XZ = Hlsl.Mul(Rotate2x2(-Hlsl.Cos(time * 3.14159f / 32.0f) / 8.0f), r.XZ); - r.XY = Hlsl.Mul(Rotate2x2(Hlsl.Sin(time * 3.14159f / 32.0f) / 8.0f), r.XY); + r.XZ = Hlsl.Mul(Rotate2x2(-Hlsl.Cos(this.time * 3.14159f / 32.0f) / 8.0f), r.XZ); + r.XY = Hlsl.Mul(Rotate2x2(Hlsl.Sin(this.time * 3.14159f / 32.0f) / 8.0f), r.XY); float d; - float t = Hash21(r.XY * 57.0f + Hlsl.Frac(time)) * 0.5f; + float t = Hash21((r.XY * 57.0f) + Hlsl.Frac(this.time)) * 0.5f; float glow = 0; for (int i = 0; i < 96; i++) { - d = M(o + r * t); + d = M(o + (r * t)); - if (Hlsl.Abs(d) < 0.001f) break; + if (Hlsl.Abs(d) < 0.001f) + { + break; + } t += d * 0.7f; - glow += 0.2f / (1.0f + Hlsl.Abs(d) * 5.0f); + glow += 0.2f / (1.0f + (Hlsl.Abs(d) * 5.0f)); } int gObjID = objID; - float3 p = o + r * t; + float3 p = o + (r * t); float3 n = Normal(p); float2 uv = p.XY; float sc = 0.5f; @@ -216,21 +237,21 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader uv -= iuv * sc; - float2 uv2 = p.XY + 0.5f * sc; + float2 uv2 = p.XY + (0.5f * sc); float2 iuv2 = Hlsl.Floor(uv2 / sc) + 0.5f; uv2 -= iuv2 * sc; - float bord = Hlsl.Max(Hlsl.Abs(uv.X), Hlsl.Abs(uv.Y)) - 0.5f * sc; + float bord = Hlsl.Max(Hlsl.Abs(uv.X), Hlsl.Abs(uv.Y)) - (0.5f * sc); bord = Hlsl.Abs(bord) - 0.002f; d = Truchet(p.XY); float lSc = 20.0f; - float pat = (Hlsl.Abs(Hlsl.Frac((uv.X - uv.Y) * lSc - 0.5f) - 0.5f) * 2.0f - 0.5f) / lSc; - float pat2 = (Hlsl.Abs(Hlsl.Frac((uv.X + uv.Y) * lSc + 0.5f) - 0.5f) * 2.0f - 0.5f) / lSc; + float pat = ((Hlsl.Abs(Hlsl.Frac(((uv.X - uv.Y) * lSc) - 0.5f) - 0.5f) * 2.0f) - 0.5f) / lSc; + float pat2 = ((Hlsl.Abs(Hlsl.Frac(((uv.X + uv.Y) * lSc) + 0.5f) - 0.5f) * 2.0f) - 0.5f) / lSc; float sf = Hlsl.Dot(Hlsl.Sin(p.XY - Hlsl.Cos(p.YX * 2.0f)), 0.5f); - float sf2 = Hlsl.Dot(Hlsl.Sin(p.XY * 1.5f - Hlsl.Cos(p.YX * 3.0f)), 0.5f); + float sf2 = Hlsl.Dot(Hlsl.Sin((p.XY * 1.5f) - Hlsl.Cos(p.YX * 3.0f)), 0.5f); float4 col1 = Hlsl.Lerp(new float4(1, 0.75f, 0.6f, 0), new float4(1, 0.85f, 0.65f, 0), Hlsl.SmoothStep(-0.5f, 0.5f, sf)); float4 col2 = Hlsl.Lerp(new float4(0.4f, 0.7f, 1, 0), new float4(0.3f, 0.85f, 0.95f, 0), Hlsl.SmoothStep(-0.5f, 0.5f, sf2) * 0.5f); @@ -244,7 +265,10 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader oCol = Hlsl.Lerp(col2, 0, (1.0f - Hlsl.SmoothStep(0, 0.01f, pat2)) * 0.35f); oCol = Hlsl.Lerp(oCol, 0, (1.0f - Hlsl.SmoothStep(0, 0.01f, bord)) * 0.8f); - if (Mod(iuv.X + iuv.Y, 2.0f) > 0.5f) oCol *= 0.8f; + if (Mod(iuv.X + iuv.Y, 2.0f) > 0.5f) + { + oCol *= 0.8f; + } oCol = Hlsl.Lerp(oCol, 0, (1.0f - Hlsl.SmoothStep(0, 0.01f, d - 0.015f)) * 0.8f); } @@ -254,7 +278,10 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader float4 fCol = Hlsl.Lerp(col1, 0, (1.0f - Hlsl.SmoothStep(0, 0.01f, pat)) * 0.35f); fCol = Hlsl.Lerp(fCol, 0, (1.0f - Hlsl.SmoothStep(0, 0.01f, bord)) * 0.8f); - if (Mod(iuv.X + iuv.Y, 2.0f) < 0.5f) fCol *= 0.8f; + if (Mod(iuv.X + iuv.Y, 2.0f) < 0.5f) + { + fCol *= 0.8f; + } oCol = Hlsl.Lerp(oCol, fCol, 1 - Hlsl.SmoothStep(0, 0.01f, d + 0.08f)); oCol = Hlsl.Lerp(oCol, 0, (1 - Hlsl.SmoothStep(0, 0.01f, Hlsl.Length(uv2) - 0.08f)) * 0.8f); @@ -283,16 +310,16 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader ld /= lDist; - float at = 1.0f / (1.0f + lDist * lDist * 0.125f); + float at = 1.0f / (1.0f + (lDist * lDist * 0.125f)); float sh = SoftShadow(p, l, n, 8); float ao = CalculateAO(p, n); float df = Hlsl.Max(Hlsl.Dot(n, ld), 0); float sp = Hlsl.Pow(Hlsl.Max(Hlsl.Dot(Hlsl.Reflect(r, n), ld), 0), 32); - float4 c = oCol * (df * sh + sp * sh + 0.5f) * at * ao; + float4 c = oCol * ((df * sh) + (sp * sh) + 0.5f) * at * ao; c = Hlsl.Sqrt(Hlsl.Max(c, 0)); return c; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs index 7fa9a2ef..dc14ebe5 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Shaders; +namespace ComputeSharp.SwapChain.Shaders; /// /// A shader which interpolates four different colors into a rotating gradient pattern. @@ -15,13 +15,13 @@ internal readonly partial struct FourColorGradient : IPixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; // Colors to blend together - private static readonly float3 colorOne = new(0.999f, 0.999f, 0.999f); - private static readonly float3 colorTwo = new(0.999f, 0f, 0f); - private static readonly float3 colorThree = new(0f, 0.999f, 0f); - private static readonly float3 colorFour = new(0f, 0f, 0.999f); + private static readonly float3 ColorOne = new(0.999f, 0.999f, 0.999f); + private static readonly float3 ColorTwo = new(0.999f, 0f, 0f); + private static readonly float3 ColorThree = new(0f, 0.999f, 0f); + private static readonly float3 ColorFour = new(0f, 0f, 0.999f); /// /// Standard 2D rotation formula. @@ -55,24 +55,23 @@ internal readonly partial struct FourColorGradient : IPixelShader { float2 i = Hlsl.Floor(p); float2 f = Hlsl.Frac(p); - float2 u = f * f * (3.0f - 2.0f * f); + float2 u = f * f * (3.0f - (2.0f * f)); // Mix -> Lerp float n = Hlsl.Lerp( Hlsl.Lerp( - Hlsl.Dot(-1.0f + 2.0f * Hash(i + new float2(0.0f, 0.0f)), f - new float2(0.0f, 0.0f)), - Hlsl.Dot(-1.0f + 2.0f * Hash(i + new float2(1.0f, 0.0f)), f - new float2(1.0f, 0.0f)), + Hlsl.Dot(-1.0f + (2.0f * Hash(i + new float2(0.0f, 0.0f))), f - new float2(0.0f, 0.0f)), + Hlsl.Dot(-1.0f + (2.0f * Hash(i + new float2(1.0f, 0.0f))), f - new float2(1.0f, 0.0f)), u.X), Hlsl.Lerp( - Hlsl.Dot(-1.0f + 2.0f * Hash(i + new float2(0.0f, 1.0f)), f - new float2(0.0f, 1.0f)), - Hlsl.Dot(-1.0f + 2.0f * Hash(i + new float2(1.0f, 1.0f)), f - new float2(1.0f, 1.0f)), - u.X), + Hlsl.Dot(-1.0f + (2.0f * Hash(i + new float2(0.0f, 1.0f))), f - new float2(0.0f, 1.0f)), + Hlsl.Dot(-1.0f + (2.0f * Hash(i + new float2(1.0f, 1.0f))), f - new float2(1.0f, 1.0f)), + u.X), u.Y); - return 0.5f + 0.5f * n; + return 0.5f + (0.5f * n); } - /// public float4 Execute() { @@ -84,25 +83,25 @@ internal readonly partial struct FourColorGradient : IPixelShader tuv -= 0.5f; // Rotate with noise - float degree = Noise(new float2(time * 0.1f, tuv.X * tuv.Y)); + float degree = Noise(new float2(this.time * 0.1f, tuv.X * tuv.Y)); tuv.Y *= 1.0f / ratio; - tuv.XY = Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians((degree - 0.5f) * 720.0f + 180.0f))); + tuv.XY = Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(((degree - 0.5f) * 720.0f) + 180.0f))); tuv.Y *= ratio; // Wave warp with sin float frequency = 5.0f; float amplitude = 30.0f; - float speed = time * 2.0f; + float speed = this.time * 2.0f; - tuv.X += Hlsl.Sin(tuv.Y * frequency + speed) / amplitude; - tuv.Y += Hlsl.Sin(tuv.X * frequency * 1.5f + speed) / (amplitude * 0.5f); + tuv.X += Hlsl.Sin((tuv.Y * frequency) + speed) / amplitude; + tuv.Y += Hlsl.Sin((tuv.X * frequency * 1.5f) + speed) / (amplitude * 0.5f); // Draw the image - float3 layer1 = Hlsl.Lerp(colorOne, colorTwo, Hlsl.SmoothStep(-0.3f, 0.2f, Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(-5.0f))).X)); - float3 layer2 = Hlsl.Lerp(colorThree, colorFour, Hlsl.SmoothStep(-0.3f, 0.2f, Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(-5.0f))).X)); + float3 layer1 = Hlsl.Lerp(ColorOne, ColorTwo, Hlsl.SmoothStep(-0.3f, 0.2f, Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(-5.0f))).X)); + float3 layer2 = Hlsl.Lerp(ColorThree, ColorFour, Hlsl.SmoothStep(-0.3f, 0.2f, Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(-5.0f))).X)); float3 col = Hlsl.Lerp(layer1, layer2, Hlsl.SmoothStep(0.5f, -0.3f, tuv.Y)); return new(col, 1.0f); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs index 06cf1d1e..5b7b8d56 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Shaders; +namespace ComputeSharp.SwapChain.Shaders; /// /// A shader creating a fractal tiling animation. @@ -15,12 +15,12 @@ internal readonly partial struct FractalTiling : IPixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// public float4 Execute() { - float2 position = ((float2)(256 * ThreadIds.XY)) / DispatchSize.X + time; + float2 position = (((float2)(256 * ThreadIds.XY)) / DispatchSize.X) + this.time; float4 color = 0; for (int i = 0; i < 6; i++) @@ -28,7 +28,7 @@ internal readonly partial struct FractalTiling : IPixelShader float2 a = Hlsl.Floor(position); float2 b = Hlsl.Frac(position); float4 w = Hlsl.Frac( - (Hlsl.Sin(a.X * 7 + 31.0f * a.Y + 0.01f * time) + + (Hlsl.Sin((a.X * 7) + (31.0f * a.Y) + (0.01f * this.time)) + new float4(0.035f, 0.01f, 0, 0.7f)) * 13.545317f); @@ -45,4 +45,4 @@ internal readonly partial struct FractalTiling : IPixelShader return color; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs index 793c234a..1fa112b7 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Shaders; +namespace ComputeSharp.SwapChain.Shaders; /// /// A simple shader to get started with based on shadertoy new shader template. @@ -13,7 +13,7 @@ internal readonly partial struct HelloWorld : IPixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// public float4 Execute() @@ -22,9 +22,9 @@ internal readonly partial struct HelloWorld : IPixelShader float2 uv = ThreadIds.Normalized.XY; // Time varying pixel color - float3 col = 0.5f + 0.5f * Hlsl.Cos(time + new float3(uv, uv.X) + new float3(0, 2, 4)); + float3 col = 0.5f + (0.5f * Hlsl.Cos(this.time + new float3(uv, uv.X) + new float3(0, 2, 4))); // Output to screen return new(col, 1f); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs index 37f655d6..58eab595 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Shaders; +namespace ComputeSharp.SwapChain.Shaders; /// /// A shader creating a flythrough in a Menger system. @@ -14,7 +14,7 @@ internal readonly partial struct MengerJourney : IPixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; private const int MaxSteps = 30; private const float MinimumDistance = 0.0009f; @@ -39,7 +39,7 @@ internal readonly partial struct MengerJourney : IPixelShader /// private static float2 Rotate(float2 v, float a) { - return new(Hlsl.Cos(a) * v.X + Hlsl.Sin(a) * v.Y, -Hlsl.Sin(a) * v.X + Hlsl.Cos(a) * v.Y); + return new((Hlsl.Cos(a) * v.X) + (Hlsl.Sin(a) * v.Y), (-Hlsl.Sin(a) * v.X) + (Hlsl.Cos(a) * v.Y)); } /// @@ -55,8 +55,8 @@ internal readonly partial struct MengerJourney : IPixelShader float diffuse2 = Hlsl.Max(0.0f, Hlsl.Dot(-normal, lightDir2)); return - (diffuse * Diffuse) * (LightColor * color) + - (diffuse2 * Diffuse) * (LightColor2 * color); + (diffuse * Diffuse * (LightColor * color)) + + (diffuse2 * Diffuse * (LightColor2 * color)); } /// @@ -68,7 +68,7 @@ internal readonly partial struct MengerJourney : IPixelShader // Performs the GLSL mod function. static float3 Mod(float3 x, float y) { - return x - y * Hlsl.Floor(x / y); + return x - (y * Hlsl.Floor(x / y)); } z = Hlsl.Abs(1.0f - Mod(z, 2.0f)); @@ -77,14 +77,16 @@ internal readonly partial struct MengerJourney : IPixelShader for (int n = 0; n < Iterations; n++) { - z.XY = Rotate(z.XY, 4.0f + 2.0f * Hlsl.Cos(time / 8.0f)); + z.XY = Rotate(z.XY, 4.0f + (2.0f * Hlsl.Cos(this.time / 8.0f))); z = Hlsl.Abs(z); if (z.X < z.Y) { z.XY = z.YX; } + if (z.X < z.Z) { z.XZ = z.ZX; } + if (z.Y < z.Z) { z.YZ = z.ZY; } - z = Scale * z - Offset * (Scale - 1.0f); + z = (Scale * z) - (Offset * (Scale - 1.0f)); if (z.Z < -0.5f * Offset.Z * (Scale - 1.0)) { @@ -100,7 +102,7 @@ internal readonly partial struct MengerJourney : IPixelShader /// /// Calculates the finite difference normal at a given position. /// - private float3 getNormal(in float3 pos) + private float3 GetNormal(in float3 pos) { float3 e = new(0.0f, NormalDistance, 0.0f); @@ -121,7 +123,7 @@ internal readonly partial struct MengerJourney : IPixelShader return Hlsl.Frac(Hlsl.Cos(Hlsl.Dot(co, new float2(4.898f, 7.23f))) * 23421.631f); } - float totalDistance = Jitter * Rand(fragCoord.XY + time); + float totalDistance = Jitter * Rand(fragCoord.XY + this.time); float3 dir2 = dir; float distance = 0; int steps = 0; @@ -129,23 +131,26 @@ internal readonly partial struct MengerJourney : IPixelShader for (int i = 0; i < MaxSteps; i++) { - dir.ZY = Rotate(dir2.ZY, totalDistance * Hlsl.Cos(time / 4.0f) * NonLinearPerspective); - pos = from + totalDistance * dir; + dir.ZY = Rotate(dir2.ZY, totalDistance * Hlsl.Cos(this.time / 4.0f) * NonLinearPerspective); + pos = from + (totalDistance * dir); distance = DE(pos) * FudgeFactor; totalDistance += distance; - if (distance < MinimumDistance) break; + if (distance < MinimumDistance) + { + break; + } steps = i; } - float smoothStep = steps + distance / MinimumDistance; - float ao = 1.1f - smoothStep / MaxSteps; - float3 normal = getNormal(pos - dir * NormalDistance * 3.0f); + float smoothStep = steps + (distance / MinimumDistance); + float ao = 1.1f - (smoothStep / MaxSteps); + float3 normal = GetNormal(pos - (dir * NormalDistance * 3.0f)); float3 color = 1.0f; float3 light = GetLight(color, normal); - color = (color * Ambient + light) * ao; + color = ((color * Ambient) + light) * ao; return new(color.X, color.Y, color.Z, 1.0f); } @@ -153,20 +158,20 @@ internal readonly partial struct MengerJourney : IPixelShader /// public float4 Execute() { - float3 camPos = 0.5f * time * new float3(1.0f, 0.0f, 0.0f); - float3 target = camPos + new float3(1.0f, 0.0f * Hlsl.Cos(time), 0.0f * Hlsl.Sin(0.4f * time)); + float3 camPos = 0.5f * this.time * new float3(1.0f, 0.0f, 0.0f); + float3 target = camPos + new float3(1.0f, 0.0f * Hlsl.Cos(this.time), 0.0f * Hlsl.Sin(0.4f * this.time)); float3 camDir = Hlsl.Normalize(target - camPos); float3 camUp = new(0.0f, 1.0f, 0.0f); - camUp = Hlsl.Normalize(camUp - Hlsl.Dot(camDir, camUp) * camDir); + camUp = Hlsl.Normalize(camUp - (Hlsl.Dot(camDir, camUp) * camDir)); float3 camRight = Hlsl.Normalize(Hlsl.Cross(camDir, camUp)); - float2 coord = -1.0f + 2.0f * (float2)ThreadIds.XY / DispatchSize.XY; + float2 coord = -1.0f + (2.0f * (float2)ThreadIds.XY / DispatchSize.XY); coord.X *= (float)DispatchSize.X / DispatchSize.Y; - float3 rayDir = Hlsl.Normalize(camDir + (coord.X * camRight + coord.Y * camUp) * FieldOfView); + float3 rayDir = Hlsl.Normalize(camDir + (((coord.X * camRight) + (coord.Y * camUp)) * FieldOfView)); return RayMarch(camPos, rayDir, ThreadIds.XY); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs index cf09264b..f10aa0c3 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Shaders; +namespace ComputeSharp.SwapChain.Shaders; /// /// A shader creating an octagram animation, inspired by arabesque. @@ -14,7 +14,7 @@ internal readonly partial struct Octagrams : IPixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; private static float2x2 Rotate(float a) { @@ -53,25 +53,25 @@ internal readonly partial struct Octagrams : IPixelShader pos.Y += Hlsl.Sin(gTime * 0.4f) * 2.5f; pos.XY = Hlsl.Mul(pos.XY, Rotate(0.8f)); - float box1 = Box(pos, 2.0f - Hlsl.Abs(Hlsl.Sin(gTime * 0.4f)) * 1.5f); + float box1 = Box(pos, 2.0f - (Hlsl.Abs(Hlsl.Sin(gTime * 0.4f)) * 1.5f)); pos = pos_origin; pos.Y -= Hlsl.Sin(gTime * 0.4f) * 2.5f; pos.XY = Hlsl.Mul(pos.XY, Rotate(0.8f)); - float box2 = Box(pos, 2.0f - Hlsl.Abs(Hlsl.Sin(gTime * 0.4f)) * 1.5f); + float box2 = Box(pos, 2.0f - (Hlsl.Abs(Hlsl.Sin(gTime * 0.4f)) * 1.5f)); pos = pos_origin; pos.X += Hlsl.Sin(gTime * 0.4f) * 2.5f; pos.XY = Hlsl.Mul(pos.XY, Rotate(0.8f)); - float box3 = Box(pos, 2.0f - Hlsl.Abs(Hlsl.Sin(gTime * 0.4f)) * 1.5f); + float box3 = Box(pos, 2.0f - (Hlsl.Abs(Hlsl.Sin(gTime * 0.4f)) * 1.5f)); pos = pos_origin; pos.X -= Hlsl.Sin(gTime * 0.4f) * 2.5f; pos.XY = Hlsl.Mul(pos.XY, Rotate(0.8f)); - float box4 = Box(pos, 2.0f - Hlsl.Abs(Hlsl.Sin(gTime * 0.4f)) * 1.5f); + float box4 = Box(pos, 2.0f - (Hlsl.Abs(Hlsl.Sin(gTime * 0.4f)) * 1.5f)); pos = pos_origin; pos.XY = Hlsl.Mul(pos.XY, Rotate(0.8f)); @@ -89,12 +89,12 @@ internal readonly partial struct Octagrams : IPixelShader /// public float4 Execute() { - float2 p = ((float2)ThreadIds.XY * 2.0f - DispatchSize.XY) / Hlsl.Min(DispatchSize.X, DispatchSize.Y); - float3 ro = new(0.0f, -0.2f, time * 4.0f); + float2 p = (((float2)ThreadIds.XY * 2.0f) - DispatchSize.XY) / Hlsl.Min(DispatchSize.X, DispatchSize.Y); + float3 ro = new(0.0f, -0.2f, this.time * 4.0f); float3 ray = Hlsl.Normalize(new float3(p, 1.5f)); - ray.XY = Hlsl.Mul(ray.XY, Rotate(Hlsl.Sin(time * 0.03f) * 5.0f)); - ray.YZ = Hlsl.Mul(ray.YZ, Rotate(Hlsl.Sin(time * 0.05f) * 0.2f)); + ray.XY = Hlsl.Mul(ray.XY, Rotate(Hlsl.Sin(this.time * 0.03f) * 5.0f)); + ray.YZ = Hlsl.Mul(ray.YZ, Rotate(Hlsl.Sin(this.time * 0.05f) * 0.2f)); float t = 0.1f; float ac = 0.0f; @@ -103,14 +103,14 @@ internal readonly partial struct Octagrams : IPixelShader { static float3 Mod(float3 x, float y) { - return x - y * Hlsl.Floor(x / y); + return x - (y * Hlsl.Floor(x / y)); } - float3 pos = ro + ray * t; + float3 pos = ro + (ray * t); pos = Mod(pos - 2.0f, 4.0f) - 2.0f; - float gTime = time - i * 0.01f; + float gTime = this.time - (i * 0.01f); float d = BoxSet(pos, gTime); d = Hlsl.Max(Hlsl.Abs(d), 0.01f); @@ -118,9 +118,9 @@ internal readonly partial struct Octagrams : IPixelShader t += d * 0.55f; } - float3 col = ac * 0.02f + new float3(0.0f, 0.2f * Hlsl.Abs(Hlsl.Sin(time)), 0.5f + Hlsl.Sin(time) * 0.2f); - float4 color = new(col, 1.0f - t * (0.02f + 0.02f * Hlsl.Sin(time))); + float3 col = (ac * 0.02f) + new float3(0.0f, 0.2f * Hlsl.Abs(Hlsl.Sin(this.time)), 0.5f + (Hlsl.Sin(this.time) * 0.2f)); + float4 color = new(col, 1.0f - (t * (0.02f + (0.02f * Hlsl.Sin(this.time))))); return color; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs index 550ef977..33b358bc 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Shaders; +namespace ComputeSharp.SwapChain.Shaders; /// /// Fully procedural 3D animated volume with three evaluations per step (for shading). @@ -15,15 +15,15 @@ internal readonly partial struct ProteanClouds : IPixelShader /// /// The current time Hlsl.Since the start of the application. /// - public readonly float time; + private readonly float time; - private static readonly float3x3 m3 = new float3x3(0.33338f, 0.56034f, -0.71817f, -0.87887f, 0.32651f, -0.15323f, 0.15162f, 0.69596f, 0.61339f) * 1.93f; + private static readonly float3x3 M3 = new float3x3(0.33338f, 0.56034f, -0.71817f, -0.87887f, 0.32651f, -0.15323f, 0.15162f, 0.69596f, 0.61339f) * 1.93f; private static float2x2 Rotate(in float a) { float c = Hlsl.Cos(a); float s = Hlsl.Sin(a); - + return new(c, s, -s, c); } @@ -42,7 +42,7 @@ internal readonly partial struct ProteanClouds : IPixelShader float3 p2 = p; p2.XY -= Disp(p.Z).XY; - p.XY = Hlsl.Mul(p.XY, Rotate(Hlsl.Sin(p.Z + time) * (0.1f + prm1 * 0.05f) + time * 0.09f)); + p.XY = Hlsl.Mul(p.XY, Rotate((Hlsl.Sin(p.Z + this.time) * (0.1f + (prm1 * 0.05f))) + (this.time * 0.09f))); float cl = Hlsl.Dot(p2.XY, p2.XY); float d = 0.0f; @@ -51,21 +51,21 @@ internal readonly partial struct ProteanClouds : IPixelShader float z = 1.0f; float trk = 1.0f; - float dspAmp = 0.1f + prm1 * 0.2f; + float dspAmp = 0.1f + (prm1 * 0.2f); for (int i = 0; i < 5; i++) { - p += Hlsl.Sin(p.ZXY * 0.75f * trk + time * trk * 0.8f) * dspAmp; + p += Hlsl.Sin((p.ZXY * 0.75f * trk) + (this.time * trk * 0.8f)) * dspAmp; d -= Hlsl.Abs(Hlsl.Dot(Hlsl.Cos(p), Hlsl.Sin(p.YZX)) * z); z *= 0.57f; trk *= 1.4f; - p = Hlsl.Mul(p, m3); + p = Hlsl.Mul(p, M3); } - d = Hlsl.Abs(d + prm1 * 3.0f) + prm1 * 0.3f - 2.5f + bsMo.Y; + d = Hlsl.Abs(d + (prm1 * 3.0f)) + (prm1 * 0.3f) - 2.5f + bsMo.Y; - return new float2(d + cl * 0.2f + 0.25f, cl); + return new float2(d + (cl * 0.2f) + 0.25f, cl); } private float4 Render(float3 ro, float3 rd, float time, float prm1, float2 bsMo) @@ -76,33 +76,36 @@ internal readonly partial struct ProteanClouds : IPixelShader for (int i = 0; i < 130; i++) { - if (rez.A > 0.99f) break; + if (rez.A > 0.99f) + { + break; + } - float3 pos = ro + t * rd; + float3 pos = ro + (t * rd); float2 mpv = Map(pos, prm1, bsMo); float den = Hlsl.Clamp(mpv.X - 0.3f, 0.0f, 1.0f) * 1.12f; - float dn = Hlsl.Clamp((mpv.X + 2.0f), 0.0f, 3.0f); + float dn = Hlsl.Clamp(mpv.X + 2.0f, 0.0f, 3.0f); float4 col = 0f; if (mpv.X > 0.6f) { - col = new float4(Hlsl.Sin(new float3(5.0f, 0.4f, 0.2f) + mpv.Y * 0.1f + Hlsl.Sin(pos.Z * 0.4f) * 0.5f + 1.8f) * 0.5f + 0.5f, 0.08f); + col = new float4((Hlsl.Sin(new float3(5.0f, 0.4f, 0.2f) + (mpv.Y * 0.1f) + (Hlsl.Sin(pos.Z * 0.4f) * 0.5f) + 1.8f) * 0.5f) + 0.5f, 0.08f); col *= den * den * den; col.RGB *= LinStep(4.0f, -2.5f, mpv.X) * 2.3f; float dif = Hlsl.Clamp((den - Map(pos + 0.8f, prm1, bsMo).X) / 9.0f, 0.001f, 1.0f); dif += Hlsl.Clamp((den - Map(pos + 0.35f, prm1, bsMo).X) / 2.5f, 0.001f, 1.0f); - col.XYZ *= den * (new float3(0.005f, 0.045f, 0.075f) + 1.5f * new float3(0.033f, 0.07f, 0.03f) * dif); + col.XYZ *= den * (new float3(0.005f, 0.045f, 0.075f) + (1.5f * new float3(0.033f, 0.07f, 0.03f) * dif)); } - float fogC = Hlsl.Exp(t * 0.2f - 2.2f); + float fogC = Hlsl.Exp((t * 0.2f) - 2.2f); col += new float4(0.06f, 0.11f, 0.11f, 0.1f) * Hlsl.Clamp(fogC - fogT, 0.0f, 1.0f); fogT = fogC; rez += col * (1.0f - rez.A); - t += Hlsl.Clamp(0.5f - dn * dn * 0.05f, 0.09f, 0.3f); + t += Hlsl.Clamp(0.5f - (dn * dn * 0.05f), 0.09f, 0.3f); } return Hlsl.Clamp(rez, 0.0f, 1.0f); @@ -120,7 +123,7 @@ internal readonly partial struct ProteanClouds : IPixelShader { float3 ic = Hlsl.Lerp(a, b, x) + new float3((float)1e-6, 0.0f, 0.0f); float sd = Hlsl.Abs(GetSaturation(ic) - Hlsl.Lerp(GetSaturation(a), GetSaturation(b), x)); - float3 dir = Hlsl.Normalize(new float3(2.0f * ic.X - ic.Y - ic.Z, 2.0f * ic.Y - ic.X - ic.Z, 2.0f * ic.Z - ic.Y - ic.X)); + float3 dir = Hlsl.Normalize(new float3((2.0f * ic.X) - ic.Y - ic.Z, (2.0f * ic.Y) - ic.X - ic.Z, (2.0f * ic.Z) - ic.Y - ic.X)); float lgt = Hlsl.Dot(1.0f, ic); float ff = Hlsl.Dot(dir, Hlsl.Normalize(ic)); @@ -133,12 +136,12 @@ internal readonly partial struct ProteanClouds : IPixelShader public float4 Execute() { float2 q = (float2)ThreadIds.XY / DispatchSize.XY; - float2 p = (ThreadIds.XY - 0.5f * (float2)DispatchSize.XY) / DispatchSize.Y; + float2 p = (ThreadIds.XY - (0.5f * (float2)DispatchSize.XY)) / DispatchSize.Y; float2 bsMo = -0.5f * (float2)DispatchSize.XY / DispatchSize.Y; - float scaledTime = time * 3.0f; + float scaledTime = this.time * 3.0f; float3 ro = new(0, 0, scaledTime); - ro += new float3(Hlsl.Sin(time) * 0.5f, Hlsl.Sin(time * 1.0f) * 0.0f, 0); + ro += new float3(Hlsl.Sin(this.time) * 0.5f, Hlsl.Sin(this.time * 1.0f) * 0.0f, 0); float dspAmp = 0.85f; @@ -154,18 +157,18 @@ internal readonly partial struct ProteanClouds : IPixelShader rightdir = Hlsl.Normalize(Hlsl.Cross(updir, target)); - float3 rd = Hlsl.Normalize((p.X * rightdir + p.Y * updir) * 1.0f - target); + float3 rd = Hlsl.Normalize((((p.X * rightdir) + (p.Y * updir)) * 1.0f) - target); - rd.XY = Hlsl.Mul(rd.XY, Rotate(-Disp(scaledTime + 3.5f).X * 0.2f + bsMo.X)); + rd.XY = Hlsl.Mul(rd.XY, Rotate((-Disp(scaledTime + 3.5f).X * 0.2f) + bsMo.X)); - float prm1 = Hlsl.SmoothStep(-0.4f, 0.4f, Hlsl.Sin(time * 0.3f)); + float prm1 = Hlsl.SmoothStep(-0.4f, 0.4f, Hlsl.Sin(this.time * 0.3f)); float4 scn = Render(ro, rd, scaledTime, prm1, bsMo); float3 col = scn.RGB; col = ILerp(col.BGR, col.RGB, Hlsl.Clamp(1.0f - prm1, 0.05f, 1.0f)); col = Hlsl.Pow(col, new float3(0.55f, 0.65f, 0.6f)) * new float3(1.0f, 0.97f, 0.9f); - col *= Hlsl.Pow(16.0f * q.X * q.Y * (1.0f - q.X) * (1.0f - q.Y), 0.12f) * 0.7f + 0.3f; + col *= (Hlsl.Pow(16.0f * q.X * q.Y * (1.0f - q.X) * (1.0f - q.Y), 0.12f) * 0.7f) + 0.3f; return new(col, 1.0f); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs index b441299e..ce8988f3 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Shaders; +namespace ComputeSharp.SwapChain.Shaders; /// /// An offset grid of square-based pyramids whose tips have been offset according to an underlying directional noise field. @@ -15,7 +15,7 @@ internal readonly partial struct PyramidPattern : IPixelShader /// /// The current time Hlsl.Since the start of the application. /// - public readonly float time; + private readonly float time; // Standard 2D rotation formula. private static float2x2 Rotate2x2(in float a) @@ -37,14 +37,14 @@ internal readonly partial struct PyramidPattern : IPixelShader { float n = Hlsl.Sin(Hlsl.Dot(p, new float2(41, 289))); - return Hlsl.Frac(new float2(262144, 32768) * n) * 2.0f - 1.0f; + return (Hlsl.Frac(new float2(262144, 32768) * n) * 2.0f) - 1.0f; } // Based on IQ's gradient noise formula. private static float N2D3G(float2 p) { float2 i = Hlsl.Floor(p); - + p -= i; float4 v = default; @@ -54,7 +54,7 @@ internal readonly partial struct PyramidPattern : IPixelShader v.Z = Hlsl.Dot(Hash22B(i + float2.UnitY), p - float2.UnitY); v.W = Hlsl.Dot(Hash22B(i + 1.0f), p - 1.0f); - p = p * p * (3.0f - 2.0f * p); + p = p * p * (3.0f - (2.0f * p)); return Hlsl.Lerp(Hlsl.Lerp(v.X, v.Y, p.X), Hlsl.Lerp(v.Z, v.W, p.X), p.Y); } @@ -62,13 +62,13 @@ internal readonly partial struct PyramidPattern : IPixelShader // Two layers of noise. private static float FBM(float2 p) { - return N2D3G(p) * 0.66f + N2D3G(p * 2.0f) * 0.34f; + return (N2D3G(p) * 0.66f) + (N2D3G(p * 2.0f) * 0.34f); } // HLSL mod from GLSL private static float Mod(float x, float y) { - return x - y * Hlsl.Floor(x / y); + return x - (y * Hlsl.Floor(x / y)); } private float BMap(float2 p) @@ -84,20 +84,31 @@ internal readonly partial struct PyramidPattern : IPixelShader p -= ip + 0.5f; - float ang = -3.14159f * 3.0f / 5.0f + (FBM(ip / 8.0f + time / 3.0f)) * 6.2831f * 2.0f; + float ang = (-3.14159f * 3.0f / 5.0f) + (FBM((ip / 8.0f) + (this.time / 3.0f)) * 6.2831f * 2.0f); float2 offs = new float2(Hlsl.Cos(ang), Hlsl.Sin(ang)) * 0.35f; - if (p.X < offs.X) p.X = 1.0f - (p.X + 0.5f) / Hlsl.Abs(offs.X + 0.5f); - else p.X = (p.X - offs.X) / (0.5f - offs.X); + if (p.X < offs.X) + { + p.X = 1.0f - ((p.X + 0.5f) / Hlsl.Abs(offs.X + 0.5f)); + } + else + { + p.X = (p.X - offs.X) / (0.5f - offs.X); + } - if (p.Y < offs.Y) p.Y = 1.0f - (p.Y + 0.5f) / Hlsl.Abs(offs.Y + 0.5f); - else p.Y = (p.Y - offs.Y) / (0.5f - offs.Y); + if (p.Y < offs.Y) + { + p.Y = 1.0f - ((p.Y + 0.5f) / Hlsl.Abs(offs.Y + 0.5f)); + } + else + { + p.Y = (p.Y - offs.Y) / (0.5f - offs.Y); + } return 1.0f - Hlsl.Max(p.X, p.Y); } - // Standard function-based bump mapping function, with an edge value included for good measure private float3 DoBumpMap(in float2 p, in float3 n, float bumpfactor, ref float edge) { @@ -109,26 +120,28 @@ internal readonly partial struct PyramidPattern : IPixelShader float fx2 = BMap(p + e.XY); float fy2 = BMap(p + e.YX); - float3 grad = (new float3(fx - fx2, fy - fx2, 0)) / e.X / 2.0f; + float3 grad = new float3(fx - fx2, fy - fx2, 0) / e.X / 2.0f; - edge = Hlsl.Length(new float2(fx, fy) + new float2(fx2, fy2) - f * 2.0f); + edge = Hlsl.Length(new float2(fx, fy) + new float2(fx2, fy2) - (f * 2.0f)); edge = Hlsl.SmoothStep(0.0f, 1.0f, edge / e.X); grad -= n * Hlsl.Dot(n, grad); - return Hlsl.Normalize(n + grad * bumpfactor); + return Hlsl.Normalize(n + (grad * bumpfactor)); } - // A hatch-like algorithm, or a stipple... or some kind of textured pattern private float DoHatch(float2 p, float res) { p *= res / 16.0f; - float hatch = Hlsl.Clamp(Hlsl.Sin((p.X - p.Y) * 3.14159f * 200.0f) * 2.0f + 0.5f, 0.0f, 1.0f); + float hatch = Hlsl.Clamp((Hlsl.Sin((p.X - p.Y) * 3.14159f * 200.0f) * 2.0f) + 0.5f, 0.0f, 1.0f); float hRnd = Hash21(Hlsl.Floor(p * 6.0f) + 0.73f); - if (hRnd > 0.66f) hatch = hRnd; + if (hRnd > 0.66f) + { + hatch = hRnd; + } return hatch; } @@ -138,10 +151,10 @@ internal readonly partial struct PyramidPattern : IPixelShader { int2 coordinate = new(ThreadIds.X, DispatchSize.Y - ThreadIds.Y); float iRes = Hlsl.Min(DispatchSize.Y, 800.0f); - float2 uv = (coordinate - (float2)DispatchSize.XY * 0.5f) / iRes; + float2 uv = (coordinate - ((float2)DispatchSize.XY * 0.5f)) / iRes; float3 rd = Hlsl.Normalize(new float3(uv, 0.5f)); const float gSc = 10.0f; - float2 p = uv * gSc + new float2(0, time / 2.0f); + float2 p = (uv * gSc) + new float2(0, this.time / 2.0f); float2 oP = p; float m = BMap(p); float3 n = new(0, 0, -1); @@ -150,7 +163,7 @@ internal readonly partial struct PyramidPattern : IPixelShader n = DoBumpMap(p, n, bumpFactor, ref edge); - float3 lp = new float3(-0.0f + Hlsl.Sin(time) * 0.3f, 0.0f + Hlsl.Cos(time * 1.3f) * 0.3f, -1) - new float3(uv, 0); + float3 lp = new float3(-0.0f + (Hlsl.Sin(this.time) * 0.3f), 0.0f + (Hlsl.Cos(this.time * 1.3f) * 0.3f), -1) - new float3(uv, 0); float lDist = Hlsl.Max(Hlsl.Length(lp), 0.001f); float3 ld = lp / lDist; float diff = Hlsl.Max(Hlsl.Dot(n, ld), 0.0f); @@ -159,20 +172,20 @@ internal readonly partial struct PyramidPattern : IPixelShader float spec = Hlsl.Pow(Hlsl.Max(Hlsl.Dot(Hlsl.Reflect(-ld, n), -rd), 0.0f), 16.0f); float fre = Hlsl.Min(Hlsl.Pow(Hlsl.Max(1.0f + Hlsl.Dot(n, rd), 0.0f), 4.0f), 3.0f); - float3 col = 0.15f * (diff + 0.251f + spec * new float3(1, 0.7f, 0.3f) * 9.0f + fre * new float3(0.1f, 0.3f, 1) * 12.0f); - float rf = Hlsl.SmoothStep(0.0f, 0.35f, BMap(Hlsl.Reflect(rd, n).XY * 2.0f) * FBM(Hlsl.Reflect(rd, n).XY * 3.0f) + 0.1f); + float3 col = 0.15f * (diff + 0.251f + (spec * new float3(1, 0.7f, 0.3f) * 9.0f) + (fre * new float3(0.1f, 0.3f, 1) * 12.0f)); + float rf = Hlsl.SmoothStep(0.0f, 0.35f, (BMap(Hlsl.Reflect(rd, n).XY * 2.0f) * FBM(Hlsl.Reflect(rd, n).XY * 3.0f)) + 0.1f); col += col * col * rf * rf * new float3(1, 0.1f, 0.1f) * 15.0f; - float shade = m * 0.83f + 0.17f; + float shade = (m * 0.83f) + 0.17f; col *= shade; - col *= 1.0f - edge * 0.8f; + col *= 1.0f - (edge * 0.8f); float hatch = DoHatch(oP / gSc, iRes); - col *= hatch * 0.5f + 0.7f; + col *= (hatch * 0.5f) + 0.7f; return new(Hlsl.Sqrt(Hlsl.Max(col, 0.0f)), 1); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs index a54daecf..52c87473 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Shaders; +namespace ComputeSharp.SwapChain.Shaders; /// /// Utilizing a 2D simplex grid to construct the isolines of a noise function. @@ -14,7 +14,7 @@ internal readonly partial struct TriangleGridContouring : IPixelShader /// /// The current time Hlsl.Since the start of the application. /// - public readonly float time; + private readonly float time; // Standard 2D rotation formula. private static float2x2 Rotate2x2(in float a) @@ -38,14 +38,14 @@ internal readonly partial struct TriangleGridContouring : IPixelShader p = Hlsl.Frac(new float2(262144, 32768) * n); - return Hlsl.Sin(p * 6.2831853f + time); + return Hlsl.Sin((p * 6.2831853f) + this.time); } // Based on IQ's gradient noise formula. private float N2D3G(float2 p) { float2 i = Hlsl.Floor(p); - + p -= i; float4 v = default; @@ -55,16 +55,15 @@ internal readonly partial struct TriangleGridContouring : IPixelShader v.Z = Hlsl.Dot(Hash22(i + float2.UnitY), p - float2.UnitY); v.W = Hlsl.Dot(Hash22(i + 1.0f), p - 1.0f); - p = p * p * p * (p * (p * 6.0f - 15.0f) + 10.0f); + p = p * p * p * ((p * ((p * 6.0f) - 15.0f)) + 10.0f); return Hlsl.Lerp(Hlsl.Lerp(v.X, v.Y, p.X), Hlsl.Lerp(v.Z, v.W, p.X), p.Y); } - // The isofunction. Just a Hlsl.Single noise function, but it can be more elaborate. private float IsoFunction(in float2 p) { - return N2D3G(p / 4.0f + 0.07f); + return N2D3G((p / 4.0f) + 0.07f); } // Unsigned distance to the segment joining "a" and "b". @@ -74,11 +73,11 @@ internal readonly partial struct TriangleGridContouring : IPixelShader float h = Hlsl.Clamp(Hlsl.Dot(a, b) / Hlsl.Dot(b, b), 0.0f, 1.0f); - return Hlsl.Length(a - b * h); + return Hlsl.Length(a - (b * h)); } // Based on IQ's signed distance to the segment joining "a" and "b". - private static float distEdge(float2 a, float2 b) + private static float DistEdge(float2 a, float2 b) { return Hlsl.Dot((a + b) * 0.5f, Hlsl.Normalize((b - a).YX * new float2(-1, 1))); } @@ -86,7 +85,7 @@ internal readonly partial struct TriangleGridContouring : IPixelShader // Interpolating along the edge connecting vertices v1 and v2 with respect to the isovalue. private static float2 Interpolate(in float2 p1, in float2 p2, float v1, float v2, float isovalue) { - return Hlsl.Lerp(p1, p2, (isovalue - v1) / (v2 - v1) * 0.75f + 0.25f / 2.0f); + return Hlsl.Lerp(p1, p2, ((isovalue - v1) / (v2 - v1) * 0.75f) + (0.25f / 2.0f)); } // Isoline function. @@ -105,9 +104,20 @@ internal readonly partial struct TriangleGridContouring : IPixelShader int iTh = 0; - if (n3.X > isovalue) iTh += 4; - if (n3.Y > isovalue) iTh += 2; - if (n3.Z > isovalue) iTh += 1; + if (n3.X > isovalue) + { + iTh += 4; + } + + if (n3.Y > isovalue) + { + iTh += 2; + } + + if (n3.Z > isovalue) + { + iTh += 1; + } if (iTh == 1 || iTh == 6) { @@ -130,7 +140,7 @@ internal readonly partial struct TriangleGridContouring : IPixelShader if (iTh >= 4 && iTh <= 6) { float2 tmp = p0; - + p0 = p1; p1 = tmp; } @@ -138,7 +148,7 @@ internal readonly partial struct TriangleGridContouring : IPixelShader if (i == 0.0f) { float2 tmp = p0; - + p0 = p1; p1 = tmp; } @@ -154,11 +164,11 @@ internal readonly partial struct TriangleGridContouring : IPixelShader float2 oP = p; - p += new float2(N2D3G(p * 3.5f), N2D3G(p * 3.5f + 7.3f)) * 0.015f; + p += new float2(N2D3G(p * 3.5f), N2D3G((p * 3.5f) + 7.3f)) * 0.015f; - float2 s = Hlsl.Floor(p + (p.X + p.Y) * 0.36602540378f); + float2 s = Hlsl.Floor(p + ((p.X + p.Y) * 0.36602540378f)); - p -= s - (s.X + s.Y) * 0.211324865f; + p -= s - ((s.X + s.Y) * 0.211324865f); float i = p.X < p.Y ? 1.0f : 0.0f; float2 ioffs = new(1.0f - i, i); @@ -188,14 +198,14 @@ internal readonly partial struct TriangleGridContouring : IPixelShader float2 p1 = default; int iTh = IsoLine(n3, ip0, ip1, ip2, isovalue, i, ref p0, ref p1); - d = Hlsl.Min(d, distEdge(p - p0, p - p1)); + d = Hlsl.Min(d, DistEdge(p - p0, p - p1)); if (iTh == 7) { d = 0; } - d3 = Hlsl.Min(d3, DistLine((p - p0), (p - p1))); + d3 = Hlsl.Min(d3, DistLine(p - p0, p - p1)); d4 = Hlsl.Min(d4, Hlsl.Min(Hlsl.Length(p - p0), Hlsl.Length(p - p1))); float tri = Hlsl.Min(Hlsl.Min(DistLine(p - ip0, p - ip1), DistLine(p - ip1, p - ip2)), DistLine(p - ip2, p - ip0)); @@ -206,15 +216,20 @@ internal readonly partial struct TriangleGridContouring : IPixelShader int iTh2 = IsoLine(n3, ip0, ip1, ip2, isovalue, i, ref p0, ref p1); - d2 = Hlsl.Min(d2, distEdge(p - p0, p - p1)); + d2 = Hlsl.Min(d2, DistEdge(p - p0, p - p1)); - float oldD2 = d2; + if (iTh2 == 7) + { + d2 = 0.0f; + } - if (iTh2 == 7) d2 = 0.0f; - if (iTh == 7) d2 = 1e5f; + if (iTh == 7) + { + d2 = 1e5f; + } d2 = Hlsl.Max(d2, -d); - d3 = Hlsl.Min(d3, DistLine((p - p0), (p - p1))); + d3 = Hlsl.Min(d3, DistLine(p - p0, p - p1)); d4 = Hlsl.Min(d4, Hlsl.Min(Hlsl.Length(p - p0), Hlsl.Length(p - p1))); d4 -= 0.075f; d3 -= 0.0125f; @@ -227,35 +242,48 @@ internal readonly partial struct TriangleGridContouring : IPixelShader float3 col = new(1, 0.85f, 0.6f); float sf = 0.004f; - if (d > 0.0f && d2 > 0.0f) col = new float3(1, 1.8f, 3) * 0.45f; - if (d > 0.0f) col = Hlsl.Lerp(col, new float3(1, 1.85f, 3) * 0.3f, (1.0f - Hlsl.SmoothStep(0.0f, sf, d2 - 0.012f))); + if (d > 0.0f && d2 > 0.0f) + { + col = new float3(1, 1.8f, 3) * 0.45f; + } - col = Hlsl.Lerp(col, new float3(1.1f, 0.85f, 0.6f), (1.0f - Hlsl.SmoothStep(0.0f, sf, d2))); - col = Hlsl.Lerp(col, new float3(1.5f, 0.9f, 0.6f) * 0.6f, (1.0f - Hlsl.SmoothStep(0.0f, sf, d - 0.012f))); - col = Hlsl.Lerp(col, new float3(1, 0.8f, 0.6f) * new float3(0.7f, 1.0f, 0.75f) * 0.95f, (1.0f - Hlsl.SmoothStep(0.0f, sf, d))); + if (d > 0.0f) + { + col = Hlsl.Lerp(col, new float3(1, 1.85f, 3) * 0.3f, 1.0f - Hlsl.SmoothStep(0.0f, sf, d2 - 0.012f)); + } - if (d2 > 0.0f) col *= (Hlsl.Abs(Hlsl.Dot(n3, float3.One)) * 1.25f + 1.25f) / 2.0f; - else col *= Hlsl.Max(2.0f - (Hlsl.Dot(n3, float3.One) + 1.45f) / 1.25f, 0.0f); + col = Hlsl.Lerp(col, new float3(1.1f, 0.85f, 0.6f), 1.0f - Hlsl.SmoothStep(0.0f, sf, d2)); + col = Hlsl.Lerp(col, new float3(1.5f, 0.9f, 0.6f) * 0.6f, 1.0f - Hlsl.SmoothStep(0.0f, sf, d - 0.012f)); + col = Hlsl.Lerp(col, new float3(1, 0.8f, 0.6f) * new float3(0.7f, 1.0f, 0.75f) * 0.95f, 1.0f - Hlsl.SmoothStep(0.0f, sf, d)); - float pat = Hlsl.Abs(Hlsl.Frac(tri * 12.5f + 0.4f) - 0.5f) * 2.0f; + if (d2 > 0.0f) + { + col *= ((Hlsl.Abs(Hlsl.Dot(n3, float3.One)) * 1.25f) + 1.25f) / 2.0f; + } + else + { + col *= Hlsl.Max(2.0f - ((Hlsl.Dot(n3, float3.One) + 1.45f) / 1.25f), 0.0f); + } - col *= pat * 0.425f + 0.75f; + float pat = Hlsl.Abs(Hlsl.Frac((tri * 12.5f) + 0.4f) - 0.5f) * 2.0f; + + col *= (pat * 0.425f) + 0.75f; col = Hlsl.Lerp(col, float3.Zero, (1.0f - Hlsl.SmoothStep(0.0f, sf, d5)) * 0.95f); - col = Hlsl.Lerp(col, float3.Zero, (1.0f - Hlsl.SmoothStep(0.0f, sf, d3))); - col = Hlsl.Lerp(col, float3.Zero, (1.0f - Hlsl.SmoothStep(0.0f, sf, d4))); - col = Hlsl.Lerp(col, float3.One, (1.0f - Hlsl.SmoothStep(0.0f, sf, d4 + 0.005f))); + col = Hlsl.Lerp(col, float3.Zero, 1.0f - Hlsl.SmoothStep(0.0f, sf, d3)); + col = Hlsl.Lerp(col, float3.Zero, 1.0f - Hlsl.SmoothStep(0.0f, sf, d4)); + col = Hlsl.Lerp(col, float3.One, 1.0f - Hlsl.SmoothStep(0.0f, sf, d4 + 0.005f)); float2 q = oP * 1.5f; col = Hlsl.Min(col, 1.0f); float gr = Hlsl.Sqrt(Hlsl.Dot(col, new float3(0.299f, 0.587f, 0.114f))) * 1.25f; - float ns = (N2D3G(q * 4.0f * new float2(1.0f / 3.0f, 3)) * 0.64f + N2D3G(q * 8.0f * new float2(1.0f / 3.0f, 3)) * 0.34f) * 0.5f + 0.5f; + float ns = (((N2D3G(q * 4.0f * new float2(1.0f / 3.0f, 3)) * 0.64f) + (N2D3G(q * 8.0f * new float2(1.0f / 3.0f, 3)) * 0.34f)) * 0.5f) + 0.5f; ns = gr - ns; q = Hlsl.Mul(q, Rotate2x2(3.14159f / 3.0f)); - float ns2 = (N2D3G(q * 4.0f * new float2(1.0f / 3.0f, 3)) * 0.64f + N2D3G(q * 8.0f * new float2(1.0f / 3.0f, 3)) * 0.34f) * 0.5f + 0.5f; + float ns2 = (((N2D3G(q * 4.0f * new float2(1.0f / 3.0f, 3)) * 0.64f) + (N2D3G(q * 8.0f * new float2(1.0f / 3.0f, 3)) * 0.34f)) * 0.5f) + 0.5f; ns2 = gr - ns2; ns = Hlsl.SmoothStep(0.0f, 1.0f, Hlsl.Min(ns, ns2)); @@ -268,8 +296,8 @@ internal readonly partial struct TriangleGridContouring : IPixelShader public float4 Execute() { int2 coordinate = new(ThreadIds.X, DispatchSize.Y - ThreadIds.Y); - float2 uv = (coordinate - (float2)DispatchSize.XY * 0.5f) / Hlsl.Min(650.0f, DispatchSize.Y); - float2 p = Hlsl.Mul(Rotate2x2(3.14159f / 12.0f), uv) + new float2(0.8660254f, 0.5f) * time / 16.0f; + float2 uv = (coordinate - ((float2)DispatchSize.XY * 0.5f)) / Hlsl.Min(650.0f, DispatchSize.Y); + float2 p = Hlsl.Mul(Rotate2x2(3.14159f / 12.0f), uv) + (new float2(0.8660254f, 0.5f) * this.time / 16.0f); float3 col = SimplexContour(p); uv = coordinate / (float2)DispatchSize.XY; @@ -277,4 +305,4 @@ internal readonly partial struct TriangleGridContouring : IPixelShader return new(Hlsl.Sqrt(Hlsl.Max(col, 0.0f)), 1); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs index 9c07eaac..701344da 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SwapChain.Shaders; +namespace ComputeSharp.SwapChain.Shaders; /// /// A shader creating an animated two-tiles Truchet arrangement. @@ -14,7 +14,7 @@ internal readonly partial struct TwoTiledTruchet : IPixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// /// Calculates the Truchet distance field. @@ -33,7 +33,7 @@ internal readonly partial struct TwoTiledTruchet : IPixelShader // HLSL's port of the GLSL mod intrinsic static float Mod(float x, float y) { - return x - y * Hlsl.Floor(x / y); + return x - (y * Hlsl.Floor(x / y)); } float2 ip2 = Hlsl.Floor(p / 2.0f); @@ -106,7 +106,7 @@ internal readonly partial struct TwoTiledTruchet : IPixelShader ang *= 2.0f; } - ang = Hlsl.Frac(ang + time / 4.0f); + ang = Hlsl.Frac(ang + (this.time / 4.0f)); return d; } @@ -114,28 +114,28 @@ internal readonly partial struct TwoTiledTruchet : IPixelShader /// public float4 Execute() { - float2 uv = (ThreadIds.XY - (float2)DispatchSize.XY * 0.5f) / DispatchSize.Y; + float2 uv = (ThreadIds.XY - ((float2)DispatchSize.XY * 0.5f)) / DispatchSize.Y; float gSc = 7.0f; - float2 p = uv * gSc - new float2(-1, -0.5f) * time / 2.0f; + float2 p = (uv * gSc) - (new float2(-1, -0.5f) * this.time / 2.0f); float sf = 2.0f / DispatchSize.Y * gSc; float lSc = 6.0f; float lw = 1.0f / lSc / gSc; - float2 d = DistanceField(p, out float2 ang) - 2.5f / lSc; + float2 d = DistanceField(p, out float2 ang) - (2.5f / lSc); float3 col = new(1.0f, 0.9f, 0.8f); for (int i = 0; i < 2; i++) { - float di = d[i] - lw / 4.0f; - float tracks = Hlsl.Clamp(Hlsl.Sin(ang[i] * 6.2831f + time * 6.0f) * 4.0f, 0.0f, 1.0f); + float di = d[i] - (lw / 4.0f); + float tracks = Hlsl.Clamp(Hlsl.Sin((ang[i] * 6.2831f) + (this.time * 6.0f)) * 4.0f, 0.0f, 1.0f); float gap = 1.0f + lw; col = Hlsl.Lerp(col, 0, (1.0f - Hlsl.SmoothStep(0.0f, sf * 6.0f, di)) * 0.35f); col = Hlsl.Lerp(col, 0, 1.0f - Hlsl.SmoothStep(0.0f, sf, di)); - col = Hlsl.Lerp(col, new(1.0f, 0.9f, 0.8f), 1.0f - Hlsl.SmoothStep(0.0f, sf, di + lw * 2.0f)); - col = Hlsl.Lerp(col, 0, 1.0f - Hlsl.SmoothStep(0.0f, sf, di + gap / lSc)); - col = Hlsl.Lerp(col, 1, 1.0f - Hlsl.SmoothStep(0.0f, sf, di + gap / lSc + lw)); - col = Hlsl.Lerp(col, 0, 1.0f - Hlsl.SmoothStep(0.0f, sf, di + 2.0f * gap / lSc)); - col = Hlsl.Lerp(col, 1 * tracks, 1.0f - Hlsl.SmoothStep(0.0f, sf, di + 2.0f * gap / lSc + lw)); + col = Hlsl.Lerp(col, new(1.0f, 0.9f, 0.8f), 1.0f - Hlsl.SmoothStep(0.0f, sf, di + (lw * 2.0f))); + col = Hlsl.Lerp(col, 0, 1.0f - Hlsl.SmoothStep(0.0f, sf, di + (gap / lSc))); + col = Hlsl.Lerp(col, 1, 1.0f - Hlsl.SmoothStep(0.0f, sf, di + (gap / lSc) + lw)); + col = Hlsl.Lerp(col, 0, 1.0f - Hlsl.SmoothStep(0.0f, sf, di + (2.0f * gap / lSc))); + col = Hlsl.Lerp(col, 1 * tracks, 1.0f - Hlsl.SmoothStep(0.0f, sf, di + (2.0f * gap / lSc) + lw)); } float3 rgb = Hlsl.Sqrt(Hlsl.Max(col, 0.0f)); @@ -143,4 +143,4 @@ internal readonly partial struct TwoTiledTruchet : IPixelShader return color; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Uwp/App.xaml.cs b/samples/ComputeSharp.SwapChain.Uwp/App.xaml.cs index 4db963a7..763ad27f 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/App.xaml.cs +++ b/samples/ComputeSharp.SwapChain.Uwp/App.xaml.cs @@ -1,4 +1,4 @@ -#if !DEBUG +#if !DEBUG using System; using System.Diagnostics; using System.Reflection; @@ -112,4 +112,4 @@ sealed partial class App : Application coreTitleBar.ExtendViewIntoTitleBar = true; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Uwp/ComputeSharp.SwapChain.Uwp.csproj b/samples/ComputeSharp.SwapChain.Uwp/ComputeSharp.SwapChain.Uwp.csproj index 9b937baa..0c24c4cd 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/ComputeSharp.SwapChain.Uwp.csproj +++ b/samples/ComputeSharp.SwapChain.Uwp/ComputeSharp.SwapChain.Uwp.csproj @@ -3,7 +3,7 @@ Debug - x86 + x64 {FBD388A5-7855-4408-98FF-E689F509DB5A} AppContainerExe Properties @@ -18,58 +18,14 @@ {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} true false - - - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x86 - false - prompt - true - - - bin\x86\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x86 - false - prompt - true - true - - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - ARM - false - prompt - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - ARM - false - prompt - true - true + x64;ARM64 + $(NoWarn);IDE0240 true bin\ARM64\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 + $(NoWarn);2008 full ARM64 false @@ -81,7 +37,7 @@ bin\ARM64\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true - ;2008 + $(NoWarn);2008 pdbonly ARM64 false @@ -93,7 +49,7 @@ true bin\x64\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 + $(NoWarn);2008 full x64 false @@ -104,7 +60,7 @@ bin\x64\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true - ;2008 + $(NoWarn);2008 pdbonly x64 false @@ -252,11 +208,4 @@ powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(SolutionDir)\build\CreateBlankAppCenterToken.ps1 - \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Uwp/Extensions/AssemblyExtensions.cs b/samples/ComputeSharp.SwapChain.Uwp/Extensions/AssemblyExtensions.cs index 52587761..61e44ce9 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/Extensions/AssemblyExtensions.cs +++ b/samples/ComputeSharp.SwapChain.Uwp/Extensions/AssemblyExtensions.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Reflection; using CommunityToolkit.Diagnostics; @@ -41,4 +41,4 @@ public static class AssemblyExtensions return false; } } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Uwp/Properties/AssemblyInfo.cs b/samples/ComputeSharp.SwapChain.Uwp/Properties/AssemblyInfo.cs index 0ed0ddff..bf5595ef 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/Properties/AssemblyInfo.cs +++ b/samples/ComputeSharp.SwapChain.Uwp/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/samples/ComputeSharp.SwapChain.Uwp/Properties/SkipLocalsInitAttribute.cs b/samples/ComputeSharp.SwapChain.Uwp/Properties/SkipLocalsInitAttribute.cs index 894d04db..56e0896b 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/Properties/SkipLocalsInitAttribute.cs +++ b/samples/ComputeSharp.SwapChain.Uwp/Properties/SkipLocalsInitAttribute.cs @@ -1,4 +1,4 @@ -namespace System.Runtime.CompilerServices; +namespace System.Runtime.CompilerServices; /// /// Used to indicate to the compiler that the .locals init flag should not be set in method headers. diff --git a/samples/ComputeSharp.SwapChain.Uwp/Services/AppCenterService.cs b/samples/ComputeSharp.SwapChain.Uwp/Services/AppCenterService.cs index 13f204c7..af5e4f99 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/Services/AppCenterService.cs +++ b/samples/ComputeSharp.SwapChain.Uwp/Services/AppCenterService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using ComputeSharp.SwapChain.Core.Services; @@ -58,4 +58,4 @@ public sealed class AppCenterService : IAnalyticsService : $"|{text.Substring(text.Length - PropertyStringMaxLength)}"; }); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Uwp/Views/MainView.xaml.cs b/samples/ComputeSharp.SwapChain.Uwp/Views/MainView.xaml.cs index 2b3f0f9e..9973a613 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/Views/MainView.xaml.cs +++ b/samples/ComputeSharp.SwapChain.Uwp/Views/MainView.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using CommunityToolkit.Mvvm.DependencyInjection; using ComputeSharp.SwapChain.Core.Constants; using ComputeSharp.SwapChain.Core.Services; @@ -31,8 +31,8 @@ public sealed partial class MainView : UserControl { Ioc.Default.GetRequiredService().Log(Event.OpenShaderSelectionPanel); - Root.Resources.Remove("ShaderSelectionPanel"); - Root.Children.Add(ShaderSelectionPanel); + _ = this.Root.Resources.Remove("ShaderSelectionPanel"); + this.Root.Children.Add(this.ShaderSelectionPanel); } // Hides the shader selection panel @@ -40,13 +40,13 @@ public sealed partial class MainView : UserControl { Ioc.Default.GetRequiredService().Log(Event.CloseShaderSelectionPanel); - Root.Children.Remove(ShaderSelectionPanel); + _ = this.Root.Children.Remove(this.ShaderSelectionPanel); } // Updates the size of the shaders list panel private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e) { - ShadersListContainerPanel.Height = Math.Round(e.NewSize.Height * 0.35); + this.ShadersListContainerPanel.Height = Math.Round(e.NewSize.Height * 0.35); } // Logs rendering failed in the main panel @@ -54,7 +54,7 @@ public sealed partial class MainView : UserControl { Ioc.Default.GetRequiredService().Log(args.Exception, (nameof(Error), Error.RenderingFailedOnMainPanel)); - RenderingErrorInfoBar.IsOpen = true; + this.RenderingErrorInfoBar.IsOpen = true; } // Logs rendering failed in a secondary panel @@ -62,6 +62,6 @@ public sealed partial class MainView : UserControl { Ioc.Default.GetRequiredService().Log(args.Exception, (nameof(Error), Error.RenderingFailedOnSelectionPanel)); - RenderingErrorInfoBar.IsOpen = true; + this.RenderingErrorInfoBar.IsOpen = true; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.WinUI/App.xaml.cs b/samples/ComputeSharp.SwapChain.WinUI/App.xaml.cs index 6068c97f..c4a547d4 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/App.xaml.cs +++ b/samples/ComputeSharp.SwapChain.WinUI/App.xaml.cs @@ -1,8 +1,10 @@ -using System; +using System; using System.Threading; using ComputeSharp.SwapChain.WinUI.Views; using Microsoft.UI.Xaml; +#pragma warning disable CA1001, IDE0052 + namespace ComputeSharp.SwapChain.WinUI; /// @@ -27,25 +29,26 @@ public sealed partial class App : Application /// public App() { - this.InitializeComponent(); + InitializeComponent(); } /// protected override void OnLaunched(LaunchActivatedEventArgs args) { - mainWindow = new MainWindow(); - mainWindow.Closed += (_, _) => + this.mainWindow = new MainWindow(); + this.mainWindow.Closed += (_, _) => { // Due to an issue (https://discord.com/channels/372137812037730304/663434534087426129/979543152853663744), the WinUI 3 app // will keep running after the window is closed if any render thread is still going. To work around this, each loaded shader // panel is tracked in a conditional weak table, and then when the window is closed they're all manually stopped by setting // their shader runners to null. After this, the app should just be able to close automatically when the panels are done. - mainWindow.OnShutdown(); + this.mainWindow.OnShutdown(); // For good measure, also start a timer of one second. If the app is still alive by then (ie. if the timer callback is // executed at all), then just force the whole process to terminate, and exit with the E_APPLICATION_EXITING error code. - shutdownTimer = new Timer(_ => Environment.Exit(unchecked((int)(0x8000001A))), this, 1000, Timeout.Infinite); + this.shutdownTimer = new Timer(_ => Environment.Exit(unchecked((int)0x8000001A)), this, 1000, Timeout.Infinite); }; - mainWindow.Activate(); + + this.mainWindow.Activate(); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj index b1a2f94d..c93fd788 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj +++ b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj @@ -1,4 +1,4 @@ - + WinExe net6.0-windows10.0.19041.0 @@ -11,6 +11,7 @@ true true $(DefineConstants);SAMPLE_APP + $(NoWarn);IDE0240 diff --git a/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml.cs b/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml.cs index 3c7257c3..0d03b5a1 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml.cs +++ b/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.SwapChain.Core.Services; using ComputeSharp.SwapChain.Core.ViewModels; @@ -23,24 +23,24 @@ public sealed partial class MainWindow : Window this.InitializeComponent(); this.ExtendsContentIntoTitleBar = true; - SetTitleBar(TitleBarRectangle); + SetTitleBar(this.TitleBarRectangle); - Root.DataContext = new MainViewModel(new DebugAnalyticsService()); + this.Root.DataContext = new MainViewModel(new DebugAnalyticsService()); } /// /// Gets the instance for the current view. /// - public MainViewModel ViewModel => (MainViewModel)Root.DataContext; + public MainViewModel ViewModel => (MainViewModel)this.Root.DataContext; /// /// Stops all rendering when the application is closing. /// public void OnShutdown() { - ShaderPanel.ShaderRunner = null; + this.ShaderPanel.ShaderRunner = null; - foreach (var (panel, _) in this.shaderPanels) + foreach ((AnimatedComputeShaderPanel panel, object _) in this.shaderPanels) { panel.ShaderRunner = null; } @@ -49,20 +49,20 @@ public sealed partial class MainWindow : Window // Opens the shader selection panel private void OpenShaderSelectionPanelButton_Click(object sender, RoutedEventArgs e) { - Root.Resources.Remove("ShaderSelectionPanel"); - Root.Children.Add(ShaderSelectionPanel); + _ = this.Root.Resources.Remove("ShaderSelectionPanel"); + this.Root.Children.Add(this.ShaderSelectionPanel); } // Hides the shader selection panel private void ShaderSelectionPanel_Tapped(object sender, TappedRoutedEventArgs e) { - Root.Children.Remove(ShaderSelectionPanel); + _ = this.Root.Children.Remove(this.ShaderSelectionPanel); } // Updates the size of the shaders list panel private void UserControl_SizeChanged(object sender, WindowSizeChangedEventArgs e) { - ShadersListContainerPanel.Height = Math.Round(e.Size.Height * 0.35); + this.ShadersListContainerPanel.Height = Math.Round(e.Size.Height * 0.35); } // Tracks the current panel @@ -70,4 +70,4 @@ public sealed partial class MainWindow : Window { this.shaderPanels.AddOrUpdate((AnimatedComputeShaderPanel)sender, null); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs b/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs index 4931207c..9affa55c 100644 --- a/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs +++ b/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Interop; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; @@ -100,7 +100,7 @@ internal sealed class SwapChainApplication : Win32Application d3D12CommandQueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAGS.D3D12_COMMAND_QUEUE_FLAG_NONE; d3D12CommandQueueDesc.NodeMask = 0; - _ = d3D12Device.Get()->CreateCommandQueue( + _ = this.d3D12Device.Get()->CreateCommandQueue( &d3D12CommandQueueDesc, Windows.__uuidof(), (void**)d3D12CommandQueue); @@ -136,7 +136,7 @@ internal sealed class SwapChainApplication : Win32Application dxgiSwapChainDesc1.SwapEffect = DXGI_SWAP_EFFECT.DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; _ = dxgiFactory2.Get()->CreateSwapChainForHwnd( - (IUnknown*)d3D12CommandQueue.Get(), + (IUnknown*)this.d3D12CommandQueue.Get(), hwnd, &dxgiSwapChainDesc1, null, @@ -147,7 +147,7 @@ internal sealed class SwapChainApplication : Win32Application // Create the command allocator to use fixed (ID3D12CommandAllocator** d3D12CommandAllocator = this.d3D12CommandAllocator) { - this.d3D12Device.Get()->CreateCommandAllocator( + _ = this.d3D12Device.Get()->CreateCommandAllocator( D3D12_COMMAND_LIST_TYPE.D3D12_COMMAND_LIST_TYPE_DIRECT, Windows.__uuidof(), (void**)d3D12CommandAllocator); @@ -156,17 +156,17 @@ internal sealed class SwapChainApplication : Win32Application // Create the reusable command list to copy data to the back buffers fixed (ID3D12GraphicsCommandList** d3D12GraphicsCommandList = this.d3D12GraphicsCommandList) { - this.d3D12Device.Get()->CreateCommandList( + _ = this.d3D12Device.Get()->CreateCommandList( 0, D3D12_COMMAND_LIST_TYPE.D3D12_COMMAND_LIST_TYPE_DIRECT, - d3D12CommandAllocator, + this.d3D12CommandAllocator, null, Windows.__uuidof(), (void**)d3D12GraphicsCommandList); } // Close the command list to prepare it for future use - this.d3D12GraphicsCommandList.Get()->Close(); + _ = this.d3D12GraphicsCommandList.Get()->Close(); } /// @@ -180,10 +180,10 @@ internal sealed class SwapChainApplication : Win32Application /// private unsafe void ApplyResize() { - this.d3D12CommandQueue.Get()->Signal(this.d3D12Fence.Get(), this.nextD3D12FenceValue); + _ = this.d3D12CommandQueue.Get()->Signal(this.d3D12Fence.Get(), this.nextD3D12FenceValue); // Wait for the fence again to ensure there are no pending operations - this.d3D12Fence.Get()->SetEventOnCompletion(this.nextD3D12FenceValue, default); + _ = this.d3D12Fence.Get()->SetEventOnCompletion(this.nextD3D12FenceValue, default); this.nextD3D12FenceValue++; @@ -192,7 +192,7 @@ internal sealed class SwapChainApplication : Win32Application this.d3D12Resource1.Dispose(); // Resize the swap chain buffers - this.dxgiSwapChain1.Get()->ResizeBuffers(0, 0, 0, DXGI_FORMAT.DXGI_FORMAT_UNKNOWN, 0); + _ = this.dxgiSwapChain1.Get()->ResizeBuffers(0, 0, 0, DXGI_FORMAT.DXGI_FORMAT_UNKNOWN, 0); // Get the index of the initial back buffer using (ComPtr dxgiSwapChain3 = default) @@ -206,8 +206,8 @@ internal sealed class SwapChainApplication : Win32Application fixed (ID3D12Resource** d3D12Resource0 = this.d3D12Resource0) fixed (ID3D12Resource** d3D12Resource1 = this.d3D12Resource1) { - _ = dxgiSwapChain1.Get()->GetBuffer(0, Windows.__uuidof(), (void**)d3D12Resource0); - _ = dxgiSwapChain1.Get()->GetBuffer(1, Windows.__uuidof(), (void**)d3D12Resource1); + _ = this.dxgiSwapChain1.Get()->GetBuffer(0, Windows.__uuidof(), (void**)d3D12Resource0); + _ = this.dxgiSwapChain1.Get()->GetBuffer(1, Windows.__uuidof(), (void**)d3D12Resource1); } this.texture?.Dispose(); @@ -249,8 +249,8 @@ internal sealed class SwapChainApplication : Win32Application this.currentBufferIndex ^= 1; // Reset the command list and command allocator - this.d3D12CommandAllocator.Get()->Reset(); - this.d3D12GraphicsCommandList.Get()->Reset(this.d3D12CommandAllocator.Get(), null); + _ = this.d3D12CommandAllocator.Get()->Reset(); + _ = this.d3D12GraphicsCommandList.Get()->Reset(this.d3D12CommandAllocator.Get(), null); D3D12_RESOURCE_BARRIER* d3D12ResourceBarriers = stackalloc D3D12_RESOURCE_BARRIER[] { @@ -265,10 +265,10 @@ internal sealed class SwapChainApplication : Win32Application }; // Transition the resources to COPY_DEST and COPY_SOURCE respectively - d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers); + this.d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers); // Copy the generated frame to the target back buffer - d3D12GraphicsCommandList.Get()->CopyResource(d3D12ResourceBackBuffer, d3D12Resource.Get()); + this.d3D12GraphicsCommandList.Get()->CopyResource(d3D12ResourceBackBuffer, d3D12Resource.Get()); d3D12ResourceBarriers[0] = D3D12_RESOURCE_BARRIER.InitTransition( d3D12Resource.Get(), @@ -281,22 +281,22 @@ internal sealed class SwapChainApplication : Win32Application D3D12_RESOURCE_STATES.D3D12_RESOURCE_STATE_COMMON); // Transition the resources back to COMMON and UNORDERED_ACCESS respectively - d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers); + this.d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers); - d3D12GraphicsCommandList.Get()->Close(); + _ = this.d3D12GraphicsCommandList.Get()->Close(); // Execute the command list to perform the copy - this.d3D12CommandQueue.Get()->ExecuteCommandLists(1, (ID3D12CommandList**)d3D12GraphicsCommandList.GetAddressOf()); - this.d3D12CommandQueue.Get()->Signal(this.d3D12Fence.Get(), this.nextD3D12FenceValue); + this.d3D12CommandQueue.Get()->ExecuteCommandLists(1, (ID3D12CommandList**)this.d3D12GraphicsCommandList.GetAddressOf()); + _ = this.d3D12CommandQueue.Get()->Signal(this.d3D12Fence.Get(), this.nextD3D12FenceValue); // Present the new frame - this.dxgiSwapChain1.Get()->Present(0, 0); + _ = this.dxgiSwapChain1.Get()->Present(0, 0); if (this.nextD3D12FenceValue > this.d3D12Fence.Get()->GetCompletedValue()) { - this.d3D12Fence.Get()->SetEventOnCompletion(this.nextD3D12FenceValue, default); + _ = this.d3D12Fence.Get()->SetEventOnCompletion(this.nextD3D12FenceValue, default); } this.nextD3D12FenceValue++; } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain/Backend/Win32Application.cs b/samples/ComputeSharp.SwapChain/Backend/Win32Application.cs index a097a84b..fbb03e37 100644 --- a/samples/ComputeSharp.SwapChain/Backend/Win32Application.cs +++ b/samples/ComputeSharp.SwapChain/Backend/Win32Application.cs @@ -1,4 +1,4 @@ -using System; +using System; using TerraFX.Interop.Windows; namespace ComputeSharp.SwapChain.Backend; @@ -24,4 +24,4 @@ internal abstract class Win32Application /// /// The current time since the start of the application. public abstract void OnUpdate(TimeSpan time); -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs index 475a2210..6856b27f 100644 --- a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs +++ b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Drawing; using System.Reflection; @@ -11,7 +11,7 @@ namespace ComputeSharp.SwapChain.Backend; /// /// A helper class to manage the creation and execution of Win32 applications. /// -internal unsafe static class Win32ApplicationRunner +internal static unsafe class Win32ApplicationRunner { /// /// Whether or not a resize operation is in progress. @@ -185,6 +185,7 @@ internal unsafe static class Win32ApplicationRunner { isPaused = false; } + return 0; } @@ -196,11 +197,11 @@ internal unsafe static class Win32ApplicationRunner if (isPaused) { - Windows.SetCapture(hwnd); + _ = Windows.SetCapture(hwnd); } else { - Windows.ReleaseCapture(); + _ = Windows.ReleaseCapture(); } isPaused = !isPaused; @@ -229,7 +230,7 @@ internal unsafe static class Win32ApplicationRunner // Size update case WM.WM_SIZE: { - if (!isResizing && wParam != (byte)Windows.SIZE_MINIMIZED) + if (!isResizing && wParam != Windows.SIZE_MINIMIZED) { application.OnResize(); } @@ -252,36 +253,68 @@ internal unsafe static class Win32ApplicationRunner _ = Windows.GetCursorPos(&point); _ = Windows.GetWindowRect(hwnd, &rect); - bool isAtTop = Math.Abs(point.y - rect.top) < 12; - bool isAtRight = Math.Abs(point.x - rect.right) < 12; - bool isAtBottom = Math.Abs(point.y - rect.bottom) < 12; - bool isAtLeft = Math.Abs(point.x - rect.left) < 12; + bool isAtTop = Math.Abs(point.y - rect.top) < 12; + bool isAtRight = Math.Abs(point.x - rect.right) < 12; + bool isAtBottom = Math.Abs(point.y - rect.bottom) < 12; + bool isAtLeft = Math.Abs(point.x - rect.left) < 12; if (isAtTop) { - if (isAtRight) return Windows.HTTOPRIGHT; - if (isAtLeft) return Windows.HTTOPLEFT; + if (isAtRight) + { + return Windows.HTTOPRIGHT; + } + + if (isAtLeft) + { + return Windows.HTTOPLEFT; + } + return Windows.HTTOP; } if (isAtRight) { - if (isAtTop) return Windows.HTTOPRIGHT; - if (isAtBottom) return Windows.HTBOTTOMRIGHT; + if (isAtTop) + { + return Windows.HTTOPRIGHT; + } + + if (isAtBottom) + { + return Windows.HTBOTTOMRIGHT; + } + return Windows.HTRIGHT; } if (isAtBottom) { - if (isAtRight) return Windows.HTBOTTOMRIGHT; - if (isAtLeft) return Windows.HTBOTTOMLEFT; + if (isAtRight) + { + return Windows.HTBOTTOMRIGHT; + } + + if (isAtLeft) + { + return Windows.HTBOTTOMLEFT; + } + return Windows.HTBOTTOM; } if (isAtLeft) { - if (isAtTop) return Windows.HTTOPLEFT; - if (isAtBottom) return Windows.HTBOTTOMLEFT; + if (isAtTop) + { + return Windows.HTTOPLEFT; + } + + if (isAtBottom) + { + return Windows.HTBOTTOMLEFT; + } + return Windows.HTLEFT; } @@ -312,4 +345,4 @@ internal unsafe static class Win32ApplicationRunner return Windows.DefWindowProcW(hwnd, uMsg, wParam, lParam); } -} +} \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain/Program.cs b/samples/ComputeSharp.SwapChain/Program.cs index 29381a57..d1606b2a 100644 --- a/samples/ComputeSharp.SwapChain/Program.cs +++ b/samples/ComputeSharp.SwapChain/Program.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Runtime.CompilerServices; using ComputeSharp.SwapChain.Backend; @@ -48,7 +48,7 @@ class Program } Console.WriteLine($"{Samples.Length}+: Exit (Use Escape, 'Q', or Alt + F4 to exit a sample once chosen)"); - Console.WriteLine(); + Console.WriteLine(); do { @@ -61,7 +61,7 @@ class Program Console.WriteLine(); Console.WriteLine($"Starting {Samples[index].ShaderName}..."); - Win32ApplicationRunner.Run(Samples[index].Application); + _ = Win32ApplicationRunner.Run(Samples[index].Application); } } while (index >= 0 && index < Samples.Length); @@ -78,4 +78,4 @@ class Program return GraphicsDevice.GetDefault().LoadReadOnlyTexture2D(filename); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/InterpolatedStringHandlerArgumentAttribute.cs b/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/InterpolatedStringHandlerArgumentAttribute.cs index 7fe883be..74ec0772 100644 --- a/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/InterpolatedStringHandlerArgumentAttribute.cs +++ b/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/InterpolatedStringHandlerArgumentAttribute.cs @@ -1,4 +1,4 @@ -namespace System.Runtime.CompilerServices; +namespace System.Runtime.CompilerServices; /// /// Indicates which arguments to a method involving an interpolated string handler should be passed to that handler. @@ -11,14 +11,20 @@ public sealed class InterpolatedStringHandlerArgumentAttribute : Attribute /// /// The name of the argument that should be passed to the handler. /// may be used as the name of the receiver in an instance method. - public InterpolatedStringHandlerArgumentAttribute(string argument) => Arguments = new string[] { argument }; + public InterpolatedStringHandlerArgumentAttribute(string argument) + { + Arguments = new string[] { argument }; + } /// /// Initializes a new instance of the class. /// /// The names of the arguments that should be passed to the handler. /// may be used as the name of the receiver in an instance method. - public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) => Arguments = arguments; + public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) + { + Arguments = arguments; + } /// /// Gets the names of the arguments that should be passed to the handler. diff --git a/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/InterpolatedStringHandlerAttribute.cs b/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/InterpolatedStringHandlerAttribute.cs index 75904a51..0ef12b61 100644 --- a/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/InterpolatedStringHandlerAttribute.cs +++ b/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/InterpolatedStringHandlerAttribute.cs @@ -1,4 +1,4 @@ -namespace System.Runtime.CompilerServices; +namespace System.Runtime.CompilerServices; /// /// Indicates the attributed type is to be used as an interpolated string handler. diff --git a/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/IsExternalInit.cs b/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/IsExternalInit.cs index 775f605a..c02e30d6 100644 --- a/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/IsExternalInit.cs +++ b/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/IsExternalInit.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; @@ -12,4 +12,4 @@ namespace System.Runtime.CompilerServices; [EditorBrowsable(EditorBrowsableState.Never)] internal static class IsExternalInit { -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/RuntimeHelpers.cs b/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/RuntimeHelpers.cs index 9d2046fc..2676343b 100644 --- a/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/RuntimeHelpers.cs +++ b/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/RuntimeHelpers.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; namespace ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices; @@ -14,5 +14,8 @@ internal static class RuntimeHelpers /// The type to associate the memory to. /// The size in byte of the memory to allocate. /// A pointer to the allocated memory. - public static IntPtr AllocateTypeAssociatedMemory(Type type, int size) => Marshal.AllocHGlobal(size); + public static IntPtr AllocateTypeAssociatedMemory(Type type, int size) + { + return Marshal.AllocHGlobal(size); + } } \ No newline at end of file diff --git a/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/SkipLocalsInitAttribute.cs b/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/SkipLocalsInitAttribute.cs index 1339a5ae..6d63a804 100644 --- a/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/SkipLocalsInitAttribute.cs +++ b/src/ComputeSharp.Core.NetStandard/System/Runtime.CompilerServices/SkipLocalsInitAttribute.cs @@ -1,4 +1,4 @@ -namespace System.Runtime.CompilerServices; +namespace System.Runtime.CompilerServices; /// /// Used to indicate to the compiler that the .locals init diff --git a/src/ComputeSharp.Core.SourceGenerators/AutoConstructorGenerator.cs b/src/ComputeSharp.Core.SourceGenerators/AutoConstructorGenerator.cs index 9d573fd3..288d6eae 100644 --- a/src/ComputeSharp.Core.SourceGenerators/AutoConstructorGenerator.cs +++ b/src/ComputeSharp.Core.SourceGenerators/AutoConstructorGenerator.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Text; using ComputeSharp.Core.SourceGenerators.Models; using ComputeSharp.SourceGeneration.Extensions; @@ -145,4 +145,4 @@ public sealed class AutoConstructorGenerator : IIncrementalGenerator return hierarchyInfo.GetSyntax(constructorDeclaration.AddAttributeLists(attributes)); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core.SourceGenerators/GlobalUsingDirectivesGenerator.cs b/src/ComputeSharp.Core.SourceGenerators/GlobalUsingDirectivesGenerator.cs index 8afd2642..1892174c 100644 --- a/src/ComputeSharp.Core.SourceGenerators/GlobalUsingDirectivesGenerator.cs +++ b/src/ComputeSharp.Core.SourceGenerators/GlobalUsingDirectivesGenerator.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Reflection; using Microsoft.CodeAnalysis; @@ -25,4 +25,4 @@ public sealed class GlobalUsingDirectivesGenerator : IIncrementalGenerator context.AddSource("GlobalUsingDirectives.g.cs", globalUsingDirectives); }); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core.SourceGenerators/Models/ConstructorInfo.cs b/src/ComputeSharp.Core.SourceGenerators/Models/ConstructorInfo.cs index 93075030..73f981cd 100644 --- a/src/ComputeSharp.Core.SourceGenerators/Models/ConstructorInfo.cs +++ b/src/ComputeSharp.Core.SourceGenerators/Models/ConstructorInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -14,10 +14,16 @@ namespace ComputeSharp.Core.SourceGenerators.Models; internal sealed record ConstructorInfo(ImmutableArray Parameters, ImmutableArray DefaultedFields) { /// - public bool Equals(ConstructorInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(ConstructorInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . diff --git a/src/ComputeSharp.Core.SourceGenerators/Models/ParameterInfo.cs b/src/ComputeSharp.Core.SourceGenerators/Models/ParameterInfo.cs index ff276e79..3f45388a 100644 --- a/src/ComputeSharp.Core.SourceGenerators/Models/ParameterInfo.cs +++ b/src/ComputeSharp.Core.SourceGenerators/Models/ParameterInfo.cs @@ -1,8 +1,8 @@ -namespace ComputeSharp.Core.SourceGenerators.Models; +namespace ComputeSharp.Core.SourceGenerators.Models; /// /// A model describing info on a constructor parameter. /// /// The fully qualified type name. /// The parameter name. -internal sealed record ParameterInfo(string Type, string Name); +internal sealed record ParameterInfo(string Type, string Name); \ No newline at end of file diff --git a/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs b/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs index 048876af..20737a4c 100644 --- a/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs +++ b/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp; @@ -8,4 +8,4 @@ namespace ComputeSharp; [AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)] public sealed class AutoConstructorAttribute : Attribute { -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehavior.cs b/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehavior.cs index 0690f9f7..465bc2b7 100644 --- a/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehavior.cs +++ b/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehavior.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// Indicates the behavior of fields annotated with . @@ -9,4 +9,4 @@ internal enum AutoConstructorBehavior /// Causes to ignore fields and set their values to . /// IgnoreAndSetToDefault -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehaviorAttribute.cs b/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehaviorAttribute.cs index f25456c6..b9dbbb8a 100644 --- a/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehaviorAttribute.cs +++ b/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehaviorAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp; diff --git a/src/ComputeSharp.Core/Exceptions/InvalidExecutionContextException.cs b/src/ComputeSharp.Core/Exceptions/InvalidExecutionContextException.cs index 274cad30..b8661343 100644 --- a/src/ComputeSharp.Core/Exceptions/InvalidExecutionContextException.cs +++ b/src/ComputeSharp.Core/Exceptions/InvalidExecutionContextException.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.Exceptions; @@ -15,4 +15,4 @@ public sealed class InvalidExecutionContextException : InvalidOperationException : base($"The API {name} can only be used from within an HLSL shader.") { } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Helpers/FormatInterpolatedStringHandler.cs b/src/ComputeSharp.Core/Helpers/FormatInterpolatedStringHandler.cs index de7c0dcf..1edcaf7e 100644 --- a/src/ComputeSharp.Core/Helpers/FormatInterpolatedStringHandler.cs +++ b/src/ComputeSharp.Core/Helpers/FormatInterpolatedStringHandler.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Buffers; @@ -61,10 +61,10 @@ internal ref struct FormatInterpolatedStringHandler { this.format = format; this.formatProvider = formatProvider; - characters = initialBuffer; - arrayToReturnToPool = null; - position = 0; - hasCustomFormatter = formatProvider is not null && HasCustomFormatter(formatProvider); + this.characters = initialBuffer; + this.arrayToReturnToPool = null; + this.position = 0; + this.hasCustomFormatter = formatProvider is not null && HasCustomFormatter(formatProvider); } /// @@ -96,11 +96,11 @@ internal ref struct FormatInterpolatedStringHandler public string ToStringAndClear() { #if NET6_0_OR_GREATER - string result = new(characters.Slice(0, position)); + string result = new(this.characters.Slice(0, this.position)); #else - string result = characters.Slice(0, position).ToString(); + string result = this.characters.Slice(0, this.position).ToString(); #endif - char[]? toReturn = arrayToReturnToPool; + char[]? toReturn = this.arrayToReturnToPool; this = default; @@ -121,26 +121,27 @@ internal ref struct FormatInterpolatedStringHandler { if (value.Length == 1) { - Span chars = characters; - int pos = position; + Span chars = this.characters; + int pos = this.position; if ((uint)pos < (uint)chars.Length) { chars[pos] = value[0]; - position = pos + 1; + this.position = pos + 1; } else { GrowThenCopyString(value); } + return; } if (value.Length == 2) { - Span chars = characters; - int pos = position; + Span chars = this.characters; + int pos = this.position; if ((uint)pos < chars.Length - 1) { @@ -152,12 +153,13 @@ internal ref struct FormatInterpolatedStringHandler Unsafe.ReadUnaligned(ref Unsafe.As(ref MemoryMarshal.GetReference(value.AsSpan())))); #endif - position = pos + 2; + this.position = pos + 2; } else { GrowThenCopyString(value); } + return; } @@ -171,12 +173,12 @@ internal ref struct FormatInterpolatedStringHandler private void AppendStringDirect(string value) { #if NET6_0_OR_GREATER - if (value.TryCopyTo(characters.Slice(position))) + if (value.TryCopyTo(this.characters.Slice(this.position))) #else - if (value.AsSpan().TryCopyTo(characters.Slice(position))) + if (value.AsSpan().TryCopyTo(this.characters.Slice(this.position))) #endif { - position += value.Length; + this.position += value.Length; } else { @@ -204,23 +206,23 @@ internal ref struct FormatInterpolatedStringHandler where T : IFormattable #endif { - if (hasCustomFormatter) + if (this.hasCustomFormatter) { - AppendCustomFormatter(value, format); + AppendCustomFormatter(value, this.format); return; } #if NET6_0_OR_GREATER int charsWritten; - while (!value.TryFormat(characters.Slice(position), out charsWritten, format, formatProvider)) + while (!value.TryFormat(this.characters.Slice(this.position), out charsWritten, this.format, this.formatProvider)) { Grow(); } - position += charsWritten; + this.position += charsWritten; #else - AppendStringDirect(value.ToString(format, formatProvider)); + AppendStringDirect(value.ToString(this.format, this.formatProvider)); #endif } @@ -243,9 +245,9 @@ internal ref struct FormatInterpolatedStringHandler [MethodImpl(MethodImplOptions.NoInlining)] private void AppendCustomFormatter(T value, string? format) { - ICustomFormatter? formatter = (ICustomFormatter?)formatProvider?.GetFormat(typeof(ICustomFormatter)); + ICustomFormatter? formatter = (ICustomFormatter?)this.formatProvider?.GetFormat(typeof(ICustomFormatter)); - if (formatter is not null && formatter.Format(format, value, formatProvider) is string customFormatted) + if (formatter is not null && formatter.Format(format, value, this.formatProvider) is string customFormatted) { AppendStringDirect(customFormatted); } @@ -261,12 +263,12 @@ internal ref struct FormatInterpolatedStringHandler Grow(value.Length); #if NET6_0_OR_GREATER - value.CopyTo(characters.Slice(position)); + value.CopyTo(this.characters.Slice(this.position)); #else - value.AsSpan().CopyTo(characters.Slice(position)); + value.AsSpan().CopyTo(this.characters.Slice(this.position)); #endif - position += value.Length; + this.position += value.Length; } /// @@ -275,17 +277,19 @@ internal ref struct FormatInterpolatedStringHandler [MethodImpl(MethodImplOptions.NoInlining)] private void Grow(int additionalChars) { - GrowCore((uint)position + (uint)additionalChars); + GrowCore((uint)this.position + (uint)additionalChars); } +#if NET6_0_OR_GREATER /// /// Grows the size of . /// [MethodImpl(MethodImplOptions.NoInlining)] private void Grow() { - GrowCore((uint)characters.Length + 1); + GrowCore((uint)this.characters.Length + 1); } +#endif /// /// Grow the size of to at least the specified . @@ -293,7 +297,7 @@ internal ref struct FormatInterpolatedStringHandler [MethodImpl(MethodImplOptions.AggressiveInlining)] private void GrowCore(uint requiredMinCapacity) { - uint newCapacity = Math.Max(requiredMinCapacity, Math.Min((uint)characters.Length * 2, 0x3FFFFFDF)); + uint newCapacity = Math.Max(requiredMinCapacity, Math.Min((uint)this.characters.Length * 2, 0x3FFFFFDF)); #if NET6_0_OR_GREATER int arraySize = (int)Math.Clamp(newCapacity, MinimumArrayPoolLength, int.MaxValue); #else @@ -301,11 +305,11 @@ internal ref struct FormatInterpolatedStringHandler #endif char[] newArray = ArrayPool.Shared.Rent(arraySize); - characters.Slice(0, position).CopyTo(newArray); + this.characters.Slice(0, this.position).CopyTo(newArray); - char[]? toReturn = arrayToReturnToPool; + char[]? toReturn = this.arrayToReturnToPool; - characters = arrayToReturnToPool = newArray; + this.characters = this.arrayToReturnToPool = newArray; if (toReturn is not null) { diff --git a/src/ComputeSharp.Core/Helpers/TryWriteFormatInterpolatedStringHandler.cs b/src/ComputeSharp.Core/Helpers/TryWriteFormatInterpolatedStringHandler.cs index bfb0ffe0..0aec4d5b 100644 --- a/src/ComputeSharp.Core/Helpers/TryWriteFormatInterpolatedStringHandler.cs +++ b/src/ComputeSharp.Core/Helpers/TryWriteFormatInterpolatedStringHandler.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Runtime.InteropServices; @@ -34,12 +34,12 @@ internal ref struct TryWriteFormatInterpolatedStringHandler /// /// The number of characters written to . /// - internal int position; + private int position; /// /// Indicates whether all formatting operations have succeeded. /// - internal bool success; + private bool success; /// /// Whether provides an . @@ -62,9 +62,9 @@ internal ref struct TryWriteFormatInterpolatedStringHandler this.format = format; this.formatAsString = null; this.formatProvider = formatProvider; - position = 0; - success = shouldAppend = destination.Length >= literalLength; - hasCustomFormatter = formatProvider is not null && FormatInterpolatedStringHandler.HasCustomFormatter(formatProvider); + this.position = 0; + this.success = shouldAppend = destination.Length >= literalLength; + this.hasCustomFormatter = formatProvider is not null && FormatInterpolatedStringHandler.HasCustomFormatter(formatProvider); } /// @@ -106,13 +106,13 @@ internal ref struct TryWriteFormatInterpolatedStringHandler if (value.Length == 1) { Span destination = this.destination; - int pos = position; + int pos = this.position; if ((uint)pos < (uint)destination.Length) { destination[pos] = value[0]; - position = pos + 1; + this.position = pos + 1; return true; } @@ -123,7 +123,7 @@ internal ref struct TryWriteFormatInterpolatedStringHandler if (value.Length == 2) { Span destination = this.destination; - int pos = position; + int pos = this.position; if ((uint)pos < destination.Length - 1) { @@ -135,7 +135,7 @@ internal ref struct TryWriteFormatInterpolatedStringHandler Unsafe.ReadUnaligned(ref Unsafe.As(ref MemoryMarshal.GetReference(value.AsSpan())))); #endif - position = pos + 2; + this.position = pos + 2; return true; } @@ -154,12 +154,12 @@ internal ref struct TryWriteFormatInterpolatedStringHandler private bool AppendStringDirect(string value) { #if NET6_0_OR_GREATER - if (value.TryCopyTo(destination.Slice(position))) + if (value.TryCopyTo(this.destination.Slice(this.position))) #else - if (value.AsSpan().TryCopyTo(destination.Slice(position))) + if (value.AsSpan().TryCopyTo(this.destination.Slice(this.position))) #endif { - position += value.Length; + this.position += value.Length; return true; } @@ -177,24 +177,22 @@ internal ref struct TryWriteFormatInterpolatedStringHandler where T : IFormattable #endif { - if (hasCustomFormatter) + if (this.hasCustomFormatter) { - return AppendCustomFormatter(value, formatAsString ??= format.ToString()); + return AppendCustomFormatter(value, this.formatAsString ??= this.format.ToString()); } #if NET6_0_OR_GREATER - int charsWritten; - - if (value.TryFormat(destination.Slice(position), out charsWritten, format, formatProvider)) + if (value.TryFormat(this.destination.Slice(this.position), out int charsWritten, this.format, this.formatProvider)) { - position += charsWritten; + this.position += charsWritten; return true; } return Fail(); #else - return AppendStringDirect(value.ToString(formatAsString ??= format.ToString(), formatProvider)); + return AppendStringDirect(value.ToString(this.formatAsString ??= this.format.ToString(), this.formatProvider)); #endif } @@ -204,7 +202,7 @@ internal ref struct TryWriteFormatInterpolatedStringHandler /// The value to write. public bool AppendFormatted(string? value) { - if (hasCustomFormatter) + if (this.hasCustomFormatter) { return AppendCustomFormatter(value, format: null); } @@ -215,12 +213,12 @@ internal ref struct TryWriteFormatInterpolatedStringHandler } #if NET6_0_OR_GREATER - if (value.TryCopyTo(destination.Slice(position))) + if (value.TryCopyTo(this.destination.Slice(this.position))) #else - if (value.AsSpan().TryCopyTo(destination.Slice(position))) + if (value.AsSpan().TryCopyTo(this.destination.Slice(this.position))) #endif { - position += value.Length; + this.position += value.Length; return true; } @@ -236,9 +234,9 @@ internal ref struct TryWriteFormatInterpolatedStringHandler [MethodImpl(MethodImplOptions.NoInlining)] private bool AppendCustomFormatter(T value, string? format) { - ICustomFormatter? formatter = (ICustomFormatter?)formatProvider?.GetFormat(typeof(ICustomFormatter)); + ICustomFormatter? formatter = (ICustomFormatter?)this.formatProvider?.GetFormat(typeof(ICustomFormatter)); - if (formatter is not null && formatter.Format(format, value, formatProvider) is string customFormatted) + if (formatter is not null && formatter.Format(format, value, this.formatProvider) is string customFormatted) { return AppendStringDirect(customFormatted); } @@ -251,7 +249,7 @@ internal ref struct TryWriteFormatInterpolatedStringHandler /// private bool Fail() { - success = false; + this.success = false; return false; } diff --git a/src/ComputeSharp.Core/Intrinsics/Attributes/HlslIntrinsicNameAttribute.cs b/src/ComputeSharp.Core/Intrinsics/Attributes/HlslIntrinsicNameAttribute.cs index 5a5b0df5..ffc2fdad 100644 --- a/src/ComputeSharp.Core/Intrinsics/Attributes/HlslIntrinsicNameAttribute.cs +++ b/src/ComputeSharp.Core/Intrinsics/Attributes/HlslIntrinsicNameAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; namespace ComputeSharp.Core.Intrinsics.Attributes; @@ -28,4 +28,4 @@ internal sealed class HlslIntrinsicNameAttribute : Attribute /// Gets whether or not matching parameters is also required to extract the name of this intrinsic. /// public bool RequiresParametersMatching { get; init; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.g.cs b/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.g.cs index 937ed920..42845080 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.g.cs +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.g.cs @@ -1,5 +1,7 @@ using ComputeSharp.Core.Intrinsics.Attributes; +#pragma warning disable IDE0022 + namespace ComputeSharp; /// diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.tt b/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.tt index eeb80f9f..51a0a0e8 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.tt +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.tt @@ -4,6 +4,8 @@ <#@ output extension=".g.cs"#> using ComputeSharp.Core.Intrinsics.Attributes; +#pragma warning disable IDE0022 + namespace ComputeSharp; /// diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.g.cs b/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.g.cs index d72e9827..98ba9e5a 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.g.cs +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.g.cs @@ -1,6 +1,8 @@ using ComputeSharp.Core.Intrinsics.Attributes; using ComputeSharp.Exceptions; +#pragma warning disable IDE0022 + namespace ComputeSharp; /// diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.tt b/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.tt index 1536a67a..fccd4923 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.tt +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.tt @@ -2,6 +2,8 @@ using ComputeSharp.Core.Intrinsics.Attributes; using ComputeSharp.Exceptions; +#pragma warning disable IDE0022 + namespace ComputeSharp; /// diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.cs b/src/ComputeSharp.Core/Intrinsics/Hlsl.cs index 03fb5bb7..57e56054 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.cs +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.cs @@ -1,6 +1,8 @@ -using ComputeSharp.Core.Intrinsics.Attributes; +using ComputeSharp.Core.Intrinsics.Attributes; using ComputeSharp.Exceptions; +#pragma warning disable IDE0022 + namespace ComputeSharp; /// @@ -88,4 +90,4 @@ public static partial class Hlsl /// [HlslIntrinsicName("lit")] public static float Lit(float nDotL, float nDotH, float m) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs b/src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs index b59a334d..2ebe9659 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs @@ -1,6 +1,8 @@ using ComputeSharp.Core.Intrinsics.Attributes; using ComputeSharp.Exceptions; +#pragma warning disable IDE0022 + namespace ComputeSharp; /// diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.tt b/src/ComputeSharp.Core/Intrinsics/Hlsl.tt index da74c73d..60fc7d8d 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.tt +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.tt @@ -2,6 +2,8 @@ using ComputeSharp.Core.Intrinsics.Attributes; using ComputeSharp.Exceptions; +#pragma warning disable IDE0022 + namespace ComputeSharp; /// diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool.cs index 774676c6..d2d0490f 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; namespace ComputeSharp; @@ -13,7 +13,7 @@ public readonly struct Bool /// The wrapped value for the current instance. /// [FieldOffset(0)] - private readonly int Value; + private readonly int value; /// /// Creates a new instance for a given value. @@ -21,19 +21,19 @@ public readonly struct Bool /// . private Bool(bool value) { - Value = value ? 1 : 0; + this.value = value ? 1 : 0; } /// public override bool Equals(object? obj) { - return obj is Bool x && Value == x.Value; + return obj is Bool x && this.value == x.value; } /// public override int GetHashCode() { - return Value.GetHashCode(); + return this.value.GetHashCode(); } /// @@ -94,24 +94,24 @@ public readonly struct Bool /// /// The left instance. /// The right instance. - public static bool operator ==(Bool left, Bool right) => left.Value == right.Value; + public static bool operator ==(Bool left, Bool right) => left.value == right.value; /// /// Checks whether or not two instances represent a different value. /// /// The left instance. /// The right instance. - public static bool operator !=(Bool left, Bool right) => left.Value != right.Value; + public static bool operator !=(Bool left, Bool right) => left.value != right.value; /// /// Converts a given instance to its corresponding value. /// /// The input instance. - public static implicit operator bool(Bool x) => x.Value != 0; + public static implicit operator bool(Bool x) => x.value != 0; /// /// Converts a value to a corresponding instance. /// /// The input value. public static implicit operator Bool(bool x) => new(x); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool2.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool2.cs index 2257036a..5ae6f9dd 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool2.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool2.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS0660, CS0661 +#pragma warning disable CS0660, CS0661 namespace ComputeSharp; @@ -23,4 +23,4 @@ public partial struct Bool2 /// /// The value to use for the components of the new instance. public static implicit operator Bool2(bool x) => new(x, x); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool3.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool3.cs index 35eee2fa..1e1b3c5d 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool3.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool3.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS0660, CS0661 +#pragma warning disable CS0660, CS0661 namespace ComputeSharp; @@ -49,4 +49,4 @@ public partial struct Bool3 /// /// The value to use for the components of the new instance. public static implicit operator Bool3(bool x) => new(x, x, x); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool4.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool4.cs index 3694225d..fbcc45d4 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool4.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool4.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS0660, CS0661 +#pragma warning disable CS0660, CS0661 namespace ComputeSharp; @@ -94,4 +94,4 @@ public partial struct Bool4 /// /// The value to use for the components of the new instance. public static implicit operator Bool4(bool x) => new(x, x, x, x); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Double/Double2.cs b/src/ComputeSharp.Core/Primitives/Double/Double2.cs index 15bec764..4df36386 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double2.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double2.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS0660, CS0661 +#pragma warning disable CS0660, CS0661 namespace ComputeSharp; @@ -44,4 +44,4 @@ public partial struct Double2 /// The input value to cast. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static explicit operator Float2(Double2 xy) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Double/Double3.cs b/src/ComputeSharp.Core/Primitives/Double/Double3.cs index aadd36e5..7a913297 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double3.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double3.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS0660, CS0661 +#pragma warning disable CS0660, CS0661 namespace ComputeSharp; @@ -70,4 +70,4 @@ public partial struct Double3 /// The input value to cast. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static explicit operator Float3(Double3 xyz) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Double/Double4.cs b/src/ComputeSharp.Core/Primitives/Double/Double4.cs index 345e51a9..e17e3fce 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double4.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double4.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS0660, CS0661 +#pragma warning disable CS0660, CS0661 namespace ComputeSharp; @@ -115,4 +115,4 @@ public partial struct Double4 /// The input value to cast. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static explicit operator Float4(Double4 xyzw) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Float/Float2.cs b/src/ComputeSharp.Core/Primitives/Float/Float2.cs index aa9a566f..bae3c788 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float2.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float2.cs @@ -1,4 +1,4 @@ -using System.Numerics; +using System.Numerics; #pragma warning disable CS0660, CS0661 @@ -58,4 +58,4 @@ public partial struct Float2 /// The input value to cast. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static explicit operator UInt2(Float2 xy) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Float/Float3.cs b/src/ComputeSharp.Core/Primitives/Float/Float3.cs index b934c43b..538a6000 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float3.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float3.cs @@ -1,4 +1,4 @@ -using System.Numerics; +using System.Numerics; #pragma warning disable CS0660, CS0661 @@ -84,4 +84,4 @@ public partial struct Float3 /// The input value to cast. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static explicit operator UInt3(Float3 xyz) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Float/Float4.cs b/src/ComputeSharp.Core/Primitives/Float/Float4.cs index 8796eda4..3cbe2622 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float4.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float4.cs @@ -1,4 +1,4 @@ -using System.Numerics; +using System.Numerics; #pragma warning disable CS0660, CS0661 @@ -129,4 +129,4 @@ public partial struct Float4 /// The input value to cast. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static explicit operator UInt4(Float4 xyzw) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Int/Int2.cs b/src/ComputeSharp.Core/Primitives/Int/Int2.cs index 2093f902..b9ce5e58 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int2.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int2.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS0660, CS0661 +#pragma warning disable CS0660, CS0661 namespace ComputeSharp; @@ -44,4 +44,4 @@ public partial struct Int2 /// The input value to cast. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static implicit operator Double2(Int2 xy) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Int/Int3.cs b/src/ComputeSharp.Core/Primitives/Int/Int3.cs index cdfd9641..90c1b94c 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int3.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int3.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS0660, CS0661 +#pragma warning disable CS0660, CS0661 namespace ComputeSharp; @@ -70,4 +70,4 @@ public partial struct Int3 /// The input value to cast. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static implicit operator Double3(Int3 xyz) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Int/Int4.cs b/src/ComputeSharp.Core/Primitives/Int/Int4.cs index d5f44c49..41e6fb60 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int4.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int4.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS0660, CS0661 +#pragma warning disable CS0660, CS0661 namespace ComputeSharp; @@ -115,4 +115,4 @@ public partial struct Int4 /// The input value to cast. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static implicit operator Double4(Int4 xyzw) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/MatrixIndex.cs b/src/ComputeSharp.Core/Primitives/MatrixIndex.cs index d5044d3c..2b2bfd1c 100644 --- a/src/ComputeSharp.Core/Primitives/MatrixIndex.cs +++ b/src/ComputeSharp.Core/Primitives/MatrixIndex.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// A type indicating a base-1 index into a matrix type. This can be used to extract references to swizzled vectors within a given matrix value. @@ -93,4 +93,4 @@ public enum MatrixIndex /// The fourth item in the fourth row. /// M44 -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs index 782624e7..48ef484e 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS0660, CS0661 +#pragma warning disable CS0660, CS0661 namespace ComputeSharp; @@ -44,4 +44,4 @@ public partial struct UInt2 /// The input value to cast. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static implicit operator Double2(UInt2 xy) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs index 88fab923..65c4f468 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS0660, CS0661 +#pragma warning disable CS0660, CS0661 namespace ComputeSharp; @@ -70,4 +70,4 @@ public partial struct UInt3 /// The input value to cast. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static implicit operator Double3(UInt3 xyz) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs index 3be7d78d..a7b776b1 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS0660, CS0661 +#pragma warning disable CS0660, CS0661 namespace ComputeSharp; @@ -115,4 +115,4 @@ public partial struct UInt4 /// The input value to cast. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static implicit operator Double4(UInt4 xyzw) => default; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Properties/Polyfills/UnscopedRefAttribute.cs b/src/ComputeSharp.Core/Properties/Polyfills/UnscopedRefAttribute.cs index c57a296a..f6f5776c 100644 --- a/src/ComputeSharp.Core/Properties/Polyfills/UnscopedRefAttribute.cs +++ b/src/ComputeSharp.Core/Properties/Polyfills/UnscopedRefAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Diagnostics.CodeAnalysis; diff --git a/src/ComputeSharp.D2D1.NetStandard/System/Buffers/BitOperations.cs b/src/ComputeSharp.D2D1.NetStandard/System/Buffers/BitOperations.cs index a8f36d90..fa177274 100644 --- a/src/ComputeSharp.D2D1.NetStandard/System/Buffers/BitOperations.cs +++ b/src/ComputeSharp.D2D1.NetStandard/System/Buffers/BitOperations.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; namespace ComputeSharp.D2D1.NetStandard.System.Buffers; diff --git a/src/ComputeSharp.D2D1.NetStandard/System/Diagnostics.CodeAnalysis/DoesNotReturnAttribute.cs b/src/ComputeSharp.D2D1.NetStandard/System/Diagnostics.CodeAnalysis/DoesNotReturnAttribute.cs index 1c6a222e..1c661961 100644 --- a/src/ComputeSharp.D2D1.NetStandard/System/Diagnostics.CodeAnalysis/DoesNotReturnAttribute.cs +++ b/src/ComputeSharp.D2D1.NetStandard/System/Diagnostics.CodeAnalysis/DoesNotReturnAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. diff --git a/src/ComputeSharp.D2D1.NetStandard/System/Math.cs b/src/ComputeSharp.D2D1.NetStandard/System/Math.cs index 7885d997..8d011f9a 100644 --- a/src/ComputeSharp.D2D1.NetStandard/System/Math.cs +++ b/src/ComputeSharp.D2D1.NetStandard/System/Math.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; namespace ComputeSharp.D2D1.NetStandard.System; @@ -21,7 +21,7 @@ internal static class Math { return min; } - + if (value > max) { return max; diff --git a/src/ComputeSharp.D2D1.NetStandard/System/Runtime/CompilerServices/RuntimeHelpers.cs b/src/ComputeSharp.D2D1.NetStandard/System/Runtime/CompilerServices/RuntimeHelpers.cs index b7a2c4ee..38812bf3 100644 --- a/src/ComputeSharp.D2D1.NetStandard/System/Runtime/CompilerServices/RuntimeHelpers.cs +++ b/src/ComputeSharp.D2D1.NetStandard/System/Runtime/CompilerServices/RuntimeHelpers.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; namespace ComputeSharp.D2D1.NetStandard.System.Runtime.CompilerServices; @@ -14,5 +14,8 @@ internal static class RuntimeHelpers /// The type to associate the memory to. /// The size in byte of the memory to allocate. /// A pointer to the allocated memory. - public static IntPtr AllocateTypeAssociatedMemory(Type type, int size) => Marshal.AllocHGlobal(size); + public static IntPtr AllocateTypeAssociatedMemory(Type type, int size) + { + return Marshal.AllocHGlobal(size); + } } \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.NetStandard/System/Text/EncodingExtensions.cs b/src/ComputeSharp.D2D1.NetStandard/System/Text/EncodingExtensions.cs index 4f9f5f47..9be7852d 100644 --- a/src/ComputeSharp.D2D1.NetStandard/System/Text/EncodingExtensions.cs +++ b/src/ComputeSharp.D2D1.NetStandard/System/Text/EncodingExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; using System.Text; diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.Execute.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.Execute.Syntax.cs index 93ef05c5..ac2bead8 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.Execute.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.Execute.Syntax.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Text; using ComputeSharp.D2D1.SourceGenerators.Models; @@ -101,4 +101,4 @@ partial class D2DPixelShaderSourceGenerator .WithBody(methodBlock); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.Execute.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.Execute.cs index b346673b..65a2f074 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.Execute.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.Execute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Immutable; using System.ComponentModel; using System.Runtime.CompilerServices; @@ -188,4 +188,4 @@ partial class D2DPixelShaderSourceGenerator return bytecode; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs index 0d96cb7e..0e653800 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -119,4 +119,4 @@ public sealed partial class D2DPixelShaderSourceGenerator : IIncrementalGenerato context.AddSource($"{item.Hierarchy.FilenameHint}.{item.BytecodeInfo.MethodName}.g.cs", text); }); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidAssemblyLevelCompileOptionsAnalyzer.cs b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidAssemblyLevelCompileOptionsAnalyzer.cs index 50d4843b..a0cf5ce7 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidAssemblyLevelCompileOptionsAnalyzer.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidAssemblyLevelCompileOptionsAnalyzer.cs @@ -45,4 +45,4 @@ public sealed class InvalidAssemblyLevelCompileOptionsAnalyzer : DiagnosticAnaly } }); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexUseAnalyzer.cs b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexUseAnalyzer.cs index 1b599546..55caff9d 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexUseAnalyzer.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidD2DResourceTextureIndexUseAnalyzer.cs @@ -45,4 +45,4 @@ public sealed class InvalidD2DResourceTextureIndexUseAnalyzer : DiagnosticAnalyz } }, SymbolKind.Field); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs index 4dceab78..48bd1fd5 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs @@ -1,4 +1,4 @@ -using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis; namespace ComputeSharp.SourceGeneration.Diagnostics; @@ -856,4 +856,4 @@ partial class DiagnosticDescriptors isEnabledByDefault: true, description: "A D2D1 shader must be annotated with the [D2DInputCount] attribute.", helpLinkUri: "https://github.com/Sergio0694/ComputeSharp"); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/SuppressionDescriptors.cs b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/SuppressionDescriptors.cs index b9b3864b..1b4fe29e 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/SuppressionDescriptors.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/SuppressionDescriptors.cs @@ -1,4 +1,4 @@ -using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis; namespace ComputeSharp.D2D1.SourceGenerators.Diagnostics; @@ -14,4 +14,4 @@ internal static class SuppressionDescriptors id: "CMPSD2DSPR0001", suppressedDiagnosticId: "CS0649", justification: "Fields of type D2D1ResourceTexture1D, D2D1ResourceTexture2D and D2D1ResourceTexture3D are implicitly mapped to resource texture objects into the resulting D2D1 pixel shader for their containing type, and don't need to be initialized"); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Suppressors/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressor.cs b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Suppressors/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressor.cs index 6a34ff49..d7c3ba60 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Suppressors/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressor.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Suppressors/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressor.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; using ComputeSharp.SourceGeneration.Mappings; using Microsoft.CodeAnalysis; @@ -68,4 +68,4 @@ public sealed class D2D1ResourceTextureUninitializedFieldDiagnosticSuppressor : } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateBuildHlslSourceMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateBuildHlslSourceMethod.Syntax.cs index 3ba67836..9cfecca8 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateBuildHlslSourceMethod.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateBuildHlslSourceMethod.Syntax.cs @@ -1,4 +1,4 @@ -using ComputeSharp.D2D1.__Internals; +using ComputeSharp.D2D1.__Internals; using ComputeSharp.SourceGeneration.Helpers; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -49,4 +49,4 @@ partial class ID2D1ShaderGenerator LiteralExpression(SyntaxKind.StringLiteralExpression, hlslSourceLiteralExpression))))); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateBuildHlslSourceMethod.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateBuildHlslSourceMethod.cs index f9687982..8faf1d54 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateBuildHlslSourceMethod.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateBuildHlslSourceMethod.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -64,13 +64,13 @@ partial class ID2D1ShaderGenerator out ImmutableArray<(string Name, string HlslType, int Index)> resourceTextureFields); // Explore the syntax tree and extract the processed info - var semanticModelProvider = new SemanticModelProvider(compilation); - var (entryPoint, processedMethods) = GetProcessedMethods(diagnostics, structDeclaration, structDeclarationSymbol, semanticModelProvider, discoveredTypes, staticMethods, instanceMethods, constantDefinitions, out bool methodsNeedD2D1RequiresScenePosition); - var staticFields = GetStaticFields(diagnostics, semanticModelProvider, structDeclaration, structDeclarationSymbol, discoveredTypes, constantDefinitions, out bool fieldsNeedD2D1RequiresScenePosition); + SemanticModelProvider semanticModelProvider = new(compilation); + (string entryPoint, ImmutableArray<(string Signature, string Definition)> processedMethods) = GetProcessedMethods(diagnostics, structDeclaration, structDeclarationSymbol, semanticModelProvider, discoveredTypes, staticMethods, instanceMethods, constantDefinitions, out bool methodsNeedD2D1RequiresScenePosition); + ImmutableArray<(string Name, string TypeDeclaration, string? Assignment)> staticFields = GetStaticFields(diagnostics, semanticModelProvider, structDeclaration, structDeclarationSymbol, discoveredTypes, constantDefinitions, out bool fieldsNeedD2D1RequiresScenePosition); // Process the discovered types and constants - var declaredTypes = GetDeclaredTypes(diagnostics, structDeclarationSymbol, discoveredTypes, instanceMethods); - var definedConstants = GetDefinedConstants(constantDefinitions); + ImmutableArray<(string Name, string Definition)> declaredTypes = GetDeclaredTypes(diagnostics, structDeclarationSymbol, discoveredTypes, instanceMethods); + ImmutableArray<(string Name, string Value)> definedConstants = GetDefinedConstants(constantDefinitions); // Check whether the scene position is required bool requiresScenePosition = GetD2DRequiresScenePositionInfo(structDeclarationSymbol); @@ -111,7 +111,7 @@ partial class ID2D1ShaderGenerator using ImmutableArrayBuilder<(string, string)> values = ImmutableArrayBuilder<(string, string)>.Rent(); using ImmutableArrayBuilder<(string, string, int)> resourceTextures = ImmutableArrayBuilder<(string, string, int)>.Rent(); - foreach (var fieldSymbol in structDeclarationSymbol.GetMembers().OfType()) + foreach (IFieldSymbol fieldSymbol in structDeclarationSymbol.GetMembers().OfType()) { if (fieldSymbol.IsStatic) { @@ -205,9 +205,9 @@ partial class ID2D1ShaderGenerator needsD2D1RequiresScenePosition = false; - foreach (var fieldDeclaration in structDeclaration.Members.OfType()) + foreach (FieldDeclarationSyntax fieldDeclaration in structDeclaration.Members.OfType()) { - foreach (var variableDeclarator in fieldDeclaration.Declaration.Variables) + foreach (VariableDeclaratorSyntax variableDeclarator in fieldDeclaration.Declaration.Variables) { IFieldSymbol fieldSymbol = (IFieldSymbol)semanticModel.For(variableDeclarator).GetDeclaredSymbol(variableDeclarator)!; @@ -319,7 +319,7 @@ partial class ID2D1ShaderGenerator needsD2D1RequiresScenePosition |= shaderSourceRewriter.NeedsD2DRequiresScenePositionAttribute; // Emit the extracted local functions first - foreach (var localFunction in shaderSourceRewriter.LocalFunctions) + foreach (KeyValuePair localFunction in shaderSourceRewriter.LocalFunctions) { methods.Add(( localFunction.Value.AsDefinition().NormalizeWhitespace(eol: "\n").ToFullString(), @@ -362,10 +362,10 @@ partial class ID2D1ShaderGenerator { using ImmutableArrayBuilder<(string, string)> builder = ImmutableArrayBuilder<(string, string)>.Rent(); - foreach (var constant in constantDefinitions) + foreach (KeyValuePair constant in constantDefinitions) { - var ownerTypeName = ((INamedTypeSymbol)constant.Key.ContainingSymbol).ToDisplayString().ToHlslIdentifierName(); - var constantName = $"__{ownerTypeName}__{constant.Key.Name}"; + string ownerTypeName = ((INamedTypeSymbol)constant.Key.ContainingSymbol).ToDisplayString().ToHlslIdentifierName(); + string constantName = $"__{ownerTypeName}__{constant.Key.Name}"; builder.Add((constantName, constant.Value)); } @@ -389,18 +389,21 @@ partial class ID2D1ShaderGenerator { using ImmutableArrayBuilder<(string, string)> builder = ImmutableArrayBuilder<(string, string)>.Rent(); - IReadOnlyCollection invalidTypes; + IReadOnlyCollection invalidTypes; // Process the discovered types - foreach (var type in HlslKnownTypes.GetCustomTypes(types, out invalidTypes)) + foreach (INamedTypeSymbol type in HlslKnownTypes.GetCustomTypes(types, out invalidTypes)) { - var structType = type.GetFullMetadataName().ToHlslIdentifierName(); - var structDeclaration = StructDeclaration(structType); + string structType = type.GetFullMetadataName().ToHlslIdentifierName(); + StructDeclarationSyntax structDeclaration = StructDeclaration(structType); // Declare the fields of the current type - foreach (var field in type.GetMembers().OfType()) + foreach (IFieldSymbol field in type.GetMembers().OfType()) { - if (field.IsStatic) continue; + if (field.IsStatic) + { + continue; + } INamedTypeSymbol fieldType = (INamedTypeSymbol)field.Type; @@ -423,7 +426,7 @@ partial class ID2D1ShaderGenerator } // Declare the methods of the current type - foreach (var method in instanceMethods.Where(pair => SymbolEqualityComparer.Default.Equals(pair.Key.ContainingType, type))) + foreach (KeyValuePair method in instanceMethods.Where(pair => SymbolEqualityComparer.Default.Equals(pair.Key.ContainingType, type))) { structDeclaration = structDeclaration.AddMembers(method.Value); } @@ -453,7 +456,7 @@ partial class ID2D1ShaderGenerator /// The input instance to process. private static void DetectAndReportInvalidPropertyDeclarations(ImmutableArrayBuilder diagnostics, INamedTypeSymbol structDeclarationSymbol) { - foreach (var memberSymbol in structDeclarationSymbol.GetMembers()) + foreach (ISymbol memberSymbol in structDeclarationSymbol.GetMembers()) { // Detect properties that are not explicit interface implementations if (memberSymbol is IPropertySymbol { ExplicitInterfaceImplementations.IsEmpty: true }) @@ -530,13 +533,13 @@ partial class ID2D1ShaderGenerator void AppendLF() { - hlslBuilder.Append('\n'); + _ = hlslBuilder.Append('\n'); } void AppendLineAndLF(string text) { - hlslBuilder.Append(text); - hlslBuilder.Append('\n'); + _ = hlslBuilder.Append(text); + _ = hlslBuilder.Append('\n'); } // Header @@ -574,7 +577,7 @@ partial class ID2D1ShaderGenerator { AppendLF(); - foreach (var (name, value) in definedConstants) + foreach ((string name, string value) in definedConstants) { AppendLineAndLF($"#define {name} {value}"); } @@ -585,7 +588,7 @@ partial class ID2D1ShaderGenerator { AppendLF(); - foreach (var field in staticFields) + foreach ((string Name, string TypeDeclaration, string? Assignment) field in staticFields) { if (field.Assignment is string assignment) { @@ -599,7 +602,7 @@ partial class ID2D1ShaderGenerator } // Declared types - foreach (var (_, typeDefinition) in declaredTypes) + foreach ((string _, string typeDefinition) in declaredTypes) { AppendLF(); AppendLineAndLF(typeDefinition); @@ -610,14 +613,14 @@ partial class ID2D1ShaderGenerator { AppendLF(); - foreach (var (fieldName, fieldType) in valueFields) + foreach ((string fieldName, string fieldType) in valueFields) { AppendLineAndLF($"{fieldType} {fieldName};"); } } // Resource textures - foreach (var (fieldName, fieldType, index) in resourceTextureFields) + foreach ((string fieldName, string fieldType, int index) in resourceTextureFields) { AppendLF(); @@ -626,14 +629,14 @@ partial class ID2D1ShaderGenerator } // Forward declarations - foreach (var (forwardDeclaration, _) in processedMethods) + foreach ((string forwardDeclaration, string _) in processedMethods) { AppendLF(); AppendLineAndLF(forwardDeclaration); } // Captured methods - foreach (var (_, method) in processedMethods) + foreach ((string _, string method) in processedMethods) { AppendLF(); AppendLineAndLF(method); @@ -646,4 +649,4 @@ partial class ID2D1ShaderGenerator return hlslBuilder.ToString(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetInputCountMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetInputCountMethod.Syntax.cs index 80028804..92326c75 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetInputCountMethod.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetInputCountMethod.Syntax.cs @@ -1,4 +1,4 @@ -using ComputeSharp.D2D1.__Internals; +using ComputeSharp.D2D1.__Internals; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; @@ -35,4 +35,4 @@ partial class ID2D1ShaderGenerator .WithBody(Block(ReturnStatement(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(inputCount))))); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetInputTypeMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetInputTypeMethod.Syntax.cs index fcf9c5cc..6bb75339 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetInputTypeMethod.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetInputTypeMethod.Syntax.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using ComputeSharp.D2D1.__Internals; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -78,4 +78,4 @@ partial class ID2D1ShaderGenerator LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(1))); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetInputTypeMethod.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetInputTypeMethod.cs index b6e85408..c6e23620 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetInputTypeMethod.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetInputTypeMethod.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; using ComputeSharp.SourceGeneration.Helpers; @@ -169,4 +169,4 @@ partial class ID2D1ShaderGenerator combinedInputTypes = combinedBuilder.ToImmutable(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.Syntax.cs index 427d89b7..02b0cd88 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.Syntax.cs @@ -1,4 +1,4 @@ -using ComputeSharp.D2D1.__Internals; +using ComputeSharp.D2D1.__Internals; using ComputeSharp.D2D1.SourceGenerators.Models; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -48,4 +48,4 @@ partial class ID2D1ShaderGenerator LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal((int)info.ChannelDepth)))))); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.cs index f0af8afe..3c746fb1 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.cs @@ -1,4 +1,4 @@ -using ComputeSharp.SourceGeneration.Extensions; +using ComputeSharp.SourceGeneration.Extensions; using Microsoft.CodeAnalysis; namespace ComputeSharp.D2D1.SourceGenerators; @@ -59,4 +59,4 @@ partial class ID2D1ShaderGenerator } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetPixelOptionsMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetPixelOptionsMethod.Syntax.cs index b583ae38..e5d9b082 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetPixelOptionsMethod.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetPixelOptionsMethod.Syntax.cs @@ -1,4 +1,4 @@ -using ComputeSharp.D2D1.__Internals; +using ComputeSharp.D2D1.__Internals; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; @@ -33,4 +33,4 @@ partial class ID2D1ShaderGenerator .WithBody(Block(ReturnStatement(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal((int)pixelOptions))))); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetPixelOptionsMethod.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetPixelOptionsMethod.cs index d1f52c2c..18102a14 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetPixelOptionsMethod.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetPixelOptionsMethod.cs @@ -1,4 +1,4 @@ -using ComputeSharp.SourceGeneration.Extensions; +using ComputeSharp.SourceGeneration.Extensions; using Microsoft.CodeAnalysis; namespace ComputeSharp.D2D1.SourceGenerators; @@ -28,4 +28,4 @@ partial class ID2D1ShaderGenerator } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInitializeFromDispatchDataMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInitializeFromDispatchDataMethod.Syntax.cs index fc8709d8..0c1a3598 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInitializeFromDispatchDataMethod.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInitializeFromDispatchDataMethod.Syntax.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using ComputeSharp.D2D1.__Internals; using ComputeSharp.D2D1.SourceGenerators.Models; using ComputeSharp.SourceGeneration.Helpers; @@ -124,6 +124,7 @@ partial class ID2D1ShaderGenerator ParseExpression($"global::System.Runtime.CompilerServices.Unsafe.Add(ref {rowLocalName}, {j})"), ParseExpression($"global::System.Runtime.CompilerServices.Unsafe.As(ref global::System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref r0, (nint){matrix.Offsets[j]}))")))); } + break; } } @@ -131,4 +132,4 @@ partial class ID2D1ShaderGenerator return statements.ToImmutable(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadBytecodeMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadBytecodeMethod.Syntax.cs index fea4c8b3..ab8d460b 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadBytecodeMethod.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadBytecodeMethod.Syntax.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Globalization; using System.Linq; using System.Text; @@ -189,7 +189,7 @@ partial class ID2D1ShaderGenerator /// /// A mapping of precomputed literals for all values. /// - private static readonly string[] formattedBytes = + private static readonly string[] FormattedBytes = { "0x00", "0x01", "0x02", "0x03", "0x04", "0x05", "0x06", "0x07", "0x08", "0x09", "0x0A", "0x0B", "0x0C", "0x0D", "0x0E", "0x0F", "0x10", "0x11", "0x12", "0x13", "0x14", "0x15", "0x16", "0x17", "0x18", "0x19", "0x1A", "0x1B", "0x1C", "0x1D", "0x1E", "0x1F", @@ -218,15 +218,15 @@ partial class ID2D1ShaderGenerator { using ImmutableArrayBuilder builder = ImmutableArrayBuilder.Rent(); - builder.AddRange(formattedBytes[bytecode[0]].AsSpan()); + builder.AddRange(FormattedBytes[bytecode[0]].AsSpan()); foreach (byte b in bytecode.Slice(1)) { builder.AddRange(", ".AsSpan()); - builder.AddRange(formattedBytes[b].AsSpan()); + builder.AddRange(FormattedBytes[b].AsSpan()); } return builder.ToString(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadBytecodeMethod.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadBytecodeMethod.cs index 624f9b69..8c684364 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadBytecodeMethod.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadBytecodeMethod.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Immutable; using System.ComponentModel; using System.Linq; @@ -191,4 +191,4 @@ partial class ID2D1ShaderGenerator return message.NormalizeToSingleLine(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadDispatchDataMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadDispatchDataMethod.Syntax.cs index aaace9de..381e0b6d 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadDispatchDataMethod.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadDispatchDataMethod.Syntax.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using ComputeSharp.D2D1.__Internals; using ComputeSharp.D2D1.SourceGenerators.Models; using ComputeSharp.SourceGeneration.Helpers; @@ -149,6 +149,7 @@ partial class ID2D1ShaderGenerator ParseExpression($"global::System.Runtime.CompilerServices.Unsafe.As(ref global::System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref r0, (nint){matrix.Offsets[j]}))"), ParseExpression($"global::System.Runtime.CompilerServices.Unsafe.Add(ref {rowLocalName}, {j})")))); } + break; } } @@ -166,4 +167,4 @@ partial class ID2D1ShaderGenerator return statements.ToImmutable(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadDispatchDataMethod.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadDispatchDataMethod.cs index fa90409d..e3f23d17 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadDispatchDataMethod.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadDispatchDataMethod.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -72,7 +72,7 @@ partial class ID2D1ShaderGenerator else if (fieldSymbol.Type.IsUnmanagedType) { // Custom struct type defined by the user - foreach (var fieldInfo in GetCapturedFieldInfos(fieldSymbol.Type, fieldPath.Add(fieldName), rawDataOffset)) + foreach (FieldInfo fieldInfo in GetCapturedFieldInfos(fieldSymbol.Type, fieldPath.Add(fieldName), rawDataOffset)) { yield return fieldInfo; } @@ -117,7 +117,7 @@ partial class ID2D1ShaderGenerator { // For scalar, vector and linear matrix types, serialize the value normally. // Only the initial alignment needs to be considered, while data is packed. - var (fieldSize, fieldPack) = HlslKnownSizes.GetTypeInfo(typeName); + (int fieldSize, int fieldPack) = HlslKnownSizes.GetTypeInfo(typeName); // Check if the current type is a matrix type with more than one row. In this // case, each row is aligned as if it was a separate array, so the start of @@ -132,7 +132,7 @@ partial class ID2D1ShaderGenerator builder.Add(startingRawDataOffset); - rawDataOffset = startingRawDataOffset + fieldPack * columns; + rawDataOffset = startingRawDataOffset + (fieldPack * columns); } return new FieldInfo.NonLinearMatrix( @@ -160,4 +160,4 @@ partial class ID2D1ShaderGenerator } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.Syntax.cs index 952fb95a..b2413cfe 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.Syntax.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using ComputeSharp.D2D1.__Internals; using ComputeSharp.D2D1.SourceGenerators.Models; using ComputeSharp.SourceGeneration.Helpers; @@ -146,4 +146,4 @@ partial class ID2D1ShaderGenerator return statements.ToImmutable(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.cs index 7813b71e..55821ef0 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Immutable; using ComputeSharp.D2D1.SourceGenerators.Models; using ComputeSharp.SourceGeneration.Extensions; @@ -49,6 +49,7 @@ partial class ID2D1ShaderGenerator inputDescriptionsBuilder.Add(new InputDescription((uint)index, filter, levelOfDetailCount)); } + break; default: break; @@ -96,4 +97,4 @@ partial class ID2D1ShaderGenerator inputDescriptions = inputDescriptionsBuilder.ToImmutable(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.Syntax.cs index 6ebafc2c..805f7726 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.Syntax.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using ComputeSharp.D2D1.__Internals; using ComputeSharp.D2D1.SourceGenerators.Models; using ComputeSharp.SourceGeneration.Helpers; @@ -137,4 +137,4 @@ partial class ID2D1ShaderGenerator return statements.ToImmutable(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.cs index f1bf3151..4c6944b0 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Immutable; using ComputeSharp.D2D1.SourceGenerators.Models; using ComputeSharp.SourceGeneration.Extensions; @@ -33,7 +33,7 @@ partial class ID2D1ShaderGenerator { using ImmutableArrayBuilder<(int? Index, int Rank)> resourceTextureInfos = ImmutableArrayBuilder<(int? Index, int Rank)>.Rent(); - foreach (var fieldSymbol in structDeclarationSymbol.GetMembers().OfType()) + foreach (IFieldSymbol fieldSymbol in structDeclarationSymbol.GetMembers().OfType()) { // Only look for fields of a named type symbol (diagnostics is emitted by the HLSL rewriter if it's not the case). // We're only looking for instance fields of unmanaged types in this case (as resource textures are structs). @@ -133,4 +133,4 @@ partial class ID2D1ShaderGenerator } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.Helpers.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.Helpers.cs index 6d1c78fc..e0a8ca76 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.Helpers.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.Helpers.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using ComputeSharp.SourceGeneration.Models; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -73,4 +73,4 @@ partial class ID2D1ShaderGenerator return hierarchyInfo.GetSyntax(methodDeclaration.AddAttributeLists(attributes.ToArray())); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs index 6dbd90ca..01ee8226 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -301,7 +301,7 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator }); // Get the LoadInputDescriptions() info (hierarchy and input descriptions) - IncrementalValuesProvider<((HierarchyInfo Hierarchy, InputDescriptionsInfo InputDescriptions) Info, bool CanUseSkipLocalsInit) > inputDescriptionsInfo = + IncrementalValuesProvider<((HierarchyInfo Hierarchy, InputDescriptionsInfo InputDescriptions) Info, bool CanUseSkipLocalsInit)> inputDescriptionsInfo = shaderInfoWithErrors .Select(static (item, _) => (item.Hierarchy, item.InputDescriptions)) .Combine(canUseSkipLocalsInit); @@ -329,4 +329,4 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator context.AddSource($"{item.Hierarchy.FilenameHint}.{nameof(GetPixelOptions)}.g.cs", compilationUnit.GetText(Encoding.UTF8)); }); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownKeywords.cs b/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownKeywords.cs index 78098a82..00885bbe 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownKeywords.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownKeywords.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Reflection; using ComputeSharp.Core.Intrinsics.Attributes; using ComputeSharp.D2D1; @@ -12,11 +12,11 @@ partial class HlslKnownKeywords static partial void AddKnownKeywords(ICollection knownKeywords) { // D2D1 intrinsics method names - foreach (var method in typeof(D2D).GetMethods(BindingFlags.Public | BindingFlags.Static)) + foreach (MethodInfo? method in typeof(D2D).GetMethods(BindingFlags.Public | BindingFlags.Static)) { string name = method.GetCustomAttribute()?.Name ?? method.Name; knownKeywords.Add(name); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownMethods.cs b/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownMethods.cs index c99d7315..24ae776a 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownMethods.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownMethods.cs @@ -26,7 +26,7 @@ partial class HlslKnownMethods static partial void AddKnownMethods(IDictionary knownMethods) { // Programmatically load mappings from the D2D1 class as well - foreach (var method in + foreach (MethodInfo? method in from method in typeof(D2D).GetMethods(BindingFlags.Public | BindingFlags.Static) group method by method.Name into groups @@ -50,4 +50,4 @@ partial class HlslKnownMethods [$"ComputeSharp.D2D1.D2D1ResourceTexture3D`1.Sample({typeof(Float3).FullName})"] = null }; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownProperties.cs b/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownProperties.cs index 578bf8a5..af7c3fb6 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownProperties.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownProperties.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace ComputeSharp.SourceGeneration.Mappings; @@ -28,4 +28,4 @@ partial class HlslKnownProperties ["ComputeSharp.D2D1.D2D1ResourceTexture3D`1.Depth"] = (3, 2) }; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownTypes.cs b/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownTypes.cs index 5569583a..1ebec150 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownTypes.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Mappings/HlslKnownTypes.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.SourceGeneration.Extensions; using Microsoft.CodeAnalysis; @@ -54,4 +54,4 @@ partial class HlslKnownTypes // The captured field is of a custom struct type return typeName.ToHlslIdentifierName(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/D2D1PixelShaderSourceInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/D2D1PixelShaderSourceInfo.cs index 2a3e64dc..20a81557 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/D2D1PixelShaderSourceInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/D2D1PixelShaderSourceInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -19,10 +19,16 @@ internal sealed record D2D1PixelShaderSourceInfo( ImmutableArray Diagnostcs) { /// - public bool Equals(D2D1PixelShaderSourceInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(D2D1PixelShaderSourceInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -46,4 +52,4 @@ internal sealed record D2D1PixelShaderSourceInfo( x.Diagnostcs.SequenceEqual(y.Diagnostcs); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/D2D1ShaderInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/D2D1ShaderInfo.cs index 643889ba..f79ebb90 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/D2D1ShaderInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/D2D1ShaderInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -31,10 +31,16 @@ internal sealed record D2D1ShaderInfo( ImmutableArray Diagnostcs) { /// - public bool Equals(D2D1ShaderInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(D2D1ShaderInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -70,4 +76,4 @@ internal sealed record D2D1ShaderInfo( x.Diagnostcs.SequenceEqual(y.Diagnostcs); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/DispatchDataInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/DispatchDataInfo.cs index e99830bb..c8aa95ed 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/DispatchDataInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/DispatchDataInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -14,10 +14,16 @@ namespace ComputeSharp.D2D1.SourceGenerators.Models; internal sealed record DispatchDataInfo(ImmutableArray FieldInfos, int ConstantBufferSizeInBytes) { /// - public bool Equals(DispatchDataInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(DispatchDataInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -39,4 +45,4 @@ internal sealed record DispatchDataInfo(ImmutableArray FieldInfos, in x.ConstantBufferSizeInBytes == y.ConstantBufferSizeInBytes; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/EmbeddedBytecodeInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/EmbeddedBytecodeInfo.cs index 2a901c51..1d65fbc8 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/EmbeddedBytecodeInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/EmbeddedBytecodeInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -16,10 +16,16 @@ namespace ComputeSharp.D2D1.SourceGenerators.Models; internal sealed record EmbeddedBytecodeInfo(string HlslSource, D2D1ShaderProfile? ShaderProfile, D2D1CompileOptions? CompileOptions, ImmutableArray Bytecode) { /// - public bool Equals(EmbeddedBytecodeInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(EmbeddedBytecodeInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -45,4 +51,4 @@ internal sealed record EmbeddedBytecodeInfo(string HlslSource, D2D1ShaderProfile x.Bytecode.SequenceEqual(y.Bytecode); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/EmbeddedBytecodeMethodInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/EmbeddedBytecodeMethodInfo.cs index 9e8c1298..e2f43b8b 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/EmbeddedBytecodeMethodInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/EmbeddedBytecodeMethodInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Runtime.InteropServices; @@ -24,10 +24,16 @@ internal sealed record EmbeddedBytecodeMethodInfo( ImmutableArray Bytecode) { /// - public bool Equals(EmbeddedBytecodeMethodInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(EmbeddedBytecodeMethodInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -55,4 +61,4 @@ internal sealed record EmbeddedBytecodeMethodInfo( x.Bytecode.SequenceEqual(y.Bytecode); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/FieldInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/FieldInfo.cs index fc65ddbb..89ff1281 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/FieldInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/FieldInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -20,10 +20,16 @@ internal abstract record FieldInfo public sealed record Primitive(ImmutableArray FieldPath, string TypeName, int Offset) : FieldInfo { /// - public bool Equals(Primitive? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(Primitive? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -67,10 +73,16 @@ internal abstract record FieldInfo ImmutableArray Offsets) : FieldInfo { /// - public bool Equals(NonLinearMatrix? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(NonLinearMatrix? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -101,4 +113,4 @@ internal abstract record FieldInfo } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/HlslShaderMethodSourceInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/HlslShaderMethodSourceInfo.cs index 6e252b26..277c0cea 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/HlslShaderMethodSourceInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/HlslShaderMethodSourceInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Immutable; using System.Runtime.InteropServices; using ComputeSharp.SourceGeneration.Extensions; @@ -27,10 +27,16 @@ internal sealed record HlslShaderMethodSourceInfo( bool HasErrors) { /// - public bool Equals(HlslShaderMethodSourceInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(HlslShaderMethodSourceInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -62,4 +68,4 @@ internal sealed record HlslShaderMethodSourceInfo( x.HasErrors == y.HasErrors; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/HlslShaderSourceInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/HlslShaderSourceInfo.cs index efb0eb1a..d6dea5d5 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/HlslShaderSourceInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/HlslShaderSourceInfo.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.SourceGenerators.Models; +namespace ComputeSharp.D2D1.SourceGenerators.Models; /// /// A model for extracted info on a processed HLSL shader. @@ -13,4 +13,4 @@ internal sealed record HlslShaderSourceInfo( D2D1ShaderProfile? ShaderProfile, D2D1CompileOptions? CompileOptions, bool IsLinkingSupported, - bool HasErrors); + bool HasErrors); \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/InputDescription.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/InputDescription.cs index c92757ab..8beeb22b 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/InputDescription.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/InputDescription.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.SourceGenerators.Models; +namespace ComputeSharp.D2D1.SourceGenerators.Models; /// /// A model representing an input description for a shader. @@ -6,4 +6,4 @@ /// The index of the input resource the description is for. /// The input filter to use. /// The level of detail to use. -internal sealed record InputDescription(uint Index, D2D1Filter Filter, int LevelOfDetail); +internal sealed record InputDescription(uint Index, D2D1Filter Filter, int LevelOfDetail); \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/InputDescriptionsInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/InputDescriptionsInfo.cs index 644ab2cb..e0500622 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/InputDescriptionsInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/InputDescriptionsInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; using ComputeSharp.SourceGeneration.Helpers; @@ -12,10 +12,16 @@ namespace ComputeSharp.D2D1.SourceGenerators.Models; internal sealed record InputDescriptionsInfo(ImmutableArray InputDescriptions) { /// - public bool Equals(InputDescriptionsInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(InputDescriptionsInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/InputTypesInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/InputTypesInfo.cs index e8169190..f393e71e 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/InputTypesInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/InputTypesInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -13,10 +13,16 @@ namespace ComputeSharp.D2D1.SourceGenerators.Models; internal sealed record InputTypesInfo(ImmutableArray InputTypes) { /// - public bool Equals(InputTypesInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(InputTypesInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -35,4 +41,4 @@ internal sealed record InputTypesInfo(ImmutableArray InputTypes) return x.InputTypes.SequenceEqual(y.InputTypes); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/OutputBufferInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/OutputBufferInfo.cs index fc821cae..98f3b85e 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/OutputBufferInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/OutputBufferInfo.cs @@ -1,8 +1,8 @@ -namespace ComputeSharp.D2D1.SourceGenerators.Models; +namespace ComputeSharp.D2D1.SourceGenerators.Models; /// /// A model representing the output buffer info for a shader. /// /// The buffer precision for the resulting output buffer. /// The channel depth for the resulting output buffer. -internal sealed record OutputBufferInfo(D2D1BufferPrecision BufferPrecision, D2D1ChannelDepth ChannelDepth); +internal sealed record OutputBufferInfo(D2D1BufferPrecision BufferPrecision, D2D1ChannelDepth ChannelDepth); \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/ResourceTextureDescription.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/ResourceTextureDescription.cs index 63f0d842..65eee9b3 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/ResourceTextureDescription.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/ResourceTextureDescription.cs @@ -1,8 +1,8 @@ -namespace ComputeSharp.D2D1.SourceGenerators.Models; +namespace ComputeSharp.D2D1.SourceGenerators.Models; /// /// A model representing a resource texture description for a shader. /// /// The index of the resource texture resource the description is for. /// The rank of the resource texture. -internal sealed record ResourceTextureDescription(uint Index, uint Rank); +internal sealed record ResourceTextureDescription(uint Index, uint Rank); \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/ResourceTextureDescriptionsInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/ResourceTextureDescriptionsInfo.cs index b0d9a817..40349dd3 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/ResourceTextureDescriptionsInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/ResourceTextureDescriptionsInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; using ComputeSharp.SourceGeneration.Helpers; @@ -12,10 +12,16 @@ namespace ComputeSharp.D2D1.SourceGenerators.Models; internal sealed record ResourceTextureDescriptionsInfo(ImmutableArray ResourceTextureDescriptions) { /// - public bool Equals(ResourceTextureDescriptionsInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(ResourceTextureDescriptionsInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . diff --git a/src/ComputeSharp.D2D1.SourceGenerators/SyntaxRewriters/ShaderSourceRewriter.cs b/src/ComputeSharp.D2D1.SourceGenerators/SyntaxRewriters/ShaderSourceRewriter.cs index f472a4c2..4ddd4301 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/SyntaxRewriters/ShaderSourceRewriter.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/SyntaxRewriters/ShaderSourceRewriter.cs @@ -1,4 +1,4 @@ -using ComputeSharp.SourceGeneration.Mappings; +using ComputeSharp.SourceGeneration.Mappings; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Operations; @@ -43,4 +43,4 @@ partial class ShaderSourceRewriter NeedsD2DRequiresScenePositionAttribute = true; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/SyntaxRewriters/StaticFieldRewriter.cs b/src/ComputeSharp.D2D1.SourceGenerators/SyntaxRewriters/StaticFieldRewriter.cs index 1a5c5410..242d527b 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/SyntaxRewriters/StaticFieldRewriter.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/SyntaxRewriters/StaticFieldRewriter.cs @@ -1,4 +1,4 @@ -using ComputeSharp.SourceGeneration.Mappings; +using ComputeSharp.SourceGeneration.Mappings; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Operations; @@ -25,4 +25,4 @@ partial class StaticFieldRewriter NeedsD2DRequiresScenePositionAttribute = true; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/D2DCompileOptionsAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DCompileOptionsAttribute.cs index ba474e40..a2ef6fee 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DCompileOptionsAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DCompileOptionsAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.D2D1; @@ -42,4 +42,4 @@ public sealed class D2DCompileOptionsAttribute : Attribute /// Gets the number of threads in each thread group for the X axis /// public D2D1CompileOptions Options { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/D2DInputComplexAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DInputComplexAttribute.cs index c3d5717c..36f26fcc 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DInputComplexAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DInputComplexAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.D2D1; @@ -26,4 +26,4 @@ public sealed class D2DInputComplexAttribute : Attribute /// Gets the index of the resource declared as using complex sampling. /// public int Index { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/D2DInputCountAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DInputCountAttribute.cs index 92e1f84f..125e759f 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DInputCountAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DInputCountAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.D2D1; @@ -26,4 +26,4 @@ public sealed class D2DInputCountAttribute : Attribute /// Gets the number of texture inputs for the shader. /// public int Count { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/D2DInputDescriptionAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DInputDescriptionAttribute.cs index 75c2fe3a..fdcd8d41 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DInputDescriptionAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DInputDescriptionAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.D2D1; @@ -38,4 +38,4 @@ public sealed class D2DInputDescriptionAttribute : Attribute /// Gets the mip level to retrieve from the upstream transform, if specified. /// public int LevelOfDetailCount { get; init; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/D2DInputSimpleAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DInputSimpleAttribute.cs index 4845e32b..77750358 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DInputSimpleAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DInputSimpleAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.D2D1; @@ -26,4 +26,4 @@ public sealed class D2DInputSimpleAttribute : Attribute /// Gets the index of the resource declared as using simple sampling. /// public int Index { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/D2DOutputBufferAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DOutputBufferAttribute.cs index 615d8a4d..5a206a5f 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DOutputBufferAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DOutputBufferAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.D2D1; @@ -50,4 +50,4 @@ public sealed class D2DOutputBufferAttribute : Attribute /// Gets the channel depth for the resulting output buffer. /// public D2D1ChannelDepth ChannelDepth { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/D2DPixelOptionsAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DPixelOptionsAttribute.cs index 11bc6de2..459eced3 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DPixelOptionsAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DPixelOptionsAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.D2D1; @@ -25,4 +25,4 @@ public sealed class D2DPixelOptionsAttribute : Attribute /// Gets the options to specify for the shader. /// public D2D1PixelOptions Options { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/D2DPixelShaderSourceAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DPixelShaderSourceAttribute.cs index 00e23ace..1eb515e9 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DPixelShaderSourceAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DPixelShaderSourceAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.CodeAnalysis; namespace ComputeSharp.D2D1; @@ -48,4 +48,4 @@ public sealed class D2DPixelShaderSourceAttribute : Attribute /// Gets the number of texture inputs for the shader. /// public string HlslSource { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/D2DRequiresScenePositionAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DRequiresScenePositionAttribute.cs index f351bb93..8355261d 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DRequiresScenePositionAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DRequiresScenePositionAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.D2D1; @@ -14,4 +14,4 @@ namespace ComputeSharp.D2D1; [AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)] public sealed class D2DRequiresScenePositionAttribute : Attribute { -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/D2DResourceTextureIndexAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DResourceTextureIndexAttribute.cs index 1bf4938e..60b6e2a5 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DResourceTextureIndexAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DResourceTextureIndexAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.D2D1; @@ -25,4 +25,4 @@ public sealed class D2DResourceTextureIndexAttribute : Attribute /// Gets the index of the annotated resource field. /// public int Index { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/D2DShaderProfileAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DShaderProfileAttribute.cs index 15ca30f8..5ae6332f 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DShaderProfileAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DShaderProfileAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.D2D1; @@ -40,4 +40,4 @@ public sealed class D2DShaderProfileAttribute : Attribute /// The shader profile used to compile the annotated D2D1 pixel shader. /// public D2D1ShaderProfile ShaderProfile { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1BufferPrecision.cs b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1BufferPrecision.cs index 55c0bfd4..14f5326e 100644 --- a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1BufferPrecision.cs +++ b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1BufferPrecision.cs @@ -1,4 +1,4 @@ -using static TerraFX.Interop.DirectX.D2D1_BUFFER_PRECISION; +using static TerraFX.Interop.DirectX.D2D1_BUFFER_PRECISION; namespace ComputeSharp.D2D1; @@ -40,4 +40,4 @@ public enum D2D1BufferPrecision /// The buffer precision uses 32-bit float values per channel. /// Float32 = (int)D2D1_BUFFER_PRECISION_32BPC_FLOAT -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1ChannelDepth.cs b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1ChannelDepth.cs index a83794ec..1d9eff34 100644 --- a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1ChannelDepth.cs +++ b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1ChannelDepth.cs @@ -1,4 +1,4 @@ -using static TerraFX.Interop.DirectX.D2D1_CHANNEL_DEPTH; +using static TerraFX.Interop.DirectX.D2D1_CHANNEL_DEPTH; namespace ComputeSharp.D2D1; @@ -25,4 +25,4 @@ public enum D2D1ChannelDepth /// The channel depth is 4. /// Four = (int)D2D1_CHANNEL_DEPTH_4 -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1CompileOptions.cs b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1CompileOptions.cs index 5727953a..525de704 100644 --- a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1CompileOptions.cs +++ b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1CompileOptions.cs @@ -1,4 +1,4 @@ -using System; +using System; #if !SOURCE_GENERATOR using ComputeSharp.D2D1.Interop; #endif @@ -172,4 +172,4 @@ public enum D2D1CompileOptions /// from instance, should be manually used when needed. /// Default = OptimizationLevel3 | WarningsAreErrors | PackMatrixRowMajor -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1Filter.cs b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1Filter.cs index 986e7e55..7b1d38cc 100644 --- a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1Filter.cs +++ b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1Filter.cs @@ -1,4 +1,4 @@ -using static TerraFX.Interop.DirectX.D2D1_FILTER; +using static TerraFX.Interop.DirectX.D2D1_FILTER; namespace ComputeSharp.D2D1; @@ -62,4 +62,4 @@ public enum D2D1Filter /// Use anisotropic interpolation for minification, magnification, and mip-level sampling. /// Anisotropic = (int)D2D1_FILTER_ANISOTROPIC -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1PixelOptions.cs b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1PixelOptions.cs index d6c0fbd9..f0aefc17 100644 --- a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1PixelOptions.cs +++ b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1PixelOptions.cs @@ -1,4 +1,4 @@ -using System; +using System; using static TerraFX.Interop.DirectX.D2D1_PIXEL_OPTIONS; namespace ComputeSharp.D2D1; @@ -22,4 +22,4 @@ public enum D2D1PixelOptions /// and returns transparent black whenever the input pixels are also transparent black. /// TrivialSampling = (int)D2D1_PIXEL_OPTIONS_TRIVIAL_SAMPLING -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1ShaderProfile.cs b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1ShaderProfile.cs index e68a8aad..7fcc0290 100644 --- a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1ShaderProfile.cs +++ b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1ShaderProfile.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1; +namespace ComputeSharp.D2D1; /// /// A to be used with to indicate the shader profile to use to precompile a shader. @@ -66,4 +66,4 @@ public enum D2D1ShaderProfile /// For more info, see . /// PixelShader50 -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Extensions/ComPtrExtensions.cs b/src/ComputeSharp.D2D1/Extensions/ComPtrExtensions.cs index ef82e319..43613112 100644 --- a/src/ComputeSharp.D2D1/Extensions/ComPtrExtensions.cs +++ b/src/ComputeSharp.D2D1/Extensions/ComPtrExtensions.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using TerraFX.Interop.Windows; namespace ComputeSharp.D2D1.Extensions; @@ -39,4 +39,4 @@ internal static class ComPtrExtensions return copy; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Extensions/HRESULTExtensions.cs b/src/ComputeSharp.D2D1/Extensions/HRESULTExtensions.cs index 6ed9aa4e..656d8d96 100644 --- a/src/ComputeSharp.D2D1/Extensions/HRESULTExtensions.cs +++ b/src/ComputeSharp.D2D1/Extensions/HRESULTExtensions.cs @@ -1,4 +1,4 @@ -using System.ComponentModel; +using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; @@ -50,4 +50,4 @@ internal static class HRESULTExtensions { throw new Win32Exception(result); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Extensions/RECTExtensions.cs b/src/ComputeSharp.D2D1/Extensions/RECTExtensions.cs index b2118fc9..ce9bdacc 100644 --- a/src/ComputeSharp.D2D1/Extensions/RECTExtensions.cs +++ b/src/ComputeSharp.D2D1/Extensions/RECTExtensions.cs @@ -1,4 +1,4 @@ -using System.Drawing; +using System.Drawing; using System.Runtime.CompilerServices; using TerraFX.Interop.Windows; #if NET6_0_OR_GREATER @@ -98,4 +98,4 @@ internal static class RECTExtensions bottom = bottom }; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Extensions/RectangleExtensions.cs b/src/ComputeSharp.D2D1/Extensions/RectangleExtensions.cs index 8826f625..22151150 100644 --- a/src/ComputeSharp.D2D1/Extensions/RectangleExtensions.cs +++ b/src/ComputeSharp.D2D1/Extensions/RectangleExtensions.cs @@ -1,4 +1,4 @@ -using System.Drawing; +using System.Drawing; using System.Runtime.CompilerServices; namespace ComputeSharp.D2D1; @@ -36,4 +36,4 @@ public static class RectangleExtensions int.MaxValue, int.MaxValue); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Helpers/ThrowHelper.cs b/src/ComputeSharp.D2D1/Helpers/ThrowHelper.cs index 288452c9..f80e64f4 100644 --- a/src/ComputeSharp.D2D1/Helpers/ThrowHelper.cs +++ b/src/ComputeSharp.D2D1/Helpers/ThrowHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.CodeAnalysis; namespace ComputeSharp.D2D1.Helpers; diff --git a/src/ComputeSharp.D2D1/Interfaces/ID2D1PixelShader.cs b/src/ComputeSharp.D2D1/Interfaces/ID2D1PixelShader.cs index c748211a..c327733f 100644 --- a/src/ComputeSharp.D2D1/Interfaces/ID2D1PixelShader.cs +++ b/src/ComputeSharp.D2D1/Interfaces/ID2D1PixelShader.cs @@ -1,4 +1,4 @@ -using ComputeSharp.D2D1.__Internals; +using ComputeSharp.D2D1.__Internals; #pragma warning disable CS0618 diff --git a/src/ComputeSharp.D2D1/Interfaces/ID2D1TransformMapperFactory{T}.cs b/src/ComputeSharp.D2D1/Interfaces/ID2D1TransformMapperFactory{T}.cs index 16b10fbf..a5b122ea 100644 --- a/src/ComputeSharp.D2D1/Interfaces/ID2D1TransformMapperFactory{T}.cs +++ b/src/ComputeSharp.D2D1/Interfaces/ID2D1TransformMapperFactory{T}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1; +namespace ComputeSharp.D2D1; /// /// An acting as a factory for instances. @@ -12,4 +12,4 @@ public interface ID2D1TransformMapperFactory /// /// A new instance for the input shader. ID2D1TransformMapper Create(); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Interfaces/ID2D1TransformMapper{T}.cs b/src/ComputeSharp.D2D1/Interfaces/ID2D1TransformMapper{T}.cs index 82c3035e..7d4ae285 100644 --- a/src/ComputeSharp.D2D1/Interfaces/ID2D1TransformMapper{T}.cs +++ b/src/ComputeSharp.D2D1/Interfaces/ID2D1TransformMapper{T}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Drawing; namespace ComputeSharp.D2D1; @@ -75,4 +75,4 @@ public interface ID2D1TransformMapper /// /// void MapInvalidOutput(int inputIndex, Rectangle invalidInput, out Rectangle invalidOutput); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1BytecodeLoader.cs b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1BytecodeLoader.cs index 1a20a785..3d4ccfa6 100644 --- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1BytecodeLoader.cs +++ b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1BytecodeLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; namespace ComputeSharp.D2D1.__Internals; @@ -23,4 +23,4 @@ public interface ID2D1BytecodeLoader /// The shader bytecode. /// Thrown if the shader has already been initialized. void LoadEmbeddedBytecode(ReadOnlySpan bytecode); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1DispatchDataLoader.cs b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1DispatchDataLoader.cs index 96e35357..d380bf7d 100644 --- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1DispatchDataLoader.cs +++ b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1DispatchDataLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; namespace ComputeSharp.D2D1.__Internals; @@ -15,4 +15,4 @@ public interface ID2D1DispatchDataLoader /// /// The sequence of serialized captured values. void LoadConstantBuffer(ReadOnlySpan data); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1InputDescriptionsLoader.cs b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1InputDescriptionsLoader.cs index b5ebd493..d1795a3f 100644 --- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1InputDescriptionsLoader.cs +++ b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1InputDescriptionsLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; namespace ComputeSharp.D2D1.__Internals; @@ -15,4 +15,4 @@ public interface ID2D1InputDescriptionsLoader /// /// The sequence of serialized input descriptions. void LoadInputDescriptions(ReadOnlySpan data); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1ResourceTextureDescriptionsLoader.cs b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1ResourceTextureDescriptionsLoader.cs index 76b0014e..c0dc2ec5 100644 --- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1ResourceTextureDescriptionsLoader.cs +++ b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1ResourceTextureDescriptionsLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; namespace ComputeSharp.D2D1.__Internals; @@ -15,4 +15,4 @@ public interface ID2D1ResourceTextureDescriptionsLoader /// /// The sequence of serialized resource texture descriptions. void LoadResourceTextureDescriptions(ReadOnlySpan data); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs index 554b138c..e4e84512 100644 --- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs +++ b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; namespace ComputeSharp.D2D1.__Internals; @@ -104,4 +104,4 @@ public interface ID2D1Shader [Obsolete("This method is not intended to be used directly by user code")] void LoadBytecode(ref TLoader loader, D2D1ShaderProfile? shaderProfile, D2D1CompileOptions? options) where TLoader : struct, ID2D1BytecodeLoader; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Intrinsics/D2D.cs b/src/ComputeSharp.D2D1/Intrinsics/D2D.cs index 328e7dbd..7ed4e452 100644 --- a/src/ComputeSharp.D2D1/Intrinsics/D2D.cs +++ b/src/ComputeSharp.D2D1/Intrinsics/D2D.cs @@ -1,6 +1,8 @@ -using ComputeSharp.Core.Intrinsics.Attributes; +using ComputeSharp.Core.Intrinsics.Attributes; using ComputeSharp.Exceptions; +#pragma warning disable IDE0022 + namespace ComputeSharp.D2D1; /// @@ -26,7 +28,7 @@ public static class D2D /// This method is only available for complex inputs. [HlslIntrinsicName("D2DGetInputCoordinate")] public static Float4 GetInputCoordinate(int index) => throw new InvalidExecutionContextException($"{typeof(D2D)}.{nameof(GetInputCoordinate)}({typeof(int)})"); - + /// /// Returns the value of the current scene position. /// @@ -64,4 +66,4 @@ public static class D2D /// This method is only available for complex inputs. [HlslIntrinsicName("D2DSampleInputAtPosition")] public static Float4 SampleInputAtPosition(int index, Float2 uv) => throw new InvalidExecutionContextException($"{typeof(D2D)}.{nameof(SampleInputAtPosition)}({typeof(int)}, {typeof(Float2)})"); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Properties/Polyfills/CompilerFeatureRequiredAttribute.cs b/src/ComputeSharp.D2D1/Properties/Polyfills/CompilerFeatureRequiredAttribute.cs index ab911b2a..3da8c78b 100644 --- a/src/ComputeSharp.D2D1/Properties/Polyfills/CompilerFeatureRequiredAttribute.cs +++ b/src/ComputeSharp.D2D1/Properties/Polyfills/CompilerFeatureRequiredAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Runtime.CompilerServices; diff --git a/src/ComputeSharp.D2D1/Properties/Polyfills/RequiredMemberAttribute.cs b/src/ComputeSharp.D2D1/Properties/Polyfills/RequiredMemberAttribute.cs index a9bc75c6..8b14f9a2 100644 --- a/src/ComputeSharp.D2D1/Properties/Polyfills/RequiredMemberAttribute.cs +++ b/src/ComputeSharp.D2D1/Properties/Polyfills/RequiredMemberAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Runtime.CompilerServices; diff --git a/src/ComputeSharp.D2D1/Properties/Polyfills/StringSyntaxAttribute.cs b/src/ComputeSharp.D2D1/Properties/Polyfills/StringSyntaxAttribute.cs index 02abeb35..bb9a2248 100644 --- a/src/ComputeSharp.D2D1/Properties/Polyfills/StringSyntaxAttribute.cs +++ b/src/ComputeSharp.D2D1/Properties/Polyfills/StringSyntaxAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Diagnostics.CodeAnalysis; diff --git a/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture1D{T}.cs b/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture1D{T}.cs index 725c4b6c..777bf3ec 100644 --- a/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture1D{T}.cs +++ b/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture1D{T}.cs @@ -1,4 +1,6 @@ -using ComputeSharp.Exceptions; +using ComputeSharp.Exceptions; + +#pragma warning disable IDE0022 namespace ComputeSharp.D2D1; @@ -30,4 +32,4 @@ public readonly struct D2D1ResourceTexture1D /// The horizontal normalized offset of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. public ref readonly T Sample(float u) => throw new InvalidExecutionContextException($"{typeof(D2D1ResourceTexture1D)}.{nameof(Sample)}({typeof(float)})"); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture2D{T}.cs b/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture2D{T}.cs index 902579f3..e17e35a6 100644 --- a/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture2D{T}.cs +++ b/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture2D{T}.cs @@ -1,4 +1,6 @@ -using ComputeSharp.Exceptions; +using ComputeSharp.Exceptions; + +#pragma warning disable IDE0022 namespace ComputeSharp.D2D1; @@ -52,4 +54,4 @@ public readonly struct D2D1ResourceTexture2D /// The normalized coordinates of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. public ref readonly T Sample(Float2 uv) => throw new InvalidExecutionContextException($"{typeof(D2D1ResourceTexture2D)}.{nameof(Sample)}({typeof(Float2)})"); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture3D{T}.cs b/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture3D{T}.cs index dfe6936a..cfcdb768 100644 --- a/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture3D{T}.cs +++ b/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture3D{T}.cs @@ -1,4 +1,6 @@ -using ComputeSharp.Exceptions; +using ComputeSharp.Exceptions; + +#pragma warning disable IDE0022 namespace ComputeSharp.D2D1; @@ -60,4 +62,4 @@ public readonly struct D2D1ResourceTexture3D /// The normalized coordinates of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. public ref readonly T Sample(Float3 uvw) => throw new InvalidExecutionContextException($"{typeof(D2D1ResourceTexture3D)}.{nameof(Sample)}({typeof(Float3)})"); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Exceptions/FxcCompilationException.cs b/src/ComputeSharp.D2D1/Shaders/Exceptions/FxcCompilationException.cs index cdb5e2a3..c7b2b7f3 100644 --- a/src/ComputeSharp.D2D1/Shaders/Exceptions/FxcCompilationException.cs +++ b/src/ComputeSharp.D2D1/Shaders/Exceptions/FxcCompilationException.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; namespace ComputeSharp.D2D1.Exceptions; @@ -26,13 +26,13 @@ public sealed class FxcCompilationException : Exception { StringBuilder builder = new(512); - builder.AppendLine("The FXC compiler encountered one or more errors while trying to compile the shader:"); - builder.AppendLine(); - builder.AppendLine(error.Trim()); - builder.AppendLine(); - builder.AppendLine("Make sure to only be using supported features by checking the README file in the ComputeSharp repository: https://github.com/Sergio0694/ComputeSharp."); - builder.Append("If you're sure that your C# shader code is valid, please open an issue an include a working repro and this error message."); + _ = builder.AppendLine("The FXC compiler encountered one or more errors while trying to compile the shader:"); + _ = builder.AppendLine(); + _ = builder.AppendLine(error.Trim()); + _ = builder.AppendLine(); + _ = builder.AppendLine("Make sure to only be using supported features by checking the README file in the ComputeSharp repository: https://github.com/Sergio0694/ComputeSharp."); + _ = builder.Append("If you're sure that your C# shader code is valid, please open an issue an include a working repro and this error message."); return builder.ToString(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Buffers/ArrayPoolBinaryWriterExtensions.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Buffers/ArrayPoolBinaryWriterExtensions.cs index 51073911..71ba9ed1 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Buffers/ArrayPoolBinaryWriterExtensions.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Buffers/ArrayPoolBinaryWriterExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; #if NET6_0_OR_GREATER using System.Buffers.Text; #endif diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Buffers/ArrayPoolBinaryWriter{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Buffers/ArrayPoolBinaryWriter{T}.cs index 162894c2..3d56598d 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Buffers/ArrayPoolBinaryWriter{T}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Buffers/ArrayPoolBinaryWriter{T}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.Diagnostics.CodeAnalysis; #if NET6_0_OR_GREATER @@ -35,7 +35,7 @@ internal ref struct ArrayPoolBufferWriter /// /// The starting offset within . /// - private int index; + private readonly int index; /// /// Initializes a new instance of the class. @@ -154,7 +154,7 @@ internal ref struct ArrayPoolBufferWriter // the nearest power of two, to ensure that repeated consecutive writes when the array in // use is bigger than that threshold don't end up causing a resize every single time. if (minimumSize > 1024 * 1024) - { + { minimumSize = BitOperations.RoundUpToPowerOf2(minimumSize); } diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Buffers/PinnedBufferMemoryManager.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Buffers/PinnedBufferMemoryManager.cs index 4fb3d71d..d4a4b09b 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Buffers/PinnedBufferMemoryManager.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Buffers/PinnedBufferMemoryManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -57,4 +57,4 @@ internal sealed unsafe class PinnedBufferMemoryManager : MemoryManager protected override void Dispose(bool disposing) { } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1EffectRegistrationData.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1EffectRegistrationData.cs index cba3bc9b..4bc80f68 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1EffectRegistrationData.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1EffectRegistrationData.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; using System.Text; using ComputeSharp.D2D1.Helpers; @@ -26,7 +26,7 @@ public static class D2D1EffectRegistrationData /// /// The containing type for deserialized version 1 registration blobs. /// - public unsafe readonly struct V1 + public readonly unsafe struct V1 { /// /// The blob id for V1 registration data. @@ -298,4 +298,4 @@ public static class D2D1EffectRegistrationData InvalidBindingPropertyName } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ExtendMode.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ExtendMode.cs index 0ecb3e2b..15d6b19e 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ExtendMode.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ExtendMode.cs @@ -1,4 +1,4 @@ -using static TerraFX.Interop.DirectX.D2D1_EXTEND_MODE; +using static TerraFX.Interop.DirectX.D2D1_EXTEND_MODE; namespace ComputeSharp.D2D1; @@ -25,4 +25,4 @@ public enum D2D1ExtendMode /// content are flipped (the brush's normal content is drawn untransformed). /// Mirror = (int)D2D1_EXTEND_MODE_MIRROR -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1InputDescription.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1InputDescription.cs index e7312118..fb23e794 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1InputDescription.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1InputDescription.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.Interop; +namespace ComputeSharp.D2D1.Interop; /// /// A type containing info on a description for a given D2D1 pixel shader input resource. @@ -57,4 +57,4 @@ public readonly struct D2D1InputDescription /// Gets the mip level to retrieve from the upstream transform, if specified. /// public int LevelOfDetailCount => this.levelOfDetailCount; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs index 99015f4e..134616a9 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.D2D1.Helpers; using ComputeSharp.D2D1.Shaders.Interop.Buffers; @@ -351,4 +351,4 @@ public static class D2D1PixelShader Unsafe.AsRef(in shader).LoadDispatchData(ref dataLoader); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs index d79fcfb4..8e2704c8 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.D2D1.Extensions; using ComputeSharp.D2D1.Helpers; @@ -350,7 +350,7 @@ public static unsafe class D2D1PixelShaderEffect // Effect id and number of inputs writer.WriteRaw(PixelShaderEffect.For.Id); writer.WriteRaw(PixelShaderEffect.For.InputCount); - + // Build the XML text writer.WriteRaw(""" @@ -631,4 +631,4 @@ public static unsafe class D2D1PixelShaderEffect data: (byte*)resourceTextureManager2.GetAddressOf(), dataSize: (uint)sizeof(void*)).Assert(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffectProperty.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffectProperty.cs index dbf89f8d..892ec2f4 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffectProperty.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffectProperty.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.Interop; +namespace ComputeSharp.D2D1.Interop; /// /// A container for indices of properties from the type. @@ -112,4 +112,4 @@ public static class D2D1PixelShaderEffectProperty /// /// For more info, see . public const uint ResourceTextureManager15 = 16; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderInputType.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderInputType.cs index 19ae7aec..d7fd74c0 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderInputType.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderInputType.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.Interop; +namespace ComputeSharp.D2D1.Interop; /// /// Indicates the type of a given input for a D2D1 pixel shader. @@ -28,4 +28,4 @@ public enum D2D1PixelShaderInputType /// For more info, see . /// Complex -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PropertyBinding.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PropertyBinding.cs index 0b78e89f..620320b3 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PropertyBinding.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PropertyBinding.cs @@ -1,9 +1,9 @@ -namespace ComputeSharp.D2D1.Interop; +namespace ComputeSharp.D2D1.Interop; /// /// A model representing a property binding for an effect. /// -public unsafe readonly struct D2D1PropertyBinding +public readonly unsafe struct D2D1PropertyBinding { /// /// Creates a new instance with the specified parameters. diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs index 5acc5ac7..1dfe3a03 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Extensions; @@ -53,7 +53,7 @@ public static class D2D1ReflectionServices { bytecodePtr = (byte*)dynamicBytecode.Get()->GetBufferPointer(); bytecodeSize = (int)dynamicBytecode.Get()->GetBufferSize(); - } + } using ComPtr d3D11ShaderReflection = default; @@ -94,4 +94,4 @@ public static class D2D1ReflectionServices InterfaceSlotCount: d3D11ShaderReflection.Get()->GetNumInterfaceSlots(), RequiresDoublePrecisionSupport: (d3D11ShaderReflection.Get()->GetRequiresFlags() & (D3D.D3D_SHADER_REQUIRES_DOUBLES | D3D.D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS)) != 0); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureDescription.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureDescription.cs index 42f244b5..0acf68e4 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureDescription.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureDescription.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.Interop; +namespace ComputeSharp.D2D1.Interop; /// /// A type containing info on a description for a given D2D1 pixel shader resource resource. @@ -36,4 +36,4 @@ public readonly struct D2D1ResourceTextureDescription /// Gets the rank of the resource texture the description belongs to. /// public int Dimensions => this.dimensions; -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureManager.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureManager.cs index 8c66d277..3c1234ce 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureManager.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers; @@ -342,7 +342,7 @@ public sealed unsafe class D2D1ResourceTextureManager : ICustomQueryInterface { if (this.d2D1ResourceManagerImpl is not null) { - this.d2D1ResourceManagerImpl->Release(); + _ = this.d2D1ResourceManagerImpl->Release(); } } @@ -536,4 +536,4 @@ public sealed unsafe class D2D1ResourceTextureManager : ICustomQueryInterface Marshal.ThrowExceptionForHR(hresult); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompiler.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompiler.cs index fdf1d322..bf1df774 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompiler.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderCompiler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.Text; using ComputeSharp.D2D1.Exceptions; @@ -110,4 +110,4 @@ public static class D2D1ShaderCompiler return new Span(blobLinkedPtr, (int)blobLinkedSize).ToArray(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderInfo.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderInfo.cs index 1fada0b5..b723db4b 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderInfo.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ShaderInfo.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.Interop; +namespace ComputeSharp.D2D1.Interop; /// /// A model representing reflection info for a given D2D1 shader. @@ -53,4 +53,4 @@ public sealed record D2D1ShaderInfo( uint MovcInstructionCount, uint MovInstructionCount, uint InterfaceSlotCount, - bool RequiresDoublePrecisionSupport); + bool RequiresDoublePrecisionSupport); \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapperFactory{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapperFactory{T}.cs index 1b914639..c53756ef 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapperFactory{T}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapperFactory{T}.cs @@ -1,4 +1,4 @@ -using System.Numerics; +using System.Numerics; using ComputeSharp.D2D1.Helpers; using ComputeSharp.D2D1.Shaders.Interop.Factories; @@ -95,5 +95,5 @@ public static class D2D1TransformMapperFactory /// The type of parameters that the transform mapper will use. /// The input D2D1 pixel shader being executed on the current effect (this can be used to retrieve shader properties). /// The resulting parameters to be used by the transform mapper. - public delegate TResult Accessor(in T shader); -} + public delegate TResult Accessor(in T shader); +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/D2D1TransformMapper.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/D2D1TransformMapper.cs index e23c9b8b..f13dc1ac 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/D2D1TransformMapper.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/D2D1TransformMapper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Drawing; using System.Runtime.CompilerServices; @@ -130,4 +130,4 @@ internal abstract class D2D1TransformMapper return new TMapper(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs index d8639943..6c574e1f 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Helpers; @@ -10,6 +10,8 @@ using RuntimeHelpers = System.Runtime.CompilerServices.RuntimeHelpers; using RuntimeHelpers = ComputeSharp.D2D1.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers; #endif +#pragma warning disable CA2002 + namespace ComputeSharp.D2D1.Interop.Effects; /// diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs index 4b9995ff..9075fbf6 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Drawing; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Extensions; @@ -16,7 +16,7 @@ partial struct PixelShaderEffect /// /// The implementation for . /// - private unsafe static class ID2D1DrawTransformMethods + private static unsafe class ID2D1DrawTransformMethods { #if !NET6_0_OR_GREATER /// diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs index 0509e163..a30467b7 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Extensions; using ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers; @@ -179,7 +179,7 @@ internal unsafe partial struct PixelShaderEffect foreach (ref readonly D2D1ResourceTextureDescription resourceTextureDescription in new ReadOnlySpan(@this->resourceTextureDescriptions, @this->resourceTextureDescriptionCount)) { using ComPtr resourceTextureManager = @this->resourceTextureManagerBuffer[resourceTextureDescription.Index]; - + // If the current resource texture manager is not set, we cannot render, as there's an unbound resource texture if (resourceTextureManager.Get() is null) { @@ -187,7 +187,7 @@ internal unsafe partial struct PixelShaderEffect break; } - + using ComPtr resourceTextureManagerInternal = default; // Get the ID2D1ResourceTextureManagerInternal object diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.cs index 64e3e8fa..44d86690 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers; @@ -43,14 +43,11 @@ unsafe partial struct PixelShaderEffect #endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] - get - { #if NET6_0_OR_GREATER - return &GetConstantBufferImpl; + get => &GetConstantBufferImpl; #else - return (void*)Marshal.GetFunctionPointerForDelegate(GetConstantBufferWrapper); + get => (void*)Marshal.GetFunctionPointerForDelegate(GetConstantBufferWrapper); #endif - } } /// @@ -63,14 +60,11 @@ unsafe partial struct PixelShaderEffect #endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] - get - { #if NET6_0_OR_GREATER - return &SetConstantBufferImpl; + get => &SetConstantBufferImpl; #else - return (void*)Marshal.GetFunctionPointerForDelegate(SetConstantBufferWrapper); + get => (void*)Marshal.GetFunctionPointerForDelegate(SetConstantBufferWrapper); #endif - } } /// @@ -178,7 +172,7 @@ unsafe partial struct PixelShaderEffect using ComPtr resourceTextureManager = this.resourceTextureManagerBuffer[resourceTextureIndex]; - resourceTextureManager.CopyTo((ID2D1ResourceTextureManager**)data); + _ = resourceTextureManager.CopyTo((ID2D1ResourceTextureManager**)data); if (actualSize is not null) { @@ -261,7 +255,7 @@ unsafe partial struct PixelShaderEffect // If there's already an existing manager at this index, release it if (currentResourceTextureManager is not null) { - ((IUnknown*)currentResourceTextureManager)->Release(); + _ = ((IUnknown*)currentResourceTextureManager)->Release(); } // Store the resource texture manager into the buffer diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ResourceTextureManagerBuffer.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ResourceTextureManagerBuffer.cs index cb5509a7..66715d60 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ResourceTextureManagerBuffer.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ResourceTextureManagerBuffer.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers; #pragma warning disable CS0649 diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs index b7f146d6..136112bc 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; @@ -43,17 +43,18 @@ internal unsafe partial struct PixelShaderEffect /// /// The shared vtable pointer for instance, for . /// - private static readonly void** VtblForID2D1EffectImpl; + private static readonly void** VtblForID2D1EffectImpl = InitVtblForID2D1EffectImplAndID2D1DrawTransform(); /// /// The shared vtable pointer for instance, for . /// - private static readonly void** VtblForID2D1DrawTransform; + private static readonly void** VtblForID2D1DrawTransform = &VtblForID2D1EffectImpl[6]; /// - /// Initializes the shared state for . + /// Initializes the combined vtable for and . /// - static PixelShaderEffect() + /// The combined vtable for and . + private static void** InitVtblForID2D1EffectImplAndID2D1DrawTransform() { void** lpVtbl = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(PixelShaderEffect), sizeof(void*) * 14); @@ -95,8 +96,7 @@ internal unsafe partial struct PixelShaderEffect lpVtbl[6 + 7] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawTransformMethods.SetDrawInfoWrapper); #endif - VtblForID2D1EffectImpl = lpVtbl; - VtblForID2D1DrawTransform = &lpVtbl[6]; + return lpVtbl; } /// @@ -363,7 +363,7 @@ internal unsafe partial struct PixelShaderEffect // Then, retrieve all of them and release the ones that had been assigned (from one of the property bindings). foreach (ref readonly D2D1ResourceTextureDescription resourceTextureDescription in new ReadOnlySpan(this.resourceTextureDescriptions, this.resourceTextureDescriptionCount)) { - ID2D1ResourceTextureManager* resourceTextureManager = resourceTextureManagerBuffer[resourceTextureDescription.Index]; + ID2D1ResourceTextureManager* resourceTextureManager = this.resourceTextureManagerBuffer[resourceTextureDescription.Index]; if (resourceTextureManager is not null) { diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManager.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManager.cs index 89fc5479..959f5ffe 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManager.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; @@ -375,8 +375,8 @@ unsafe partial struct D2D1ResourceTextureManagerImpl uint dataCount) { // Either both extents are available, or none is, and the other values must not be null - if (minimumExtents is null && maximimumExtents is not null || - minimumExtents is not null && maximimumExtents is null || + if ((minimumExtents is null && maximimumExtents is not null) || + (minimumExtents is not null && maximimumExtents is null) || (dimensions > 1 && strides is null) || data is null) { @@ -485,7 +485,7 @@ unsafe partial struct D2D1ResourceTextureManagerImpl (dimensions > 2 ? z * strides[1] : 0); byte* destinationDataPlane = @this->data + - (dimensions > 2 ? minimumExtents[2] * @this->strides[1] + z * @this->strides[1] : 0) + + (dimensions > 2 ? (minimumExtents[2] * @this->strides[1]) + (z * @this->strides[1]) : 0) + (dimensions > 1 ? minimumExtents[1] * @this->strides[0] : 0); for (int y = 0; y < updateExtents[1]; y++) @@ -582,7 +582,7 @@ unsafe partial struct D2D1ResourceTextureManagerImpl try { - extent01SizeInBytes = checked((extents[1] - 1) * strides[0] + extent0SizeInBytes); + extent01SizeInBytes = checked(((extents[1] - 1) * strides[0]) + extent0SizeInBytes); } catch (OverflowException) { @@ -609,7 +609,7 @@ unsafe partial struct D2D1ResourceTextureManagerImpl try { - extent012SizeInBytes = (extents[2] - 1) * strides[1] + extent01SizeInBytes; + extent012SizeInBytes = ((extents[2] - 1) * strides[1]) + extent01SizeInBytes; } catch (OverflowException) { @@ -685,4 +685,4 @@ unsafe partial struct D2D1ResourceTextureManagerImpl return S.S_OK; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManagerInternal.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManagerInternal.cs index f02b3c3f..7472fb31 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManagerInternal.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManagerInternal.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Shaders.Interop.Extensions; using TerraFX.Interop.DirectX; @@ -15,7 +15,7 @@ partial struct D2D1ResourceTextureManagerImpl /// /// The implementation for ID2D1ResourceTextureManagerInternal. /// - private unsafe static class ID2D1ResourceTextureManagerInternalMethods + private static unsafe class ID2D1ResourceTextureManagerInternalMethods { #if !NET6_0_OR_GREATER /// @@ -165,7 +165,7 @@ partial struct D2D1ResourceTextureManagerImpl // If the texture has already been created, just return it if (@this->d2D1ResourceTexture is not null) { - @this->d2D1ResourceTexture->AddRef(); + _ = @this->d2D1ResourceTexture->AddRef(); *resourceTexture = @this->d2D1ResourceTexture; @@ -194,10 +194,10 @@ partial struct D2D1ResourceTextureManagerImpl if (result == S.S_OK) { // Store the resource texture for later - d2D1ResourceTexture.CopyTo(&@this->d2D1ResourceTexture); + _ = d2D1ResourceTexture.CopyTo(&@this->d2D1ResourceTexture); // Also return it to callers - d2D1ResourceTexture.CopyTo(resourceTexture); + _ = d2D1ResourceTexture.CopyTo(resourceTexture); // Free the staging buffers NativeMemory.Free(@this->resourceTextureProperties.extents); @@ -216,4 +216,4 @@ partial struct D2D1ResourceTextureManagerImpl } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs index bf17571c..31095856 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; @@ -32,17 +32,18 @@ internal unsafe partial struct D2D1ResourceTextureManagerImpl /// /// The shared vtable pointer for instance, for ID2D1ResourceTextureManager. /// - private static readonly void** VtblForID2D1ResourceTextureManager; + private static readonly void** VtblForID2D1ResourceTextureManager = InitVtblForID2D1ResourceTextureManagerAndID2D1ResourceTextureManagerInternal(); /// /// The shared vtable pointer for instance, for ID2D1ResourceTextureManagerInternal. /// - private static readonly void** VtblForID2D1ResourceTextureManagerInternal; + private static readonly void** VtblForID2D1ResourceTextureManagerInternal = &VtblForID2D1ResourceTextureManager[5]; /// - /// Initializes the shared state for . + /// Initializes the combined vtable for ID2D1ResourceTextureManager and ID2D1ResourceTextureManagerInternal. /// - static D2D1ResourceTextureManagerImpl() + /// The combined vtable for ID2D1ResourceTextureManager and ID2D1ResourceTextureManagerInternal. + private static void** InitVtblForID2D1ResourceTextureManagerAndID2D1ResourceTextureManagerInternal() { void** lpVtbl = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(D2D1ResourceTextureManagerImpl), sizeof(void*) * 10); @@ -76,8 +77,7 @@ internal unsafe partial struct D2D1ResourceTextureManagerImpl lpVtbl[5 + 4] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1ResourceTextureManagerInternalMethods.GetResourceTextureWrapper); #endif - VtblForID2D1ResourceTextureManager = lpVtbl; - VtblForID2D1ResourceTextureManagerInternal = &lpVtbl[5]; + return lpVtbl; } /// @@ -249,17 +249,18 @@ internal unsafe partial struct D2D1ResourceTextureManagerImpl // Release the resource too if it has been created if (this.d2D1ResourceTexture is not null) { - this.d2D1ResourceTexture->Release(); + _ = this.d2D1ResourceTexture->Release(); } // Now that the resource, if any, has been released, the effect context can also // be released. This must be done only after any associated resource textures have // been released. Releasing an effect context first, in case it was the last reference // to it, will otherwise cause the Release() call on the resource texture to explode. - this.d2D1EffectContext->Release(); + _ = this.d2D1EffectContext->Release(); this.d2D1Multithread->Leave(); - this.d2D1Multithread->Release(); + + _ = this.d2D1Multithread->Release(); } if (this.resourceId is not null) @@ -295,4 +296,4 @@ internal unsafe partial struct D2D1ResourceTextureManagerImpl return referenceCount; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManager.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManager.cs index 690f7db6..651f511c 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManager.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using TerraFX.Interop.DirectX; @@ -98,4 +98,4 @@ internal unsafe struct ID2D1ResourceTextureManager data, dataCount); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManagerInternal.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManagerInternal.cs index ac43cacb..d8b7c894 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManagerInternal.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManagerInternal.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using TerraFX.Interop.DirectX; @@ -22,7 +22,7 @@ internal unsafe struct ID2D1ResourceTextureManagerInternal get { ReadOnlySpan data = new byte[] { - 0x24, 0x10, 0xBB, 0x5C, + 0x24, 0x10, 0xBB, 0x5C, 0xA1, 0x8E, 0x89, 0x46, 0x81, 0xBF, @@ -70,4 +70,4 @@ internal unsafe struct ID2D1ResourceTextureManagerInternal (ID2D1ResourceTextureManagerInternal*)Unsafe.AsPointer(ref this), resourceTexture); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Extensions/ID2D1EffectContextExtensions.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Extensions/ID2D1EffectContextExtensions.cs index 17b5dde6..39a188b0 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Extensions/ID2D1EffectContextExtensions.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Extensions/ID2D1EffectContextExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; @@ -63,4 +63,4 @@ internal static class ID2D1EffectContextExtensions return hresult; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapperFactory{T, TParameters, TTransformMapper}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapperFactory{T, TParameters, TTransformMapper}.cs index f65fc762..5350b0b0 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapperFactory{T, TParameters, TTransformMapper}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapperFactory{T, TParameters, TTransformMapper}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.Shaders.Interop.Factories.Abstract; +namespace ComputeSharp.D2D1.Shaders.Interop.Factories.Abstract; /// /// A base type for a transform mapper factory to be used in a D2D1 pixel shader effect. diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapperParametersAccessor{T, TParameters}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapperParametersAccessor{T, TParameters}.cs index a12df793..51f454ec 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapperParametersAccessor{T, TParameters}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapperParametersAccessor{T, TParameters}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.Shaders.Interop.Factories.Abstract; +namespace ComputeSharp.D2D1.Shaders.Interop.Factories.Abstract; /// /// A base type for an accessor of parameters to be used in D2D1 transform mapping implementations. diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapper{T, TParameters}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapper{T, TParameters}.cs index 903c0a0d..09a62ed5 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapper{T, TParameters}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/Abstract/D2D1TransformMapper{T, TParameters}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Drawing; using System.Runtime.CompilerServices; using ComputeSharp.D2D1.Interop.Effects; diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1AffineTransformMapperFactory.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1AffineTransformMapperFactory.cs index e3d8945c..3e76e5b7 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1AffineTransformMapperFactory.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1AffineTransformMapperFactory.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Numerics; using System.Runtime.CompilerServices; using ComputeSharp.D2D1.Interop; @@ -29,10 +29,10 @@ internal sealed class D2D1AffineTransformMapperFactory Point64 bottomRight = new(rectangle.Right, rectangle.Bottom); // Transform them with the current matrix - var transformedTopLeft = topLeft.Transform(in matrix); - var transformedTopRight = topRight.Transform(in matrix); - var transformedBottomLeft = bottomLeft.Transform(in matrix); - var transformedBottomRight = bottomRight.Transform(in matrix); + (double X, double Y) transformedTopLeft = topLeft.Transform(in matrix); + (double X, double Y) transformedTopRight = topRight.Transform(in matrix); + (double X, double Y) transformedBottomLeft = bottomLeft.Transform(in matrix); + (double X, double Y) transformedBottomRight = bottomRight.Transform(in matrix); // Calculate the bounding box of the transformed points double transformedLeft = Math.Min(Math.Min(transformedTopLeft.X, transformedTopRight.X), Math.Min(transformedBottomLeft.X, transformedBottomRight.X)); diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1InflateTransformMapperFactory.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1InflateTransformMapperFactory.cs index 9e5b8a0e..873d911f 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1InflateTransformMapperFactory.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1InflateTransformMapperFactory.cs @@ -1,4 +1,4 @@ -using ComputeSharp.D2D1.Interop; +using ComputeSharp.D2D1.Interop; using ComputeSharp.D2D1.Shaders.Interop.Factories.Abstract; using ComputeSharp.D2D1.Shaders.Interop.Helpers; diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Helpers/Point64.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Helpers/Point64.cs index 6bd7dec5..53352867 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Helpers/Point64.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Helpers/Point64.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Drawing; using System.Numerics; using System.Runtime.CompilerServices; @@ -8,17 +8,17 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Helpers; /// /// A 64-bit version of the type. /// -internal struct Point64 +internal readonly struct Point64 { /// /// The left coordinate of the current point. /// - private long x; + private readonly long x; /// /// The top coordinate of the current point. /// - private long y; + private readonly long y; /// /// Creates a new instance with the specified parameters. @@ -77,7 +77,7 @@ internal struct Point64 // [ M21, M22 ] // [ x, y] [ M31, M32 ] = [ x * M11 + y * M21 + M31, x * M12 + y * M22 + m32] return ( - Math.Round((double)this.x * matrix.M11 + (double)this.y * matrix.M21 + matrix.M31), - Math.Round((double)this.x * matrix.M12 + (double)this.y * matrix.M22 + matrix.M32)); + Math.Round(((double)this.x * matrix.M11) + ((double)this.y * matrix.M21) + matrix.M31), + Math.Round(((double)this.x * matrix.M12) + ((double)this.y * matrix.M22) + matrix.M32)); } } \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Helpers/Rectangle64.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Helpers/Rectangle64.cs index 7a87df79..1a20b3db 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Helpers/Rectangle64.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Helpers/Rectangle64.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Drawing; using System.Runtime.CompilerServices; diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1BufferSizeDispatchDataLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1BufferSizeDispatchDataLoader.cs index b18fcc4e..d24559f6 100644 --- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1BufferSizeDispatchDataLoader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1BufferSizeDispatchDataLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.D2D1.__Internals; using TerraFX.Interop.DirectX; @@ -60,4 +60,4 @@ internal unsafe struct D2D1BufferSizeDispatchDataLoader : ID2D1DispatchDataLoade return dataLoader.GetConstantBufferSize(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayDispatchDataLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayDispatchDataLoader.cs index ff567595..f0baa491 100644 --- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayDispatchDataLoader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayDispatchDataLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.D2D1.__Internals; using TerraFX.Interop.DirectX; @@ -32,4 +32,4 @@ internal struct D2D1ByteArrayDispatchDataLoader : ID2D1DispatchDataLoader { this.data = data.ToArray(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayInputDescriptionsLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayInputDescriptionsLoader.cs index dffefa81..bff3bb03 100644 --- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayInputDescriptionsLoader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayInputDescriptionsLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.D2D1.__Internals; @@ -33,4 +33,4 @@ internal struct D2D1ByteArrayInputDescriptionsLoader : ID2D1InputDescriptionsLoa { this.inputDescriptions = MemoryMarshal.Cast(data).ToArray(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayResourceTextureDescriptionsLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayResourceTextureDescriptionsLoader.cs index 1a375e82..99574e9a 100644 --- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayResourceTextureDescriptionsLoader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayResourceTextureDescriptionsLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.D2D1.__Internals; @@ -33,4 +33,4 @@ internal struct D2D1ByteArrayResourceTextureDescriptionsLoader : ID2D1ResourceTe { this.resourceTextureDescriptions = MemoryMarshal.Cast(data).ToArray(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteBufferDispatchDataLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteBufferDispatchDataLoader.cs index e45e3862..379e16c5 100644 --- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteBufferDispatchDataLoader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteBufferDispatchDataLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.D2D1.__Internals; using TerraFX.Interop.DirectX; @@ -72,4 +72,4 @@ internal unsafe struct D2D1ByteBufferDispatchDataLoader : ID2D1DispatchDataLoade this.writtenBytes = data.Length; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoDispatchDataLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoDispatchDataLoader.cs index d2ac7e01..0f302f4b 100644 --- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoDispatchDataLoader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1DrawInfoDispatchDataLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.D2D1.__Internals; @@ -31,8 +31,8 @@ internal readonly unsafe struct D2D1DrawInfoDispatchDataLoader : ID2D1DispatchDa /// void ID2D1DispatchDataLoader.LoadConstantBuffer(ReadOnlySpan data) { - this.d2D1DrawInfo->SetPixelShaderConstantBuffer( + _ = this.d2D1DrawInfo->SetPixelShaderConstantBuffer( buffer: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)), bufferCount: (uint)data.Length); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1EffectDispatchDataLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1EffectDispatchDataLoader.cs index b7381119..0f8c809f 100644 --- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1EffectDispatchDataLoader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1EffectDispatchDataLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.D2D1.__Internals; @@ -43,4 +43,4 @@ internal readonly unsafe struct D2D1EffectDispatchDataLoader : ID2D1DispatchData data: (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)), dataSize: (uint)data.Length).Assert(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ShaderBytecodeLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ShaderBytecodeLoader.cs index 4db265a3..4f3badee 100644 --- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ShaderBytecodeLoader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ShaderBytecodeLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.D2D1.__Internals; @@ -76,4 +76,4 @@ internal unsafe struct D2D1ShaderBytecodeLoader : ID2D1BytecodeLoader this.embeddedBytecodePtr = (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(bytecode)); this.embeddedBytecodeSize = bytecode.Length; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.ID3DInclude.cs b/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.ID3DInclude.cs index 260bcdcf..8269fe02 100644 --- a/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.ID3DInclude.cs +++ b/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.ID3DInclude.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; @@ -103,4 +103,4 @@ partial class D3DCompiler return S.S_OK; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.cs b/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.cs index 2dde77f8..be6c0b08 100644 --- a/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.cs +++ b/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; @@ -270,4 +270,4 @@ internal static unsafe partial class D3DCompiler }; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Translation/Headers/d2d1effecthelpers.hlsli.cs b/src/ComputeSharp.D2D1/Shaders/Translation/Headers/d2d1effecthelpers.hlsli.cs index 73153fef..c1dc408d 100644 --- a/src/ComputeSharp.D2D1/Shaders/Translation/Headers/d2d1effecthelpers.hlsli.cs +++ b/src/ComputeSharp.D2D1/Shaders/Translation/Headers/d2d1effecthelpers.hlsli.cs @@ -1,4 +1,6 @@ -using System; +using System; + +#pragma warning disable IDE0025 namespace ComputeSharp.D2D1.Shaders.Translation; @@ -334,4 +336,4 @@ internal static class D2D1EffectHelpers """u8; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Shaders/Translation/__Internals/D2D1ShaderCompiler.cs b/src/ComputeSharp.D2D1/Shaders/Translation/__Internals/D2D1ShaderCompiler.cs index 0802f677..cda09946 100644 --- a/src/ComputeSharp.D2D1/Shaders/Translation/__Internals/D2D1ShaderCompiler.cs +++ b/src/ComputeSharp.D2D1/Shaders/Translation/__Internals/D2D1ShaderCompiler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Runtime.CompilerServices; using TerraFX.Interop.DirectX; @@ -35,4 +35,4 @@ public static class D2D1ShaderCompiler loader.LoadDynamicBytecode((IntPtr)d3DBlobBytecode.Get()); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Dynamic/Attributes/ShaderMethodAttribute.cs b/src/ComputeSharp.Dynamic/Attributes/ShaderMethodAttribute.cs index 3674883c..fc3b6415 100644 --- a/src/ComputeSharp.Dynamic/Attributes/ShaderMethodAttribute.cs +++ b/src/ComputeSharp.Dynamic/Attributes/ShaderMethodAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp; @@ -12,4 +12,4 @@ namespace ComputeSharp; [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public sealed class ShaderMethodAttribute : Attribute { -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Dynamic/Attributes/__Internals/ShaderMethodSourceAttribute.HlslGeneration.cs b/src/ComputeSharp.Dynamic/Attributes/__Internals/ShaderMethodSourceAttribute.HlslGeneration.cs index 71086963..2bc68b06 100644 --- a/src/ComputeSharp.Dynamic/Attributes/__Internals/ShaderMethodSourceAttribute.HlslGeneration.cs +++ b/src/ComputeSharp.Dynamic/Attributes/__Internals/ShaderMethodSourceAttribute.HlslGeneration.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; namespace ComputeSharp.__Internals; @@ -90,4 +90,4 @@ partial class ShaderMethodSourceAttribute : Attribute { builder.Append(this.invokeMethod.Replace(InvokeMethodIdentifier, name)); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Dynamic/Attributes/__Internals/ShaderMethodSourceAttribute.cs b/src/ComputeSharp.Dynamic/Attributes/__Internals/ShaderMethodSourceAttribute.cs index b00de205..64a5d7a0 100644 --- a/src/ComputeSharp.Dynamic/Attributes/__Internals/ShaderMethodSourceAttribute.cs +++ b/src/ComputeSharp.Dynamic/Attributes/__Internals/ShaderMethodSourceAttribute.cs @@ -1,10 +1,12 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Reflection; using ComputeSharp.Core.Extensions; +#pragma warning disable IDE0052 + namespace ComputeSharp.__Internals; /// @@ -108,4 +110,4 @@ public sealed partial class ShaderMethodSourceAttribute : Attribute { throw new ArgumentException($"The captured delegate \"{name}\" was wrapping a method without the [ShaderMethod] attribute applied to it.", name); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Dynamic/Shaders/Exceptions/DxcCompilationException.cs b/src/ComputeSharp.Dynamic/Shaders/Exceptions/DxcCompilationException.cs index 3c315dd7..634b84dd 100644 --- a/src/ComputeSharp.Dynamic/Shaders/Exceptions/DxcCompilationException.cs +++ b/src/ComputeSharp.Dynamic/Shaders/Exceptions/DxcCompilationException.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; namespace ComputeSharp.Exceptions; @@ -26,13 +26,13 @@ public sealed class DxcCompilationException : Exception { StringBuilder builder = new(512); - builder.AppendLine("The DXC compiler encountered one or more errors while trying to compile the shader:"); - builder.AppendLine(); - builder.AppendLine(error.Trim()); - builder.AppendLine(); - builder.AppendLine("Make sure to only be using supported features by checking the README file in the ComputeSharp repository: https://github.com/Sergio0694/ComputeSharp."); - builder.Append("If you're sure that your C# shader code is valid, please open an issue an include a working repro and this error message."); + _ = builder.AppendLine("The DXC compiler encountered one or more errors while trying to compile the shader:"); + _ = builder.AppendLine(); + _ = builder.AppendLine(error.Trim()); + _ = builder.AppendLine(); + _ = builder.AppendLine("Make sure to only be using supported features by checking the README file in the ComputeSharp repository: https://github.com/Sergio0694/ComputeSharp."); + _ = builder.Append("If you're sure that your C# shader code is valid, please open an issue an include a working repro and this error message."); return builder.ToString(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Dynamic/Shaders/Interop/ReflectionServices.cs b/src/ComputeSharp.Dynamic/Shaders/Interop/ReflectionServices.cs index 51a04792..250ba163 100644 --- a/src/ComputeSharp.Dynamic/Shaders/Interop/ReflectionServices.cs +++ b/src/ComputeSharp.Dynamic/Shaders/Interop/ReflectionServices.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.__Internals; using ComputeSharp.Core.Extensions; @@ -159,4 +159,4 @@ public static class ReflectionServices InterfaceSlotCount: d3D12ShaderReflection.Get()->GetNumInterfaceSlots(), RequiresDoublePrecisionSupport: (d3D12ShaderReflection.Get()->GetRequiresFlags() & (D3D.D3D_SHADER_REQUIRES_DOUBLES | D3D.D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS)) != 0); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Dynamic/Shaders/Interop/ShaderInfo.cs b/src/ComputeSharp.Dynamic/Shaders/Interop/ShaderInfo.cs index f69667e5..2b2064b7 100644 --- a/src/ComputeSharp.Dynamic/Shaders/Interop/ShaderInfo.cs +++ b/src/ComputeSharp.Dynamic/Shaders/Interop/ShaderInfo.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.Interop; +namespace ComputeSharp.Interop; /// /// A model representing reflection info for a given compute shader. @@ -53,4 +53,4 @@ public sealed record ShaderInfo( uint MovcInstructionCount, uint MovInstructionCount, uint InterfaceSlotCount, - bool RequiresDoublePrecisionSupport); + bool RequiresDoublePrecisionSupport); \ No newline at end of file diff --git a/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.LibraryLoading.cs b/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.LibraryLoading.cs index 437ae750..7ec3bb05 100644 --- a/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.LibraryLoading.cs +++ b/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.LibraryLoading.cs @@ -1,4 +1,4 @@ -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER using System; using System.IO; @@ -22,7 +22,10 @@ unsafe partial class ShaderCompiler // This happens when doing eg. "dotnet bin\Debug\net5.0\MyApp.dll", which would crash at runtime. Windows.ResolveLibrary += static (libraryName, assembly, searchPath) => { - if (libraryName is not "dxcompiler") return IntPtr.Zero; + if (libraryName is not "dxcompiler") + { + return IntPtr.Zero; + } string rid = RuntimeInformation.ProcessArchitecture switch { @@ -70,4 +73,4 @@ unsafe partial class ShaderCompiler } } -#endif +#endif \ No newline at end of file diff --git a/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.cs b/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.cs index aff3c606..b93f9323 100644 --- a/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.cs +++ b/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Text.RegularExpressions; using ComputeSharp.Core.Extensions; @@ -26,17 +26,17 @@ internal sealed unsafe partial class ShaderCompiler /// /// The instance to use to create the bytecode for HLSL sources. /// - private readonly ComPtr DxcCompiler; + private readonly ComPtr dxcCompiler; /// - /// The instance to use to work with . + /// The instance to use to work with . /// - private readonly ComPtr DxcLibrary; + private readonly ComPtr dxcLibrary; /// - /// The instance used to compile shaders with . + /// The instance used to compile shaders with . /// - private readonly ComPtr DxcIncludeHandler; + private readonly ComPtr dxcIncludeHandler; /// /// Creates a new instance. @@ -59,9 +59,9 @@ internal sealed unsafe partial class ShaderCompiler dxcLibrary.Get()->CreateIncludeHandler(dxcIncludeHandler.GetAddressOf()).Assert(); - DxcCompiler = dxcCompiler.Move(); - DxcLibrary = dxcLibrary.Move(); - DxcIncludeHandler = dxcIncludeHandler.Move(); + this.dxcCompiler = dxcCompiler.Move(); + this.dxcLibrary = dxcLibrary.Move(); + this.dxcIncludeHandler = dxcIncludeHandler.Move(); } /// @@ -69,9 +69,9 @@ internal sealed unsafe partial class ShaderCompiler /// ~ShaderCompiler() { - DxcCompiler.Dispose(); - DxcLibrary.Dispose(); - DxcIncludeHandler.Dispose(); + this.dxcCompiler.Dispose(); + this.dxcLibrary.Dispose(); + this.dxcIncludeHandler.Dispose(); } /// @@ -93,7 +93,7 @@ internal sealed unsafe partial class ShaderCompiler // Get the encoded blob from the source code fixed (char* p = source) { - DxcLibrary.Get()->CreateBlobWithEncodingOnHeapCopy( + this.dxcLibrary.Get()->CreateBlobWithEncodingOnHeapCopy( p, (uint)source.Length * 2, 1200, @@ -110,7 +110,7 @@ internal sealed unsafe partial class ShaderCompiler { char** arguments = stackalloc char*[3] { optimization, rowMajor, warningsAsErrors }; - DxcCompiler.Get()->Compile( + this.dxcCompiler.Get()->Compile( (IDxcBlob*)dxcBlobEncoding.Get(), (ushort*)shaderName, (ushort*)entryPoint, @@ -119,7 +119,7 @@ internal sealed unsafe partial class ShaderCompiler 3, null, 0, - DxcIncludeHandler.Get(), + this.dxcIncludeHandler.Get(), dxcOperationResult.GetAddressOf()).Assert(); } diff --git a/src/ComputeSharp.Dynamic/Shaders/Translation/__Internals/ShaderCompiler.cs b/src/ComputeSharp.Dynamic/Shaders/Translation/__Internals/ShaderCompiler.cs index e93dc7f6..709314f8 100644 --- a/src/ComputeSharp.Dynamic/Shaders/Translation/__Internals/ShaderCompiler.cs +++ b/src/ComputeSharp.Dynamic/Shaders/Translation/__Internals/ShaderCompiler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Runtime.CompilerServices; using TerraFX.Interop.DirectX; @@ -35,4 +35,4 @@ public static class ShaderCompiler loader.LoadDynamicBytecode((IntPtr)dxcBlobBytecode.Get()); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.NetStandard/System/Collections.Generic/DictionaryExtensions.cs b/src/ComputeSharp.NetStandard/System/Collections.Generic/DictionaryExtensions.cs index 3c8199dc..4c47fb38 100644 --- a/src/ComputeSharp.NetStandard/System/Collections.Generic/DictionaryExtensions.cs +++ b/src/ComputeSharp.NetStandard/System/Collections.Generic/DictionaryExtensions.cs @@ -1,4 +1,4 @@ -namespace System.Collections.Generic; +namespace System.Collections.Generic; /// /// A helper type with extensions for the type. diff --git a/src/ComputeSharp.NetStandard/System/Collections.Generic/QueueExtensions.cs b/src/ComputeSharp.NetStandard/System/Collections.Generic/QueueExtensions.cs index 8ca46f02..d3ed152c 100644 --- a/src/ComputeSharp.NetStandard/System/Collections.Generic/QueueExtensions.cs +++ b/src/ComputeSharp.NetStandard/System/Collections.Generic/QueueExtensions.cs @@ -1,4 +1,4 @@ -namespace System.Collections.Generic; +namespace System.Collections.Generic; /// /// A helper type with extensions for the type. diff --git a/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs b/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs index 7c3bade3..2d663176 100644 --- a/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Diagnostics.CodeAnalysis; diff --git a/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/RequiresUnreferencedCodeAttribute.cs b/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/RequiresUnreferencedCodeAttribute.cs index 7009fdd3..699a1844 100644 --- a/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/RequiresUnreferencedCodeAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/RequiresUnreferencedCodeAttribute.cs @@ -1,40 +1,39 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System.Diagnostics.CodeAnalysis +namespace System.Diagnostics.CodeAnalysis; + +/// +/// Indicates that the specified method requires dynamic access to code that is not referenced +/// statically, for example through . +/// +/// +/// This allows tools to understand which methods are unsafe to call when removing unreferenced +/// code from an application. +/// +[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)] +internal sealed class RequiresUnreferencedCodeAttribute : Attribute { /// - /// Indicates that the specified method requires dynamic access to code that is not referenced - /// statically, for example through . + /// Initializes a new instance of the class + /// with the specified message. /// - /// - /// This allows tools to understand which methods are unsafe to call when removing unreferenced - /// code from an application. - /// - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)] - internal sealed class RequiresUnreferencedCodeAttribute : Attribute + /// + /// A message that contains information about the usage of unreferenced code. + /// + public RequiresUnreferencedCodeAttribute(string message) { - /// - /// Initializes a new instance of the class - /// with the specified message. - /// - /// - /// A message that contains information about the usage of unreferenced code. - /// - public RequiresUnreferencedCodeAttribute(string message) - { - Message = message; - } - - /// - /// Gets a message that contains information about the usage of unreferenced code. - /// - public string Message { get; } - - /// - /// Gets or sets an optional URL that contains more information about the method, - /// why it requires unreferenced code, and what options a consumer has to deal with it. - /// - public string? Url { get; set; } + Message = message; } + + /// + /// Gets a message that contains information about the usage of unreferenced code. + /// + public string Message { get; } + + /// + /// Gets or sets an optional URL that contains more information about the method, + /// why it requires unreferenced code, and what options a consumer has to deal with it. + /// + public string? Url { get; set; } } \ No newline at end of file diff --git a/src/ComputeSharp.NetStandard/System/Enum.cs b/src/ComputeSharp.NetStandard/System/Enum.cs index 6a601cc1..4ea63575 100644 --- a/src/ComputeSharp.NetStandard/System/Enum.cs +++ b/src/ComputeSharp.NetStandard/System/Enum.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.NetStandard.System; +namespace ComputeSharp.NetStandard.System; /// /// A polyfill type that mirrors some methods from on .NET 6. diff --git a/src/ComputeSharp.NetStandard/System/FormatExtensions.cs b/src/ComputeSharp.NetStandard/System/FormatExtensions.cs index ad799798..cea6f5f3 100644 --- a/src/ComputeSharp.NetStandard/System/FormatExtensions.cs +++ b/src/ComputeSharp.NetStandard/System/FormatExtensions.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; namespace System; diff --git a/src/ComputeSharp.NetStandard/System/GC.cs b/src/ComputeSharp.NetStandard/System/GC.cs index cd9c26ac..5ef7f82b 100644 --- a/src/ComputeSharp.NetStandard/System/GC.cs +++ b/src/ComputeSharp.NetStandard/System/GC.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.NetStandard.System; +namespace ComputeSharp.NetStandard.System; /// /// A polyfill type that mirrors some methods from on .NET 6. diff --git a/src/ComputeSharp.NetStandard/System/IO/StreamExtensions.cs b/src/ComputeSharp.NetStandard/System/IO/StreamExtensions.cs index 6e94d749..b18da222 100644 --- a/src/ComputeSharp.NetStandard/System/IO/StreamExtensions.cs +++ b/src/ComputeSharp.NetStandard/System/IO/StreamExtensions.cs @@ -1,4 +1,4 @@ -using System.Buffers; +using System.Buffers; namespace System.IO; @@ -51,4 +51,4 @@ internal static class StreamExtensions ArrayPool.Shared.Return(array); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.NetStandard/System/IntPtrExtensions.cs b/src/ComputeSharp.NetStandard/System/IntPtrExtensions.cs index 481b7b9c..89316e29 100644 --- a/src/ComputeSharp.NetStandard/System/IntPtrExtensions.cs +++ b/src/ComputeSharp.NetStandard/System/IntPtrExtensions.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; namespace System; diff --git a/src/ComputeSharp.NetStandard/System/Path.cs b/src/ComputeSharp.NetStandard/System/Path.cs index 654ded4d..c07e3711 100644 --- a/src/ComputeSharp.NetStandard/System/Path.cs +++ b/src/ComputeSharp.NetStandard/System/Path.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.NetStandard.System.IO; diff --git a/src/ComputeSharp.NetStandard/System/Runtime/CompilerServices/RuntimeHelpers.cs b/src/ComputeSharp.NetStandard/System/Runtime/CompilerServices/RuntimeHelpers.cs index 552f2b33..82c79c14 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/CompilerServices/RuntimeHelpers.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/CompilerServices/RuntimeHelpers.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; namespace ComputeSharp.NetStandard.System.Runtime.CompilerServices; @@ -14,5 +14,8 @@ internal static class RuntimeHelpers /// The type to associate the memory to. /// The size in byte of the memory to allocate. /// A pointer to the allocated memory. - public static IntPtr AllocateTypeAssociatedMemory(Type type, int size) => Marshal.AllocHGlobal(size); + public static IntPtr AllocateTypeAssociatedMemory(Type type, int size) + { + return Marshal.AllocHGlobal(size); + } } \ No newline at end of file diff --git a/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/MemoryMarshal.cs b/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/MemoryMarshal.cs index bb7c704d..c80bc981 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/MemoryMarshal.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/MemoryMarshal.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; namespace ComputeSharp.NetStandard.System.Runtime.InteropServices; diff --git a/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/NativeMemory.cs b/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/NativeMemory.cs index b5a23ff6..a9810ac4 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/NativeMemory.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/NativeMemory.cs @@ -1,4 +1,4 @@ -namespace System.Runtime.InteropServices; +namespace System.Runtime.InteropServices; /// /// This class contains methods that are mainly used to manage native memory. diff --git a/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs b/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs index 0f25befe..9b9e96e5 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; diff --git a/src/ComputeSharp.NetStandard/System/Runtime/Versioning/OSPlatformAttribute.cs b/src/ComputeSharp.NetStandard/System/Runtime/Versioning/OSPlatformAttribute.cs index 8a3497ee..1c78df51 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/Versioning/OSPlatformAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/Versioning/OSPlatformAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; diff --git a/src/ComputeSharp.NetStandard/System/Runtime/Versioning/SupportedOSPlatformAttribute.cs b/src/ComputeSharp.NetStandard/System/Runtime/Versioning/SupportedOSPlatformAttribute.cs index 3a108b87..e1ea17d0 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/Versioning/SupportedOSPlatformAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/Versioning/SupportedOSPlatformAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; diff --git a/src/ComputeSharp.Pix/ComputeContextExtensions.cs b/src/ComputeSharp.Pix/ComputeContextExtensions.cs index 73a4a69b..fb9b5abf 100644 --- a/src/ComputeSharp.Pix/ComputeContextExtensions.cs +++ b/src/ComputeSharp.Pix/ComputeContextExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Drawing; using ComputeSharp.Graphics.Commands; @@ -278,4 +278,4 @@ public static class ComputeContextExtensions commandList.D3D12GraphicsCommandList->SetPixMarkerUnsafe(0, message); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Pix/Interop/ID3D12GraphicsCommandListExtensions.cs b/src/ComputeSharp.Pix/Interop/ID3D12GraphicsCommandListExtensions.cs index 816128a2..aad49f06 100644 --- a/src/ComputeSharp.Pix/Interop/ID3D12GraphicsCommandListExtensions.cs +++ b/src/ComputeSharp.Pix/Interop/ID3D12GraphicsCommandListExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.Runtime.CompilerServices; using System.Text; @@ -102,4 +102,4 @@ internal static class ID3D12GraphicsCommandListExtensions Pix.PIXSetMarkerOnCommandList((ID3D12GraphicsCommandList*)Unsafe.AsPointer(ref d3D12GraphicsCommandList), color, (sbyte*)messagePtr); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Pix/Interop/Pix.cs b/src/ComputeSharp.Pix/Interop/Pix.cs index cc6ee0bf..11e1719a 100644 --- a/src/ComputeSharp.Pix/Interop/Pix.cs +++ b/src/ComputeSharp.Pix/Interop/Pix.cs @@ -1,4 +1,4 @@ -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; using TerraFX.Interop.DirectX; namespace ComputeSharp.Interop; @@ -41,4 +41,4 @@ internal static unsafe partial class Pix /// The format string to use for the marker (in ANSI format, -terminated). [DllImport("WinPixEventRuntime", ExactSpelling = true, CallingConvention = CallingConvention.Winapi)] public static extern void PIXSetMarkerOnCommandList(ID3D12GraphicsCommandList* commandList, ulong color, sbyte* formatString); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Pix/Interop/Pix.h.cs b/src/ComputeSharp.Pix/Interop/Pix.h.cs index 3cca15bd..caad7784 100644 --- a/src/ComputeSharp.Pix/Interop/Pix.h.cs +++ b/src/ComputeSharp.Pix/Interop/Pix.h.cs @@ -1,4 +1,4 @@ -/*==========================================================================; +/*==========================================================================; * * Copyright (C) Microsoft Corporation. All Rights Reserved. * @@ -40,4 +40,4 @@ partial class Pix { return i; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Diagnostics/DiagnosticDescriptors.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Diagnostics/DiagnosticDescriptors.cs index ced8e438..fc3653a2 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Diagnostics/DiagnosticDescriptors.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Diagnostics/DiagnosticDescriptors.cs @@ -1,4 +1,4 @@ -using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis; namespace ComputeSharp.SourceGeneration.Diagnostics; @@ -7,4 +7,4 @@ namespace ComputeSharp.SourceGeneration.Diagnostics; /// internal static partial class DiagnosticDescriptors { -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Extensions/StringExtensions.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Extensions/StringExtensions.cs index f01e6d86..31ef59fd 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Extensions/StringExtensions.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Extensions/StringExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; namespace ComputeSharp.SourceGeneration.Extensions; @@ -66,4 +66,4 @@ internal static class StringExtensions return text; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Extensions/SyntaxNodeExtensions.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Extensions/SyntaxNodeExtensions.cs index d9a2fd78..85dde30c 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Extensions/SyntaxNodeExtensions.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Extensions/SyntaxNodeExtensions.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using ComputeSharp.SourceGeneration.Mappings; using Microsoft.CodeAnalysis; @@ -162,7 +162,7 @@ internal static class SyntaxNodeExtensions /// A node like the one in input, but just as a definition. public static MethodDeclarationSyntax AsDefinition(this MethodDeclarationSyntax node) { - if (node.ExpressionBody is ArrowExpressionClauseSyntax) + if (node.ExpressionBody is not null) { return node.WithExpressionBody(null).WithSemicolonToken(Token(SyntaxKind.SemicolonToken)); } @@ -205,7 +205,7 @@ internal static class SyntaxNodeExtensions /// A node like the one in input, but just as a definition. public static LocalFunctionStatementSyntax AsDefinition(this LocalFunctionStatementSyntax node) { - if (node.ExpressionBody is ArrowExpressionClauseSyntax) + if (node.ExpressionBody is not null) { return node.WithExpressionBody(null).WithSemicolonToken(Token(SyntaxKind.SemicolonToken)); } @@ -229,4 +229,4 @@ internal static class SyntaxNodeExtensions _ => true }).ToArray())); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Helpers/SemanticModelProvider.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Helpers/SemanticModelProvider.cs index b4dd8b35..ad657a04 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Helpers/SemanticModelProvider.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Helpers/SemanticModelProvider.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Microsoft.CodeAnalysis; namespace ComputeSharp.SourceGeneration.Helpers; @@ -44,4 +44,4 @@ internal sealed class SemanticModelProvider return semanticModel; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Helpers/SyntaxTokenHelper.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Helpers/SyntaxTokenHelper.cs index 48415734..f537568f 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Helpers/SyntaxTokenHelper.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Helpers/SyntaxTokenHelper.cs @@ -1,4 +1,4 @@ -using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; @@ -23,8 +23,8 @@ internal static class SyntaxTokenHelper // An extra newline and indentation has to be added to the raw text when there is no trailing newline, as not doing // so would otherwise case the terminating """ token to fall on the same line, which is invalid syntax. This is only // needed to make the code valid, as the actual literal context of the string is not affected and remains the same. - string indentation = new(' ', 4 * indentationLevel + 4 + 4); - + string indentation = new(' ', (4 * indentationLevel) + 4 + 4); + return Token( TriviaList(), SyntaxKind.MultiLineRawStringLiteralToken, @@ -32,4 +32,4 @@ internal static class SyntaxTokenHelper text, TriviaList()); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownFields.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownFields.cs index 7728ab5b..a2466cae 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownFields.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownFields.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace ComputeSharp.SourceGeneration.Mappings; @@ -41,4 +41,4 @@ internal static partial class HlslKnownFields { return KnownFields.TryGetValue(name, out mapped); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownKeywords.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownKeywords.cs index 3db69f94..6d706a5a 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownKeywords.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownKeywords.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using System.Reflection; using ComputeSharp.Core.Intrinsics.Attributes; @@ -44,17 +45,17 @@ internal static partial class HlslKnownKeywords }); // HLSL primitive names - foreach (var type in HlslKnownTypes.KnownVectorTypes.Concat(HlslKnownTypes.KnownMatrixTypes)) + foreach (Type? type in HlslKnownTypes.KnownVectorTypes.Concat(HlslKnownTypes.KnownMatrixTypes)) { - knownKeywords.Add(type.Name.ToLowerInvariant()); + _ = knownKeywords.Add(type.Name.ToLowerInvariant()); } // HLSL intrinsics method names - foreach (var method in typeof(Hlsl).GetMethods(BindingFlags.Public | BindingFlags.Static)) + foreach (MethodInfo? method in typeof(Hlsl).GetMethods(BindingFlags.Public | BindingFlags.Static)) { string name = method.GetCustomAttribute()?.Name ?? method.Name; - knownKeywords.Add(name); + _ = knownKeywords.Add(name); } // Let other types inject additional keywords @@ -85,4 +86,4 @@ internal static partial class HlslKnownKeywords return mapped is not null; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownMethods.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownMethods.cs index dd7f890b..8ea3c68d 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownMethods.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownMethods.cs @@ -128,7 +128,7 @@ internal static partial class HlslKnownMethods }; // Programmatically load mappings from the Hlsl class as well (the ones with no parameter matching) - foreach (var method in + foreach (MethodInfo? method in from method in typeof(Hlsl).GetMethods(BindingFlags.Public | BindingFlags.Static) group method by method.Name into groups @@ -171,7 +171,7 @@ internal static partial class HlslKnownMethods Dictionary knownMethods = new(); // Go through the previously discovered methods to find the ones requiring parameters mapping - foreach (var pair in KnownMethods) + foreach (KeyValuePair pair in KnownMethods) { // Only process methods marked as requiring parameters mapping if (pair.Value != nameof(HlslIntrinsicNameAttribute.RequiresParametersMatching)) @@ -262,4 +262,4 @@ internal static partial class HlslKnownMethods { return KnownMethodsParametersMapping[$"{name}({string.Join(", ", parameterTypeNames)})"]; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownOperators.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownOperators.cs index ee1bda0a..885c06e9 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownOperators.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownOperators.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -24,7 +24,7 @@ internal static partial class HlslKnownOperators Dictionary knownOperators = new(); // Programmatically load mappings for the intrinsic operators on each HLSL primitive type - foreach (var item in + foreach ((Type Type, MethodInfo Operator, string IntrinsicName, bool RequiresParametersMatching) item in from type in HlslKnownTypes.KnownVectorTypes.Concat(HlslKnownTypes.KnownMatrixTypes) from method in type.GetMethods(BindingFlags.Static | BindingFlags.Public) where method.IsSpecialName && method.Name.StartsWith("op_") @@ -57,4 +57,4 @@ internal static partial class HlslKnownOperators { return KnownOperators.TryGetValue($"{name}({string.Join(", ", parameterTypeNames)})", out mapped); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownProperties.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownProperties.cs index de59abca..2b5fd0d5 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownProperties.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownProperties.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -140,7 +140,7 @@ internal static partial class HlslKnownProperties }; // Programmatically load mappings for the instance members of the HLSL vector types - foreach (var item in + foreach ((Type Type, PropertyInfo Property) item in from type in HlslKnownTypes.KnownVectorTypes from property in type.GetProperties(BindingFlags.Instance | BindingFlags.Public) select (Type: type, Property: property)) @@ -149,7 +149,7 @@ internal static partial class HlslKnownProperties } // Load mappings for the matrix properties as well - foreach (var item in + foreach ((Type Type, PropertyInfo Property) item in from type in HlslKnownTypes.KnownMatrixTypes from property in type.GetProperties(BindingFlags.Instance | BindingFlags.Public) where Regex.IsMatch(property.Name, "^M[1-4]{2}$") @@ -282,7 +282,7 @@ internal static partial class HlslKnownProperties /// Whether or not a rank and axis could be resolved by the input indexer name. public static bool TryGetAccessorRankAndAxis(string name, out int rank, out int axis) { - if (KnownSizeAccessors.TryGetValue(name, out var info)) + if (KnownSizeAccessors.TryGetValue(name, out (int Rank, int Axis) info)) { (rank, axis) = info; @@ -293,4 +293,4 @@ internal static partial class HlslKnownProperties return false; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownSizes.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownSizes.cs index 44bc07f8..55df54a2 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownSizes.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownSizes.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Reflection; @@ -35,7 +36,7 @@ internal static class HlslKnownSizes }; foreach ( - var type in + Type? type in from type in Assembly.GetExecutingAssembly().ExportedTypes where Regex.IsMatch(type.FullName, @"^ComputeSharp\.(Bool|Double|Float|Int|UInt)") select type) @@ -55,4 +56,4 @@ internal static class HlslKnownSizes { return KnownSizes[typeName]; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs index 9fef8219..58e6c35d 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Numerics; @@ -78,13 +78,13 @@ internal static partial class HlslKnownTypes }; // Add all the vector types - foreach (var type in KnownVectorTypes) + foreach (Type type in KnownVectorTypes) { knownTypes.Add(type.FullName, type.Name.ToLowerInvariant()); } // Add all the matrix types - foreach (var type in KnownMatrixTypes) + foreach (Type type in KnownMatrixTypes) { knownTypes.Add(type.FullName, type.Name.ToLowerInvariant()); } @@ -135,7 +135,7 @@ internal static partial class HlslKnownTypes { if (KnownMatrixTypes.Any(type => type.FullName == typeName)) { - var match = Regex.Match(typeName, @"^ComputeSharp\.(Bool|Int|UInt|Float|Double)([2-4])x([1-4])$"); + Match match = Regex.Match(typeName, @"^ComputeSharp\.(Bool|Int|UInt|Float|Double)([2-4])x([1-4])$"); if (match.Success) { @@ -222,12 +222,15 @@ internal static partial class HlslKnownTypes // Explicitly prevent bool from being a field in a custom struct if (type.SpecialType == SpecialType.System_Boolean) { - invalidTypes.Add(type); + _ = invalidTypes.Add(type); return; } - if (KnownHlslTypes.ContainsKey(type.GetFullMetadataName())) return; + if (KnownHlslTypes.ContainsKey(type.GetFullMetadataName())) + { + return; + } // Check if the type is unsupported if (!type.IsUnmanagedType || @@ -236,16 +239,22 @@ internal static partial class HlslKnownTypes type.IsRefLikeType || type.GetFullyQualifiedName().StartsWith("System.")) { - invalidTypes.Add(type); + _ = invalidTypes.Add(type); return; } - if (!customTypes.Add(type)) return; - - foreach (var field in type.GetMembers().OfType()) + if (!customTypes.Add(type)) { - if (field.IsStatic) continue; + return; + } + + foreach (IFieldSymbol field in type.GetMembers().OfType()) + { + if (field.IsStatic) + { + continue; + } ExploreTypes((INamedTypeSymbol)field.Type, customTypes, invalidTypes); } @@ -291,14 +300,17 @@ internal static partial class HlslKnownTypes // types and their dependencies, and iteratively remove items from the map when they have no // dependencies left. When one type is processed and removed, it is also removed from the list // of dependencies of all other remaining types in the map, until there is none left. - foreach (var type in types) + foreach (INamedTypeSymbol type in types) { HashSet dependencies = new(SymbolEqualityComparer.Default); // Only add other custom types as dependencies, and ignore HLSL types - foreach (var field in type.GetMembers().OfType()) + foreach (IFieldSymbol field in type.GetMembers().OfType()) { - if (field.IsStatic) continue; + if (field.IsStatic) + { + continue; + } INamedTypeSymbol fieldType = (INamedTypeSymbol)field.Type; @@ -314,20 +326,23 @@ internal static partial class HlslKnownTypes while (queue.Count > 0) { - var entry = queue.Dequeue(); + (INamedTypeSymbol Type, HashSet Fields) entry = queue.Dequeue(); // No dependencies left, we can declare this type if (entry.Fields.Count == 0) { // Remove the current type from dependencies of others - foreach (var pair in queue) + foreach ((INamedTypeSymbol Type, HashSet Fields) pair in queue) { _ = pair.Fields.Remove(entry.Type); } yield return entry.Type; } - else queue.Enqueue(entry); + else + { + queue.Enqueue(entry); + } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.Diagnostics.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.Diagnostics.cs index e308f084..c4e6beaa 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.Diagnostics.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.Diagnostics.cs @@ -1,4 +1,4 @@ -using ComputeSharp.SourceGeneration.Extensions; +using ComputeSharp.SourceGeneration.Extensions; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; using static ComputeSharp.SourceGeneration.Diagnostics.DiagnosticDescriptors; @@ -11,7 +11,7 @@ partial class HlslSourceRewriter /// public override SyntaxNode? VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) { - var updatedNode = (AnonymousObjectCreationExpressionSyntax)base.VisitAnonymousObjectCreationExpression(node)!; + AnonymousObjectCreationExpressionSyntax updatedNode = (AnonymousObjectCreationExpressionSyntax)base.VisitAnonymousObjectCreationExpression(node)!; Diagnostics.Add(AnonymousObjectCreationExpression, node); @@ -201,4 +201,4 @@ partial class HlslSourceRewriter return base.VisitUnsafeStatement(node); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.cs index bbfe304e..db297fe4 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -26,26 +26,6 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter /// private static readonly char[] FloatLiteralSpecialCharacters = { '.', 'E' }; - /// - /// The instance with semantic info on the target syntax tree. - /// - protected readonly SemanticModelProvider SemanticModel; - - /// - /// The collection of discovered custom types. - /// - protected readonly ICollection DiscoveredTypes; - - /// - /// The collection of discovered constant definitions. - /// - protected readonly IDictionary ConstantDefinitions; - - /// - /// The collection of produced instances. - /// - protected readonly ImmutableArrayBuilder Diagnostics; - /// /// Creates a new instance with the specified parameters. /// @@ -65,10 +45,30 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter Diagnostics = diagnostics; } + /// + /// Gets the instance with semantic info on the target syntax tree. + /// + protected SemanticModelProvider SemanticModel { get; } + + /// + /// Gets the collection of discovered custom types. + /// + protected ICollection DiscoveredTypes { get; } + + /// + /// Gets the collection of discovered constant definitions. + /// + protected IDictionary ConstantDefinitions { get; } + + /// + /// Gets the collection of produced instances. + /// + protected ImmutableArrayBuilder Diagnostics { get; } + /// public override SyntaxNode VisitCastExpression(CastExpressionSyntax node) { - var updatedNode = (CastExpressionSyntax)base.VisitCastExpression(node)!; + CastExpressionSyntax updatedNode = (CastExpressionSyntax)base.VisitCastExpression(node)!; return updatedNode.ReplaceAndTrackType(updatedNode.Type, node.Type, SemanticModel.For(node), DiscoveredTypes); } @@ -76,7 +76,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter /// public override SyntaxNode? VisitVariableDeclaration(VariableDeclarationSyntax node) { - var updatedNode = (VariableDeclarationSyntax)base.VisitVariableDeclaration(node)!; + VariableDeclarationSyntax updatedNode = (VariableDeclarationSyntax)base.VisitVariableDeclaration(node)!; if (SemanticModel.For(node).GetTypeInfo(node.Type).Type is ITypeSymbol { IsUnmanagedType: false } type) { @@ -95,7 +95,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter /// public override SyntaxNode VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) { - var updatedNode = (ObjectCreationExpressionSyntax)base.VisitObjectCreationExpression(node)!; + ObjectCreationExpressionSyntax updatedNode = (ObjectCreationExpressionSyntax)base.VisitObjectCreationExpression(node)!; if (SemanticModel.For(node).GetTypeInfo(node).Type is ITypeSymbol { IsUnmanagedType: false } type) { @@ -131,7 +131,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter /// public override SyntaxNode VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) { - var updatedNode = (ImplicitObjectCreationExpressionSyntax)base.VisitImplicitObjectCreationExpression(node)!; + ImplicitObjectCreationExpressionSyntax updatedNode = (ImplicitObjectCreationExpressionSyntax)base.VisitImplicitObjectCreationExpression(node)!; if (SemanticModel.For(node).GetTypeInfo(node).Type is ITypeSymbol { IsUnmanagedType: false } type) { @@ -167,7 +167,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter /// public override SyntaxNode VisitDefaultExpression(DefaultExpressionSyntax node) { - var updatedNode = (DefaultExpressionSyntax)base.VisitDefaultExpression(node)!; + DefaultExpressionSyntax updatedNode = (DefaultExpressionSyntax)base.VisitDefaultExpression(node)!; updatedNode = updatedNode.ReplaceAndTrackType(updatedNode.Type, node.Type, SemanticModel.For(node), DiscoveredTypes); @@ -178,7 +178,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter /// public override SyntaxNode? VisitLiteralExpression(LiteralExpressionSyntax node) { - var updatedNode = (LiteralExpressionSyntax)base.VisitLiteralExpression(node)!; + LiteralExpressionSyntax updatedNode = (LiteralExpressionSyntax)base.VisitLiteralExpression(node)!; if (updatedNode.IsKind(SyntaxKind.DefaultLiteralExpression)) { @@ -236,7 +236,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter /// public override SyntaxNode? VisitElementAccessExpression(ElementAccessExpressionSyntax node) { - var updatedNode = (ElementAccessExpressionSyntax)base.VisitElementAccessExpression(node)!; + ElementAccessExpressionSyntax updatedNode = (ElementAccessExpressionSyntax)base.VisitElementAccessExpression(node)!; if (SemanticModel.For(node).GetOperation(node) is IPropertyReferenceOperation operation) { @@ -246,7 +246,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter // For instance: texture[ThreadIds.X, ThreadIds.Y] will be rewritten as texture[int2(ThreadIds.X, ThreadIds.Y)]. if (HlslKnownProperties.TryGetMappedResourceIndexerTypeName(propertyName, out string? mapping)) { - var index = InvocationExpression(IdentifierName(mapping!), ArgumentList(updatedNode.ArgumentList.Arguments)); + InvocationExpressionSyntax index = InvocationExpression(IdentifierName(mapping!), ArgumentList(updatedNode.ArgumentList.Arguments)); return updatedNode.WithArgumentList(BracketedArgumentList(SingletonSeparatedList(Argument(index)))); } @@ -294,7 +294,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter /// public override SyntaxNode? VisitAssignmentExpression(AssignmentExpressionSyntax node) { - var updatedNode = (AssignmentExpressionSyntax)base.VisitAssignmentExpression(node)!; + AssignmentExpressionSyntax updatedNode = (AssignmentExpressionSyntax)base.VisitAssignmentExpression(node)!; if (SemanticModel.For(node).GetOperation(node) is ICompoundAssignmentOperation { OperatorMethod: { ContainingType.ContainingNamespace.Name: "ComputeSharp" } method }) { @@ -321,8 +321,8 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter /// public override SyntaxNode? VisitBinaryExpression(BinaryExpressionSyntax node) { - var updatedNode = (BinaryExpressionSyntax)base.VisitBinaryExpression(node)!; - + BinaryExpressionSyntax updatedNode = (BinaryExpressionSyntax)base.VisitBinaryExpression(node)!; + // Process binary operations to see if the target operator method is an intrinsic if (SemanticModel.For(node).GetOperation(node) is IBinaryOperation { OperatorMethod: { ContainingType.ContainingNamespace.Name: "ComputeSharp" } method }) { @@ -339,14 +339,14 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter Argument(updatedNode.Right)); } } - + return updatedNode; } /// public override SyntaxNode? VisitIdentifierName(IdentifierNameSyntax node) { - var updatedNode = (IdentifierNameSyntax)base.VisitIdentifierName(node)!; + IdentifierNameSyntax updatedNode = (IdentifierNameSyntax)base.VisitIdentifierName(node)!; if (SemanticModel.For(node).GetOperation(node) is IFieldReferenceOperation operation && operation.Field.IsConst && @@ -354,8 +354,8 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter { ConstantDefinitions[operation.Field] = ((IFormattable)operation.Field.ConstantValue!).ToString(null, CultureInfo.InvariantCulture); - var ownerTypeName = ((INamedTypeSymbol)operation.Field.ContainingSymbol).ToDisplayString().ToHlslIdentifierName(); - var constantName = $"__{ownerTypeName}__{operation.Field.Name}"; + string ownerTypeName = ((INamedTypeSymbol)operation.Field.ContainingSymbol).ToDisplayString().ToHlslIdentifierName(); + string constantName = $"__{ownerTypeName}__{operation.Field.Name}"; return IdentifierName(constantName); } @@ -377,4 +377,4 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter return updatedToken.WithoutTrivia(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs index a80b9e59..c0b6bc9e 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -13,6 +13,8 @@ using Microsoft.CodeAnalysis.Operations; using static ComputeSharp.SourceGeneration.Diagnostics.DiagnosticDescriptors; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +#pragma warning disable IDE0052 + namespace ComputeSharp.SourceGeneration.SyntaxRewriters; /// @@ -129,7 +131,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter this.currentMethodIdentifier = node.Identifier; - var updatedNode = (MethodDeclarationSyntax?)base.Visit(node)!; + MethodDeclarationSyntax? updatedNode = (MethodDeclarationSyntax?)base.Visit(node)!; updatedNode = updatedNode.ReplaceAndTrackType(updatedNode.ReturnType, node!.ReturnType, SemanticModel.For(node), DiscoveredTypes); @@ -145,7 +147,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter if (updatedNode is not null) { - var implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray()); + BlockSyntax implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray()); // Add the tracked implicit declarations (at the start of the body) updatedNode = updatedNode.WithBody(implicitBlock).AddBodyStatements(updatedNode.Body!.Statements.ToArray()); @@ -164,7 +166,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter this.currentMethodIdentifier = node.Identifier; - var updatedNode = (LocalFunctionStatementSyntax?)base.Visit(node)!; + LocalFunctionStatementSyntax? updatedNode = (LocalFunctionStatementSyntax?)base.Visit(node)!; updatedNode = updatedNode.ReplaceAndTrackType(updatedNode.ReturnType, node!.ReturnType, SemanticModel.For(node), DiscoveredTypes); @@ -180,7 +182,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter if (updatedNode is not null) { - var implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray()); + BlockSyntax implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray()); updatedNode = updatedNode.WithBody(implicitBlock).AddBodyStatements(updatedNode.Body!.Statements.ToArray()); } @@ -191,7 +193,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter /// public override SyntaxNode VisitParameter(ParameterSyntax node) { - var updatedNode = (ParameterSyntax)base.VisitParameter(node)!; + ParameterSyntax updatedNode = (ParameterSyntax)base.VisitParameter(node)!; // Convert the C# parameter modifiers to the HLSL equivalent SyntaxToken modifier = @@ -214,7 +216,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter /// public override SyntaxNode VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) { - var updatedNode = ((LocalDeclarationStatementSyntax)base.VisitLocalDeclarationStatement(node)!); + LocalDeclarationStatementSyntax updatedNode = (LocalDeclarationStatementSyntax)base.VisitLocalDeclarationStatement(node)!; if (SemanticModel.For(node).GetOperation(node) is IOperation { Kind: OperationKind.UsingDeclaration }) { @@ -227,7 +229,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter /// public override SyntaxNode? VisitDeclarationExpression(DeclarationExpressionSyntax node) { - var updatedNode = (DeclarationExpressionSyntax)base.VisitDeclarationExpression(node)!; + DeclarationExpressionSyntax updatedNode = (DeclarationExpressionSyntax)base.VisitDeclarationExpression(node)!; updatedNode = updatedNode.ReplaceAndTrackType(updatedNode.Type, node.Type, SemanticModel.For(node), DiscoveredTypes); @@ -255,7 +257,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter // being parsed. That is, this was a blobal method that was annotated in source. if (node.Identifier == this.currentMethodIdentifier) { - var updatedNode = + LocalFunctionStatementSyntax updatedNode = ((LocalFunctionStatementSyntax)base.VisitLocalFunctionStatement(node)!) .WithBlockBody() .WithAttributeLists(List()); @@ -278,7 +280,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter { this.localFunctionDepth++; - var updatedNode = + LocalFunctionStatementSyntax updatedNode = ((LocalFunctionStatementSyntax)base.VisitLocalFunctionStatement(node)!) .WithBlockBody() .WithAttributeLists(List()) @@ -311,8 +313,8 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter /// public override SyntaxNode VisitMemberAccessExpression(MemberAccessExpressionSyntax node) { - var updatedNode = (MemberAccessExpressionSyntax)base.VisitMemberAccessExpression(node)!; - + MemberAccessExpressionSyntax updatedNode = (MemberAccessExpressionSyntax)base.VisitMemberAccessExpression(node)!; + if (node.IsKind(SyntaxKind.SimpleMemberAccessExpression) && SemanticModel.For(node).GetOperation(node) is IMemberReferenceOperation operation) { @@ -329,8 +331,8 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter ConstantDefinitions[fieldOperation.Field] = ((IFormattable)fieldOperation.Field.ConstantValue!).ToString(null, CultureInfo.InvariantCulture); - var ownerTypeName = ((INamedTypeSymbol)fieldOperation.Field.ContainingSymbol).ToDisplayString().ToHlslIdentifierName(); - var constantName = $"__{ownerTypeName}__{fieldOperation.Field.Name}"; + string ownerTypeName = ((INamedTypeSymbol)fieldOperation.Field.ContainingSymbol).ToDisplayString().ToHlslIdentifierName(); + string constantName = $"__{ownerTypeName}__{fieldOperation.Field.Name}"; return IdentifierName(constantName); } @@ -419,7 +421,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter /// public override SyntaxNode? VisitInvocationExpression(InvocationExpressionSyntax node) { - var updatedNode = (InvocationExpressionSyntax)base.VisitInvocationExpression(node)!; + InvocationExpressionSyntax updatedNode = (InvocationExpressionSyntax)base.VisitInvocationExpression(node)!; if (SemanticModel.For(node).GetOperation(node) is IInvocationOperation { TargetMethod: IMethodSymbol method } operation) { @@ -447,7 +449,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter // updated name is detailed in the override handling the local function statement. if (method.MethodKind == MethodKind.LocalFunction) { - var functionIdentifier = $"__{this.currentMethodIdentifier.Text}__{method.Name}"; + string functionIdentifier = $"__{this.currentMethodIdentifier.Text}__{method.Name}"; return updatedNode.WithExpression(IdentifierName(functionIdentifier)); } @@ -458,7 +460,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter // type as well, as they will be processed by the generator in a different path. if (!SymbolEqualityComparer.Default.Equals(this.shaderType, method.ContainingType)) { - var methodIdentifier = method.GetFullMetadataName().ToHlslIdentifierName(); + string methodIdentifier = method.GetFullMetadataName().ToHlslIdentifierName(); if (!this.staticMethods.ContainsKey(method)) { @@ -503,7 +505,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter { DiscoveredTypes.Add(structTypeSymbol); - var methodIdentifier = method.GetFullMetadataName().ToHlslIdentifierName(); + string methodIdentifier = method.GetFullMetadataName().ToHlslIdentifierName(); // Same as for static methods, ensure the method is available in source, and process it if so if (!this.instanceMethods.ContainsKey(method)) @@ -540,7 +542,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter /// public override SyntaxNode? VisitArgument(ArgumentSyntax node) { - var updatedNode = (ArgumentSyntax)base.VisitArgument(node)!; + ArgumentSyntax updatedNode = (ArgumentSyntax)base.VisitArgument(node)!; // Strip the ref keywords from arguments updatedNode = updatedNode.WithRefKindKeyword(Token(SyntaxKind.None)); @@ -560,8 +562,6 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter return updatedNode; } - - /// /// Rewrites a sampled texture access. /// @@ -584,4 +584,4 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter /// /// The metadata name of the method being invoked. private partial void TrackKnownMethodInvocation(string metadataName); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/StaticFieldRewriter.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/StaticFieldRewriter.cs index 8e9dab94..bdc85dff 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/StaticFieldRewriter.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/StaticFieldRewriter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -12,6 +12,8 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Operations; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +#pragma warning disable IDE0051 + namespace ComputeSharp.SourceGeneration.SyntaxRewriters; /// @@ -49,7 +51,7 @@ internal sealed partial class StaticFieldRewriter : HlslSourceRewriter /// public override SyntaxNode VisitMemberAccessExpression(MemberAccessExpressionSyntax node) { - var updatedNode = (MemberAccessExpressionSyntax)base.VisitMemberAccessExpression(node)!; + MemberAccessExpressionSyntax updatedNode = (MemberAccessExpressionSyntax)base.VisitMemberAccessExpression(node)!; if (node.IsKind(SyntaxKind.SimpleMemberAccessExpression) && SemanticModel.For(node).GetOperation(node) is IMemberReferenceOperation operation) @@ -66,8 +68,8 @@ internal sealed partial class StaticFieldRewriter : HlslSourceRewriter ConstantDefinitions[fieldOperation.Field] = ((IFormattable)fieldOperation.Field.ConstantValue!).ToString(null, CultureInfo.InvariantCulture); - var ownerTypeName = ((INamedTypeSymbol)fieldOperation.Field.ContainingSymbol).ToDisplayString().ToHlslIdentifierName(); - var constantName = $"__{ownerTypeName}__{fieldOperation.Field.Name}"; + string ownerTypeName = ((INamedTypeSymbol)fieldOperation.Field.ContainingSymbol).ToDisplayString().ToHlslIdentifierName(); + string constantName = $"__{ownerTypeName}__{fieldOperation.Field.Name}"; return IdentifierName(constantName); } @@ -92,7 +94,7 @@ internal sealed partial class StaticFieldRewriter : HlslSourceRewriter /// public override SyntaxNode? VisitInvocationExpression(InvocationExpressionSyntax node) { - var updatedNode = (InvocationExpressionSyntax)base.VisitInvocationExpression(node)!; + InvocationExpressionSyntax updatedNode = (InvocationExpressionSyntax)base.VisitInvocationExpression(node)!; if (SemanticModel.For(node).GetOperation(node) is IInvocationOperation operation && operation.TargetMethod is IMethodSymbol method && @@ -116,7 +118,7 @@ internal sealed partial class StaticFieldRewriter : HlslSourceRewriter /// public override SyntaxNode? VisitArgument(ArgumentSyntax node) { - var updatedNode = (ArgumentSyntax)base.VisitArgument(node)!; + ArgumentSyntax updatedNode = (ArgumentSyntax)base.VisitArgument(node)!; updatedNode = updatedNode.WithRefKindKeyword(Token(SyntaxKind.None)); @@ -135,4 +137,4 @@ internal sealed partial class StaticFieldRewriter : HlslSourceRewriter /// /// The metadata name of the method being invoked. private partial void TrackKnownMethodInvocation(string metadataName); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Extensions/AttributeDataExtensions.cs b/src/ComputeSharp.SourceGeneration/Extensions/AttributeDataExtensions.cs index 0130f215..96b3872d 100644 --- a/src/ComputeSharp.SourceGeneration/Extensions/AttributeDataExtensions.cs +++ b/src/ComputeSharp.SourceGeneration/Extensions/AttributeDataExtensions.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Microsoft.CodeAnalysis; namespace ComputeSharp.SourceGeneration.Extensions; @@ -55,4 +55,4 @@ internal static class AttributeDataExtensions return false; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Extensions/CompilationExtensions.cs b/src/ComputeSharp.SourceGeneration/Extensions/CompilationExtensions.cs index 53ac9c6a..01f78575 100644 --- a/src/ComputeSharp.SourceGeneration/Extensions/CompilationExtensions.cs +++ b/src/ComputeSharp.SourceGeneration/Extensions/CompilationExtensions.cs @@ -75,4 +75,4 @@ internal static class CompilationExtensions return false; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Extensions/DiagnosticsExtensions.cs b/src/ComputeSharp.SourceGeneration/Extensions/DiagnosticsExtensions.cs index b1404c61..4d6d3717 100644 --- a/src/ComputeSharp.SourceGeneration/Extensions/DiagnosticsExtensions.cs +++ b/src/ComputeSharp.SourceGeneration/Extensions/DiagnosticsExtensions.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Helpers; using ComputeSharp.SourceGeneration.Models; using Microsoft.CodeAnalysis; @@ -49,10 +49,7 @@ internal static class DiagnosticsExtensions /// The input sequence of diagnostics. public static void ReportDiagnostics(this IncrementalGeneratorInitializationContext context, IncrementalValuesProvider diagnostics) { - context.RegisterSourceOutput(diagnostics, static (context, diagnostic) => - { - context.ReportDiagnostic(diagnostic.ToDiagnostic()); - }); + context.RegisterSourceOutput(diagnostics, static (context, diagnostic) => context.ReportDiagnostic(diagnostic.ToDiagnostic())); } /// @@ -70,4 +67,4 @@ internal static class DiagnosticsExtensions } }); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Extensions/HashCodeExtensions.cs b/src/ComputeSharp.SourceGeneration/Extensions/HashCodeExtensions.cs index 6830252e..15592c78 100644 --- a/src/ComputeSharp.SourceGeneration/Extensions/HashCodeExtensions.cs +++ b/src/ComputeSharp.SourceGeneration/Extensions/HashCodeExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; @@ -37,4 +37,4 @@ internal static class HashCodeExtensions hashCode.Add(item, comparer); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Extensions/IEqualityComparerExtensions.cs b/src/ComputeSharp.SourceGeneration/Extensions/IEqualityComparerExtensions.cs index e76d9a93..ff7734fb 100644 --- a/src/ComputeSharp.SourceGeneration/Extensions/IEqualityComparerExtensions.cs +++ b/src/ComputeSharp.SourceGeneration/Extensions/IEqualityComparerExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; @@ -56,4 +56,4 @@ internal static class IEqualityComparerExtensions return hashCode.ToHashCode(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Extensions/ISymbolExtensions.cs b/src/ComputeSharp.SourceGeneration/Extensions/ISymbolExtensions.cs index 2061543e..15f35756 100644 --- a/src/ComputeSharp.SourceGeneration/Extensions/ISymbolExtensions.cs +++ b/src/ComputeSharp.SourceGeneration/Extensions/ISymbolExtensions.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Text; using Microsoft.CodeAnalysis; @@ -215,6 +215,6 @@ internal static class ISymbolExtensions return accessibility == Accessibility.Public || - accessibility == Accessibility.Internal && symbol.ContainingAssembly.GivesAccessTo(assembly); + (accessibility == Accessibility.Internal && symbol.ContainingAssembly.GivesAccessTo(assembly)); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Extensions/ImmutableArrayExtensions.cs b/src/ComputeSharp.SourceGeneration/Extensions/ImmutableArrayExtensions.cs index a6a11304..9b8b6a77 100644 --- a/src/ComputeSharp.SourceGeneration/Extensions/ImmutableArrayExtensions.cs +++ b/src/ComputeSharp.SourceGeneration/Extensions/ImmutableArrayExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; @@ -47,4 +47,4 @@ internal static class ImmutableArrayExtensions return true; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Extensions/IncrementalValueProviderExtensions.cs b/src/ComputeSharp.SourceGeneration/Extensions/IncrementalValueProviderExtensions.cs index 56dfed31..70c8fbd5 100644 --- a/src/ComputeSharp.SourceGeneration/Extensions/IncrementalValueProviderExtensions.cs +++ b/src/ComputeSharp.SourceGeneration/Extensions/IncrementalValueProviderExtensions.cs @@ -32,4 +32,4 @@ internal static class IncrementalValueProviderExtensions .Combine(source3) .Select(static (items, _) => (items.Left.Left, items.Left.Right, items.Right)); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Helpers/Comparer{T,TSelf}.cs b/src/ComputeSharp.SourceGeneration/Helpers/Comparer{T,TSelf}.cs index 71ee2e1a..000ccd39 100644 --- a/src/ComputeSharp.SourceGeneration/Helpers/Comparer{T,TSelf}.cs +++ b/src/ComputeSharp.SourceGeneration/Helpers/Comparer{T,TSelf}.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -65,4 +65,4 @@ internal abstract class Comparer : IEqualityComparer /// The second instance to compare. /// Whether or not and are equal. protected abstract bool AreEqual(T x, T y); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Helpers/HashCode.cs b/src/ComputeSharp.SourceGeneration/Helpers/HashCode.cs index 94ea71f0..bd2a4c6f 100644 --- a/src/ComputeSharp.SourceGeneration/Helpers/HashCode.cs +++ b/src/ComputeSharp.SourceGeneration/Helpers/HashCode.cs @@ -1,10 +1,10 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Cryptography; -#pragma warning disable CS0809 +#pragma warning disable CS0809, IDE0009, IDE1006, IDE0048 namespace System; @@ -470,12 +470,18 @@ internal struct HashCode /// [Obsolete("HashCode is a mutable struct and should not be compared with other HashCodes. Use ToHashCode to retrieve the computed hash code.", error: true)] [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => throw new NotSupportedException(); + public override int GetHashCode() + { + throw new NotSupportedException(); + } /// [Obsolete("HashCode is a mutable struct and should not be compared with other HashCodes.", error: true)] [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object? obj) => throw new NotSupportedException(); + public override bool Equals(object? obj) + { + throw new NotSupportedException(); + } /// /// Rotates the specified value left by the specified number of bits. diff --git a/src/ComputeSharp.SourceGeneration/Helpers/ImmutableArrayBuilder{T}.cs b/src/ComputeSharp.SourceGeneration/Helpers/ImmutableArrayBuilder{T}.cs index 40eae510..1dfbc2d6 100644 --- a/src/ComputeSharp.SourceGeneration/Helpers/ImmutableArrayBuilder{T}.cs +++ b/src/ComputeSharp.SourceGeneration/Helpers/ImmutableArrayBuilder{T}.cs @@ -17,7 +17,7 @@ internal struct ImmutableArrayBuilder : IDisposable /// /// The shared instance to share objects. /// - private static readonly ObjectPool sharedObjectPool = new(static () => new Writer()); + private static readonly ObjectPool SharedObjectPool = new(static () => new Writer()); /// /// The owner instance. @@ -35,7 +35,7 @@ internal struct ImmutableArrayBuilder : IDisposable /// A instance to write data to. public static ImmutableArrayBuilder Rent() { - return new(sharedObjectPool, sharedObjectPool.Allocate()); + return new(SharedObjectPool, SharedObjectPool.Allocate()); } /// diff --git a/src/ComputeSharp.SourceGeneration/Models/DeferredDiagnosticInfo.cs b/src/ComputeSharp.SourceGeneration/Models/DeferredDiagnosticInfo.cs index 32034299..47d6c1b2 100644 --- a/src/ComputeSharp.SourceGeneration/Models/DeferredDiagnosticInfo.cs +++ b/src/ComputeSharp.SourceGeneration/Models/DeferredDiagnosticInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -16,10 +16,16 @@ namespace ComputeSharp.SourceGeneration.Models; internal sealed record DeferredDiagnosticInfo(DiagnosticDescriptor Descriptor, ImmutableArray Arguments) { /// - public bool Equals(DeferredDiagnosticInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(DeferredDiagnosticInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// Creates a new instance with the specified parameters. @@ -52,4 +58,4 @@ internal sealed record DeferredDiagnosticInfo(DiagnosticDescriptor Descriptor, I x.Arguments.SequenceEqual(y.Arguments); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Models/DiagnosticInfo.cs b/src/ComputeSharp.SourceGeneration/Models/DiagnosticInfo.cs index 6eb80f9a..24937c14 100644 --- a/src/ComputeSharp.SourceGeneration/Models/DiagnosticInfo.cs +++ b/src/ComputeSharp.SourceGeneration/Models/DiagnosticInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -23,10 +23,16 @@ internal sealed record DiagnosticInfo( ImmutableArray Arguments) { /// - public bool Equals(DiagnosticInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(DiagnosticInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// Creates a new instance with the state from this model. @@ -94,4 +100,4 @@ internal sealed record DiagnosticInfo( x.Arguments.SequenceEqual(y.Arguments); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Models/HierarchyInfo.cs b/src/ComputeSharp.SourceGeneration/Models/HierarchyInfo.cs index 511af340..a9450d58 100644 --- a/src/ComputeSharp.SourceGeneration/Models/HierarchyInfo.cs +++ b/src/ComputeSharp.SourceGeneration/Models/HierarchyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -112,10 +112,16 @@ internal sealed partial record HierarchyInfo(string FilenameHint, string FullyQu } /// - public bool Equals(HierarchyInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(HierarchyInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -141,4 +147,4 @@ internal sealed partial record HierarchyInfo(string FilenameHint, string FullyQu x.Hierarchy.SequenceEqual(y.Hierarchy); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration/Models/TypeInfo.cs b/src/ComputeSharp.SourceGeneration/Models/TypeInfo.cs index f6d48c0a..9341a459 100644 --- a/src/ComputeSharp.SourceGeneration/Models/TypeInfo.cs +++ b/src/ComputeSharp.SourceGeneration/Models/TypeInfo.cs @@ -1,4 +1,4 @@ -using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; @@ -39,4 +39,4 @@ internal sealed record TypeInfo(string QualifiedName, TypeKind Kind, bool IsReco _ => ClassDeclaration(QualifiedName) }; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/ComputeSharp/Core/Interfaces/__Internals/IShader.cs b/src/ComputeSharp.SourceGenerators/ComputeSharp/Core/Interfaces/__Internals/IShader.cs index 44644c69..2a41f8d2 100644 --- a/src/ComputeSharp.SourceGenerators/ComputeSharp/Core/Interfaces/__Internals/IShader.cs +++ b/src/ComputeSharp.SourceGenerators/ComputeSharp/Core/Interfaces/__Internals/IShader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; namespace ComputeSharp.__Internals; @@ -10,4 +10,4 @@ namespace ComputeSharp.__Internals; [Obsolete("This interface is not intended to be used directly by user code")] public interface IShader { -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/ComputeSharp/Graphics/Extensions/Interop/HRESULTExtensions.cs b/src/ComputeSharp.SourceGenerators/ComputeSharp/Graphics/Extensions/Interop/HRESULTExtensions.cs index bc125808..da6a898f 100644 --- a/src/ComputeSharp.SourceGenerators/ComputeSharp/Graphics/Extensions/Interop/HRESULTExtensions.cs +++ b/src/ComputeSharp.SourceGenerators/ComputeSharp/Graphics/Extensions/Interop/HRESULTExtensions.cs @@ -1,4 +1,4 @@ -using System.ComponentModel; +using System.ComponentModel; using System.Diagnostics; using TerraFX.Interop.Windows; @@ -32,4 +32,4 @@ internal static class HRESULTExtensions throw new Win32Exception(result); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Diagnostics/Analyzers/InvalidComputeContextCopyAnalyzer.cs b/src/ComputeSharp.SourceGenerators/Diagnostics/Analyzers/InvalidComputeContextCopyAnalyzer.cs index 354d5a3e..392f8d74 100644 --- a/src/ComputeSharp.SourceGenerators/Diagnostics/Analyzers/InvalidComputeContextCopyAnalyzer.cs +++ b/src/ComputeSharp.SourceGenerators/Diagnostics/Analyzers/InvalidComputeContextCopyAnalyzer.cs @@ -53,7 +53,7 @@ public sealed class InvalidComputeContextCopyAnalyzer : DiagnosticAnalyzer if (context.Operation is IArgumentOperation { Parameter.RefKind: RefKind.None } operation) { CheckCopyability(context, operation.Value); - } + } }, OperationKind.Argument); // Returns @@ -63,7 +63,7 @@ public sealed class InvalidComputeContextCopyAnalyzer : DiagnosticAnalyzer { // In the absence of data flow analysis we can treat // return of a local variable or a parameter as a "move" - if (operation.ReturnedValue.Kind is (OperationKind.LocalReference or OperationKind.ParameterReference) && + if (operation.ReturnedValue.Kind is OperationKind.LocalReference or OperationKind.ParameterReference && operation.Kind == OperationKind.Return) { ISymbol? varScope = operation.ReturnedValue.Kind switch @@ -355,7 +355,7 @@ public sealed class InvalidComputeContextCopyAnalyzer : DiagnosticAnalyzer } return - kind is (OperationKind.ObjectCreation or OperationKind.DefaultValue or OperationKind.Literal or OperationKind.Invocation) || - (kind is (OperationKind.None or OperationKind.Invalid) && operation.Syntax is InvocationExpressionSyntax); // Workaround for https://github.com/dotnet/roslyn/issues/49751 + kind is OperationKind.ObjectCreation or OperationKind.DefaultValue or OperationKind.Literal or OperationKind.Invocation || + (kind is OperationKind.None or OperationKind.Invalid && operation.Syntax is InvocationExpressionSyntax); // Workaround for https://github.com/dotnet/roslyn/issues/49751 } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs b/src/ComputeSharp.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs index 3486414b..27588984 100644 --- a/src/ComputeSharp.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs +++ b/src/ComputeSharp.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs @@ -1,4 +1,4 @@ -using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis; namespace ComputeSharp.SourceGeneration.Diagnostics; @@ -729,4 +729,4 @@ partial class DiagnosticDescriptors isEnabledByDefault: true, description: "The ComputeContext type cannot be copied (and values should rather be passed via ref readonly or in instead) and cannot be used as a field of value types (as it could be indirectly copied).", helpLinkUri: "https://github.com/Sergio0694/ComputeSharp"); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Helpers/SyntaxFactoryHelper.cs b/src/ComputeSharp.SourceGenerators/Helpers/SyntaxFactoryHelper.cs index e679b445..166c6579 100644 --- a/src/ComputeSharp.SourceGenerators/Helpers/SyntaxFactoryHelper.cs +++ b/src/ComputeSharp.SourceGenerators/Helpers/SyntaxFactoryHelper.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -38,4 +38,4 @@ internal static class SyntaxFactoryHelper LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(group.A)), LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(group.B))))).ToArray())); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.Syntax.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.Syntax.cs index 94c7b991..e83b3614 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.Syntax.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.Syntax.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Collections.Immutable; using System.Text; using ComputeSharp.__Internals; @@ -96,12 +96,12 @@ partial class IShaderGenerator void AppendLF() { - textBuilder.Append('\n'); + _ = textBuilder.Append('\n'); } void AppendLine(string text) { - textBuilder.Append(text); + _ = textBuilder.Append(text); } void AppendParsedStatement(string text) @@ -117,7 +117,7 @@ partial class IShaderGenerator { string hlslSource = textBuilder.ToString(); - textBuilder.Append(hlslSource); + _ = textBuilder.Append(hlslSource); sizeHint += textBuilder.Length; @@ -133,7 +133,7 @@ partial class IShaderGenerator MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName("builder"), IdentifierName("Append"))) .AddArgumentListArguments(Argument(LiteralExpression(SyntaxKind.StringLiteralExpression, hlslSourceLiteralExpression))))); - textBuilder.Clear(); + _ = textBuilder.Clear(); } } @@ -154,7 +154,7 @@ partial class IShaderGenerator prologueStatements++; // .Add(""); - foreach (var item in items) + foreach (string item in items) { statements.Add( ExpressionStatement( @@ -296,4 +296,4 @@ partial class IShaderGenerator return statements.ToImmutable(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.cs index 03aa3fb3..d17e02e8 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -58,20 +58,20 @@ partial class IShaderGenerator } // Explore the syntax tree and extract the processed info - var semanticModelProvider = new SemanticModelProvider(compilation); - var pixelShaderSymbol = structDeclarationSymbol.AllInterfaces.FirstOrDefault(static interfaceSymbol => interfaceSymbol is { IsGenericType: true, Name: nameof(IPixelShader) }); - var isComputeShader = pixelShaderSymbol is null; - var implicitTextureType = isComputeShader ? null : HlslKnownTypes.GetMappedNameForPixelShaderType(pixelShaderSymbol!); - var (resourceFields, valueFields) = GetInstanceFields(diagnostics, structDeclarationSymbol, discoveredTypes, isComputeShader); - var delegateInstanceFields = GetDispatchId.GetInfo(structDeclarationSymbol); - var sharedBuffers = GetSharedBuffers(diagnostics, structDeclarationSymbol, discoveredTypes); - var (entryPoint, processedMethods, isSamplerUsed) = GetProcessedMethods(diagnostics, structDeclaration, structDeclarationSymbol, semanticModelProvider, discoveredTypes, staticMethods, instanceMethods, constantDefinitions, isComputeShader); - var implicitSamplerField = isSamplerUsed ? ("SamplerState", "__sampler") : default((string, string)?); - var staticFields = GetStaticFields(diagnostics, semanticModelProvider, structDeclaration, structDeclarationSymbol, discoveredTypes, constantDefinitions); + SemanticModelProvider semanticModelProvider = new(compilation); + INamedTypeSymbol? pixelShaderSymbol = structDeclarationSymbol.AllInterfaces.FirstOrDefault(static interfaceSymbol => interfaceSymbol is { IsGenericType: true, Name: nameof(IPixelShader) }); + bool isComputeShader = pixelShaderSymbol is null; + string? implicitTextureType = isComputeShader ? null : HlslKnownTypes.GetMappedNameForPixelShaderType(pixelShaderSymbol!); + (ImmutableArray<(string MetadataName, string Name, string HlslType)> resourceFields, ImmutableArray<(string Name, string HlslType)> valueFields) = GetInstanceFields(diagnostics, structDeclarationSymbol, discoveredTypes, isComputeShader); + ImmutableArray delegateInstanceFields = GetDispatchId.GetInfo(structDeclarationSymbol); + ImmutableArray<(string Name, string Type, int? Count)> sharedBuffers = GetSharedBuffers(diagnostics, structDeclarationSymbol, discoveredTypes); + (string entryPoint, ImmutableArray<(string Signature, string Definition)> processedMethods, bool isSamplerUsed) = GetProcessedMethods(diagnostics, structDeclaration, structDeclarationSymbol, semanticModelProvider, discoveredTypes, staticMethods, instanceMethods, constantDefinitions, isComputeShader); + (string, string)? implicitSamplerField = isSamplerUsed ? ("SamplerState", "__sampler") : default((string, string)?); + ImmutableArray<(string Name, string TypeDeclaration, string? Assignment)> staticFields = GetStaticFields(diagnostics, semanticModelProvider, structDeclaration, structDeclarationSymbol, discoveredTypes, constantDefinitions); // Process the discovered types and constants - var declaredTypes = GetDeclaredTypes(diagnostics, structDeclarationSymbol, discoveredTypes, instanceMethods); - var definedConstants = GetDefinedConstants(constantDefinitions); + ImmutableArray<(string Name, string Definition)> declaredTypes = GetDeclaredTypes(diagnostics, structDeclarationSymbol, discoveredTypes, instanceMethods); + ImmutableArray<(string Name, string Value)> definedConstants = GetDefinedConstants(constantDefinitions); // Get the HLSL source data with the intermediate info return GetHlslSourceInfo( @@ -111,7 +111,7 @@ partial class IShaderGenerator bool hlslResourceFound = false; - foreach (var fieldSymbol in structDeclarationSymbol.GetMembers().OfType()) + foreach (IFieldSymbol fieldSymbol in structDeclarationSymbol.GetMembers().OfType()) { if (fieldSymbol.IsStatic) { @@ -202,9 +202,9 @@ partial class IShaderGenerator { using ImmutableArrayBuilder<(string, string, string?)> builder = ImmutableArrayBuilder<(string, string, string?)>.Rent(); - foreach (var fieldDeclaration in structDeclaration.Members.OfType()) + foreach (FieldDeclarationSyntax fieldDeclaration in structDeclaration.Members.OfType()) { - foreach (var variableDeclarator in fieldDeclaration.Declaration.Variables) + foreach (VariableDeclaratorSyntax variableDeclarator in fieldDeclaration.Declaration.Variables) { IFieldSymbol fieldSymbol = (IFieldSymbol)semanticModel.For(variableDeclarator).GetDeclaredSymbol(variableDeclarator)!; @@ -266,7 +266,7 @@ partial class IShaderGenerator { using ImmutableArrayBuilder<(string, string, int?)> builder = ImmutableArrayBuilder<(string, string, int?)>.Rent(); - foreach (var fieldSymbol in structDeclarationSymbol.GetMembers().OfType()) + foreach (IFieldSymbol fieldSymbol in structDeclarationSymbol.GetMembers().OfType()) { if (!fieldSymbol.IsStatic) { @@ -340,7 +340,7 @@ partial class IShaderGenerator using ImmutableArrayBuilder<(string, string)> methods = ImmutableArrayBuilder<(string, string)>.Rent(); - string ? entryPoint = null; + string? entryPoint = null; bool isSamplerUsed = false; foreach (MethodDeclarationSyntax methodDeclaration in methodDeclarations) @@ -382,7 +382,7 @@ partial class IShaderGenerator isSamplerUsed = isSamplerUsed || shaderSourceRewriter.IsSamplerUsed; // Emit the extracted local functions first - foreach (var localFunction in shaderSourceRewriter.LocalFunctions) + foreach (KeyValuePair localFunction in shaderSourceRewriter.LocalFunctions) { methods.Add(( localFunction.Value.AsDefinition().NormalizeWhitespace(eol: "\n").ToFullString(), @@ -428,10 +428,10 @@ partial class IShaderGenerator { using ImmutableArrayBuilder<(string, string)> builder = ImmutableArrayBuilder<(string, string)>.Rent(); - foreach (var constant in constantDefinitions) + foreach (KeyValuePair constant in constantDefinitions) { - var ownerTypeName = ((INamedTypeSymbol)constant.Key.ContainingSymbol).ToDisplayString().ToHlslIdentifierName(); - var constantName = $"__{ownerTypeName}__{constant.Key.Name}"; + string ownerTypeName = ((INamedTypeSymbol)constant.Key.ContainingSymbol).ToDisplayString().ToHlslIdentifierName(); + string constantName = $"__{ownerTypeName}__{constant.Key.Name}"; builder.Add((constantName, constant.Value)); } @@ -455,18 +455,21 @@ partial class IShaderGenerator { using ImmutableArrayBuilder<(string, string)> builder = ImmutableArrayBuilder<(string, string)>.Rent(); - IReadOnlyCollection invalidTypes; + IReadOnlyCollection invalidTypes; // Process the discovered types - foreach (var type in HlslKnownTypes.GetCustomTypes(types, out invalidTypes)) + foreach (INamedTypeSymbol type in HlslKnownTypes.GetCustomTypes(types, out invalidTypes)) { - var structType = type.GetFullMetadataName().ToHlslIdentifierName(); - var structDeclaration = StructDeclaration(structType); + string structType = type.GetFullMetadataName().ToHlslIdentifierName(); + StructDeclarationSyntax structDeclaration = StructDeclaration(structType); // Declare the fields of the current type - foreach (var field in type.GetMembers().OfType()) + foreach (IFieldSymbol field in type.GetMembers().OfType()) { - if (field.IsStatic) continue; + if (field.IsStatic) + { + continue; + } INamedTypeSymbol fieldType = (INamedTypeSymbol)field.Type; @@ -489,7 +492,7 @@ partial class IShaderGenerator } // Declare the methods of the current type - foreach (var method in instanceMethods.Where(pair => SymbolEqualityComparer.Default.Equals(pair.Key.ContainingType, type))) + foreach (KeyValuePair method in instanceMethods.Where(pair => SymbolEqualityComparer.Default.Equals(pair.Key.ContainingType, type))) { structDeclaration = structDeclaration.AddMembers(method.Value); } @@ -519,7 +522,7 @@ partial class IShaderGenerator /// The input instance to process. private static void DetectAndReportInvalidPropertyDeclarations(ImmutableArrayBuilder diagnostics, INamedTypeSymbol structDeclarationSymbol) { - foreach (var memberSymbol in structDeclarationSymbol.GetMembers()) + foreach (ISymbol memberSymbol in structDeclarationSymbol.GetMembers()) { // Detect properties that are not explicit interface implementations if (memberSymbol is IPropertySymbol { ExplicitInterfaceImplementations.IsEmpty: true }) @@ -570,31 +573,31 @@ partial class IShaderGenerator void AppendLF() { - hlslBuilder.Append('\n'); + _ = hlslBuilder.Append('\n'); } void AppendLine(string text) { - hlslBuilder.Append(text); + _ = hlslBuilder.Append(text); } void AppendLineAndLF(string text) { - hlslBuilder.Append(text); - hlslBuilder.Append('\n'); + _ = hlslBuilder.Append(text); + _ = hlslBuilder.Append('\n'); } void AppendCharacterAndLF(char c) { - hlslBuilder.Append(c); - hlslBuilder.Append('\n'); + _ = hlslBuilder.Append(c); + _ = hlslBuilder.Append('\n'); } string FlushText() { string text = hlslBuilder.ToString(); - hlslBuilder.Clear(); + _ = hlslBuilder.Clear(); return text; } @@ -625,7 +628,7 @@ partial class IShaderGenerator AppendLF(); // Define declarations - foreach (var (name, value) in definedConstants) + foreach ((string name, string value) in definedConstants) { AppendLineAndLF($"#define {name} {value}"); } @@ -637,7 +640,7 @@ partial class IShaderGenerator { AppendLF(); - foreach (var field in staticFields) + foreach ((string Name, string TypeDeclaration, string? Assignment) field in staticFields) { if (field.Assignment is string assignment) { @@ -651,7 +654,7 @@ partial class IShaderGenerator } // Declared types - foreach (var (_, typeDefinition) in declaredTypes) + foreach ((string _, string typeDefinition) in declaredTypes) { AppendLF(); AppendLineAndLF(typeDefinition); @@ -672,7 +675,7 @@ partial class IShaderGenerator } // User-defined values - foreach (var (fieldName, fieldType) in valueFields) + foreach ((string fieldName, string fieldType) in valueFields) { AppendLineAndLF($" {fieldType} {fieldName};"); } @@ -698,7 +701,7 @@ partial class IShaderGenerator } // Resources - foreach (var (metadataName, fieldName, fieldType) in resourceFields) + foreach ((string metadataName, string fieldName, string fieldType) in resourceFields) { if (HlslKnownTypes.IsConstantBufferType(metadataName)) { @@ -721,7 +724,7 @@ partial class IShaderGenerator } // Shared buffers - foreach (var (bufferName, bufferType, bufferCount) in sharedBuffers) + foreach ((string bufferName, string bufferType, int? bufferCount) in sharedBuffers) { object count = (object?)bufferCount ?? "__GroupSize__get_X * __GroupSize__get_Y * __GroupSize__get_Z"; @@ -730,7 +733,7 @@ partial class IShaderGenerator } // Forward declarations - foreach (var (forwardDeclaration, _) in processedMethods) + foreach ((string forwardDeclaration, string _) in processedMethods) { AppendLF(); AppendLineAndLF(forwardDeclaration); @@ -739,7 +742,7 @@ partial class IShaderGenerator string capturedFieldsAndResourcesAndForwardDeclarations = FlushText(); // Captured methods - foreach (var (_, method) in processedMethods) + foreach ((string _, string method) in processedMethods) { AppendLF(); AppendLineAndLF(method); @@ -789,4 +792,4 @@ partial class IShaderGenerator hlslSourceInfo.EntryPoint; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateGetDispatchIdMethod.Syntax.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateGetDispatchIdMethod.Syntax.cs index 974dcb73..59e59acd 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateGetDispatchIdMethod.Syntax.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateGetDispatchIdMethod.Syntax.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.__Internals; using Microsoft.CodeAnalysis.CSharp; @@ -94,4 +94,4 @@ partial class IShaderGenerator return Block(blockStatements); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateGetDispatchIdMethod.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateGetDispatchIdMethod.cs index 589a926d..8485f16a 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateGetDispatchIdMethod.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateGetDispatchIdMethod.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis; @@ -28,4 +28,4 @@ partial class IShaderGenerator .ToImmutableArray(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadBytecodeMethod.Syntax.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadBytecodeMethod.Syntax.cs index 544c1189..799c5edb 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadBytecodeMethod.Syntax.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadBytecodeMethod.Syntax.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; using ComputeSharp.__Internals; using ComputeSharp.SourceGeneration.Helpers; @@ -211,7 +211,7 @@ partial class IShaderGenerator /// /// A mapping of precomputed literals for all values. /// - private static readonly string[] formattedBytes = + private static readonly string[] FormattedBytes = { "0x00", "0x01", "0x02", "0x03", "0x04", "0x05", "0x06", "0x07", "0x08", "0x09", "0x0A", "0x0B", "0x0C", "0x0D", "0x0E", "0x0F", "0x10", "0x11", "0x12", "0x13", "0x14", "0x15", "0x16", "0x17", "0x18", "0x19", "0x1A", "0x1B", "0x1C", "0x1D", "0x1E", "0x1F", @@ -240,15 +240,15 @@ partial class IShaderGenerator { using ImmutableArrayBuilder builder = ImmutableArrayBuilder.Rent(); - builder.AddRange(formattedBytes[bytecode[0]].AsSpan()); + builder.AddRange(FormattedBytes[bytecode[0]].AsSpan()); foreach (byte b in bytecode.Slice(1)) { builder.AddRange(", ".AsSpan()); - builder.AddRange(formattedBytes[b].AsSpan()); + builder.AddRange(FormattedBytes[b].AsSpan()); } return builder.ToString(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadBytecodeMethod.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadBytecodeMethod.cs index 61b70547..4c432101 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadBytecodeMethod.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadBytecodeMethod.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Immutable; using System.ComponentModel; using System.Globalization; @@ -224,7 +224,7 @@ partial class IShaderGenerator string sourceFilename = $"ComputeSharp.SourceGenerators.ComputeSharp.Libraries.{rid}.{name}.dll"; string targetFilename = Path.Combine(folder, rid, $"{name}.dll"); - Directory.CreateDirectory(Path.GetDirectoryName(targetFilename)); + _ = Directory.CreateDirectory(Path.GetDirectoryName(targetFilename)); using Stream sourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(sourceFilename); @@ -276,4 +276,4 @@ partial class IShaderGenerator } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchDataMethod.Syntax.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchDataMethod.Syntax.cs index 8684d2cc..7a52ad3f 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchDataMethod.Syntax.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchDataMethod.Syntax.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using ComputeSharp.__Internals; using ComputeSharp.SourceGeneration.Helpers; using ComputeSharp.SourceGenerators.Models; @@ -234,6 +234,7 @@ partial class IShaderGenerator ParseExpression($"global::System.Runtime.CompilerServices.Unsafe.As(ref global::System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref r0, (nint){matrix.Offsets[j]}))"), ParseExpression($"global::System.Runtime.CompilerServices.Unsafe.Add(ref {rowLocalName}, {j})")))); } + break; } } @@ -264,4 +265,4 @@ partial class IShaderGenerator return statements.ToImmutable(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchDataMethod.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchDataMethod.cs index 298f27e4..cb2604f7 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchDataMethod.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchDataMethod.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -81,7 +81,7 @@ partial class IShaderGenerator else if (fieldSymbol.Type.IsUnmanagedType) { // Custom struct type defined by the user - foreach (var fieldInfo in GetCapturedFieldInfos(fieldSymbol.Type, fieldPath.Add(fieldName), resourceOffset, rawDataOffset)) + foreach (FieldInfo fieldInfo in GetCapturedFieldInfos(fieldSymbol.Type, fieldPath.Add(fieldName), resourceOffset, rawDataOffset)) { yield return fieldInfo; } @@ -142,7 +142,7 @@ partial class IShaderGenerator { // For scalar, vector and linear matrix types, serialize the value normally. // Only the initial alignment needs to be considered, while data is packed. - var (fieldSize, fieldPack) = HlslKnownSizes.GetTypeInfo(typeName); + (int fieldSize, int fieldPack) = HlslKnownSizes.GetTypeInfo(typeName); // Check if the current type is a matrix type with more than one row. In this // case, each row is aligned as if it was a separate array, so the start of @@ -157,7 +157,7 @@ partial class IShaderGenerator builder.Add(startingRawDataOffset); - rawDataOffset = startingRawDataOffset + fieldPack * columns; + rawDataOffset = startingRawDataOffset + (fieldPack * columns); } return new FieldInfo.NonLinearMatrix( @@ -185,4 +185,4 @@ partial class IShaderGenerator } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchMetadataMethod.Syntax.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchMetadataMethod.Syntax.cs index a6807487..9af3d88d 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchMetadataMethod.Syntax.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchMetadataMethod.Syntax.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Immutable; using System.Globalization; using ComputeSharp.__Internals; @@ -44,7 +44,7 @@ partial class IShaderGenerator .WithType(IdentifierName("TLoader")), Parameter(Identifier("result")) .AddModifiers(Token(SyntaxKind.OutKeyword)) - .WithType(IdentifierName($"global::System.{typeof(IntPtr).Name}"))) + .WithType(IdentifierName($"global::System.{nameof(IntPtr)}"))) .WithBody(Block(GetDispatchMetadataLoadingStatements(metadataInfo))); } @@ -122,7 +122,6 @@ partial class IShaderGenerator statements.Add(ParseStatement($"global::System.Runtime.CompilerServices.Unsafe.WriteUnaligned(ref global::System.Runtime.CompilerServices.Unsafe.Add(ref r0, 0), {metadataInfo.Root32BitConstantCount});")); statements.Add(ParseStatement($"global::System.Runtime.CompilerServices.Unsafe.WriteUnaligned(ref global::System.Runtime.CompilerServices.Unsafe.Add(ref r0, 4), {metadataInfo.IsSamplerUsed.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()});")); - // Populate the sequence of resource descriptors foreach (ResourceDescriptor descriptor in metadataInfo.ResourceDescriptors) { @@ -135,4 +134,4 @@ partial class IShaderGenerator return statements.ToImmutable(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchMetadataMethod.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchMetadataMethod.cs index c0f2a926..a611cfd5 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchMetadataMethod.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateLoadDispatchMetadataMethod.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Helpers; using ComputeSharp.SourceGeneration.Mappings; using ComputeSharp.SourceGenerators.Models; @@ -63,4 +63,4 @@ partial class IShaderGenerator descriptors.ToImmutable()); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.Helpers.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.Helpers.cs index 62efe0a5..48b9fb0b 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.Helpers.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.Helpers.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using ComputeSharp.SourceGeneration.Models; using ComputeSharp.SourceGenerators.Models; @@ -94,4 +94,4 @@ partial class IShaderGenerator return hierarchyInfo.GetSyntax(methodDeclaration.AddAttributeLists(attributes.ToArray())); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.cs index f10dc388..569bd3ee 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -136,7 +136,7 @@ public sealed partial class IShaderGenerator : IIncrementalGenerator }); // Get the LoadDispatchData() info (hierarchy and dispatch data info) - IncrementalValuesProvider<((HierarchyInfo Hierarchy, DispatchDataInfo DispatchData) Info, bool CanUseSkipLocalsInit) > dispatchDataInfo = + IncrementalValuesProvider<((HierarchyInfo Hierarchy, DispatchDataInfo DispatchData) Info, bool CanUseSkipLocalsInit)> dispatchDataInfo = shaderInfoWithErrors .Select(static (item, _) => (item.Hierarchy, item.DispatchData)) .Combine(canUseSkipLocalsInit); @@ -244,4 +244,4 @@ public sealed partial class IShaderGenerator : IIncrementalGenerator context.AddSource($"{item.Info.Hierarchy.FilenameHint}.{nameof(LoadBytecode)}.g.cs", text); }); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownKeywords.cs b/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownKeywords.cs index 40ce2cbb..43e321e9 100644 --- a/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownKeywords.cs +++ b/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownKeywords.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace ComputeSharp.SourceGeneration.Mappings; @@ -14,4 +14,4 @@ internal static partial class HlslKnownKeywords knownKeywords.Add(nameof(GroupSize)); knownKeywords.Add(nameof(GridIds)); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownMethods.cs b/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownMethods.cs index b1f16b0b..3f83ba16 100644 --- a/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownMethods.cs +++ b/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownMethods.cs @@ -27,4 +27,4 @@ partial class HlslKnownMethods [$"ComputeSharp.IReadOnlyNormalizedTexture3D`1.Sample({typeof(Float3).FullName})"] = null }; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownProperties.cs b/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownProperties.cs index 531893de..0d85be99 100644 --- a/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownProperties.cs +++ b/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownProperties.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -72,7 +72,7 @@ partial class HlslKnownProperties PropertyInfo groupindexProperty = typeof(GroupIds).GetProperty(nameof(GroupIds.Index), BindingFlags.Static | BindingFlags.Public); // Programmatically load mappings for the dispatch types - foreach (var item in + foreach ((Type Type, PropertyInfo Property) item in from type in HlslKnownTypes.HlslDispatchTypes from property in type.GetProperties(BindingFlags.Static | BindingFlags.Public) select (Type: type, Property: property)) @@ -90,9 +90,9 @@ partial class HlslKnownProperties } // Programmatically load mappings for the normalized thread ids - foreach (var property in typeof(ThreadIds.Normalized).GetProperties(BindingFlags.Static | BindingFlags.Public)) + foreach (PropertyInfo? property in typeof(ThreadIds.Normalized).GetProperties(BindingFlags.Static | BindingFlags.Public)) { - string key = $"{typeof(ThreadIds).FullName}{Type.Delimiter}{typeof(ThreadIds.Normalized).Name}{Type.Delimiter}{property.Name}"; + string key = $"{typeof(ThreadIds).FullName}{Type.Delimiter}{nameof(ThreadIds.Normalized)}{Type.Delimiter}{property.Name}"; // The normalized value must be in the [0, 1] range, inclusive. As such, the expression is rewritten to be: // 1D: (float)ThreadIds. / (float)(max(1, __ - 1)); @@ -105,11 +105,11 @@ partial class HlslKnownProperties switch (property.Name) { case string name when name.Length == 1: - knownProperties.Add(key, $"(float){typeof(ThreadIds).Name}.{char.ToLowerInvariant(name[0])} / (float)(max(1, __{char.ToLowerInvariant(name[0])} - 1))"); + knownProperties.Add(key, $"(float){nameof(ThreadIds)}.{char.ToLowerInvariant(name[0])} / (float)(max(1, __{char.ToLowerInvariant(name[0])} - 1))"); break; case string name when name.Length == 2: { - string numerator = $"float2({typeof(ThreadIds).Name}.{char.ToLowerInvariant(name[0])}, {typeof(ThreadIds).Name}.{char.ToLowerInvariant(name[1])})"; + string numerator = $"float2({nameof(ThreadIds)}.{char.ToLowerInvariant(name[0])}, {nameof(ThreadIds)}.{char.ToLowerInvariant(name[1])})"; string denominator = $"float2(max(1, int2(__{char.ToLowerInvariant(name[0])}, __{char.ToLowerInvariant(name[1])}) - 1))"; knownProperties.Add(key, $"{numerator} / {denominator}"); @@ -117,7 +117,7 @@ partial class HlslKnownProperties } case string name when name.Length == 3: { - string numerator = $"float3({typeof(ThreadIds).Name}.{char.ToLowerInvariant(name[0])}, {typeof(ThreadIds).Name}.{char.ToLowerInvariant(name[1])}, {typeof(ThreadIds).Name}.{char.ToLowerInvariant(name[2])})"; + string numerator = $"float3({nameof(ThreadIds)}.{char.ToLowerInvariant(name[0])}, {nameof(ThreadIds)}.{char.ToLowerInvariant(name[1])}, {nameof(ThreadIds)}.{char.ToLowerInvariant(name[2])})"; string denominator = $"float3(max(1, int3(__{char.ToLowerInvariant(name[0])}, __{char.ToLowerInvariant(name[1])}, __{char.ToLowerInvariant(name[2])}) - 1))"; knownProperties.Add(key, $"{numerator} / {denominator}"); @@ -127,7 +127,7 @@ partial class HlslKnownProperties } // Programmatically load mappings for the group size - foreach (var property in typeof(GroupSize).GetProperties(BindingFlags.Static | BindingFlags.Public)) + foreach (PropertyInfo? property in typeof(GroupSize).GetProperties(BindingFlags.Static | BindingFlags.Public)) { string key = $"{typeof(GroupSize).FullName}{Type.Delimiter}{property.Name}"; @@ -149,7 +149,7 @@ partial class HlslKnownProperties } // Programmatically load mappings for the dispatch size - foreach (var property in typeof(DispatchSize).GetProperties(BindingFlags.Static | BindingFlags.Public)) + foreach (PropertyInfo? property in typeof(DispatchSize).GetProperties(BindingFlags.Static | BindingFlags.Public)) { string key = $"{typeof(DispatchSize).FullName}{Type.Delimiter}{property.Name}"; @@ -170,4 +170,4 @@ partial class HlslKnownProperties } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownTypes.cs b/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownTypes.cs index e8d318a6..5456019b 100644 --- a/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownTypes.cs +++ b/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownTypes.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using ComputeSharp.SourceGeneration.Extensions; @@ -38,8 +38,8 @@ partial class HlslKnownTypes { return typeName switch { - "ComputeSharp.ConstantBuffer`1" or - "ComputeSharp.ReadOnlyBuffer`1" or + "ComputeSharp.ConstantBuffer`1" or + "ComputeSharp.ReadOnlyBuffer`1" or "ComputeSharp.ReadWriteBuffer`1" => true, _ => false }; @@ -136,7 +136,10 @@ partial class HlslKnownTypes { // Delegate types just return an empty string, as they're not actually // used in the generated shaders, but just mapped to a function at runtime. - if (typeSymbol.TypeKind == TypeKind.Delegate) return ""; + if (typeSymbol.TypeKind == TypeKind.Delegate) + { + return ""; + } string typeName = typeSymbol.GetFullMetadataName(); @@ -210,4 +213,4 @@ partial class HlslKnownTypes // Construct the HLSL type name return $"RWTexture2D"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Models/DispatchDataInfo.cs b/src/ComputeSharp.SourceGenerators/Models/DispatchDataInfo.cs index e733ea62..4d9e53b0 100644 --- a/src/ComputeSharp.SourceGenerators/Models/DispatchDataInfo.cs +++ b/src/ComputeSharp.SourceGenerators/Models/DispatchDataInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -20,10 +20,16 @@ internal sealed record DispatchDataInfo( int Root32BitConstantCount) { /// - public bool Equals(DispatchDataInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(DispatchDataInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -49,4 +55,4 @@ internal sealed record DispatchDataInfo( x.Root32BitConstantCount == y.Root32BitConstantCount; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Models/DispatchIdInfo.cs b/src/ComputeSharp.SourceGenerators/Models/DispatchIdInfo.cs index d0b590cb..c28aa8b2 100644 --- a/src/ComputeSharp.SourceGenerators/Models/DispatchIdInfo.cs +++ b/src/ComputeSharp.SourceGenerators/Models/DispatchIdInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -13,10 +13,16 @@ namespace ComputeSharp.SourceGenerators.Models; internal sealed record DispatchIdInfo(ImmutableArray Delegates) { /// - public bool Equals(DispatchIdInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(DispatchIdInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -35,4 +41,4 @@ internal sealed record DispatchIdInfo(ImmutableArray Delegates) return x.Delegates.SequenceEqual(y.Delegates); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Models/DispatchMetadataInfo.cs b/src/ComputeSharp.SourceGenerators/Models/DispatchMetadataInfo.cs index 93ca74ff..8ebe65d7 100644 --- a/src/ComputeSharp.SourceGenerators/Models/DispatchMetadataInfo.cs +++ b/src/ComputeSharp.SourceGenerators/Models/DispatchMetadataInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -18,10 +18,16 @@ internal sealed record DispatchMetadataInfo( ImmutableArray ResourceDescriptors) { /// - public bool Equals(DispatchMetadataInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(DispatchMetadataInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . diff --git a/src/ComputeSharp.SourceGenerators/Models/EmbeddedBytecodeInfo.cs b/src/ComputeSharp.SourceGenerators/Models/EmbeddedBytecodeInfo.cs index ca2f6093..50c2dee6 100644 --- a/src/ComputeSharp.SourceGenerators/Models/EmbeddedBytecodeInfo.cs +++ b/src/ComputeSharp.SourceGenerators/Models/EmbeddedBytecodeInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -16,10 +16,16 @@ namespace ComputeSharp.SourceGenerators.Models; internal sealed record EmbeddedBytecodeInfo(int X, int Y, int Z, ImmutableArray Bytecode) { /// - public bool Equals(EmbeddedBytecodeInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(EmbeddedBytecodeInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -45,4 +51,4 @@ internal sealed record EmbeddedBytecodeInfo(int X, int Y, int Z, ImmutableArray< x.Bytecode.SequenceEqual(y.Bytecode); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Models/FieldInfo.cs b/src/ComputeSharp.SourceGenerators/Models/FieldInfo.cs index 44344c73..c24c7744 100644 --- a/src/ComputeSharp.SourceGenerators/Models/FieldInfo.cs +++ b/src/ComputeSharp.SourceGenerators/Models/FieldInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -20,10 +20,16 @@ internal abstract record FieldInfo public sealed record Resource(string FieldName, string TypeName, int Offset) : FieldInfo { /// - public bool Equals(Resource? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(Resource? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -58,10 +64,16 @@ internal abstract record FieldInfo public sealed record Primitive(ImmutableArray FieldPath, string TypeName, int Offset) : FieldInfo { /// - public bool Equals(Primitive? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(Primitive? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -105,10 +117,16 @@ internal abstract record FieldInfo ImmutableArray Offsets) : FieldInfo { /// - public bool Equals(NonLinearMatrix? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(NonLinearMatrix? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -139,4 +157,4 @@ internal abstract record FieldInfo } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Models/HlslMethodSourceInfo.cs b/src/ComputeSharp.SourceGenerators/Models/HlslMethodSourceInfo.cs index ca4b2921..52a7f469 100644 --- a/src/ComputeSharp.SourceGenerators/Models/HlslMethodSourceInfo.cs +++ b/src/ComputeSharp.SourceGenerators/Models/HlslMethodSourceInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -22,10 +22,16 @@ internal sealed record HlslMethodSourceInfo( ImmutableArray<(string Signature, string Definition)> DependentMethods) { /// - public bool Equals(HlslMethodSourceInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(HlslMethodSourceInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -53,4 +59,4 @@ internal sealed record HlslMethodSourceInfo( x.DependentMethods.SequenceEqual(y.DependentMethods); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Models/HlslShaderSourceInfo.cs b/src/ComputeSharp.SourceGenerators/Models/HlslShaderSourceInfo.cs index bf44b779..67ba89dc 100644 --- a/src/ComputeSharp.SourceGenerators/Models/HlslShaderSourceInfo.cs +++ b/src/ComputeSharp.SourceGenerators/Models/HlslShaderSourceInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -40,10 +40,16 @@ internal sealed record HlslShaderSourceInfo( ImmutableArray Delegates) { /// - public bool Equals(HlslShaderSourceInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(HlslShaderSourceInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -89,4 +95,4 @@ internal sealed record HlslShaderSourceInfo( x.Delegates.SequenceEqual(y.Delegates); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Models/ResourceDescriptor.cs b/src/ComputeSharp.SourceGenerators/Models/ResourceDescriptor.cs index a1fd1553..791af20a 100644 --- a/src/ComputeSharp.SourceGenerators/Models/ResourceDescriptor.cs +++ b/src/ComputeSharp.SourceGenerators/Models/ResourceDescriptor.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SourceGenerators.Models; +namespace ComputeSharp.SourceGenerators.Models; /// /// A resource descriptor for a captured resource in a shader. @@ -6,4 +6,4 @@ /// The type id for the resource. /// The offset of the resource in its containing register. /// The offset of the resource descriptor in the shader root signature. -internal sealed record ResourceDescriptor(int TypeId, int RegisterOffset, int Offset); +internal sealed record ResourceDescriptor(int TypeId, int RegisterOffset, int Offset); \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Models/ShaderInfo.cs b/src/ComputeSharp.SourceGenerators/Models/ShaderInfo.cs index fa4613f3..7823f689 100644 --- a/src/ComputeSharp.SourceGenerators/Models/ShaderInfo.cs +++ b/src/ComputeSharp.SourceGenerators/Models/ShaderInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -27,10 +27,16 @@ internal sealed record ShaderInfo( ImmutableArray Diagnostcs) { /// - public bool Equals(ShaderInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(ShaderInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -62,4 +68,4 @@ internal sealed record ShaderInfo( x.Diagnostcs.SequenceEqual(y.Diagnostcs); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Models/ShaderMethodInfo.cs b/src/ComputeSharp.SourceGenerators/Models/ShaderMethodInfo.cs index 0975348f..7fabe44c 100644 --- a/src/ComputeSharp.SourceGenerators/Models/ShaderMethodInfo.cs +++ b/src/ComputeSharp.SourceGenerators/Models/ShaderMethodInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using ComputeSharp.SourceGeneration.Extensions; @@ -15,10 +15,16 @@ namespace ComputeSharp.SourceGenerators.Models; internal sealed record ShaderMethodInfo(HlslMethodSourceInfo HlslMethodSource, ImmutableArray Diagnostcs) { /// - public bool Equals(ShaderMethodInfo? obj) => Comparer.Default.Equals(this, obj); + public bool Equals(ShaderMethodInfo? obj) + { + return Comparer.Default.Equals(this, obj); + } /// - public override int GetHashCode() => Comparer.Default.GetHashCode(this); + public override int GetHashCode() + { + return Comparer.Default.GetHashCode(this); + } /// /// An implementation for . @@ -40,4 +46,4 @@ internal sealed record ShaderMethodInfo(HlslMethodSourceInfo HlslMethodSource, I x.Diagnostcs.SequenceEqual(y.Diagnostcs); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/Models/ShaderType.cs b/src/ComputeSharp.SourceGenerators/Models/ShaderType.cs index f70a62c0..9abb0833 100644 --- a/src/ComputeSharp.SourceGenerators/Models/ShaderType.cs +++ b/src/ComputeSharp.SourceGenerators/Models/ShaderType.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SourceGenerators.Models; +namespace ComputeSharp.SourceGenerators.Models; /// /// Indicates a type of shader being processed. diff --git a/src/ComputeSharp.SourceGenerators/Models/ThreadIdsInfo.cs b/src/ComputeSharp.SourceGenerators/Models/ThreadIdsInfo.cs index 4bca599b..aae33b3d 100644 --- a/src/ComputeSharp.SourceGenerators/Models/ThreadIdsInfo.cs +++ b/src/ComputeSharp.SourceGenerators/Models/ThreadIdsInfo.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.SourceGenerators.Models; +namespace ComputeSharp.SourceGenerators.Models; /// /// A model representing gathered info on a embedded thread ids. @@ -7,4 +7,4 @@ /// The thread ids value for the X axis. /// The thread ids value for the Y axis. /// The thread ids value for the Z axis. -internal sealed record ThreadIdsInfo(bool IsDefault, int X, int Y, int Z); +internal sealed record ThreadIdsInfo(bool IsDefault, int X, int Y, int Z); \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/ShaderMethodSourceGenerator.cs b/src/ComputeSharp.SourceGenerators/ShaderMethodSourceGenerator.cs index 81356654..92128a0d 100644 --- a/src/ComputeSharp.SourceGenerators/ShaderMethodSourceGenerator.cs +++ b/src/ComputeSharp.SourceGenerators/ShaderMethodSourceGenerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -87,10 +87,10 @@ public sealed partial class ShaderMethodSourceGenerator : IIncrementalGenerator Dictionary instanceMethods = new(SymbolEqualityComparer.Default); // Unused in this generator // Explore the syntax tree and extract the processed info - var semanticModel = new SemanticModelProvider(compilation); - var (entryPoint, dependentMethods) = GetProcessedMethods(builder, methodDeclaration, semanticModel, discoveredTypes, constantDefinitions); - var definedTypes = IShaderGenerator.BuildHlslSource.GetDeclaredTypes(builder, methodSymbol, discoveredTypes, instanceMethods); - var definedConstants = IShaderGenerator.BuildHlslSource.GetDefinedConstants(constantDefinitions); + SemanticModelProvider semanticModel = new(compilation); + (string entryPoint, ImmutableArray<(string Signature, string Definition)> dependentMethods) = GetProcessedMethods(builder, methodDeclaration, semanticModel, discoveredTypes, constantDefinitions); + ImmutableArray<(string Name, string Definition)> definedTypes = IShaderGenerator.BuildHlslSource.GetDeclaredTypes(builder, methodSymbol, discoveredTypes, instanceMethods); + ImmutableArray<(string Name, string Value)> definedConstants = IShaderGenerator.BuildHlslSource.GetDefinedConstants(constantDefinitions); diagnostics = builder.ToImmutable(); @@ -140,7 +140,7 @@ public sealed partial class ShaderMethodSourceGenerator : IIncrementalGenerator using ImmutableArrayBuilder<(string, string)> methods = ImmutableArrayBuilder<(string, string)>.Rent(); // Emit the extracted local functions - foreach (var localFunction in shaderSourceRewriter.LocalFunctions) + foreach (KeyValuePair localFunction in shaderSourceRewriter.LocalFunctions) { methods.Add(( localFunction.Value.AsDefinition().NormalizeWhitespace(eol: "\n").ToFullString(), @@ -148,7 +148,7 @@ public sealed partial class ShaderMethodSourceGenerator : IIncrementalGenerator } // Emit the discovered static methods - foreach (var staticMethod in staticMethods.Values) + foreach (MethodDeclarationSyntax staticMethod in staticMethods.Values) { methods.Add(( staticMethod.AsDefinition().NormalizeWhitespace(eol: "\n").ToFullString(), @@ -188,4 +188,4 @@ public sealed partial class ShaderMethodSourceGenerator : IIncrementalGenerator .NormalizeWhitespace(eol: "\n"); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ExecuteMethodRewriter.cs b/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ExecuteMethodRewriter.cs index e26a322c..597869e4 100644 --- a/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ExecuteMethodRewriter.cs +++ b/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ExecuteMethodRewriter.cs @@ -1,4 +1,4 @@ -using ComputeSharp.SourceGeneration.SyntaxRewriters; +using ComputeSharp.SourceGeneration.SyntaxRewriters; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -35,7 +35,7 @@ internal abstract class ExecuteMethodRewriter : CSharpSyntaxRewriter /// public override SyntaxNode? VisitParameterList(ParameterListSyntax node) { - var updatedNode = (ParameterListSyntax)base.VisitParameterList(node)!; + ParameterListSyntax updatedNode = (ParameterListSyntax)base.VisitParameterList(node)!; updatedNode = updatedNode.AddParameters(Parameter(Identifier($"uint3 {nameof(ThreadIds)} : SV_DispatchThreadID"))); @@ -74,7 +74,7 @@ internal abstract class ExecuteMethodRewriter : CSharpSyntaxRewriter /// public override SyntaxNode? VisitMethodDeclaration(MethodDeclarationSyntax node) { - var updatedNode = ((MethodDeclarationSyntax)base.VisitMethodDeclaration(node)!).WithModifiers(TokenList()); + MethodDeclarationSyntax updatedNode = ((MethodDeclarationSyntax)base.VisitMethodDeclaration(node)!).WithModifiers(TokenList()); // When we're rewriting the main compute shader method, we need to insert a range // check to ensure that invocation outside of the requested range are discarded. @@ -129,7 +129,7 @@ internal abstract class ExecuteMethodRewriter : CSharpSyntaxRewriter /// public override SyntaxNode? VisitReturnStatement(ReturnStatementSyntax node) { - var updatedNode = (ReturnStatementSyntax)base.VisitReturnStatement(node)!; + ReturnStatementSyntax updatedNode = (ReturnStatementSyntax)base.VisitReturnStatement(node)!; // { // __outputTexture[ThreadIds.xy] = ; @@ -154,7 +154,7 @@ internal abstract class ExecuteMethodRewriter : CSharpSyntaxRewriter /// public override SyntaxNode? VisitMethodDeclaration(MethodDeclarationSyntax node) { - var updatedNode = ((MethodDeclarationSyntax)base.VisitMethodDeclaration(node)!).WithModifiers(TokenList()); + MethodDeclarationSyntax updatedNode = ((MethodDeclarationSyntax)base.VisitMethodDeclaration(node)!).WithModifiers(TokenList()); // Change the return type to void updatedNode = updatedNode.WithReturnType(PredefinedType(Token(SyntaxKind.VoidKeyword))); @@ -194,4 +194,4 @@ internal abstract class ExecuteMethodRewriter : CSharpSyntaxRewriter return updatedNode; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ShaderSourceRewriter.cs b/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ShaderSourceRewriter.cs index 43ab1642..50a7c8aa 100644 --- a/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ShaderSourceRewriter.cs +++ b/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ShaderSourceRewriter.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.SourceGeneration.Extensions; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -55,9 +55,18 @@ partial class ShaderSourceRewriter { string typeName = operation.Member.ContainingType.GetFullMetadataName(); - if (mappedName == $"__{nameof(GroupIds)}__get_Index") IsGroupIdsIndexUsed = true; - else if (typeName == typeof(GroupIds).FullName) IsGroupIdsUsed = true; - else if (typeName == typeof(GridIds).FullName) IsGridIdsUsed = true; + if (mappedName == $"__{nameof(GroupIds)}__get_Index") + { + IsGroupIdsIndexUsed = true; + } + else if (typeName == typeof(GroupIds).FullName) + { + IsGroupIdsUsed = true; + } + else if (typeName == typeof(GridIds).FullName) + { + IsGridIdsUsed = true; + } // Check that the dispatch info types are only used from the main shader body if (!this.isEntryPoint || this.localFunctionDepth > 0) @@ -85,4 +94,4 @@ partial class ShaderSourceRewriter { // No special tracking is needed for DX12 compute shaders } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/SyntaxRewriters/StaticFieldRewriter.cs b/src/ComputeSharp.SourceGenerators/SyntaxRewriters/StaticFieldRewriter.cs index 30aa28fc..0d4e2695 100644 --- a/src/ComputeSharp.SourceGenerators/SyntaxRewriters/StaticFieldRewriter.cs +++ b/src/ComputeSharp.SourceGenerators/SyntaxRewriters/StaticFieldRewriter.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.SourceGeneration.Extensions; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -40,4 +40,4 @@ partial class StaticFieldRewriter { // No special tracking is needed for DX12 compute shaders } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.Properties.cs b/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.Properties.cs index b7b1556d..35a3d39d 100644 --- a/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.Properties.cs +++ b/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.Properties.cs @@ -1,4 +1,4 @@ -using System; +using System; #if WINDOWS_UWP using Windows.UI.Xaml; #else @@ -72,8 +72,8 @@ partial class AnimatedComputeShaderPanel /// private static void OnShaderRunnerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var @this = (AnimatedComputeShaderPanel)d; - + AnimatedComputeShaderPanel @this = (AnimatedComputeShaderPanel)d; + if (@this.IsLoaded && !@this.IsPaused && e.NewValue is IShaderRunner shaderRunner) @@ -109,8 +109,8 @@ partial class AnimatedComputeShaderPanel /// private static void OnResolutionScalePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var @this = (AnimatedComputeShaderPanel)d; - var resolutionScale = (double)e.NewValue; + AnimatedComputeShaderPanel @this = (AnimatedComputeShaderPanel)d; + double resolutionScale = (double)e.NewValue; @this.swapChainManager.QueueResolutionScaleChange(resolutionScale); } @@ -138,8 +138,8 @@ partial class AnimatedComputeShaderPanel /// private static void OnIsDynamicResolutionEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var @this = (AnimatedComputeShaderPanel)d; - var isDynamicResolutionEnabled = (bool)e.NewValue; + AnimatedComputeShaderPanel @this = (AnimatedComputeShaderPanel)d; + bool isDynamicResolutionEnabled = (bool)e.NewValue; @this.swapChainManager.QueueDynamicResolutionModeChange(isDynamicResolutionEnabled); } @@ -166,8 +166,8 @@ partial class AnimatedComputeShaderPanel /// private static void OnIsVerticalSyncEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var @this = (AnimatedComputeShaderPanel)d; - var isVerticalSyncEnabled = (bool)e.NewValue; + AnimatedComputeShaderPanel @this = (AnimatedComputeShaderPanel)d; + bool isVerticalSyncEnabled = (bool)e.NewValue; @this.swapChainManager.QueueVerticalSyncModeChange(isVerticalSyncEnabled); } @@ -193,7 +193,7 @@ partial class AnimatedComputeShaderPanel /// private static void OnIsPausedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var @this = (AnimatedComputeShaderPanel)d; + AnimatedComputeShaderPanel @this = (AnimatedComputeShaderPanel)d; if (@this.IsLoaded && (bool)e.NewValue is false && @@ -206,4 +206,4 @@ partial class AnimatedComputeShaderPanel @this.swapChainManager.StopRenderLoop(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.cs b/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.cs index e940962a..ab611e3c 100644 --- a/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.cs +++ b/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.cs @@ -1,4 +1,4 @@ -using System; +using System; #if WINDOWS_UWP using ComputeSharp.Uwp.Helpers; using Windows.UI.Xaml; @@ -98,4 +98,4 @@ public sealed partial class AnimatedComputeShaderPanel : SwapChainPanel, IDispos this.swapChainManager.StopRenderLoop(); this.swapChainManager.Dispose(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/Controls/ComputeShaderPanel.Properties.cs b/src/ComputeSharp.UI/Controls/ComputeShaderPanel.Properties.cs index 73c01768..2c5e37f5 100644 --- a/src/ComputeSharp.UI/Controls/ComputeShaderPanel.Properties.cs +++ b/src/ComputeSharp.UI/Controls/ComputeShaderPanel.Properties.cs @@ -1,4 +1,4 @@ -using System; +using System; #if WINDOWS_UWP using Windows.UI.Xaml; #else @@ -72,7 +72,7 @@ partial class ComputeShaderPanel /// private static void OnFrameRequestQueueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var @this = (ComputeShaderPanel)d; + ComputeShaderPanel @this = (ComputeShaderPanel)d; if (@this.IsLoaded && e.NewValue is IFrameRequestQueue frameRequestQueue && @@ -107,7 +107,7 @@ partial class ComputeShaderPanel /// private static void OnShaderRunnerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var @this = (ComputeShaderPanel)d; + ComputeShaderPanel @this = (ComputeShaderPanel)d; if (@this.IsLoaded && @this.FrameRequestQueue is IFrameRequestQueue frameRequestQueue && @@ -144,8 +144,8 @@ partial class ComputeShaderPanel /// private static void OnResolutionScalePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var @this = (ComputeShaderPanel)d; - var resolutionScale = (double)e.NewValue; + ComputeShaderPanel @this = (ComputeShaderPanel)d; + double resolutionScale = (double)e.NewValue; @this.swapChainManager.QueueResolutionScaleChange(resolutionScale); } @@ -173,8 +173,8 @@ partial class ComputeShaderPanel /// private static void OnIsDynamicResolutionEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var @this = (ComputeShaderPanel)d; - var isDynamicResolutionEnabled = (bool)e.NewValue; + ComputeShaderPanel @this = (ComputeShaderPanel)d; + bool isDynamicResolutionEnabled = (bool)e.NewValue; @this.swapChainManager.QueueDynamicResolutionModeChange(isDynamicResolutionEnabled); } @@ -201,9 +201,9 @@ partial class ComputeShaderPanel /// private static void OnIsVerticalSyncEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var @this = (ComputeShaderPanel)d; - var isVerticalSyncEnabled = (bool)e.NewValue; + ComputeShaderPanel @this = (ComputeShaderPanel)d; + bool isVerticalSyncEnabled = (bool)e.NewValue; @this.swapChainManager.QueueVerticalSyncModeChange(isVerticalSyncEnabled); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/Controls/ComputeShaderPanel.cs b/src/ComputeSharp.UI/Controls/ComputeShaderPanel.cs index fae6d793..a0edfa80 100644 --- a/src/ComputeSharp.UI/Controls/ComputeShaderPanel.cs +++ b/src/ComputeSharp.UI/Controls/ComputeShaderPanel.cs @@ -1,4 +1,4 @@ -using System; +using System; #if WINDOWS_UWP using ComputeSharp.Uwp.Helpers; using Windows.UI.Xaml; @@ -92,4 +92,4 @@ public sealed partial class ComputeShaderPanel : SwapChainPanel, IDisposable { this.swapChainManager.Dispose(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/Controls/RenderingFailedEventArgs.cs b/src/ComputeSharp.UI/Controls/RenderingFailedEventArgs.cs index c4e13778..c65ee832 100644 --- a/src/ComputeSharp.UI/Controls/RenderingFailedEventArgs.cs +++ b/src/ComputeSharp.UI/Controls/RenderingFailedEventArgs.cs @@ -1,4 +1,4 @@ -using System; +using System; #if WINDOWS_UWP namespace ComputeSharp.Uwp; @@ -24,4 +24,4 @@ public sealed class RenderingFailedEventArgs : EventArgs /// Gets the that caused the rendering to fail. /// public Exception Exception { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/Extensions/IDXGIAdapterExtensions.cs b/src/ComputeSharp.UI/Extensions/IDXGIAdapterExtensions.cs index 8244edde..a03fc851 100644 --- a/src/ComputeSharp.UI/Extensions/IDXGIAdapterExtensions.cs +++ b/src/ComputeSharp.UI/Extensions/IDXGIAdapterExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Core.Extensions; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; @@ -52,4 +52,4 @@ internal static unsafe class IDXGIAdapterExtensions return refreshRate; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/Extensions/SemaphoreSlimExtensions.cs b/src/ComputeSharp.UI/Extensions/SemaphoreSlimExtensions.cs index fd2ab3d0..750e637d 100644 --- a/src/ComputeSharp.UI/Extensions/SemaphoreSlimExtensions.cs +++ b/src/ComputeSharp.UI/Extensions/SemaphoreSlimExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Threading; using System.Threading.Tasks; @@ -50,7 +50,7 @@ internal static class SemaphoreSlimExtensions /// public void Dispose() { - this.semaphore.Release(); + _ = this.semaphore.Release(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/Helpers/DynamicResolutionManager.cs b/src/ComputeSharp.UI/Helpers/DynamicResolutionManager.cs index ac3b07ec..fc7d0e55 100644 --- a/src/ComputeSharp.UI/Helpers/DynamicResolutionManager.cs +++ b/src/ComputeSharp.UI/Helpers/DynamicResolutionManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Threading; @@ -114,10 +114,10 @@ internal unsafe ref struct DynamicResolutionManager // This formula is adapted from https://software.intel.com/content/www/us/en/develop/articles/dynamic-resolution-rendering-article.html. long averageFrameTimeInTicks = this.slidingFrameTimeWindowSum / SlidingFrameTimeWindowLength; - if (averageFrameTimeInTicks < lowerFrameTimeThresholdInTicks || - averageFrameTimeInTicks > upperFrameTimeThresholdInTicks) + if (averageFrameTimeInTicks < this.lowerFrameTimeThresholdInTicks || + averageFrameTimeInTicks > this.upperFrameTimeThresholdInTicks) { - float frameTimeDelta = (targetFrameTimeInTicks - averageFrameTimeInTicks) / (float)averageFrameTimeInTicks; + float frameTimeDelta = (this.targetFrameTimeInTicks - averageFrameTimeInTicks) / (float)averageFrameTimeInTicks; float scaleFactorDelta = scaleFactor * frameTimeDelta * ScaleFactorDeltaK; float updatedScaleFactor = Math.Clamp(scaleFactor + scaleFactorDelta, 0.10f, 1.0f); @@ -136,4 +136,4 @@ internal unsafe ref struct DynamicResolutionManager return false; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs b/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs index 1e4f6328..a0a7eb9b 100644 --- a/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs +++ b/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Threading; @@ -34,7 +34,7 @@ partial class SwapChainManager // Here and in the calls below, only get a reference tracking lease when starting a render thread. // This avoids crashes when the panel has been disposed but some code (eg. event handlers) still // ends up calling into any of the APIs in this file, which is not intended but should not crash. - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); this.renderCancellationTokenSource?.Cancel(); @@ -79,7 +79,7 @@ partial class SwapChainManager // If there is a render thread currently running, stop it and restart it if (this.renderCancellationTokenSource?.IsCancellationRequested == false) { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); this.renderCancellationTokenSource?.Cancel(); @@ -114,7 +114,7 @@ partial class SwapChainManager if (this.renderCancellationTokenSource?.IsCancellationRequested == false && this.isDynamicResolutionEnabled) { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); this.renderCancellationTokenSource?.Cancel(); @@ -187,13 +187,13 @@ partial class SwapChainManager this.dynamicResolutionScale = this.resolutionScale; // These two leases are needed to ensure the manager isn't disposed while rendering is running - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); RenderLoopWithDynamicResolution(); } else { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); RenderLoop(); } @@ -210,7 +210,7 @@ partial class SwapChainManager } finally { - this.renderSemaphore.Release(); + _ = this.renderSemaphore.Release(); } } @@ -249,7 +249,7 @@ partial class SwapChainManager } OnResize(); - + if (OnUpdate(renderStopwatch.Elapsed, parameter)) { OnWaitForPresent(); @@ -441,4 +441,4 @@ partial class SwapChainManager this.renderCancellationTokenSource?.Cancel(); this.renderSemaphore.Wait(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/Helpers/SwapChainManager.cs b/src/ComputeSharp.UI/Helpers/SwapChainManager.cs index 279df0c2..dacf5b5f 100644 --- a/src/ComputeSharp.UI/Helpers/SwapChainManager.cs +++ b/src/ComputeSharp.UI/Helpers/SwapChainManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Runtime.CompilerServices; #if WINDOWS_UWP @@ -110,7 +110,7 @@ internal sealed unsafe partial class SwapChainManager : NativeObject /// /// The awaitable object for calls. /// - private HANDLE frameLatencyWaitableObject; + private readonly HANDLE frameLatencyWaitableObject; /// /// The first buffer within . @@ -240,8 +240,9 @@ internal sealed unsafe partial class SwapChainManager : NativeObject // Extract the ISwapChainPanelNative reference from the current panel, then query the // IDXGISwapChain reference just created and set that as the swap chain panel to use. fixed (ISwapChainPanelNative** swapChainPanelNative = this.swapChainPanelNative) - using (ComPtr swapChainPanel = default) { + using ComPtr swapChainPanel = default; + #if WINDOWS_UWP swapChainPanel.Attach((IUnknown*)Marshal.GetIUnknownForObject(owner)); @@ -394,8 +395,8 @@ internal sealed unsafe partial class SwapChainManager : NativeObject // Apply the necessary scale transform DXGI_MATRIX_3X2_F transformMatrix = default; - transformMatrix._11 = (1 / this.compositionScaleX) * (1 / targetResolutionScale); - transformMatrix._22 = (1 / this.compositionScaleY) * (1 / targetResolutionScale); + transformMatrix._11 = 1 / this.compositionScaleX * (1 / targetResolutionScale); + transformMatrix._22 = 1 / this.compositionScaleY * (1 / targetResolutionScale); this.dxgiSwapChain3.Get()->SetMatrixTransform(&transformMatrix).Assert(); @@ -420,7 +421,7 @@ internal sealed unsafe partial class SwapChainManager : NativeObject /// private unsafe partial void OnWaitForPresent() { - _ = Win32.WaitForSingleObjectEx(frameLatencyWaitableObject, Win32.INFINITE, true); + _ = Win32.WaitForSingleObjectEx(this.frameLatencyWaitableObject, Win32.INFINITE, true); } /// @@ -531,7 +532,7 @@ internal sealed unsafe partial class SwapChainManager : NativeObject @this.swapChainPanelNative.Get()->SetSwapChain(null).Assert(); @this.swapChainPanelNative.Dispose(); - ThreadPool.UnsafeQueueUserWorkItem(static state => + _ = ThreadPool.UnsafeQueueUserWorkItem(static state => { SwapChainManager @this = (SwapChainManager)state!; @@ -580,4 +581,4 @@ internal sealed unsafe partial class SwapChainManager : NativeObject OnDisposeOnThreadPoolThread(this); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/IFrameRequestQueue.cs b/src/ComputeSharp.UI/IFrameRequestQueue.cs index 96677a27..59d0ebd6 100644 --- a/src/ComputeSharp.UI/IFrameRequestQueue.cs +++ b/src/ComputeSharp.UI/IFrameRequestQueue.cs @@ -1,4 +1,4 @@ -using System.Threading; +using System.Threading; #if WINDOWS_UWP namespace ComputeSharp.Uwp; @@ -36,4 +36,4 @@ public interface IFrameRequestQueue /// /// void Dequeue(out object? parameter, CancellationToken token); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/IShaderRunner.cs b/src/ComputeSharp.UI/IShaderRunner.cs index b6ebaf23..23e7d337 100644 --- a/src/ComputeSharp.UI/IShaderRunner.cs +++ b/src/ComputeSharp.UI/IShaderRunner.cs @@ -1,4 +1,4 @@ -using System; +using System; #if WINDOWS_UWP namespace ComputeSharp.Uwp; @@ -23,4 +23,4 @@ public interface IShaderRunner /// or to be raised. /// bool TryExecute(IReadWriteNormalizedTexture2D texture, TimeSpan timespan, object? parameter); -} +} \ No newline at end of file diff --git a/src/ComputeSharp.UI/ShaderRunner{T}.cs b/src/ComputeSharp.UI/ShaderRunner{T}.cs index da2d5fed..08bca82b 100644 --- a/src/ComputeSharp.UI/ShaderRunner{T}.cs +++ b/src/ComputeSharp.UI/ShaderRunner{T}.cs @@ -1,4 +1,4 @@ -using System; +using System; using CommunityToolkit.Diagnostics; #if WINDOWS_UWP @@ -70,4 +70,4 @@ public sealed class ShaderRunner : IShaderRunner return true; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp.Uwp/Properties/AssemblyInfo.cs b/src/ComputeSharp.Uwp/Properties/AssemblyInfo.cs index f03c1078..5777bd26 100644 --- a/src/ComputeSharp.Uwp/Properties/AssemblyInfo.cs +++ b/src/ComputeSharp.Uwp/Properties/AssemblyInfo.cs @@ -1,3 +1,3 @@ -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; [assembly: ComVisible(false)] \ No newline at end of file diff --git a/src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs b/src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs index 012cdd4c..ec80ea6f 100644 --- a/src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs +++ b/src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; #if !SOURCE_GENERATOR using CommunityToolkit.Diagnostics; #endif @@ -96,4 +96,4 @@ public sealed class EmbeddedBytecodeAttribute : Attribute /// Gets the number of threads in each thread group for the Z axis /// public int ThreadsZ { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Attributes/GroupSharedAttribute.cs b/src/ComputeSharp/Core/Attributes/GroupSharedAttribute.cs index ac35796d..e53897ef 100644 --- a/src/ComputeSharp/Core/Attributes/GroupSharedAttribute.cs +++ b/src/ComputeSharp/Core/Attributes/GroupSharedAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp; @@ -42,4 +42,4 @@ public sealed class GroupSharedAttribute : Attribute /// If , the thread group size will be used. /// public int? Size { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Dispatch/DispatchAxis.cs b/src/ComputeSharp/Core/Dispatch/DispatchAxis.cs index 7e95cd93..181b53b1 100644 --- a/src/ComputeSharp/Core/Dispatch/DispatchAxis.cs +++ b/src/ComputeSharp/Core/Dispatch/DispatchAxis.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// A to be used with to indicate the dispatch axis to precompile a shader for. @@ -66,4 +66,4 @@ public enum DispatchAxis /// This applies to using or . /// XYZ -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Dispatch/DispatchSize.cs b/src/ComputeSharp/Core/Dispatch/DispatchSize.cs index 60b7b696..60b05ba9 100644 --- a/src/ComputeSharp/Core/Dispatch/DispatchSize.cs +++ b/src/ComputeSharp/Core/Dispatch/DispatchSize.cs @@ -1,4 +1,4 @@ -using ComputeSharp.Exceptions; +using ComputeSharp.Exceptions; namespace ComputeSharp; @@ -207,4 +207,4 @@ public static class DispatchSize /// Gets an value with the components , , . /// public static Int3 ZZZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZZZ)}"); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Dispatch/GridIds.cs b/src/ComputeSharp/Core/Dispatch/GridIds.cs index c8e6ff5f..48c37a80 100644 --- a/src/ComputeSharp/Core/Dispatch/GridIds.cs +++ b/src/ComputeSharp/Core/Dispatch/GridIds.cs @@ -1,4 +1,4 @@ -using ComputeSharp.Exceptions; +using ComputeSharp.Exceptions; namespace ComputeSharp; @@ -202,4 +202,4 @@ public static class GridIds /// Gets an value with the components , , . /// public static Int3 ZZZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZZZ)}"); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Dispatch/GroupIds.cs b/src/ComputeSharp/Core/Dispatch/GroupIds.cs index 56eb5865..bd97efac 100644 --- a/src/ComputeSharp/Core/Dispatch/GroupIds.cs +++ b/src/ComputeSharp/Core/Dispatch/GroupIds.cs @@ -1,4 +1,4 @@ -using ComputeSharp.Exceptions; +using ComputeSharp.Exceptions; namespace ComputeSharp; @@ -207,4 +207,4 @@ public static class GroupIds /// Gets an value with the components , , . /// public static Int3 ZZZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZZZ)}"); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Dispatch/GroupSize.cs b/src/ComputeSharp/Core/Dispatch/GroupSize.cs index da359a3e..84a7791d 100644 --- a/src/ComputeSharp/Core/Dispatch/GroupSize.cs +++ b/src/ComputeSharp/Core/Dispatch/GroupSize.cs @@ -1,4 +1,4 @@ -using ComputeSharp.Exceptions; +using ComputeSharp.Exceptions; namespace ComputeSharp; @@ -207,4 +207,4 @@ public static class GroupSize /// Gets an value with the components , , . /// public static Int3 ZZZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZZZ)}"); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Dispatch/ThreadIds.Normalized.cs b/src/ComputeSharp/Core/Dispatch/ThreadIds.Normalized.cs index 79c366ba..df03886c 100644 --- a/src/ComputeSharp/Core/Dispatch/ThreadIds.Normalized.cs +++ b/src/ComputeSharp/Core/Dispatch/ThreadIds.Normalized.cs @@ -1,4 +1,4 @@ -using ComputeSharp.Exceptions; +using ComputeSharp.Exceptions; namespace ComputeSharp; @@ -219,4 +219,4 @@ partial class ThreadIds /// public static Float3 ZZZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZZZ)}"); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Dispatch/ThreadIds.cs b/src/ComputeSharp/Core/Dispatch/ThreadIds.cs index 29151b58..f931a086 100644 --- a/src/ComputeSharp/Core/Dispatch/ThreadIds.cs +++ b/src/ComputeSharp/Core/Dispatch/ThreadIds.cs @@ -1,4 +1,4 @@ -using ComputeSharp.Exceptions; +using ComputeSharp.Exceptions; namespace ComputeSharp; @@ -202,4 +202,4 @@ public static partial class ThreadIds /// Gets an value with the components , , . /// public static Int3 ZZZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZZZ)}"); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Extensions/FloatExtensions.cs b/src/ComputeSharp/Core/Extensions/FloatExtensions.cs index 83374084..f213d01c 100644 --- a/src/ComputeSharp/Core/Extensions/FloatExtensions.cs +++ b/src/ComputeSharp/Core/Extensions/FloatExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Numerics; using System.Runtime.InteropServices; @@ -68,4 +68,4 @@ public static class FloatExtensions { return MemoryMarshal.Cast(span); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Extensions/MethodInfoExtensions.cs b/src/ComputeSharp/Core/Extensions/MethodInfoExtensions.cs index 81d7dfa7..5e66a834 100644 --- a/src/ComputeSharp/Core/Extensions/MethodInfoExtensions.cs +++ b/src/ComputeSharp/Core/Extensions/MethodInfoExtensions.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Reflection; using System.Text.RegularExpressions; @@ -36,4 +36,4 @@ internal static class MethodInfoExtensions return $"{declaringType}.{methodName}({parameters})"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Extensions/VectorExtensions.cs b/src/ComputeSharp/Core/Extensions/VectorExtensions.cs index 2366067d..0cd7cb0e 100644 --- a/src/ComputeSharp/Core/Extensions/VectorExtensions.cs +++ b/src/ComputeSharp/Core/Extensions/VectorExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Numerics; using System.Runtime.InteropServices; @@ -68,4 +68,4 @@ public static class VectorExtensions { return MemoryMarshal.Cast(span); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Helpers/AlignmentHelper.cs b/src/ComputeSharp/Core/Helpers/AlignmentHelper.cs index 9c690131..6751bde4 100644 --- a/src/ComputeSharp/Core/Helpers/AlignmentHelper.cs +++ b/src/ComputeSharp/Core/Helpers/AlignmentHelper.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; namespace ComputeSharp.Core.Helpers; @@ -48,4 +48,4 @@ internal static class AlignmentHelper return (offset + alignment - 1) & ~(alignment - 1); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/Bgra32.cs b/src/ComputeSharp/Core/Imaging/Bgra32.cs index ffe235b9..1c2e6393 100644 --- a/src/ComputeSharp/Core/Imaging/Bgra32.cs +++ b/src/ComputeSharp/Core/Imaging/Bgra32.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -136,18 +136,30 @@ public struct Bgra32 : IEquatable, IPixel public static bool operator !=(Bgra32 left, Bgra32 right) => !left.Equals(right); /// - public override readonly bool Equals(object? obj) => obj is Bgra32 other && Equals(other); + public override readonly bool Equals(object? obj) + { + return obj is Bgra32 other && Equals(other); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly bool Equals(Bgra32 other) => PackedValue.Equals(other.PackedValue); + public readonly bool Equals(Bgra32 other) + { + return PackedValue.Equals(other.PackedValue); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public override readonly int GetHashCode() => PackedValue.GetHashCode(); + public override readonly int GetHashCode() + { + return PackedValue.GetHashCode(); + } /// - public override readonly string ToString() => $"{nameof(Bgra32)}({this.B}, {this.G}, {this.R}, {this.A})"; + public override readonly string ToString() + { + return $"{nameof(Bgra32)}({this.B}, {this.G}, {this.R}, {this.A})"; + } #if NET6_0_OR_GREATER /// @@ -162,4 +174,4 @@ public struct Bgra32 : IEquatable, IPixel return destination.TryWrite(provider, $"{nameof(Bgra32)}({this.B}, {this.G}, {this.R}, {this.A})", out charsWritten); } #endif -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/Formats/ImageFormat.cs b/src/ComputeSharp/Core/Imaging/Formats/ImageFormat.cs index 218957e5..1a8819f2 100644 --- a/src/ComputeSharp/Core/Imaging/Formats/ImageFormat.cs +++ b/src/ComputeSharp/Core/Imaging/Formats/ImageFormat.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An representing a supported image format. @@ -34,4 +34,4 @@ public enum ImageFormat /// The DDS format. /// Dds -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/Interfaces/IPixel{T,TPixel}.cs b/src/ComputeSharp/Core/Imaging/Interfaces/IPixel{T,TPixel}.cs index 4a047881..5e285582 100644 --- a/src/ComputeSharp/Core/Imaging/Interfaces/IPixel{T,TPixel}.cs +++ b/src/ComputeSharp/Core/Imaging/Interfaces/IPixel{T,TPixel}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An interface representing a pixel type and its normalized representation on the GPU side, when used within a shader. @@ -19,4 +19,4 @@ public interface IPixel /// and . /// TPixel ToPixel(); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/R16.cs b/src/ComputeSharp/Core/Imaging/R16.cs index f096e73b..35b61732 100644 --- a/src/ComputeSharp/Core/Imaging/R16.cs +++ b/src/ComputeSharp/Core/Imaging/R16.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -72,18 +72,30 @@ public struct R16 : IEquatable, IPixel public static bool operator !=(R16 left, R16 right) => !left.Equals(right); /// - public override readonly bool Equals(object? obj) => obj is R16 R16 && Equals(R16); + public override readonly bool Equals(object? obj) + { + return obj is R16 R16 && Equals(R16); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly bool Equals(R16 other) => PackedValue.Equals(other.PackedValue); + public readonly bool Equals(R16 other) + { + return PackedValue.Equals(other.PackedValue); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public override readonly int GetHashCode() => PackedValue.GetHashCode(); + public override readonly int GetHashCode() + { + return PackedValue.GetHashCode(); + } /// - public override readonly string ToString() => $"{nameof(R16)}({this.R})"; + public override readonly string ToString() + { + return $"{nameof(R16)}({this.R})"; + } #if NET6_0_OR_GREATER /// @@ -98,4 +110,4 @@ public struct R16 : IEquatable, IPixel return destination.TryWrite(provider, $"{nameof(R16)}({this.R})", out charsWritten); } #endif -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/R8.cs b/src/ComputeSharp/Core/Imaging/R8.cs index e438980c..d46c8315 100644 --- a/src/ComputeSharp/Core/Imaging/R8.cs +++ b/src/ComputeSharp/Core/Imaging/R8.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -72,18 +72,30 @@ public struct R8 : IEquatable, IPixel public static bool operator !=(R8 left, R8 right) => !left.Equals(right); /// - public override readonly bool Equals(object? obj) => obj is R8 R8 && Equals(R8); + public override readonly bool Equals(object? obj) + { + return obj is R8 R8 && Equals(R8); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly bool Equals(R8 other) => PackedValue.Equals(other.PackedValue); + public readonly bool Equals(R8 other) + { + return PackedValue.Equals(other.PackedValue); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public override readonly int GetHashCode() => PackedValue.GetHashCode(); + public override readonly int GetHashCode() + { + return PackedValue.GetHashCode(); + } /// - public override readonly string ToString() => $"{nameof(R8)}({this.R})"; + public override readonly string ToString() + { + return $"{nameof(R8)}({this.R})"; + } #if NET6_0_OR_GREATER /// @@ -98,4 +110,4 @@ public struct R8 : IEquatable, IPixel return destination.TryWrite(provider, $"{nameof(R8)}({this.R})", out charsWritten); } #endif -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/Rg16.cs b/src/ComputeSharp/Core/Imaging/Rg16.cs index 97baee2c..1ae01ab8 100644 --- a/src/ComputeSharp/Core/Imaging/Rg16.cs +++ b/src/ComputeSharp/Core/Imaging/Rg16.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -79,18 +79,30 @@ public struct Rg16 : IEquatable, IPixel public static bool operator !=(Rg16 left, Rg16 right) => !left.Equals(right); /// - public override readonly bool Equals(object? obj) => obj is Rg16 rgba32 && Equals(rgba32); + public override readonly bool Equals(object? obj) + { + return obj is Rg16 rgba32 && Equals(rgba32); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly bool Equals(Rg16 other) => PackedValue.Equals(other.PackedValue); + public readonly bool Equals(Rg16 other) + { + return PackedValue.Equals(other.PackedValue); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public override readonly int GetHashCode() => PackedValue.GetHashCode(); + public override readonly int GetHashCode() + { + return PackedValue.GetHashCode(); + } /// - public override readonly string ToString() => $"{nameof(Rg16)}({this.R}, {this.G})"; + public override readonly string ToString() + { + return $"{nameof(Rg16)}({this.R}, {this.G})"; + } #if NET6_0_OR_GREATER /// @@ -105,4 +117,4 @@ public struct Rg16 : IEquatable, IPixel return destination.TryWrite(provider, $"{nameof(Rg16)}({this.R}, {this.G})", out charsWritten); } #endif -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/Rg32.cs b/src/ComputeSharp/Core/Imaging/Rg32.cs index 99742d81..3262b123 100644 --- a/src/ComputeSharp/Core/Imaging/Rg32.cs +++ b/src/ComputeSharp/Core/Imaging/Rg32.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -79,18 +79,30 @@ public struct Rg32 : IEquatable, IPixel public static bool operator !=(Rg32 left, Rg32 right) => !left.Equals(right); /// - public override readonly bool Equals(object? obj) => obj is Rg32 rgba32 && Equals(rgba32); + public override readonly bool Equals(object? obj) + { + return obj is Rg32 rgba32 && Equals(rgba32); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly bool Equals(Rg32 other) => PackedValue.Equals(other.PackedValue); + public readonly bool Equals(Rg32 other) + { + return PackedValue.Equals(other.PackedValue); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public override readonly int GetHashCode() => PackedValue.GetHashCode(); + public override readonly int GetHashCode() + { + return PackedValue.GetHashCode(); + } /// - public override readonly string ToString() => $"{nameof(Rg32)}({this.R}, {this.G})"; + public override readonly string ToString() + { + return $"{nameof(Rg32)}({this.R}, {this.G})"; + } #if NET6_0_OR_GREATER /// @@ -105,4 +117,4 @@ public struct Rg32 : IEquatable, IPixel return destination.TryWrite(provider, $"{nameof(Rg32)}({this.R}, {this.G})", out charsWritten); } #endif -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/Rgba32.cs b/src/ComputeSharp/Core/Imaging/Rgba32.cs index 595eea02..61fc1f32 100644 --- a/src/ComputeSharp/Core/Imaging/Rgba32.cs +++ b/src/ComputeSharp/Core/Imaging/Rgba32.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -134,18 +134,30 @@ public struct Rgba32 : IEquatable, IPixel public static bool operator !=(Rgba32 left, Rgba32 right) => !left.Equals(right); /// - public override readonly bool Equals(object? obj) => obj is Rgba32 rgba32 && Equals(rgba32); + public override readonly bool Equals(object? obj) + { + return obj is Rgba32 rgba32 && Equals(rgba32); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly bool Equals(Rgba32 other) => PackedValue.Equals(other.PackedValue); + public readonly bool Equals(Rgba32 other) + { + return PackedValue.Equals(other.PackedValue); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public override readonly int GetHashCode() => PackedValue.GetHashCode(); + public override readonly int GetHashCode() + { + return PackedValue.GetHashCode(); + } /// - public override readonly string ToString() => $"{nameof(Rgba32)}({this.R}, {this.G}, {this.B}, {this.A})"; + public override readonly string ToString() + { + return $"{nameof(Rgba32)}({this.R}, {this.G}, {this.B}, {this.A})"; + } #if NET6_0_OR_GREATER /// @@ -160,4 +172,4 @@ public struct Rgba32 : IEquatable, IPixel return destination.TryWrite(provider, $"{nameof(Rgba32)}({this.R}, {this.G}, {this.B}, {this.A})", out charsWritten); } #endif -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/Rgba64.cs b/src/ComputeSharp/Core/Imaging/Rgba64.cs index 0652aac0..51f9e3a3 100644 --- a/src/ComputeSharp/Core/Imaging/Rgba64.cs +++ b/src/ComputeSharp/Core/Imaging/Rgba64.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -132,18 +132,30 @@ public struct Rgba64 : IEquatable, IPixel public static bool operator !=(Rgba64 left, Rgba64 right) => !left.Equals(right); /// - public override readonly bool Equals(object? obj) => obj is Rgba64 rgba32 && Equals(rgba32); + public override readonly bool Equals(object? obj) + { + return obj is Rgba64 rgba32 && Equals(rgba32); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly bool Equals(Rgba64 other) => PackedValue.Equals(other.PackedValue); + public readonly bool Equals(Rgba64 other) + { + return PackedValue.Equals(other.PackedValue); + } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public override readonly int GetHashCode() => PackedValue.GetHashCode(); + public override readonly int GetHashCode() + { + return PackedValue.GetHashCode(); + } /// - public override readonly string ToString() => $"{nameof(Rgba64)}({this.R}, {this.G}, {this.B}, {this.A})"; + public override readonly string ToString() + { + return $"{nameof(Rgba64)}({this.R}, {this.G}, {this.B}, {this.A})"; + } #if NET6_0_OR_GREATER /// @@ -158,4 +170,4 @@ public struct Rgba64 : IEquatable, IPixel return destination.TryWrite(provider, $"{nameof(Rgba64)}({this.R}, {this.G}, {this.B}, {this.A})", out charsWritten); } #endif -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Interfaces/IComputeShader.cs b/src/ComputeSharp/Core/Interfaces/IComputeShader.cs index 24f0ad15..1b4e7727 100644 --- a/src/ComputeSharp/Core/Interfaces/IComputeShader.cs +++ b/src/ComputeSharp/Core/Interfaces/IComputeShader.cs @@ -1,4 +1,4 @@ -using ComputeSharp.__Internals; +using ComputeSharp.__Internals; #pragma warning disable CS0618 @@ -13,4 +13,4 @@ public interface IComputeShader : IShader /// Executes the current compute shader. /// void Execute(); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Interfaces/IPixelShader{TPixel}.cs b/src/ComputeSharp/Core/Interfaces/IPixelShader{TPixel}.cs index 9e15d6af..b12cf074 100644 --- a/src/ComputeSharp/Core/Interfaces/IPixelShader{TPixel}.cs +++ b/src/ComputeSharp/Core/Interfaces/IPixelShader{TPixel}.cs @@ -1,4 +1,4 @@ -using ComputeSharp.__Internals; +using ComputeSharp.__Internals; #pragma warning disable CS0618 @@ -15,4 +15,4 @@ public interface IPixelShader : IShader /// /// The pixel value for the current invocation. TPixel Execute(); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Interfaces/__Internals/IBytecodeLoader.cs b/src/ComputeSharp/Core/Interfaces/__Internals/IBytecodeLoader.cs index 1ca5ee68..e3dbc4b3 100644 --- a/src/ComputeSharp/Core/Interfaces/__Internals/IBytecodeLoader.cs +++ b/src/ComputeSharp/Core/Interfaces/__Internals/IBytecodeLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; namespace ComputeSharp.__Internals; @@ -24,4 +24,4 @@ public interface IBytecodeLoader /// The shader bytecode. /// Thrown if the shader has already been initialized. void LoadEmbeddedBytecode(ReadOnlySpan bytecode); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Interfaces/__Internals/IDispatchDataLoader.cs b/src/ComputeSharp/Core/Interfaces/__Internals/IDispatchDataLoader.cs index 98d5a513..9fddceaf 100644 --- a/src/ComputeSharp/Core/Interfaces/__Internals/IDispatchDataLoader.cs +++ b/src/ComputeSharp/Core/Interfaces/__Internals/IDispatchDataLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; namespace ComputeSharp.__Internals; @@ -21,4 +21,4 @@ public interface IDispatchDataLoader /// /// The sequence of serialized resources. void LoadCapturedResources(ReadOnlySpan data); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Interfaces/__Internals/IDispatchMetadataLoader.cs b/src/ComputeSharp/Core/Interfaces/__Internals/IDispatchMetadataLoader.cs index 41d11b88..0e455379 100644 --- a/src/ComputeSharp/Core/Interfaces/__Internals/IDispatchMetadataLoader.cs +++ b/src/ComputeSharp/Core/Interfaces/__Internals/IDispatchMetadataLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; namespace ComputeSharp.__Internals; @@ -17,4 +17,4 @@ public interface IDispatchMetadataLoader /// The sequence of resource descriptors for the current shader. /// The resulting opaque metadata handle. void LoadMetadataHandle(ReadOnlySpan serializedMetadata, ReadOnlySpan resourceDescriptors, out IntPtr result); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Interfaces/__Internals/IShader.cs b/src/ComputeSharp/Core/Interfaces/__Internals/IShader.cs index e0d69b91..be0cc8af 100644 --- a/src/ComputeSharp/Core/Interfaces/__Internals/IShader.cs +++ b/src/ComputeSharp/Core/Interfaces/__Internals/IShader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; namespace ComputeSharp.__Internals; @@ -67,4 +67,4 @@ public interface IShader [Obsolete("This method is not intended to be used directly by user code")] void LoadBytecode(ref TLoader loader, int threadsX, int threadsY, int threadsZ) where TLoader : struct, IBytecodeLoader; -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Commands/CommandList.cs b/src/ComputeSharp/Graphics/Commands/CommandList.cs index 15381bbe..ade72ef0 100644 --- a/src/ComputeSharp/Graphics/Commands/CommandList.cs +++ b/src/ComputeSharp/Graphics/Commands/CommandList.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Threading.Tasks; @@ -163,4 +163,4 @@ internal unsafe struct CommandList : IDisposable this.d3D12CommandAllocator.Dispose(); this.d3D12GraphicsCommandList.Dispose(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs index cd46d8d1..b373af48 100644 --- a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs +++ b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using ComputeSharp.Core.Extensions; @@ -90,8 +90,8 @@ internal readonly unsafe struct ID3D12CommandListPool : IDisposable { foreach (D3D12CommandListBundle d3D12CommandListBundle in this.d3D12CommandListBundleQueue) { - d3D12CommandListBundle.D3D12CommandList->Release(); - d3D12CommandListBundle.D3D12CommandAllocator->Release(); + _ = d3D12CommandListBundle.D3D12CommandList->Release(); + _ = d3D12CommandListBundle.D3D12CommandAllocator->Release(); } this.d3D12CommandListBundleQueue.Clear(); @@ -114,8 +114,8 @@ internal readonly unsafe struct ID3D12CommandListPool : IDisposable fixed (ID3D12GraphicsCommandList** d3D12CommandListPtr = &d3D12CommandList) fixed (ID3D12CommandAllocator** d3D12CommandAllocatorPtr = &d3D12CommandAllocator) { - d3D12CommandListComPtr.CopyTo(d3D12CommandListPtr); - d3D12CommandAllocatorComPtr.CopyTo(d3D12CommandAllocatorPtr); + _ = d3D12CommandListComPtr.CopyTo(d3D12CommandListPtr); + _ = d3D12CommandAllocatorComPtr.CopyTo(d3D12CommandAllocatorPtr); } } @@ -141,8 +141,8 @@ internal readonly unsafe struct ID3D12CommandListPool : IDisposable /// The value to wrap. public D3D12CommandListBundle(ID3D12GraphicsCommandList* d3D12CommandList, ID3D12CommandAllocator* d3D12CommandAllocator) { - D3D12CommandList = d3D12CommandList; - D3D12CommandAllocator = d3D12CommandAllocator; + this.D3D12CommandList = d3D12CommandList; + this.D3D12CommandAllocator = d3D12CommandAllocator; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs index 02989353..f5cc3aa7 100644 --- a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs +++ b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs @@ -1,4 +1,4 @@ -using System; +using System; using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Extensions; using TerraFX.Interop.DirectX; @@ -140,4 +140,4 @@ internal unsafe struct ID3D12DescriptorHandleAllocator : IDisposable this.d3D12DescriptorHeap.Dispose(); this.d3D12DescriptorHeapNonShaderVisible.Dispose(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12ResourceDescriptorHandles.cs b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12ResourceDescriptorHandles.cs index e416d833..c8d43081 100644 --- a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12ResourceDescriptorHandles.cs +++ b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12ResourceDescriptorHandles.cs @@ -1,4 +1,4 @@ -using TerraFX.Interop.DirectX; +using TerraFX.Interop.DirectX; namespace ComputeSharp.Graphics.Commands.Interop; @@ -33,8 +33,8 @@ internal readonly struct ID3D12ResourceDescriptorHandles D3D12_GPU_DESCRIPTOR_HANDLE d3D12GpuDescriptorHandle, D3D12_CPU_DESCRIPTOR_HANDLE d3D12CpuDescriptorHandleNonShaderVisible) { - D3D12CpuDescriptorHandle = d3D12CpuDescriptorHandle; - D3D12GpuDescriptorHandle = d3D12GpuDescriptorHandle; - D3D12CpuDescriptorHandleNonShaderVisible = d3D12CpuDescriptorHandleNonShaderVisible; + this.D3D12CpuDescriptorHandle = d3D12CpuDescriptorHandle; + this.D3D12GpuDescriptorHandle = d3D12GpuDescriptorHandle; + this.D3D12CpuDescriptorHandleNonShaderVisible = d3D12CpuDescriptorHandleNonShaderVisible; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/DeviceLostEventArgs.cs b/src/ComputeSharp/Graphics/DeviceLostEventArgs.cs index f817501f..f3fb24aa 100644 --- a/src/ComputeSharp/Graphics/DeviceLostEventArgs.cs +++ b/src/ComputeSharp/Graphics/DeviceLostEventArgs.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp; @@ -20,4 +20,4 @@ public sealed class DeviceLostEventArgs : EventArgs /// Gets the reason that caused the device to be lost. /// public DeviceLostReason Reason { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/DeviceLostReason.cs b/src/ComputeSharp/Graphics/DeviceLostReason.cs index b27f1132..6eed0e47 100644 --- a/src/ComputeSharp/Graphics/DeviceLostReason.cs +++ b/src/ComputeSharp/Graphics/DeviceLostReason.cs @@ -1,4 +1,4 @@ -using TerraFX.Interop.DirectX; +using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; namespace ComputeSharp; @@ -47,4 +47,4 @@ public enum DeviceLostReason /// The device was lost for an unspecified reason. /// UnspecifiedError = E.E_FAIL -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Exceptions/GraphicsDeviceMismatchException.cs b/src/ComputeSharp/Graphics/Exceptions/GraphicsDeviceMismatchException.cs index 2569600e..e953fb2d 100644 --- a/src/ComputeSharp/Graphics/Exceptions/GraphicsDeviceMismatchException.cs +++ b/src/ComputeSharp/Graphics/Exceptions/GraphicsDeviceMismatchException.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; using ComputeSharp.Interop; using ComputeSharp.Resources; @@ -34,11 +34,11 @@ public sealed class GraphicsDeviceMismatchException : InvalidOperationException { StringBuilder builder = new(512); - builder.AppendLine("Invalid pairing of graphics devices used to run a compute shader and allocate memory buffers."); - builder.AppendLine($"The target device to run the compute shader is \"{destinationDevice}\"."); - builder.AppendLine($"The buffer of type {resource.GetType()} was allocated on device \"{sourceDevice}\"."); - builder.Append("Make sure to always allocate buffers on the same device used to actually run the code that accesses them."); - builder.ToString(); + _ = builder.AppendLine("Invalid pairing of graphics devices used to run a compute shader and allocate memory buffers."); + _ = builder.AppendLine($"The target device to run the compute shader is \"{destinationDevice}\"."); + _ = builder.AppendLine($"The buffer of type {resource.GetType()} was allocated on device \"{sourceDevice}\"."); + _ = builder.Append("Make sure to always allocate buffers on the same device used to actually run the code that accesses them."); + _ = builder.ToString(); return new(builder.ToString()); } @@ -138,4 +138,4 @@ public sealed class GraphicsDeviceMismatchException : InvalidOperationException { throw Create(texture, texture.GraphicsDevice, device); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Exceptions/UnsupportedDoubleOperationsException.cs b/src/ComputeSharp/Graphics/Exceptions/UnsupportedDoubleOperationsException.cs index 5a6414b2..0c4b8fdb 100644 --- a/src/ComputeSharp/Graphics/Exceptions/UnsupportedDoubleOperationsException.cs +++ b/src/ComputeSharp/Graphics/Exceptions/UnsupportedDoubleOperationsException.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; namespace ComputeSharp.Exceptions; @@ -26,10 +26,10 @@ public sealed class UnsupportedDoubleOperationException : NotSupportedException { StringBuilder builder = new(256); - builder.AppendLine($"The device in use does not support creating resources of type {type}, as it does not support using double precision floating point numbers."); - builder.AppendLine("As a possible workaround, consider replacing usage of the double type with single precision floating point numbers."); - builder.AppendLine("Note that double precision operations are only partially supported on GPU devices, and are far slower than single precision ones."); - builder.ToString(); + _ = builder.AppendLine($"The device in use does not support creating resources of type {type}, as it does not support using double precision floating point numbers."); + _ = builder.AppendLine("As a possible workaround, consider replacing usage of the double type with single precision floating point numbers."); + _ = builder.AppendLine("Note that double precision operations are only partially supported on GPU devices, and are far slower than single precision ones."); + _ = builder.ToString(); return new(builder.ToString()); } @@ -43,4 +43,4 @@ public sealed class UnsupportedDoubleOperationException : NotSupportedException { throw Create(typeof(T)); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Exceptions/UnsupportedTextureTypeException.cs b/src/ComputeSharp/Graphics/Exceptions/UnsupportedTextureTypeException.cs index bc4f9353..4d4c5863 100644 --- a/src/ComputeSharp/Graphics/Exceptions/UnsupportedTextureTypeException.cs +++ b/src/ComputeSharp/Graphics/Exceptions/UnsupportedTextureTypeException.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; using CommunityToolkit.Diagnostics; @@ -28,10 +28,10 @@ public sealed class UnsupportedTextureTypeException : NotSupportedException { StringBuilder builder = new(256); - builder.AppendLine($"The device in use does not support creating {rank}D textures of type {type}."); - builder.Append($"Make sure to check the support at runtime by using {nameof(GraphicsDevice)}."); + _ = builder.AppendLine($"The device in use does not support creating {rank}D textures of type {type}."); + _ = builder.Append($"Make sure to check the support at runtime by using {nameof(GraphicsDevice)}."); - builder.AppendLine(rank switch + _ = builder.AppendLine(rank switch { 1 => $"{nameof(GraphicsDevice.IsReadOnlyTexture1DSupportedForType)}() or {nameof(GraphicsDevice)}.{nameof(GraphicsDevice.IsReadWriteTexture1DSupportedForType)}().", 2 => $"{nameof(GraphicsDevice.IsReadOnlyTexture2DSupportedForType)}() or {nameof(GraphicsDevice)}.{nameof(GraphicsDevice.IsReadWriteTexture2DSupportedForType)}().", @@ -39,7 +39,7 @@ public sealed class UnsupportedTextureTypeException : NotSupportedException _ => ThrowHelper.ThrowArgumentException("Invalid texture rank.") }); - builder.Append("As a possible workaround on older devices, consider using a texture type of lower rank, or a linear buffer."); + _ = builder.Append("As a possible workaround on older devices, consider using a texture type of lower rank, or a linear buffer."); return new(builder.ToString()); } @@ -73,4 +73,4 @@ public sealed class UnsupportedTextureTypeException : NotSupportedException { throw Create(3, typeof(T)); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs b/src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs index 6045ba1e..f5990fc8 100644 --- a/src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; @@ -241,4 +241,4 @@ public static class BufferExtensions source.CopyTo(destination, sourceOffset, destinationOffset, count); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs index 4b85af2b..351e2244 100644 --- a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs +++ b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; namespace ComputeSharp; @@ -150,10 +150,10 @@ public static partial class GraphicsDeviceExtensions { Guard.IsNotNull(device); - using var _0 = device.GetReferenceTrackingLease(); + using Interop.NativeObject.Lease _0 = device.GetReferenceTrackingLease(); device.ThrowIfDeviceLost(); return new(device); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs index 0e2c8834..320d05dc 100644 --- a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs +++ b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.CodeAnalysis; using System.IO; using CommunityToolkit.Diagnostics; @@ -1820,4 +1820,4 @@ partial class GraphicsDeviceExtensions return WICHelper.Instance.LoadTexture(device, stream); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs index c765cd21..cc66f091 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs @@ -1,4 +1,4 @@ -#if NET6_0_OR_GREATER +#if NET6_0_OR_GREATER using CommunityToolkit.Diagnostics; using ComputeSharp.Core.Extensions; @@ -60,14 +60,14 @@ internal static unsafe class AllocatorExtensions (D3D12_HEAP_TYPE d3D12HeapType, D3D12_RESOURCE_FLAGS d3D12ResourceFlags, D3D12_RESOURCE_STATES d3D12ResourceStates) = resourceType switch - { + { ResourceType.Constant => (D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_GENERIC_READ), ResourceType.ReadOnly => (D3D12_HEAP_TYPE_DEFAULT, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COMMON), ResourceType.ReadWrite => (D3D12_HEAP_TYPE_DEFAULT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COMMON), ResourceType.ReadBack => (D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COPY_DEST), ResourceType.Upload => (D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_GENERIC_READ), _ => ThrowHelper.ThrowArgumentException<(D3D12_HEAP_TYPE, D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>() - }; + }; using ComPtr allocation = default; @@ -250,4 +250,4 @@ internal static unsafe class AllocatorExtensions } } -#endif +#endif \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs index 40e28633..0b14b7fe 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using TerraFX.Interop.Windows; namespace ComputeSharp.Core.Extensions; @@ -113,4 +113,4 @@ internal static class ComPtrExtensions return copy; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/HRESULTExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/HRESULTExtensions.cs index 229c5ac4..77710d00 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/HRESULTExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/HRESULTExtensions.cs @@ -1,4 +1,4 @@ -using System.ComponentModel; +using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; @@ -92,4 +92,4 @@ internal static class HRESULTExtensions DXGI.DXGI_ERROR_INVALID_CALL or DXGI.DXGI_ERROR_ACCESS_DENIED; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs index 8246cc6f..08c1e529 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; #if NET6_0_OR_GREATER using System.Runtime.CompilerServices; #else @@ -768,4 +768,4 @@ internal static unsafe class ID3D12DeviceExtensions return d3D12ShaderModel.HighestShaderModel == d3DShaderModel; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12GraphicsCommandListExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12GraphicsCommandListExtensions.cs index ba806042..b8f66857 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12GraphicsCommandListExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12GraphicsCommandListExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using TerraFX.Interop.DirectX; namespace ComputeSharp.Graphics.Extensions; @@ -295,4 +295,4 @@ internal static unsafe class ID3D12GraphicsCommandListExtensions d3D12GraphicsCommandList.SetComputeRoot32BitConstants(0, (uint)data.Length, p, 0); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12ResourceExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12ResourceExtensions.cs index fdca3723..41a395fc 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12ResourceExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12ResourceExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Runtime.CompilerServices; using ComputeSharp.Core.Extensions; @@ -55,4 +55,4 @@ internal static unsafe class ID3D12ResourceExtensions d3D12Resource.SetName((ushort*)p).Assert(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs index 76c15576..49ed469b 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -41,7 +41,7 @@ unsafe partial class IWICStreamExtensions /// /// A manual CCW implementation for an object wrapping an instance. /// - internal unsafe partial struct IBufferWriterWrapper + private unsafe partial struct IBufferWriterWrapper #if NET6_0_OR_GREATER : IUnknown.Interface #endif @@ -225,17 +225,17 @@ unsafe partial class IWICStreamExtensions /// /// The vtable pointer for the current instance. /// - public void** lpVtbl; + private void** lpVtbl; /// /// The current reference count for the object (from IUnknown). /// - public volatile int referenceCount; + private volatile int referenceCount; /// /// The to the captured . /// - public GCHandle writerHandle; + private GCHandle writerHandle; /// /// Creates and initializes a new instance. @@ -267,19 +267,19 @@ unsafe partial class IWICStreamExtensions /// public HRESULT QueryInterface(Guid* riid, void** ppvObject) { - return ((delegate* unmanaged)lpVtbl[0])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject); + return ((delegate* unmanaged)this.lpVtbl[0])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject); } /// public uint AddRef() { - return ((delegate* unmanaged)lpVtbl[1])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged)this.lpVtbl[1])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this)); } /// public uint Release() { - return ((delegate* unmanaged)lpVtbl[2])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged)this.lpVtbl[2])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this)); } #endif @@ -462,4 +462,4 @@ unsafe partial class IWICStreamExtensions return STG_E_INVALIDFUNCTION; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs index dc664ea7..44cb9846 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -44,7 +44,7 @@ internal static unsafe partial class IWICStreamExtensions /// /// A manual CCW implementation for an object wrapping a instance. /// - internal unsafe partial struct IStreamWrapper + private unsafe partial struct IStreamWrapper #if NET6_0_OR_GREATER : IUnknown.Interface #endif @@ -228,17 +228,17 @@ internal static unsafe partial class IWICStreamExtensions /// /// The vtable pointer for the current instance. /// - public void** lpVtbl; + private void** lpVtbl; /// /// The current reference count for the object (from IUnknown). /// - public volatile int referenceCount; + private volatile int referenceCount; /// /// The to the captured . /// - public GCHandle streamHandle; + private GCHandle streamHandle; /// /// Creates and initializes a new instance. @@ -270,19 +270,19 @@ internal static unsafe partial class IWICStreamExtensions /// public HRESULT QueryInterface(Guid* riid, void** ppvObject) { - return ((delegate* unmanaged)lpVtbl[0])((IStreamWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject); + return ((delegate* unmanaged)this.lpVtbl[0])((IStreamWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject); } /// public uint AddRef() { - return ((delegate* unmanaged)lpVtbl[1])((IStreamWrapper*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged)this.lpVtbl[1])((IStreamWrapper*)Unsafe.AsPointer(ref this)); } /// public uint Release() { - return ((delegate* unmanaged)lpVtbl[2])((IStreamWrapper*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged)this.lpVtbl[2])((IStreamWrapper*)Unsafe.AsPointer(ref this)); } #endif @@ -596,4 +596,4 @@ internal static unsafe partial class IWICStreamExtensions return STG_E_INVALIDFUNCTION; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/ReadBackBufferExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadBackBufferExtensions.cs index 0940cf5d..b35105da 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadBackBufferExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadBackBufferExtensions.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; namespace ComputeSharp; @@ -40,4 +40,4 @@ public static class ReadBackBufferExtensions source.CopyTo(destination, sourceOffset, destinationOffset, count); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture1DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture1DExtensions.cs index 1c22347a..7720a3fd 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture1DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture1DExtensions.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; namespace ComputeSharp; @@ -57,4 +57,4 @@ public static class ReadBackTexture1DExtensions source.CopyTo(destination, sourceOffsetX, destinationOffsetX, width); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture2DExtensions.cs index 1d54bc19..fd196cca 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture2DExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.IO; using CommunityToolkit.Diagnostics; @@ -127,4 +127,4 @@ public static class ReadBackTexture2DExtensions WICHelper.Instance.SaveTexture(texture.View, writer, format); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture3DExtensions.cs index 76d35750..ab07892a 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture3DExtensions.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; namespace ComputeSharp; @@ -67,4 +67,4 @@ public static class ReadBackTexture3DExtensions source.CopyTo(destination, sourceOffsetX, sourceOffsetY, sourceOffsetZ, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture1DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture1DExtensions.cs index 5c540d7e..565cdb04 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture1DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture1DExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using CommunityToolkit.Diagnostics; namespace ComputeSharp; @@ -141,4 +141,4 @@ public static class ReadWriteTexture1DExtensions return texture.AsReadOnly(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture2DExtensions.cs index f301580f..efa1f2da 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture2DExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using CommunityToolkit.Diagnostics; namespace ComputeSharp; @@ -141,4 +141,4 @@ public static class ReadWriteTexture2DExtensions return texture.AsReadOnly(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture3DExtensions.cs index 3bb33cfd..bc0621ab 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture3DExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using CommunityToolkit.Diagnostics; namespace ComputeSharp; @@ -141,4 +141,4 @@ public static class ReadWriteTexture3DExtensions return texture.AsReadOnly(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/StructuredBufferExtensions.cs b/src/ComputeSharp/Graphics/Extensions/StructuredBufferExtensions.cs index 1166042e..087201a9 100644 --- a/src/ComputeSharp/Graphics/Extensions/StructuredBufferExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/StructuredBufferExtensions.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; namespace ComputeSharp; @@ -73,4 +73,4 @@ public static class StructuredBufferExtensions source.CopyTo(destination, sourceOffset, destinationOffset, count); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Texture1DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Texture1DExtensions.cs index 55c7f2fe..40e37268 100644 --- a/src/ComputeSharp/Graphics/Extensions/Texture1DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Texture1DExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; @@ -183,7 +183,7 @@ public static class Texture1DExtensions { Guard.IsNotNull(source); - var (offsetX, width) = x.GetOffsetAndLength(source.Width); + (int offsetX, int width) = x.GetOffsetAndLength(source.Width); source.CopyTo(destination, offsetX, width); } @@ -420,7 +420,7 @@ public static class Texture1DExtensions { Guard.IsNotNull(destination); - var (offsetX, width) = x.GetOffsetAndLength(destination.Width); + (int offsetX, int width) = x.GetOffsetAndLength(destination.Width); destination.CopyFrom(source, offsetX, width); } @@ -541,4 +541,4 @@ public static class Texture1DExtensions destination.CopyFrom(source, sourceOffsetX, destinationOffsetX, width); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs index 68b845c5..f3015fa5 100644 --- a/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.IO; using System.Runtime.InteropServices; @@ -213,8 +213,8 @@ public static class Texture2DExtensions { Guard.IsNotNull(source); - var (offsetX, width) = x.GetOffsetAndLength(source.Width); - var (offsetY, height) = y.GetOffsetAndLength(source.Height); + (int offsetX, int width) = x.GetOffsetAndLength(source.Width); + (int offsetY, int height) = y.GetOffsetAndLength(source.Height); source.CopyTo(destination, offsetX, offsetY, width, height); } @@ -487,8 +487,8 @@ public static class Texture2DExtensions { Guard.IsNotNull(destination); - var (offsetX, width) = x.GetOffsetAndLength(destination.Width); - var (offsetY, height) = y.GetOffsetAndLength(destination.Height); + (int offsetX, int width) = x.GetOffsetAndLength(destination.Width); + (int offsetY, int height) = y.GetOffsetAndLength(destination.Height); destination.CopyFrom(source, offsetX, offsetY, width, height); } @@ -694,4 +694,4 @@ public static class Texture2DExtensions WICHelper.Instance.SaveTexture(readback.View, writer, format); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs index 1693ecf9..ade73640 100644 --- a/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; @@ -173,9 +173,9 @@ public static class Texture3DExtensions { Guard.IsNotNull(source); - var (offsetX, width) = x.GetOffsetAndLength(source.Width); - var (offsetY, height) = y.GetOffsetAndLength(source.Height); - var (offsetZ, depth) = z.GetOffsetAndLength(source.Depth); + (int offsetX, int width) = x.GetOffsetAndLength(source.Width); + (int offsetY, int height) = y.GetOffsetAndLength(source.Height); + (int offsetZ, int depth) = z.GetOffsetAndLength(source.Depth); source.CopyTo(destination, offsetX, offsetY, offsetZ, width, height, depth); } @@ -472,9 +472,9 @@ public static class Texture3DExtensions { Guard.IsNotNull(destination); - var (offsetX, width) = x.GetOffsetAndLength(destination.Width); - var (offsetY, height) = y.GetOffsetAndLength(destination.Height); - var (offsetZ, depth) = z.GetOffsetAndLength(destination.Depth); + (int offsetX, int width) = x.GetOffsetAndLength(destination.Width); + (int offsetY, int height) = y.GetOffsetAndLength(destination.Height); + (int offsetZ, int depth) = z.GetOffsetAndLength(destination.Depth); destination.CopyFrom(source, offsetX, offsetY, offsetZ, width, height, depth); } @@ -619,4 +619,4 @@ public static class Texture3DExtensions destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, sourceOffsetZ, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/UploadBufferExtensions.cs b/src/ComputeSharp/Graphics/Extensions/UploadBufferExtensions.cs index 118eeb9e..35de31cc 100644 --- a/src/ComputeSharp/Graphics/Extensions/UploadBufferExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/UploadBufferExtensions.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; namespace ComputeSharp; @@ -40,4 +40,4 @@ public static class UploadBufferExtensions destination.CopyFrom(source, sourceOffset, destinationOffset, count); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/UploadTexture1DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/UploadTexture1DExtensions.cs index 87f160f9..ef1d9844 100644 --- a/src/ComputeSharp/Graphics/Extensions/UploadTexture1DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/UploadTexture1DExtensions.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; namespace ComputeSharp; @@ -57,4 +57,4 @@ public static class UploadTexture1DExtensions destination.CopyFrom(source, sourceOffsetX, destinationOffsetX, width); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs index 1cd16e05..ac2a4273 100644 --- a/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Helpers; @@ -78,7 +78,7 @@ public static class UploadTexture2DExtensions Guard.IsNotNull(texture); Guard.IsNotNull(filename); - texture. Load(filename.AsSpan()); + texture.Load(filename.AsSpan()); } /// @@ -124,4 +124,4 @@ public static class UploadTexture2DExtensions WICHelper.Instance.LoadTexture(texture.View, stream); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/UploadTexture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/UploadTexture3DExtensions.cs index 43e54cbc..6590c16e 100644 --- a/src/ComputeSharp/Graphics/Extensions/UploadTexture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/UploadTexture3DExtensions.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; namespace ComputeSharp; @@ -67,4 +67,4 @@ public static class UploadTexture3DExtensions destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, sourceOffsetZ, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.DeviceLost.cs b/src/ComputeSharp/Graphics/GraphicsDevice.DeviceLost.cs index 1bd8209a..1251ab04 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.DeviceLost.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.DeviceLost.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; @@ -48,7 +48,7 @@ unsafe partial class GraphicsDevice /// private void QueueRaiseDeviceLostEventIfNeeded() { - using var _0 = TryGetReferenceTrackingLease(out bool leaseTaken); + using Lease _0 = TryGetReferenceTrackingLease(out bool leaseTaken); if (!leaseTaken) { @@ -99,7 +99,7 @@ unsafe partial class GraphicsDevice device.DeviceLost?.Invoke(device, new DeviceLostEventArgs(reason)); } - ThreadPool.QueueUserWorkItem(static state => RaiseDeviceLostEvent((GraphicsDevice)state!), this); + _ = ThreadPool.QueueUserWorkItem(static state => RaiseDeviceLostEvent((GraphicsDevice)state!), this); } /// @@ -188,9 +188,6 @@ unsafe partial class GraphicsDevice handle.Free(); // If the device is available, then also queue the device lost event to be raised on the thread pool - if (device is not null) - { - device.QueueRaiseDeviceLostEventIfNeeded(); - } + device?.QueueRaiseDeviceLostEventIfNeeded(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs b/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs index 239c9cbc..8227eb55 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Concurrent; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -341,4 +341,4 @@ unsafe partial class GraphicsDevice this.manualResetValueTaskSource.OnCompleted(continuation, state, token, flags); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs b/src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs index e17a64dd..a4fe798e 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Helpers; @@ -75,4 +75,4 @@ partial class GraphicsDevice return new DeviceHelper.DeviceQuery(predicate); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.cs b/src/ComputeSharp/Graphics/GraphicsDevice.cs index 71895039..b3aed608 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Runtime.CompilerServices; @@ -97,12 +97,12 @@ public sealed unsafe partial class GraphicsDevice : NativeObject /// /// The event for the device removed callback. /// - private HANDLE deviceRemovedEvent; + private readonly HANDLE deviceRemovedEvent; /// /// The wait handle for the device removed callback. /// - private HANDLE deviceRemovedWaitHandle; + private readonly HANDLE deviceRemovedWaitHandle; /// /// The reason the device was removed, if any. @@ -164,12 +164,12 @@ public sealed unsafe partial class GraphicsDevice : NativeObject SharedMemorySize = dxgiDescription1->SharedSystemMemory; IsHardwareAccelerated = (dxgiDescription1->Flags & (uint)DXGI_ADAPTER_FLAG_SOFTWARE) == 0; - var d3D12Options1Data = d3D12Device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS1); + D3D12_FEATURE_DATA_D3D12_OPTIONS1 d3D12Options1Data = d3D12Device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS1); ComputeUnits = d3D12Options1Data.TotalLaneCount; WavefrontSize = d3D12Options1Data.WaveLaneCountMin; - var d3D12Architecture1Data = d3D12Device->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE1); + D3D12_FEATURE_DATA_ARCHITECTURE1 d3D12Architecture1Data = d3D12Device->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE1); IsCacheCoherentUMA = d3D12Architecture1Data.CacheCoherentUMA != 0; @@ -252,11 +252,11 @@ public sealed unsafe partial class GraphicsDevice : NativeObject /// Whether the current device supports double precision floating point operations in shaders. public bool IsDoublePrecisionSupportAvailable() { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceLost(); - var d3D12OptionsData = this.d3D12Device.Get()->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS); + D3D12_FEATURE_DATA_D3D12_OPTIONS d3D12OptionsData = this.d3D12Device.Get()->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS); return d3D12OptionsData.DoublePrecisionFloatShaderOps; } @@ -270,7 +270,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject public bool IsReadOnlyTexture1DSupportedForType() where T : unmanaged { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceLost(); @@ -286,7 +286,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject public bool IsReadWriteTexture1DSupportedForType() where T : unmanaged { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceLost(); @@ -304,7 +304,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject public bool IsReadOnlyTexture2DSupportedForType() where T : unmanaged { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceLost(); @@ -320,7 +320,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject public bool IsReadWriteTexture2DSupportedForType() where T : unmanaged { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceLost(); @@ -338,7 +338,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject public bool IsReadOnlyTexture3DSupportedForType() where T : unmanaged { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceLost(); @@ -354,7 +354,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject public bool IsReadWriteTexture3DSupportedForType() where T : unmanaged { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceLost(); @@ -433,7 +433,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject this.copyCommandListPool.Rent(this.d3D12Device.Get(), null, out d3D12CommandList, out d3D12CommandAllocator); break; default: - ThrowHelper.ThrowArgumentException>(); + _ = ThrowHelper.ThrowArgumentException>(); d3D12CommandList = null; d3D12CommandAllocator = null; break; @@ -508,4 +508,4 @@ public sealed unsafe partial class GraphicsDevice : NativeObject { return $"[{Luid}] {Name}"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/GraphicsDeviceInfo.cs b/src/ComputeSharp/Graphics/GraphicsDeviceInfo.cs index d66a86c5..67556760 100644 --- a/src/ComputeSharp/Graphics/GraphicsDeviceInfo.cs +++ b/src/ComputeSharp/Graphics/GraphicsDeviceInfo.cs @@ -1,4 +1,4 @@ -using TerraFX.Interop.DirectX; +using TerraFX.Interop.DirectX; using static TerraFX.Interop.DirectX.DXGI_ADAPTER_FLAG; namespace ComputeSharp; @@ -46,4 +46,4 @@ public readonly struct GraphicsDeviceInfo /// This value is for software fallback devices. /// public bool IsHardwareAccelerated { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs b/src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs index 8bff94ef..38be3c55 100644 --- a/src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs @@ -1,9 +1,11 @@ -using System.Numerics; +using System.Numerics; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using TerraFX.Interop.DirectX; using static TerraFX.Interop.DirectX.DXGI_FORMAT; +#pragma warning disable IDE0011 + namespace ComputeSharp.Graphics.Helpers; /// @@ -22,28 +24,29 @@ internal static class DXGIFormatHelper where T : unmanaged { if (typeof(T) == typeof(int)) return DXGI_FORMAT_R32_SINT; - else if (typeof(T) == typeof(Int2)) return DXGI_FORMAT_R32G32_SINT; - else if (typeof(T) == typeof(Int3)) return DXGI_FORMAT_R32G32B32_SINT; - else if (typeof(T) == typeof(Int4)) return DXGI_FORMAT_R32G32B32A32_SINT; - else if (typeof(T) == typeof(uint)) return DXGI_FORMAT_R32_UINT; - else if (typeof(T) == typeof(UInt2)) return DXGI_FORMAT_R32G32_UINT; - else if (typeof(T) == typeof(UInt3)) return DXGI_FORMAT_R32G32B32_UINT; - else if (typeof(T) == typeof(UInt4)) return DXGI_FORMAT_R32G32B32A32_UINT; - else if (typeof(T) == typeof(float)) return DXGI_FORMAT_R32_FLOAT; - else if (typeof(T) == typeof(Float2)) return DXGI_FORMAT_R32G32_FLOAT; - else if (typeof(T) == typeof(Float3)) return DXGI_FORMAT_R32G32B32_FLOAT; - else if (typeof(T) == typeof(Float4)) return DXGI_FORMAT_R32G32B32A32_FLOAT; - else if (typeof(T) == typeof(Vector2)) return DXGI_FORMAT_R32G32_FLOAT; - else if (typeof(T) == typeof(Vector3)) return DXGI_FORMAT_R32G32B32_FLOAT; - else if (typeof(T) == typeof(Vector4)) return DXGI_FORMAT_R32G32B32A32_FLOAT; - else if (typeof(T) == typeof(Bgra32)) return DXGI_FORMAT_B8G8R8A8_UNORM; - else if (typeof(T) == typeof(Rgba32)) return DXGI_FORMAT_R8G8B8A8_UNORM; - else if (typeof(T) == typeof(Rgba64)) return DXGI_FORMAT_R16G16B16A16_UNORM; - else if (typeof(T) == typeof(R8)) return DXGI_FORMAT_R8_UNORM; - else if (typeof(T) == typeof(R16)) return DXGI_FORMAT_R16_UNORM; - else if (typeof(T) == typeof(Rg16)) return DXGI_FORMAT_R8G8_UNORM; - else if (typeof(T) == typeof(Rg32)) return DXGI_FORMAT_R16G16_UNORM; - else return ThrowHelper.ThrowArgumentException("Invalid texture type."); + if (typeof(T) == typeof(Int2)) return DXGI_FORMAT_R32G32_SINT; + if (typeof(T) == typeof(Int3)) return DXGI_FORMAT_R32G32B32_SINT; + if (typeof(T) == typeof(Int4)) return DXGI_FORMAT_R32G32B32A32_SINT; + if (typeof(T) == typeof(uint)) return DXGI_FORMAT_R32_UINT; + if (typeof(T) == typeof(UInt2)) return DXGI_FORMAT_R32G32_UINT; + if (typeof(T) == typeof(UInt3)) return DXGI_FORMAT_R32G32B32_UINT; + if (typeof(T) == typeof(UInt4)) return DXGI_FORMAT_R32G32B32A32_UINT; + if (typeof(T) == typeof(float)) return DXGI_FORMAT_R32_FLOAT; + if (typeof(T) == typeof(Float2)) return DXGI_FORMAT_R32G32_FLOAT; + if (typeof(T) == typeof(Float3)) return DXGI_FORMAT_R32G32B32_FLOAT; + if (typeof(T) == typeof(Float4)) return DXGI_FORMAT_R32G32B32A32_FLOAT; + if (typeof(T) == typeof(Vector2)) return DXGI_FORMAT_R32G32_FLOAT; + if (typeof(T) == typeof(Vector3)) return DXGI_FORMAT_R32G32B32_FLOAT; + if (typeof(T) == typeof(Vector4)) return DXGI_FORMAT_R32G32B32A32_FLOAT; + if (typeof(T) == typeof(Bgra32)) return DXGI_FORMAT_B8G8R8A8_UNORM; + if (typeof(T) == typeof(Rgba32)) return DXGI_FORMAT_R8G8B8A8_UNORM; + if (typeof(T) == typeof(Rgba64)) return DXGI_FORMAT_R16G16B16A16_UNORM; + if (typeof(T) == typeof(R8)) return DXGI_FORMAT_R8_UNORM; + if (typeof(T) == typeof(R16)) return DXGI_FORMAT_R16_UNORM; + if (typeof(T) == typeof(Rg16)) return DXGI_FORMAT_R8G8_UNORM; + if (typeof(T) == typeof(Rg32)) return DXGI_FORMAT_R16G16_UNORM; + + return ThrowHelper.ThrowArgumentException("Invalid texture type."); } /// @@ -85,7 +88,7 @@ internal static class DXGIFormatHelper { return true; } - + return ThrowHelper.ThrowArgumentException("Invalid texture type."); } @@ -109,4 +112,4 @@ internal static class DXGIFormatHelper return result; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs index 87296d33..d48e7502 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using ComputeSharp.Core.Extensions; @@ -111,7 +111,10 @@ partial class DeviceHelper } } - if (this.isCompleted) return false; + if (this.isCompleted) + { + return false; + } while (true) { @@ -213,4 +216,4 @@ partial class DeviceHelper } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Factory.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Factory.cs index cd010295..d964ffab 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Factory.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Factory.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Runtime.CompilerServices; using ComputeSharp.Graphics.Extensions; using TerraFX.Interop.DirectX; @@ -22,7 +22,7 @@ partial class DeviceHelper /// /// The cached default instance, if any. /// - internal static GraphicsDevice? defaultDevice; + private static GraphicsDevice? defaultDevice; /// /// Gets the cached instance or creates and caches a new one. @@ -100,14 +100,14 @@ partial class DeviceHelper defaultDevice = null; } - DevicesCache.Remove(device.Luid); + _ = DevicesCache.Remove(device.Luid); if (Configuration.IsDebugOutputEnabled) { - D3D12InfoQueueMap.Remove(device.Luid, out ComPtr queue); + _ = D3D12InfoQueueMap.Remove(device.Luid, out ComPtr queue); queue.Dispose(); } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs index 313d92fa..acbfb1a9 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System.Collections.Generic; +using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; using CommunityToolkit.Diagnostics; @@ -36,7 +37,7 @@ partial class DeviceHelper { StringBuilder builder = infoQueueMessageBuilder ??= new(1024); - foreach (var pair in D3D12InfoQueueMap) + foreach (KeyValuePair> pair in D3D12InfoQueueMap) { GraphicsDevice device = DevicesCache[pair.Key]; ID3D12InfoQueue* queue = pair.Value.Get(); @@ -47,19 +48,19 @@ partial class DeviceHelper { nuint length; - queue->GetMessage(i, null, &length); + _ = queue->GetMessage(i, null, &length); D3D12_MESSAGE* message = (D3D12_MESSAGE*)NativeMemory.Alloc(length); try { - queue->GetMessage(i, message, &length); + _ = queue->GetMessage(i, message, &length); - builder.Clear(); - builder.AppendLine($"[D3D12 message #{i} for \"{device}\" (HW: {device.IsHardwareAccelerated}, UMA: {device.IsCacheCoherentUMA})]"); - builder.AppendLine($"[Category]: {Enum.GetName(message->Category)}"); - builder.AppendLine($"[Severity]: {Enum.GetName(message->Severity)}"); - builder.AppendLine($"[ID]: {Enum.GetName(message->ID)}"); + _ = builder.Clear(); + _ = builder.AppendLine($"[D3D12 message #{i} for \"{device}\" (HW: {device.IsHardwareAccelerated}, UMA: {device.IsCacheCoherentUMA})]"); + _ = builder.AppendLine($"[Category]: {Enum.GetName(message->Category)}"); + _ = builder.AppendLine($"[Severity]: {Enum.GetName(message->Severity)}"); + _ = builder.AppendLine($"[ID]: {Enum.GetName(message->ID)}"); bool isDeviceRemovedMessage = message->ID is D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT or D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT or D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT; @@ -81,14 +82,14 @@ partial class DeviceHelper _ => ThrowHelper.ThrowArgumentOutOfRangeException("Invalid GetDeviceRemovedReason HRESULT.") }; - builder.AppendLine($"[Reason]: {deviceRemovalReason}"); + _ = builder.AppendLine($"[Reason]: {deviceRemovalReason}"); } } // If DRED is enabled, also output the available auto breadcrumbs if (isDeviceRemovedMessage && Configuration.IsDeviceRemovedExtendedDataEnabled) { - builder.AppendLine($"[Description]: \"{new string(message->pDescription)}\""); + _ = builder.AppendLine($"[Description]: \"{new string(message->pDescription)}\""); using ComPtr d3D12DeviceRemovedExtendedData = default; @@ -112,7 +113,7 @@ partial class DeviceHelper ThrowHelper.ThrowWin32Exception(hresult); } - builder.AppendLine("[DRED breadcrumbs START] ==============================="); + _ = builder.AppendLine("[DRED breadcrumbs START] ==============================="); int breadcrumbNodeIndex = 0; @@ -126,7 +127,7 @@ partial class DeviceHelper // For each auto breadcrumb node, not all recorded breadcrumb have actually been executed. To reduce the verbosity of the // output and only show the most relevant info, indicate how many breadcrumbs were recorded and how many were actually // executed, but then only display the executed ones in the code below. This makes it easier to debug hangs for users. - builder.AppendLine($"[NODE #{breadcrumbNodeIndex}]: {d3D12AutoBreadcrumbNode->BreadcrumbCount} total breadcrumb(s), {numberOfExecutedOps} executed breadcrumb(s)"); + _ = builder.AppendLine($"[NODE #{breadcrumbNodeIndex}]: {d3D12AutoBreadcrumbNode->BreadcrumbCount} total breadcrumb(s), {numberOfExecutedOps} executed breadcrumb(s)"); uint contextIndex = 0; @@ -145,20 +146,20 @@ partial class DeviceHelper { string context = new((char*)d3D12AutoBreadcrumbNode->pBreadcrumbContexts[contextIndex++].pContextString); - builder.AppendLine($">> [OP #{commandIndex}]: {d3D12AutoBreadcrumbNode->pCommandHistory[commandIndex]}, \"{context}\""); + _ = builder.AppendLine($">> [OP #{commandIndex}]: {d3D12AutoBreadcrumbNode->pCommandHistory[commandIndex]}, \"{context}\""); } else { - builder.AppendLine($">> [OP #{commandIndex}]: {d3D12AutoBreadcrumbNode->pCommandHistory[commandIndex]}"); + _ = builder.AppendLine($">> [OP #{commandIndex}]: {d3D12AutoBreadcrumbNode->pCommandHistory[commandIndex]}"); } } } - builder.AppendLine("================================= [DRED breadcrumbs END]"); + _ = builder.AppendLine("================================= [DRED breadcrumbs END]"); } else { - builder.Append($"[Description]: \"{new string(message->pDescription)}\""); + _ = builder.Append($"[Description]: \"{new string(message->pDescription)}\""); } if (message->Severity is D3D12_MESSAGE_SEVERITY_ERROR or D3D12_MESSAGE_SEVERITY_CORRUPTION or D3D12_MESSAGE_SEVERITY_WARNING) @@ -180,4 +181,4 @@ partial class DeviceHelper return hasErrorsOrWarnings; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs index 67c91793..dad22eed 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; using ComputeSharp.Core.Extensions; using TerraFX.Interop.DirectX; @@ -204,9 +204,9 @@ partial class DeviceHelper /// [UnmanagedCallersOnly] - public static uint Release(IDXGIFactory4As6Backcompat* @this) + private static uint Release(IDXGIFactory4As6Backcompat* @this) { - @this->dxgiFactory4->Release(); + _ = @this->dxgiFactory4->Release(); NativeMemory.Free(@this); @@ -215,23 +215,23 @@ partial class DeviceHelper /// [UnmanagedCallersOnly] - public static int EnumAdapters(IDXGIFactory4As6Backcompat* @this, uint Adapter, IDXGIAdapter** ppAdapter) + private static int EnumAdapters(IDXGIFactory4As6Backcompat* @this, uint Adapter, IDXGIAdapter** ppAdapter) { return @this->dxgiFactory4->EnumAdapters(Adapter, ppAdapter); } /// [UnmanagedCallersOnly] - public static int EnumWarpAdapter(IDXGIFactory4As6Backcompat* @this, Guid* riid, void** ppvAdapter) + private static int EnumWarpAdapter(IDXGIFactory4As6Backcompat* @this, Guid* riid, void** ppvAdapter) { return @this->dxgiFactory4->EnumWarpAdapter(riid, ppvAdapter); } /// [UnmanagedCallersOnly] - public static int EnumAdapterByGpuPreference(IDXGIFactory4As6Backcompat* @this, uint Adapter, DXGI_GPU_PREFERENCE GpuPreference, Guid* riid, void** ppvAdapter) + private static int EnumAdapterByGpuPreference(IDXGIFactory4As6Backcompat* @this, uint Adapter, DXGI_GPU_PREFERENCE GpuPreference, Guid* riid, void** ppvAdapter) { return @this->dxgiFactory4->EnumAdapters1(Adapter, (IDXGIAdapter1**)ppvAdapter); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs index 54ae9364..f5506087 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using CommunityToolkit.Diagnostics; using ComputeSharp.Core.Extensions; using ComputeSharp.Graphics.Extensions; @@ -115,8 +115,8 @@ internal static partial class DeviceHelper if (Windows.SUCCEEDED(createDeviceResult) && d3D12DeviceCandidate.Get()->IsShaderModelSupported(D3D_SHADER_MODEL_6_0)) { - d3D12DeviceCandidate.CopyTo(d3D12Device); - dxgiAdapter1.CopyTo(dxgiAdapter); + _ = d3D12DeviceCandidate.CopyTo(d3D12Device); + _ = dxgiAdapter1.CopyTo(dxgiAdapter); return true; } @@ -140,7 +140,7 @@ internal static partial class DeviceHelper using ComPtr dxgiAdapter1 = default; dxgiFactory6.Get()->EnumWarpAdapter(Windows.__uuidof(), dxgiAdapter1.GetVoidAddressOf()).Assert(); - + dxgiAdapter1.Get()->GetDesc1(dxgiDescription1).Assert(); using ComPtr d3D12DeviceCandidate = default; @@ -159,12 +159,12 @@ internal static partial class DeviceHelper // There is no need to check for SM6.0, as it's guaranteed to be supported by Windows if (Windows.SUCCEEDED(createDeviceResult)) { - d3D12DeviceCandidate.CopyTo(d3D12Device); - dxgiAdapter1.CopyTo(dxgiAdapter); + _ = d3D12DeviceCandidate.CopyTo(d3D12Device); + _ = dxgiAdapter1.CopyTo(dxgiAdapter); return true; } return false; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Helpers/MemoryHelper.cs b/src/ComputeSharp/Graphics/Helpers/MemoryHelper.cs index 8b9597c3..ae0aaaf0 100644 --- a/src/ComputeSharp/Graphics/Helpers/MemoryHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/MemoryHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; namespace ComputeSharp.Graphics.Helpers; @@ -31,8 +31,8 @@ internal static class MemoryHelper where T : unmanaged { // Offset adjustment - source = (byte*)source + sourceElementOffset * sourceElementPitchInBytes; - destination = (byte*)destination + destinationElementOffset * destinationElementPitchInBytes; + source = (byte*)source + (sourceElementOffset * sourceElementPitchInBytes); + destination = (byte*)destination + (destinationElementOffset * destinationElementPitchInBytes); if (sourceElementPitchInBytes == (uint)sizeof(T)) { @@ -54,7 +54,7 @@ internal static class MemoryHelper uint destinationElementPitchInBytes, uint count) { - void* sourceEnd = (byte*)source + count * sizeof(T); + void* sourceEnd = (byte*)source + (count * sizeof(T)); while (source < sourceEnd) { @@ -77,7 +77,7 @@ internal static class MemoryHelper uint sourceElementPitchInBytes, uint count) { - void* sourceEnd = (byte*)source + count * sourceElementPitchInBytes; + void* sourceEnd = (byte*)source + (count * sourceElementPitchInBytes); while (source < sourceEnd) { @@ -100,8 +100,8 @@ internal static class MemoryHelper uint destinationElementPitchInBytes, uint count) { - void* sourceEnd = (byte*)source + count * sourceElementPitchInBytes; - + void* sourceEnd = (byte*)source + (count * sourceElementPitchInBytes); + while (source < sourceEnd) { *(T*)destination = *(T*)source; @@ -140,8 +140,8 @@ internal static class MemoryHelper for (int i = 0; i < height; i++) { Buffer.MemoryCopy( - (byte*)source + (uint)i * widthInBytes, - (byte*)destination + (uint)i * pitchInBytes, + (byte*)source + ((uint)i * widthInBytes), + (byte*)destination + ((uint)i * pitchInBytes), ulong.MaxValue, widthInBytes); } @@ -173,8 +173,8 @@ internal static class MemoryHelper for (int i = 0; i < height; i++) { Buffer.MemoryCopy( - (byte*)source + (uint)i * pitchInBytes, - (byte*)destination + (uint)i * widthInBytes, + (byte*)source + ((uint)i * pitchInBytes), + (byte*)destination + ((uint)i * widthInBytes), ulong.MaxValue, widthInBytes); } @@ -215,8 +215,8 @@ internal static class MemoryHelper for (int i = 0; i < height; i++) { Buffer.MemoryCopy( - (byte*)source + sourceZOffset + (uint)i * widthInBytes, - (byte*)destination + destinationZOffset + (uint)i * pitchInBytes, + (byte*)source + sourceZOffset + ((uint)i * widthInBytes), + (byte*)destination + destinationZOffset + ((uint)i * pitchInBytes), ulong.MaxValue, widthInBytes); } @@ -258,12 +258,12 @@ internal static class MemoryHelper for (int i = 0; i < height; i++) { Buffer.MemoryCopy( - (byte*)source + sourceZOffset + (uint)i * pitchInBytes, - (byte*)destination + destinationZOffset + (uint)i * widthInBytes, + (byte*)source + sourceZOffset + ((uint)i * pitchInBytes), + (byte*)destination + destinationZOffset + ((uint)i * widthInBytes), ulong.MaxValue, widthInBytes); } } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs b/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs index 5f113201..77cc2a0a 100644 --- a/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs +++ b/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.CodeAnalysis; using System.Reflection; @@ -25,9 +25,15 @@ internal static class TypeInfo [RequiresUnreferencedCode("This method reads type info of all fields of the input type (recursively).")] private static bool ChecksIsDoubleOrContainsDoubles(Type type) { - if (type == typeof(double)) return true; + if (type == typeof(double)) + { + return true; + } - if (type.IsPrimitive) return false; + if (type.IsPrimitive) + { + return false; + } foreach (FieldInfo fieldInfo in type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { @@ -39,4 +45,4 @@ internal static class TypeInfo return false; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs b/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs index ac8beb0d..ec08b097 100644 --- a/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using TerraFX.Interop.Windows; @@ -8,6 +8,8 @@ using Path = System.IO.Path; using Path = ComputeSharp.NetStandard.System.IO.Path; #endif +#pragma warning disable IDE0011 + namespace ComputeSharp.Graphics.Helpers; /// @@ -26,11 +28,12 @@ internal static class WICFormatHelper where T : unmanaged { if (typeof(T) == typeof(Bgra32)) return GUID.GUID_WICPixelFormat32bppBGRA; - else if (typeof(T) == typeof(Rgba32)) return GUID.GUID_WICPixelFormat32bppRGBA; - else if (typeof(T) == typeof(Rgba64)) return GUID.GUID_WICPixelFormat64bppRGBA; - else if (typeof(T) == typeof(R8)) return GUID.GUID_WICPixelFormat8bppGray; - else if (typeof(T) == typeof(R16)) return GUID.GUID_WICPixelFormat16bppGray; - else return ThrowHelper.ThrowArgumentException("Invalid texture type."); + if (typeof(T) == typeof(Rgba32)) return GUID.GUID_WICPixelFormat32bppRGBA; + if (typeof(T) == typeof(Rgba64)) return GUID.GUID_WICPixelFormat64bppRGBA; + if (typeof(T) == typeof(R8)) return GUID.GUID_WICPixelFormat8bppGray; + if (typeof(T) == typeof(R16)) return GUID.GUID_WICPixelFormat16bppGray; + + return ThrowHelper.ThrowArgumentException("Invalid texture type."); } /// @@ -148,4 +151,4 @@ internal static class WICFormatHelper _ => ThrowHelper.ThrowArgumentException("Invalid format."), }; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Helpers/WICHelper.cs b/src/ComputeSharp/Graphics/Helpers/WICHelper.cs index c984e550..791fd01f 100644 --- a/src/ComputeSharp/Graphics/Helpers/WICHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/WICHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.IO; using System.Runtime.CompilerServices; @@ -372,7 +372,7 @@ internal sealed unsafe class WICHelper fixed (char* p = filename) { - wicStream.Get()->InitializeFromFilename( + _ = wicStream.Get()->InitializeFromFilename( (ushort*)p, Windows.GENERIC_WRITE); } @@ -409,7 +409,7 @@ internal sealed unsafe class WICHelper // Create and initialize a stream this.wicImagingFactory2.Get()->CreateStream(wicStream.GetAddressOf()).Assert(); - wicStream.Get()->InitializeFromStream(stream); + _ = wicStream.Get()->InitializeFromStream(stream); // Initialize the encoder wicBitmapEncoder.Get()->Initialize( @@ -443,7 +443,7 @@ internal sealed unsafe class WICHelper // Create and initialize a stream this.wicImagingFactory2.Get()->CreateStream(wicStream.GetAddressOf()).Assert(); - wicStream.Get()->InitializeFromBufferWriter(writer); + _ = wicStream.Get()->InitializeFromBufferWriter(writer); // Initialize the encoder wicBitmapEncoder.Get()->Initialize( @@ -524,7 +524,7 @@ internal sealed unsafe class WICHelper pbPixels: (byte*)data).Assert(); } - wicBitmapFrameEncode.Get()->Commit(); - wicBitmapEncoder->Commit(); + _ = wicBitmapFrameEncode.Get()->Commit(); + _ = wicBitmapEncoder->Commit(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs b/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs index 1bc7e9f6..78800311 100644 --- a/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; @@ -67,7 +67,7 @@ public static class GraphicsResourceHelper { Guard.IsNotNull(buffer); - using var _0 = buffer.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = buffer.GetReferenceTrackingLease(); buffer.ThrowIfDeviceMismatch(device); @@ -89,7 +89,7 @@ public static class GraphicsResourceHelper { Guard.IsNotNull(texture); - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); texture.ThrowIfDeviceMismatch(device); @@ -111,7 +111,7 @@ public static class GraphicsResourceHelper { Guard.IsNotNull(texture); - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); texture.ThrowIfDeviceMismatch(device); @@ -202,7 +202,7 @@ public static class GraphicsResourceHelper { Guard.IsNotNull(texture); - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); texture.ThrowIfDeviceMismatch(device); @@ -224,7 +224,7 @@ public static class GraphicsResourceHelper { Guard.IsNotNull(texture); - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); texture.ThrowIfDeviceMismatch(device); @@ -315,7 +315,7 @@ public static class GraphicsResourceHelper { Guard.IsNotNull(texture); - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); texture.ThrowIfDeviceMismatch(device); @@ -337,7 +337,7 @@ public static class GraphicsResourceHelper { Guard.IsNotNull(texture); - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); texture.ThrowIfDeviceMismatch(device); @@ -414,4 +414,4 @@ public static class GraphicsResourceHelper return ThrowHelper.ThrowArgumentException("The input texture is not a valid instance."); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Interop/InteropServices.cs b/src/ComputeSharp/Graphics/Interop/InteropServices.cs index f2847c0e..ecf23531 100644 --- a/src/ComputeSharp/Graphics/Interop/InteropServices.cs +++ b/src/ComputeSharp/Graphics/Interop/InteropServices.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using ComputeSharp.Core.Extensions; using ComputeSharp.Resources; @@ -34,7 +34,7 @@ public static unsafe class InteropServices /// Thrown if the IUnknown::QueryInterface call doesn't return S_OK. public static void GetID3D12Device(GraphicsDevice device, Guid* riid, void** ppvObject) { - using var _0 = device.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = device.GetReferenceTrackingLease(); device.D3D12Device->QueryInterface(riid, ppvObject).Assert(); } @@ -52,7 +52,7 @@ public static unsafe class InteropServices public static void GetID3D12Resource(Buffer buffer, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = buffer.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = buffer.GetReferenceTrackingLease(); buffer.D3D12Resource->QueryInterface(riid, ppvObject).Assert(); } @@ -70,7 +70,7 @@ public static unsafe class InteropServices public static void GetID3D12Resource(Texture1D texture, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert(); } @@ -88,7 +88,7 @@ public static unsafe class InteropServices public static void GetID3D12Resource(Texture2D texture, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert(); } @@ -106,7 +106,7 @@ public static unsafe class InteropServices public static void GetID3D12Resource(Texture3D texture, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert(); } @@ -124,7 +124,7 @@ public static unsafe class InteropServices public static void GetID3D12Resource(TransferBuffer buffer, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = buffer.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = buffer.GetReferenceTrackingLease(); buffer.D3D12Resource->QueryInterface(riid, ppvObject).Assert(); } @@ -142,7 +142,7 @@ public static unsafe class InteropServices public static void GetID3D12Resource(TransferTexture2D texture, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert(); } @@ -160,7 +160,7 @@ public static unsafe class InteropServices public static void GetID3D12Resource(TransferTexture3D texture, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert(); } @@ -179,7 +179,7 @@ public static unsafe class InteropServices /// The instance has been disposed. public static int TryGetID3D12Device(GraphicsDevice device, Guid* riid, void** ppvObject) { - using var _0 = device.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = device.GetReferenceTrackingLease(); return device.D3D12Device->QueryInterface(riid, ppvObject); } @@ -200,7 +200,7 @@ public static unsafe class InteropServices public static int TryGetID3D12Resource(Buffer buffer, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = buffer.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = buffer.GetReferenceTrackingLease(); return buffer.D3D12Resource->QueryInterface(riid, ppvObject); } @@ -221,7 +221,7 @@ public static unsafe class InteropServices public static int TryGetID3D12Resource(Texture1D texture, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); return texture.D3D12Resource->QueryInterface(riid, ppvObject); } @@ -242,7 +242,7 @@ public static unsafe class InteropServices public static int TryGetID3D12Resource(Texture2D texture, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); return texture.D3D12Resource->QueryInterface(riid, ppvObject); } @@ -263,7 +263,7 @@ public static unsafe class InteropServices public static int TryGetID3D12Resource(Texture3D texture, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); return texture.D3D12Resource->QueryInterface(riid, ppvObject); } @@ -284,7 +284,7 @@ public static unsafe class InteropServices public static int TryGetID3D12Resource(TransferBuffer buffer, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = buffer.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = buffer.GetReferenceTrackingLease(); return buffer.D3D12Resource->QueryInterface(riid, ppvObject); } @@ -305,7 +305,7 @@ public static unsafe class InteropServices public static int TryGetID3D12Resource(TransferTexture2D texture, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); return texture.D3D12Resource->QueryInterface(riid, ppvObject); } @@ -326,8 +326,8 @@ public static unsafe class InteropServices public static int TryGetID3D12Resource(TransferTexture3D texture, Guid* riid, void** ppvObject) where T : unmanaged { - using var _0 = texture.GetReferenceTrackingLease(); + using NativeObject.Lease _0 = texture.GetReferenceTrackingLease(); return texture.D3D12Resource->QueryInterface(riid, ppvObject); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Interop/NativeObject.ReferenceTracking.cs b/src/ComputeSharp/Graphics/Interop/NativeObject.ReferenceTracking.cs index 36e926cf..5bd358fa 100644 --- a/src/ComputeSharp/Graphics/Interop/NativeObject.ReferenceTracking.cs +++ b/src/ComputeSharp/Graphics/Interop/NativeObject.ReferenceTracking.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Threading; @@ -217,10 +217,7 @@ partial class NativeObject this.nativeObject = null; - if (nativeObject is not null) - { - nativeObject.ReturnReferenceTrackingLease(); - } + nativeObject?.ReturnReferenceTrackingLease(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Interop/NativeObject.cs b/src/ComputeSharp/Graphics/Interop/NativeObject.cs index 261990ec..30028508 100644 --- a/src/ComputeSharp/Graphics/Interop/NativeObject.cs +++ b/src/ComputeSharp/Graphics/Interop/NativeObject.cs @@ -1,4 +1,6 @@ -using System; +using System; + +#pragma warning disable CA1063 namespace ComputeSharp.Interop; @@ -46,4 +48,4 @@ public abstract partial class NativeObject : IDisposable /// /// This method is guaranteed to only ever be called once for a given tracked object. private protected abstract void OnDispose(); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Luid.cs b/src/ComputeSharp/Graphics/Luid.cs index 42c9286a..995738af 100644 --- a/src/ComputeSharp/Graphics/Luid.cs +++ b/src/ComputeSharp/Graphics/Luid.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using TerraFX.Interop.Windows; @@ -60,20 +60,20 @@ public readonly struct Luid : IEquatable /// public override string ToString() { - return (((long)this.highPart) << 32 | this.lowPart).ToString(); + return ((((long)this.highPart) << 32) | this.lowPart).ToString(); } #if NET6_0_OR_GREATER /// public string ToString(string? format, IFormatProvider? formatProvider) { - return (((long)this.highPart) << 32 | this.lowPart).ToString(format, formatProvider); + return ((((long)this.highPart) << 32) | this.lowPart).ToString(format, formatProvider); } /// public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan format, IFormatProvider? provider) { - return (((long)this.highPart) << 32 | this.lowPart).TryFormat(destination, out charsWritten, format, provider); + return ((((long)this.highPart) << 32) | this.lowPart).TryFormat(destination, out charsWritten, format, provider); } #endif @@ -100,4 +100,4 @@ public readonly struct Luid : IEquatable { return !a.Equals(b); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs index 05fd79ee..e9fb6501 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs @@ -1,4 +1,4 @@ -using System.Buffers; +using System.Buffers; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; @@ -25,7 +25,7 @@ namespace ComputeSharp.Resources; /// A representing a typed buffer stored on GPU memory. /// /// The type of items stored on the buffer. -public unsafe abstract class Buffer : NativeObject, IGraphicsResource +public abstract unsafe class Buffer : NativeObject, IGraphicsResource where T : unmanaged { #if NET6_0_OR_GREATER @@ -76,7 +76,7 @@ public unsafe abstract class Buffer : NativeObject, IGraphicsResource Guard.IsBetweenOrEqualTo(length, 1, (uint.MaxValue / elementSizeInBytes) & ~255); } - using var _0 = device.GetReferenceTrackingLease(); + using Lease _0 = device.GetReferenceTrackingLease(); device.ThrowIfDeviceLost(); @@ -89,7 +89,7 @@ public unsafe abstract class Buffer : NativeObject, IGraphicsResource nint usableSizeInBytes = checked((nint)(length * elementSizeInBytes)); nint effectiveSizeInBytes = resourceType == ResourceType.Constant ? AlignmentHelper.Pad(usableSizeInBytes, D3D12.D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT) : usableSizeInBytes; - SizeInBytes = usableSizeInBytes; + this.SizeInBytes = usableSizeInBytes; GraphicsDevice = device; Length = length; @@ -140,7 +140,7 @@ public unsafe abstract class Buffer : NativeObject, IGraphicsResource internal bool IsPaddingPresent { [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => SizeInBytes > (nint)Length * sizeof(T); + get => this.SizeInBytes > (nint)Length * sizeof(T); } /// @@ -234,7 +234,7 @@ public unsafe abstract class Buffer : NativeObject, IGraphicsResource /// internal (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) ValidateAndGetGpuAndCpuDescriptorHandlesForClear(GraphicsDevice device) { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceMismatch(device); @@ -252,4 +252,4 @@ public unsafe abstract class Buffer : NativeObject, IGraphicsResource return D3D12Resource; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs index 9ec2c94b..d108ae07 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Commands; using ComputeSharp.Graphics.Extensions; @@ -38,8 +38,8 @@ public abstract class StructuredBuffer : Buffer Guard.IsInRange(sourceOffset, 0, Length); Guard.IsLessThanOrEqualTo(sourceOffset + count, Length, nameof(sourceOffset)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -113,9 +113,9 @@ public abstract class StructuredBuffer : Buffer Guard.IsInRange(destinationOffset, 0, destination.Length); Guard.IsLessThanOrEqualTo(destinationOffset + count, destination.Length, nameof(destinationOffset)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = destination.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = destination.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -139,7 +139,10 @@ public abstract class StructuredBuffer : Buffer copyCommandList.ExecuteAndWaitForCompletion(); } - else CopyToWithCpuBuffer(destination, sourceOffset, destinationOffset, count); + else + { + CopyToWithCpuBuffer(destination, sourceOffset, destinationOffset, count); + } } /// @@ -158,9 +161,9 @@ public abstract class StructuredBuffer : Buffer Guard.IsInRange(destinationOffset, 0, destination.Length); Guard.IsLessThanOrEqualTo(destinationOffset + count, destination.Length, nameof(destinationOffset)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = destination.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = destination.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -199,8 +202,8 @@ public abstract class StructuredBuffer : Buffer Guard.IsInRange(offset, 0, Length); Guard.IsLessThanOrEqualTo(offset + length, Length, nameof(offset)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -239,17 +242,17 @@ public abstract class StructuredBuffer : Buffer #else using (ID3D12ResourceMap resource = d3D12Resource.Get()->Map()) #endif - fixed (void* sourcePointer = &source) - { - MemoryHelper.Copy( - source: sourcePointer, - destination: resource.Pointer, - sourceElementOffset: 0, - destinationElementOffset: 0, - sourceElementPitchInBytes: (uint)sizeof(T), - destinationElementPitchInBytes: (uint)sizeof(T), - count: (uint)length); - } + fixed (void* sourcePointer = &source) + { + MemoryHelper.Copy( + source: sourcePointer, + destination: resource.Pointer, + sourceElementOffset: 0, + destinationElementOffset: 0, + sourceElementPitchInBytes: (uint)sizeof(T), + destinationElementPitchInBytes: (uint)sizeof(T), + count: (uint)length); + } using CommandList copyCommandList = new(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COPY); @@ -278,9 +281,9 @@ public abstract class StructuredBuffer : Buffer Guard.IsInRange(destinationOffset, 0, Length); Guard.IsLessThanOrEqualTo(destinationOffset + count, Length, nameof(destinationOffset)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = source.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = source.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -311,4 +314,4 @@ public abstract class StructuredBuffer : Buffer copyCommandList.ExecuteAndWaitForCompletion(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture1D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture1D{T}.cs index daf616b7..10e4263b 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture1D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture1D{T}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using ComputeSharp.__Internals; @@ -26,7 +26,7 @@ namespace ComputeSharp.Resources; /// A representing a typed 1D texture stored on GPU memory. /// /// The type of items stored on the texture. -public unsafe abstract class Texture1D : NativeObject, IGraphicsResource, GraphicsResourceHelper.IGraphicsResource +public abstract unsafe class Texture1D : NativeObject, IGraphicsResource, GraphicsResourceHelper.IGraphicsResource where T : unmanaged { #if NET6_0_OR_GREATER @@ -73,7 +73,7 @@ public unsafe abstract class Texture1D : NativeObject, IGraphicsResource, Gra { Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE1D_U_DIMENSION); - using var _0 = device.GetReferenceTrackingLease(); + using Lease _0 = device.GetReferenceTrackingLease(); device.ThrowIfDeviceLost(); @@ -163,8 +163,8 @@ public unsafe abstract class Texture1D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX)); Guard.IsGreaterThanOrEqualTo(size, width); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -247,9 +247,9 @@ public unsafe abstract class Texture1D : NativeObject, IGraphicsResource, Gra Guard.IsBetweenOrEqualTo(destinationOffsetX + width, 1, destination.Width, nameof(destinationOffsetX)); Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = destination.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = destination.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -307,9 +307,9 @@ public unsafe abstract class Texture1D : NativeObject, IGraphicsResource, Gra Guard.IsBetweenOrEqualTo(destinationOffsetX + width, 1, destination.Width, nameof(destinationOffsetX)); Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = destination.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = destination.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -361,8 +361,8 @@ public unsafe abstract class Texture1D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(destinationOffsetX + width, Width, nameof(destinationOffsetX)); Guard.IsGreaterThanOrEqualTo(size, width); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -389,13 +389,15 @@ public unsafe abstract class Texture1D : NativeObject, IGraphicsResource, Gra #endif using (ID3D12ResourceMap resource = d3D12Resource.Get()->Map()) - fixed (void* sourcePointer = &source) { - Buffer.MemoryCopy( - source: sourcePointer, - destination: resource.Pointer, - destinationSizeInBytes: rowSizeInBytes, - sourceBytesToCopy: rowSizeInBytes); + fixed (void* sourcePointer = &source) + { + Buffer.MemoryCopy( + source: sourcePointer, + destination: resource.Pointer, + destinationSizeInBytes: rowSizeInBytes, + sourceBytesToCopy: rowSizeInBytes); + } } using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType); @@ -443,9 +445,9 @@ public unsafe abstract class Texture1D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(sourceOffsetX + width, source.Width, nameof(sourceOffsetX)); Guard.IsLessThanOrEqualTo(destinationOffsetX + width, Width, nameof(destinationOffsetX)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = source.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = source.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -532,7 +534,7 @@ public unsafe abstract class Texture1D : NativeObject, IGraphicsResource, Gra /// internal (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) ValidateAndGetGpuAndCpuDescriptorHandlesForClear(GraphicsDevice device, out bool isNormalized) { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceMismatch(device); @@ -571,7 +573,7 @@ public unsafe abstract class Texture1D : NativeObject, IGraphicsResource, Gra /// D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device) { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceMismatch(device); @@ -595,4 +597,4 @@ public unsafe abstract class Texture1D : NativeObject, IGraphicsResource, Gra { return ValidateAndGetID3D12ResourceAndTransitionStates(device, resourceState, out d3D12Resource, out lease); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs index 65d237f1..d4889717 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using ComputeSharp.__Internals; @@ -26,7 +26,7 @@ namespace ComputeSharp.Resources; /// A representing a typed 2D texture stored on GPU memory. /// /// The type of items stored on the texture. -public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, GraphicsResourceHelper.IGraphicsResource +public abstract unsafe class Texture2D : NativeObject, IGraphicsResource, GraphicsResourceHelper.IGraphicsResource where T : unmanaged { #if NET6_0_OR_GREATER @@ -75,7 +75,7 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION); Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION); - using var _0 = device.GetReferenceTrackingLease(); + using Lease _0 = device.GetReferenceTrackingLease(); device.ThrowIfDeviceLost(); @@ -178,8 +178,8 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY)); Guard.IsGreaterThanOrEqualTo(size, (nint)width * height); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -273,9 +273,9 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX)); Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = destination.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = destination.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -342,9 +342,9 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX)); Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = destination.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = destination.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -401,8 +401,8 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(destinationOffsetY + height, Height, nameof(destinationOffsetY)); Guard.IsGreaterThanOrEqualTo(size, (nint)width * height); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -430,14 +430,16 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra #endif using (ID3D12ResourceMap resource = d3D12Resource.Get()->Map()) - fixed (void* sourcePointer = &source) { - MemoryHelper.Copy( - sourcePointer, - resource.Pointer, - (uint)height, - rowSizeInBytes, - d3D12PlacedSubresourceFootprintSource.Footprint.RowPitch); + fixed (void* sourcePointer = &source) + { + MemoryHelper.Copy( + sourcePointer, + resource.Pointer, + (uint)height, + rowSizeInBytes, + d3D12PlacedSubresourceFootprintSource.Footprint.RowPitch); + } } using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType); @@ -494,9 +496,9 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(destinationOffsetX + width, Width, nameof(destinationOffsetX)); Guard.IsLessThanOrEqualTo(destinationOffsetY + height, Height, nameof(destinationOffsetY)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = source.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = source.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -583,7 +585,7 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra /// internal (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) ValidateAndGetGpuAndCpuDescriptorHandlesForClear(GraphicsDevice device, out bool isNormalized) { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceMismatch(device); @@ -622,7 +624,7 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra /// D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device) { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceMismatch(device); @@ -646,4 +648,4 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra { return ValidateAndGetID3D12ResourceAndTransitionStates(device, resourceState, out d3D12Resource, out lease); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs index 8f36b574..ef70c32f 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using ComputeSharp.__Internals; @@ -26,7 +26,7 @@ namespace ComputeSharp.Resources; /// A representing a typed 3D texture stored on GPU memory. /// /// The type of items stored on the texture. -public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, GraphicsResourceHelper.IGraphicsResource +public abstract unsafe class Texture3D : NativeObject, IGraphicsResource, GraphicsResourceHelper.IGraphicsResource where T : unmanaged { #if NET6_0_OR_GREATER @@ -77,7 +77,7 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); Guard.IsBetweenOrEqualTo(depth, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); - using var _0 = device.GetReferenceTrackingLease(); + using Lease _0 = device.GetReferenceTrackingLease(); device.ThrowIfDeviceLost(); @@ -193,8 +193,8 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(sourceOffsetZ + depth, Depth, nameof(sourceOffsetZ)); Guard.IsGreaterThanOrEqualTo(size, (nint)width * height * depth); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -300,9 +300,9 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY)); Guard.IsLessThanOrEqualTo(sourceOffsetZ + depth, Depth, nameof(sourceOffsetZ)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = destination.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = destination.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -378,9 +378,9 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY)); Guard.IsLessThanOrEqualTo(sourceOffsetZ + depth, Depth, nameof(sourceOffsetZ)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = destination.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = destination.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -442,8 +442,8 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(destinationOffsetZ + depth, Depth, nameof(destinationOffsetZ)); Guard.IsGreaterThanOrEqualTo(size, (nint)width * height * depth); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -472,16 +472,18 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra #endif using (ID3D12ResourceMap resource = d3D12Resource.Get()->Map()) - fixed (void* sourcePointer = &source) { - MemoryHelper.Copy( - sourcePointer, - resource.Pointer, - (uint)height, - (uint)depth, - rowSizeInBytes, - d3D12PlacedSubresourceFootprintSource.Footprint.RowPitch, - d3D12PlacedSubresourceFootprintSource.Footprint.RowPitch * (uint)height); + fixed (void* sourcePointer = &source) + { + MemoryHelper.Copy( + sourcePointer, + resource.Pointer, + (uint)height, + (uint)depth, + rowSizeInBytes, + d3D12PlacedSubresourceFootprintSource.Footprint.RowPitch, + d3D12PlacedSubresourceFootprintSource.Footprint.RowPitch * (uint)height); + } } using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType); @@ -547,9 +549,9 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra Guard.IsLessThanOrEqualTo(destinationOffsetY + height, Height, nameof(destinationOffsetY)); Guard.IsLessThanOrEqualTo(destinationOffsetZ + depth, Depth, nameof(destinationOffsetZ)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = source.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = source.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -636,7 +638,7 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra /// internal (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) ValidateAndGetGpuAndCpuDescriptorHandlesForClear(GraphicsDevice device, out bool isNormalized) { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceMismatch(device); @@ -675,7 +677,7 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra /// D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device) { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); ThrowIfDeviceMismatch(device); @@ -699,4 +701,4 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra { return ValidateAndGetID3D12ResourceAndTransitionStates(device, resourceState, out d3D12Resource, out lease); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs index 33f3efcf..2c6e9cfa 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; @@ -51,7 +51,7 @@ public abstract unsafe class TransferBuffer : NativeObject, IGraphicsResource // The maximum length is set such that the aligned buffer size can't exceed uint.MaxValue Guard.IsBetweenOrEqualTo(length, 1, (uint.MaxValue / (uint)sizeof(T)) & ~255); - using var _0 = device.GetReferenceTrackingLease(); + using Lease _0 = device.GetReferenceTrackingLease(); device.ThrowIfDeviceLost(); @@ -104,7 +104,7 @@ public abstract unsafe class TransferBuffer : NativeObject, IGraphicsResource [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); return new MemoryManager(this).Memory; } @@ -116,7 +116,7 @@ public abstract unsafe class TransferBuffer : NativeObject, IGraphicsResource [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); return new(this.mappedData, Length); } @@ -170,6 +170,7 @@ public abstract unsafe class TransferBuffer : NativeObject, IGraphicsResource /// public override Memory Memory { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => CreateMemory(this.buffer.Length); } @@ -184,7 +185,7 @@ public abstract unsafe class TransferBuffer : NativeObject, IGraphicsResource { Guard.IsEqualTo(elementIndex, 0); - using var _0 = this.buffer.GetReferenceTrackingLease(); + using Lease _0 = this.buffer.GetReferenceTrackingLease(); return new(this.buffer.mappedData); } @@ -199,4 +200,4 @@ public abstract unsafe class TransferBuffer : NativeObject, IGraphicsResource { } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture1D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture1D{T}.cs index 63058466..23eee345 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture1D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture1D{T}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; @@ -17,7 +17,7 @@ namespace ComputeSharp.Resources; /// A representing a typed 1D texture stored on on CPU memory, that can be used to transfer data to/from the GPU. /// /// The type of items stored on the texture. -public unsafe abstract class TransferTexture1D : NativeObject, IGraphicsResource, IMemoryOwner +public abstract unsafe class TransferTexture1D : NativeObject, IGraphicsResource, IMemoryOwner where T : unmanaged { #if NET6_0_OR_GREATER @@ -53,7 +53,7 @@ public unsafe abstract class TransferTexture1D : NativeObject, IGraphicsResou { Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE1D_U_DIMENSION); - using var _0 = device.GetReferenceTrackingLease(); + using Lease _0 = device.GetReferenceTrackingLease(); device.ThrowIfDeviceLost(); @@ -109,7 +109,7 @@ public unsafe abstract class TransferTexture1D : NativeObject, IGraphicsResou [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); return new MemoryManager(this).Memory; } @@ -121,7 +121,7 @@ public unsafe abstract class TransferTexture1D : NativeObject, IGraphicsResou [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - using var _0 = GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); return new(this.mappedData, Width); } @@ -175,6 +175,7 @@ public unsafe abstract class TransferTexture1D : NativeObject, IGraphicsResou /// public override Memory Memory { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => CreateMemory(this.buffer.Width); } @@ -189,7 +190,7 @@ public unsafe abstract class TransferTexture1D : NativeObject, IGraphicsResou { Guard.IsEqualTo(elementIndex, 0); - using var _0 = this.buffer.GetReferenceTrackingLease(); + using Lease _0 = this.buffer.GetReferenceTrackingLease(); return new(this.buffer.mappedData); } @@ -204,4 +205,4 @@ public unsafe abstract class TransferTexture1D : NativeObject, IGraphicsResou { } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs index 05bc33e4..52aa6f3a 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Extensions; @@ -15,7 +15,7 @@ namespace ComputeSharp.Resources; /// A representing a typed 2D texture stored on on CPU memory, that can be used to transfer data to/from the GPU. /// /// The type of items stored on the texture. -public unsafe abstract class TransferTexture2D : NativeObject, IGraphicsResource +public abstract unsafe class TransferTexture2D : NativeObject, IGraphicsResource where T : unmanaged { #if NET6_0_OR_GREATER @@ -53,7 +53,7 @@ public unsafe abstract class TransferTexture2D : NativeObject, IGraphicsResou Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION); Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION); - using var _0 = device.GetReferenceTrackingLease(); + using Lease _0 = device.GetReferenceTrackingLease(); device.ThrowIfDeviceLost(); @@ -115,7 +115,7 @@ public unsafe abstract class TransferTexture2D : NativeObject, IGraphicsResou [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - using var _0 = this.GetReferenceTrackingLease(); + using Lease _0 = this.GetReferenceTrackingLease(); return new(this.mappedData, Width, Height, (int)this.d3D12PlacedSubresourceFootprint.Footprint.RowPitch); } @@ -146,4 +146,4 @@ public unsafe abstract class TransferTexture2D : NativeObject, IGraphicsResou GraphicsDeviceMismatchException.Throw(this, device); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs index 701399b1..b564a246 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Extensions; @@ -15,7 +15,7 @@ namespace ComputeSharp.Resources; /// A representing a typed 3D texture stored on on CPU memory, that can be used to transfer data to/from the GPU. /// /// The type of items stored on the texture. -public unsafe abstract class TransferTexture3D : NativeObject, IGraphicsResource +public abstract unsafe class TransferTexture3D : NativeObject, IGraphicsResource where T : unmanaged { #if NET6_0_OR_GREATER @@ -55,7 +55,7 @@ public unsafe abstract class TransferTexture3D : NativeObject, IGraphicsResou Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); Guard.IsBetweenOrEqualTo(depth, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); - using var _0 = device.GetReferenceTrackingLease(); + using Lease _0 = device.GetReferenceTrackingLease(); device.ThrowIfDeviceLost(); @@ -123,7 +123,7 @@ public unsafe abstract class TransferTexture3D : NativeObject, IGraphicsResou [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - using var _0 = this.GetReferenceTrackingLease(); + using Lease _0 = this.GetReferenceTrackingLease(); return new(this.mappedData, Width, Height, Depth, (int)this.d3D12PlacedSubresourceFootprint.Footprint.RowPitch); } @@ -154,4 +154,4 @@ public unsafe abstract class TransferTexture3D : NativeObject, IGraphicsResou GraphicsDeviceMismatchException.Throw(this, device); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs index 56f4d842..cd5dfed7 100644 --- a/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; @@ -63,8 +63,8 @@ public sealed class ConstantBuffer : Buffer Guard.IsInRange(offset, 0, Length); Guard.IsLessThanOrEqualTo(offset + length, Length, nameof(offset)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -93,9 +93,9 @@ public sealed class ConstantBuffer : Buffer Guard.IsInRange(destinationOffset, 0, destination.Length); Guard.IsLessThanOrEqualTo(destinationOffset + length, destination.Length, nameof(destinationOffset)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); - using var _2 = destination.GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); + using Lease _2 = destination.GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -115,7 +115,10 @@ public sealed class ConstantBuffer : Buffer destinationElementPitchInBytes: (uint)GetPaddedSize(), count: (uint)length); } - else CopyToWithCpuBuffer(destination, sourceOffset, destinationOffset, length); + else + { + CopyToWithCpuBuffer(destination, sourceOffset, destinationOffset, length); + } } /// @@ -125,8 +128,8 @@ public sealed class ConstantBuffer : Buffer Guard.IsInRange(offset, 0, Length); Guard.IsLessThanOrEqualTo(offset + length, Length, nameof(offset)); - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -150,4 +153,4 @@ public sealed class ConstantBuffer : Buffer { return $"ComputeSharp.ConstantBuffer<{typeof(T)}>[{Length}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Debug/BufferDebugView{T}.cs b/src/ComputeSharp/Graphics/Resources/Debug/BufferDebugView{T}.cs index 6ee0d853..2b1209e6 100644 --- a/src/ComputeSharp/Graphics/Resources/Debug/BufferDebugView{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Debug/BufferDebugView{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; #if NET6_0_OR_GREATER using GC = System.GC; #else @@ -35,4 +35,4 @@ internal sealed class BufferDebugView /// [DebuggerBrowsable(DebuggerBrowsableState.Collapsed)] public T[]? Items { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Debug/Texture1DDebugView{T}.cs b/src/ComputeSharp/Graphics/Resources/Debug/Texture1DDebugView{T}.cs index a36c242d..147296f2 100644 --- a/src/ComputeSharp/Graphics/Resources/Debug/Texture1DDebugView{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Debug/Texture1DDebugView{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; namespace ComputeSharp.Resources.Debug; @@ -30,4 +30,4 @@ internal sealed class Texture1DDebugView /// [DebuggerBrowsable(DebuggerBrowsableState.Collapsed)] public T[]? Items { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Debug/Texture2DDebugView{T}.cs b/src/ComputeSharp/Graphics/Resources/Debug/Texture2DDebugView{T}.cs index 88020a15..37db3923 100644 --- a/src/ComputeSharp/Graphics/Resources/Debug/Texture2DDebugView{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Debug/Texture2DDebugView{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; namespace ComputeSharp.Resources.Debug; @@ -30,4 +30,4 @@ internal sealed class Texture2DDebugView /// [DebuggerBrowsable(DebuggerBrowsableState.Collapsed)] public T[,]? Items { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Debug/Texture3DDebugView{T}.cs b/src/ComputeSharp/Graphics/Resources/Debug/Texture3DDebugView{T}.cs index 4da600b1..d26ad6cd 100644 --- a/src/ComputeSharp/Graphics/Resources/Debug/Texture3DDebugView{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Debug/Texture3DDebugView{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; namespace ComputeSharp.Resources.Debug; @@ -30,4 +30,4 @@ internal sealed class Texture3DDebugView /// [DebuggerBrowsable(DebuggerBrowsableState.Collapsed)] public T[,,]? Items { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Debug/TransferBufferDebugView{T}.cs b/src/ComputeSharp/Graphics/Resources/Debug/TransferBufferDebugView{T}.cs index 71d51056..ed03ad6b 100644 --- a/src/ComputeSharp/Graphics/Resources/Debug/TransferBufferDebugView{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Debug/TransferBufferDebugView{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; #if NET6_0_OR_GREATER using GC = System.GC; #else @@ -35,4 +35,4 @@ internal sealed class TransferBufferDebugView /// [DebuggerBrowsable(DebuggerBrowsableState.Collapsed)] public T[]? Items { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Debug/TransferTexture1DDebugView{T}.cs b/src/ComputeSharp/Graphics/Resources/Debug/TransferTexture1DDebugView{T}.cs index 7b277889..c37b4d45 100644 --- a/src/ComputeSharp/Graphics/Resources/Debug/TransferTexture1DDebugView{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Debug/TransferTexture1DDebugView{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; namespace ComputeSharp.Resources.Debug; @@ -23,4 +23,4 @@ internal sealed class TransferTexture1DDebugView /// [DebuggerBrowsable(DebuggerBrowsableState.Collapsed)] public T[]? Items { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Debug/TransferTexture2DDebugView{T}.cs b/src/ComputeSharp/Graphics/Resources/Debug/TransferTexture2DDebugView{T}.cs index 9ef6327e..bedecbc8 100644 --- a/src/ComputeSharp/Graphics/Resources/Debug/TransferTexture2DDebugView{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Debug/TransferTexture2DDebugView{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; namespace ComputeSharp.Resources.Debug; @@ -23,4 +23,4 @@ internal sealed class TransferTexture2DDebugView /// [DebuggerBrowsable(DebuggerBrowsableState.Collapsed)] public T[,]? Items { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Debug/TransferTexture3DDebugView{T}.cs b/src/ComputeSharp/Graphics/Resources/Debug/TransferTexture3DDebugView{T}.cs index b3b0f63c..2ad6c3b5 100644 --- a/src/ComputeSharp/Graphics/Resources/Debug/TransferTexture3DDebugView{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Debug/TransferTexture3DDebugView{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; namespace ComputeSharp.Resources.Debug; @@ -23,4 +23,4 @@ internal sealed class TransferTexture3DDebugView /// [DebuggerBrowsable(DebuggerBrowsableState.Collapsed)] public T[,,]? Items { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Enums/AllocationMode.cs b/src/ComputeSharp/Graphics/Resources/Enums/AllocationMode.cs index a6ec6b97..f99a79af 100644 --- a/src/ComputeSharp/Graphics/Resources/Enums/AllocationMode.cs +++ b/src/ComputeSharp/Graphics/Resources/Enums/AllocationMode.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An that indicates a mode to use when allocating resources. @@ -16,4 +16,4 @@ public enum AllocationMode /// Clear allocated buffers when creating them. /// Clear -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Enums/ResourceState.cs b/src/ComputeSharp/Graphics/Resources/Enums/ResourceState.cs index 684ed25b..ca2a79ef 100644 --- a/src/ComputeSharp/Graphics/Resources/Enums/ResourceState.cs +++ b/src/ComputeSharp/Graphics/Resources/Enums/ResourceState.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An that indicates the state of a resource after a given transition. @@ -14,4 +14,4 @@ public enum ResourceState /// A read write resource, with both read and write access for the GPU, but without support for texture sampling. /// ReadWrite -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Enums/ResourceType.cs b/src/ComputeSharp/Graphics/Resources/Enums/ResourceType.cs index 3c61b131..81dc7c8a 100644 --- a/src/ComputeSharp/Graphics/Resources/Enums/ResourceType.cs +++ b/src/ComputeSharp/Graphics/Resources/Enums/ResourceType.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.Graphics.Resources.Enums; +namespace ComputeSharp.Graphics.Resources.Enums; /// /// An that indicates the type of a given HLSL resource. @@ -39,4 +39,4 @@ internal enum ResourceType /// Resources of this type are located in . /// Upload -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Helpers/ResourceStateHelper.cs b/src/ComputeSharp/Graphics/Resources/Helpers/ResourceStateHelper.cs index d6f45f59..6d06aefc 100644 --- a/src/ComputeSharp/Graphics/Resources/Helpers/ResourceStateHelper.cs +++ b/src/ComputeSharp/Graphics/Resources/Helpers/ResourceStateHelper.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using TerraFX.Interop.DirectX; using static TerraFX.Interop.DirectX.D3D12_RESOURCE_STATES; @@ -21,8 +21,8 @@ internal static class ResourceStateHelper if (resourceState == ResourceState.ReadOnly) { return D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE; - } - + } + if (resourceState == ResourceState.ReadWrite) { return D3D12_RESOURCE_STATE_UNORDERED_ACCESS; @@ -30,4 +30,4 @@ internal static class ResourceStateHelper return ThrowHelper.ThrowArgumentException("The target resource state is not valid."); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IGraphicsResource.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IGraphicsResource.cs index b55614d9..11316fcb 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IGraphicsResource.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IGraphicsResource.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An interface representing a graphics resource associated to a given instance. @@ -9,4 +9,4 @@ public interface IGraphicsResource /// Gets the instance associated with the current resource. /// GraphicsDevice GraphicsDevice { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture1D{TPixel}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture1D{TPixel}.cs index eda6c900..a19801b5 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture1D{TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture1D{TPixel}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An interface representing a typed readonly 1D texture containing normalized pixel data stored on GPU memory. @@ -26,4 +26,4 @@ public interface IReadOnlyNormalizedTexture1D : IGraphicsResource /// The horizontal normalized offset of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. ref readonly TPixel Sample(float u); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture2D{TPixel}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture2D{TPixel}.cs index 6c896ce0..2d9dd29a 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture2D{TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture2D{TPixel}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An interface representing a typed readonly 2D texture containing normalized pixel data stored on GPU memory. @@ -47,4 +47,4 @@ public interface IReadOnlyNormalizedTexture2D : IGraphicsResource /// The normalized coordinates of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. ref readonly TPixel Sample(Float2 uv); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture3D{TPixel}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture3D{TPixel}.cs index 8b5c3f7d..c9da4ef7 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture3D{TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture3D{TPixel}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An interface representing a typed readonly 3D texture containing normalized pixel data stored on GPU memory. @@ -54,4 +54,4 @@ public interface IReadOnlyNormalizedTexture3D : IGraphicsResource /// The normalized coordinates of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. ref readonly TPixel Sample(Float3 uvw); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture1D{T}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture1D{T}.cs index 14ae0c64..71bf6252 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture1D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture1D{T}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An interface representing a typed readonly 1D texture containing raw data stored on GPU memory. @@ -26,4 +26,4 @@ public interface IReadOnlyTexture1D : IGraphicsResource /// The horizontal normalized offset of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. ref readonly T Sample(float u); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture2D{T}.cs index e0e32110..891698be 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture2D{T}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An interface representing a typed readonly 2D texture containing raw data stored on GPU memory. @@ -47,4 +47,4 @@ public interface IReadOnlyTexture2D : IGraphicsResource /// The normalized coordinates of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. ref readonly T Sample(Float2 uv); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture3D{T}.cs index c08086c0..2c15d640 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture3D{T}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An interface representing a typed readonly 3D texture containing raw data stored on GPU memory. @@ -54,4 +54,4 @@ public interface IReadOnlyTexture3D : IGraphicsResource /// The normalized coordinates of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. ref readonly T Sample(Float3 uvw); -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture1D{TPixel}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture1D{TPixel}.cs index 0d65f74d..0df9eb80 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture1D{TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture1D{TPixel}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An interface representing a typed writeable 1D texture containing normalized pixel data stored on GPU memory. @@ -19,4 +19,4 @@ public interface IReadWriteNormalizedTexture1D : IGraphicsResource /// The horizontal offset of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. ref TPixel this[int x] { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture2D{TPixel}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture2D{TPixel}.cs index 3c9255bd..bebecc57 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture2D{TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture2D{TPixel}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An interface representing a typed writeable 2D texture containing normalized pixel data stored on GPU memory. @@ -32,4 +32,4 @@ public interface IReadWriteNormalizedTexture2D : IGraphicsResource /// The coordinates of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. ref TPixel this[Int2 xy] { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture3D{TPixel}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture3D{TPixel}.cs index 9ddb39ad..1477b115 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture3D{TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture3D{TPixel}.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp; +namespace ComputeSharp; /// /// An interface representing a typed writeable 2D texture containing normalized pixel data stored on GPU memory. @@ -38,4 +38,4 @@ public interface IReadWriteNormalizedTexture3D : IGraphicsResource /// The coordinates of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. ref TPixel this[Int3 xyz] { get; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Interop/ID3D12ResourceMap.cs b/src/ComputeSharp/Graphics/Resources/Interop/ID3D12ResourceMap.cs index e5b71cfb..4838fd9e 100644 --- a/src/ComputeSharp/Graphics/Resources/Interop/ID3D12ResourceMap.cs +++ b/src/ComputeSharp/Graphics/Resources/Interop/ID3D12ResourceMap.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.Graphics.Extensions; using TerraFX.Interop.DirectX; @@ -30,7 +30,7 @@ internal readonly unsafe ref struct ID3D12ResourceMap { this.d3D12Resource = d3D12Resource; - Pointer = pointer; + this.Pointer = pointer; } /// @@ -39,4 +39,4 @@ internal readonly unsafe ref struct ID3D12ResourceMap { this.d3D12Resource->Unmap(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Interop/__Internals/ResourceDescriptor.cs b/src/ComputeSharp/Graphics/Resources/Interop/__Internals/ResourceDescriptor.cs index e0cb246b..803ef761 100644 --- a/src/ComputeSharp/Graphics/Resources/Interop/__Internals/ResourceDescriptor.cs +++ b/src/ComputeSharp/Graphics/Resources/Interop/__Internals/ResourceDescriptor.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.ComponentModel; using TerraFX.Interop.DirectX; using static TerraFX.Interop.DirectX.D3D12_DESCRIPTOR_RANGE_FLAGS; -#pragma warning disable IDE0052, CS0414 +#pragma warning disable IDE0052, IDE1006, CS0414 namespace ComputeSharp.__Internals; @@ -47,4 +47,4 @@ public struct ResourceDescriptor descriptor.Flags = D3D12_DESCRIPTOR_RANGE_FLAG_NONE; descriptor.OffsetInDescriptorsFromTableStart = D3D12.D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadBackBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadBackBuffer{T}.cs index 78b8ec2d..9e4c5a63 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadBackBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadBackBuffer{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -32,4 +32,4 @@ public sealed class ReadBackBuffer : TransferBuffer { return $"ComputeSharp.ReadBackBuffer<{typeof(T)}>[{Length}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadBackTexture1D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadBackTexture1D{T}.cs index 7ee3a5f9..0085e298 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadBackTexture1D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadBackTexture1D{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; @@ -30,4 +30,4 @@ public sealed class ReadBackTexture1D : TransferTexture1D { return $"ComputeSharp.ReadBackTexture1D<{typeof(T)}>[{Width}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadBackTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadBackTexture2D{T}.cs index 5ea12337..da1e38d1 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadBackTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadBackTexture2D{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; @@ -31,4 +31,4 @@ public sealed class ReadBackTexture2D : TransferTexture2D { return $"ComputeSharp.ReadBackTexture2D<{typeof(T)}>[{Width}, {Height}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadBackTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadBackTexture3D{T}.cs index 2bd68a01..9efe7da4 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadBackTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadBackTexture3D{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; @@ -32,4 +32,4 @@ public sealed class ReadBackTexture3D : TransferTexture3D { return $"ComputeSharp.ReadBackTexture3D<{typeof(T)}>[{Width}, {Height}, {Depth}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyBuffer{T}.cs index ffa70ebb..7febe5f1 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyBuffer{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; @@ -40,4 +40,4 @@ public sealed class ReadOnlyBuffer : StructuredBuffer { return $"ComputeSharp.ReadOnlyBuffer<{typeof(T)}>[{Length}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture1D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture1D{T,TPixel}.cs index 53315a0a..f529a648 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture1D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture1D{T,TPixel}.cs @@ -1,10 +1,12 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; +#pragma warning disable IDE0022 + namespace ComputeSharp; /// @@ -40,4 +42,4 @@ public sealed class ReadOnlyTexture1D : Texture1D, IReadOnlyNormal { return $"ComputeSharp.ReadOnlyTexture1D<{typeof(T)}, {typeof(TPixel)}>[{Width}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture1D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture1D{T}.cs index 2ebbb317..aa0493c5 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture1D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture1D{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -39,4 +39,4 @@ public sealed class ReadOnlyTexture1D : Texture1D { return $"ComputeSharp.ReadOnlyTexture1D<{typeof(T)}>[{Width}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs index 376267a5..93bee080 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs @@ -1,10 +1,12 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; +#pragma warning disable IDE0022 + namespace ComputeSharp; /// @@ -34,7 +36,7 @@ public sealed class ReadOnlyTexture2D : Texture2D, IReadOnlyNormal public ref readonly TPixel this[int x, int y] => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture2D)}[{typeof(int)}, {typeof(int)}]"); /// - public ref readonly TPixel this[Int2 xy] => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture2D)}[{typeof(Int2)}]"); + public ref readonly TPixel this[Int2 xy] => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture2D)}[{typeof(Int2)}]"); /// public ref readonly TPixel Sample(float u, float v) => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture2D)}.{nameof(Sample)}({typeof(float)}, {typeof(float)})"); @@ -47,4 +49,4 @@ public sealed class ReadOnlyTexture2D : Texture2D, IReadOnlyNormal { return $"ComputeSharp.ReadOnlyTexture2D<{typeof(T)}, {typeof(TPixel)}>[{Width}, {Height}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T}.cs index 5b6e7271..a1261e6d 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -48,4 +48,4 @@ public sealed class ReadOnlyTexture2D : Texture2D { return $"ComputeSharp.ReadOnlyTexture2D<{typeof(T)}>[{Width}, {Height}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs index f27322f2..0beb680c 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs @@ -1,10 +1,12 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; +#pragma warning disable IDE0022 + namespace ComputeSharp; /// @@ -48,4 +50,4 @@ public sealed class ReadOnlyTexture3D : Texture3D, IReadOnlyNormal { return $"ComputeSharp.ReadOnlyTexture3D<{typeof(T)}, {nameof(TPixel)}>[{Width}, {Height}, {Depth}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T}.cs index dd4baaa0..60121dc3 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -50,4 +50,4 @@ public sealed class ReadOnlyTexture3D : Texture3D { return $"ComputeSharp.ReadOnlyTexture3D<{typeof(T)}>[{Width}, {Height}, {Depth}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteBuffer{T}.cs index 45e82eed..944beb97 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteBuffer{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; @@ -40,4 +40,4 @@ public sealed class ReadWriteBuffer : StructuredBuffer { return $"ComputeSharp.ReadWriteBuffer<{typeof(T)}>[{Length}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T,TPixel}.ReadOnly.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T,TPixel}.ReadOnly.cs index 7ed9ac15..0244ff9f 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T,TPixel}.ReadOnly.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T,TPixel}.ReadOnly.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.__Internals; using ComputeSharp.Exceptions; @@ -9,7 +9,7 @@ using ComputeSharp.Interop; using TerraFX.Interop.DirectX; using static TerraFX.Interop.DirectX.D3D12_SRV_DIMENSION; -#pragma warning disable CS0618 +#pragma warning disable CS0618, IDE0022 namespace ComputeSharp; @@ -24,8 +24,8 @@ partial class ReadWriteTexture1D /// internal IReadOnlyNormalizedTexture1D AsReadOnly() { - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -100,8 +100,8 @@ partial class ReadWriteTexture1D /// D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device) { - using var _0 = GetReferenceTrackingLease(); - using var _1 = this.owner.GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); + using Lease _1 = this.owner.GetReferenceTrackingLease(); this.owner.ThrowIfDeviceMismatch(device); @@ -119,7 +119,7 @@ partial class ReadWriteTexture1D { lease = GetReferenceTrackingLease(); - using var _1 = this.owner.GetReferenceTrackingLease(); + using Lease _1 = this.owner.GetReferenceTrackingLease(); this.owner.ThrowIfDeviceMismatch(device); @@ -143,4 +143,4 @@ partial class ReadWriteTexture1D } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T,TPixel}.cs index b40d5b82..43ba6251 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T,TPixel}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -37,4 +37,4 @@ public sealed partial class ReadWriteTexture1D : Texture1D, IReadW { return $"ComputeSharp.ReadWriteTexture1D<{typeof(T)}, {typeof(TPixel)}>[{Width}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T}.ReadOnly.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T}.ReadOnly.cs index 4f03c9b9..e662caf1 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T}.ReadOnly.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T}.ReadOnly.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.__Internals; using ComputeSharp.Exceptions; @@ -9,7 +9,7 @@ using ComputeSharp.Interop; using TerraFX.Interop.DirectX; using static TerraFX.Interop.DirectX.D3D12_SRV_DIMENSION; -#pragma warning disable CS0618 +#pragma warning disable CS0618, IDE0022 namespace ComputeSharp; @@ -24,8 +24,8 @@ partial class ReadWriteTexture1D /// public IReadOnlyTexture1D AsReadOnly() { - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -100,8 +100,8 @@ partial class ReadWriteTexture1D /// D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device) { - using var _0 = GetReferenceTrackingLease(); - using var _1 = this.owner.GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); + using Lease _1 = this.owner.GetReferenceTrackingLease(); this.owner.ThrowIfDeviceMismatch(device); @@ -119,7 +119,7 @@ partial class ReadWriteTexture1D { lease = GetReferenceTrackingLease(); - using var _1 = this.owner.GetReferenceTrackingLease(); + using Lease _1 = this.owner.GetReferenceTrackingLease(); this.owner.ThrowIfDeviceMismatch(device); @@ -143,4 +143,4 @@ partial class ReadWriteTexture1D } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T}.cs index 4cd863ad..57b061c3 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture1D{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -39,4 +39,4 @@ public sealed partial class ReadWriteTexture1D : Texture1D { return $"ComputeSharp.ReadWriteTexture1D<{typeof(T)}>[{Width}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.ReadOnly.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.ReadOnly.cs index c52f1ec2..c79591fd 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.ReadOnly.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.ReadOnly.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.__Internals; using ComputeSharp.Exceptions; @@ -9,7 +9,7 @@ using ComputeSharp.Interop; using TerraFX.Interop.DirectX; using static TerraFX.Interop.DirectX.D3D12_SRV_DIMENSION; -#pragma warning disable CS0618 +#pragma warning disable CS0618, IDE0022 namespace ComputeSharp; @@ -24,8 +24,8 @@ partial class ReadWriteTexture2D /// internal IReadOnlyNormalizedTexture2D AsReadOnly() { - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -112,8 +112,8 @@ partial class ReadWriteTexture2D /// D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device) { - using var _0 = GetReferenceTrackingLease(); - using var _1 = this.owner.GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); + using Lease _1 = this.owner.GetReferenceTrackingLease(); this.owner.ThrowIfDeviceMismatch(device); @@ -131,7 +131,7 @@ partial class ReadWriteTexture2D { lease = GetReferenceTrackingLease(); - using var _1 = this.owner.GetReferenceTrackingLease(); + using Lease _1 = this.owner.GetReferenceTrackingLease(); this.owner.ThrowIfDeviceMismatch(device); @@ -155,4 +155,4 @@ partial class ReadWriteTexture2D } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs index fecb9603..ba59c270 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -41,4 +41,4 @@ public sealed partial class ReadWriteTexture2D : Texture2D, IReadW { return $"ComputeSharp.ReadWriteTexture2D<{typeof(T)}, {typeof(TPixel)}>[{Width}, {Height}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.ReadOnly.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.ReadOnly.cs index 56c278f0..c6e4113e 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.ReadOnly.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.ReadOnly.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.__Internals; using ComputeSharp.Exceptions; @@ -9,7 +9,7 @@ using ComputeSharp.Interop; using TerraFX.Interop.DirectX; using static TerraFX.Interop.DirectX.D3D12_SRV_DIMENSION; -#pragma warning disable CS0618 +#pragma warning disable CS0618, IDE0022 namespace ComputeSharp; @@ -24,8 +24,8 @@ partial class ReadWriteTexture2D /// public IReadOnlyTexture2D AsReadOnly() { - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -112,8 +112,8 @@ partial class ReadWriteTexture2D /// D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device) { - using var _0 = GetReferenceTrackingLease(); - using var _1 = this.owner.GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); + using Lease _1 = this.owner.GetReferenceTrackingLease(); this.owner.ThrowIfDeviceMismatch(device); @@ -131,7 +131,7 @@ partial class ReadWriteTexture2D { lease = GetReferenceTrackingLease(); - using var _1 = this.owner.GetReferenceTrackingLease(); + using Lease _1 = this.owner.GetReferenceTrackingLease(); this.owner.ThrowIfDeviceMismatch(device); @@ -155,4 +155,4 @@ partial class ReadWriteTexture2D } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.cs index d4e055ff..42c2c5f2 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -48,4 +48,4 @@ public sealed partial class ReadWriteTexture2D : Texture2D { return $"ComputeSharp.ReadWriteTexture2D<{typeof(T)}>[{Width}, {Height}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.ReadOnly.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.ReadOnly.cs index 29df6f79..1d28fdaf 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.ReadOnly.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.ReadOnly.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.__Internals; using ComputeSharp.Exceptions; @@ -9,7 +9,7 @@ using ComputeSharp.Interop; using TerraFX.Interop.DirectX; using static TerraFX.Interop.DirectX.D3D12_SRV_DIMENSION; -#pragma warning disable CS0618 +#pragma warning disable CS0618, IDE0022 namespace ComputeSharp; @@ -24,8 +24,8 @@ partial class ReadWriteTexture3D /// public IReadOnlyNormalizedTexture3D AsReadOnly() { - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -112,8 +112,8 @@ partial class ReadWriteTexture3D /// D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device) { - using var _0 = GetReferenceTrackingLease(); - using var _1 = this.owner.GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); + using Lease _1 = this.owner.GetReferenceTrackingLease(); this.owner.ThrowIfDeviceMismatch(device); @@ -131,7 +131,7 @@ partial class ReadWriteTexture3D { lease = GetReferenceTrackingLease(); - using var _1 = this.owner.GetReferenceTrackingLease(); + using Lease _1 = this.owner.GetReferenceTrackingLease(); this.owner.ThrowIfDeviceMismatch(device); @@ -155,4 +155,4 @@ partial class ReadWriteTexture3D } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs index d7f68197..afd6c66a 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -42,4 +42,4 @@ public sealed partial class ReadWriteTexture3D : Texture3D, IReadW { return $"ComputeSharp.ReadWriteTexture3D<{typeof(T)}, {nameof(TPixel)}>[{Width}, {Height}, {Depth}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.ReadOnly.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.ReadOnly.cs index 9161f98f..25a0cf77 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.ReadOnly.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.ReadOnly.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.__Internals; using ComputeSharp.Exceptions; @@ -9,7 +9,7 @@ using ComputeSharp.Interop; using TerraFX.Interop.DirectX; using static TerraFX.Interop.DirectX.D3D12_SRV_DIMENSION; -#pragma warning disable CS0618 +#pragma warning disable CS0618, IDE0022 namespace ComputeSharp; @@ -24,8 +24,8 @@ partial class ReadWriteTexture3D /// public IReadOnlyTexture3D AsReadOnly() { - using var _0 = GraphicsDevice.GetReferenceTrackingLease(); - using var _1 = GetReferenceTrackingLease(); + using Lease _0 = GraphicsDevice.GetReferenceTrackingLease(); + using Lease _1 = GetReferenceTrackingLease(); GraphicsDevice.ThrowIfDeviceLost(); @@ -112,8 +112,8 @@ partial class ReadWriteTexture3D /// D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device) { - using var _0 = GetReferenceTrackingLease(); - using var _1 = this.owner.GetReferenceTrackingLease(); + using Lease _0 = GetReferenceTrackingLease(); + using Lease _1 = this.owner.GetReferenceTrackingLease(); this.owner.ThrowIfDeviceMismatch(device); @@ -131,7 +131,7 @@ partial class ReadWriteTexture3D { lease = GetReferenceTrackingLease(); - using var _1 = this.owner.GetReferenceTrackingLease(); + using Lease _1 = this.owner.GetReferenceTrackingLease(); this.owner.ThrowIfDeviceMismatch(device); @@ -155,4 +155,4 @@ partial class ReadWriteTexture3D } } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.cs index 28f3e10f..1f00f3cf 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -50,4 +50,4 @@ public sealed partial class ReadWriteTexture3D : Texture3D { return $"ComputeSharp.ReadWriteTexture3D<{typeof(T)}>[{Width}, {Height}, {Depth}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/UploadBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/UploadBuffer{T}.cs index 1400f410..09e3b311 100644 --- a/src/ComputeSharp/Graphics/Resources/UploadBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/UploadBuffer{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -32,4 +32,4 @@ public sealed class UploadBuffer : TransferBuffer { return $"ComputeSharp.UploadBuffer<{typeof(T)}>[{Length}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/UploadTexture1D{T}.cs b/src/ComputeSharp/Graphics/Resources/UploadTexture1D{T}.cs index 53f6a43d..47093d49 100644 --- a/src/ComputeSharp/Graphics/Resources/UploadTexture1D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/UploadTexture1D{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; @@ -30,4 +30,4 @@ public sealed class UploadTexture1D : TransferTexture1D { return $"ComputeSharp.UploadTexture1D<{typeof(T)}>[{Width}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/UploadTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/UploadTexture2D{T}.cs index 19397908..c92fe371 100644 --- a/src/ComputeSharp/Graphics/Resources/UploadTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/UploadTexture2D{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; @@ -31,4 +31,4 @@ public sealed class UploadTexture2D : TransferTexture2D { return $"ComputeSharp.UploadTexture2D<{typeof(T)}>[{Width}, {Height}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/UploadTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/UploadTexture3D{T}.cs index 9bbe844b..68b08515 100644 --- a/src/ComputeSharp/Graphics/Resources/UploadTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/UploadTexture3D{T}.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; @@ -32,4 +32,4 @@ public sealed class UploadTexture3D : TransferTexture3D { return $"ComputeSharp.UploadTexture3D<{typeof(T)}>[{Width}, {Height}, {Depth}]"; } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs index 610ea99c..200a6c08 100644 --- a/src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.ComponentModel; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; -#pragma warning disable CS0809 +#pragma warning disable CS0809, CA1065 namespace ComputeSharp; @@ -16,7 +16,7 @@ namespace ComputeSharp; /// It is recommended to execute as much computation on the GPU side as possible. /// /// The type of items in the current instance. -public readonly unsafe ref partial struct TextureView2D +public readonly unsafe ref struct TextureView2D where T : unmanaged { // Let's consider a representation of a 2D texture or a generic 2D memory region. @@ -339,7 +339,7 @@ public readonly unsafe ref partial struct TextureView2D /// [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Equals() on Span will always throw an exception. Use == instead.")] + [Obsolete("Equals() on TextureView2D will always throw an exception. Use == instead.")] public override bool Equals(object? obj) { throw new NotSupportedException("ComputeSharp.TextureView2D.Equals(object) is not supported"); @@ -347,7 +347,7 @@ public readonly unsafe ref partial struct TextureView2D /// [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("GetHashCode() on Span will always throw an exception.")] + [Obsolete("GetHashCode() on TextureView2D will always throw an exception.")] public override int GetHashCode() { throw new NotSupportedException("ComputeSharp.TextureView2D.GetHashCode() is not supported"); @@ -380,4 +380,4 @@ public readonly unsafe ref partial struct TextureView2D { return !(left == right); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs index a7ed9751..e5883bc7 100644 --- a/src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.ComponentModel; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; -#pragma warning disable CS0809 +#pragma warning disable CS0809, CA1065 namespace ComputeSharp; @@ -13,7 +13,7 @@ namespace ComputeSharp; /// It is recommended to execute as much computation on the GPU side as possible. /// /// The type of items in the current instance. -public readonly unsafe ref partial struct TextureView3D +public readonly unsafe ref struct TextureView3D where T : unmanaged { // The internal layout of a 3D texture mapped in memory is the same as that of a @@ -396,7 +396,7 @@ public readonly unsafe ref partial struct TextureView3D /// [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Equals() on Span will always throw an exception. Use == instead.")] + [Obsolete("Equals() on TextureView3D will always throw an exception. Use == instead.")] public override bool Equals(object? obj) { throw new NotSupportedException("ComputeSharp.TextureView3D.Equals(object) is not supported"); @@ -404,7 +404,7 @@ public readonly unsafe ref partial struct TextureView3D /// [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("GetHashCode() on Span will always throw an exception.")] + [Obsolete("GetHashCode() on TextureView3D will always throw an exception.")] public override int GetHashCode() { throw new NotSupportedException("ComputeSharp.TextureView3D.GetHashCode() is not supported"); @@ -437,4 +437,4 @@ public readonly unsafe ref partial struct TextureView3D { return !(left == right); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Properties/Configuration.cs b/src/ComputeSharp/Properties/Configuration.cs index a66f4ff1..e5e96e46 100644 --- a/src/ComputeSharp/Properties/Configuration.cs +++ b/src/ComputeSharp/Properties/Configuration.cs @@ -1,4 +1,4 @@ -using System; +using System; #if DEBUG using System.Diagnostics; #endif diff --git a/src/ComputeSharp/Shaders/ComputeContext.cs b/src/ComputeSharp/Shaders/ComputeContext.cs index 3a3a2aa5..f5213442 100644 --- a/src/ComputeSharp/Shaders/ComputeContext.cs +++ b/src/ComputeSharp/Shaders/ComputeContext.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Threading.Tasks; @@ -391,4 +391,4 @@ public struct ComputeContext : IDisposable, IAsyncDisposable ThrowHelper.ThrowInvalidOperationException("The current compute context is not in a valid state."); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Shaders/Dispatching/ComputeShaderDispatchDataLoader.cs b/src/ComputeSharp/Shaders/Dispatching/ComputeShaderDispatchDataLoader.cs index b565ad62..8f131c65 100644 --- a/src/ComputeSharp/Shaders/Dispatching/ComputeShaderDispatchDataLoader.cs +++ b/src/ComputeSharp/Shaders/Dispatching/ComputeShaderDispatchDataLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.Graphics.Extensions; using ComputeSharp.__Internals; @@ -53,4 +53,4 @@ internal readonly unsafe struct ComputeShaderDispatchDataLoader : IDispatchDataL offset++; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Shaders/Dispatching/PixelShaderDispatchDataLoader.cs b/src/ComputeSharp/Shaders/Dispatching/PixelShaderDispatchDataLoader.cs index 2c8792e0..c43bf1f1 100644 --- a/src/ComputeSharp/Shaders/Dispatching/PixelShaderDispatchDataLoader.cs +++ b/src/ComputeSharp/Shaders/Dispatching/PixelShaderDispatchDataLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Graphics.Extensions; @@ -57,4 +57,4 @@ internal readonly unsafe struct PixelShaderDispatchDataLoader : IDispatchDataLoa offset++; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Shaders/Dispatching/ShaderBytecodeLoader.cs b/src/ComputeSharp/Shaders/Dispatching/ShaderBytecodeLoader.cs index 03c69b94..4d72f814 100644 --- a/src/ComputeSharp/Shaders/Dispatching/ShaderBytecodeLoader.cs +++ b/src/ComputeSharp/Shaders/Dispatching/ShaderBytecodeLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using ComputeSharp.__Internals; @@ -62,4 +62,4 @@ internal struct ShaderBytecodeLoader : IBytecodeLoader this.cachedShader = new ICachedShader.Embedded(bytecode); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs b/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs index 002e3837..6218557c 100644 --- a/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs +++ b/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using CommunityToolkit.Diagnostics; @@ -44,4 +44,4 @@ internal readonly unsafe struct ShaderDispatchMetadataLoader : IDispatchMetadata MemoryMarshal.Read(serializedMetadata.Slice(4))); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Shaders/Dispatching/__Internals/ArrayPoolStringBuilder.cs b/src/ComputeSharp/Shaders/Dispatching/__Internals/ArrayPoolStringBuilder.cs index b6fbe97b..2e9ef06e 100644 --- a/src/ComputeSharp/Shaders/Dispatching/__Internals/ArrayPoolStringBuilder.cs +++ b/src/ComputeSharp/Shaders/Dispatching/__Internals/ArrayPoolStringBuilder.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.ComponentModel; using System.Diagnostics; @@ -130,7 +130,7 @@ public ref struct ArrayPoolStringBuilder Array.Copy(this.array, 0, newArray, 0, itemsToCopy); - ArrayPool.Shared.Return(array); + ArrayPool.Shared.Return(this.array); this.array = newArray; } @@ -160,4 +160,4 @@ public ref struct ArrayPoolStringBuilder /// public string Text { get; } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs index 8b9c6ce5..aee0c830 100644 --- a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs +++ b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using ComputeSharp.__Internals; using ComputeSharp.Graphics.Helpers; @@ -191,7 +191,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(buffer); - var handles = buffer.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = buffer.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice); context.Clear(buffer.D3D12Resource, handles.Gpu, handles.Cpu, isNormalized: false); } @@ -207,7 +207,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized); context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, isNormalized); } @@ -223,7 +223,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized); context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, isNormalized); } @@ -239,7 +239,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized); context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, isNormalized); } @@ -257,7 +257,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, true); } @@ -275,7 +275,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, true); } @@ -293,7 +293,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, true); } @@ -309,7 +309,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); using NativeObject.Lease lease = default; @@ -327,7 +327,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); using NativeObject.Lease lease = default; @@ -345,7 +345,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); using NativeObject.Lease lease = default; @@ -366,7 +366,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); context.Fill(texture.D3D12Resource, handles.Gpu, handles.Cpu, DXGIFormatHelper.ExtendToNormalizedValue(value.ToPixel())); } @@ -385,7 +385,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); context.Fill(texture.D3D12Resource, handles.Gpu, handles.Cpu, DXGIFormatHelper.ExtendToNormalizedValue(value.ToPixel())); } @@ -404,7 +404,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); context.Fill(texture.D3D12Resource, handles.Gpu, handles.Cpu, DXGIFormatHelper.ExtendToNormalizedValue(value.ToPixel())); } @@ -421,7 +421,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); using NativeObject.Lease lease = default; @@ -444,7 +444,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); using NativeObject.Lease lease = default; @@ -467,7 +467,7 @@ public static class ComputeContextExtensions { Guard.IsNotNull(texture); - var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); + (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); using NativeObject.Lease lease = default; @@ -583,7 +583,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -600,7 +600,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -617,7 +617,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -634,7 +634,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -655,7 +655,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -672,7 +672,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -689,7 +689,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -706,7 +706,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -723,7 +723,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -744,7 +744,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -761,7 +761,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -778,7 +778,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -795,7 +795,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -812,7 +812,7 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } @@ -833,8 +833,8 @@ public static class ComputeContextExtensions using NativeObject.Lease lease = default; - var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); + (D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease)); context.Transition(d3D12Resource, states.Before, states.After); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Shaders/Extensions/Interop/ID3D12DeviceExtensions.cs b/src/ComputeSharp/Shaders/Extensions/Interop/ID3D12DeviceExtensions.cs index 122ad5c9..e93441c7 100644 --- a/src/ComputeSharp/Shaders/Extensions/Interop/ID3D12DeviceExtensions.cs +++ b/src/ComputeSharp/Shaders/Extensions/Interop/ID3D12DeviceExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Core.Extensions; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; @@ -117,4 +117,4 @@ internal static unsafe class ID3D12DeviceExtensions return d3D12PipelineState.Move(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Shaders/Loading/PipelineDataLoader{T}.cs b/src/ComputeSharp/Shaders/Loading/PipelineDataLoader{T}.cs index 415e9b89..fc4a80fe 100644 --- a/src/ComputeSharp/Shaders/Loading/PipelineDataLoader{T}.cs +++ b/src/ComputeSharp/Shaders/Loading/PipelineDataLoader{T}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using ComputeSharp.Shaders.Dispatching; @@ -92,7 +92,7 @@ internal static class PipelineDataLoader Unsafe.SkipInit(out T shader); shader.LoadDispatchMetadata(ref metadataLoader, out *(IntPtr*)&d3D12RootSignature); - + using ComPtr d3D12PipelineState = device.D3D12Device->CreateComputePipelineState(d3D12RootSignature.Get(), shaderData.D3D12ShaderBytecode); pipelineData = new PipelineData(d3D12RootSignature.Get(), d3D12PipelineState.Get()); @@ -102,4 +102,4 @@ internal static class PipelineDataLoader // Register the newly created pipeline data to enable early disposal device.RegisterPipelineData(pipelineData); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Shaders/Models/ICachedShader.cs b/src/ComputeSharp/Shaders/Models/ICachedShader.cs index f05fb96b..cc99f145 100644 --- a/src/ComputeSharp/Shaders/Models/ICachedShader.cs +++ b/src/ComputeSharp/Shaders/Models/ICachedShader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Interop; @@ -83,7 +83,7 @@ internal interface ICachedShader public ConditionalWeakTable CachedPipelines { get; } = new(); /// - public D3D12_SHADER_BYTECODE D3D12ShaderBytecode => new ((ID3DBlob*)this.dxcBlobBytecode.Get()); + public D3D12_SHADER_BYTECODE D3D12ShaderBytecode => new((ID3DBlob*)this.dxcBlobBytecode.Get()); /// private protected override void OnDispose() @@ -91,4 +91,4 @@ internal interface ICachedShader this.dxcBlobBytecode.Dispose(); } } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Shaders/Models/PipelineData.cs b/src/ComputeSharp/Shaders/Models/PipelineData.cs index d7fec9e1..a3a05f80 100644 --- a/src/ComputeSharp/Shaders/Models/PipelineData.cs +++ b/src/ComputeSharp/Shaders/Models/PipelineData.cs @@ -1,4 +1,4 @@ -using ComputeSharp.Interop; +using ComputeSharp.Interop; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; @@ -46,4 +46,4 @@ internal sealed unsafe class PipelineData : NativeObject this.d3D12RootSignature.Dispose(); this.d3D12PipelineState.Dispose(); } -} +} \ No newline at end of file diff --git a/src/ComputeSharp/Shaders/Models/ShaderKey.cs b/src/ComputeSharp/Shaders/Models/ShaderKey.cs index 1af9978f..695630c9 100644 --- a/src/ComputeSharp/Shaders/Models/ShaderKey.cs +++ b/src/ComputeSharp/Shaders/Models/ShaderKey.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; namespace ComputeSharp.Shaders.Models; @@ -11,22 +11,22 @@ internal readonly struct ShaderKey : IEquatable /// /// The hashcode of the current shader type. /// - private readonly int Id; + private readonly int id; /// /// The number of iterations to run on the X axis. /// - private readonly int ThreadsX; + private readonly int threadsX; /// /// The number of iterations to run on the Y axis. /// - private readonly int ThreadsY; + private readonly int threadsY; /// /// The number of iterations to run on the Z axis. /// - private readonly int ThreadsZ; + private readonly int threadsZ; /// /// Creates a new instance with the specified parameters. @@ -38,10 +38,10 @@ internal readonly struct ShaderKey : IEquatable [MethodImpl(MethodImplOptions.AggressiveInlining)] public ShaderKey(int id, int threadsX, int threadsY, int threadsZ) { - Id = id; - ThreadsX = threadsX; - ThreadsY = threadsY; - ThreadsZ = threadsZ; + this.id = id; + this.threadsX = threadsX; + this.threadsY = threadsY; + this.threadsZ = threadsZ; } /// @@ -49,10 +49,10 @@ internal readonly struct ShaderKey : IEquatable public bool Equals(ShaderKey other) { return - Id == other.Id && - ThreadsX == other.ThreadsX && - ThreadsY == other.ThreadsY && - ThreadsZ == other.ThreadsZ; + this.id == other.id && + this.threadsX == other.threadsX && + this.threadsY == other.threadsY && + this.threadsZ == other.threadsZ; } /// @@ -65,6 +65,6 @@ internal readonly struct ShaderKey : IEquatable [MethodImpl(MethodImplOptions.AggressiveInlining)] public override int GetHashCode() { - return HashCode.Combine(Id, ThreadsX, ThreadsY, ThreadsZ); + return HashCode.Combine(this.id, this.threadsX, this.threadsY, this.threadsZ); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows.D2D1/.editorconfig b/src/TerraFX.Interop.Windows.D2D1/.editorconfig new file mode 100644 index 00000000..45041b2c --- /dev/null +++ b/src/TerraFX.Interop.Windows.D2D1/.editorconfig @@ -0,0 +1,37 @@ +# Disable all rules from above directories +root = true + +# All files +[*] + +# Encoding +charset = utf-8 + +# Indentation and spacing +tab_width = 4 +indent_size = 4 +indent_style = space + +# New line preferences +insert_final_newline = false +trim_trailing_whitespace = true + +# C# files +[*.cs] + +dotnet_diagnostic.IDE0004.severity = none +dotnet_diagnostic.IDE0007.severity = none +dotnet_diagnostic.IDE0008.severity = none +dotnet_diagnostic.IDE0022.severity = none +dotnet_diagnostic.IDE0023.severity = none +dotnet_diagnostic.IDE0024.severity = none +dotnet_diagnostic.IDE0027.severity = none +dotnet_diagnostic.IDE0032.severity = none +dotnet_diagnostic.IDE0045.severity = none +dotnet_diagnostic.IDE0046.severity = none +dotnet_diagnostic.IDE0047.severity = none +dotnet_diagnostic.IDE0060.severity = none +dotnet_diagnostic.IDE0090.severity = none +dotnet_diagnostic.IDE0160.severity = none +dotnet_diagnostic.IDE0180.severity = none +dotnet_diagnostic.IDE1006.severity = none \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1/D2D1_EXTEND_MODE.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1/D2D1_EXTEND_MODE.cs index 3697bb0b..1baf82fa 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1/D2D1_EXTEND_MODE.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1/D2D1_EXTEND_MODE.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1/ID2D1Factory.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1/ID2D1Factory.cs index e690fd2f..8ad7aa23 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1/ID2D1Factory.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1/ID2D1Factory.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1/ID2D1Image.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1/ID2D1Image.cs index bfa830c6..583ca9d0 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1/ID2D1Image.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1/ID2D1Image.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_BUFFER_PRECISION.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_BUFFER_PRECISION.cs index f8aab853..bff22696 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_BUFFER_PRECISION.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_BUFFER_PRECISION.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_CHANNEL_DEPTH.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_CHANNEL_DEPTH.cs index 3189cb39..6e0c50bd 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_CHANNEL_DEPTH.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_CHANNEL_DEPTH.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_PROPERTY_TYPE.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_PROPERTY_TYPE.cs index 993104bc..094d3bd6 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_PROPERTY_TYPE.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_PROPERTY_TYPE.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1DeviceContext.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1DeviceContext.cs index e612b6d4..0f850b43 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1DeviceContext.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1DeviceContext.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1Effect.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1Effect.cs index faa1afde..9f00de81 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1Effect.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1Effect.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1Factory1.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1Factory1.cs index 0613b2d5..5b7432a2 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1Factory1.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1Factory1.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1Multithread.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1Multithread.cs index d728980d..72488551 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1Multithread.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/ID2D1Multithread.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_CHANGE_TYPE.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_CHANGE_TYPE.cs index 071cdb7c..0980b294 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_CHANGE_TYPE.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_CHANGE_TYPE.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_FEATURE.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_FEATURE.cs index 411d47e1..7b9fab45 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_FEATURE.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_FEATURE.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_FEATURE_DATA_DOUBLES.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_FEATURE_DATA_DOUBLES.cs index 081ff01c..ce7ca58a 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_FEATURE_DATA_DOUBLES.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_FEATURE_DATA_DOUBLES.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_FILTER.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_FILTER.cs index 7f6d604c..a98792e8 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_FILTER.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_FILTER.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_INPUT_DESCRIPTION.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_INPUT_DESCRIPTION.cs index 0da17fd0..c999deef 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_INPUT_DESCRIPTION.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_INPUT_DESCRIPTION.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_PIXEL_OPTIONS.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_PIXEL_OPTIONS.cs index 446d86ae..6b36ca5e 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_PIXEL_OPTIONS.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_PIXEL_OPTIONS.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_PROPERTY_BINDING.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_PROPERTY_BINDING.cs index fdd86e4a..5d2f995d 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_PROPERTY_BINDING.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_PROPERTY_BINDING.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_RESOURCE_TEXTURE_PROPERTIES.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_RESOURCE_TEXTURE_PROPERTIES.cs index 3671d592..843b3ee4 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_RESOURCE_TEXTURE_PROPERTIES.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/D2D1_RESOURCE_TEXTURE_PROPERTIES.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs index 73ff14e9..5ac30b91 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawTransform.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawTransform.cs index 064cece3..d41dfb4b 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawTransform.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawTransform.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectContext.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectContext.cs index e9d47721..b3bcd57a 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectContext.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectContext.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectImpl.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectImpl.cs index 1480f720..81f014c3 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectImpl.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectImpl.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1ResourceTexture.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1ResourceTexture.cs index c3aa978a..dc04a6e3 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1ResourceTexture.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1ResourceTexture.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1Transform.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1Transform.cs index 0db52274..7a552d4c 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1Transform.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1Transform.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformGraph.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformGraph.cs index 923993c1..9e88c744 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformGraph.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformGraph.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformNode.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformNode.cs index aa2a61c9..2aa5d3fc 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformNode.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformNode.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effects/CLSID.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effects/CLSID.cs index e63a48c6..77ff136d 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effects/CLSID.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1effects/CLSID.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1effects.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3d11shader/D3D11_SHADER_DESC.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3d11shader/D3D11_SHADER_DESC.cs index 2bb5b6cf..cb72d4f9 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3d11shader/D3D11_SHADER_DESC.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3d11shader/D3D11_SHADER_DESC.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d3d11shader.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3d11shader/ID3D11ShaderReflection.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3d11shader/ID3D11ShaderReflection.cs index ed1349c1..76a3893f 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3d11shader/ID3D11ShaderReflection.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3d11shader/ID3D11ShaderReflection.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d3d11shader.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcommon/D3D_INCLUDE_TYPE.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcommon/D3D_INCLUDE_TYPE.cs index 65ca6cc7..74563221 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcommon/D3D_INCLUDE_TYPE.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcommon/D3D_INCLUDE_TYPE.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from d3dcommon.h in Microsoft.Direct3D.D3D12 v1.600.10 // Original source is Copyright © Microsoft. Licensed under the MIT license diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcommon/ID3DInclude.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcommon/ID3DInclude.cs index 8fd92f76..48956764 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcommon/ID3DInclude.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcommon/ID3DInclude.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from d3dcommon.h in Microsoft.Direct3D.D3D12 v1.600.10 // Original source is Copyright © Microsoft. Licensed under the MIT license diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcompiler/D3DCOMPILE.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcompiler/D3DCOMPILE.cs index a7841e13..b0179ecb 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcompiler/D3DCOMPILE.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcompiler/D3DCOMPILE.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d3dcompiler.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcompiler/D3D_BLOB_PART.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcompiler/D3D_BLOB_PART.cs index f61ad7ee..53344482 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcompiler/D3D_BLOB_PART.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcompiler/D3D_BLOB_PART.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d3dcompiler.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcompiler/DirectX.cs b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcompiler/DirectX.cs index ba483f7e..15b6f420 100644 --- a/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcompiler/DirectX.cs +++ b/src/TerraFX.Interop.Windows.D2D1/DirectX/um/d3dcompiler/DirectX.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d3dcompiler.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/Windows/shared/uuids/Windows.Manual.cs b/src/TerraFX.Interop.Windows.D2D1/Windows/shared/uuids/Windows.Manual.cs index d8316436..269bddd3 100644 --- a/src/TerraFX.Interop.Windows.D2D1/Windows/shared/uuids/Windows.Manual.cs +++ b/src/TerraFX.Interop.Windows.D2D1/Windows/shared/uuids/Windows.Manual.cs @@ -26,7 +26,7 @@ namespace TerraFX.Interop.Windows { return new UuidOfType(UUID.RIID); } - + /// Retrieves the GUID of of a specified type. /// A pointer to a value of type . /// The type to retrieve the GUID for. @@ -87,4 +87,4 @@ namespace TerraFX.Interop.Windows } } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows.D2D1/Windows/shared/windef/RECT.cs b/src/TerraFX.Interop.Windows.D2D1/Windows/shared/windef/RECT.cs index 614ff8b9..cf4fe4c8 100644 --- a/src/TerraFX.Interop.Windows.D2D1/Windows/shared/windef/RECT.cs +++ b/src/TerraFX.Interop.Windows.D2D1/Windows/shared/windef/RECT.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from shared/windef.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/Windows/shared/winerror/D2DERR.cs b/src/TerraFX.Interop.Windows.D2D1/Windows/shared/winerror/D2DERR.cs index 13436b45..51fc74a5 100644 --- a/src/TerraFX.Interop.Windows.D2D1/Windows/shared/winerror/D2DERR.cs +++ b/src/TerraFX.Interop.Windows.D2D1/Windows/shared/winerror/D2DERR.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from shared/winerror.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/Windows/shared/winerror/E.cs b/src/TerraFX.Interop.Windows.D2D1/Windows/shared/winerror/E.cs index e8227e77..7f0be886 100644 --- a/src/TerraFX.Interop.Windows.D2D1/Windows/shared/winerror/E.cs +++ b/src/TerraFX.Interop.Windows.D2D1/Windows/shared/winerror/E.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from shared/winerror.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.D2D1/Windows/shared/winerror/Windows.cs b/src/TerraFX.Interop.Windows.D2D1/Windows/shared/winerror/Windows.cs index b02c142b..940ff04d 100644 --- a/src/TerraFX.Interop.Windows.D2D1/Windows/shared/winerror/Windows.cs +++ b/src/TerraFX.Interop.Windows.D2D1/Windows/shared/winerror/Windows.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from shared/winerror.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows.Dynamic/.editorconfig b/src/TerraFX.Interop.Windows.Dynamic/.editorconfig new file mode 100644 index 00000000..45041b2c --- /dev/null +++ b/src/TerraFX.Interop.Windows.Dynamic/.editorconfig @@ -0,0 +1,37 @@ +# Disable all rules from above directories +root = true + +# All files +[*] + +# Encoding +charset = utf-8 + +# Indentation and spacing +tab_width = 4 +indent_size = 4 +indent_style = space + +# New line preferences +insert_final_newline = false +trim_trailing_whitespace = true + +# C# files +[*.cs] + +dotnet_diagnostic.IDE0004.severity = none +dotnet_diagnostic.IDE0007.severity = none +dotnet_diagnostic.IDE0008.severity = none +dotnet_diagnostic.IDE0022.severity = none +dotnet_diagnostic.IDE0023.severity = none +dotnet_diagnostic.IDE0024.severity = none +dotnet_diagnostic.IDE0027.severity = none +dotnet_diagnostic.IDE0032.severity = none +dotnet_diagnostic.IDE0045.severity = none +dotnet_diagnostic.IDE0046.severity = none +dotnet_diagnostic.IDE0047.severity = none +dotnet_diagnostic.IDE0060.severity = none +dotnet_diagnostic.IDE0090.severity = none +dotnet_diagnostic.IDE0160.severity = none +dotnet_diagnostic.IDE0180.severity = none +dotnet_diagnostic.IDE1006.severity = none \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows.Dynamic/DirectX.cs b/src/TerraFX.Interop.Windows.Dynamic/DirectX.cs index a408b343..a99c012d 100644 --- a/src/TerraFX.Interop.Windows.Dynamic/DirectX.cs +++ b/src/TerraFX.Interop.Windows.Dynamic/DirectX.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.DirectX [DllImport("dxcompiler", ExactSpelling = true)] public static extern HRESULT DxcCreateInstance([NativeTypeName("const IID &")] Guid* rclsid, [NativeTypeName("const IID &")] Guid* riid, [NativeTypeName("LPVOID *")] void** ppv); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/.editorconfig b/src/TerraFX.Interop.Windows/.editorconfig new file mode 100644 index 00000000..45041b2c --- /dev/null +++ b/src/TerraFX.Interop.Windows/.editorconfig @@ -0,0 +1,37 @@ +# Disable all rules from above directories +root = true + +# All files +[*] + +# Encoding +charset = utf-8 + +# Indentation and spacing +tab_width = 4 +indent_size = 4 +indent_style = space + +# New line preferences +insert_final_newline = false +trim_trailing_whitespace = true + +# C# files +[*.cs] + +dotnet_diagnostic.IDE0004.severity = none +dotnet_diagnostic.IDE0007.severity = none +dotnet_diagnostic.IDE0008.severity = none +dotnet_diagnostic.IDE0022.severity = none +dotnet_diagnostic.IDE0023.severity = none +dotnet_diagnostic.IDE0024.severity = none +dotnet_diagnostic.IDE0027.severity = none +dotnet_diagnostic.IDE0032.severity = none +dotnet_diagnostic.IDE0045.severity = none +dotnet_diagnostic.IDE0046.severity = none +dotnet_diagnostic.IDE0047.severity = none +dotnet_diagnostic.IDE0060.severity = none +dotnet_diagnostic.IDE0090.severity = none +dotnet_diagnostic.IDE0160.severity = none +dotnet_diagnostic.IDE0180.severity = none +dotnet_diagnostic.IDE1006.severity = none \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_BOX.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_BOX.Manual.cs index fba29b6d..ced40df9 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_BOX.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_BOX.Manual.cs @@ -55,4 +55,4 @@ namespace TerraFX.Interop.DirectX public override int GetHashCode() => HashCode.Combine(left, top, front, right, bottom, back); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_CPU_DESCRIPTOR_HANDLE.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_CPU_DESCRIPTOR_HANDLE.Manual.cs index 89b88b8f..d9490690 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_CPU_DESCRIPTOR_HANDLE.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_CPU_DESCRIPTOR_HANDLE.Manual.cs @@ -65,4 +65,4 @@ namespace TerraFX.Interop.DirectX public override int GetHashCode() => ptr.GetHashCode(); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_GPU_DESCRIPTOR_HANDLE.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_GPU_DESCRIPTOR_HANDLE.Manual.cs index 27015c74..52c6d71a 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_GPU_DESCRIPTOR_HANDLE.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_GPU_DESCRIPTOR_HANDLE.Manual.cs @@ -65,4 +65,4 @@ namespace TerraFX.Interop.DirectX public override int GetHashCode() => ptr.GetHashCode(); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_RESOURCE_ALLOCATION_INFO.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_RESOURCE_ALLOCATION_INFO.Manual.cs index 64d7a37a..8eb06b21 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_RESOURCE_ALLOCATION_INFO.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_RESOURCE_ALLOCATION_INFO.Manual.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX Alignment = alignment; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_RESOURCE_BARRIER.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_RESOURCE_BARRIER.Manual.cs index e92d3271..69d9c631 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_RESOURCE_BARRIER.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_RESOURCE_BARRIER.Manual.cs @@ -40,4 +40,4 @@ namespace TerraFX.Interop.DirectX return result; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_RESOURCE_DESC.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_RESOURCE_DESC.Manual.cs index 124227e1..82a732a0 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_RESOURCE_DESC.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_RESOURCE_DESC.Manual.cs @@ -97,4 +97,4 @@ namespace TerraFX.Interop.DirectX return hashCode.ToHashCode(); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_CONSTANTS.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_CONSTANTS.Manual.cs index df2b4831..251f014a 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_CONSTANTS.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_CONSTANTS.Manual.cs @@ -24,4 +24,4 @@ namespace TerraFX.Interop.DirectX rootConstants.RegisterSpace = registerSpace; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_DESCRIPTOR.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_DESCRIPTOR.Manual.cs index b1407e79..3a4301e6 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_DESCRIPTOR.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_DESCRIPTOR.Manual.cs @@ -23,4 +23,4 @@ namespace TerraFX.Interop.DirectX table.RegisterSpace = registerSpace; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_DESCRIPTOR1.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_DESCRIPTOR1.Manual.cs index b83df714..2e564a9e 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_DESCRIPTOR1.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_DESCRIPTOR1.Manual.cs @@ -26,4 +26,4 @@ namespace TerraFX.Interop.DirectX table.Flags = flags; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_DESCRIPTOR_TABLE1.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_DESCRIPTOR_TABLE1.Manual.cs index b081e33a..f2b829e9 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_DESCRIPTOR_TABLE1.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_DESCRIPTOR_TABLE1.Manual.cs @@ -23,4 +23,4 @@ namespace TerraFX.Interop.DirectX rootDescriptorTable.pDescriptorRanges = _pDescriptorRanges; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_PARAMETER1.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_PARAMETER1.Manual.cs index 916f3238..12b65431 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_PARAMETER1.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_ROOT_PARAMETER1.Manual.cs @@ -80,4 +80,4 @@ namespace TerraFX.Interop.DirectX InitAsUnorderedAccessView(out this, shaderRegister, registerSpace, visibility); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_SHADER_BYTECODE.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_SHADER_BYTECODE.Manual.cs index b985dd8e..6e1b36f7 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_SHADER_BYTECODE.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_SHADER_BYTECODE.Manual.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.DirectX BytecodeLength = bytecodeLength; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_STATIC_SAMPLER_DESC.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_STATIC_SAMPLER_DESC.Manual.cs index 70ca8d6c..0943f41d 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_STATIC_SAMPLER_DESC.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_STATIC_SAMPLER_DESC.Manual.cs @@ -41,4 +41,4 @@ namespace TerraFX.Interop.DirectX Init(out this, shaderRegister, filter, addressU, addressV, addressW, mipLODBias, maxAnisotropy, comparisonFunc, borderColor, minLOD, maxLOD, shaderVisibility, registerSpace); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_TEXTURE_COPY_LOCATION.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_TEXTURE_COPY_LOCATION.Manual.cs index e7a81dba..249dda00 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_TEXTURE_COPY_LOCATION.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_TEXTURE_COPY_LOCATION.Manual.cs @@ -37,4 +37,4 @@ namespace TerraFX.Interop.DirectX Anonymous.SubresourceIndex = Sub; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_VERSIONED_ROOT_SIGNATURE_DESC.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_VERSIONED_ROOT_SIGNATURE_DESC.Manual.cs index e137dc61..9c56bf7f 100644 --- a/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_VERSIONED_ROOT_SIGNATURE_DESC.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/other/d3dx12/D3D12_VERSIONED_ROOT_SIGNATURE_DESC.Manual.cs @@ -112,4 +112,4 @@ namespace TerraFX.Interop.DirectX desc.Anonymous.Desc_1_1.Flags = flags; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI.cs index 7f74e299..4fdeb294 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI.cs @@ -100,4 +100,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("#define DXGI_MWA_VALID ( 0x7 )")] public const int DXGI_MWA_VALID = (0x7); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_ADAPTER_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_ADAPTER_DESC.cs index 3d2cd69d..3cabb4b3 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_ADAPTER_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_ADAPTER_DESC.cs @@ -31,4 +31,4 @@ namespace TerraFX.Interop.DirectX public LUID AdapterLuid; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_ADAPTER_DESC1.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_ADAPTER_DESC1.cs index 21f0e476..da689cec 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_ADAPTER_DESC1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_ADAPTER_DESC1.cs @@ -33,4 +33,4 @@ namespace TerraFX.Interop.DirectX public uint Flags; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_ADAPTER_FLAG.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_ADAPTER_FLAG.cs index 65539584..73718518 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_ADAPTER_FLAG.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_ADAPTER_FLAG.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.DirectX DXGI_ADAPTER_FLAG_SOFTWARE = 2, DXGI_ADAPTER_FLAG_FORCE_DWORD = 0xffffffff, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_SWAP_CHAIN_FLAG.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_SWAP_CHAIN_FLAG.cs index 16968bd2..78f45226 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_SWAP_CHAIN_FLAG.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_SWAP_CHAIN_FLAG.cs @@ -24,4 +24,4 @@ namespace TerraFX.Interop.DirectX DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING = 2048, DXGI_SWAP_CHAIN_FLAG_RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS = 4096, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_SWAP_EFFECT.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_SWAP_EFFECT.cs index f73106ca..a6c1f9d9 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_SWAP_EFFECT.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/DXGI_SWAP_EFFECT.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.DirectX DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL = 3, DXGI_SWAP_EFFECT_FLIP_DISCARD = 4, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIAdapter.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIAdapter.cs index c33669e3..ae6db595 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIAdapter.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIAdapter.cs @@ -89,4 +89,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[9]))((IDXGIAdapter*)Unsafe.AsPointer(ref this), InterfaceName, pUMDVersion); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIAdapter1.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIAdapter1.cs index 505a0501..f3d57cf4 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIAdapter1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIAdapter1.cs @@ -96,4 +96,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[10]))((IDXGIAdapter1*)Unsafe.AsPointer(ref this), pDesc); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIFactory.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIFactory.cs index aa9bda1f..600044be 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIFactory.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIFactory.cs @@ -40,4 +40,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[2]))((IDXGIFactory*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIOutput.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIOutput.cs index d2593375..80fc84f1 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIOutput.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGIOutput.cs @@ -40,4 +40,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[2]))((IDXGIOutput*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGISwapChain.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGISwapChain.cs index 5e8cf0a8..3d5a88af 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGISwapChain.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi/IDXGISwapChain.cs @@ -40,4 +40,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[2]))((IDXGISwapChain*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGIOutput1.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGIOutput1.cs index 8ef6175b..d49c21ba 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGIOutput1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGIOutput1.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from shared/dxgi1_2.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_ALPHA_MODE.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_ALPHA_MODE.cs index e87dd340..e2b2ea6f 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_ALPHA_MODE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_ALPHA_MODE.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX DXGI_ALPHA_MODE_IGNORE = 3, DXGI_ALPHA_MODE_FORCE_DWORD = 0xffffffff, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_MODE_DESC1.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_MODE_DESC1.cs index 698876b4..5d165a38 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_MODE_DESC1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_MODE_DESC1.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from shared/dxgi1_2.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_SCALING.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_SCALING.cs index abc02e14..0332dd60 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_SCALING.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_SCALING.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX DXGI_SCALING_NONE = 1, DXGI_SCALING_ASPECT_RATIO_STRETCH = 2, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_SWAP_CHAIN_DESC1.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_SWAP_CHAIN_DESC1.cs index 92a0e27a..c94c0109 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_SWAP_CHAIN_DESC1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/DXGI_SWAP_CHAIN_DESC1.cs @@ -32,4 +32,4 @@ namespace TerraFX.Interop.DirectX public uint Flags; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/IDXGIFactory2.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/IDXGIFactory2.cs index 92a574e0..83428cad 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/IDXGIFactory2.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/IDXGIFactory2.cs @@ -47,4 +47,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[24]))((IDXGIFactory2*)Unsafe.AsPointer(ref this), pDevice, pDesc, pRestrictToOutput, ppSwapChain); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/IDXGISwapChain1.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/IDXGISwapChain1.cs index d6fbecab..8727a941 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/IDXGISwapChain1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_2/IDXGISwapChain1.cs @@ -40,4 +40,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[2]))((IDXGISwapChain1*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_3/DXGI.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_3/DXGI.cs index bd919a37..0328726e 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_3/DXGI.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_3/DXGI.cs @@ -10,4 +10,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("#define DXGI_CREATE_FACTORY_DEBUG 0x1")] public const int DXGI_CREATE_FACTORY_DEBUG = 0x1; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_3/DXGI_MATRIX_3X2_F.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_3/DXGI_MATRIX_3X2_F.cs index f6a6be78..c5b2dcac 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_3/DXGI_MATRIX_3X2_F.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_3/DXGI_MATRIX_3X2_F.cs @@ -22,4 +22,4 @@ namespace TerraFX.Interop.DirectX public float _32; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_3/DirectX.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_3/DirectX.cs index 440954d3..16bc86ca 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_3/DirectX.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_3/DirectX.cs @@ -16,4 +16,4 @@ namespace TerraFX.Interop.DirectX [DllImport("dxgi", ExactSpelling = true)] public static extern HRESULT CreateDXGIFactory2(uint Flags, [NativeTypeName("const IID &")] Guid* riid, void** ppFactory); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_4/IDXGIFactory4.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_4/IDXGIFactory4.cs index 19eb878b..cf202d0a 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_4/IDXGIFactory4.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_4/IDXGIFactory4.cs @@ -194,4 +194,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[27]))((IDXGIFactory4*)Unsafe.AsPointer(ref this), riid, ppvAdapter); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_4/IDXGISwapChain3.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_4/IDXGISwapChain3.cs index 358cbf3d..3777376c 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_4/IDXGISwapChain3.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_4/IDXGISwapChain3.cs @@ -84,4 +84,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[36]))((IDXGISwapChain3*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_5/DXGI_FEATURE.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_5/DXGI_FEATURE.cs index 6b64519a..fb489f3f 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_5/DXGI_FEATURE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_5/DXGI_FEATURE.cs @@ -9,4 +9,4 @@ namespace TerraFX.Interop.DirectX { DXGI_FEATURE_PRESENT_ALLOW_TEARING = 0, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_6/DXGI_GPU_PREFERENCE.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_6/DXGI_GPU_PREFERENCE.cs index c97b88c2..45959a27 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_6/DXGI_GPU_PREFERENCE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_6/DXGI_GPU_PREFERENCE.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX DXGI_GPU_PREFERENCE_MINIMUM_POWER = (DXGI_GPU_PREFERENCE_UNSPECIFIED + 1), DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE = (DXGI_GPU_PREFERENCE_MINIMUM_POWER + 1), } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_6/IDXGIFactory6.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_6/IDXGIFactory6.cs index e5674032..90293743 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_6/IDXGIFactory6.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgi1_6/IDXGIFactory6.cs @@ -70,4 +70,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[29]))((IDXGIFactory6*)Unsafe.AsPointer(ref this), Adapter, GpuPreference, riid, ppvAdapter); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgicommon/DXGI_RATIONAL.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgicommon/DXGI_RATIONAL.cs index df398c81..8cbab27f 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgicommon/DXGI_RATIONAL.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgicommon/DXGI_RATIONAL.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from shared/dxgicommon.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgicommon/DXGI_SAMPLE_DESC.Manual.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgicommon/DXGI_SAMPLE_DESC.Manual.cs index 8f0922c0..54c50d92 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgicommon/DXGI_SAMPLE_DESC.Manual.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgicommon/DXGI_SAMPLE_DESC.Manual.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX Quality = quality; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgicommon/DXGI_SAMPLE_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgicommon/DXGI_SAMPLE_DESC.cs index ae913a76..4fa0cb3a 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgicommon/DXGI_SAMPLE_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgicommon/DXGI_SAMPLE_DESC.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX public uint Quality; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgiformat/DXGI_FORMAT.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgiformat/DXGI_FORMAT.cs index a0179bce..7b0112f0 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgiformat/DXGI_FORMAT.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgiformat/DXGI_FORMAT.cs @@ -130,4 +130,4 @@ namespace TerraFX.Interop.DirectX DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 190, DXGI_FORMAT_FORCE_UINT = 0xffffffff, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgitype/DXGI_MODE_SCALING.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgitype/DXGI_MODE_SCALING.cs index 4d01c537..ea3b3ee0 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgitype/DXGI_MODE_SCALING.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgitype/DXGI_MODE_SCALING.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from shared/dxgitype.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/DirectX/shared/dxgitype/DXGI_MODE_SCANLINE_ORDER.cs b/src/TerraFX.Interop.Windows/DirectX/shared/dxgitype/DXGI_MODE_SCANLINE_ORDER.cs index a5a7ad3e..5dd27624 100644 --- a/src/TerraFX.Interop.Windows/DirectX/shared/dxgitype/DXGI_MODE_SCANLINE_ORDER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/shared/dxgitype/DXGI_MODE_SCANLINE_ORDER.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from shared/dxgitype.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d2d1/D2D1_FEATURE_LEVEL.cs b/src/TerraFX.Interop.Windows/DirectX/um/d2d1/D2D1_FEATURE_LEVEL.cs index 8001a133..5647032b 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d2d1/D2D1_FEATURE_LEVEL.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d2d1/D2D1_FEATURE_LEVEL.cs @@ -14,4 +14,4 @@ namespace TerraFX.Interop.DirectX D2D1_FEATURE_LEVEL_10 = D3D_FEATURE_LEVEL_10_0, D2D1_FEATURE_LEVEL_FORCE_DWORD = 0xffffffff, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d11/D3D11.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d11/D3D11.cs index 752c5e38..0e7e64d1 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d11/D3D11.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d11/D3D11.cs @@ -2711,4 +2711,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("#define D3D11_SDK_VERSION ( 7 )")] public const int D3D11_SDK_VERSION = (7); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d11shader/D3D.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d11shader/D3D.cs index 2f63108a..c7d6ff8d 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d11shader/D3D.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d11shader/D3D.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d3d11shader.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12.cs index 73d57801..96171166 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12.cs @@ -1336,4 +1336,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("#define D3D12_SHADING_RATE_VALID_MASK 3")] public const int D3D12_SHADING_RATE_VALID_MASK = 3; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_NODE1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_NODE1.cs index a5376c65..2cb638bb 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_NODE1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_NODE1.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from d3d12.h in Microsoft.Direct3D.D3D12 v1.600.10 // Original source is Copyright © Microsoft. Licensed under the MIT license diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_OP.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_OP.cs index 95dd83ec..95785c0a 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_OP.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_OP.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from d3d12.h in Microsoft.Direct3D.D3D12 v1.600.10 // Original source is Copyright © Microsoft. Licensed under the MIT license diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BOX.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BOX.cs index 7be40621..53a0be7c 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BOX.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BOX.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.DirectX public uint back; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_SRV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_SRV.cs index 61bba963..0de75432 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_SRV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_SRV.cs @@ -16,4 +16,4 @@ namespace TerraFX.Interop.DirectX public D3D12_BUFFER_SRV_FLAGS Flags; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_SRV_FLAGS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_SRV_FLAGS.cs index 2b35c2b1..c078364a 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_SRV_FLAGS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_SRV_FLAGS.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX D3D12_BUFFER_SRV_FLAG_NONE = 0, D3D12_BUFFER_SRV_FLAG_RAW = 0x1, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_UAV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_UAV.cs index 3efae809..708bc592 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_UAV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_UAV.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.DirectX public D3D12_BUFFER_UAV_FLAGS Flags; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_UAV_FLAGS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_UAV_FLAGS.cs index adf6c5d1..48f0732e 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_UAV_FLAGS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_BUFFER_UAV_FLAGS.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX D3D12_BUFFER_UAV_FLAG_NONE = 0, D3D12_BUFFER_UAV_FLAG_RAW = 0x1, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CACHED_PIPELINE_STATE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CACHED_PIPELINE_STATE.cs index cf97e125..ffb73ac7 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CACHED_PIPELINE_STATE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CACHED_PIPELINE_STATE.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("SIZE_T")] public nuint CachedBlobSizeInBytes; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CLEAR_VALUE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CLEAR_VALUE.cs index dc47dedd..a9755d04 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CLEAR_VALUE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CLEAR_VALUE.cs @@ -25,4 +25,4 @@ namespace TerraFX.Interop.DirectX public D3D12_DEPTH_STENCIL_VALUE DepthStencil; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_LIST_TYPE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_LIST_TYPE.cs index 30928d14..b232289d 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_LIST_TYPE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_LIST_TYPE.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.DirectX D3D12_COMMAND_LIST_TYPE_VIDEO_PROCESS = 5, D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE = 6, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_QUEUE_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_QUEUE_DESC.cs index 8970ae43..81580b64 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_QUEUE_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_QUEUE_DESC.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.DirectX public uint NodeMask; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_QUEUE_FLAGS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_QUEUE_FLAGS.cs index 2052bba2..144fea14 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_QUEUE_FLAGS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_QUEUE_FLAGS.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX D3D12_COMMAND_QUEUE_FLAG_NONE = 0, D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT = 0x1, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_QUEUE_PRIORITY.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_QUEUE_PRIORITY.cs index 6a55660b..e4aa5487 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_QUEUE_PRIORITY.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMMAND_QUEUE_PRIORITY.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX D3D12_COMMAND_QUEUE_PRIORITY_HIGH = 100, D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME = 10000, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMPARISON_FUNC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMPARISON_FUNC.cs index dc65efba..217f243e 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMPARISON_FUNC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMPARISON_FUNC.cs @@ -16,4 +16,4 @@ namespace TerraFX.Interop.DirectX D3D12_COMPARISON_FUNC_GREATER_EQUAL = 7, D3D12_COMPARISON_FUNC_ALWAYS = 8, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMPUTE_PIPELINE_STATE_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMPUTE_PIPELINE_STATE_DESC.cs index 007b7d86..94947910 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMPUTE_PIPELINE_STATE_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_COMPUTE_PIPELINE_STATE_DESC.cs @@ -17,4 +17,4 @@ namespace TerraFX.Interop.DirectX public D3D12_PIPELINE_STATE_FLAGS Flags; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CONSERVATIVE_RASTERIZATION_TIER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CONSERVATIVE_RASTERIZATION_TIER.cs index 1f9c7439..d0776168 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CONSERVATIVE_RASTERIZATION_TIER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CONSERVATIVE_RASTERIZATION_TIER.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.DirectX D3D12_CONSERVATIVE_RASTERIZATION_TIER_2 = 2, D3D12_CONSERVATIVE_RASTERIZATION_TIER_3 = 3, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CONSTANT_BUFFER_VIEW_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CONSTANT_BUFFER_VIEW_DESC.cs index e10daa6d..0bac23de 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CONSTANT_BUFFER_VIEW_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CONSTANT_BUFFER_VIEW_DESC.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.DirectX public uint SizeInBytes; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CPU_DESCRIPTOR_HANDLE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CPU_DESCRIPTOR_HANDLE.cs index 15ec1041..fe3661b3 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CPU_DESCRIPTOR_HANDLE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CPU_DESCRIPTOR_HANDLE.cs @@ -10,4 +10,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("SIZE_T")] public nuint ptr; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CPU_PAGE_PROPERTY.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CPU_PAGE_PROPERTY.cs index f2ba3764..7dbec992 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CPU_PAGE_PROPERTY.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CPU_PAGE_PROPERTY.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.DirectX D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE = 2, D3D12_CPU_PAGE_PROPERTY_WRITE_BACK = 3, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CROSS_NODE_SHARING_TIER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CROSS_NODE_SHARING_TIER.cs index 7115cb8a..1a6f6c02 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CROSS_NODE_SHARING_TIER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_CROSS_NODE_SHARING_TIER.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX D3D12_CROSS_NODE_SHARING_TIER_2 = 3, D3D12_CROSS_NODE_SHARING_TIER_3 = 4, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DEPTH_STENCIL_VALUE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DEPTH_STENCIL_VALUE.cs index 0f07a09a..d09e8b62 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DEPTH_STENCIL_VALUE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DEPTH_STENCIL_VALUE.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("UINT8")] public byte Stencil; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_HEAP_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_HEAP_DESC.cs index cc86a3da..8651f79a 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_HEAP_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_HEAP_DESC.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.DirectX public uint NodeMask; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_HEAP_FLAGS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_HEAP_FLAGS.cs index 2e243d51..b74d07ae 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_HEAP_FLAGS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_HEAP_FLAGS.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX D3D12_DESCRIPTOR_HEAP_FLAG_NONE = 0, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE = 0x1, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_HEAP_TYPE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_HEAP_TYPE.cs index 126ba313..393d20f1 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_HEAP_TYPE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_HEAP_TYPE.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX D3D12_DESCRIPTOR_HEAP_TYPE_DSV = (D3D12_DESCRIPTOR_HEAP_TYPE_RTV + 1), D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES = (D3D12_DESCRIPTOR_HEAP_TYPE_DSV + 1), } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE.cs index 0bfefa3d..91815458 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE.cs @@ -17,4 +17,4 @@ namespace TerraFX.Interop.DirectX public uint OffsetInDescriptorsFromTableStart; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE1.cs index 9e380189..9e5138f3 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE1.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.DirectX public uint OffsetInDescriptorsFromTableStart; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE_FLAGS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE_FLAGS.cs index b113913a..5fbb7e4c 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE_FLAGS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE_FLAGS.cs @@ -17,4 +17,4 @@ namespace TerraFX.Interop.DirectX D3D12_DESCRIPTOR_RANGE_FLAG_DATA_STATIC = 0x8, D3D12_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS = 0x10000, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE_TYPE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE_TYPE.cs index 9d54a14d..a89ad2b9 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE_TYPE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DESCRIPTOR_RANGE_TYPE.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.DirectX D3D12_DESCRIPTOR_RANGE_TYPE_CBV = (D3D12_DESCRIPTOR_RANGE_TYPE_UAV + 1), D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER = (D3D12_DESCRIPTOR_RANGE_TYPE_CBV + 1), } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_AUTO_BREADCRUMB_OUTPUT1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_AUTO_BREADCRUMB_OUTPUT1.cs index 57b9e182..860c8783 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_AUTO_BREADCRUMB_OUTPUT1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_AUTO_BREADCRUMB_OUTPUT1.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from d3d12.h in Microsoft.Direct3D.D3D12 v1.600.10 // Original source is Copyright © Microsoft. Licensed under the MIT license diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_BREADCRUMB_CONTEXT.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_BREADCRUMB_CONTEXT.cs index bf5f8904..7beff353 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_BREADCRUMB_CONTEXT.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_BREADCRUMB_CONTEXT.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from d3d12.h in Microsoft.Direct3D.D3D12 v1.600.10 // Original source is Copyright © Microsoft. Licensed under the MIT license diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_ENABLEMENT.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_ENABLEMENT.cs index d3fb1b22..00ecae57 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_ENABLEMENT.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_ENABLEMENT.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from d3d12.h in Microsoft.Direct3D.D3D12 v1.600.10 // Original source is Copyright © Microsoft. Licensed under the MIT license diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE.cs index 52911832..cbcfe00b 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE.cs @@ -37,4 +37,4 @@ namespace TerraFX.Interop.DirectX D3D12_FEATURE_D3D12_OPTIONS9 = 37, D3D12_FEATURE_WAVE_MMA = 38, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_ARCHITECTURE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_ARCHITECTURE.cs index 4b9df376..60310d3a 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_ARCHITECTURE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_ARCHITECTURE.cs @@ -17,4 +17,4 @@ namespace TerraFX.Interop.DirectX public BOOL CacheCoherentUMA; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_ARCHITECTURE1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_ARCHITECTURE1.cs index e06e8ae7..b9287ec3 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_ARCHITECTURE1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_ARCHITECTURE1.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.DirectX public BOOL IsolatedMMU; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_D3D12_OPTIONS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_D3D12_OPTIONS.cs index a8fe79a5..25373528 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_D3D12_OPTIONS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_D3D12_OPTIONS.cs @@ -39,4 +39,4 @@ namespace TerraFX.Interop.DirectX public D3D12_RESOURCE_HEAP_TIER ResourceHeapTier; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_D3D12_OPTIONS1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_D3D12_OPTIONS1.cs index 8bb6a3a7..185771fc 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_D3D12_OPTIONS1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_D3D12_OPTIONS1.cs @@ -21,4 +21,4 @@ namespace TerraFX.Interop.DirectX public BOOL Int64ShaderOps; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_D3D12_OPTIONS7.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_D3D12_OPTIONS7.cs index 85652ef2..5b6d2c02 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_D3D12_OPTIONS7.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_D3D12_OPTIONS7.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX public D3D12_SAMPLER_FEEDBACK_TIER SamplerFeedbackTier; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_FORMAT_SUPPORT.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_FORMAT_SUPPORT.cs index 0dabd3ed..b2670530 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_FORMAT_SUPPORT.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_FORMAT_SUPPORT.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX public D3D12_FORMAT_SUPPORT2 Support2; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_SHADER_MODEL.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_SHADER_MODEL.cs index a87e05ff..a7af4acd 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_SHADER_MODEL.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FEATURE_DATA_SHADER_MODEL.cs @@ -9,4 +9,4 @@ namespace TerraFX.Interop.DirectX { public D3D_SHADER_MODEL HighestShaderModel; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FENCE_FLAGS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FENCE_FLAGS.cs index 79b1b17a..28fc46ed 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FENCE_FLAGS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FENCE_FLAGS.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.DirectX D3D12_FENCE_FLAG_SHARED_CROSS_ADAPTER = 0x2, D3D12_FENCE_FLAG_NON_MONITORED = 0x4, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FILTER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FILTER.cs index e0221c56..ab751db1 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FILTER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FILTER.cs @@ -44,4 +44,4 @@ namespace TerraFX.Interop.DirectX D3D12_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 0x195, D3D12_FILTER_MAXIMUM_ANISOTROPIC = 0x1d5, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FORMAT_SUPPORT1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FORMAT_SUPPORT1.cs index 36b6f166..c946b460 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FORMAT_SUPPORT1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FORMAT_SUPPORT1.cs @@ -41,4 +41,4 @@ namespace TerraFX.Interop.DirectX D3D12_FORMAT_SUPPORT1_VIDEO_PROCESSOR_INPUT = 0x20000000, D3D12_FORMAT_SUPPORT1_VIDEO_ENCODER = 0x40000000, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FORMAT_SUPPORT2.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FORMAT_SUPPORT2.cs index 55a457d0..79bcaac3 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FORMAT_SUPPORT2.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_FORMAT_SUPPORT2.cs @@ -24,4 +24,4 @@ namespace TerraFX.Interop.DirectX D3D12_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x4000, D3D12_FORMAT_SUPPORT2_SAMPLER_FEEDBACK = 0x8000, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_GPU_DESCRIPTOR_HANDLE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_GPU_DESCRIPTOR_HANDLE.cs index c9de53a5..a2bd28d3 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_GPU_DESCRIPTOR_HANDLE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_GPU_DESCRIPTOR_HANDLE.cs @@ -10,4 +10,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("UINT64")] public ulong ptr; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_DESC.cs index b245157d..e4c52d13 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_DESC.cs @@ -17,4 +17,4 @@ namespace TerraFX.Interop.DirectX public D3D12_HEAP_FLAGS Flags; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_FLAGS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_FLAGS.cs index cce0ac38..635917f0 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_FLAGS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_FLAGS.cs @@ -27,4 +27,4 @@ namespace TerraFX.Interop.DirectX D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES = 0x44, D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES = 0x84, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_PROPERTIES.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_PROPERTIES.cs index a96d99be..c3d5208b 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_PROPERTIES.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_PROPERTIES.cs @@ -17,4 +17,4 @@ namespace TerraFX.Interop.DirectX public uint VisibleNodeMask; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_TYPE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_TYPE.cs index f7c4e9eb..ec326b2b 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_TYPE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_HEAP_TYPE.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.DirectX D3D12_HEAP_TYPE_READBACK = 3, D3D12_HEAP_TYPE_CUSTOM = 4, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_MEMORY_POOL.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_MEMORY_POOL.cs index 2b7ebae2..774f1ff1 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_MEMORY_POOL.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_MEMORY_POOL.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX D3D12_MEMORY_POOL_L0 = 1, D3D12_MEMORY_POOL_L1 = 2, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_MESH_SHADER_TIER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_MESH_SHADER_TIER.cs index 5b1c1faa..9d9760a5 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_MESH_SHADER_TIER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_MESH_SHADER_TIER.cs @@ -10,4 +10,4 @@ namespace TerraFX.Interop.DirectX D3D12_MESH_SHADER_TIER_NOT_SUPPORTED = 0, D3D12_MESH_SHADER_TIER_1 = 10, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_MIP_REGION.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_MIP_REGION.cs index ea34765f..b3f8d802 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_MIP_REGION.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_MIP_REGION.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX public uint Depth; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_PIPELINE_STATE_FLAGS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_PIPELINE_STATE_FLAGS.cs index d478cf96..29a75da7 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_PIPELINE_STATE_FLAGS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_PIPELINE_STATE_FLAGS.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX D3D12_PIPELINE_STATE_FLAG_NONE = 0, D3D12_PIPELINE_STATE_FLAG_TOOL_DEBUG = 0x1, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_PLACED_SUBRESOURCE_FOOTPRINT.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_PLACED_SUBRESOURCE_FOOTPRINT.cs index f12a7c2c..591794c7 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_PLACED_SUBRESOURCE_FOOTPRINT.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_PLACED_SUBRESOURCE_FOOTPRINT.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.DirectX public D3D12_SUBRESOURCE_FOOTPRINT Footprint; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RANGE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RANGE.cs index d0dc335f..97a25d09 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RANGE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RANGE.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("SIZE_T")] public nuint End; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV.cs index d5fa70bd..a1e4e3a3 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV.cs @@ -10,4 +10,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("D3D12_GPU_VIRTUAL_ADDRESS")] public ulong Location; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_ALIASING_BARRIER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_ALIASING_BARRIER.cs index 17268e95..c588434c 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_ALIASING_BARRIER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_ALIASING_BARRIER.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX public ID3D12Resource* pResourceAfter; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_ALLOCATION_INFO.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_ALLOCATION_INFO.cs index 94497290..b870361e 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_ALLOCATION_INFO.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_ALLOCATION_INFO.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("UINT64")] public ulong Alignment; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_ALLOCATION_INFO1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_ALLOCATION_INFO1.cs index f5ff3cba..0b8857b2 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_ALLOCATION_INFO1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_ALLOCATION_INFO1.cs @@ -16,4 +16,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("UINT64")] public ulong SizeInBytes; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BARRIER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BARRIER.cs index 5daf7b8f..48f1e2da 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BARRIER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BARRIER.cs @@ -29,4 +29,4 @@ namespace TerraFX.Interop.DirectX public D3D12_RESOURCE_UAV_BARRIER UAV; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BARRIER_FLAGS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BARRIER_FLAGS.cs index b59e2222..b71d79ff 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BARRIER_FLAGS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BARRIER_FLAGS.cs @@ -14,4 +14,4 @@ namespace TerraFX.Interop.DirectX D3D12_RESOURCE_BARRIER_FLAG_BEGIN_ONLY = 0x1, D3D12_RESOURCE_BARRIER_FLAG_END_ONLY = 0x2, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BARRIER_TYPE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BARRIER_TYPE.cs index f453954a..84bce222 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BARRIER_TYPE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BARRIER_TYPE.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX D3D12_RESOURCE_BARRIER_TYPE_ALIASING = (D3D12_RESOURCE_BARRIER_TYPE_TRANSITION + 1), D3D12_RESOURCE_BARRIER_TYPE_UAV = (D3D12_RESOURCE_BARRIER_TYPE_ALIASING + 1), } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BINDING_TIER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BINDING_TIER.cs index ba7a52b3..2c44a44c 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BINDING_TIER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_BINDING_TIER.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX D3D12_RESOURCE_BINDING_TIER_2 = 2, D3D12_RESOURCE_BINDING_TIER_3 = 3, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_DESC.cs index 80a21e12..34e1e03b 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_DESC.cs @@ -31,4 +31,4 @@ namespace TerraFX.Interop.DirectX public D3D12_RESOURCE_FLAGS Flags; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_DESC1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_DESC1.cs index e2d8c7d1..ab512453 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_DESC1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_DESC1.cs @@ -33,4 +33,4 @@ namespace TerraFX.Interop.DirectX public D3D12_MIP_REGION SamplerFeedbackMipRegion; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_DIMENSION.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_DIMENSION.cs index 37c22425..841bdabf 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_DIMENSION.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_DIMENSION.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX D3D12_RESOURCE_DIMENSION_TEXTURE2D = 3, D3D12_RESOURCE_DIMENSION_TEXTURE3D = 4, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_FLAGS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_FLAGS.cs index d55bc11f..ffffa821 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_FLAGS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_FLAGS.cs @@ -20,4 +20,4 @@ namespace TerraFX.Interop.DirectX D3D12_RESOURCE_FLAG_VIDEO_DECODE_REFERENCE_ONLY = 0x40, D3D12_RESOURCE_FLAG_VIDEO_ENCODE_REFERENCE_ONLY = 0x80, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_HEAP_TIER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_HEAP_TIER.cs index e54c5722..ddf515ba 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_HEAP_TIER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_HEAP_TIER.cs @@ -10,4 +10,4 @@ namespace TerraFX.Interop.DirectX D3D12_RESOURCE_HEAP_TIER_1 = 1, D3D12_RESOURCE_HEAP_TIER_2 = 2, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_STATES.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_STATES.cs index ec892d97..51af7a4e 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_STATES.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_STATES.cs @@ -38,4 +38,4 @@ namespace TerraFX.Interop.DirectX D3D12_RESOURCE_STATE_VIDEO_ENCODE_READ = 0x200000, D3D12_RESOURCE_STATE_VIDEO_ENCODE_WRITE = 0x800000, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_TRANSITION_BARRIER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_TRANSITION_BARRIER.cs index cd962f06..fa024220 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_TRANSITION_BARRIER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_TRANSITION_BARRIER.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.DirectX public D3D12_RESOURCE_STATES StateAfter; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_UAV_BARRIER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_UAV_BARRIER.cs index e7d212ca..07fb226f 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_UAV_BARRIER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_RESOURCE_UAV_BARRIER.cs @@ -9,4 +9,4 @@ namespace TerraFX.Interop.DirectX { public ID3D12Resource* pResource; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_CONSTANTS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_CONSTANTS.cs index 5d262c23..1346906a 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_CONSTANTS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_CONSTANTS.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX public uint Num32BitValues; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR.cs index b028b06a..c4f2e61d 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX public uint RegisterSpace; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR1.cs index bf1c40db..dacd6e6a 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR1.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX public D3D12_ROOT_DESCRIPTOR_FLAGS Flags; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR_FLAGS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR_FLAGS.cs index e8e9e898..a2ab1590 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR_FLAGS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR_FLAGS.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.DirectX D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE = 0x4, D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC = 0x8, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR_TABLE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR_TABLE.cs index 65784004..40e7bcda 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR_TABLE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR_TABLE.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("const D3D12_DESCRIPTOR_RANGE *")] public D3D12_DESCRIPTOR_RANGE* pDescriptorRanges; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR_TABLE1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR_TABLE1.cs index 30050611..93488aee 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR_TABLE1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_DESCRIPTOR_TABLE1.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("const D3D12_DESCRIPTOR_RANGE1 *")] public D3D12_DESCRIPTOR_RANGE1* pDescriptorRanges; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_PARAMETER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_PARAMETER.cs index 67b3a313..07e758ab 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_PARAMETER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_PARAMETER.cs @@ -29,4 +29,4 @@ namespace TerraFX.Interop.DirectX public D3D12_ROOT_DESCRIPTOR Descriptor; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_PARAMETER1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_PARAMETER1.cs index 5bfcbdd3..b4f38318 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_PARAMETER1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_PARAMETER1.cs @@ -29,4 +29,4 @@ namespace TerraFX.Interop.DirectX public D3D12_ROOT_DESCRIPTOR1 Descriptor; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_PARAMETER_TYPE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_PARAMETER_TYPE.cs index 5d87d02a..e312dee0 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_PARAMETER_TYPE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_PARAMETER_TYPE.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX D3D12_ROOT_PARAMETER_TYPE_SRV = (D3D12_ROOT_PARAMETER_TYPE_CBV + 1), D3D12_ROOT_PARAMETER_TYPE_UAV = (D3D12_ROOT_PARAMETER_TYPE_SRV + 1), } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_SIGNATURE_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_SIGNATURE_DESC.cs index 2641edc1..bf2e9911 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_SIGNATURE_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_SIGNATURE_DESC.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.DirectX public D3D12_ROOT_SIGNATURE_FLAGS Flags; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_SIGNATURE_DESC1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_SIGNATURE_DESC1.cs index be1d76b4..d3466c09 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_SIGNATURE_DESC1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_SIGNATURE_DESC1.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.DirectX public D3D12_ROOT_SIGNATURE_FLAGS Flags; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_SIGNATURE_FLAGS.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_SIGNATURE_FLAGS.cs index 07384aa0..d7fd3687 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_SIGNATURE_FLAGS.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_ROOT_SIGNATURE_FLAGS.cs @@ -24,4 +24,4 @@ namespace TerraFX.Interop.DirectX D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED = 0x400, D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED = 0x800, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SAMPLER_FEEDBACK_TIER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SAMPLER_FEEDBACK_TIER.cs index cd12ae03..c2d7b8bd 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SAMPLER_FEEDBACK_TIER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SAMPLER_FEEDBACK_TIER.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX D3D12_SAMPLER_FEEDBACK_TIER_0_9 = 90, D3D12_SAMPLER_FEEDBACK_TIER_1_0 = 100, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_BYTECODE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_BYTECODE.cs index 8f5fc765..76e2f69b 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_BYTECODE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_BYTECODE.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("SIZE_T")] public nuint BytecodeLength; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_MIN_PRECISION_SUPPORT.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_MIN_PRECISION_SUPPORT.cs index 7a30fa34..4fa92164 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_MIN_PRECISION_SUPPORT.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_MIN_PRECISION_SUPPORT.cs @@ -14,4 +14,4 @@ namespace TerraFX.Interop.DirectX D3D12_SHADER_MIN_PRECISION_SUPPORT_10_BIT = 0x1, D3D12_SHADER_MIN_PRECISION_SUPPORT_16_BIT = 0x2, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_RESOURCE_VIEW_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_RESOURCE_VIEW_DESC.cs index 7178e92b..2c93e1e6 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_RESOURCE_VIEW_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_RESOURCE_VIEW_DESC.cs @@ -77,4 +77,4 @@ namespace TerraFX.Interop.DirectX public D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV RaytracingAccelerationStructure; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_VISIBILITY.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_VISIBILITY.cs index 4cd19828..defc97f4 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_VISIBILITY.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SHADER_VISIBILITY.cs @@ -16,4 +16,4 @@ namespace TerraFX.Interop.DirectX D3D12_SHADER_VISIBILITY_AMPLIFICATION = 6, D3D12_SHADER_VISIBILITY_MESH = 7, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SRV_DIMENSION.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SRV_DIMENSION.cs index 01bcb885..ea58c01c 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SRV_DIMENSION.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SRV_DIMENSION.cs @@ -20,4 +20,4 @@ namespace TerraFX.Interop.DirectX D3D12_SRV_DIMENSION_TEXTURECUBEARRAY = 10, D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE = 11, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_STATIC_BORDER_COLOR.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_STATIC_BORDER_COLOR.cs index 826270fc..2a821e23 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_STATIC_BORDER_COLOR.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_STATIC_BORDER_COLOR.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK = (D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK + 1), D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE = (D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK + 1), } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_STATIC_SAMPLER_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_STATIC_SAMPLER_DESC.cs index 397ff191..591e5b9e 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_STATIC_SAMPLER_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_STATIC_SAMPLER_DESC.cs @@ -33,4 +33,4 @@ namespace TerraFX.Interop.DirectX public D3D12_SHADER_VISIBILITY ShaderVisibility; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SUBRESOURCE_FOOTPRINT.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SUBRESOURCE_FOOTPRINT.cs index ca756aee..46cf1e3c 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SUBRESOURCE_FOOTPRINT.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_SUBRESOURCE_FOOTPRINT.cs @@ -17,4 +17,4 @@ namespace TerraFX.Interop.DirectX public uint RowPitch; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_ARRAY_SRV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_ARRAY_SRV.cs index 5a50100f..e8199e77 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_ARRAY_SRV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_ARRAY_SRV.cs @@ -17,4 +17,4 @@ namespace TerraFX.Interop.DirectX public float ResourceMinLODClamp; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_ARRAY_UAV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_ARRAY_UAV.cs index 5c51892e..fb1608d3 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_ARRAY_UAV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_ARRAY_UAV.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX public uint ArraySize; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_SRV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_SRV.cs index 172f1ebf..f1c738d6 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_SRV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_SRV.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX public float ResourceMinLODClamp; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_UAV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_UAV.cs index 663bf298..b627e3f6 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_UAV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX1D_UAV.cs @@ -9,4 +9,4 @@ namespace TerraFX.Interop.DirectX { public uint MipSlice; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2DMS_ARRAY_SRV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2DMS_ARRAY_SRV.cs index 4466146a..4df053d7 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2DMS_ARRAY_SRV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2DMS_ARRAY_SRV.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX public uint ArraySize; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2DMS_SRV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2DMS_SRV.cs index cbce8f9b..e1732151 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2DMS_SRV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2DMS_SRV.cs @@ -9,4 +9,4 @@ namespace TerraFX.Interop.DirectX { public uint UnusedField_NothingToDefine; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_ARRAY_SRV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_ARRAY_SRV.cs index e1926822..cb532348 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_ARRAY_SRV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_ARRAY_SRV.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.DirectX public float ResourceMinLODClamp; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_ARRAY_UAV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_ARRAY_UAV.cs index 1902ef3b..f4521313 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_ARRAY_UAV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_ARRAY_UAV.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.DirectX public uint PlaneSlice; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_SRV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_SRV.cs index 279cc1d5..cbf477db 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_SRV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_SRV.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.DirectX public float ResourceMinLODClamp; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_UAV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_UAV.cs index d7f65038..f3711a8d 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_UAV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX2D_UAV.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX public uint PlaneSlice; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX3D_SRV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX3D_SRV.cs index 01f0294c..9755c9b7 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX3D_SRV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX3D_SRV.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX public float ResourceMinLODClamp; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX3D_UAV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX3D_UAV.cs index d76d1cbf..5ebe69b3 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX3D_UAV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEX3D_UAV.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX public uint WSize; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXCUBE_ARRAY_SRV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXCUBE_ARRAY_SRV.cs index 5df2dd08..77e57686 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXCUBE_ARRAY_SRV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXCUBE_ARRAY_SRV.cs @@ -17,4 +17,4 @@ namespace TerraFX.Interop.DirectX public float ResourceMinLODClamp; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXCUBE_SRV.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXCUBE_SRV.cs index 2df89015..d960cb05 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXCUBE_SRV.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXCUBE_SRV.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX public float ResourceMinLODClamp; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_ADDRESS_MODE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_ADDRESS_MODE.cs index 23fe77f7..5f4b7e28 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_ADDRESS_MODE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_ADDRESS_MODE.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX D3D12_TEXTURE_ADDRESS_MODE_BORDER = 4, D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE = 5, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_COPY_LOCATION.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_COPY_LOCATION.cs index 460d4699..90fdadc8 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_COPY_LOCATION.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_COPY_LOCATION.cs @@ -26,4 +26,4 @@ namespace TerraFX.Interop.DirectX public uint SubresourceIndex; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_COPY_TYPE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_COPY_TYPE.cs index 8b272ff1..06fcf071 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_COPY_TYPE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_COPY_TYPE.cs @@ -10,4 +10,4 @@ namespace TerraFX.Interop.DirectX D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX = 0, D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT = 1, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_LAYOUT.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_LAYOUT.cs index bb67db51..c2a6769a 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_LAYOUT.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TEXTURE_LAYOUT.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.DirectX D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE = 2, D3D12_TEXTURE_LAYOUT_64KB_STANDARD_SWIZZLE = 3, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TILED_RESOURCES_TIER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TILED_RESOURCES_TIER.cs index 909c8f53..5e4367ef 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TILED_RESOURCES_TIER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_TILED_RESOURCES_TIER.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX D3D12_TILED_RESOURCES_TIER_3 = 3, D3D12_TILED_RESOURCES_TIER_4 = 4, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_UAV_DIMENSION.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_UAV_DIMENSION.cs index db0eeb74..f9a2fbff 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_UAV_DIMENSION.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_UAV_DIMENSION.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.DirectX D3D12_UAV_DIMENSION_TEXTURE2DARRAY = 5, D3D12_UAV_DIMENSION_TEXTURE3D = 8, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_UNORDERED_ACCESS_VIEW_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_UNORDERED_ACCESS_VIEW_DESC.cs index 3dc4a7fd..61222191 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_UNORDERED_ACCESS_VIEW_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_UNORDERED_ACCESS_VIEW_DESC.cs @@ -60,4 +60,4 @@ namespace TerraFX.Interop.DirectX public D3D12_TEX3D_UAV Texture3D; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_VERSIONED_ROOT_SIGNATURE_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_VERSIONED_ROOT_SIGNATURE_DESC.cs index f15832d8..6d9a2df1 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_VERSIONED_ROOT_SIGNATURE_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_VERSIONED_ROOT_SIGNATURE_DESC.cs @@ -24,4 +24,4 @@ namespace TerraFX.Interop.DirectX public D3D12_ROOT_SIGNATURE_DESC1 Desc_1_1; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D_ROOT_SIGNATURE_VERSION.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D_ROOT_SIGNATURE_VERSION.cs index a31f1890..cc3a4148 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D_ROOT_SIGNATURE_VERSION.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D_ROOT_SIGNATURE_VERSION.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX D3D_ROOT_SIGNATURE_VERSION_1_0 = 0x1, D3D_ROOT_SIGNATURE_VERSION_1_1 = 0x2, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D_SHADER_MODEL.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D_SHADER_MODEL.cs index 944e72ce..5eb99ddd 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D_SHADER_MODEL.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D_SHADER_MODEL.cs @@ -17,4 +17,4 @@ namespace TerraFX.Interop.DirectX D3D_SHADER_MODEL_6_6 = 0x66, D3D_SHADER_MODEL_6_7 = 0x67, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/DirectX.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/DirectX.cs index 58a52f64..dbd4c491 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/DirectX.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/DirectX.cs @@ -20,4 +20,4 @@ namespace TerraFX.Interop.DirectX [DllImport("d3d12", ExactSpelling = true)] public static extern HRESULT D3D12GetDebugInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvDebug); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12CommandAllocator.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12CommandAllocator.cs index f0e4e20b..5ed9d3e0 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12CommandAllocator.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12CommandAllocator.cs @@ -82,4 +82,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[8]))((ID3D12CommandAllocator*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12CommandList.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12CommandList.cs index 8f56a731..4b3df1fd 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12CommandList.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12CommandList.cs @@ -82,4 +82,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[8]))((ID3D12CommandList*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12CommandQueue.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12CommandQueue.cs index f8f9211c..18ef09b7 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12CommandQueue.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12CommandQueue.cs @@ -139,4 +139,4 @@ namespace TerraFX.Interop.DirectX return *((delegate* unmanaged[Stdcall])(lpVtbl[18]))((ID3D12CommandQueue*)Unsafe.AsPointer(ref this), &result); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DescriptorHeap.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DescriptorHeap.cs index d778c6e9..1e6199e5 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DescriptorHeap.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DescriptorHeap.cs @@ -99,4 +99,4 @@ namespace TerraFX.Interop.DirectX return *((delegate* unmanaged[Stdcall])(lpVtbl[10]))((ID3D12DescriptorHeap*)Unsafe.AsPointer(ref this), &result); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Device.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Device.cs index 9e6e5d67..9d6b8832 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Device.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Device.cs @@ -260,4 +260,4 @@ namespace TerraFX.Interop.DirectX return *((delegate* unmanaged[Stdcall])(lpVtbl[43]))((ID3D12Device*)Unsafe.AsPointer(ref this), &result); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs index 2e7d0d58..b991b4a0 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from d3d12.h in Microsoft.Direct3D.D3D12 v1.600.10 // Original source is Copyright © Microsoft. Licensed under the MIT license diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedDataSettings1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedDataSettings1.cs index 4843bac0..71d204bd 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedDataSettings1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedDataSettings1.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from d3d12.h in Microsoft.Direct3D.D3D12 v1.600.10 // Original source is Copyright © Microsoft. Licensed under the MIT license diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Fence.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Fence.cs index fb7b58d5..105ef939 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Fence.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Fence.cs @@ -97,4 +97,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[10]))((ID3D12Fence*)Unsafe.AsPointer(ref this), Value); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12GraphicsCommandList.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12GraphicsCommandList.cs index ffc02277..792b2461 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12GraphicsCommandList.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12GraphicsCommandList.cs @@ -313,4 +313,4 @@ namespace TerraFX.Interop.DirectX ((delegate* unmanaged[Stdcall])(lpVtbl[50]))((ID3D12GraphicsCommandList*)Unsafe.AsPointer(ref this), ViewGPUHandleInCurrentHeap, ViewCPUHandle, pResource, Values, NumRects, pRects); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Heap.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Heap.cs index 4bb283ef..2c7a5d23 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Heap.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Heap.cs @@ -83,4 +83,4 @@ namespace TerraFX.Interop.DirectX return *((delegate* unmanaged[Stdcall])(lpVtbl[8]))((ID3D12Heap*)Unsafe.AsPointer(ref this), &result); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12PipelineState.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12PipelineState.cs index d539b7d8..72ce8174 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12PipelineState.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12PipelineState.cs @@ -82,4 +82,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[8]))((ID3D12PipelineState*)Unsafe.AsPointer(ref this), ppBlob); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Resource.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Resource.cs index a9424e62..7703675a 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Resource.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12Resource.cs @@ -126,4 +126,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[14]))((ID3D12Resource*)Unsafe.AsPointer(ref this), pHeapProperties, pHeapFlags); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12RootSignature.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12RootSignature.cs index a96f1266..32c6b158 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12RootSignature.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12RootSignature.cs @@ -75,4 +75,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[7]))((ID3D12RootSignature*)Unsafe.AsPointer(ref this), riid, ppvDevice); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_INFO_QUEUE_FILTER.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_INFO_QUEUE_FILTER.cs index aa1ba5ff..7b3ad6d3 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_INFO_QUEUE_FILTER.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_INFO_QUEUE_FILTER.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.DirectX public D3D12_INFO_QUEUE_FILTER_DESC DenyList; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_INFO_QUEUE_FILTER_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_INFO_QUEUE_FILTER_DESC.cs index e17e66ef..4f756118 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_INFO_QUEUE_FILTER_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_INFO_QUEUE_FILTER_DESC.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.DirectX public D3D12_MESSAGE_ID* pIDList; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE.cs index 84bd7ee1..b8b151da 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("SIZE_T")] public nuint DescriptionByteLength; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE_CATEGORY.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE_CATEGORY.cs index 452aa7f9..9bd869a8 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE_CATEGORY.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE_CATEGORY.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.DirectX D3D12_MESSAGE_CATEGORY_EXECUTION = (D3D12_MESSAGE_CATEGORY_RESOURCE_MANIPULATION + 1), D3D12_MESSAGE_CATEGORY_SHADER = (D3D12_MESSAGE_CATEGORY_EXECUTION + 1), } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE_ID.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE_ID.cs index 2e903d09..7338b20e 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE_ID.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE_ID.cs @@ -920,4 +920,4 @@ namespace TerraFX.Interop.DirectX D3D12_MESSAGE_ID_EMPTY_ROOT_DESCRIPTOR_TABLE = 1347, D3D12_MESSAGE_ID_D3D12_MESSAGES_END = (D3D12_MESSAGE_ID_EMPTY_ROOT_DESCRIPTOR_TABLE + 1) } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE_SEVERITY.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE_SEVERITY.cs index 1f581650..6b4d04f0 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE_SEVERITY.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/D3D12_MESSAGE_SEVERITY.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX D3D12_MESSAGE_SEVERITY_INFO = (D3D12_MESSAGE_SEVERITY_WARNING + 1), D3D12_MESSAGE_SEVERITY_MESSAGE = (D3D12_MESSAGE_SEVERITY_INFO + 1), } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/ID3D12Debug.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/ID3D12Debug.cs index b0016aac..77ae9f48 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/ID3D12Debug.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/ID3D12Debug.cs @@ -47,4 +47,4 @@ namespace TerraFX.Interop.DirectX ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID3D12Debug*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/ID3D12Debug1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/ID3D12Debug1.cs index ab77db14..74369008 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/ID3D12Debug1.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/ID3D12Debug1.cs @@ -61,4 +61,4 @@ namespace TerraFX.Interop.DirectX ((delegate* unmanaged[Stdcall])(lpVtbl[5]))((ID3D12Debug1*)Unsafe.AsPointer(ref this), Enable); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/ID3D12InfoQueue.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/ID3D12InfoQueue.cs index d72c17b3..b7861744 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/ID3D12InfoQueue.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12sdklayers/ID3D12InfoQueue.cs @@ -291,4 +291,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[37]))((ID3D12InfoQueue*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12shader/D3D12_SHADER_DESC.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12shader/D3D12_SHADER_DESC.cs index 0e0f144d..cd140914 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12shader/D3D12_SHADER_DESC.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12shader/D3D12_SHADER_DESC.cs @@ -84,4 +84,4 @@ namespace TerraFX.Interop.DirectX public uint cTextureStoreInstructions; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12shader/ID3D12ShaderReflection.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12shader/ID3D12ShaderReflection.cs index cc101764..afa9e9a8 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3d12shader/ID3D12ShaderReflection.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12shader/ID3D12ShaderReflection.cs @@ -118,4 +118,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[21]))((ID3D12ShaderReflection*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_FEATURE_LEVEL.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_FEATURE_LEVEL.cs index 46e6acd5..649ba020 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_FEATURE_LEVEL.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_FEATURE_LEVEL.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.DirectX D3D_FEATURE_LEVEL_12_1 = 0xc100, D3D_FEATURE_LEVEL_12_2 = 0xc200, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_PRIMITIVE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_PRIMITIVE.cs index 9c838be7..7088a7c2 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_PRIMITIVE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_PRIMITIVE.cs @@ -90,4 +90,4 @@ namespace TerraFX.Interop.DirectX D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH = D3D_PRIMITIVE_31_CONTROL_POINT_PATCH, D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH = D3D_PRIMITIVE_32_CONTROL_POINT_PATCH, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_PRIMITIVE_TOPOLOGY.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_PRIMITIVE_TOPOLOGY.cs index 3e404b74..b1868f5f 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_PRIMITIVE_TOPOLOGY.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_PRIMITIVE_TOPOLOGY.cs @@ -102,4 +102,4 @@ namespace TerraFX.Interop.DirectX D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST, D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_TESSELLATOR_DOMAIN.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_TESSELLATOR_DOMAIN.cs index a11b609d..f3ea9772 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_TESSELLATOR_DOMAIN.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_TESSELLATOR_DOMAIN.cs @@ -16,4 +16,4 @@ namespace TerraFX.Interop.DirectX D3D11_TESSELLATOR_DOMAIN_TRI = D3D_TESSELLATOR_DOMAIN_TRI, D3D11_TESSELLATOR_DOMAIN_QUAD = D3D_TESSELLATOR_DOMAIN_QUAD, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_TESSELLATOR_OUTPUT_PRIMITIVE.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_TESSELLATOR_OUTPUT_PRIMITIVE.cs index 9a61e1bf..d2aedc60 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_TESSELLATOR_OUTPUT_PRIMITIVE.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_TESSELLATOR_OUTPUT_PRIMITIVE.cs @@ -18,4 +18,4 @@ namespace TerraFX.Interop.DirectX D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW, D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_TESSELLATOR_PARTITIONING.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_TESSELLATOR_PARTITIONING.cs index e66227c6..56c56e1e 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_TESSELLATOR_PARTITIONING.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/D3D_TESSELLATOR_PARTITIONING.cs @@ -18,4 +18,4 @@ namespace TerraFX.Interop.DirectX D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD, D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/ID3DBlob.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/ID3DBlob.cs index 5eebe81e..d3723f11 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/ID3DBlob.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3dcommon/ID3DBlob.cs @@ -58,4 +58,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[4]))((ID3DBlob*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/CLSID.cs b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/CLSID.cs index 7407b4fa..ff7c3090 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/CLSID.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/CLSID.cs @@ -62,4 +62,4 @@ namespace TerraFX.Interop.Windows } } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/DxcBuffer.cs b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/DxcBuffer.cs index af729794..819561c4 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/DxcBuffer.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/DxcBuffer.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.DirectX public uint Encoding; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/DxcDefine.cs b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/DxcDefine.cs index 66c66be1..6071c20b 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/DxcDefine.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/DxcDefine.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("LPCWSTR")] public ushort* Value; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcBlob.cs b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcBlob.cs index 69749bd2..15a678e6 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcBlob.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcBlob.cs @@ -56,4 +56,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[4]))((IDxcBlob*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcBlobEncoding.cs b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcBlobEncoding.cs index 23938046..03ca39e4 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcBlobEncoding.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcBlobEncoding.cs @@ -63,4 +63,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[5]))((IDxcBlobEncoding*)Unsafe.AsPointer(ref this), pKnown, pCodePage); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcCompiler.cs b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcCompiler.cs index 40595635..55c7c7c6 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcCompiler.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcCompiler.cs @@ -61,4 +61,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[5]))((IDxcCompiler*)Unsafe.AsPointer(ref this), pSource, ppDisassembly); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcIncludeHandler.cs b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcIncludeHandler.cs index 85acc27d..a5f035dd 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcIncludeHandler.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcIncludeHandler.cs @@ -47,4 +47,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((IDxcIncludeHandler*)Unsafe.AsPointer(ref this), pFilename, ppIncludeSource); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcLibrary.cs b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcLibrary.cs index 0a2b65b2..9e0ce2b5 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcLibrary.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcLibrary.cs @@ -96,4 +96,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[12]))((IDxcLibrary*)Unsafe.AsPointer(ref this), pBlob, pBlobEncoding); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcOperationResult.cs b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcOperationResult.cs index c6327c9d..8b193c8e 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcOperationResult.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcOperationResult.cs @@ -61,4 +61,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[5]))((IDxcOperationResult*)Unsafe.AsPointer(ref this), ppErrors); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcUtils.cs b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcUtils.cs index e813c145..4c92f3a9 100644 --- a/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcUtils.cs +++ b/src/TerraFX.Interop.Windows/DirectX/um/dxcapi/IDxcUtils.cs @@ -103,4 +103,4 @@ namespace TerraFX.Interop.DirectX return ((delegate* unmanaged[Stdcall])(lpVtbl[15]))((IDxcUtils*)Unsafe.AsPointer(ref this), pPDBBlob, ppHash, ppContainer); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/WinRT/um/windows.ui.xaml.media.dxinterop/ISwapChainPanelNative.cs b/src/TerraFX.Interop.Windows/WinRT/um/windows.ui.xaml.media.dxinterop/ISwapChainPanelNative.cs index 70c0ba9b..702fe621 100644 --- a/src/TerraFX.Interop.Windows/WinRT/um/windows.ui.xaml.media.dxinterop/ISwapChainPanelNative.cs +++ b/src/TerraFX.Interop.Windows/WinRT/um/windows.ui.xaml.media.dxinterop/ISwapChainPanelNative.cs @@ -50,4 +50,4 @@ namespace TerraFX.Interop.WinRT return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ISwapChainPanelNative*)Unsafe.AsPointer(ref this), swapChain); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/other/helper-types/BOOL.cs b/src/TerraFX.Interop.Windows/Windows/other/helper-types/BOOL.cs index 9df0d783..6698a75a 100644 --- a/src/TerraFX.Interop.Windows/Windows/other/helper-types/BOOL.cs +++ b/src/TerraFX.Interop.Windows/Windows/other/helper-types/BOOL.cs @@ -99,4 +99,4 @@ namespace TerraFX.Interop.Windows public string ToString(string? format, IFormatProvider? formatProvider) => Value.ToString(format, formatProvider); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/other/helper-types/HANDLE.cs b/src/TerraFX.Interop.Windows/Windows/other/helper-types/HANDLE.cs index 659ab402..cca80e73 100644 --- a/src/TerraFX.Interop.Windows/Windows/other/helper-types/HANDLE.cs +++ b/src/TerraFX.Interop.Windows/Windows/other/helper-types/HANDLE.cs @@ -95,4 +95,4 @@ namespace TerraFX.Interop.Windows public string ToString(string? format, IFormatProvider? formatProvider) => ((nuint)(Value)).ToString(format, formatProvider); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/other/helper-types/HRESULT.cs b/src/TerraFX.Interop.Windows/Windows/other/helper-types/HRESULT.cs index 72932ea0..efd5b460 100644 --- a/src/TerraFX.Interop.Windows/Windows/other/helper-types/HRESULT.cs +++ b/src/TerraFX.Interop.Windows/Windows/other/helper-types/HRESULT.cs @@ -87,4 +87,4 @@ namespace TerraFX.Interop.Windows public string ToString(string? format, IFormatProvider? formatProvider) => Value.ToString(format, formatProvider); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/other/helper-types/HWND.cs b/src/TerraFX.Interop.Windows/Windows/other/helper-types/HWND.cs index bd2e4ae4..5b66968d 100644 --- a/src/TerraFX.Interop.Windows/Windows/other/helper-types/HWND.cs +++ b/src/TerraFX.Interop.Windows/Windows/other/helper-types/HWND.cs @@ -99,4 +99,4 @@ namespace TerraFX.Interop.Windows public string ToString(string? format, IFormatProvider? formatProvider) => ((nuint)(Value)).ToString(format, formatProvider); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/other/helper-types/LPARAM.cs b/src/TerraFX.Interop.Windows/Windows/other/helper-types/LPARAM.cs index 4876b7aa..5225af47 100644 --- a/src/TerraFX.Interop.Windows/Windows/other/helper-types/LPARAM.cs +++ b/src/TerraFX.Interop.Windows/Windows/other/helper-types/LPARAM.cs @@ -87,4 +87,4 @@ namespace TerraFX.Interop.Windows public string ToString(string? format, IFormatProvider? formatProvider) => Value.ToString(format, formatProvider); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/other/helper-types/LRESULT.cs b/src/TerraFX.Interop.Windows/Windows/other/helper-types/LRESULT.cs index fd7aebc6..30bbbb1c 100644 --- a/src/TerraFX.Interop.Windows/Windows/other/helper-types/LRESULT.cs +++ b/src/TerraFX.Interop.Windows/Windows/other/helper-types/LRESULT.cs @@ -87,4 +87,4 @@ namespace TerraFX.Interop.Windows public string ToString(string? format, IFormatProvider? formatProvider) => Value.ToString(format, formatProvider); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/other/helper-types/NativeInheritanceAttribute.cs b/src/TerraFX.Interop.Windows/Windows/other/helper-types/NativeInheritanceAttribute.cs index 66b88a86..11144f8f 100644 --- a/src/TerraFX.Interop.Windows/Windows/other/helper-types/NativeInheritanceAttribute.cs +++ b/src/TerraFX.Interop.Windows/Windows/other/helper-types/NativeInheritanceAttribute.cs @@ -22,4 +22,4 @@ namespace TerraFX.Interop /// Gets the name of the base type that was inherited from in the native signature. public string Name => _name; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/other/helper-types/NativeTypeNameAttribute.cs b/src/TerraFX.Interop.Windows/Windows/other/helper-types/NativeTypeNameAttribute.cs index 0ae70d8e..6110bbd5 100644 --- a/src/TerraFX.Interop.Windows/Windows/other/helper-types/NativeTypeNameAttribute.cs +++ b/src/TerraFX.Interop.Windows/Windows/other/helper-types/NativeTypeNameAttribute.cs @@ -22,4 +22,4 @@ namespace TerraFX.Interop /// Gets the name of the type that was used in the native signature. public string Name => _name; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/other/helper-types/VtblIndexAttribute.cs b/src/TerraFX.Interop.Windows/Windows/other/helper-types/VtblIndexAttribute.cs index 020fa7ec..470524a6 100644 --- a/src/TerraFX.Interop.Windows/Windows/other/helper-types/VtblIndexAttribute.cs +++ b/src/TerraFX.Interop.Windows/Windows/other/helper-types/VtblIndexAttribute.cs @@ -22,4 +22,4 @@ namespace TerraFX.Interop /// Gets the vtbl index of a method as it was in the native signature. public uint Index => _index; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/other/helper-types/WPARAM.cs b/src/TerraFX.Interop.Windows/Windows/other/helper-types/WPARAM.cs index aeb196d5..b4e1dca2 100644 --- a/src/TerraFX.Interop.Windows/Windows/other/helper-types/WPARAM.cs +++ b/src/TerraFX.Interop.Windows/Windows/other/helper-types/WPARAM.cs @@ -87,4 +87,4 @@ namespace TerraFX.Interop.Windows public string ToString(string? format, IFormatProvider? formatProvider) => Value.ToString(format, formatProvider); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/shared/minwindef/FILETIME.cs b/src/TerraFX.Interop.Windows/Windows/shared/minwindef/FILETIME.cs index 0f4ac886..cbe5ec45 100644 --- a/src/TerraFX.Interop.Windows/Windows/shared/minwindef/FILETIME.cs +++ b/src/TerraFX.Interop.Windows/Windows/shared/minwindef/FILETIME.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from shared/minwindef.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/Windows/shared/minwindef/Windows.cs b/src/TerraFX.Interop.Windows/Windows/shared/minwindef/Windows.cs index 71839e47..21bc8d56 100644 --- a/src/TerraFX.Interop.Windows/Windows/shared/minwindef/Windows.cs +++ b/src/TerraFX.Interop.Windows/Windows/shared/minwindef/Windows.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.Windows [NativeTypeName("#define TRUE 1")] public const int TRUE = 1; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/shared/uuids/Windows.Manual.cs b/src/TerraFX.Interop.Windows/Windows/shared/uuids/Windows.Manual.cs index 5d6b72ff..cbea5057 100644 --- a/src/TerraFX.Interop.Windows/Windows/shared/uuids/Windows.Manual.cs +++ b/src/TerraFX.Interop.Windows/Windows/shared/uuids/Windows.Manual.cs @@ -8,6 +8,8 @@ using System.ComponentModel; using System.Runtime.CompilerServices; using RuntimeHelpers = ComputeSharp.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers; +#pragma warning disable IDE1006 + namespace TerraFX.Interop.Windows { internal static partial class Windows @@ -22,7 +24,7 @@ namespace TerraFX.Interop.Windows { return new UuidOfType(UUID.RIID); } - + /// Retrieves the GUID of of a specified type. /// A pointer to a value of type . /// The type to retrieve the GUID for. @@ -83,4 +85,4 @@ namespace TerraFX.Interop.Windows } } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/shared/winerror/DXGI.cs b/src/TerraFX.Interop.Windows/Windows/shared/winerror/DXGI.cs index 51fff5e3..40db8076 100644 --- a/src/TerraFX.Interop.Windows/Windows/shared/winerror/DXGI.cs +++ b/src/TerraFX.Interop.Windows/Windows/shared/winerror/DXGI.cs @@ -142,4 +142,4 @@ namespace TerraFX.Interop.DirectX [NativeTypeName("#define DXGI_DDI_ERR_NONEXCLUSIVE _HRESULT_TYPEDEF_(0x887B0003L)")] public const int DXGI_DDI_ERR_NONEXCLUSIVE = unchecked((int)(0x887B0003)); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/shared/winerror/E.cs b/src/TerraFX.Interop.Windows/Windows/shared/winerror/E.cs index 50c6ed0c..78e3906b 100644 --- a/src/TerraFX.Interop.Windows/Windows/shared/winerror/E.cs +++ b/src/TerraFX.Interop.Windows/Windows/shared/winerror/E.cs @@ -364,4 +364,4 @@ namespace TerraFX.Interop.Windows [NativeTypeName("#define E_PROTOCOL_VERSION_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x83760005L)")] public const int E_PROTOCOL_VERSION_NOT_SUPPORTED = unchecked((int)(0x83760005)); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/shared/winerror/S.cs b/src/TerraFX.Interop.Windows/Windows/shared/winerror/S.cs index ed02e8c5..ad5ccf3f 100644 --- a/src/TerraFX.Interop.Windows/Windows/shared/winerror/S.cs +++ b/src/TerraFX.Interop.Windows/Windows/shared/winerror/S.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.Windows [NativeTypeName("#define S_FALSE ((HRESULT)1L)")] public const int S_FALSE = ((int)(1)); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/shared/winerror/STG.cs b/src/TerraFX.Interop.Windows/Windows/shared/winerror/STG.cs index 80db6d81..a5e814e8 100644 --- a/src/TerraFX.Interop.Windows/Windows/shared/winerror/STG.cs +++ b/src/TerraFX.Interop.Windows/Windows/shared/winerror/STG.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from shared/winerror.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/Windows/shared/winerror/Windows.Manual.cs b/src/TerraFX.Interop.Windows/Windows/shared/winerror/Windows.Manual.cs index 55c30aed..304a4a26 100644 --- a/src/TerraFX.Interop.Windows/Windows/shared/winerror/Windows.Manual.cs +++ b/src/TerraFX.Interop.Windows/Windows/shared/winerror/Windows.Manual.cs @@ -17,4 +17,4 @@ namespace TerraFX.Interop.Windows return hr < 0; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/shared/wtypes/STATFLAG.cs b/src/TerraFX.Interop.Windows/Windows/shared/wtypes/STATFLAG.cs index 9a1a5369..2bc25802 100644 --- a/src/TerraFX.Interop.Windows/Windows/shared/wtypes/STATFLAG.cs +++ b/src/TerraFX.Interop.Windows/Windows/shared/wtypes/STATFLAG.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from shared/wtypes.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/Windows/shared/wtypesbase/CLSCTX.cs b/src/TerraFX.Interop.Windows/Windows/shared/wtypesbase/CLSCTX.cs index d7bfe4ce..5a4290c1 100644 --- a/src/TerraFX.Interop.Windows/Windows/shared/wtypesbase/CLSCTX.cs +++ b/src/TerraFX.Interop.Windows/Windows/shared/wtypesbase/CLSCTX.cs @@ -35,4 +35,4 @@ namespace TerraFX.Interop.Windows CLSCTX_ACTIVATE_ARM32_SERVER = 0x2000000, CLSCTX_PS_DLL = unchecked((int)(0x80000000)), } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/Unknwnbase/IID.cs b/src/TerraFX.Interop.Windows/Windows/um/Unknwnbase/IID.cs index e5f657bf..f4d7959c 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/Unknwnbase/IID.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/Unknwnbase/IID.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/Unknwnbase.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/Windows/um/Unknwnbase/IUnknown.cs b/src/TerraFX.Interop.Windows/Windows/um/Unknwnbase/IUnknown.cs index 10af550b..5d110e63 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/Unknwnbase/IUnknown.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/Unknwnbase/IUnknown.cs @@ -39,4 +39,4 @@ namespace TerraFX.Interop.Windows return ((delegate* unmanaged[Stdcall])(lpVtbl[2]))((IUnknown*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/WinBase/Windows.cs b/src/TerraFX.Interop.Windows/Windows/um/WinBase/Windows.cs index eb881c81..f2c0bc0d 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/WinBase/Windows.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/WinBase/Windows.cs @@ -18,4 +18,4 @@ namespace TerraFX.Interop.Windows [NativeTypeName("#define INFINITE 0xFFFFFFFF")] public const uint INFINITE = 0xFFFFFFFF; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/combaseapi/Windows.cs b/src/TerraFX.Interop.Windows/Windows/um/combaseapi/Windows.cs index 7c3536ba..828064f8 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/combaseapi/Windows.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/combaseapi/Windows.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.Windows [DllImport("ole32", ExactSpelling = true)] public static extern HRESULT CoCreateInstance([NativeTypeName("const IID &")] Guid* rclsid, [NativeTypeName("LPUNKNOWN")] IUnknown* pUnkOuter, [NativeTypeName("DWORD")] uint dwClsContext, [NativeTypeName("const IID &")] Guid* riid, [NativeTypeName("LPVOID *")] void** ppv); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/coml2api/STGM.cs b/src/TerraFX.Interop.Windows/Windows/um/coml2api/STGM.cs index 8e541953..7cbd5295 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/coml2api/STGM.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/coml2api/STGM.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/coml2api.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/Windows/um/handleapi/Windows.cs b/src/TerraFX.Interop.Windows/Windows/um/handleapi/Windows.cs index 3670f39e..3bfff7c8 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/handleapi/Windows.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/handleapi/Windows.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.Windows [DllImport("kernel32", ExactSpelling = true)] public static extern BOOL CloseHandle(HANDLE hObject); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/minwinbase/SECURITY_ATTRIBUTES.cs b/src/TerraFX.Interop.Windows/Windows/um/minwinbase/SECURITY_ATTRIBUTES.cs index 91554d31..3b1c2ef9 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/minwinbase/SECURITY_ATTRIBUTES.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/minwinbase/SECURITY_ATTRIBUTES.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.Windows public BOOL bInheritHandle; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IID.cs b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IID.cs index 4475b9f7..50d17b3f 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IID.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IID.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/objidlbase.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IStream.cs b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IStream.cs index 637adbfc..947e745e 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IStream.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IStream.cs @@ -116,4 +116,4 @@ namespace TerraFX.Interop.Windows return ((delegate* unmanaged[Stdcall])(lpVtbl[13]))((IStream*)Unsafe.AsPointer(ref this), ppstm); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STATSTG.cs b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STATSTG.cs index 1f843abb..40d1c92d 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STATSTG.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STATSTG.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/objidlbase.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STGTY.cs b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STGTY.cs index 7fd183ca..cd7dc868 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STGTY.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STGTY.cs @@ -1,4 +1,4 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/objidlbase.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. diff --git a/src/TerraFX.Interop.Windows/Windows/um/synchapi/Windows.cs b/src/TerraFX.Interop.Windows/Windows/um/synchapi/Windows.cs index df33571b..304391ae 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/synchapi/Windows.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/synchapi/Windows.cs @@ -16,4 +16,4 @@ namespace TerraFX.Interop.Windows [return: NativeTypeName("DWORD")] public static extern uint WaitForSingleObjectEx(HANDLE hHandle, [NativeTypeName("DWORD")] uint dwMilliseconds, BOOL bAlertable); } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/CLSID.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/CLSID.cs index b41a9c11..76ddae4e 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/CLSID.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/CLSID.cs @@ -762,4 +762,4 @@ namespace TerraFX.Interop.Windows } } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/GUID.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/GUID.cs index e010f513..b97850e1 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/GUID.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/GUID.cs @@ -312,4 +312,4 @@ namespace TerraFX.Interop.Windows } } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmap.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmap.cs index 9a11a6b5..5a7d8e9d 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmap.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmap.cs @@ -88,4 +88,4 @@ namespace TerraFX.Interop.Windows return ((delegate* unmanaged[Stdcall])(lpVtbl[10]))((IWICBitmap*)Unsafe.AsPointer(ref this), dpiX, dpiY); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapDecoder.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapDecoder.cs index ed01c970..e9a466b9 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapDecoder.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapDecoder.cs @@ -95,4 +95,4 @@ namespace TerraFX.Interop.Windows return ((delegate* unmanaged[Stdcall])(lpVtbl[13]))((IWICBitmapDecoder*)Unsafe.AsPointer(ref this), index, ppIBitmapFrame); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapEncoder.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapEncoder.cs index 018f4b80..5c98e41b 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapEncoder.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapEncoder.cs @@ -88,4 +88,4 @@ namespace TerraFX.Interop.Windows return ((delegate* unmanaged[Stdcall])(lpVtbl[11]))((IWICBitmapEncoder*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapFrameDecode.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapFrameDecode.cs index cfa35e32..7f124edc 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapFrameDecode.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapFrameDecode.cs @@ -81,4 +81,4 @@ namespace TerraFX.Interop.Windows return ((delegate* unmanaged[Stdcall])(lpVtbl[10]))((IWICBitmapFrameDecode*)Unsafe.AsPointer(ref this), ppIThumbnail); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapFrameEncode.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapFrameEncode.cs index 7af93722..369651f2 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapFrameEncode.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapFrameEncode.cs @@ -102,4 +102,4 @@ namespace TerraFX.Interop.Windows return ((delegate* unmanaged[Stdcall])(lpVtbl[12]))((IWICBitmapFrameEncode*)Unsafe.AsPointer(ref this)); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapSource.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapSource.cs index 439b5c54..200549f4 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapSource.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICBitmapSource.cs @@ -74,4 +74,4 @@ namespace TerraFX.Interop.Windows return ((delegate* unmanaged[Stdcall])(lpVtbl[7]))((IWICBitmapSource*)Unsafe.AsPointer(ref this), prc, cbStride, cbBufferSize, pbBuffer); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICFormatConverter.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICFormatConverter.cs index e8eb2513..2b0947f8 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICFormatConverter.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICFormatConverter.cs @@ -88,4 +88,4 @@ namespace TerraFX.Interop.Windows return ((delegate* unmanaged[Stdcall])(lpVtbl[9]))((IWICFormatConverter*)Unsafe.AsPointer(ref this), srcPixelFormat, dstPixelFormat, pfCanConvert); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICImagingFactory2.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICImagingFactory2.cs index d0a1be4a..9525950d 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICImagingFactory2.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICImagingFactory2.cs @@ -125,4 +125,4 @@ namespace TerraFX.Interop.Windows return ((delegate* unmanaged[Stdcall])(lpVtbl[20]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), uiWidth, uiHeight, pixelFormat, cbStride, cbBufferSize, pbBuffer, ppIBitmap); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICPalette.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICPalette.cs index a6f6ae88..ffca1860 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICPalette.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICPalette.cs @@ -109,4 +109,4 @@ namespace TerraFX.Interop.Windows return ((delegate* unmanaged[Stdcall])(lpVtbl[12]))((IWICPalette*)Unsafe.AsPointer(ref this), pfHasAlpha); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICStream.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICStream.cs index f5af19fa..34511f33 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICStream.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/IWICStream.cs @@ -137,4 +137,4 @@ namespace TerraFX.Interop.Windows return ((delegate* unmanaged[Stdcall])(lpVtbl[17]))((IWICStream*)Unsafe.AsPointer(ref this), pIStream, ulOffset, ulMaxSize); } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapAlphaChannelOption.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapAlphaChannelOption.cs index 80243f3a..d14bed70 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapAlphaChannelOption.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapAlphaChannelOption.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.Windows WICBitmapIgnoreAlpha = 0x2, WICBITMAPALPHACHANNELOPTIONS_FORCE_DWORD = 0x7fffffff, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapCreateCacheOption.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapCreateCacheOption.cs index 1a9148a0..c979fea1 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapCreateCacheOption.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapCreateCacheOption.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.Windows WICBitmapCacheOnLoad = 0x2, WICBITMAPCREATECACHEOPTION_FORCE_DWORD = 0x7fffffff, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapDitherType.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapDitherType.cs index 5f0a140e..12fb192d 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapDitherType.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapDitherType.cs @@ -19,4 +19,4 @@ namespace TerraFX.Interop.Windows WICBitmapDitherTypeErrorDiffusion = 0x8, WICBITMAPDITHERTYPE_FORCE_DWORD = 0x7fffffff, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapEncoderCacheOption.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapEncoderCacheOption.cs index 29be991b..1dd96305 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapEncoderCacheOption.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapEncoderCacheOption.cs @@ -12,4 +12,4 @@ namespace TerraFX.Interop.Windows WICBitmapEncoderNoCache = 0x2, WICBITMAPENCODERCACHEOPTION_FORCE_DWORD = 0x7fffffff, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapPaletteType.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapPaletteType.cs index 96a27dbd..f6c1faac 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapPaletteType.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICBitmapPaletteType.cs @@ -23,4 +23,4 @@ namespace TerraFX.Interop.Windows WICBitmapPaletteTypeFixedGray256 = 0xc, WICBITMAPPALETTETYPE_FORCE_DWORD = 0x7fffffff, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICDecodeOptions.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICDecodeOptions.cs index 4ef516c3..cb047273 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICDecodeOptions.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICDecodeOptions.cs @@ -11,4 +11,4 @@ namespace TerraFX.Interop.Windows WICDecodeMetadataCacheOnLoad = 0x1, WICMETADATACACHEOPTION_FORCE_DWORD = 0x7fffffff, } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICRect.cs b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICRect.cs index fd1a94e1..1a5921f4 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICRect.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/wincodec/WICRect.cs @@ -15,4 +15,4 @@ namespace TerraFX.Interop.Windows public int Height; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/winnt/LARGE_INTEGER.cs b/src/TerraFX.Interop.Windows/Windows/um/winnt/LARGE_INTEGER.cs index 190fad7f..b7bc8246 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/winnt/LARGE_INTEGER.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/winnt/LARGE_INTEGER.cs @@ -40,4 +40,4 @@ namespace TerraFX.Interop.Windows public int HighPart; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/winnt/LUID.cs b/src/TerraFX.Interop.Windows/Windows/um/winnt/LUID.cs index 10088097..361feb25 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/winnt/LUID.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/winnt/LUID.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.Windows [NativeTypeName("LONG")] public int HighPart; } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/winnt/ULARGE_INTEGER.cs b/src/TerraFX.Interop.Windows/Windows/um/winnt/ULARGE_INTEGER.cs index 9aa28922..c2210819 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/winnt/ULARGE_INTEGER.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/winnt/ULARGE_INTEGER.cs @@ -40,4 +40,4 @@ namespace TerraFX.Interop.Windows public uint HighPart; } } -} +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/Windows/um/winnt/Windows.cs b/src/TerraFX.Interop.Windows/Windows/um/winnt/Windows.cs index c3b5a2cc..c89422be 100644 --- a/src/TerraFX.Interop.Windows/Windows/um/winnt/Windows.cs +++ b/src/TerraFX.Interop.Windows/Windows/um/winnt/Windows.cs @@ -13,4 +13,4 @@ namespace TerraFX.Interop.Windows [NativeTypeName("#define GENERIC_WRITE (0x40000000L)")] public const int GENERIC_WRITE = (0x40000000); } -} +} \ No newline at end of file diff --git a/tests/.editorconfig b/tests/.editorconfig new file mode 100644 index 00000000..107ebce8 --- /dev/null +++ b/tests/.editorconfig @@ -0,0 +1,8 @@ +# C# files +[*.cs] + +# Disable fields naming rule violation warnings just for unit tests +dotnet_naming_rule.private_fields_must_be_pascal_case.severity = none +dotnet_naming_rule.constant_fields_must_be_pascal_case.severity = none +dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.severity = none +dotnet_naming_rule.non_private_fields_must_be_pascal_case.severity = none \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/D2D1PixelShaderTests.cs b/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/D2D1PixelShaderTests.cs index 481ff5d3..4a26be0f 100644 --- a/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/D2D1PixelShaderTests.cs +++ b/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/D2D1PixelShaderTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Interop; @@ -19,7 +19,7 @@ public partial class D2D1PixelShaderTests Assert.IsTrue(MemoryMarshal.TryGetMemoryManager(bytecode, out MemoryManager? manager)); Assert.AreEqual("PinnedBufferMemoryManager", manager!.GetType().Name); - D2D1PixelShader.LoadBytecode( + _ = D2D1PixelShader.LoadBytecode( shaderProfile: D2D1ShaderProfile.PixelShader41, options: D2D1CompileOptions.IeeeStrictness | D2D1CompileOptions.OptimizationLevel2 | D2D1CompileOptions.PartialPrecision); @@ -53,7 +53,7 @@ public partial class D2D1PixelShaderTests Assert.IsTrue(MemoryMarshal.TryGetMemoryManager(bytecode, out MemoryManager? manager)); Assert.AreEqual("PinnedBufferMemoryManager", manager!.GetType().Name); - D2D1PixelShader.LoadBytecode( + _ = D2D1PixelShader.LoadBytecode( shaderProfile: D2D1ShaderProfile.PixelShader50, options: D2D1CompileOptions.IeeeStrictness | D2D1CompileOptions.OptimizationLevel2 | D2D1CompileOptions.PartialPrecision); @@ -87,7 +87,7 @@ public partial class D2D1PixelShaderTests Assert.IsTrue(MemoryMarshal.TryGetMemoryManager(bytecode, out MemoryManager? manager)); Assert.AreEqual("PinnedBufferMemoryManager", manager!.GetType().Name); - D2D1PixelShader.LoadBytecode( + _ = D2D1PixelShader.LoadBytecode( shaderProfile: D2D1ShaderProfile.PixelShader41, options: D2D1CompileOptions.Debug | D2D1CompileOptions.AvoidFlowControl | D2D1CompileOptions.PartialPrecision); @@ -121,7 +121,7 @@ public partial class D2D1PixelShaderTests Assert.IsTrue(MemoryMarshal.TryGetMemoryManager(bytecode, out MemoryManager? manager)); Assert.AreEqual("PinnedBufferMemoryManager", manager!.GetType().Name); - D2D1PixelShader.LoadBytecode( + _ = D2D1PixelShader.LoadBytecode( shaderProfile: D2D1ShaderProfile.PixelShader50, options: D2D1CompileOptions.Debug | D2D1CompileOptions.AvoidFlowControl | D2D1CompileOptions.PartialPrecision); diff --git a/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/Properties/AssemblyInfo.cs b/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/Properties/AssemblyInfo.cs index 24c73837..896d16dc 100644 --- a/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/Properties/AssemblyInfo.cs +++ b/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using ComputeSharp.D2D1; +using ComputeSharp.D2D1; [assembly: D2DShaderProfile(D2D1ShaderProfile.PixelShader41)] [assembly: D2DCompileOptions(D2D1CompileOptions.IeeeStrictness | D2D1CompileOptions.OptimizationLevel2 | D2D1CompileOptions.PartialPrecision)] \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1EffectRegistrationDataTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1EffectRegistrationDataTests.cs index bb896c9b..31c16d92 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1EffectRegistrationDataTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1EffectRegistrationDataTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.D2D1.Interop; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -111,13 +111,13 @@ public partial class D2D1EffectRegistrationDataTests [D2DInputCount(2)] [D2DRequiresScenePosition] [AutoConstructor] - private partial struct TestRegistrationBlobShader : ID2D1PixelShader + private readonly partial struct TestRegistrationBlobShader : ID2D1PixelShader { - private float a; + private readonly float a; public float4 Execute() { - return a; + return this.a; } } } \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderEffectTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderEffectTests.cs index d2dc4479..49e06915 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderEffectTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderEffectTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Drawing; using ComputeSharp.D2D1.Interop; @@ -8,6 +8,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Win32; using Win32.Graphics.Direct2D; +#pragma warning disable IDE0022, IDE0044 + namespace ComputeSharp.D2D1.Tests; [TestClass] @@ -143,7 +145,7 @@ public partial class D2D1PixelShaderEffectTests public float4 Execute() { - return dummy; + return this.dummy; } } @@ -178,7 +180,7 @@ public partial class D2D1PixelShaderEffectTests public float4 Execute() { - return a + b + c.X + d + e; + return this.a + this.b + this.c.X + this.d + this.e; } } } \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs index ba821605..336f47b4 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs @@ -1,10 +1,12 @@ -using System; +using System; using System.Buffers; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Interop; using ComputeSharp.D2D1.Tests.Effects; using Microsoft.VisualStudio.TestTools.UnitTesting; +#pragma warning disable IDE0059, IDE0044 + namespace ComputeSharp.D2D1.Tests; [TestClass] @@ -232,14 +234,14 @@ public partial class D2D1PixelShaderTests public Float4 Execute() { - float4 pixel1 = myTexture1[0]; - float4 pixel2 = myTexture1.Sample(0.4f); - float4 pixel3 = myTexture2[0, 1]; - float4 pixel4 = myTexture2.Sample(0.4f, 0.3f); - float4 pixel5 = myTexture3[0, 1, 2]; - float4 pixel6 = myTexture3.Sample(0.4f, 0.5f, 0.6f); - float number1 = myTexture4[0, 2]; - float number2 = myTexture4.Sample(0.4f, 0.6f); + float4 pixel1 = this.myTexture1[0]; + float4 pixel2 = this.myTexture1.Sample(0.4f); + float4 pixel3 = this.myTexture2[0, 1]; + float4 pixel4 = this.myTexture2.Sample(0.4f, 0.3f); + float4 pixel5 = this.myTexture3[0, 1, 2]; + float4 pixel6 = this.myTexture3.Sample(0.4f, 0.5f, 0.6f); + float number1 = this.myTexture4[0, 2]; + float number2 = this.myTexture4.Sample(0.4f, 0.6f); return 0; } diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs index ee6a3673..9f304859 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.IO; using System.Reflection; @@ -13,12 +13,12 @@ using SixLabors.ImageSharp.PixelFormats; using Win32; using Win32.Graphics.Direct2D; -#pragma warning disable CS0649 +#pragma warning disable CS0649, IDE0044, IDE0065 namespace ComputeSharp.D2D1.Tests; -using HRESULT = Win32.HResult; -using D2D1_MAPPED_RECT = Win32.Graphics.Direct2D.MappedRect; +using HRESULT = HResult; +using D2D1_MAPPED_RECT = MappedRect; [TestClass] [TestCategory("D2D1ResourceTextureManager")] @@ -547,8 +547,8 @@ public partial class D2D1ResourceTextureManagerTests int2 xy = (int2)D2D.GetScenePosition().XY; int x = xy.X; - int y = (int)((uint)xy.Y % (uint)height); - int z = (int)((uint)xy.Y / (uint)height); + int y = (int)((uint)xy.Y % (uint)this.height); + int z = (int)((uint)xy.Y / (uint)this.height); return this.source[x, y, z]; } @@ -689,7 +689,7 @@ public partial class D2D1ResourceTextureManagerTests for (int y = 0; y < updateLengthY; y++) { ReadOnlySpan source = data.AsSpan(y * updateLengthX, updateLengthX); - Span destination = texture.AsSpan(startOffsetY * width + y * width + startOffsetX, updateLengthX); + Span destination = texture.AsSpan((startOffsetY * width) + (y * width) + startOffsetX, updateLengthX); source.CopyTo(destination); } @@ -707,7 +707,7 @@ public partial class D2D1ResourceTextureManagerTests for (int y = 0; y < height; y++) { - foreach (Bgra32 pixel in new ReadOnlySpan(d2D1MappedRect.bits + d2D1MappedRect.pitch * y, width)) + foreach (Bgra32 pixel in new ReadOnlySpan(d2D1MappedRect.bits + (d2D1MappedRect.pitch * y), width)) { resultingBytes[i++] = pixel.B; } @@ -793,8 +793,8 @@ public partial class D2D1ResourceTextureManagerTests { for (int y = 0; y < updateLengthY; y++) { - ReadOnlySpan source = data.AsSpan(z * updateLengthX * updateLengthY + y * updateLengthX, updateLengthX); - Span destination = texture.AsSpan((startOffsetZ + z) * (width * height) + (startOffsetY + y) * width + startOffsetX, updateLengthX); + ReadOnlySpan source = data.AsSpan((z * updateLengthX * updateLengthY) + (y * updateLengthX), updateLengthX); + Span destination = texture.AsSpan(((startOffsetZ + z) * width * height) + ((startOffsetY + y) * width) + startOffsetX, updateLengthX); source.CopyTo(destination); } @@ -813,7 +813,7 @@ public partial class D2D1ResourceTextureManagerTests for (int y = 0; y < height * depth; y++) { - foreach (Bgra32 pixel in new ReadOnlySpan(d2D1MappedRect.bits + d2D1MappedRect.pitch * y, width)) + foreach (Bgra32 pixel in new ReadOnlySpan(d2D1MappedRect.bits + (d2D1MappedRect.pitch * y), width)) { resultingBytes[i++] = pixel.B; } @@ -876,7 +876,7 @@ public partial class D2D1ResourceTextureManagerTests public float4 Execute() { - return source[0, 0]; + return this.source[0, 0]; } } } \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests.cs index 7a633d51..7b5b24dd 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.Tests; +namespace ComputeSharp.D2D1.Tests; /// /// A test class for the diagnostic suppressor for D2D1 resource texture fields being left uninitialized. @@ -14,6 +14,9 @@ internal sealed partial class D2D1ResourceTextureUninitializedFieldDiagnosticSup [D2DResourceTextureIndex(0)] private readonly D2D1ResourceTexture1D texture; - public float4 Execute() => texture[0]; + public float4 Execute() + { + return this.texture[0]; + } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1ShaderCompilerTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1ShaderCompilerTests.cs index f2f0e6c5..271a5e8f 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1ShaderCompilerTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1ShaderCompilerTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.D2D1.Exceptions; using ComputeSharp.D2D1.Interop; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/tests/ComputeSharp.D2D1.Tests/D2DPixelShaderSourceTests.cs b/tests/ComputeSharp.D2D1.Tests/D2DPixelShaderSourceTests.cs index 8b910614..89dbf5cb 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2DPixelShaderSourceTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2DPixelShaderSourceTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.D2D1.Tests; diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs index 69ef4797..ab224b80 100644 --- a/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs +++ b/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; @@ -13,17 +13,19 @@ using SixLabors.ImageSharp; using Win32; using Win32.Graphics.Direct2D; +#pragma warning disable IDE0065 + namespace ComputeSharp.BokehBlur.Processors; -using D2D1_BORDER_EDGE_MODE = Win32.Graphics.Direct2D.BorderEdgeMode; -using D2D1_BORDER_PROP = Win32.Graphics.Direct2D.BorderProp; -using D2D1_BUFFER_PRECISION = Win32.Graphics.Direct2D.BufferPrecision; +using D2D1_BORDER_EDGE_MODE = BorderEdgeMode; +using D2D1_BORDER_PROP = BorderProp; +using D2D1_BUFFER_PRECISION = BufferPrecision; using D2D1_COMPOSITE_MODE = Win32.Graphics.Direct2D.Common.CompositeMode; -using D2D1_COMPOSITE_PROP = Win32.Graphics.Direct2D.CompositeProp; -using D2D1_INTERPOLATION_MODE = Win32.Graphics.Direct2D.InterpolationMode; -using D2D1_PROPERTY = Win32.Graphics.Direct2D.Property; -using D2D1_MAPPED_RECT = Win32.Graphics.Direct2D.MappedRect; -using D2D1_RENDERING_CONTROLS = Win32.Graphics.Direct2D.RenderingControls; +using D2D1_COMPOSITE_PROP = CompositeProp; +using D2D1_INTERPOLATION_MODE = InterpolationMode; +using D2D1_PROPERTY = Property; +using D2D1_MAPPED_RECT = MappedRect; +using D2D1_RENDERING_CONTROLS = RenderingControls; using D2D1 = Win32.Graphics.Direct2D.Apis; /// @@ -31,40 +33,40 @@ using D2D1 = Win32.Graphics.Direct2D.Apis; /// public sealed partial class BokehBlurEffect { + /// + /// The mapping of initialized complex kernels and parameters, to speed up the initialization of new instances. + /// + private static readonly ConcurrentDictionary<(int Radius, int ComponentsCount), (Vector4[] Parameters, float Scale, (float[] Real, float[] Imaginary)[] Kernels)> Cache = new(); + /// /// The kernel radius. /// - private readonly int Radius; + private readonly int radius; /// /// The maximum size of the kernel in either direction. /// - private readonly int KernelSize; + private readonly int kernelSize; /// /// The number of components to use when applying the bokeh blur. /// - private readonly int ComponentsCount; + private readonly int componentsCount; /// /// The kernel parameters to use for the current instance (a: X, b: Y, A: Z, B: W) /// - private readonly Vector4[] KernelParameters; + private readonly Vector4[] kernelParameters; /// /// The kernel components for the current instance. /// - private readonly (float[] Real, float[] Imaginary)[] Kernels; + private readonly (float[] Real, float[] Imaginary)[] kernels; /// /// The scaling factor for kernel values. /// - private readonly float KernelsScale; - - /// - /// The mapping of initialized complex kernels and parameters, to speed up the initialization of new instances. - /// - private static readonly ConcurrentDictionary<(int Radius, int ComponentsCount), (Vector4[] Parameters, float Scale, (float[] Real, float[] Imaginary)[] Kernels)> Cache = new(); + private readonly float kernelsScale; /// /// Initializes a new instance of the class. @@ -73,30 +75,32 @@ public sealed partial class BokehBlurEffect /// The number of components to use to approximate the original 2D bokeh blur convolution kernel. public BokehBlurEffect(int radius, int componentsCount) { - Radius = radius; - KernelSize = Radius * 2 + 1; - ComponentsCount = componentsCount; + this.radius = radius; + this.kernelSize = (this.radius * 2) + 1; + this.componentsCount = componentsCount; // Reuse the initialized values from the cache, if possible - var parameters = (Radius, ComponentsCount); - if (Cache.TryGetValue(parameters, out var info)) + (int radius, int componentsCount) parameters = (this.radius, this.componentsCount); + + if (Cache.TryGetValue(parameters, out (Vector4[] Parameters, float Scale, (float[] Real, float[] Imaginary)[] Kernels) info)) { - KernelParameters = info.Parameters; - KernelsScale = info.Scale; - Kernels = info.Kernels; + this.kernelParameters = info.Parameters; + this.kernelsScale = info.Scale; + this.kernels = info.Kernels; } else { // Initialize the complex kernels and parameters with the current arguments - (KernelParameters, KernelsScale) = GetParameters(); - var kernels = CreateComplexKernels(); + (this.kernelParameters, this.kernelsScale) = GetParameters(); - NormalizeKernels(kernels, KernelParameters); + Complex64[][] kernels = CreateComplexKernels(); - Kernels = ConvertKernelsToStructureOfArrays(kernels); + NormalizeKernels(kernels, this.kernelParameters); + + this.kernels = ConvertKernelsToStructureOfArrays(kernels); // Store them in the cache for future use - Cache.TryAdd(parameters, (KernelParameters, KernelsScale, Kernels)); + _ = Cache.TryAdd(parameters, (this.kernelParameters, this.kernelsScale, this.kernels)); } } @@ -165,7 +169,7 @@ public sealed partial class BokehBlurEffect private (Vector4[] Parameters, float Scale) GetParameters() { // Prepare the kernel components - int index = Math.Max(0, Math.Min(ComponentsCount - 1, KernelComponents.Count)); + int index = Math.Max(0, Math.Min(this.componentsCount - 1, KernelComponents.Count)); return (KernelComponents[index], KernelScales[index]); } @@ -175,10 +179,10 @@ public sealed partial class BokehBlurEffect /// private Complex64[][] CreateComplexKernels() { - var kernels = new Complex64[KernelParameters.Length][]; - ref Vector4 baseRef = ref MemoryMarshal.GetReference(KernelParameters.AsSpan()); + Complex64[][] kernels = new Complex64[this.kernelParameters.Length][]; + ref Vector4 baseRef = ref MemoryMarshal.GetReference(this.kernelParameters.AsSpan()); - for (int i = 0; i < KernelParameters.Length; i++) + for (int i = 0; i < this.kernelParameters.Length; i++) { ref Vector4 paramsRef = ref Unsafe.Add(ref baseRef, i); @@ -195,15 +199,15 @@ public sealed partial class BokehBlurEffect /// The angle component for each complex component. private Complex64[] CreateComplex1DKernel(float a, float b) { - var kernel = new Complex64[KernelSize]; + Complex64[] kernel = new Complex64[this.kernelSize]; ref Complex64 baseRef = ref MemoryMarshal.GetReference(kernel.AsSpan()); - int r = Radius; + int r = this.radius; int n = -r; - for (int i = 0; i < KernelSize; i++, n++) + for (int i = 0; i < this.kernelSize; i++, n++) { // Incrementally compute the range values - float value = n * KernelsScale * (1f / r); + float value = n * this.kernelsScale * (1f / r); value *= value; @@ -244,8 +248,8 @@ public sealed partial class BokehBlurEffect ref Complex64 kRef = ref Unsafe.Add(ref valueRef, k); total += - paramsRef.Z * (jRef.Real * kRef.Real - jRef.Imaginary * kRef.Imaginary) - + paramsRef.W * (jRef.Real * kRef.Imaginary + jRef.Imaginary * kRef.Real); + (paramsRef.Z * ((jRef.Real * kRef.Real) - (jRef.Imaginary * kRef.Imaginary))) + + (paramsRef.W * ((jRef.Real * kRef.Imaginary) + (jRef.Imaginary * kRef.Real))); } } } @@ -272,13 +276,13 @@ public sealed partial class BokehBlurEffect /// The input kernels to convert. private static (float[] Real, float[] Imaginary)[] ConvertKernelsToStructureOfArrays(Complex64[][] kernels) { - var structureOfArrayKernels = new (float[] Real, float[] Imaginary)[kernels.Length]; + (float[] Real, float[] Imaginary)[] structureOfArrayKernels = new (float[] Real, float[] Imaginary)[kernels.Length]; for (int i = 0; i < kernels.Length; i++) { Complex64[] kernel = kernels[i]; - var real = new float[kernel.Length]; - var imaginary = new float[kernel.Length]; + float[] real = new float[kernel.Length]; + float[] imaginary = new float[kernel.Length]; for (int j = 0; j < kernel.Length; j++) { @@ -319,7 +323,7 @@ public sealed partial class BokehBlurEffect D2D1PixelShaderEffect.RegisterForD2D1Factory1(d2D1Factory2.Get(), out _); D2D1PixelShaderEffect.RegisterForD2D1Factory1(d2D1Factory2.Get(), out _); - int numberOfComponents = KernelParameters.Length; + int numberOfComponents = this.kernelParameters.Length; using ComPtr gammaExposureEffect = default; using ComPtr inverseGammaExposureEffect = default; @@ -379,7 +383,7 @@ public sealed partial class BokehBlurEffect using ComPtr d2D1BitmapTarget = D2D1Helper.CreateD2D1BitmapAndSetAsTarget(d2D1DeviceContext.Get(), width, height); (D2D1ResourceTextureManager Reals, D2D1ResourceTextureManager Imaginaries)[] kernels = new (D2D1ResourceTextureManager, D2D1ResourceTextureManager)[numberOfComponents]; - uint kernelSize = (uint)KernelSize; + uint kernelSize = (uint)this.kernelSize; for (int i = 0; i < numberOfComponents; i++) { @@ -390,7 +394,7 @@ public sealed partial class BokehBlurEffect channelDepth: D2D1ChannelDepth.One, filter: D2D1Filter.MinMagMipPoint, extendModes: stackalloc[] { D2D1ExtendMode.Clamp }, - data: MemoryMarshal.AsBytes(Kernels[i].Real.AsSpan()), + data: MemoryMarshal.AsBytes(this.kernels[i].Real.AsSpan()), strides: ReadOnlySpan.Empty); // Also create the one for the imaginary kernel @@ -400,7 +404,7 @@ public sealed partial class BokehBlurEffect channelDepth: D2D1ChannelDepth.One, filter: D2D1Filter.MinMagMipPoint, extendModes: stackalloc[] { D2D1ExtendMode.Clamp }, - data: MemoryMarshal.AsBytes(Kernels[i].Imaginary.AsSpan()), + data: MemoryMarshal.AsBytes(this.kernels[i].Imaginary.AsSpan()), strides: ReadOnlySpan.Empty); kernels[i] = (kernelReals, kernelImaginary); @@ -420,7 +424,7 @@ public sealed partial class BokehBlurEffect { D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(new VerticalConvolution.Shader((int)kernelSize), verticalConvolutionEffectsForReals[i].Get()); D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(new VerticalConvolution.Shader((int)kernelSize), verticalConvolutionEffectsForImaginaries[i].Get()); - D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(new HorizontalConvolutionAndAccumulatePartials.Shader((int)kernelSize, KernelParameters[i].Z, KernelParameters[i].W), horizontalConvolutionEffects[i].Get()); + D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(new HorizontalConvolutionAndAccumulatePartials.Shader((int)kernelSize, this.kernelParameters[i].Z, this.kernelParameters[i].W), horizontalConvolutionEffects[i].Get()); } // Build the effect graph: @@ -445,7 +449,7 @@ public sealed partial class BokehBlurEffect } else { - compositeEffect.Get()->SetInputCount((uint)numberOfComponents); + _ = compositeEffect.Get()->SetInputCount((uint)numberOfComponents); // Aggregate all partial results with the composite effect for (int i = 0; i < numberOfComponents; i++) @@ -577,14 +581,14 @@ public sealed partial class BokehBlurEffect { float4 sourceReal = D2D.SampleInputAtOffset(0, new float2(i - radiusX, 0)); float4 sourceImaginary = D2D.SampleInputAtOffset(1, new float2(i - radiusX, 0)); - float realFactor = kernelReals[i]; - float imaginaryFactor = kernelImaginaries[i]; + float realFactor = this.kernelReals[i]; + float imaginaryFactor = this.kernelImaginaries[i]; - result.Real += (Vector4)(realFactor * sourceReal - imaginaryFactor * sourceImaginary); - result.Imaginary += (Vector4)(realFactor * sourceImaginary + imaginaryFactor * sourceReal); + result.Real += (Vector4)((realFactor * sourceReal) - (imaginaryFactor * sourceImaginary)); + result.Imaginary += (Vector4)((realFactor * sourceImaginary) + (imaginaryFactor * sourceReal)); } - return result.WeightedSum(z, w); + return result.WeightedSum(this.z, this.w); } } } @@ -633,4 +637,4 @@ public sealed partial class BokehBlurEffect return pixel; } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/CheckerboardClipEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/CheckerboardClipEffect.cs index b7a02601..22ca046c 100644 --- a/tests/ComputeSharp.D2D1.Tests/Effects/CheckerboardClipEffect.cs +++ b/tests/ComputeSharp.D2D1.Tests/Effects/CheckerboardClipEffect.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.Tests.Effects; +namespace ComputeSharp.D2D1.Tests.Effects; [D2DInputCount(1)] [D2DInputSimple(0)] @@ -18,8 +18,8 @@ public partial struct CheckerboardClipEffect : ID2D1PixelShader uint x = (uint)Hlsl.Floor(position.X); uint y = (uint)Hlsl.Floor(position.Y); - uint cellX = (uint)(int)Hlsl.Floor(x / cellSize); - uint cellY = (uint)(int)Hlsl.Floor(y / cellSize); + uint cellX = (uint)(int)Hlsl.Floor(x / this.cellSize); + uint cellY = (uint)(int)Hlsl.Floor(y / this.cellSize); if ((cellX % 2 == 0 && cellY % 2 == 0) || (cellX % 2 == 1 && cellY % 2 == 1)) @@ -29,4 +29,4 @@ public partial struct CheckerboardClipEffect : ID2D1PixelShader return D2D.GetInput(0); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/InvertEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/InvertEffect.cs index dbf1dccf..b48972cc 100644 --- a/tests/ComputeSharp.D2D1.Tests/Effects/InvertEffect.cs +++ b/tests/ComputeSharp.D2D1.Tests/Effects/InvertEffect.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.Tests.Effects; +namespace ComputeSharp.D2D1.Tests.Effects; [D2DInputCount(1)] [D2DInputSimple(0)] @@ -13,4 +13,4 @@ public partial struct InvertEffect : ID2D1PixelShader return new(rgb, 1); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/InvertWithThresholdEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/InvertWithThresholdEffect.cs index 6d0d9698..542ed490 100644 --- a/tests/ComputeSharp.D2D1.Tests/Effects/InvertWithThresholdEffect.cs +++ b/tests/ComputeSharp.D2D1.Tests/Effects/InvertWithThresholdEffect.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.Tests.Effects; +namespace ComputeSharp.D2D1.Tests.Effects; [D2DInputCount(1)] [D2DInputSimple(0)] @@ -16,4 +16,4 @@ public partial struct InvertWithThresholdEffect : ID2D1PixelShader return new(rgb, 1); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/PixelateEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/PixelateEffect.cs index bf330069..161077a3 100644 --- a/tests/ComputeSharp.D2D1.Tests/Effects/PixelateEffect.cs +++ b/tests/ComputeSharp.D2D1.Tests/Effects/PixelateEffect.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.D2D1.Tests.Effects; +namespace ComputeSharp.D2D1.Tests.Effects; [D2DInputCount(1)] [D2DInputComplex(0)] diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/ZonePlateEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/ZonePlateEffect.cs index af460bfd..92c9e71e 100644 --- a/tests/ComputeSharp.D2D1.Tests/Effects/ZonePlateEffect.cs +++ b/tests/ComputeSharp.D2D1.Tests/Effects/ZonePlateEffect.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.D2D1.Tests.Effects; @@ -34,8 +34,8 @@ public readonly partial struct ZonePlateEffect : ID2D1PixelShader float yd = yo * yo; float xd = xo * xo; float d = xd + yd; - float v = 1.0f + (1.0f + Hlsl.Tanh((rm - Hlsl.Sqrt(d)) / w)) * Hlsl.Sin(km * d) * 0.5f; + float v = 1.0f + ((1.0f + Hlsl.Tanh((rm - Hlsl.Sqrt(d)) / w)) * Hlsl.Sin(km * d) * 0.5f); return new Float4(v, v, v, 1.0f); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/EndToEndTests.cs b/tests/ComputeSharp.D2D1.Tests/EndToEndTests.cs index 72dc3dbf..c950d65c 100644 --- a/tests/ComputeSharp.D2D1.Tests/EndToEndTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/EndToEndTests.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Reflection; using ComputeSharp.BokehBlur.Processors; using ComputeSharp.D2D1.Interop; diff --git a/tests/ComputeSharp.D2D1.Tests/Extensions/ComPtrExtensions.cs b/tests/ComputeSharp.D2D1.Tests/Extensions/ComPtrExtensions.cs index 93074a24..a9c23451 100644 --- a/tests/ComputeSharp.D2D1.Tests/Extensions/ComPtrExtensions.cs +++ b/tests/ComputeSharp.D2D1.Tests/Extensions/ComPtrExtensions.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using Win32; namespace ComputeSharp.D2D1.Tests.Extensions; @@ -25,4 +25,4 @@ internal static class ComPtrExtensions return copy; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/Extensions/HRESULTExtensions.cs b/tests/ComputeSharp.D2D1.Tests/Extensions/HRESULTExtensions.cs index e0fc8004..273b8957 100644 --- a/tests/ComputeSharp.D2D1.Tests/Extensions/HRESULTExtensions.cs +++ b/tests/ComputeSharp.D2D1.Tests/Extensions/HRESULTExtensions.cs @@ -1,10 +1,12 @@ -using System.ComponentModel; +using System.ComponentModel; using System.Diagnostics; #if NETCOREAPP3_1_OR_GREATER using System.Diagnostics.CodeAnalysis; #endif using System.Runtime.CompilerServices; +#pragma warning disable IDE0065 + namespace ComputeSharp.D2D1.Tests.Extensions; using HRESULT = Win32.HResult; @@ -55,4 +57,4 @@ internal static class HRESULTExtensions { throw new Win32Exception(result); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/Helpers/D2D1Helper.cs b/tests/ComputeSharp.D2D1.Tests/Helpers/D2D1Helper.cs index 656e7961..e6c764d9 100644 --- a/tests/ComputeSharp.D2D1.Tests/Helpers/D2D1Helper.cs +++ b/tests/ComputeSharp.D2D1.Tests/Helpers/D2D1Helper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Drawing; using ComputeSharp.D2D1.Tests.Extensions; using Win32; @@ -6,23 +6,25 @@ using Win32.Graphics.Direct2D; using Win32.Graphics.Direct3D11; using Win32.Graphics.Dxgi; +#pragma warning disable IDE0065 + namespace ComputeSharp.D2D1.Tests.Helpers; using D2D1_ALPHA_MODE = Win32.Graphics.Direct2D.Common.AlphaMode; -using D2D1_BITMAP_OPTIONS = Win32.Graphics.Direct2D.BitmapOptions; -using D2D1_DEVICE_CONTEXT_OPTIONS = Win32.Graphics.Direct2D.DeviceContextOptions; -using D2D1_FACTORY_OPTIONS = Win32.Graphics.Direct2D.FactoryOptions; -using D2D1_FACTORY_TYPE = Win32.Graphics.Direct2D.FactoryType; -using D2D1_INTERPOLATION_MODE = Win32.Graphics.Direct2D.InterpolationMode; +using D2D1_BITMAP_OPTIONS = BitmapOptions; +using D2D1_DEVICE_CONTEXT_OPTIONS = DeviceContextOptions; +using D2D1_FACTORY_OPTIONS = FactoryOptions; +using D2D1_FACTORY_TYPE = FactoryType; +using D2D1_INTERPOLATION_MODE = InterpolationMode; using D2D1_COMPOSITE_MODE = Win32.Graphics.Direct2D.Common.CompositeMode; -using D2D1_MAP_OPTIONS = Win32.Graphics.Direct2D.MapOptions; +using D2D1_MAP_OPTIONS = MapOptions; using D2D_RECT_U = Win32.Graphics.Direct2D.Common.RectU; using D2D1_MAPPED_RECT = Win32.Graphics.Direct2D.MappedRect; -using D2D1_BITMAP_PROPERTIES = Win32.Graphics.Direct2D.BitmapProperties; -using D2D1_BITMAP_PROPERTIES1 = Win32.Graphics.Direct2D.BitmapProperties1; +using D2D1_BITMAP_PROPERTIES = BitmapProperties; +using D2D1_BITMAP_PROPERTIES1 = BitmapProperties1; using D3D_FEATURE_LEVEL = Win32.Graphics.Direct3D.FeatureLevel; using D3D_DRIVER_TYPE = Win32.Graphics.Direct3D.DriverType; -using D3D11_CREATE_DEVICE_FLAG = Win32.Graphics.Direct3D11.CreateDeviceFlags; +using D3D11_CREATE_DEVICE_FLAG = CreateDeviceFlags; using DXGI_FORMAT = Win32.Graphics.Dxgi.Common.Format; using Win32 = Win32.Apis; using D2D1 = Win32.Graphics.Direct2D.Apis; @@ -96,7 +98,7 @@ internal static class D2D1Helper using ComPtr d2D1Device = default; // Create a D2D1 device - d2D1Factory2->CreateDevice( + _ = d2D1Factory2->CreateDevice( dxgiDevice: (IDXGIDevice*)dxgiDevice3.Get(), d2dDevice: d2D1Device.GetAddressOf()); @@ -227,7 +229,7 @@ internal static class D2D1Helper d2DRectSource.bottom = (uint)d2DSize.Height; // Copy the image from the target to the readback bitmap - d2D1Bitmap1Buffer.Get()->CopyFromBitmap( + _ = d2D1Bitmap1Buffer.Get()->CopyFromBitmap( destPoint: &d2DPointDestination, bitmap: d2D1Bitmap, srcRect: &d2DRectSource); @@ -262,4 +264,4 @@ internal static class D2D1Helper d2D1DeviceContext->EndDraw().Assert(); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/Helpers/D2D1TestRunner.cs b/tests/ComputeSharp.D2D1.Tests/Helpers/D2D1TestRunner.cs index 7b414e7d..6cc264f7 100644 --- a/tests/ComputeSharp.D2D1.Tests/Helpers/D2D1TestRunner.cs +++ b/tests/ComputeSharp.D2D1.Tests/Helpers/D2D1TestRunner.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; @@ -7,9 +7,11 @@ using ComputeSharp.Tests.Helpers; using Win32; using Win32.Graphics.Direct2D; +#pragma warning disable IDE0065 + namespace ComputeSharp.D2D1.Tests.Helpers; -using D2D1_MAPPED_RECT = Win32.Graphics.Direct2D.MappedRect; +using D2D1_MAPPED_RECT = MappedRect; /// /// A test helper for D2D1 pixel shaders. @@ -168,4 +170,4 @@ internal static class D2D1TestRunner // Save the image ImageHelper.SaveBitmapToFile(destinationPath, (uint)width, (uint)height, d2D1MappedRect.pitch, d2D1MappedRect.bits); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/Helpers/ImageHelper.cs b/tests/ComputeSharp.D2D1.Tests/Helpers/ImageHelper.cs index d5489726..7d4f6c08 100644 --- a/tests/ComputeSharp.D2D1.Tests/Helpers/ImageHelper.cs +++ b/tests/ComputeSharp.D2D1.Tests/Helpers/ImageHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.Runtime.InteropServices; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -48,7 +48,7 @@ internal static class ImageHelper for (int i = 0; i < (int)height; i++) { - ReadOnlySpan source = new(buffer + i * (int)strideInBytes, (int)width * sizeof(Bgra32)); + ReadOnlySpan source = new(buffer + (i * (int)strideInBytes), (int)width * sizeof(Bgra32)); source.CopyTo(pixelData.AsSpan(i * (int)width * sizeof(Bgra32))); } @@ -60,4 +60,4 @@ internal static class ImageHelper ArrayPool.Shared.Return(pixelData); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Dynamic.NuGet/Program.cs b/tests/ComputeSharp.Dynamic.NuGet/Program.cs index 55fd170e..32dccd17 100644 --- a/tests/ComputeSharp.Dynamic.NuGet/Program.cs +++ b/tests/ComputeSharp.Dynamic.NuGet/Program.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Linq; #if NET6_0_OR_GREATER using System.Runtime.Versioning; @@ -39,4 +39,4 @@ internal readonly partial struct MultiplyByTwo : IComputeShader { buffer[ThreadIds.X] *= 2; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.NuGet/Program.cs b/tests/ComputeSharp.NuGet/Program.cs index b357113c..bb7fb0d3 100644 --- a/tests/ComputeSharp.NuGet/Program.cs +++ b/tests/ComputeSharp.NuGet/Program.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Linq; #if NET6_0_OR_GREATER using System.Runtime.Versioning; @@ -40,4 +40,4 @@ internal readonly partial struct MultiplyByTwo : IComputeShader { buffer[ThreadIds.X] *= 2; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Pix.NuGet/Program.cs b/tests/ComputeSharp.Pix.NuGet/Program.cs index 9fa7a379..0d6e690b 100644 --- a/tests/ComputeSharp.Pix.NuGet/Program.cs +++ b/tests/ComputeSharp.Pix.NuGet/Program.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Linq; #if NET6_0_OR_GREATER using System.Runtime.Versioning; @@ -15,7 +15,7 @@ float[] array = Enumerable.Range(1, 100).Select(static i => (float)i).ToArray(); using ReadWriteBuffer gpuBuffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(array); // Run the shader -using (var context = GraphicsDevice.GetDefault().CreateComputeContext()) +using (ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext()) { context.Log("Dispatching shader"); context.BeginEvent("Dispatching event"); @@ -46,4 +46,4 @@ internal readonly partial struct MultiplyByTwo : IComputeShader { buffer[ThreadIds.X] *= 2; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs b/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs index 7d2c3be4..e261d54a 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Interop; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.DeviceLost.Helpers; @@ -62,15 +62,15 @@ public partial class DeviceDisposalTests using (GraphicsDevice graphicsDevice = device.Get()) { - using var r1 = graphicsDevice.AllocateConstantBuffer(128); - using var r2 = graphicsDevice.AllocateReadOnlyBuffer(128); - using var r3 = graphicsDevice.AllocateReadWriteBuffer(128); - using var r4 = graphicsDevice.AllocateReadOnlyTexture2D(128, 128); - using var r5 = graphicsDevice.AllocateReadWriteTexture2D(128, 128); - using var r6 = graphicsDevice.AllocateUploadBuffer(128); - using var r7 = graphicsDevice.AllocateReadBackBuffer(128); - using var r8 = graphicsDevice.AllocateUploadTexture2D(128, 128); - using var r9 = graphicsDevice.AllocateReadBackTexture2D(128, 128); + using ConstantBuffer r1 = graphicsDevice.AllocateConstantBuffer(128); + using ReadOnlyBuffer r2 = graphicsDevice.AllocateReadOnlyBuffer(128); + using ReadWriteBuffer r3 = graphicsDevice.AllocateReadWriteBuffer(128); + using ReadOnlyTexture2D r4 = graphicsDevice.AllocateReadOnlyTexture2D(128, 128); + using ReadWriteTexture2D r5 = graphicsDevice.AllocateReadWriteTexture2D(128, 128); + using UploadBuffer r6 = graphicsDevice.AllocateUploadBuffer(128); + using ReadBackBuffer r7 = graphicsDevice.AllocateReadBackBuffer(128); + using UploadTexture2D r8 = graphicsDevice.AllocateUploadTexture2D(128, 128); + using ReadBackTexture2D r9 = graphicsDevice.AllocateReadBackTexture2D(128, 128); GraphicsDeviceHelper.GetD3D12Device(graphicsDevice, in d3D12Device); } @@ -118,7 +118,7 @@ public partial class DeviceDisposalTests using (GraphicsDevice graphicsDevice = device.Get()) { - using var buffer = graphicsDevice.AllocateReadWriteBuffer(128); + using ReadWriteBuffer buffer = graphicsDevice.AllocateReadWriteBuffer(128); using (ComputeContext context = graphicsDevice.CreateComputeContext()) { @@ -139,7 +139,7 @@ public partial class DeviceDisposalTests public void Execute() { - buffer[ThreadIds.X] = ThreadIds.X; + this.buffer[ThreadIds.X] = ThreadIds.X; } } @@ -151,7 +151,7 @@ public partial class DeviceDisposalTests using (GraphicsDevice graphicsDevice = device.Get()) { - using var texture = graphicsDevice.AllocateReadWriteTexture2D(128, 128); + using ReadWriteTexture2D texture = graphicsDevice.AllocateReadWriteTexture2D(128, 128); using (ComputeContext context = graphicsDevice.CreateComputeContext()) { @@ -170,9 +170,9 @@ public partial class DeviceDisposalTests public float4 Execute() { float2 uv = ThreadIds.Normalized.XY; - float3 col = 0.5f + 0.5f * Hlsl.Cos(new float3(uv, uv.X) + new float3(0, 2, 4)); + float3 col = 0.5f + (0.5f * Hlsl.Cos(new float3(uv, uv.X) + new float3(0, 2, 4))); return new(col, 1f); } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.DeviceLost/DeviceLostTests.cs b/tests/ComputeSharp.Tests.DeviceLost/DeviceLostTests.cs index 58895f94..94fadf55 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/DeviceLostTests.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/DeviceLostTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; using ComputeSharp.Tests.Attributes; @@ -53,7 +53,7 @@ public class DeviceLostTests await GraphicsDeviceHelper.RemoveDeviceAsync(graphicsDevice); - using var _ = graphicsDevice.AllocateBuffer(bufferType, 128); + using Resources.Buffer _ = graphicsDevice.AllocateBuffer(bufferType, 128); } [CombinatorialTestMethod] @@ -67,7 +67,7 @@ public class DeviceLostTests await GraphicsDeviceHelper.RemoveDeviceAsync(graphicsDevice); - using var _ = graphicsDevice.AllocateTexture2D(textureType, 128, 128); + using Resources.Texture2D _ = graphicsDevice.AllocateTexture2D(textureType, 128, 128); } [CombinatorialTestMethod] @@ -81,7 +81,7 @@ public class DeviceLostTests await GraphicsDeviceHelper.RemoveDeviceAsync(graphicsDevice); - using var _ = graphicsDevice.AllocateTexture3D(textureType, 128, 128, 3); + using Resources.Texture3D _ = graphicsDevice.AllocateTexture3D(textureType, 128, 128, 3); } [CombinatorialTestMethod] @@ -153,6 +153,6 @@ public class DeviceLostTests await GraphicsDeviceHelper.RemoveDeviceAsync(graphicsDevice); - using var _ = graphicsDevice.CreateComputeContext(); + using ComputeContext _ = graphicsDevice.CreateComputeContext(); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.DeviceLost/Extensions/DeviceExtensions.cs b/tests/ComputeSharp.Tests.DeviceLost/Extensions/DeviceExtensions.cs index 983083bb..d3910436 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/Extensions/DeviceExtensions.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/Extensions/DeviceExtensions.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using CommunityToolkit.Diagnostics; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -33,7 +33,6 @@ public static class DeviceExtensions case Device.Discrete: Assert.Inconclusive(); break; case Device.Warp: Assert.Fail(); break; } - } return device!; @@ -54,4 +53,4 @@ public enum Device /// A WARP device (software fallback). /// Warp -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.DeviceLost/GetDefaultDeviceTests.cs b/tests/ComputeSharp.Tests.DeviceLost/GetDefaultDeviceTests.cs index bbfe9ddd..0f20decd 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/GetDefaultDeviceTests.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/GetDefaultDeviceTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using ComputeSharp.Tests.DeviceLost.Helpers; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -40,7 +40,7 @@ public class GetDefaultDeviceTests device1.Dispose(); // The device is correctly marked as disposed - Assert.ThrowsException(() => device1.IsDoublePrecisionSupportAvailable()); + _ = Assert.ThrowsException(() => device1.IsDoublePrecisionSupportAvailable()); // Now there should just be this one last reference left to the native device Assert.AreEqual(1u, GraphicsDeviceHelper.GetD3D12DeviceRefCount(in d3D12Device)); @@ -65,7 +65,7 @@ public class GetDefaultDeviceTests device4.Dispose(); // The device is correctly marked as disposed - Assert.ThrowsException(() => device4.IsDoublePrecisionSupportAvailable()); + _ = Assert.ThrowsException(() => device4.IsDoublePrecisionSupportAvailable()); // Sanity check that this is in fact the only reference keeping the device alive Assert.AreEqual(1u, GraphicsDeviceHelper.GetD3D12DeviceRefCount(in d3D12Device)); @@ -79,7 +79,7 @@ public class GetDefaultDeviceTests } // Calling GraphicsDevice.GetDefault() will now throw, because the native device has not been disposed properly - Assert.ThrowsException(() => GraphicsDevice.GetDefault()); + _ = Assert.ThrowsException(GraphicsDevice.GetDefault); } } @@ -119,4 +119,4 @@ public class GetDefaultDeviceTests Assert.AreEqual(1u, GraphicsDeviceHelper.GetD3D12DeviceRefCount(in d3D12Device)); } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.DeviceLost/Helpers/GraphicsDeviceHelper.cs b/tests/ComputeSharp.Tests.DeviceLost/Helpers/GraphicsDeviceHelper.cs index cbc4499c..de319cdf 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/Helpers/GraphicsDeviceHelper.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/Helpers/GraphicsDeviceHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using ComputeSharp.Interop; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -68,7 +68,7 @@ internal static class GraphicsDeviceHelper { if (d3D12Device is not null) { - d3D12Device->Release(); + _ = d3D12Device->Release(); } } } @@ -92,6 +92,6 @@ internal static class GraphicsDeviceHelper RemoveDevice(graphicsDevice); - await tcs.Task; + _ = await tcs.Task; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.DeviceLost/Properties/AssemblyInfo.cs b/tests/ComputeSharp.Tests.DeviceLost/Properties/AssemblyInfo.cs index 8ed86d91..fb369378 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/Properties/AssemblyInfo.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/Properties/AssemblyInfo.cs @@ -1,3 +1,3 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; -[assembly: DoNotParallelize] +[assembly: DoNotParallelize] \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.DeviceLost/TerraFX.Interop.Windows/ID3D12Device5.cs b/tests/ComputeSharp.Tests.DeviceLost/TerraFX.Interop.Windows/ID3D12Device5.cs index d81d75aa..6f0fa4ea 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/TerraFX.Interop.Windows/ID3D12Device5.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/TerraFX.Interop.Windows/ID3D12Device5.cs @@ -9,25 +9,24 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -namespace TerraFX.Interop.DirectX +namespace TerraFX.Interop.DirectX; + +[Guid("8B4F173B-2FEA-4B80-8F58-4307191AB95D")] +public unsafe partial struct ID3D12Device5 { - [Guid("8B4F173B-2FEA-4B80-8F58-4307191AB95D")] - public unsafe partial struct ID3D12Device5 + public void** lpVtbl; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint Release() { - public void** lpVtbl; + return ((delegate* unmanaged[Stdcall])this.lpVtbl[2])((ID3D12Device5*)Unsafe.AsPointer(ref this)); + } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public uint Release() - { - return ((delegate* unmanaged[Stdcall])(lpVtbl[2]))((ID3D12Device5*)Unsafe.AsPointer(ref this)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void RemoveDevice() - { - ((delegate* unmanaged[Stdcall])(lpVtbl[58]))((ID3D12Device5*)Unsafe.AsPointer(ref this)); - } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void RemoveDevice() + { + ((delegate* unmanaged[Stdcall])this.lpVtbl[58])((ID3D12Device5*)Unsafe.AsPointer(ref this)); } } -#endif +#endif \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.DisableDynamicCompilation/DispatchTests.cs b/tests/ComputeSharp.Tests.DisableDynamicCompilation/DispatchTests.cs index e0815693..7c8c903f 100644 --- a/tests/ComputeSharp.Tests.DisableDynamicCompilation/DispatchTests.cs +++ b/tests/ComputeSharp.Tests.DisableDynamicCompilation/DispatchTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; @@ -50,7 +50,7 @@ public partial class DispatchTests /// public void Execute() { - buffer[ThreadIds.X] *= factor; + this.buffer[ThreadIds.X] *= this.factor; } } @@ -94,7 +94,7 @@ public partial class DispatchTests /// public float4 Execute() { - return new(ThreadIds.Normalized.X, ThreadIds.Normalized.Y, b, a); + return new(ThreadIds.Normalized.X, ThreadIds.Normalized.Y, this.b, this.a); } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.GlobalStatements/Program.cs b/tests/ComputeSharp.Tests.GlobalStatements/Program.cs index a9507482..b4cdd3ac 100644 --- a/tests/ComputeSharp.Tests.GlobalStatements/Program.cs +++ b/tests/ComputeSharp.Tests.GlobalStatements/Program.cs @@ -1,4 +1,4 @@ -using ComputeSharp; +using ComputeSharp; using Microsoft.VisualStudio.TestTools.UnitTesting; float[] numbers = Enumerable.Range(0, 128).Select(i => (float)i).ToArray(); diff --git a/tests/ComputeSharp.Tests.Internals/AlignmentHelperTests.cs b/tests/ComputeSharp.Tests.Internals/AlignmentHelperTests.cs index 05943b6e..91b6604c 100644 --- a/tests/ComputeSharp.Tests.Internals/AlignmentHelperTests.cs +++ b/tests/ComputeSharp.Tests.Internals/AlignmentHelperTests.cs @@ -1,4 +1,4 @@ -using ComputeSharp.Core.Helpers; +using ComputeSharp.Core.Helpers; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests.Internals; @@ -37,4 +37,4 @@ public class AlignmentHelperTests Assert.AreEqual(result, expected); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.Internals/DebugViewTests.cs b/tests/ComputeSharp.Tests.Internals/DebugViewTests.cs index 9c247059..3865953f 100644 --- a/tests/ComputeSharp.Tests.Internals/DebugViewTests.cs +++ b/tests/ComputeSharp.Tests.Internals/DebugViewTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; @@ -318,4 +318,4 @@ public partial class DebugViewTests Assert.IsNull(view.Items); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.Internals/Helpers/DebugDispatchDataLoader.cs b/tests/ComputeSharp.Tests.Internals/Helpers/DebugDispatchDataLoader.cs index ff00dd4e..9dc41823 100644 --- a/tests/ComputeSharp.Tests.Internals/Helpers/DebugDispatchDataLoader.cs +++ b/tests/ComputeSharp.Tests.Internals/Helpers/DebugDispatchDataLoader.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using ComputeSharp.__Internals; @@ -50,4 +50,4 @@ internal readonly unsafe struct DebugDispatchDataLoader : IDispatchDataLoader { this.data.Value.Resources = data.ToArray(); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.Internals/NativeObjectTests.cs b/tests/ComputeSharp.Tests.Internals/NativeObjectTests.cs index f5a387a0..4c939895 100644 --- a/tests/ComputeSharp.Tests.Internals/NativeObjectTests.cs +++ b/tests/ComputeSharp.Tests.Internals/NativeObjectTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using ComputeSharp.Interop; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -18,11 +18,11 @@ public class NativeObjectTests Assert.IsTrue(obj.IsDisposed); - using var _ = obj.TryGetReferenceTrackingLease(out bool leaseTaken); + using NativeObject.Lease lease0 = obj.TryGetReferenceTrackingLease(out bool leaseTaken); Assert.IsFalse(leaseTaken); - Assert.ThrowsException(() => obj.GetReferenceTrackingLease()); + _ = Assert.ThrowsException(() => obj.GetReferenceTrackingLease()); } [TestMethod] @@ -30,7 +30,7 @@ public class NativeObjectTests { DisposableObject obj = new(); - var lease0 = obj.GetReferenceTrackingLease(); + NativeObject.Lease lease0 = obj.GetReferenceTrackingLease(); obj.Dispose(); @@ -49,7 +49,7 @@ public class NativeObjectTests { DisposableObject obj = new(); - var lease0 = obj.TryGetReferenceTrackingLease(out bool leaseTaken); + NativeObject.Lease lease0 = obj.TryGetReferenceTrackingLease(out bool leaseTaken); Assert.IsTrue(leaseTaken); @@ -85,11 +85,11 @@ public class NativeObjectTests { DisposableObject obj = new(); - Parallel.For(0, 2048, i => + _ = Parallel.For(0, 2048, i => { for (int j = 0; j < 4; j++) { - using var lease = obj.GetReferenceTrackingLease(); + using NativeObject.Lease lease = obj.GetReferenceTrackingLease(); } }); @@ -105,7 +105,7 @@ public class NativeObjectTests { DisposableObject obj = new(); - Parallel.For(0, 2048, i => + _ = Parallel.For(0, 2048, i => { bool isDisposed = false; @@ -118,7 +118,7 @@ public class NativeObjectTests for (int j = 0; j < 4; j++) { - using var lease = obj.TryGetReferenceTrackingLease(out bool leaseTaken); + using NativeObject.Lease lease = obj.TryGetReferenceTrackingLease(out bool leaseTaken); if (isDisposed) { @@ -135,9 +135,9 @@ public class NativeObjectTests { DisposableObject obj = new(); - var outstandingLease = obj.GetReferenceTrackingLease(); + NativeObject.Lease outstandingLease = obj.GetReferenceTrackingLease(); - Parallel.For(0, 2048, i => + _ = Parallel.For(0, 2048, i => { bool isDisposed = false; @@ -150,7 +150,7 @@ public class NativeObjectTests for (int j = 0; j < 4; j++) { - using var lease = obj.TryGetReferenceTrackingLease(out bool leaseTaken); + using NativeObject.Lease lease = obj.TryGetReferenceTrackingLease(out bool leaseTaken); if (isDisposed) { @@ -177,4 +177,4 @@ public class NativeObjectTests IsDisposed = true; } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.Internals/ShaderCompilerTests.cs b/tests/ComputeSharp.Tests.Internals/ShaderCompilerTests.cs index b7dc4591..9afe217a 100644 --- a/tests/ComputeSharp.Tests.Internals/ShaderCompilerTests.cs +++ b/tests/ComputeSharp.Tests.Internals/ShaderCompilerTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Exceptions; using ComputeSharp.Shaders.Translation; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -41,8 +41,8 @@ public class ShaderCompilerTests [ExpectedException(typeof(DxcCompilationException))] public void CompileTest_Fail() { - var faultyShader = ShaderSource.Replace("ids.x", "ids.X"); + string faultyShader = ShaderSource.Replace("ids.x", "ids.X"); using ComPtr dxcBlob = ShaderCompiler.Instance.Compile(faultyShader.AsSpan()); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.Internals/ShaderDataLoaderTests.cs b/tests/ComputeSharp.Tests.Internals/ShaderDataLoaderTests.cs index 4071dbb1..766f597d 100644 --- a/tests/ComputeSharp.Tests.Internals/ShaderDataLoaderTests.cs +++ b/tests/ComputeSharp.Tests.Internals/ShaderDataLoaderTests.cs @@ -1,4 +1,4 @@ -using ComputeSharp.__Internals; +using ComputeSharp.__Internals; using ComputeSharp.Tests.Internals.Helpers; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -340,7 +340,7 @@ public partial class ShaderDataLoaderTests b: new(44.4f, 55.5f), c: new CustomType3( a: 7654321, - b: new (111.1f, 222.2f))), + b: new(111.1f, 222.2f))), e: new CustomType3( a: 888888, b: new(333.3f, 444.4f)))); @@ -444,4 +444,4 @@ public partial class ShaderDataLoaderTests Assert.AreEqual(y.D3D12GpuDescriptorHandle.ptr, dataLoader.Resources[4]); Assert.AreEqual(z.D3D12GpuDescriptorHandle.ptr, dataLoader.Resources[5]); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.Internals/ShaderHashCodeTests.cs b/tests/ComputeSharp.Tests.Internals/ShaderHashCodeTests.cs index 0dcc496d..a4dcdcd5 100644 --- a/tests/ComputeSharp.Tests.Internals/ShaderHashCodeTests.cs +++ b/tests/ComputeSharp.Tests.Internals/ShaderHashCodeTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.__Internals; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -17,7 +17,7 @@ public partial class ShaderHashCodeTests public void Execute() { - B[0] = A; + this.B[0] = this.A; } } @@ -49,7 +49,7 @@ public partial class ShaderHashCodeTests public void Execute() { - B[0] = F(A); + this.B[0] = this.F(this.A); } } @@ -75,4 +75,4 @@ public partial class ShaderHashCodeTests Assert.IsFalse(hash1 == hash3); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/DynamicNativeLibrariesResolverTests.cs b/tests/ComputeSharp.Tests.NativeLibrariesResolver/DynamicNativeLibrariesResolverTests.cs index d990e218..507f6660 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/DynamicNativeLibrariesResolverTests.cs +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/DynamicNativeLibrariesResolverTests.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.IO; using ComputeSharp.Tests.NativeLibrariesResolver.Helpers; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -34,4 +34,4 @@ public class DynamicNativeLibrariesResolverTests : NativeLibrariesResolverTestsB Process.Start("dotnet", $"pack {packagingProjectPath} -c Release").WaitForExit(); Process.Start("dotnet", $"pack {dynamicPackagingProjectPath} -c Release").WaitForExit(); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/Helpers/NativeLibrariesResolverTestsBase.cs b/tests/ComputeSharp.Tests.NativeLibrariesResolver/Helpers/NativeLibrariesResolverTestsBase.cs index 503b491a..74881bb5 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/Helpers/NativeLibrariesResolverTestsBase.cs +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/Helpers/NativeLibrariesResolverTestsBase.cs @@ -1,4 +1,4 @@ -using System.ComponentModel; +using System.ComponentModel; using System.Diagnostics; using System.IO; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -105,7 +105,6 @@ public abstract class NativeLibrariesResolverTestsBase Assert.AreEqual(0, Exec(pathToAppHostDirectory, $"{SampleProjectName}.exe", "")); } - [TestMethod] [DataRow(PublishMode.SelfContained, DeploymentMode.Multiassembly, NativeLibrariesDeploymentMode.NotApplicable)] [DataRow(PublishMode.FrameworkDependent, DeploymentMode.Multiassembly, NativeLibrariesDeploymentMode.NotApplicable)] @@ -119,7 +118,7 @@ public abstract class NativeLibrariesResolverTestsBase // Furthermore, only publishing in Release mode is tested. CleanSampleProject(Configuration.Release, RID.Win_x64); - Exec(SampleProjectDirectory, "dotnet", $"publish -c Release -f net6.0 -r win-x64 {ToOption(publishMode)} {ToOption(deploymentMode)} {ToOption(nativeLibsDeploymentMode)} /bl"); + _ = Exec(SampleProjectDirectory, "dotnet", $"publish -c Release -f net6.0 -r win-x64 {ToOption(publishMode)} {ToOption(deploymentMode)} {ToOption(nativeLibsDeploymentMode)} /bl"); string pathToAppHost = Path.Combine("bin", $"Release", "net6.0", "win-x64", "publish", $"{SampleProjectName}.exe"); @@ -135,7 +134,7 @@ public abstract class NativeLibrariesResolverTestsBase /// The RID for which the output is cleaned. private void CleanSampleProject(Configuration configuration, RID rid) { - Exec(SampleProjectDirectory, "dotnet", $"clean -c {configuration} {ToOption(rid)}"); + _ = Exec(SampleProjectDirectory, "dotnet", $"clean -c {configuration} {ToOption(rid)}"); } /// @@ -145,7 +144,7 @@ public abstract class NativeLibrariesResolverTestsBase /// The RID to use to build the project. private void BuildSampleProject(Configuration configuration, RID rid) { - Exec(SampleProjectDirectory, "dotnet", $"build -c {configuration} {ToOption(rid)}"); + _ = Exec(SampleProjectDirectory, "dotnet", $"build -c {configuration} {ToOption(rid)}"); } /// @@ -179,61 +178,76 @@ public abstract class NativeLibrariesResolverTestsBase /// /// The input value. /// A text representation for . - private static string ToOption(RID rid) => rid switch + private static string ToOption(RID rid) { - RID.None => "", - RID.Win_x64 => "-r win-x64", - _ => throw new InvalidEnumArgumentException(nameof(rid), (int)rid, typeof(RID)) - }; + return rid switch + { + RID.None => "", + RID.Win_x64 => "-r win-x64", + _ => throw new InvalidEnumArgumentException(nameof(rid), (int)rid, typeof(RID)) + }; + } /// /// Gets a text representation of the command line argument for the given . /// /// The input value. /// A text representation for . - private static string ToOption(PublishMode publishMode) => publishMode switch + private static string ToOption(PublishMode publishMode) { - PublishMode.FrameworkDependent => "--self-contained false", - PublishMode.SelfContained => "--self-contained true", - _ => throw new InvalidEnumArgumentException(nameof(publishMode), (int)publishMode, typeof(PublishMode)) - }; + return publishMode switch + { + PublishMode.FrameworkDependent => "--self-contained false", + PublishMode.SelfContained => "--self-contained true", + _ => throw new InvalidEnumArgumentException(nameof(publishMode), (int)publishMode, typeof(PublishMode)) + }; + } /// /// Gets a text representation of the command line argument for the given . /// /// The input value. /// A text representation for . - private static string ToOption(DeploymentMode deploymentMode) => deploymentMode switch + private static string ToOption(DeploymentMode deploymentMode) { - DeploymentMode.Multiassembly => "/p:PublishSingleFile=false", - DeploymentMode.SingleFile => "/p:PublishSingleFile=true", - _ => throw new InvalidEnumArgumentException(nameof(deploymentMode), (int)deploymentMode, typeof(DeploymentMode)) - }; + return deploymentMode switch + { + DeploymentMode.Multiassembly => "/p:PublishSingleFile=false", + DeploymentMode.SingleFile => "/p:PublishSingleFile=true", + _ => throw new InvalidEnumArgumentException(nameof(deploymentMode), (int)deploymentMode, typeof(DeploymentMode)) + }; + } /// /// Gets a text representation of the command line argument for the given . /// /// The input value. /// A text representation for . - private static string ToOption(NativeLibrariesDeploymentMode deploymentMode) => deploymentMode switch + private static string ToOption(NativeLibrariesDeploymentMode deploymentMode) { - NativeLibrariesDeploymentMode.NotApplicable => "", - NativeLibrariesDeploymentMode.CopyToApplicationDirectory => "/p:IncludeNativeLibrariesForSelfExtract=false", - NativeLibrariesDeploymentMode.ExtractToTemporaryDirectory => "/p:IncludeNativeLibrariesForSelfExtract=true", - _ => throw new InvalidEnumArgumentException(nameof(deploymentMode), (int)deploymentMode, typeof(NativeLibrariesDeploymentMode)) - }; + return deploymentMode switch + { + NativeLibrariesDeploymentMode.NotApplicable => "", + NativeLibrariesDeploymentMode.CopyToApplicationDirectory => "/p:IncludeNativeLibrariesForSelfExtract=false", + NativeLibrariesDeploymentMode.ExtractToTemporaryDirectory => "/p:IncludeNativeLibrariesForSelfExtract=true", + _ => throw new InvalidEnumArgumentException(nameof(deploymentMode), (int)deploymentMode, typeof(NativeLibrariesDeploymentMode)) + }; + } /// /// Gets a text representation of the build folder for the given . /// /// The input value. /// A text representation for . - private static string ToDirectory(RID rid) => rid switch + private static string ToDirectory(RID rid) { - RID.None => "", - RID.Win_x64 => "win-x64", - _ => throw new InvalidEnumArgumentException(nameof(rid), (int)rid, typeof(RID)) - }; + return rid switch + { + RID.None => "", + RID.Win_x64 => "win-x64", + _ => throw new InvalidEnumArgumentException(nameof(rid), (int)rid, typeof(RID)) + }; + } } /// diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/NativeLibrariesResolverTests.cs b/tests/ComputeSharp.Tests.NativeLibrariesResolver/NativeLibrariesResolverTests.cs index 6e8afe8c..e299b1e2 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/NativeLibrariesResolverTests.cs +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/NativeLibrariesResolverTests.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.IO; using ComputeSharp.Tests.NativeLibrariesResolver.Helpers; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -32,4 +32,4 @@ public class NativeLibrariesResolverTests : NativeLibrariesResolverTestsBase Process.Start("dotnet", $"pack {corePackagingProjectPath} -c Release").WaitForExit(); Process.Start("dotnet", $"pack {packagingProjectPath} -c Release").WaitForExit(); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/PixNativeLibrariesResolverTests.cs b/tests/ComputeSharp.Tests.NativeLibrariesResolver/PixNativeLibrariesResolverTests.cs index 9624c1c4..e98eb7d5 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/PixNativeLibrariesResolverTests.cs +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/PixNativeLibrariesResolverTests.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.IO; using ComputeSharp.Tests.NativeLibrariesResolver.Helpers; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -34,4 +34,4 @@ public class PixNativeLibrariesResolverTests : NativeLibrariesResolverTestsBase Process.Start("dotnet", $"pack {packagingProjectPath} -c Release").WaitForExit(); Process.Start("dotnet", $"pack {pixPackagingProjectPath} -c Release").WaitForExit(); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/Properties/AssemblyInfo.cs b/tests/ComputeSharp.Tests.NativeLibrariesResolver/Properties/AssemblyInfo.cs index 6a076669..fb369378 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/Properties/AssemblyInfo.cs +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/Properties/AssemblyInfo.cs @@ -1,3 +1,3 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; [assembly: DoNotParallelize] \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.SourceGenerators/AutoConstructorGeneratorTests.cs b/tests/ComputeSharp.Tests.SourceGenerators/AutoConstructorGeneratorTests.cs index d6968c03..7d897463 100644 --- a/tests/ComputeSharp.Tests.SourceGenerators/AutoConstructorGeneratorTests.cs +++ b/tests/ComputeSharp.Tests.SourceGenerators/AutoConstructorGeneratorTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -97,7 +97,7 @@ public class AutoConstructorGeneratorTests CSharpGeneratorDriver driver = CSharpGeneratorDriver.Create(generator); - driver.RunGeneratorsAndUpdateCompilation(compilation, out Compilation outputCompilation, out ImmutableArray diagnostics); + _ = driver.RunGeneratorsAndUpdateCompilation(compilation, out Compilation outputCompilation, out ImmutableArray diagnostics); string outputBody = outputCompilation.SyntaxTrees.Skip(index + 1).First().ToString(); @@ -111,4 +111,4 @@ public class AutoConstructorGeneratorTests Assert.AreEqual(expectedLines[i], outputLines[i]); } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs b/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs index 182fe64e..b7d90664 100644 --- a/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs +++ b/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -1810,10 +1810,10 @@ public class DiagnosticsTests CSharpGeneratorDriver driver = CSharpGeneratorDriver.Create(generator); - driver.RunGeneratorsAndUpdateCompilation(compilation, out Compilation outputCompilation, out ImmutableArray diagnostics); + _ = driver.RunGeneratorsAndUpdateCompilation(compilation, out Compilation outputCompilation, out ImmutableArray diagnostics); HashSet resultingIds = diagnostics.Select(diagnostic => diagnostic.Id).ToHashSet(); Assert.IsTrue(resultingIds.SetEquals(diagnosticsIds)); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Attributes/AdditionalDataAttribute.cs b/tests/ComputeSharp.Tests/Attributes/AdditionalDataAttribute.cs index d4c0b0bc..1014107b 100644 --- a/tests/ComputeSharp.Tests/Attributes/AdditionalDataAttribute.cs +++ b/tests/ComputeSharp.Tests/Attributes/AdditionalDataAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.Tests.Attributes; @@ -21,4 +21,4 @@ public sealed class AdditionalDataAttribute : Attribute /// Gets the additional input data for the current attribute. /// public object[] Data { get; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Attributes/AdditionalResourceAttribute.cs b/tests/ComputeSharp.Tests/Attributes/AdditionalResourceAttribute.cs index f5c8fda9..70936ae0 100644 --- a/tests/ComputeSharp.Tests/Attributes/AdditionalResourceAttribute.cs +++ b/tests/ComputeSharp.Tests/Attributes/AdditionalResourceAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.Tests.Attributes; @@ -21,4 +21,4 @@ public sealed class AdditionalResourceAttribute : Attribute /// Gets the additional resource type for the current attribute. /// public Type Type { get; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Attributes/AllDevicesAttribute.cs b/tests/ComputeSharp.Tests/Attributes/AllDevicesAttribute.cs index 1c83a15d..7194b7b1 100644 --- a/tests/ComputeSharp.Tests/Attributes/AllDevicesAttribute.cs +++ b/tests/ComputeSharp.Tests/Attributes/AllDevicesAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.Tests.Attributes; @@ -8,4 +8,4 @@ namespace ComputeSharp.Tests.Attributes; [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public sealed class AllDevicesAttribute : Attribute { -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Attributes/CombinatorialTestMethodAttribute.cs b/tests/ComputeSharp.Tests/Attributes/CombinatorialTestMethodAttribute.cs index 2074a0a5..7f1f1441 100644 --- a/tests/ComputeSharp.Tests/Attributes/CombinatorialTestMethodAttribute.cs +++ b/tests/ComputeSharp.Tests/Attributes/CombinatorialTestMethodAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -274,4 +274,4 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes { return $"{methodInfo.Name} ({string.Join(", ", data)})"; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Attributes/DataAttribute.cs b/tests/ComputeSharp.Tests/Attributes/DataAttribute.cs index b1633f24..c8a133b3 100644 --- a/tests/ComputeSharp.Tests/Attributes/DataAttribute.cs +++ b/tests/ComputeSharp.Tests/Attributes/DataAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.Tests.Attributes; @@ -21,4 +21,4 @@ public sealed class DataAttribute : Attribute /// Gets the input data for the current attribute. /// public object[] Data { get; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Attributes/DeviceAttribute.cs b/tests/ComputeSharp.Tests/Attributes/DeviceAttribute.cs index 4bf2e34e..2aad8c70 100644 --- a/tests/ComputeSharp.Tests/Attributes/DeviceAttribute.cs +++ b/tests/ComputeSharp.Tests/Attributes/DeviceAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Tests.Extensions; namespace ComputeSharp.Tests.Attributes; @@ -22,4 +22,4 @@ public sealed class DeviceAttribute : Attribute /// Gets the target to use. /// public Device Device { get; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Attributes/ResourceAttribute.cs b/tests/ComputeSharp.Tests/Attributes/ResourceAttribute.cs index 08e6477f..1498ebf9 100644 --- a/tests/ComputeSharp.Tests/Attributes/ResourceAttribute.cs +++ b/tests/ComputeSharp.Tests/Attributes/ResourceAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace ComputeSharp.Tests.Attributes; @@ -21,4 +21,4 @@ public sealed class ResourceAttribute : Attribute /// Gets the resource type for the current attribute. /// public Type Type { get; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/AutoConstructorAttributeTests.cs b/tests/ComputeSharp.Tests/AutoConstructorAttributeTests.cs index dd147250..88254195 100644 --- a/tests/ComputeSharp.Tests/AutoConstructorAttributeTests.cs +++ b/tests/ComputeSharp.Tests/AutoConstructorAttributeTests.cs @@ -1,4 +1,4 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests; @@ -86,4 +86,4 @@ public unsafe partial class AutoConstructorAttributeTests Assert.AreEqual(instance.a, a); Assert.AreEqual(instance.b, b); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/BufferTests.cs b/tests/ComputeSharp.Tests/BufferTests.cs index 5d84cf8e..8f223ecf 100644 --- a/tests/ComputeSharp.Tests/BufferTests.cs +++ b/tests/ComputeSharp.Tests/BufferTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using ComputeSharp.Exceptions; using ComputeSharp.Resources; @@ -197,7 +197,7 @@ public partial class BufferTests [Data(-56, 0, 1024)] [Data(0, 512, 4096)] [Data(1024, 12, 3600)] - [Data(1024, 12, - 2096)] + [Data(1024, 12, -2096)] [ExpectedException(typeof(ArgumentOutOfRangeException))] public void CopyTo_RangeToVoid_Fail(Device device, Type bufferType, int sourceOffset, int destinationOffset, int count) { @@ -286,7 +286,7 @@ public partial class BufferTests public void Execute() { - destination[ThreadIds.X] = source[ThreadIds.X]; + this.destination[ThreadIds.X] = this.source[ThreadIds.X]; } } @@ -314,7 +314,7 @@ public partial class BufferTests public void Execute() { - destination[ThreadIds.X] = source[ThreadIds.X]; + this.destination[ThreadIds.X] = this.source[ThreadIds.X]; } } @@ -342,7 +342,7 @@ public partial class BufferTests public void Execute() { - destination[ThreadIds.X] = source[ThreadIds.X]; + this.destination[ThreadIds.X] = this.source[ThreadIds.X]; } } @@ -365,7 +365,7 @@ public partial class BufferTests for (int i = 0; i < 128; i++) { - Assert.IsTrue(Math.Abs(result[i] - (array[i] * 2.0 + 3.14)) < 0.00001); + Assert.IsTrue(Math.Abs(result[i] - ((array[i] * 2.0) + 3.14)) < 0.00001); } } @@ -378,7 +378,7 @@ public partial class BufferTests /// public void Execute() { - buffer[ThreadIds.X] = buffer[ThreadIds.X] * factor + 3.14; + this.buffer[ThreadIds.X] = (this.buffer[ThreadIds.X] * this.factor) + 3.14; } } @@ -416,4 +416,4 @@ public partial class BufferTests Assert.Fail(); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/ComputeContextTests.cs b/tests/ComputeSharp.Tests/ComputeContextTests.cs index 039bbe46..78ce0ab5 100644 --- a/tests/ComputeSharp.Tests/ComputeContextTests.cs +++ b/tests/ComputeSharp.Tests/ComputeContextTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using System.Reflection; @@ -11,6 +11,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SixLabors.ImageSharp; using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32; +#pragma warning disable IDE0047 + namespace ComputeSharp.Tests; [TestClass] @@ -655,7 +657,7 @@ public partial class ComputeContextTests _ = device.Get(); - Parallel.For(0, 64, _ => Test(device)); + _ = Parallel.For(0, 64, _ => Test(device)); } [CombinatorialTestMethod] @@ -896,13 +898,13 @@ public partial class ComputeContextTests string imagingPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging"); string assetsPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Assets"); - using var sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png")); + using Image sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png")); using ReadOnlyTexture2D source = device.Get().LoadReadOnlyTexture2D(Path.Combine(imagingPath, "city.jpg")); using ReadWriteTexture2D sourceAsFloat4 = device.Get().AllocateReadWriteTexture2D(source.Width, source.Height); using ReadWriteTexture2D destination = device.Get().AllocateReadWriteTexture2D(sampled.Width, sampled.Height); - using (var context = device.Get().CreateComputeContext()) + using (ComputeContext context = device.Get().CreateComputeContext()) { context.For(source.Width, source.Height, new ConvertToNonNormalized2DShader(source, sourceAsFloat4)); context.Transition(sourceAsFloat4, ResourceState.ReadOnly); @@ -910,7 +912,7 @@ public partial class ComputeContextTests context.Transition(sourceAsFloat4, ResourceState.ReadWrite); } - using var processed = destination.ToImage(); + using Image processed = destination.ToImage(); TolerantImageComparer.AssertEqual(sampled, processed, 0.00000174f); } @@ -924,19 +926,19 @@ public partial class ComputeContextTests string imagingPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging"); string assetsPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Assets"); - using var sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png")); + using Image sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png")); using ReadWriteTexture2D source = device.Get().LoadReadWriteTexture2D(Path.Combine(imagingPath, "city.jpg")); using ReadWriteTexture2D destination = device.Get().AllocateReadWriteTexture2D(sampled.Width, sampled.Height); - using (var context = device.Get().CreateComputeContext()) + using (ComputeContext context = device.Get().CreateComputeContext()) { context.Transition(source, ResourceState.ReadOnly); context.ForEach(destination, new LinearSamplingFromNormalized2DPixelShader(source.AsReadOnly())); context.Transition(source, ResourceState.ReadWrite); } - using var processed = destination.ToImage(); + using Image processed = destination.ToImage(); TolerantImageComparer.AssertEqual(sampled, processed, 0.0000017f); } @@ -950,15 +952,15 @@ public partial class ComputeContextTests string imagingPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging"); string assetsPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Assets"); - using var sampled1 = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png")); - using var sampled2 = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024SamplingInverted.png")); + using Image sampled1 = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png")); + using Image sampled2 = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024SamplingInverted.png")); using ReadOnlyTexture2D image = device.Get().LoadReadOnlyTexture2D(Path.Combine(imagingPath, "city.jpg")); using ReadWriteTexture2D source = device.Get().AllocateReadWriteTexture2D(image.Width, image.Height); using ReadWriteTexture2D destination1 = device.Get().AllocateReadWriteTexture2D(sampled1.Width, sampled1.Height); using ReadWriteTexture2D destination2 = device.Get().AllocateReadWriteTexture2D(sampled1.Width, sampled1.Height); - using (var context = device.Get().CreateComputeContext()) + using (ComputeContext context = device.Get().CreateComputeContext()) { // Dispatch before any transitions, and UAV barrier test context.ForEach(source); @@ -980,8 +982,8 @@ public partial class ComputeContextTests context.ForEach(destination2, new LinearSamplingFromNormalized2DPixelShader(source.AsReadOnly())); } - using var processed1 = destination1.ToImage(); - using var processed2 = destination2.ToImage(); + using Image processed1 = destination1.ToImage(); + using Image processed2 = destination2.ToImage(); TolerantImageComparer.AssertEqual(sampled1, processed1, 0.0000017f); TolerantImageComparer.AssertEqual(sampled2, processed2, 0.0000028f); @@ -997,9 +999,9 @@ public partial class ComputeContextTests string originalPath = Path.Combine(assetsPath, "CityWith1920x1280Resizing.png"); string sampledPath = Path.Combine(assetsPath, "CityAfter1024x1024SamplingFrom1920x1080.png"); - var imageInfo = Image.Identify(originalPath); + IImageInfo imageInfo = Image.Identify(originalPath); - using var sampled = Image.Load(Path.Combine(assetsPath, sampledPath)); + using Image sampled = Image.Load(Path.Combine(assetsPath, sampledPath)); using ReadWriteTexture3D sourceAsFloat4 = device.Get().AllocateReadWriteTexture3D(imageInfo.Width, imageInfo.Height, 3); @@ -1024,7 +1026,7 @@ public partial class ComputeContextTests using ReadWriteTexture3D destination = device.Get().AllocateReadWriteTexture3D(sampled.Width, sampled.Height, 2); - using (var context = device.Get().CreateComputeContext()) + using (ComputeContext context = device.Get().CreateComputeContext()) { context.Transition(sourceAsFloat4, ResourceState.ReadOnly); context.For(destination.Width, destination.Height, destination.Depth, new LinearSampling3DComputeShader(sourceAsFloat4.AsReadOnly(), destination)); @@ -1033,7 +1035,7 @@ public partial class ComputeContextTests for (int z = 0; z < destination.Depth; z++) { - using var processed = destination.ToImage(depth: z); + using Image processed = destination.ToImage(depth: z); TolerantImageComparer.AssertEqual(sampled, processed, 0.000012f); } @@ -1049,9 +1051,9 @@ public partial class ComputeContextTests string originalPath = Path.Combine(assetsPath, "CityWith1920x1280Resizing.png"); string sampledPath = Path.Combine(assetsPath, "CityAfter1024x1024SamplingFrom1920x1080.png"); - var imageInfo = Image.Identify(originalPath); + IImageInfo imageInfo = Image.Identify(originalPath); - using var sampled = Image.Load(Path.Combine(assetsPath, sampledPath)); + using Image sampled = Image.Load(Path.Combine(assetsPath, sampledPath)); using ReadWriteTexture3D source = device.Get().AllocateReadWriteTexture3D(imageInfo.Width, imageInfo.Height, 3); @@ -1068,7 +1070,7 @@ public partial class ComputeContextTests using ReadWriteTexture3D destination = device.Get().AllocateReadWriteTexture3D(sampled.Width, sampled.Height, 2); - using (var context = device.Get().CreateComputeContext()) + using (ComputeContext context = device.Get().CreateComputeContext()) { context.Transition(source, ResourceState.ReadOnly); context.For(destination.Width, destination.Height, destination.Depth, new LinearSamplingFromNormalized3DComputeShader(source.AsReadOnly(), destination)); @@ -1077,7 +1079,7 @@ public partial class ComputeContextTests for (int z = 0; z < destination.Depth; z++) { - using var processed = destination.ToImage(depth: z); + using Image processed = destination.ToImage(depth: z); TolerantImageComparer.AssertEqual(sampled, processed, 0.000012f); } @@ -1092,12 +1094,12 @@ public partial class ComputeContextTests string imagingPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging"); string assetsPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Assets"); - using var sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024SamplingAndDashing.png")); + using Image sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024SamplingAndDashing.png")); using ReadWriteTexture2D source = device.Get().LoadReadWriteTexture2D(Path.Combine(imagingPath, "city.jpg")); using ReadWriteTexture2D destination = device.Get().AllocateReadWriteTexture2D(sampled.Width, sampled.Height); - using (var context = device.Get().CreateComputeContext()) + using (ComputeContext context = device.Get().CreateComputeContext()) { context.For(source.Width, source.Height, new Dotted2DPixelShader(source)); context.Transition(source, ResourceState.ReadOnly); @@ -1106,7 +1108,7 @@ public partial class ComputeContextTests context.Fill(source, new Rgba32(0xFF, 0x6A, 0x00, 0x00)); } - using var processed = destination.ToImage(); + using Image processed = destination.ToImage(); TolerantImageComparer.AssertEqual(sampled, processed, 0.0000017f); @@ -1128,9 +1130,9 @@ public partial class ComputeContextTests string originalPath = Path.Combine(assetsPath, "CityWith1920x1280Resizing.png"); string sampledPath = Path.Combine(assetsPath, "CityAfter1024x1024SamplingFrom1920x1080AndDashing.png"); - var imageInfo = Image.Identify(originalPath); + IImageInfo imageInfo = Image.Identify(originalPath); - using var sampled = Image.Load(Path.Combine(assetsPath, sampledPath)); + using Image sampled = Image.Load(Path.Combine(assetsPath, sampledPath)); using ReadWriteTexture3D source = device.Get().AllocateReadWriteTexture3D(imageInfo.Width, imageInfo.Height, 3); @@ -1147,7 +1149,7 @@ public partial class ComputeContextTests using ReadWriteTexture3D destination = device.Get().AllocateReadWriteTexture3D(sampled.Width, sampled.Height, 2); - using (var context = device.Get().CreateComputeContext()) + using (ComputeContext context = device.Get().CreateComputeContext()) { context.For(source.Width, source.Height, source.Depth, new Dotted3DPixelShader(source)); context.Transition(source, ResourceState.ReadOnly); @@ -1158,8 +1160,8 @@ public partial class ComputeContextTests for (int z = 0; z < destination.Depth; z++) { - using var processed = destination.ToImage(depth: z); - + using Image processed = destination.ToImage(depth: z); + TolerantImageComparer.AssertEqual(sampled, processed, 0.000012f); } @@ -1300,7 +1302,7 @@ public partial class ComputeContextTests /// public void Execute() { - buffer[offset + ThreadIds.X] *= 2; + this.buffer[this.offset + ThreadIds.X] *= 2; } } @@ -1322,7 +1324,7 @@ public partial class ComputeContextTests /// public float4 Execute() { - return color; + return this.color; } } @@ -1334,7 +1336,7 @@ public partial class ComputeContextTests /// public float4 Execute() { - return source.Sample(ThreadIds.Normalized.XY); + return this.source.Sample(ThreadIds.Normalized.XY); } } @@ -1352,7 +1354,7 @@ public partial class ComputeContextTests // The source has a depth of 3, but the destination has a depth of 2 xyz.Z = Hlsl.Lerp(0, 0.5f, xyz.Z); - destination[ThreadIds.XYZ] = source.Sample(xyz); + this.destination[ThreadIds.XYZ] = this.source.Sample(xyz); } } @@ -1364,7 +1366,7 @@ public partial class ComputeContextTests /// public float4 Execute() { - return source.Sample(ThreadIds.Normalized.XY); + return this.source.Sample(ThreadIds.Normalized.XY); } } @@ -1376,7 +1378,7 @@ public partial class ComputeContextTests /// public float4 Execute() { - return source[ThreadIds.XY]; + return this.source[ThreadIds.XY]; } } @@ -1388,7 +1390,7 @@ public partial class ComputeContextTests /// public float4 Execute() { - return new(1.0f - source[ThreadIds.XY].XYZ, source[ThreadIds.XY].W); + return new(1.0f - this.source[ThreadIds.XY].XYZ, this.source[ThreadIds.XY].W); } } @@ -1406,7 +1408,7 @@ public partial class ComputeContextTests // See comment in LinearSampling3DComputeShader xyz.Z = Hlsl.Lerp(0, 0.5f, xyz.Z); - destination[ThreadIds.XYZ] = source.Sample(xyz); + this.destination[ThreadIds.XYZ] = this.source.Sample(xyz); } } @@ -1428,11 +1430,11 @@ public partial class ComputeContextTests (ThreadIds.Normalized.X > 0.5f && ThreadIds.Normalized.Y > 0.5)) { - source[ThreadIds.XY] = float4.UnitW; + this.source[ThreadIds.XY] = float4.UnitW; } else { - source[ThreadIds.XY] = float4.Zero; + this.source[ThreadIds.XY] = float4.Zero; } } } @@ -1456,11 +1458,11 @@ public partial class ComputeContextTests (ThreadIds.Normalized.X > 0.5f && ThreadIds.Normalized.Y > 0.5)) { - source[ThreadIds.XYZ] = float4.UnitW; + this.source[ThreadIds.XYZ] = float4.UnitW; } else { - source[ThreadIds.XYZ] = float4.Zero; + this.source[ThreadIds.XYZ] = float4.Zero; } } } @@ -1475,7 +1477,7 @@ public partial class ComputeContextTests /// public void Execute() { - destination[ThreadIds.XY] = source[ThreadIds.XY]; + this.destination[ThreadIds.XY] = this.source[ThreadIds.XY]; } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/DispatchTests.cs b/tests/ComputeSharp.Tests/DispatchTests.cs index 68812262..7e93e0a4 100644 --- a/tests/ComputeSharp.Tests/DispatchTests.cs +++ b/tests/ComputeSharp.Tests/DispatchTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Interop; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; @@ -63,7 +63,7 @@ public partial class DispatchTests public void Execute() { - buffer[ThreadIds.XYZ].XYZ = ThreadIds.XYZ; + this.buffer[ThreadIds.XYZ].XYZ = ThreadIds.XYZ; } } @@ -117,9 +117,9 @@ public partial class DispatchTests public void Execute() { - buffer[ThreadIds.XYZ].XYZ = ThreadIds.Normalized.XYZ; - buffer[ThreadIds.XYZ].XY = ThreadIds.Normalized.XY; - buffer[ThreadIds.XYZ].W = ThreadIds.Normalized.X; + this.buffer[ThreadIds.XYZ].XYZ = ThreadIds.Normalized.XYZ; + this.buffer[ThreadIds.XYZ].XY = ThreadIds.Normalized.XY; + this.buffer[ThreadIds.XYZ].W = ThreadIds.Normalized.X; } } @@ -145,7 +145,7 @@ public partial class DispatchTests Assert.AreEqual(x % 4, value[0]); Assert.AreEqual(y % 4, value[1]); Assert.AreEqual(z % 4, value[2]); - Assert.AreEqual(value[2] * 4 * 4 + value[1] * 4 + value[0], value[3]); + Assert.AreEqual((value[2] * 4 * 4) + (value[1] * 4) + value[0], value[3]); } } } @@ -178,8 +178,8 @@ public partial class DispatchTests public void Execute() { - buffer[ThreadIds.XYZ].XYZ = GroupIds.XYZ; - buffer[ThreadIds.XYZ].W = GroupIds.Index; + this.buffer[ThreadIds.XYZ].XYZ = GroupIds.XYZ; + this.buffer[ThreadIds.XYZ].W = GroupIds.Index; } } @@ -190,7 +190,7 @@ public partial class DispatchTests using ReadWriteBuffer buffer = device.Get().AllocateReadWriteBuffer(32); device.Get().For(1, 1, 1, 4, 15, 7, new GroupSizeShader(buffer)); - + int[] data = buffer.ToArray(); Assert.AreEqual(4, data[0]); @@ -208,12 +208,12 @@ public partial class DispatchTests public void Execute() { - buffer[0] = GroupSize.X; - buffer[1] = GroupSize.Y; - buffer[2] = GroupSize.Z; - buffer[3] = GroupSize.Count; - buffer[4] = (int)Hlsl.Dot(GroupSize.XY, float2.One); - buffer[5] = (int)Hlsl.Dot(GroupSize.XYZ, float3.One); + this.buffer[0] = GroupSize.X; + this.buffer[1] = GroupSize.Y; + this.buffer[2] = GroupSize.Z; + this.buffer[3] = GroupSize.Count; + this.buffer[4] = (int)Hlsl.Dot(GroupSize.XY, float2.One); + this.buffer[5] = (int)Hlsl.Dot(GroupSize.XYZ, float3.One); } } @@ -240,7 +240,7 @@ public partial class DispatchTests public void Execute() { - buffer[ThreadIds.X] = GridIds.X; + this.buffer[ThreadIds.X] = GridIds.X; } } @@ -271,12 +271,12 @@ public partial class DispatchTests public void Execute() { - buffer[0] = DispatchSize.Count; - buffer[1] = DispatchSize.X; - buffer[2] = DispatchSize.Y; - buffer[3] = DispatchSize.Z; - buffer[4] = (int)Hlsl.Dot(DispatchSize.XY, float2.One); - buffer[5] = (int)Hlsl.Dot(DispatchSize.XYZ, float3.One); + this.buffer[0] = DispatchSize.Count; + this.buffer[1] = DispatchSize.X; + this.buffer[2] = DispatchSize.Y; + this.buffer[3] = DispatchSize.Z; + this.buffer[4] = (int)Hlsl.Dot(DispatchSize.XY, float2.One); + this.buffer[5] = (int)Hlsl.Dot(DispatchSize.XYZ, float3.One); } } @@ -354,7 +354,7 @@ public partial class DispatchTests if (!isWritingToGroupShared) { - buffer[index] = cache[index]; + this.buffer[index] = cache[index]; } } } @@ -397,8 +397,8 @@ public partial class DispatchTests if (!isWritingToGroupShared) { - buffer[index] = cache[index]; + this.buffer[index] = cache[index]; } } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs b/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs index 07a3b3ac..111bf9e8 100644 --- a/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs +++ b/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using CommunityToolkit.Diagnostics; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -52,7 +52,6 @@ public static class DeviceExtensions case Device.Discrete: Assert.Inconclusive(); break; case Device.Warp: Assert.Fail(); break; } - } return device!; @@ -73,4 +72,4 @@ public enum Device /// A WARP device (software fallback). /// Warp -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Extensions/GraphicsDeviceExtensions.cs b/tests/ComputeSharp.Tests/Extensions/GraphicsDeviceExtensions.cs index d40c81b0..6f10e0dc 100644 --- a/tests/ComputeSharp.Tests/Extensions/GraphicsDeviceExtensions.cs +++ b/tests/ComputeSharp.Tests/Extensions/GraphicsDeviceExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using ComputeSharp.Resources; @@ -508,4 +508,4 @@ public static class GraphicsDeviceExtensions throw new ArgumentException($"Invalid input type: {inputType}", nameof(inputType)); } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs b/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs index 8470ebb3..1c1e75c3 100644 --- a/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs +++ b/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; @@ -61,4 +61,4 @@ public static class ImagingExtensions return image; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/GlobalUsingDirectivesTests.cs b/tests/ComputeSharp.Tests/GlobalUsingDirectivesTests.cs index 4c015206..efd5384d 100644 --- a/tests/ComputeSharp.Tests/GlobalUsingDirectivesTests.cs +++ b/tests/ComputeSharp.Tests/GlobalUsingDirectivesTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests; @@ -107,4 +107,4 @@ public unsafe partial class GlobalUsingDirectivesTests { Assert.AreEqual(left, right); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Helpers/TestHelper.cs b/tests/ComputeSharp.Tests/Helpers/TestHelper.cs index 4d2a447c..992c4276 100644 --- a/tests/ComputeSharp.Tests/Helpers/TestHelper.cs +++ b/tests/ComputeSharp.Tests/Helpers/TestHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -24,7 +24,7 @@ public static class TestHelper try { - @delegate.Method.GetGenericMethodDefinition().MakeGenericMethod(type).Invoke(null, arguments); + _ = @delegate.Method.GetGenericMethodDefinition().MakeGenericMethod(type).Invoke(null, arguments); } catch (TargetInvocationException e) when (e.InnerException is not null) { @@ -48,11 +48,11 @@ public static class TestHelper try { - @delegate.Method.GetGenericMethodDefinition().MakeGenericMethod(type1, type2).Invoke(null, arguments); + _ = @delegate.Method.GetGenericMethodDefinition().MakeGenericMethod(type1, type2).Invoke(null, arguments); } catch (TargetInvocationException e) when (e.InnerException is not null) { throw e.InnerException; } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Helpers/TolerantImageComparer.cs b/tests/ComputeSharp.Tests/Helpers/TolerantImageComparer.cs index 4f3594c3..97ed11aa 100644 --- a/tests/ComputeSharp.Tests/Helpers/TolerantImageComparer.cs +++ b/tests/ComputeSharp.Tests/Helpers/TolerantImageComparer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text; using System.Runtime.CompilerServices; @@ -23,8 +23,8 @@ internal static class TolerantImageComparer /// The allowed difference threshold for the normalized delta. public static void AssertEqual(string expectedPath, string actualPath, float threshold) { - using var expected = Image.Load(expectedPath); - using var actual = Image.Load(actualPath); + using Image expected = Image.Load(expectedPath); + using Image actual = Image.Load(actualPath); AssertEqual(expected, actual, threshold); } @@ -55,7 +55,7 @@ internal static class TolerantImageComparer float totalDifference = 0F; - var differences = new List(20); + List differences = new(20); Span aBuffer = new ImageSharpRgba32[actual.Width]; Span bBuffer = new ImageSharpRgba32[actual.Width]; @@ -84,7 +84,7 @@ internal static class TolerantImageComparer { if (differences.Count < 20) { - var diff = new PixelDifference(new Point(x, y), aBuffer[x], bBuffer[x]); + PixelDifference diff = new(new Point(x, y), aBuffer[x], bBuffer[x]); differences.Add(diff); } @@ -99,12 +99,12 @@ internal static class TolerantImageComparer if (normalizedDifference > threshold) { StringBuilder builder = new(); - builder.AppendLine($"The input images don't match. Normalized delta: {normalizedDifference}%"); - builder.AppendLine($"First {differences.Count} pixel deltas:"); + _ = builder.AppendLine($"The input images don't match. Normalized delta: {normalizedDifference}%"); + _ = builder.AppendLine($"First {differences.Count} pixel deltas:"); - foreach (var delta in differences) + foreach (PixelDifference delta in differences) { - builder.AppendLine(delta.ToString()); + _ = builder.AppendLine(delta.ToString()); } Assert.Fail(builder.ToString()); @@ -138,7 +138,7 @@ internal static class TolerantImageComparer /// public override string ToString() { - return $"[delta({RedDifference},{GreenDifference},{BlueDifference},{AlphaDifference}) @ ({Position.X},{Position.Y})]"; + return $"[delta({this.RedDifference},{this.GreenDifference},{this.BlueDifference},{this.AlphaDifference}) @ ({this.Position.X},{this.Position.Y})]"; } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/IPixelShaderTests.cs b/tests/ComputeSharp.Tests/IPixelShaderTests.cs index b41a62d5..0c2c60cc 100644 --- a/tests/ComputeSharp.Tests/IPixelShaderTests.cs +++ b/tests/ComputeSharp.Tests/IPixelShaderTests.cs @@ -1,4 +1,4 @@ -using ComputeSharp.Tests.Attributes; +using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -47,4 +47,4 @@ public partial class IPixelShaderTests return float4.UnitY; } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/ImageProcessingTests.cs b/tests/ComputeSharp.Tests/ImageProcessingTests.cs index 99c6e5b1..66f1fcda 100644 --- a/tests/ComputeSharp.Tests/ImageProcessingTests.cs +++ b/tests/ComputeSharp.Tests/ImageProcessingTests.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Reflection; using ComputeSharp.BokehBlur.Processors; using ComputeSharp.Tests.Attributes; @@ -25,12 +25,12 @@ public class ImageProcessingTests string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging"); - using var original = Image.Load(Path.Combine(path, "city.jpg")); - + using Image original = Image.Load(Path.Combine(path, "city.jpg")); + original.Mutate(c => c.Resize(1920, 1080)); - using var cpu = original.Clone(c => c.BokehBlur(40, 2, 3)); - using var gpu = original.Clone(c => c.ApplyProcessor(new HlslBokehBlurProcessor(device.Get(), 40, 2))); + using Image cpu = original.Clone(c => c.BokehBlur(40, 2, 3)); + using Image gpu = original.Clone(c => c.ApplyProcessor(new HlslBokehBlurProcessor(device.Get(), 40, 2))); string expectedPath = Path.Combine(path, "city_bokeh_cpu.jpg"); string actualPath = Path.Combine(path, "city_bokeh_gpu.jpg"); @@ -49,12 +49,12 @@ public class ImageProcessingTests string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging"); - using var original = Image.Load(Path.Combine(path, "city.jpg")); + using Image original = Image.Load(Path.Combine(path, "city.jpg")); original.Mutate(c => c.Resize(1920, 1080)); - using var cpu = original.Clone(c => c.GaussianBlur(30f)); - using var gpu = original.Clone(c => c.ApplyProcessor(new HlslGaussianBlurProcessor(device.Get(), 90))); + using Image cpu = original.Clone(c => c.GaussianBlur(30f)); + using Image gpu = original.Clone(c => c.ApplyProcessor(new HlslGaussianBlurProcessor(device.Get(), 90))); string expectedPath = Path.Combine(path, "city_gaussian_cpu.jpg"); string actualPath = Path.Combine(path, "city_gaussian_gpu.jpg"); @@ -64,4 +64,4 @@ public class ImageProcessingTests TolerantImageComparer.AssertEqual(expectedPath, actualPath, 0.0000046f); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/ImagingTests.cs b/tests/ComputeSharp.Tests/ImagingTests.cs index 5b3ce1ab..7008bbcb 100644 --- a/tests/ComputeSharp.Tests/ImagingTests.cs +++ b/tests/ComputeSharp.Tests/ImagingTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.IO; using System.Reflection; @@ -532,4 +532,4 @@ public class ImagingTests texture.Save(typeof(string), null!); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/InitializationTests.cs b/tests/ComputeSharp.Tests/InitializationTests.cs index 3609519c..5e3332dc 100644 --- a/tests/ComputeSharp.Tests/InitializationTests.cs +++ b/tests/ComputeSharp.Tests/InitializationTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; @@ -35,7 +35,10 @@ public partial class InitializationTests foreach (GraphicsDevice device in GraphicsDevice.EnumerateDevices()) { - if (i++ == 0) Assert.AreSame(GraphicsDevice.GetDefault(), device); + if (i++ == 0) + { + Assert.AreSame(GraphicsDevice.GetDefault(), device); + } using ReadWriteBuffer buffer = device.AllocateReadWriteBuffer(128); @@ -54,7 +57,10 @@ public partial class InitializationTests foreach (GraphicsDevice device in GraphicsDevice.QueryDevices(info => info.DedicatedMemorySize >= 1024)) { - if (i++ == 0) Assert.AreSame(GraphicsDevice.GetDefault(), device); + if (i++ == 0) + { + Assert.AreSame(GraphicsDevice.GetDefault(), device); + } using ReadWriteBuffer buffer = device.AllocateReadWriteBuffer(128); @@ -73,7 +79,7 @@ public partial class InitializationTests public void Execute() { - buffer[ThreadIds.X] = ThreadIds.X; + this.buffer[ThreadIds.X] = ThreadIds.X; } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/InteropServicesTests.cs b/tests/ComputeSharp.Tests/InteropServicesTests.cs index fa7b36ee..c7944bb9 100644 --- a/tests/ComputeSharp.Tests/InteropServicesTests.cs +++ b/tests/ComputeSharp.Tests/InteropServicesTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Interop; using ComputeSharp.Resources; using ComputeSharp.Tests.Attributes; @@ -184,4 +184,4 @@ public unsafe partial class InteropServicesTests Assert.IsTrue(d3D12Resource.Get() != null); Assert.AreEqual(d3D12Resource.Get()->GetDesc().Dimension, D3D12_RESOURCE_DIMENSION_BUFFER); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/MetaprogrammingTests.cs b/tests/ComputeSharp.Tests/MetaprogrammingTests.cs index 624f6b30..91bad97b 100644 --- a/tests/ComputeSharp.Tests/MetaprogrammingTests.cs +++ b/tests/ComputeSharp.Tests/MetaprogrammingTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -19,23 +19,35 @@ public partial class MetaprogrammingTests public void Execute() { - buffer[ThreadIds.X] = activation(ThreadIds.X); + this.buffer[ThreadIds.X] = this.activation(ThreadIds.X); } } public static class Activations { [ShaderMethod] - public static int Square(int x) => x * x; + public static int Square(int x) + { + return x * x; + } [ShaderMethod] - public static int AddOne(int x) => x + 1; + public static int AddOne(int x) + { + return x + 1; + } // Missing attribute - public static int Identity(int x) => x; + public static int Identity(int x) + { + return x; + } [ShaderMethod] - public static int FunctionWithConstants(int x) => (int)(x + FourAndAHalf); + public static int FunctionWithConstants(int x) + { + return (int)(x + FourAndAHalf); + } [ShaderMethod] public static Position FunctionWithTypes(int x) @@ -123,7 +135,7 @@ public partial class MetaprogrammingTests public void Execute() { - buffer[ThreadIds.X] = f2(f1(ThreadIds.X)); + this.buffer[ThreadIds.X] = this.f2(this.f1(ThreadIds.X)); } } @@ -154,7 +166,7 @@ public partial class MetaprogrammingTests public void Execute() { - buffer[ThreadIds.X] = MagicNumber + activation(ThreadIds.X); + this.buffer[ThreadIds.X] = MagicNumber + this.activation(ThreadIds.X); } } @@ -188,7 +200,7 @@ public partial class MetaprogrammingTests public void Execute() { - buffer[ThreadIds.X] = activation(ThreadIds.X); + this.buffer[ThreadIds.X] = this.activation(ThreadIds.X); } } @@ -217,7 +229,7 @@ public partial class MetaprogrammingTests public void Execute() { - buffer[ThreadIds.X] = Activations.AddOne(ThreadIds.X) + activation(ThreadIds.X); + this.buffer[ThreadIds.X] = Activations.AddOne(ThreadIds.X) + this.activation(ThreadIds.X); } } @@ -236,4 +248,4 @@ public partial class MetaprogrammingTests Assert.AreEqual(result[i], Activations.AddOne(i) + Activations.FunctionWithLocalFunctionAndStaticMethod(i)); } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Misc/ExternalStructType.cs b/tests/ComputeSharp.Tests/Misc/ExternalStructType.cs index b01444fd..c28c5c3a 100644 --- a/tests/ComputeSharp.Tests/Misc/ExternalStructType.cs +++ b/tests/ComputeSharp.Tests/Misc/ExternalStructType.cs @@ -1,4 +1,4 @@ -namespace ComputeSharp.Tests.Misc; +namespace ComputeSharp.Tests.Misc; /// /// An internal custom struct used to test semantic model information coming from different files (different syntax trees). @@ -21,4 +21,4 @@ internal struct ExternalStructType { return value.A + value.B; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Polyfills/RandomExtensions.cs b/tests/ComputeSharp.Tests/Polyfills/RandomExtensions.cs index 308c6724..01261a90 100644 --- a/tests/ComputeSharp.Tests/Polyfills/RandomExtensions.cs +++ b/tests/ComputeSharp.Tests/Polyfills/RandomExtensions.cs @@ -1,4 +1,4 @@ -#if !NETCOREAPP3_1_OR_GREATER +#if !NETCOREAPP3_1_OR_GREATER namespace System; @@ -22,4 +22,4 @@ internal static class RandomExtensions } } -#endif +#endif \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Properties/AssemblyInfo.cs b/tests/ComputeSharp.Tests/Properties/AssemblyInfo.cs index 8ed86d91..fb369378 100644 --- a/tests/ComputeSharp.Tests/Properties/AssemblyInfo.cs +++ b/tests/ComputeSharp.Tests/Properties/AssemblyInfo.cs @@ -1,3 +1,3 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; -[assembly: DoNotParallelize] +[assembly: DoNotParallelize] \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs index ab8901df..9893e27b 100644 --- a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs +++ b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs @@ -1,8 +1,10 @@ -using ComputeSharp; +using ComputeSharp; using ComputeSharp.Interop; using ComputeSharp.Tests.Misc; using Microsoft.VisualStudio.TestTools.UnitTesting; +#pragma warning disable IDE0008, IDE0022, IDE0009 + namespace ComputeSharp.Tests { [TestClass] @@ -28,7 +30,7 @@ namespace ComputeSharp.Tests float exp = Hlsl.Exp(dword * row_major[ThreadIds.X]); float log = Hlsl.Log(1 + exp); - row_major[ThreadIds.X] = log / dword + float2 + int2x2; + row_major[ThreadIds.X] = (log / dword) + float2 + int2x2; } } @@ -66,7 +68,7 @@ namespace ComputeSharp.Tests float log = Hlsl.Log(1 + exp); float temp = log + cellData.dword + cellData.int2x2; - row_major[ThreadIds.X] = log / dword + float2 + int2x2 + cbuffer.float2; + row_major[ThreadIds.X] = (log / dword) + float2 + int2x2 + cbuffer.float2 + temp; } } @@ -142,10 +144,10 @@ namespace ComputeSharp.Tests float s2 = s1 + this.intensity + Hlsl.Tan(s1 * this.scale); float t2 = t1 + this.intensity + Hlsl.Tan(t1 * this.scale); - float u2 = this.cos * s2 - this.sin * t2; - float v2 = this.sin * s2 - this.cos * t2; + float u2 = (this.cos * s2) - (this.sin * t2); + float v2 = (this.sin * s2) - (this.cos * t2); - row_major[ThreadIds.X] = log / dword + float2 + int2x2 + u2 + v2; + row_major[ThreadIds.X] = (log / dword) + float2 + int2x2 + u2 + v2; } } @@ -302,7 +304,7 @@ namespace ComputeSharp.Tests { for (var i = 0; i < 10; i++) { - buffer[ThreadIds.X * 10 + i] = i; + buffer[(ThreadIds.X * 10) + i] = i; } } } @@ -484,7 +486,7 @@ namespace ExternalNamespace { for (var i = 0; i < 10; i++) { - buffer[ThreadIds.X * 10 + i] = i; + buffer[(ThreadIds.X * 10) + i] = i; } } } @@ -495,4 +497,4 @@ namespace ExternalNamespace _ = ReflectionServices.GetShaderInfo(); } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/ShaderMembersTests.cs b/tests/ComputeSharp.Tests/ShaderMembersTests.cs index 5c83f514..17708f73 100644 --- a/tests/ComputeSharp.Tests/ShaderMembersTests.cs +++ b/tests/ComputeSharp.Tests/ShaderMembersTests.cs @@ -1,8 +1,10 @@ -using System.Linq; +using System.Linq; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; using Microsoft.VisualStudio.TestTools.UnitTesting; +#pragma warning disable IDE0009 + namespace ComputeSharp.Tests; [TestClass] @@ -174,4 +176,4 @@ public partial class ShaderMembersTests buffer[ThreadIds.X].B = true; } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/ShaderRewriterTests.cs b/tests/ComputeSharp.Tests/ShaderRewriterTests.cs index b1a57806..cf9791de 100644 --- a/tests/ComputeSharp.Tests/ShaderRewriterTests.cs +++ b/tests/ComputeSharp.Tests/ShaderRewriterTests.cs @@ -1,9 +1,11 @@ -using System; +using System; using System.Linq; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; using Microsoft.VisualStudio.TestTools.UnitTesting; +#pragma warning disable IDE0007, IDE0008, IDE0009 + namespace ComputeSharp.Tests; [TestClass] @@ -439,7 +441,7 @@ public partial class ShaderRewriterTests internal readonly partial struct ConstantsInShaderConstantFieldsShader : IComputeShader { public const float rot_angle = (float)(137.2 / 180.0 * Math.PI); - public const float rot_angle2 = rot_angle + (float)Math.E * 100; + public const float rot_angle2 = rot_angle + ((float)Math.E * 100); public const float sin = 42; public const float exponentLowercase = 1234567e-4f; public const float exponentUppercase = 1234567E-4f; @@ -741,7 +743,7 @@ public partial class ShaderRewriterTests for (int i = 0; i < source.Length; i++) { - Assert.AreEqual(i * 2 + 1, results1[i].value); + Assert.AreEqual((i * 2) + 1, results1[i].value); Assert.AreEqual(results1[i].value, results2[i]); } } @@ -769,4 +771,4 @@ public partial class ShaderRewriterTests destination[ThreadIds.X] = source[ThreadIds.X].AddAndGetSum(ThreadIds.X + 1); } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/ColorfulInfinity.cs b/tests/ComputeSharp.Tests/Shaders/Compute/ColorfulInfinity.cs index 2d70a855..74e2c88d 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/ColorfulInfinity.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/ColorfulInfinity.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute; +#pragma warning disable IDE0048, IDE0009 + +namespace ComputeSharp.SwapChain.Shaders.Compute; /// /// A shader creating an abstract and colorful animation. @@ -12,12 +14,12 @@ internal readonly partial struct ColorfulInfinity : IComputeShader /// /// The target texture. /// - public readonly IReadWriteNormalizedTexture2D texture; + private readonly IReadWriteNormalizedTexture2D texture; /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The total number of layers for the final animation. @@ -72,4 +74,4 @@ internal readonly partial struct ColorfulInfinity : IComputeShader texture[ThreadIds.XY] = color; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/ContouredLayers.cs b/tests/ComputeSharp.Tests/Shaders/Compute/ContouredLayers.cs index 7b33c396..230fc637 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/ContouredLayers.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/ContouredLayers.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute; +#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009 + +namespace ComputeSharp.SwapChain.Shaders.Compute; /// /// Constructing some concise contoured layers, then applying various edge and shading effects to produce some faux depth. @@ -11,17 +13,17 @@ internal readonly partial struct ContouredLayers : IComputeShader /// /// The target texture. /// - public readonly IReadWriteNormalizedTexture2D destination; + private readonly IReadWriteNormalizedTexture2D destination; /// /// The current time Hlsl.Since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The sampling texture. /// - public readonly IReadOnlyNormalizedTexture2D texture; + private readonly IReadOnlyNormalizedTexture2D texture; // float3 to float hash. private static float Hash21(float2 p) @@ -70,7 +72,7 @@ internal readonly partial struct ContouredLayers : IComputeShader private float Noise2D3G(float2 p) { float2 i = Hlsl.Floor(p); - + p -= i; float4 v = default; @@ -114,7 +116,7 @@ internal readonly partial struct ContouredLayers : IComputeShader private float3 GetColor(float2 p, float sh, float fi) { float3 tx = texture.Sample(p + Hash21(new float2(sh, fi))).XYZ; - + tx *= tx; float3 col; @@ -198,4 +200,4 @@ internal readonly partial struct ContouredLayers : IComputeShader destination[ThreadIds.XY] = new float4(Hlsl.Sqrt(Hlsl.Max(col, 0.0f)), 1); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/ExtrudedTruchetPattern.cs b/tests/ComputeSharp.Tests/Shaders/Compute/ExtrudedTruchetPattern.cs index 308b3c65..7ef2f2b5 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/ExtrudedTruchetPattern.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/ExtrudedTruchetPattern.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute; +#pragma warning disable IDE0048, IDE0011, IDE0009 + +namespace ComputeSharp.SwapChain.Shaders.Compute; /// /// A basic extruded square grid-based blobby Truchet pattern. @@ -11,12 +13,12 @@ internal readonly partial struct ExtrudedTruchetPattern : IComputeShader /// /// The target texture. /// - public readonly IReadWriteNormalizedTexture2D texture; + private readonly IReadWriteNormalizedTexture2D texture; /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// /// Curve shape - Round: 0, Semi-round: 1, Octagonal: 2, Superellipse: 3, Straight: 4. @@ -149,7 +151,6 @@ internal readonly partial struct ExtrudedTruchetPattern : IComputeShader return Hlsl.Max(shade, 0.0f); } - // I keep a collection of occlusion routines... OK, that sounded really nerdy. :) // Anyway, I like this one. I'm assuHlsl.Ming it's based on IQ's original. private float CalculateAO(in float3 p, in float3 n) @@ -297,4 +298,4 @@ internal readonly partial struct ExtrudedTruchetPattern : IComputeShader texture[ThreadIds.XY] = c; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/FourColorGradient.cs b/tests/ComputeSharp.Tests/Shaders/Compute/FourColorGradient.cs index 91309eea..4a88ee95 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/FourColorGradient.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/FourColorGradient.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute; +#pragma warning disable IDE0048, IDE0009 + +namespace ComputeSharp.SwapChain.Shaders.Compute; /// /// A shader which interpolates four different colors into a rotating gradient pattern. @@ -12,18 +14,18 @@ internal readonly partial struct FourColorGradient : IComputeShader /// /// The target texture. /// - public readonly IReadWriteNormalizedTexture2D texture; + private readonly IReadWriteNormalizedTexture2D texture; /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; // Colors to blend together - private static readonly float3 colorOne = new(0.999f, 0.999f, 0.999f); - private static readonly float3 colorTwo = new(0.999f, 0f, 0f); - private static readonly float3 colorThree = new(0f, 0.999f, 0f); - private static readonly float3 colorFour = new(0f, 0f, 0.999f); + private static readonly float3 ColorOne = new(0.999f, 0.999f, 0.999f); + private static readonly float3 ColorTwo = new(0.999f, 0f, 0f); + private static readonly float3 ColorThree = new(0f, 0.999f, 0f); + private static readonly float3 ColorFour = new(0f, 0f, 0.999f); /// /// Standard 2D rotation formula. @@ -67,14 +69,13 @@ internal readonly partial struct FourColorGradient : IComputeShader u.X), Hlsl.Lerp( Hlsl.Dot(-1.0f + 2.0f * Hash(i + new float2(0.0f, 1.0f)), f - new float2(0.0f, 1.0f)), - Hlsl.Dot(-1.0f + 2.0f * Hash(i + new float2(1.0f, 1.0f)), f - new float2(1.0f, 1.0f)), - u.X), + Hlsl.Dot(-1.0f + 2.0f * Hash(i + new float2(1.0f, 1.0f)), f - new float2(1.0f, 1.0f)), + u.X), u.Y); return 0.5f + 0.5f * n; } - /// public void Execute() { @@ -101,10 +102,10 @@ internal readonly partial struct FourColorGradient : IComputeShader tuv.Y += Hlsl.Sin(tuv.X * frequency * 1.5f + speed) / (amplitude * 0.5f); // Draw the image - float3 layer1 = Hlsl.Lerp(colorOne, colorTwo, Hlsl.SmoothStep(-0.3f, 0.2f, Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(-5.0f))).X)); - float3 layer2 = Hlsl.Lerp(colorThree, colorFour, Hlsl.SmoothStep(-0.3f, 0.2f, Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(-5.0f))).X)); + float3 layer1 = Hlsl.Lerp(ColorOne, ColorTwo, Hlsl.SmoothStep(-0.3f, 0.2f, Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(-5.0f))).X)); + float3 layer2 = Hlsl.Lerp(ColorThree, ColorFour, Hlsl.SmoothStep(-0.3f, 0.2f, Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(-5.0f))).X)); float3 col = Hlsl.Lerp(layer1, layer2, Hlsl.SmoothStep(0.5f, -0.3f, tuv.Y)); texture[ThreadIds.XY] = new float4(col, 1.0f); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/FractalTiling.cs b/tests/ComputeSharp.Tests/Shaders/Compute/FractalTiling.cs index c61fe0c0..a1a79924 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/FractalTiling.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/FractalTiling.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute; +#pragma warning disable IDE0048, IDE0009 + +namespace ComputeSharp.SwapChain.Shaders.Compute; /// /// A shader creating a fractal tiling animation. @@ -12,12 +14,12 @@ internal readonly partial struct FractalTiling : IComputeShader /// /// The target texture. /// - public readonly IReadWriteNormalizedTexture2D texture; + private readonly IReadWriteNormalizedTexture2D texture; /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// public void Execute() @@ -47,4 +49,4 @@ internal readonly partial struct FractalTiling : IComputeShader texture[ThreadIds.XY] = color; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs b/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs index 09e3e831..bd58fde3 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute; +#pragma warning disable IDE0048, IDE0009 + +namespace ComputeSharp.SwapChain.Shaders.Compute; /// /// A simple shader to get started with based on shadertoy new shader template. @@ -10,7 +12,7 @@ internal readonly partial struct HelloWorld : IPixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// public float4 Execute() @@ -24,4 +26,4 @@ internal readonly partial struct HelloWorld : IPixelShader // Output to screen return new(col, 1f); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/MengerJourney.cs b/tests/ComputeSharp.Tests/Shaders/Compute/MengerJourney.cs index 83f97d10..13d6cc1b 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/MengerJourney.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/MengerJourney.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute; +#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009 + +namespace ComputeSharp.SwapChain.Shaders.Compute; /// /// A shader creating a flythrough in a Menger system. @@ -11,12 +13,12 @@ internal readonly partial struct MengerJourney : IComputeShader /// /// The target texture. /// - public readonly IReadWriteNormalizedTexture2D texture; + private readonly IReadWriteNormalizedTexture2D texture; /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; private const int MaxSteps = 30; private const float MinimumDistance = 0.0009f; @@ -83,7 +85,9 @@ internal readonly partial struct MengerJourney : IComputeShader z = Hlsl.Abs(z); if (z.X < z.Y) { z.XY = z.YX; } + if (z.X < z.Z) { z.XZ = z.ZX; } + if (z.Y < z.Z) { z.YZ = z.ZY; } z = Scale * z - Offset * (Scale - 1.0f); @@ -102,7 +106,7 @@ internal readonly partial struct MengerJourney : IComputeShader /// /// Calculates the finite difference normal at a given position. /// - private float3 getNormal(in float3 pos) + private float3 GetNormal(in float3 pos) { float3 e = new(0.0f, NormalDistance, 0.0f); @@ -143,7 +147,7 @@ internal readonly partial struct MengerJourney : IComputeShader float smoothStep = steps + distance / MinimumDistance; float ao = 1.1f - smoothStep / MaxSteps; - float3 normal = getNormal(pos - dir * NormalDistance * 3.0f); + float3 normal = GetNormal(pos - dir * NormalDistance * 3.0f); float3 color = 1.0f; float3 light = GetLight(color, normal); @@ -171,4 +175,4 @@ internal readonly partial struct MengerJourney : IComputeShader texture[ThreadIds.XY] = RayMarch(camPos, rayDir, ThreadIds.XY); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/Octagrams.cs b/tests/ComputeSharp.Tests/Shaders/Compute/Octagrams.cs index 9c37ce7b..a2da9f97 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/Octagrams.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/Octagrams.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute; +#pragma warning disable IDE0048, IDE0009 + +namespace ComputeSharp.SwapChain.Shaders.Compute; /// /// A shader creating an octagram animation, inspired by arabesque. @@ -11,12 +13,12 @@ internal readonly partial struct Octagrams : IComputeShader /// /// The target texture. /// - public readonly IReadWriteNormalizedTexture2D texture; + private readonly IReadWriteNormalizedTexture2D texture; /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; private static float2x2 Rotate(float a) { @@ -125,4 +127,4 @@ internal readonly partial struct Octagrams : IComputeShader texture[ThreadIds.XY] = color; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/ProteanClouds.cs b/tests/ComputeSharp.Tests/Shaders/Compute/ProteanClouds.cs index 030ffdb3..81091c26 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/ProteanClouds.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/ProteanClouds.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute; +#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009 + +namespace ComputeSharp.SwapChain.Shaders.Compute; /// /// Fully procedural 3D animated volume with three evaluations per step (for shading). @@ -12,14 +14,14 @@ internal readonly partial struct ProteanClouds : IComputeShader /// /// The target texture. /// - public readonly IReadWriteNormalizedTexture2D texture; + private readonly IReadWriteNormalizedTexture2D texture; /// /// The current time Hlsl.Since the start of the application. /// - public readonly float time; + private readonly float time; - private static readonly float3x3 m3 = new float3x3(0.33338f, 0.56034f, -0.71817f, -0.87887f, 0.32651f, -0.15323f, 0.15162f, 0.69596f, 0.61339f) * 1.93f; + private static readonly float3x3 M3 = new float3x3(0.33338f, 0.56034f, -0.71817f, -0.87887f, 0.32651f, -0.15323f, 0.15162f, 0.69596f, 0.61339f) * 1.93f; private static float2x2 Rotate(in float a) { @@ -62,7 +64,7 @@ internal readonly partial struct ProteanClouds : IComputeShader z *= 0.57f; trk *= 1.4f; - p = Hlsl.Mul(p, m3); + p = Hlsl.Mul(p, M3); } d = Hlsl.Abs(d + prm1 * 3.0f) + prm1 * 0.3f - 2.5f + bsMo.Y; @@ -170,4 +172,4 @@ internal readonly partial struct ProteanClouds : IComputeShader texture[ThreadIds.XY] = new float4(col, 1.0f); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/PyramidPattern.cs b/tests/ComputeSharp.Tests/Shaders/Compute/PyramidPattern.cs index 778d3442..97b689a7 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/PyramidPattern.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/PyramidPattern.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute; +#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009 + +namespace ComputeSharp.SwapChain.Shaders.Compute; /// /// An offset grid of square-based pyramids whose tips have been offset according to an underlying directional noise field. @@ -12,12 +14,12 @@ internal readonly partial struct PyramidPattern : IComputeShader /// /// The target texture. /// - public readonly IReadWriteNormalizedTexture2D texture; + private readonly IReadWriteNormalizedTexture2D texture; /// /// The current time Hlsl.Since the start of the application. /// - public readonly float time; + private readonly float time; // Standard 2D rotation formula. private static float2x2 Rotate2x2(in float a) @@ -99,7 +101,6 @@ internal readonly partial struct PyramidPattern : IComputeShader return 1.0f - Hlsl.Max(p.X, p.Y); } - // Standard function-based bump mapping function, with an edge value included for good measure private float3 DoBumpMap(in float2 p, in float3 n, float bumpfactor, ref float edge) { @@ -121,7 +122,6 @@ internal readonly partial struct PyramidPattern : IComputeShader return Hlsl.Normalize(n + grad * bumpfactor); } - // A hatch-like algorithm, or a stipple... or some kind of textured pattern private float DoHatch(float2 p, float res) { @@ -179,4 +179,4 @@ internal readonly partial struct PyramidPattern : IComputeShader texture[ThreadIds.XY] = color; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/TriangleGridContouring.cs b/tests/ComputeSharp.Tests/Shaders/Compute/TriangleGridContouring.cs index 3457d626..74f9d9a8 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/TriangleGridContouring.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/TriangleGridContouring.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute; +#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009 + +namespace ComputeSharp.SwapChain.Shaders.Compute; /// /// Utilizing a 2D simplex grid to construct the isolines of a noise function. @@ -11,12 +13,12 @@ internal readonly partial struct TriangleGridContouring : IComputeShader /// /// The target texture. /// - public readonly IReadWriteNormalizedTexture2D texture; + private readonly IReadWriteNormalizedTexture2D texture; /// /// The current time Hlsl.Since the start of the application. /// - public readonly float time; + private readonly float time; // Standard 2D rotation formula. private static float2x2 Rotate2x2(in float a) @@ -62,7 +64,6 @@ internal readonly partial struct TriangleGridContouring : IComputeShader return Hlsl.Lerp(Hlsl.Lerp(v.X, v.Y, p.X), Hlsl.Lerp(v.Z, v.W, p.X), p.Y); } - // The isofunction. Just a Hlsl.Single noise function, but it can be more elaborate. private float IsoFunction(in float2 p) { @@ -80,7 +81,7 @@ internal readonly partial struct TriangleGridContouring : IComputeShader } // Based on IQ's signed distance to the segment joining "a" and "b". - private static float distEdge(float2 a, float2 b) + private static float DistEdge(float2 a, float2 b) { return Hlsl.Dot((a + b) * 0.5f, Hlsl.Normalize((b - a).YX * new float2(-1, 1))); } @@ -190,7 +191,7 @@ internal readonly partial struct TriangleGridContouring : IComputeShader float2 p1 = default; int iTh = IsoLine(n3, ip0, ip1, ip2, isovalue, i, ref p0, ref p1); - d = Hlsl.Min(d, distEdge(p - p0, p - p1)); + d = Hlsl.Min(d, DistEdge(p - p0, p - p1)); if (iTh == 7) { @@ -208,9 +209,7 @@ internal readonly partial struct TriangleGridContouring : IComputeShader int iTh2 = IsoLine(n3, ip0, ip1, ip2, isovalue, i, ref p0, ref p1); - d2 = Hlsl.Min(d2, distEdge(p - p0, p - p1)); - - float oldD2 = d2; + d2 = Hlsl.Min(d2, DistEdge(p - p0, p - p1)); if (iTh2 == 7) d2 = 0.0f; if (iTh == 7) d2 = 1e5f; @@ -281,4 +280,4 @@ internal readonly partial struct TriangleGridContouring : IComputeShader texture[ThreadIds.XY] = color; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/TwoTiledTruchet.cs b/tests/ComputeSharp.Tests/Shaders/Compute/TwoTiledTruchet.cs index 8d31b400..142da84e 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/TwoTiledTruchet.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/TwoTiledTruchet.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute; +#pragma warning disable IDE0048, IDE0009 + +namespace ComputeSharp.SwapChain.Shaders.Compute; /// /// A shader creating an animated two-tiles Truchet arrangement. @@ -11,12 +13,12 @@ internal readonly partial struct TwoTiledTruchet : IComputeShader /// /// The target texture. /// - public readonly IReadWriteNormalizedTexture2D texture; + private readonly IReadWriteNormalizedTexture2D texture; /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// /// Calculates the Truchet distance field. @@ -145,4 +147,4 @@ internal readonly partial struct TwoTiledTruchet : IComputeShader texture[ThreadIds.XY] = color; } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/ShadersTests.cs b/tests/ComputeSharp.Tests/ShadersTests.cs index 515a829d..3b0b2b39 100644 --- a/tests/ComputeSharp.Tests/ShadersTests.cs +++ b/tests/ComputeSharp.Tests/ShadersTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Reflection; using System.Runtime.InteropServices; @@ -169,9 +169,9 @@ public class ShadersTests texture.GraphicsDevice.For(texture.Width, texture.Height, (T)Activator.CreateInstance(typeof(T), texture, 0f)!); } - var action = new Action>(RunComputeShader); + Action> action = new(RunComputeShader); - action.Method.GetGenericMethodDefinition().MakeGenericMethod(shaderType).Invoke(null, new[] { texture }); + _ = action.Method.GetGenericMethodDefinition().MakeGenericMethod(shaderType).Invoke(null, new[] { texture }); } else { @@ -181,9 +181,9 @@ public class ShadersTests texture.GraphicsDevice.ForEach(texture, (T)Activator.CreateInstance(typeof(T), 0f)!); } - var action = new Action>(RunPixelShader); + Action> action = new(RunPixelShader); - action.Method.GetGenericMethodDefinition().MakeGenericMethod(shaderType).Invoke(null, new[] { texture }); + _ = action.Method.GetGenericMethodDefinition().MakeGenericMethod(shaderType).Invoke(null, new[] { texture }); } _ = image.DangerousTryGetSinglePixelMemory(out Memory memory); @@ -259,4 +259,4 @@ public class ShadersTests TolerantImageComparer.AssertEqual(expectedPath, actualPath, delta); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Texture1DTests.Pixels.cs b/tests/ComputeSharp.Tests/Texture1DTests.Pixels.cs index 4c60ce88..522f8af8 100644 --- a/tests/ComputeSharp.Tests/Texture1DTests.Pixels.cs +++ b/tests/ComputeSharp.Tests/Texture1DTests.Pixels.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Reflection; using System.Runtime.InteropServices; @@ -60,8 +60,8 @@ partial class Texture1DTests string imagingPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging"); string assetsPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Assets"); - using var original = Image.Load(Path.Combine(imagingPath, "city.jpg")); - using var sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png")); + using Image original = Image.Load(Path.Combine(imagingPath, "city.jpg")); + using Image sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png")); if (!original.DangerousTryGetSinglePixelMemory(out Memory originalMemory)) { @@ -82,8 +82,8 @@ partial class Texture1DTests Assert.Inconclusive(); } - using var sampledRow = Image.WrapMemory(sampledMemory.Slice(0, sampled.Width), sampled.Width, 1); - using var processedRow = Image.WrapMemory(processed.AsMemory().Cast(), sampled.Width, 1); + using Image sampledRow = Image.WrapMemory(sampledMemory.Slice(0, sampled.Width), sampled.Width, 1); + using Image processedRow = Image.WrapMemory(processed.AsMemory().Cast(), sampled.Width, 1); TolerantImageComparer.AssertEqual(sampledRow, processedRow, 0.0000017f); } @@ -96,7 +96,7 @@ partial class Texture1DTests public void Execute() { - destination[ThreadIds.X] = source.Sample(ThreadIds.Normalized.X); + this.destination[ThreadIds.X] = this.source.Sample(ThreadIds.Normalized.X); } } @@ -117,21 +117,20 @@ partial class Texture1DTests { using ReadWriteTexture1D texture = device.Get().AllocateReadWriteTexture1D(64); - using (var context = device.Get().CreateComputeContext()) - { - context.Transition(texture, ResourceState.ReadOnly); + using ComputeContext context = device.Get().CreateComputeContext(); - IReadOnlyNormalizedTexture1D wrapper1 = texture.AsReadOnly(); + context.Transition(texture, ResourceState.ReadOnly); - Assert.IsNotNull(wrapper1); + IReadOnlyNormalizedTexture1D wrapper1 = texture.AsReadOnly(); - IReadOnlyNormalizedTexture1D wrapper2 = texture.AsReadOnly(); + Assert.IsNotNull(wrapper1); - Assert.IsNotNull(wrapper2); - Assert.AreSame(wrapper1, wrapper2); + IReadOnlyNormalizedTexture1D wrapper2 = texture.AsReadOnly(); - context.Transition(texture, ResourceState.ReadWrite); - } + Assert.IsNotNull(wrapper2); + Assert.AreSame(wrapper1, wrapper2); + + context.Transition(texture, ResourceState.ReadWrite); } TestHelper.Run(Test, t, tPixel, device); @@ -162,4 +161,4 @@ partial class Texture1DTests TestHelper.Run(Test, t, tPixel, device); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Texture1DTests.cs b/tests/ComputeSharp.Tests/Texture1DTests.cs index d7fd68a3..21468a7c 100644 --- a/tests/ComputeSharp.Tests/Texture1DTests.cs +++ b/tests/ComputeSharp.Tests/Texture1DTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using ComputeSharp.Resources; using ComputeSharp.Tests.Attributes; @@ -370,7 +370,7 @@ public partial class Texture1DTests public void Execute() { - destination[ThreadIds.X] = source[ThreadIds.X]; + this.destination[ThreadIds.X] = this.source[ThreadIds.X]; } } @@ -378,7 +378,7 @@ public partial class Texture1DTests [AllDevices] public void Dispatch_ReadWriteTexture1D(Device device) { - int[] data = Enumerable.Range(0,256).ToArray(); + int[] data = Enumerable.Range(0, 256).ToArray(); using ReadWriteTexture1D source = device.Get().AllocateReadWriteTexture1D(data); using ReadWriteTexture1D destination = device.Get().AllocateReadWriteTexture1D(256); @@ -400,7 +400,7 @@ public partial class Texture1DTests public void Execute() { - destination[ThreadIds.X] = source[ThreadIds.X]; + this.destination[ThreadIds.X] = this.source[ThreadIds.X]; } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs index 956500ba..5fe9fec1 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs +++ b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Reflection; using ComputeSharp.Resources; @@ -59,14 +59,14 @@ partial class Texture2DTests string imagingPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging"); string assetsPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Assets"); - using var sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png")); + using Image sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png")); using ReadOnlyTexture2D source = device.Get().LoadReadOnlyTexture2D(Path.Combine(imagingPath, "city.jpg")); using ReadWriteTexture2D destination = device.Get().AllocateReadWriteTexture2D(sampled.Width, sampled.Height); device.Get().For(sampled.Width, sampled.Height, new SamplingComputeShader(source, destination)); - using var processed = destination.ToImage(); + using Image processed = destination.ToImage(); TolerantImageComparer.AssertEqual(sampled, processed, 0.0000017f); } @@ -79,7 +79,7 @@ partial class Texture2DTests public void Execute() { - destination[ThreadIds.XY] = source.Sample(ThreadIds.Normalized.XY); + this.destination[ThreadIds.XY] = this.source.Sample(ThreadIds.Normalized.XY); } } @@ -92,14 +92,14 @@ partial class Texture2DTests string imagingPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging"); string assetsPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Assets"); - using var sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png")); + using Image sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png")); using ReadOnlyTexture2D source = device.Get().LoadReadOnlyTexture2D(Path.Combine(imagingPath, "city.jpg")); using ReadWriteTexture2D destination = device.Get().AllocateReadWriteTexture2D(sampled.Width, sampled.Height); device.Get().ForEach(destination, new SamplingPixelShader(source)); - using var processed = destination.ToImage(); + using Image processed = destination.ToImage(); TolerantImageComparer.AssertEqual(sampled, processed, 0.0000017f); } @@ -111,7 +111,7 @@ partial class Texture2DTests public float4 Execute() { - return texture.Sample(ThreadIds.Normalized.XY); + return this.texture.Sample(ThreadIds.Normalized.XY); } } @@ -132,21 +132,20 @@ partial class Texture2DTests { using ReadWriteTexture2D texture = device.Get().AllocateReadWriteTexture2D(64, 64); - using (var context = device.Get().CreateComputeContext()) - { - context.Transition(texture, ResourceState.ReadOnly); + using ComputeContext context = device.Get().CreateComputeContext(); - IReadOnlyNormalizedTexture2D wrapper1 = texture.AsReadOnly(); + context.Transition(texture, ResourceState.ReadOnly); - Assert.IsNotNull(wrapper1); + IReadOnlyNormalizedTexture2D wrapper1 = texture.AsReadOnly(); - IReadOnlyNormalizedTexture2D wrapper2 = texture.AsReadOnly(); + Assert.IsNotNull(wrapper1); - Assert.IsNotNull(wrapper2); - Assert.AreSame(wrapper1, wrapper2); + IReadOnlyNormalizedTexture2D wrapper2 = texture.AsReadOnly(); - context.Transition(texture, ResourceState.ReadWrite); - } + Assert.IsNotNull(wrapper2); + Assert.AreSame(wrapper1, wrapper2); + + context.Transition(texture, ResourceState.ReadWrite); } TestHelper.Run(Test, t, tPixel, device); @@ -177,4 +176,4 @@ partial class Texture2DTests TestHelper.Run(Test, t, tPixel, device); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Texture2DTests.cs b/tests/ComputeSharp.Tests/Texture2DTests.cs index a72642a4..a9dec703 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.cs +++ b/tests/ComputeSharp.Tests/Texture2DTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using CommunityToolkit.HighPerformance; using ComputeSharp.Resources; @@ -435,7 +435,7 @@ public partial class Texture2DTests public void Execute() { - destination[ThreadIds.Y * 32 + ThreadIds.X] = source[ThreadIds.XY]; + this.destination[(ThreadIds.Y * 32) + ThreadIds.X] = this.source[ThreadIds.XY]; } } @@ -465,7 +465,7 @@ public partial class Texture2DTests public void Execute() { - destination[ThreadIds.XY] = source[ThreadIds.XY]; + this.destination[ThreadIds.XY] = this.source[ThreadIds.XY]; } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Texture3DTests.Pixels.cs b/tests/ComputeSharp.Tests/Texture3DTests.Pixels.cs index b482b4d3..5c36116d 100644 --- a/tests/ComputeSharp.Tests/Texture3DTests.Pixels.cs +++ b/tests/ComputeSharp.Tests/Texture3DTests.Pixels.cs @@ -1,4 +1,4 @@ -using System; +using System; using ComputeSharp.Resources; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; @@ -64,21 +64,20 @@ partial class Texture3DTests { using ReadWriteTexture3D texture = device.Get().AllocateReadWriteTexture3D(32, 32, 2); - using (var context = device.Get().CreateComputeContext()) - { - context.Transition(texture, ResourceState.ReadOnly); + using ComputeContext context = device.Get().CreateComputeContext(); - IReadOnlyNormalizedTexture3D wrapper1 = texture.AsReadOnly(); + context.Transition(texture, ResourceState.ReadOnly); - Assert.IsNotNull(wrapper1); + IReadOnlyNormalizedTexture3D wrapper1 = texture.AsReadOnly(); - IReadOnlyNormalizedTexture3D wrapper2 = texture.AsReadOnly(); + Assert.IsNotNull(wrapper1); - Assert.IsNotNull(wrapper2); - Assert.AreSame(wrapper1, wrapper2); + IReadOnlyNormalizedTexture3D wrapper2 = texture.AsReadOnly(); - context.Transition(texture, ResourceState.ReadWrite); - } + Assert.IsNotNull(wrapper2); + Assert.AreSame(wrapper1, wrapper2); + + context.Transition(texture, ResourceState.ReadWrite); } TestHelper.Run(Test, t, tPixel, device); @@ -109,4 +108,4 @@ partial class Texture3DTests TestHelper.Run(Test, t, tPixel, device); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Texture3DTests.cs b/tests/ComputeSharp.Tests/Texture3DTests.cs index 80dbcdbe..62c4f4e7 100644 --- a/tests/ComputeSharp.Tests/Texture3DTests.cs +++ b/tests/ComputeSharp.Tests/Texture3DTests.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.Linq; using CommunityToolkit.HighPerformance; +using CommunityToolkit.HighPerformance.Enumerables; using ComputeSharp.Resources; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; @@ -183,7 +184,7 @@ public partial class Texture3DTests fixed (int* p = array) { - foreach (var item in new Span(p, array.Length).Enumerate()) + foreach (SpanEnumerable.Item item in new Span(p, array.Length).Enumerate()) { item.Value = item.Index; } @@ -539,7 +540,7 @@ public partial class Texture3DTests public void Execute() { - destination[ThreadIds.Z * 32 * 32 + ThreadIds.Y * 32 + ThreadIds.X] = source[ThreadIds.XYZ]; + this.destination[(ThreadIds.Z * 32 * 32) + (ThreadIds.Y * 32) + ThreadIds.X] = this.source[ThreadIds.XYZ]; } } @@ -569,7 +570,7 @@ public partial class Texture3DTests public void Execute() { - destination[ThreadIds.XYZ] = source[ThreadIds.XYZ]; + this.destination[ThreadIds.XYZ] = this.source[ThreadIds.XYZ]; } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/TransferBufferTests.cs b/tests/ComputeSharp.Tests/TransferBufferTests.cs index 62900553..d7c76232 100644 --- a/tests/ComputeSharp.Tests/TransferBufferTests.cs +++ b/tests/ComputeSharp.Tests/TransferBufferTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Runtime.CompilerServices; using CommunityToolkit.HighPerformance; @@ -221,4 +221,4 @@ public partial class TransferBufferTests Assert.AreEqual(source.Length, readBackBuffer.Length); Assert.IsTrue(source.AsSpan(sourceOffset, count).SequenceEqual(readBackBuffer.Span.Slice(destinationOffset, count))); } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/TransferTexture1DTests.cs b/tests/ComputeSharp.Tests/TransferTexture1DTests.cs index 61529276..87b5565d 100644 --- a/tests/ComputeSharp.Tests/TransferTexture1DTests.cs +++ b/tests/ComputeSharp.Tests/TransferTexture1DTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Runtime.CompilerServices; using CommunityToolkit.HighPerformance; @@ -172,4 +172,4 @@ public partial class TransferTexture1DTests Assert.IsTrue(sourceRow.SequenceEqual(destinationRow)); } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/TransferTexture2DTests.cs b/tests/ComputeSharp.Tests/TransferTexture2DTests.cs index 82fe3d4d..649bce97 100644 --- a/tests/ComputeSharp.Tests/TransferTexture2DTests.cs +++ b/tests/ComputeSharp.Tests/TransferTexture2DTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Runtime.CompilerServices; using CommunityToolkit.HighPerformance; @@ -191,4 +191,4 @@ public partial class TransferTexture2DTests } } } -} +} \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/TransferTexture3DTests.cs b/tests/ComputeSharp.Tests/TransferTexture3DTests.cs index 54c0fa53..d5408fce 100644 --- a/tests/ComputeSharp.Tests/TransferTexture3DTests.cs +++ b/tests/ComputeSharp.Tests/TransferTexture3DTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Runtime.CompilerServices; using CommunityToolkit.HighPerformance; @@ -87,7 +87,7 @@ public partial class TransferTexture3DTests { for (int j = 0; j < uploadTexture3D.Height; j++) { - new Random(i * 5381 + j).NextBytes(uploadTexture3D.View.GetRowSpan(j, i).AsBytes()); + new Random((i * 5381) + j).NextBytes(uploadTexture3D.View.GetRowSpan(j, i).AsBytes()); } } @@ -131,7 +131,7 @@ public partial class TransferTexture3DTests { for (int j = 0; j < uploadTexture3D.Height; j++) { - new Random(i * 5381 + j).NextBytes(uploadTexture3D.View.GetRowSpan(j, i).AsBytes()); + new Random((i * 5381) + j).NextBytes(uploadTexture3D.View.GetRowSpan(j, i).AsBytes()); } } @@ -226,4 +226,4 @@ public partial class TransferTexture3DTests } } } -} +} \ No newline at end of file