Code refactoring
このコミットが含まれているのは:
1 親
508cdc3911
コミット
0cc9acb923
7ファイル変更
+14
-14
検索条件に一致するファイルはありません
@@ -3,7 +3,7 @@
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that contains info on a shader buffer field
|
||||
/// </summary>
|
||||
internal abstract class HlslBufferInfo : FieldInfo
|
||||
internal abstract class HlslBufferInfo : CapturedFieldInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the index of the current buffer, relative to its own type
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
namespace ComputeSharp.Shaders.Renderer.Models.Fields.Abstract
|
||||
namespace ComputeSharp.Shaders.Renderer.Models.Fields
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that contains info on a shader field
|
||||
/// </summary>
|
||||
internal abstract class FieldInfo
|
||||
internal class CapturedFieldInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the current field
|
||||
@@ -16,11 +16,11 @@
|
||||
public string FieldName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="FieldInfo"/> instance with the specified parameters
|
||||
/// Creates a new <see cref="CapturedFieldInfo"/> instance with the specified parameters
|
||||
/// </summary>
|
||||
/// <param name="fieldType">The type of the current field</param>
|
||||
/// <param name="fieldName">The name of the current field</param>
|
||||
protected FieldInfo(string fieldType, string fieldName)
|
||||
public CapturedFieldInfo(string fieldType, string fieldName)
|
||||
{
|
||||
FieldType = fieldType;
|
||||
FieldName = fieldName;
|
||||
@@ -8,7 +8,7 @@ namespace ComputeSharp.Shaders.Renderer.Models.Fields
|
||||
internal sealed class ConstantBufferFieldInfo : HlslBufferInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets whether or not the current <see cref="FieldInfo"/> instance represents a constant buffer (always <see langword="true"/>)
|
||||
/// Gets whether or not the current <see cref="CapturedFieldInfo"/> instance represents a constant buffer (always <see langword="true"/>)
|
||||
/// </summary>
|
||||
public bool IsConstantBuffer { get; } = true;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace ComputeSharp.Shaders.Renderer.Models.Fields
|
||||
internal sealed class ReadOnlyBufferFieldInfo : HlslBufferInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets whether or not the current <see cref="FieldInfo"/> instance represents a readonly buffer (always <see langword="true"/>)
|
||||
/// Gets whether or not the current <see cref="CapturedFieldInfo"/> instance represents a readonly buffer (always <see langword="true"/>)
|
||||
/// </summary>
|
||||
public bool IsReadOnlyBuffer { get; } = true;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace ComputeSharp.Shaders.Renderer.Models.Fields
|
||||
internal sealed class ReadWriteBufferFieldInfo : HlslBufferInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets whether or not the current <see cref="FieldInfo"/> instance represents a read write buffer (always <see langword="true"/>)
|
||||
/// Gets whether or not the current <see cref="CapturedFieldInfo"/> instance represents a read write buffer (always <see langword="true"/>)
|
||||
/// </summary>
|
||||
public bool IsReadWriteBuffer { get; } = true;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using ComputeSharp.Shaders.Renderer.Models.Fields;
|
||||
using ComputeSharp.Shaders.Renderer.Models.Fields.Abstract;
|
||||
|
||||
#pragma warning disable CS8618 // Non-nullable field is uninitialized
|
||||
@@ -13,7 +14,7 @@ namespace ComputeSharp.Shaders.Renderer.Models
|
||||
/// <summary>
|
||||
/// Gets the list of fields being present in the current shader
|
||||
/// </summary>
|
||||
public IReadOnlyList<FieldInfo> FieldsList { get; set; }
|
||||
public IReadOnlyList<CapturedFieldInfo> FieldsList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the index for the constant buffer with the info on the target number of iterations on the X, Y and Z axes
|
||||
|
||||
@@ -9,7 +9,6 @@ using ComputeSharp.Shaders.Renderer.Models.Fields;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using SharpDX.Direct3D12;
|
||||
using FieldInfo = ComputeSharp.Shaders.Renderer.Models.Fields.Abstract.FieldInfo;
|
||||
|
||||
#pragma warning disable CS8618 // Non-nullable field is uninitialized
|
||||
|
||||
@@ -71,12 +70,12 @@ namespace ComputeSharp.Shaders.Translation
|
||||
/// </summary>
|
||||
public IReadOnlyList<(int Index, object Value)> CapturedConstantBufferValues => _CapturedConstantBufferValues;
|
||||
|
||||
private readonly List<FieldInfo> _FieldsInfo = new List<FieldInfo>();
|
||||
private readonly List<CapturedFieldInfo> _FieldsInfo = new List<CapturedFieldInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of <see cref="FieldInfo"/> items for the shader fields
|
||||
/// Gets the collection of <see cref="CapturedFieldInfo"/> items for the shader fields
|
||||
/// </summary>
|
||||
public IReadOnlyList<FieldInfo> FieldsInfo => _FieldsInfo;
|
||||
public IReadOnlyList<CapturedFieldInfo> FieldsInfo => _FieldsInfo;
|
||||
|
||||
/// <summary>
|
||||
/// gets the number of constant buffers in the current instance
|
||||
@@ -127,7 +126,7 @@ namespace ComputeSharp.Shaders.Translation
|
||||
Type fieldType = fieldInfo.FieldType;
|
||||
string fieldName = fieldInfo.Name;
|
||||
object fieldValue = fieldInfo.GetValue(ShaderInstance);
|
||||
FieldInfo processedFieldInfo;
|
||||
CapturedFieldInfo processedFieldInfo;
|
||||
|
||||
// Constant buffer
|
||||
if (HlslKnownTypes.IsConstantBufferType(fieldType))
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする