Update all runtime and generator tests
このコミットが含まれているのは:
1 親
fa94387ec9
コミット
2c36f2c40f
3ファイル変更
+54
-21
検索条件に一致するファイルはありません
+5
-5
@@ -166,7 +166,7 @@ public class Test_D2DPixelShaderDescriptorGenerator
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.D2DPixelShaderDescriptorGenerator", <ASSEMBLY_VERSION>)]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
static ComputeSharp.D2D1.D2D1CompileOptions global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<MyShader>.CompileOptions => global::ComputeSharp.D2D1.D2D1CompileOptions.Default | global::ComputeSharp.D2D1.D2D1CompileOptions.EnableLinking;
|
||||
static ComputeSharp.D2D1.D2D1CompileOptions global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<MyShader>.CompileOptions => global::ComputeSharp.D2D1.D2D1CompileOptions.Default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.D2DPixelShaderDescriptorGenerator", <ASSEMBLY_VERSION>)]
|
||||
@@ -466,7 +466,7 @@ public class Test_D2DPixelShaderDescriptorGenerator
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.D2DPixelShaderDescriptorGenerator", <ASSEMBLY_VERSION>)]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
static ComputeSharp.D2D1.D2D1CompileOptions global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<MyShader>.CompileOptions => global::ComputeSharp.D2D1.D2D1CompileOptions.Default | global::ComputeSharp.D2D1.D2D1CompileOptions.EnableLinking;
|
||||
static ComputeSharp.D2D1.D2D1CompileOptions global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<MyShader>.CompileOptions => global::ComputeSharp.D2D1.D2D1CompileOptions.Default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.D2DPixelShaderDescriptorGenerator", <ASSEMBLY_VERSION>)]
|
||||
@@ -818,7 +818,7 @@ public class Test_D2DPixelShaderDescriptorGenerator
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.D2DPixelShaderDescriptorGenerator", <ASSEMBLY_VERSION>)]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
static ComputeSharp.D2D1.D2D1CompileOptions global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<MyShader>.CompileOptions => global::ComputeSharp.D2D1.D2D1CompileOptions.Default | global::ComputeSharp.D2D1.D2D1CompileOptions.EnableLinking;
|
||||
static ComputeSharp.D2D1.D2D1CompileOptions global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<MyShader>.CompileOptions => global::ComputeSharp.D2D1.D2D1CompileOptions.Default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.D2DPixelShaderDescriptorGenerator", <ASSEMBLY_VERSION>)]
|
||||
@@ -1116,7 +1116,7 @@ public class Test_D2DPixelShaderDescriptorGenerator
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.D2DPixelShaderDescriptorGenerator", <ASSEMBLY_VERSION>)]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
static ComputeSharp.D2D1.D2D1CompileOptions global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<MyShader>.CompileOptions => global::ComputeSharp.D2D1.D2D1CompileOptions.Default | global::ComputeSharp.D2D1.D2D1CompileOptions.EnableLinking;
|
||||
static ComputeSharp.D2D1.D2D1CompileOptions global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<MyShader>.CompileOptions => global::ComputeSharp.D2D1.D2D1CompileOptions.Default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.D2DPixelShaderDescriptorGenerator", <ASSEMBLY_VERSION>)]
|
||||
@@ -1694,7 +1694,7 @@ public class Test_D2DPixelShaderDescriptorGenerator
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.D2DPixelShaderDescriptorGenerator", <ASSEMBLY_VERSION>)]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
static ComputeSharp.D2D1.D2D1CompileOptions global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<MyShader>.CompileOptions => global::ComputeSharp.D2D1.D2D1CompileOptions.Default | global::ComputeSharp.D2D1.D2D1CompileOptions.EnableLinking;
|
||||
static ComputeSharp.D2D1.D2D1CompileOptions global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<MyShader>.CompileOptions => global::ComputeSharp.D2D1.D2D1CompileOptions.Default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.D2DPixelShaderDescriptorGenerator", <ASSEMBLY_VERSION>)]
|
||||
|
||||
@@ -417,13 +417,13 @@ namespace ComputeSharp.D2D1.Tests
|
||||
Assert.IsTrue(manager!.GetType().Name.Contains("HlslBytecodeMemoryManager"));
|
||||
|
||||
// Matching compile options
|
||||
bytecode = D2D1PixelShader.LoadBytecode<ShaderWithEmbeddedBytecode>(D2D1CompileOptions.Default | D2D1CompileOptions.EnableLinking);
|
||||
bytecode = D2D1PixelShader.LoadBytecode<ShaderWithEmbeddedBytecode>(D2D1CompileOptions.Default);
|
||||
|
||||
Assert.IsTrue(MemoryMarshal.TryGetMemoryManager(bytecode, out manager));
|
||||
Assert.IsTrue(manager!.GetType().Name.Contains("HlslBytecodeMemoryManager"));
|
||||
|
||||
// Matching shader profile and compile options
|
||||
bytecode = D2D1PixelShader.LoadBytecode<ShaderWithEmbeddedBytecode>(D2D1ShaderProfile.PixelShader40Level91, D2D1CompileOptions.Default | D2D1CompileOptions.EnableLinking);
|
||||
bytecode = D2D1PixelShader.LoadBytecode<ShaderWithEmbeddedBytecode>(D2D1ShaderProfile.PixelShader40Level91, D2D1CompileOptions.Default);
|
||||
|
||||
Assert.IsTrue(MemoryMarshal.TryGetMemoryManager(bytecode, out manager));
|
||||
Assert.IsTrue(manager!.GetType().Name.Contains("HlslBytecodeMemoryManager"));
|
||||
@@ -534,7 +534,7 @@ namespace ComputeSharp.D2D1.Tests
|
||||
_ = D2D1PixelShader.LoadBytecode<SimpleShaderWithExplicitShaderProfileAndNoCompileOptions>(out D2D1ShaderProfile shaderProfile, out D2D1CompileOptions compileOptions);
|
||||
|
||||
Assert.AreEqual(shaderProfile, D2D1ShaderProfile.PixelShader40Level91);
|
||||
Assert.AreEqual(compileOptions, D2D1CompileOptions.Default | D2D1CompileOptions.EnableLinking);
|
||||
Assert.AreEqual(compileOptions, D2D1CompileOptions.Default);
|
||||
|
||||
_ = D2D1PixelShader.LoadBytecode<ComplexShaderWithExplicitShaderProfileAndNoCompileOptions>(out shaderProfile, out compileOptions);
|
||||
|
||||
@@ -598,7 +598,7 @@ namespace ComputeSharp.D2D1.Tests
|
||||
{
|
||||
ReadOnlyMemory<byte> hlslBytecode = D2D1PixelShader.LoadBytecode<ShaderWithSuppressedFxcWarning>(out _, out D2D1CompileOptions compileOptions);
|
||||
|
||||
Assert.AreEqual(D2D1CompileOptions.OptimizationLevel3 | D2D1CompileOptions.PackMatrixRowMajor, compileOptions);
|
||||
Assert.AreEqual(D2D1CompileOptions.Default & ~D2D1CompileOptions.WarningsAreErrors, compileOptions);
|
||||
Assert.IsTrue(hlslBytecode.Length > 0);
|
||||
}
|
||||
|
||||
@@ -618,11 +618,11 @@ namespace ComputeSharp.D2D1.Tests
|
||||
[TestMethod]
|
||||
public void LoadBytecode_EnableLinkingIsAppliedCorrectly()
|
||||
{
|
||||
ReadOnlyMemory<byte> hlslBytecode1 = D2D1PixelShader.LoadBytecode<ReferenceShaderWithDefaultCompileOptions>(out _, out D2D1CompileOptions compileOptions1);
|
||||
ReadOnlyMemory<byte> hlslBytecode2 = D2D1PixelShader.LoadBytecode<ReferenceShaderWithEnableLinking>(out _, out D2D1CompileOptions compileOptions2);
|
||||
ReadOnlyMemory<byte> hlslBytecode1 = D2D1PixelShader.LoadBytecode<ReferenceShaderWithDefaultCompileOptionsAndNoLinking>(out _, out D2D1CompileOptions compileOptions1);
|
||||
ReadOnlyMemory<byte> hlslBytecode2 = D2D1PixelShader.LoadBytecode<ReferenceShaderWithDefaultCompileOptions>(out _, out D2D1CompileOptions compileOptions2);
|
||||
|
||||
Assert.AreEqual(D2D1CompileOptions.Default | D2D1CompileOptions.PackMatrixRowMajor, compileOptions1);
|
||||
Assert.AreEqual(D2D1CompileOptions.Default | D2D1CompileOptions.EnableLinking | D2D1CompileOptions.PackMatrixRowMajor, compileOptions2);
|
||||
Assert.AreEqual(D2D1CompileOptions.Default & ~D2D1CompileOptions.EnableLinking, compileOptions1);
|
||||
Assert.AreEqual(D2D1CompileOptions.Default, compileOptions2);
|
||||
|
||||
Assert.IsTrue(MemoryMarshal.TryGetMemoryManager(hlslBytecode1, out MemoryManager<byte>? manager1));
|
||||
Assert.IsTrue(manager1!.GetType().Name.Contains("HlslBytecodeMemoryManager"));
|
||||
@@ -630,9 +630,9 @@ namespace ComputeSharp.D2D1.Tests
|
||||
Assert.IsTrue(MemoryMarshal.TryGetMemoryManager(hlslBytecode2, out MemoryManager<byte>? manager2));
|
||||
Assert.IsTrue(manager2!.GetType().Name.Contains("HlslBytecodeMemoryManager"));
|
||||
|
||||
// Same checks as in D2D1ShaderCompilerTests.CompileInvertEffectWithDefaultOptionsAndLinking
|
||||
// Very similar checks to those in D2D1ShaderCompilerTests.CompileInvertEffectWithDefaultOptionsAndLinking
|
||||
Assert.IsTrue(hlslBytecode1.Length > 700);
|
||||
Assert.IsTrue(hlslBytecode2.Length > 1400);
|
||||
Assert.IsTrue(hlslBytecode2.Length > 1500);
|
||||
Assert.IsTrue(hlslBytecode2.Length > hlslBytecode1.Length);
|
||||
Assert.IsTrue((hlslBytecode2.Length - hlslBytecode1.Length) > 700);
|
||||
}
|
||||
@@ -656,9 +656,9 @@ namespace ComputeSharp.D2D1.Tests
|
||||
[D2DInputCount(1)]
|
||||
[D2DInputSimple(0)]
|
||||
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
|
||||
[D2DCompileOptions(D2D1CompileOptions.Default | D2D1CompileOptions.EnableLinking)]
|
||||
[D2DCompileOptions(D2D1CompileOptions.Default & ~D2D1CompileOptions.EnableLinking)]
|
||||
[D2DGeneratedPixelShaderDescriptor]
|
||||
public readonly partial struct ReferenceShaderWithEnableLinking : ID2D1PixelShader
|
||||
public readonly partial struct ReferenceShaderWithDefaultCompileOptionsAndNoLinking : ID2D1PixelShader
|
||||
{
|
||||
public float4 Execute()
|
||||
{
|
||||
@@ -675,8 +675,8 @@ namespace ComputeSharp.D2D1.Tests
|
||||
ReadOnlyMemory<byte> hlslBytecode1 = D2D1PixelShader.LoadBytecode<ReferenceShaderWithDefaultCompileOptions>(out _, out D2D1CompileOptions compileOptions1);
|
||||
ReadOnlyMemory<byte> hlslBytecode2 = D2D1PixelShader.LoadBytecode<ReferenceShaderWithStripReflectionData>(out _, out D2D1CompileOptions compileOptions2);
|
||||
|
||||
Assert.AreEqual(D2D1CompileOptions.Default | D2D1CompileOptions.PackMatrixRowMajor, compileOptions1);
|
||||
Assert.AreEqual(D2D1CompileOptions.Default | D2D1CompileOptions.StripReflectionData | D2D1CompileOptions.PackMatrixRowMajor, compileOptions2);
|
||||
Assert.AreEqual(D2D1CompileOptions.Default, compileOptions1);
|
||||
Assert.AreEqual(D2D1CompileOptions.Default | D2D1CompileOptions.StripReflectionData, compileOptions2);
|
||||
|
||||
Assert.IsTrue(MemoryMarshal.TryGetMemoryManager(hlslBytecode1, out MemoryManager<byte>? manager1));
|
||||
Assert.IsTrue(manager1!.GetType().Name.Contains("HlslBytecodeMemoryManager"));
|
||||
|
||||
@@ -80,13 +80,13 @@ public partial class D2D1ShaderCompilerTests
|
||||
source.AsSpan(),
|
||||
"PSMain".AsSpan(),
|
||||
D2D1ShaderProfile.PixelShader40Level93,
|
||||
D2D1CompileOptions.Default);
|
||||
D2D1CompileOptions.Default & ~D2D1CompileOptions.EnableLinking);
|
||||
|
||||
ReadOnlyMemory<byte> bytecodeWithLinking = D2D1ShaderCompiler.Compile(
|
||||
source.AsSpan(),
|
||||
"PSMain".AsSpan(),
|
||||
D2D1ShaderProfile.PixelShader40Level93,
|
||||
D2D1CompileOptions.Default | D2D1CompileOptions.EnableLinking);
|
||||
D2D1CompileOptions.Default);
|
||||
|
||||
Assert.IsTrue(bytecode.Length > 800);
|
||||
Assert.IsTrue(bytecodeWithLinking.Length > 1600);
|
||||
@@ -94,6 +94,39 @@ public partial class D2D1ShaderCompilerTests
|
||||
Assert.IsTrue((bytecodeWithLinking.Length - bytecode.Length) > 800);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CompileInvertEffectWithDefaultOptionsAndOptimizeForSize()
|
||||
{
|
||||
const string source = """
|
||||
#define D2D_INPUT_COUNT 1
|
||||
#define D2D_INPUT0_SIMPLE
|
||||
|
||||
#include "d2d1effecthelpers.hlsli"
|
||||
|
||||
D2D_PS_ENTRY(PSMain)
|
||||
{
|
||||
float4 color = D2DGetInput(0);
|
||||
float3 rgb = saturate(1.0 - color.rgb);
|
||||
return float4(rgb, 1);
|
||||
}
|
||||
""";
|
||||
|
||||
ReadOnlyMemory<byte> bytecode = D2D1ShaderCompiler.Compile(
|
||||
source.AsSpan(),
|
||||
"PSMain".AsSpan(),
|
||||
D2D1ShaderProfile.PixelShader40Level93,
|
||||
D2D1CompileOptions.Default);
|
||||
|
||||
ReadOnlyMemory<byte> bytecodeWithOptimizeForSize = D2D1ShaderCompiler.Compile(
|
||||
source.AsSpan(),
|
||||
"PSMain".AsSpan(),
|
||||
D2D1ShaderProfile.PixelShader40Level93,
|
||||
D2D1CompileOptions.OptimizeForSize);
|
||||
|
||||
Assert.IsTrue(bytecode.Length > 1800);
|
||||
Assert.IsTrue(bytecodeWithOptimizeForSize.Length < 600);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CompileInvertEffectWithDefaultOptionsAndStripReflectionData()
|
||||
{
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする