Fix warnings for new analyzer in D2D1 unit tests

このコミットが含まれているのは:
Sergio Pedri committed 2023-11-24 00:32:27 +01:00
1 親 43b79bdf4b
コミット ec42352125
8ファイル変更
+50 -61

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

+8 -8
ファイルの表示
@@ -122,9 +122,9 @@ public partial class D2D1PixelShaderEffectTests
[D2DRequiresScenePosition]
[D2DGeneratedPixelShaderDescriptor]
[AutoConstructor]
internal partial struct NullConstantBufferShader : ID2D1PixelShader
internal readonly partial struct NullConstantBufferShader : ID2D1PixelShader
{
private float dummy;
private readonly float dummy;
public float4 Execute()
{
@@ -154,13 +154,13 @@ public partial class D2D1PixelShaderEffectTests
[D2DRequiresScenePosition]
[D2DGeneratedPixelShaderDescriptor]
[AutoConstructor]
internal partial struct ConstantBufferSizeTestShader : ID2D1PixelShader
internal readonly partial struct ConstantBufferSizeTestShader : ID2D1PixelShader
{
private float a;
private float b;
private float3 c;
private int d;
private int e;
private readonly float a;
private readonly float b;
private readonly float3 c;
private readonly int d;
private readonly int e;
public float4 Execute()
{
+8 -8
ファイルの表示
@@ -336,10 +336,10 @@ namespace ComputeSharp.D2D1.Tests
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
[D2DGeneratedPixelShaderDescriptor]
[AutoConstructor]
internal partial struct ShaderWithJustOneResourceTextures : ID2D1PixelShader
internal readonly partial struct ShaderWithJustOneResourceTextures : ID2D1PixelShader
{
[D2DResourceTextureIndex(0)]
D2D1ResourceTexture1D<float> myTexture;
readonly D2D1ResourceTexture1D<float> myTexture;
public Float4 Execute()
{
@@ -355,21 +355,21 @@ namespace ComputeSharp.D2D1.Tests
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
[D2DGeneratedPixelShaderDescriptor]
[AutoConstructor]
internal partial struct ShaderWithResourceTextures : ID2D1PixelShader
internal readonly partial struct ShaderWithResourceTextures : ID2D1PixelShader
{
float number;
readonly float number;
[D2DResourceTextureIndex(4)]
D2D1ResourceTexture1D<float4> myTexture1;
readonly D2D1ResourceTexture1D<float4> myTexture1;
[D2DResourceTextureIndex(5)]
D2D1ResourceTexture2D<float4> myTexture2;
readonly D2D1ResourceTexture2D<float4> myTexture2;
[D2DResourceTextureIndex(6)]
D2D1ResourceTexture3D<float4> myTexture3;
readonly D2D1ResourceTexture3D<float4> myTexture3;
[D2DResourceTextureIndex(7)]
D2D1ResourceTexture2D<float> myTexture4;
readonly D2D1ResourceTexture2D<float> myTexture4;
public Float4 Execute()
{
+16 -16
ファイルの表示
@@ -171,10 +171,10 @@ public partial class D2D1ResourceTextureManagerTests
[D2DInputCount(0)]
[D2DRequiresScenePosition]
[D2DGeneratedPixelShaderDescriptor]
internal partial struct DummyShaderWithResourceTexture : ID2D1PixelShader
internal readonly partial struct DummyShaderWithResourceTexture : ID2D1PixelShader
{
[D2DResourceTextureIndex(0)]
private D2D1ResourceTexture2D<float4> source;
private readonly D2D1ResourceTexture2D<float4> source;
public float4 Execute()
{
@@ -460,10 +460,10 @@ public partial class D2D1ResourceTextureManagerTests
[D2DInputCount(0)]
[D2DRequiresScenePosition]
[D2DGeneratedPixelShaderDescriptor]
internal partial struct IndexFrom2DResourceTextureShader : ID2D1PixelShader
internal readonly partial struct IndexFrom2DResourceTextureShader : ID2D1PixelShader
{
[D2DResourceTextureIndex(0)]
private D2D1ResourceTexture2D<float4> source;
private readonly D2D1ResourceTexture2D<float4> source;
public float4 Execute()
{
@@ -536,12 +536,12 @@ public partial class D2D1ResourceTextureManagerTests
[D2DRequiresScenePosition]
[D2DGeneratedPixelShaderDescriptor]
[AutoConstructor]
internal partial struct IndexFrom3DResourceTextureShader : ID2D1PixelShader
internal readonly partial struct IndexFrom3DResourceTextureShader : ID2D1PixelShader
{
private int height;
private readonly int height;
[D2DResourceTextureIndex(0)]
private D2D1ResourceTexture3D<float4> source;
private readonly D2D1ResourceTexture3D<float4> source;
public float4 Execute()
{
@@ -624,10 +624,10 @@ public partial class D2D1ResourceTextureManagerTests
[D2DRequiresScenePosition]
[D2DGeneratedPixelShaderDescriptor]
[AutoConstructor]
internal partial struct CopyFromResourceTexture1DShader : ID2D1PixelShader
internal readonly partial struct CopyFromResourceTexture1DShader : ID2D1PixelShader
{
[D2DResourceTextureIndex(0)]
private D2D1ResourceTexture1D<float> source;
private readonly D2D1ResourceTexture1D<float> source;
public float4 Execute()
{
@@ -792,10 +792,10 @@ public partial class D2D1ResourceTextureManagerTests
[D2DRequiresScenePosition]
[D2DGeneratedPixelShaderDescriptor]
[AutoConstructor]
internal partial struct CopyFromResourceTexture2DShader : ID2D1PixelShader
internal readonly partial struct CopyFromResourceTexture2DShader : ID2D1PixelShader
{
[D2DResourceTextureIndex(0)]
private D2D1ResourceTexture2D<float> source;
private readonly D2D1ResourceTexture2D<float> source;
public float4 Execute()
{
@@ -896,12 +896,12 @@ public partial class D2D1ResourceTextureManagerTests
[D2DRequiresScenePosition]
[D2DGeneratedPixelShaderDescriptor]
[AutoConstructor]
internal partial struct CopyFromResourceTexture3DShader : ID2D1PixelShader
internal readonly partial struct CopyFromResourceTexture3DShader : ID2D1PixelShader
{
private int height;
private readonly int height;
[D2DResourceTextureIndex(0)]
private D2D1ResourceTexture3D<float> source;
private readonly D2D1ResourceTexture3D<float> source;
public float4 Execute()
{
@@ -939,10 +939,10 @@ public partial class D2D1ResourceTextureManagerTests
[D2DInputCount(0)]
[D2DRequiresScenePosition]
[D2DGeneratedPixelShaderDescriptor]
internal partial struct NullResourceTextureShader : ID2D1PixelShader
internal readonly partial struct NullResourceTextureShader : ID2D1PixelShader
{
[D2DResourceTextureIndex(0)]
private D2D1ResourceTexture2D<float4> source;
private readonly D2D1ResourceTexture2D<float4> source;
public float4 Execute()
{
+4 -5
ファイルの表示
@@ -261,8 +261,7 @@ public partial class D2D1TransformMapperTests
Assert.AreEqual(shader.Width, this.ExpectedWidth);
Assert.AreEqual(shader.Height, this.ExpectedHeight);
shader.Width = inputs[0].Width;
shader.Height = inputs[0].Height;
shader = new ShaderWithDispatchArea(inputs[0].Width, inputs[0].Height);
drawInfoUpdateContext.SetConstantBuffer(in shader);
@@ -286,10 +285,10 @@ public partial class D2D1TransformMapperTests
[D2DRequiresScenePosition]
[D2DGeneratedPixelShaderDescriptor]
[AutoConstructor]
internal partial struct ShaderWithDispatchArea : ID2D1PixelShader
internal readonly partial struct ShaderWithDispatchArea : ID2D1PixelShader
{
public int Width;
public int Height;
public readonly int Width;
public readonly int Height;
public float4 Execute()
{
+3 -8
ファイルの表示
@@ -5,13 +5,8 @@ namespace ComputeSharp.D2D1.Tests.Effects;
[D2DRequiresScenePosition]
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
[D2DGeneratedPixelShaderDescriptor]
[AutoConstructor]
public partial struct CheckerboardClipEffect : ID2D1PixelShader
public readonly partial struct CheckerboardClipEffect(int cellSize) : ID2D1PixelShader
{
public int width;
public int height;
public int cellSize;
/// <inheritdoc/>
public float4 Execute()
{
@@ -19,8 +14,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 / this.cellSize);
uint cellY = (uint)(int)Hlsl.Floor(y / this.cellSize);
uint cellX = (uint)(int)Hlsl.Floor(x / cellSize);
uint cellY = (uint)(int)Hlsl.Floor(y / cellSize);
if ((cellX % 2 == 0 && cellY % 2 == 0) ||
(cellX % 2 == 1 && cellY % 2 == 1))
+2 -5
ファイルの表示
@@ -4,16 +4,13 @@ namespace ComputeSharp.D2D1.Tests.Effects;
[D2DInputSimple(0)]
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
[D2DGeneratedPixelShaderDescriptor]
[AutoConstructor]
public partial struct InvertWithThresholdEffect : ID2D1PixelShader
public readonly partial struct InvertWithThresholdEffect(float number) : ID2D1PixelShader
{
public float number;
/// <inheritdoc/>
public float4 Execute()
{
float4 color = D2D.GetInput(0);
float3 rgb = Hlsl.Saturate(this.number - color.RGB);
float3 rgb = Hlsl.Saturate(number - color.RGB);
return new(rgb, 1);
}
+8 -10
ファイルの表示
@@ -6,23 +6,21 @@ namespace ComputeSharp.D2D1.Tests.Effects;
[D2DRequiresScenePosition]
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
[D2DGeneratedPixelShaderDescriptor]
[AutoConstructor]
public readonly partial struct ZonePlateEffect : ID2D1PixelShader
public readonly partial struct ZonePlateEffect(
int width,
int height,
float diameter) : ID2D1PixelShader
{
private readonly int width;
private readonly int height;
private readonly float diameter;
/// <inheritdoc/>
public float4 Execute()
{
float2 scenePos = D2D.GetScenePosition().XY;
float xo = scenePos.X - (this.width >> 1);
float yo = scenePos.Y - (this.height >> 1);
float xo = scenePos.X - (width >> 1);
float yo = scenePos.Y - (height >> 1);
float rm = 0.5f * this.diameter;
float km = 0.7f / this.diameter * MathF.PI;
float rm = 0.5f * diameter;
float km = 0.7f / diameter * MathF.PI;
float w = rm / 10.0f;
float yd = yo * yo;
+1 -1
ファイルの表示
@@ -52,7 +52,7 @@ public class EffectsTests
[TestMethod]
public void CheckerboardClip()
{
D2D1TestRunner.RunAndCompareShader(new CheckerboardClipEffect(1280, 840, 32), null, "Landscape.png", "Landscape_CheckerboardClip.png");
D2D1TestRunner.RunAndCompareShader(new CheckerboardClipEffect(32), null, "Landscape.png", "Landscape_CheckerboardClip.png");
}
[TestMethod]