Add ExcedeedPixelShaderDispatchDataSizeAnalyzer
このコミットが含まれているのは:
1 親
d1578bb997
コミット
38c885f74e
5ファイル変更
+161
-29
検索条件に一致するファイルはありません
@@ -3,11 +3,9 @@ using System.Collections.Immutable;
|
||||
using ComputeSharp.SourceGeneration.Extensions;
|
||||
using ComputeSharp.SourceGeneration.Helpers;
|
||||
using ComputeSharp.SourceGeneration.Mappings;
|
||||
using ComputeSharp.SourceGeneration.Models;
|
||||
using ComputeSharp.SourceGeneration.SyntaxProcessors;
|
||||
using ComputeSharp.SourceGenerators.Models;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using static ComputeSharp.SourceGeneration.Diagnostics.DiagnosticDescriptors;
|
||||
|
||||
namespace ComputeSharp.SourceGenerators;
|
||||
|
||||
@@ -22,19 +20,15 @@ partial class ComputeShaderDescriptorGenerator
|
||||
/// <summary>
|
||||
/// Gathers info on all resources captured by a given shader type.
|
||||
/// </summary>
|
||||
/// <param name="diagnostics">The collection of produced <see cref="DiagnosticInfo"/> instances.</param>
|
||||
/// <param name="compilation">The input <see cref="Compilation"/> object currently in use.</param>
|
||||
/// <param name="structDeclarationSymbol">The current shader type being explored.</param>
|
||||
/// <param name="isImplicitTextureUsed">Indicates whether the current shader uses an implicit texture.</param>
|
||||
/// <param name="constantBufferSizeInBytes">The size of the shader constant buffer.</param>
|
||||
/// <param name="resources">The sequence of <see cref="ResourceInfo"/> instances for all captured resources.</param>
|
||||
/// <param name="resourceDescriptors">The sequence of <see cref="ResourceDescriptor"/> instances for all captured resources.</param>
|
||||
public static void GetInfo(
|
||||
ImmutableArrayBuilder<DiagnosticInfo> diagnostics,
|
||||
Compilation compilation,
|
||||
ITypeSymbol structDeclarationSymbol,
|
||||
bool isImplicitTextureUsed,
|
||||
int constantBufferSizeInBytes,
|
||||
out ImmutableArray<ResourceInfo> resources,
|
||||
out ImmutableArray<ResourceDescriptor> resourceDescriptors)
|
||||
{
|
||||
@@ -96,19 +90,6 @@ partial class ComputeShaderDescriptorGenerator
|
||||
|
||||
resources = resourceBuilder.ToImmutable();
|
||||
resourceDescriptors = resourceDescriptorBuilder.ToImmutable();
|
||||
|
||||
// A shader root signature has a maximum size of 64 DWORDs, so 256 bytes.
|
||||
// Loaded values in the root signature have the following costs:
|
||||
// - Root constants cost 1 DWORD each, since they are 32-bit values.
|
||||
// - Descriptor tables cost 1 DWORD each.
|
||||
// - Root descriptors (64-bit GPU virtual addresses) cost 2 DWORDs each.
|
||||
// So here we check whether the current signature respects that constraint,
|
||||
// and emit a build error otherwise. For more info on this, see the docs here:
|
||||
// https://docs.microsoft.com/windows/win32/direct3d12/root-signature-limits.
|
||||
if ((constantBufferSizeInBytes / sizeof(int)) + resourceBuilder.Count > 64)
|
||||
{
|
||||
diagnostics.Add(ShaderDispatchDataSizeExceeded, structDeclarationSymbol, structDeclarationSymbol);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする