Allow D2D1 attributes at assembly level
このコミットが含まれているのは:
1 親
48b6b4245e
コミット
f5ea4b7911
3ファイル変更
+23
-2
検索条件に一致するファイルはありません
@@ -38,6 +38,11 @@ partial class ID2D1ShaderGenerator
|
||||
return (D2D1ShaderProfile)attributeData!.ConstructorArguments[0].Value!;
|
||||
}
|
||||
|
||||
if (structDeclarationSymbol.ContainingAssembly.TryGetAttributeWithFullMetadataName("ComputeSharp.D2D1.D2DEmbeddedBytecodeAttribute", out attributeData))
|
||||
{
|
||||
return (D2D1ShaderProfile)attributeData!.ConstructorArguments[0].Value!;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -65,6 +70,12 @@ partial class ID2D1ShaderGenerator
|
||||
return options | D2D1CompileOptions.PackMatrixRowMajor;
|
||||
}
|
||||
|
||||
if (structDeclarationSymbol.ContainingAssembly.TryGetAttributeWithFullMetadataName("ComputeSharp.D2D1.D2DCompileOptionsAttribute", out attributeData))
|
||||
{
|
||||
// No need to validate against PackMatrixColumnMajor as that's checked separately
|
||||
return (D2D1CompileOptions)attributeData!.ConstructorArguments[0].Value! | D2D1CompileOptions.PackMatrixRowMajor;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,12 +16,17 @@ namespace ComputeSharp.D2D1;
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Note that the <see cref="D2D1CompileOptions.PackMatrixRowMajor"/> is always enabled automatically and does not need to be
|
||||
/// specified. This option is mandatory, as the generated code to load the constant buffer from a shader assumes the layout
|
||||
/// for matrix types is row major. For the same reason, using <see cref="D2D1CompileOptions.PackMatrixColumnMajor"/> is not
|
||||
/// allowed, as it would cause the constant buffer retrieved from a shader to be potentially incorrect.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This attribute can also be added to a whole assembly, and will be used by default if not overridden by a shader type.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
|
||||
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public sealed class D2DCompileOptionsAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -16,10 +16,15 @@ namespace ComputeSharp.D2D1;
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The runtime compilation will automatically be skipped if the shader bytecode is then retrieved using a matching profile,
|
||||
/// otherwise the usual runtime compilation will be used as fallback (or an exception will be thrown, depending on the API).
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This attribute can also be added to a whole assembly, and will be used by default if not overridden by a shader type.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
|
||||
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public sealed class D2DEmbeddedBytecodeAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする