Added specific writeable and readonly buffer types

このコミットが含まれているのは:
Sergio Pedri committed 2019-08-12 13:48:35 +02:00
1 親 acf2aa9fce
コミット 13ee3e9422
7ファイル変更
+74 -31

検索条件に一致するファイルはありません

+5 -5
ファイルの表示
@@ -27,7 +27,7 @@ namespace ComputeSharp.Shaders.Mappings
[typeof(Vector4).FullName] = "float4",
[typeof(Matrix4x4).FullName] = "float4x4",
[typeof(ThreadIds).FullName] = "uint3",
[typeof(Buffer<>).FullName] = "RWBuffer"
[typeof(ReadWriteBuffer<>).FullName] = "RWBuffer"
};
/// <summary>
@@ -54,13 +54,13 @@ namespace ComputeSharp.Shaders.Mappings
type == typeof(Matrix4x4);
/// <summary>
/// Checks whether or not the input type is a <see cref="Buffer{T}"/> value
/// Checks whether or not the input type is a <see cref="ReadWriteBuffer{T}"/> value
/// </summary>
/// <param name="type">The input <see cref="Type"/> instance to check</param>
/// <returns>A <see langword="bool"/> indicating whether the input <see cref="Type"/> is in fact a <see cref="Buffer{T}"/> instance</returns>
/// <returns>A <see langword="bool"/> indicating whether the input <see cref="Type"/> is in fact a <see cref="ReadWriteBuffer{T}"/> instance</returns>
[Pure]
public static bool IsBufferType(Type type) => type.IsGenericType &&
type.GetGenericTypeDefinition() == typeof(Buffer<>);
public static bool IsReadWriteBufferType(Type type) => type.IsGenericType &&
type.GetGenericTypeDefinition() == typeof(ReadWriteBuffer<>);
/// <summary>
/// Checks whether or not a given <see cref="Type"/> is an HLSL known type
+1 -3
ファイルの表示
@@ -4,7 +4,6 @@ using System.Diagnostics.Contracts;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using ComputeSharp.Graphics.Buffers;
using ComputeSharp.Graphics.Buffers.Abstract;
using ComputeSharp.Shaders.Mappings;
using ComputeSharp.Shaders.Renderer.Models.Fields;
@@ -116,8 +115,7 @@ namespace ComputeSharp.Shaders
FieldInfoBase processedFieldInfo;
// Read write buffer
if (HlslKnownTypes.IsBufferType(fieldType) &&
(HeapType)fieldType.GetProperty(nameof(Buffer<byte>.HeapType)).GetValue(fieldValue) == HeapType.Default)
if (HlslKnownTypes.IsReadWriteBufferType(fieldType))
{
// Root parameter for a read write buffer
DescriptorRange range = new DescriptorRange(DescriptorRangeType.UnorderedAccessView, 1, readWriteBuffersCount);