Fix sorting of custom type declarations in HLSL

このコミットが含まれているのは:
Sergio Pedri committed 2023-12-21 18:50:30 +01:00
1 親 a926a1211f
コミット 2cb61a3eec
2ファイル変更
+25 -22

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

+12 -9
ファイルの表示
@@ -68,6 +68,18 @@ internal static class HlslSourceSyntaxProcessor
writer.WriteLine(skipIfPresent: true);
}
// Declared types (these have to be declared early on in the shader so that even if
// forward declarations for types are not supported, like is the case for D2D shaders
// using the FXC compiler, the resulting HLSL code is valid in case any forward
// declaration of methods in the shader has one of these types in its signature).
foreach (HlslUserType userType in typeDeclarations)
{
writer.WriteLine(skipIfPresent: true);
writer.WriteLine(userType.Definition);
}
writer.WriteLine(skipIfPresent: true);
// Forward declarations of shader/static methods
foreach (HlslMethod method in processedMethods)
{
@@ -91,15 +103,6 @@ internal static class HlslSourceSyntaxProcessor
}
writer.WriteLine(skipIfPresent: true);
// Declared types
foreach (HlslUserType userType in typeDeclarations)
{
writer.WriteLine(skipIfPresent: true);
writer.WriteLine(userType.Definition);
}
writer.WriteLine(skipIfPresent: true);
}
/// <summary>
+13 -13
ファイルの表示
@@ -992,19 +992,6 @@ namespace ComputeSharp.Tests
struct ComputeSharp_Tests_ShaderCompilerTests_StructType1;
struct ComputeSharp_Tests_ShaderCompilerTests_StructType2;
int InstanceMethodInShader();
static float StaticMethodInShader(float x);
static float ComputeSharp_Tests_ShaderCompilerTests_StructType1_StaticMethod(int x);
static float ComputeSharp_Tests_ShaderCompilerTests_StructType2_StaticMethod(int x);
static const float Init = abs(__ComputeSharp_Tests_ShaderCompilerTests_ShaderWithAllSupportedMembers__PI);
static int Temp;
static int ComputeSharp_Tests_ShaderCompilerTests_ExternalContainerClass_Temp;
static const float ComputeSharp_Tests_ShaderCompilerTests_ExternalContainerClass_PI2 = 3.14 * 2;
struct ComputeSharp_Tests_ShaderCompilerTests_StructType1
{
int X;
@@ -1020,6 +1007,19 @@ namespace ComputeSharp.Tests
float Combine(ComputeSharp_Tests_ShaderCompilerTests_StructType1 other);
};
int InstanceMethodInShader();
static float StaticMethodInShader(float x);
static float ComputeSharp_Tests_ShaderCompilerTests_StructType1_StaticMethod(int x);
static float ComputeSharp_Tests_ShaderCompilerTests_StructType2_StaticMethod(int x);
static const float Init = abs(__ComputeSharp_Tests_ShaderCompilerTests_ShaderWithAllSupportedMembers__PI);
static int Temp;
static int ComputeSharp_Tests_ShaderCompilerTests_ExternalContainerClass_Temp;
static const float ComputeSharp_Tests_ShaderCompilerTests_ExternalContainerClass_PI2 = 3.14 * 2;
cbuffer _ : register(b0)
{
uint __x;