From 6a83c6827d7cc1c3bc181cde928bda123dd951c6 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 8 May 2022 21:49:52 +0200 Subject: [PATCH] Rename input description LevelOfDetailCount parameter Closes #270 --- ...rGenerator.CreateLoadInputDescriptionsMethod.cs | 4 ++-- .../Attributes/D2DInputDescriptionAttribute.cs | 2 +- .../Shaders/Interop/D2D1InputDescription.cs | 8 ++++---- .../PixelShaderEffect.ID2D1DrawTransformMethods.cs | 2 +- .../D2D1InteropServicesTests.cs | 14 +++++++------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.cs index 44f3fc46..05000c74 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.cs @@ -45,9 +45,9 @@ partial class ID2D1ShaderGenerator int index = (int)attributeData.ConstructorArguments[0].Value!; D2D1Filter filter = (D2D1Filter)attributeData.ConstructorArguments[1].Value!; - _ = attributeData.TryGetNamedArgument("LevelOfDetail", out int levelOfDetail); + _ = attributeData.TryGetNamedArgument("LevelOfDetailCount", out int levelOfDetailCount); - inputDescriptionsBuilder.Add(new InputDescription((uint)index, filter, levelOfDetail)); + inputDescriptionsBuilder.Add(new InputDescription((uint)index, filter, levelOfDetailCount)); } break; default: diff --git a/src/ComputeSharp.D2D1/Attributes/D2DInputDescriptionAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DInputDescriptionAttribute.cs index 8bafd59e..75c2fe3a 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DInputDescriptionAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DInputDescriptionAttribute.cs @@ -37,5 +37,5 @@ public sealed class D2DInputDescriptionAttribute : Attribute /// /// Gets the mip level to retrieve from the upstream transform, if specified. /// - public int LevelOfDetail { get; init; } + public int LevelOfDetailCount { get; init; } } diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1InputDescription.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1InputDescription.cs index 4566f288..9c1c04c9 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1InputDescription.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1InputDescription.cs @@ -16,12 +16,12 @@ public readonly struct D2D1InputDescription /// /// The index of the resource the description belongs to. /// The type of filter to apply to the input texture. - /// The mip level to retrieve from the upstream transform, if specified. - internal D2D1InputDescription(int index, D2D1Filter filter, int levelOfDetail) + /// The mip level to retrieve from the upstream transform, if specified. + internal D2D1InputDescription(int index, D2D1Filter filter, int levelOfDetailCount) { Index = index; Filter = filter; - LevelOfDetail = levelOfDetail; + LevelOfDetailCount = levelOfDetailCount; } /// @@ -37,5 +37,5 @@ public readonly struct D2D1InputDescription /// /// Gets the mip level to retrieve from the upstream transform, if specified. /// - public int LevelOfDetail { get; } + public int LevelOfDetailCount { get; } } diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs index 9af7e953..89b281e5 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs @@ -340,7 +340,7 @@ partial struct PixelShaderEffect D2D1_INPUT_DESCRIPTION d2D1InputDescription; d2D1InputDescription.filter = (D2D1_FILTER)inputDescription.Filter; - d2D1InputDescription.levelOfDetailCount = (uint)inputDescription.LevelOfDetail; + d2D1InputDescription.levelOfDetailCount = (uint)inputDescription.LevelOfDetailCount; hresult = drawInfo->SetInputDescription((uint)inputDescription.Index, d2D1InputDescription); diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1InteropServicesTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1InteropServicesTests.cs index 9b9f24c2..b5fbbdd4 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1InteropServicesTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1InteropServicesTests.cs @@ -128,23 +128,23 @@ public partial class D2D1InteropServicesTests Assert.AreEqual(span[0].Index, 0); Assert.AreEqual(span[0].Filter, D2D1Filter.MinPointMagLinearMipPoint); - Assert.AreEqual(span[0].LevelOfDetail, 0); + Assert.AreEqual(span[0].LevelOfDetailCount, 0); Assert.AreEqual(span[1].Index, 1); Assert.AreEqual(span[1].Filter, D2D1Filter.Anisotropic); - Assert.AreEqual(span[1].LevelOfDetail, 0); + Assert.AreEqual(span[1].LevelOfDetailCount, 0); Assert.AreEqual(span[2].Index, 2); Assert.AreEqual(span[2].Filter, D2D1Filter.MinLinearMagPointMinLinear); - Assert.AreEqual(span[2].LevelOfDetail, 4); + Assert.AreEqual(span[2].LevelOfDetailCount, 4); Assert.AreEqual(span[3].Index, 5); Assert.AreEqual(span[3].Filter, D2D1Filter.MinMagPointMipLinear); - Assert.AreEqual(span[3].LevelOfDetail, 0); + Assert.AreEqual(span[3].LevelOfDetailCount, 0); Assert.AreEqual(span[4].Index, 6); Assert.AreEqual(span[4].Filter, D2D1Filter.MinPointMagMipLinear); - Assert.AreEqual(span[4].LevelOfDetail, 3); + Assert.AreEqual(span[4].LevelOfDetailCount, 3); } [D2DInputCount(7)] @@ -156,9 +156,9 @@ public partial class D2D1InteropServicesTests [D2DInputSimple(6)] [D2DInputDescription(0, D2D1Filter.MinPointMagLinearMipPoint)] [D2DInputDescription(1, D2D1Filter.Anisotropic)] - [D2DInputDescription(2, D2D1Filter.MinLinearMagPointMinLinear, LevelOfDetail = 4)] + [D2DInputDescription(2, D2D1Filter.MinLinearMagPointMinLinear, LevelOfDetailCount = 4)] [D2DInputDescription(5, D2D1Filter.MinMagPointMipLinear)] - [D2DInputDescription(6, D2D1Filter.MinPointMagMipLinear, LevelOfDetail = 3)] + [D2DInputDescription(6, D2D1Filter.MinPointMagMipLinear, LevelOfDetailCount = 3)] partial struct ShaderWithInputDescriptions : ID2D1PixelShader { public Float4 Execute()