From 5ffa20e548e3b02d94f86a88ae92447796f1e655 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 16 Nov 2020 17:06:04 +0100 Subject: [PATCH] Minor code style tweaks --- .../Models/Fields/Abstract/HlslBufferInfo.cs | 25 ++++++------ .../Models/Fields/CapturedFieldInfo.cs | 40 +++++++++---------- .../Models/Fields/ConstantBufferFieldInfo.cs | 22 +++++----- .../Models/Fields/ReadOnlyBufferFieldInfo.cs | 22 +++++----- .../Models/Fields/ReadWriteBufferFieldInfo.cs | 22 +++++----- 5 files changed, 69 insertions(+), 62 deletions(-) diff --git a/src/ComputeSharp.Shaders/Renderer/Models/Fields/Abstract/HlslBufferInfo.cs b/src/ComputeSharp.Shaders/Renderer/Models/Fields/Abstract/HlslBufferInfo.cs index 85eaee9c..165d224d 100644 --- a/src/ComputeSharp.Shaders/Renderer/Models/Fields/Abstract/HlslBufferInfo.cs +++ b/src/ComputeSharp.Shaders/Renderer/Models/Fields/Abstract/HlslBufferInfo.cs @@ -3,25 +3,26 @@ namespace ComputeSharp.Shaders.Renderer.Models.Fields.Abstract { /// - /// A that contains info on a shader buffer field + /// A that contains info on a shader buffer field. /// internal abstract class HlslBufferInfo : CapturedFieldInfo { /// - /// Gets or sets the index of the current buffer, relative to its own type + /// Creates a new instance with the specified parameters. /// - public int BufferIndex { get; set; } - - /// - /// Creates a new instance with the specified parameters - /// - /// The type of the current field in the C# source - /// The type of the current field in the HLSL shader - /// The name of the current field - /// The index of the current buffer field - protected HlslBufferInfo(Type fieldCsharpType, string fieldHlslType, string fieldName, int bufferIndex) : base(fieldCsharpType, fieldHlslType, fieldName) + /// The type of the current field in the C# source. + /// The type of the current field in the HLSL shader. + /// The name of the current field. + /// The index of the current buffer field. + protected HlslBufferInfo(Type fieldCsharpType, string fieldHlslType, string fieldName, int bufferIndex) + : base(fieldCsharpType, fieldHlslType, fieldName) { BufferIndex = bufferIndex; } + + /// + /// Gets or sets the index of the current buffer, relative to its own type. + /// + public int BufferIndex { get; set; } } } diff --git a/src/ComputeSharp.Shaders/Renderer/Models/Fields/CapturedFieldInfo.cs b/src/ComputeSharp.Shaders/Renderer/Models/Fields/CapturedFieldInfo.cs index 091f17d9..9548826b 100644 --- a/src/ComputeSharp.Shaders/Renderer/Models/Fields/CapturedFieldInfo.cs +++ b/src/ComputeSharp.Shaders/Renderer/Models/Fields/CapturedFieldInfo.cs @@ -4,36 +4,36 @@ using System; namespace ComputeSharp.Shaders.Renderer.Models.Fields { /// - /// A that contains info on a shader field + /// A that contains info on a shader field. /// internal class CapturedFieldInfo { /// - /// Gets the type of the current field in the C# source + /// Creates a new instance with the specified parameters. /// - public string FieldCsharpType { get; } - - /// - /// Gets the type of the current field in the HLSL shader - /// - public string FieldHlslType { get; } - - /// - /// Gets the name to use for the current field - /// - public string FieldName { get; } - - /// - /// Creates a new instance with the specified parameters - /// - /// The type of the current field in the C# source - /// The type of the current field in the HLSL shader - /// The name to use for the current field + /// The type of the current field in the C# source. + /// The type of the current field in the HLSL shader. + /// The name to use for the current field. public CapturedFieldInfo(Type fieldCsharpType, string fieldHlslType, string fieldName) { FieldCsharpType = fieldCsharpType.ToFriendlyString(); FieldHlslType = fieldHlslType; FieldName = fieldName; } + + /// + /// Gets the type of the current field in the C# source. + /// + public string FieldCsharpType { get; } + + /// + /// Gets the type of the current field in the HLSL shader. + /// + public string FieldHlslType { get; } + + /// + /// Gets the name to use for the current field. + /// + public string FieldName { get; } } } diff --git a/src/ComputeSharp.Shaders/Renderer/Models/Fields/ConstantBufferFieldInfo.cs b/src/ComputeSharp.Shaders/Renderer/Models/Fields/ConstantBufferFieldInfo.cs index a2554735..bd9e87c9 100644 --- a/src/ComputeSharp.Shaders/Renderer/Models/Fields/ConstantBufferFieldInfo.cs +++ b/src/ComputeSharp.Shaders/Renderer/Models/Fields/ConstantBufferFieldInfo.cs @@ -4,23 +4,25 @@ using ComputeSharp.Shaders.Renderer.Models.Fields.Abstract; namespace ComputeSharp.Shaders.Renderer.Models.Fields { /// - /// A that contains info on a constant buffer field + /// A that contains info on a constant buffer field. /// internal sealed class ConstantBufferFieldInfo : HlslBufferInfo { /// - /// Gets whether or not the current instance represents a constant buffer (always ) + /// Creates a new instance with the specified parameters. /// - public bool IsConstantBuffer { get; } = true; + /// The type of the current field in the C# source. + /// The type of the current field in the HLSL shader. + /// The name of the current field. + /// The index of the current constant buffer field. + public ConstantBufferFieldInfo(Type fieldCsharpType, string fieldHlslType, string fieldName, int bufferIndex) + : base(fieldCsharpType, fieldHlslType, fieldName, bufferIndex) + { + } /// - /// Creates a new instance with the specified parameters + /// Gets whether or not the current instance represents a constant buffer (always ). /// - /// The type of the current field in the C# source - /// The type of the current field in the HLSL shader - /// The name of the current field - /// The index of the current constant buffer field - public ConstantBufferFieldInfo(Type fieldCsharpType, string fieldHlslType, string fieldName, int bufferIndex) - : base(fieldCsharpType, fieldHlslType, fieldName, bufferIndex) { } + public bool IsConstantBuffer { get; } = true; } } diff --git a/src/ComputeSharp.Shaders/Renderer/Models/Fields/ReadOnlyBufferFieldInfo.cs b/src/ComputeSharp.Shaders/Renderer/Models/Fields/ReadOnlyBufferFieldInfo.cs index b5ecb59c..3323a8d6 100644 --- a/src/ComputeSharp.Shaders/Renderer/Models/Fields/ReadOnlyBufferFieldInfo.cs +++ b/src/ComputeSharp.Shaders/Renderer/Models/Fields/ReadOnlyBufferFieldInfo.cs @@ -4,23 +4,25 @@ using ComputeSharp.Shaders.Renderer.Models.Fields.Abstract; namespace ComputeSharp.Shaders.Renderer.Models.Fields { /// - /// A that contains info on a readonly buffer field + /// A that contains info on a readonly buffer field. /// internal sealed class ReadOnlyBufferFieldInfo : HlslBufferInfo { /// - /// Gets whether or not the current instance represents a readonly buffer (always ) + /// Creates a new instance with the specified parameters. /// - public bool IsReadOnlyBuffer { get; } = true; + /// The type of the current field in the C# source. + /// The type of the current field in the HLSL shader. + /// The name of the current field. + /// The index of the current readonly buffer field. + public ReadOnlyBufferFieldInfo(Type fieldCsharpType, string fieldHlslType, string fieldName, int bufferIndex) + : base(fieldCsharpType, fieldHlslType, fieldName, bufferIndex) + { + } /// - /// Creates a new instance with the specified parameters + /// Gets whether or not the current instance represents a readonly buffer (always ). /// - /// The type of the current field in the C# source - /// The type of the current field in the HLSL shader - /// The name of the current field - /// The index of the current readonly buffer field - public ReadOnlyBufferFieldInfo(Type fieldCsharpType, string fieldHlslType, string fieldName, int bufferIndex) - : base(fieldCsharpType, fieldHlslType, fieldName, bufferIndex) { } + public bool IsReadOnlyBuffer { get; } = true; } } diff --git a/src/ComputeSharp.Shaders/Renderer/Models/Fields/ReadWriteBufferFieldInfo.cs b/src/ComputeSharp.Shaders/Renderer/Models/Fields/ReadWriteBufferFieldInfo.cs index 86c04a47..955b17b1 100644 --- a/src/ComputeSharp.Shaders/Renderer/Models/Fields/ReadWriteBufferFieldInfo.cs +++ b/src/ComputeSharp.Shaders/Renderer/Models/Fields/ReadWriteBufferFieldInfo.cs @@ -4,23 +4,25 @@ using ComputeSharp.Shaders.Renderer.Models.Fields.Abstract; namespace ComputeSharp.Shaders.Renderer.Models.Fields { /// - /// A that contains info on a read write buffer field + /// A that contains info on a read write buffer field. /// internal sealed class ReadWriteBufferFieldInfo : HlslBufferInfo { /// - /// Gets whether or not the current instance represents a read write buffer (always ) + /// Creates a new instance with the specified parameters. /// - public bool IsReadWriteBuffer { get; } = true; + /// The type of the current field in the C# source. + /// The type of the current field in the HLSL shader. + /// The name of the current field. + /// The index of the current read write buffer field. + public ReadWriteBufferFieldInfo(Type fieldCsharpType, string fieldHlslType, string fieldName, int bufferIndex) + : base(fieldCsharpType, fieldHlslType, fieldName, bufferIndex) + { + } /// - /// Creates a new instance with the specified parameters + /// Gets whether or not the current instance represents a read write buffer (always ). /// - /// The type of the current field in the C# source - /// The type of the current field in the HLSL shader - /// The name of the current field - /// The index of the current read write buffer field - public ReadWriteBufferFieldInfo(Type fieldCsharpType, string fieldHlslType, string fieldName, int bufferIndex) - : base(fieldCsharpType, fieldHlslType, fieldName, bufferIndex) { } + public bool IsReadWriteBuffer { get; } = true; } }