Skip to content

Commit f7b03ea

Browse files
committed
Add unit test for D2D pixel shader
1 parent ecb9082 commit f7b03ea

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/ComputeSharp.D2D1.Tests/ShaderRewriterTests.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,33 @@ public float4 Execute()
208208
return new float4(0.0f, 1.0f, 0.0f, 1.0f);
209209
}
210210
}
211+
212+
// See https://github.com/Sergio0694/ComputeSharp/issues/855
213+
[TestMethod]
214+
public void ExplicitEntryPointMethodPixelShader_IsRewrittenCorrectly()
215+
{
216+
D2D1ShaderInfo shaderInfo = D2D1ReflectionServices.GetShaderInfo<ExplicitEntryPointMethodPixelShader>();
217+
218+
Assert.AreEqual("""
219+
#define D2D_INPUT_COUNT 0
220+
221+
#include "d2d1effecthelpers.hlsli"
222+
223+
D2D_PS_ENTRY(Execute)
224+
{
225+
return (float4)0;
226+
}
227+
""", shaderInfo.HlslSource);
228+
}
229+
230+
[D2DInputCount(0)]
231+
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
232+
[D2DGeneratedPixelShaderDescriptor]
233+
internal readonly partial struct ExplicitEntryPointMethodPixelShader : ID2D1PixelShader
234+
{
235+
float4 ID2D1PixelShader.Execute()
236+
{
237+
return default;
238+
}
239+
}
211240
}

0 commit comments

Comments
 (0)