diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs index 224ba76f..8d4b2b1d 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct ColorfulInfinity : IPixelShader +internal readonly partial struct ColorfulInfinity : IComputeShader { /// /// The current time since the start of the application. diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs index 99b50e94..52cd77f2 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs @@ -7,7 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct ContouredLayers : IPixelShader +internal readonly partial struct ContouredLayers : IComputeShader { /// /// The current time Hlsl.Since the start of the application. diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs index ceea8dce..44905851 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs @@ -7,7 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct ExtrudedTruchetPattern : IPixelShader +internal readonly partial struct ExtrudedTruchetPattern : IComputeShader { /// /// The current time since the start of the application. diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs index 92bff991..123f0575 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct FourColorGradient : IPixelShader +internal readonly partial struct FourColorGradient : IComputeShader { /// /// The current time since the start of the application. diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs index 4478d2dc..156ece01 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct FractalTiling : IPixelShader +internal readonly partial struct FractalTiling : IComputeShader { /// /// The current time since the start of the application. diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs index 192ec941..75fc97c1 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs @@ -6,7 +6,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct HelloWorld : IPixelShader +internal readonly partial struct HelloWorld : IComputeShader { /// /// The current time since the start of the application. diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs index 958726ae..1b006248 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs @@ -7,7 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct MengerJourney : IPixelShader +internal readonly partial struct MengerJourney : IComputeShader { /// /// The current time since the start of the application. diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs index 3190d925..1fc1f0a6 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs @@ -7,7 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct Octagrams : IPixelShader +internal readonly partial struct Octagrams : IComputeShader { /// /// The current time since the start of the application. diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs index ef98690e..6799eda1 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct ProteanClouds : IPixelShader +internal readonly partial struct ProteanClouds : IComputeShader { /// /// The current time Hlsl.Since the start of the application. diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs index 5ffc2fa2..f4260f4c 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct PyramidPattern : IPixelShader +internal readonly partial struct PyramidPattern : IComputeShader { /// /// The current time Hlsl.Since the start of the application. diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/TerracedHills.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/TerracedHills.cs index 1d8ab189..6eeff2ba 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/TerracedHills.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/TerracedHills.cs @@ -7,7 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct TerracedHills : IPixelShader +internal readonly partial struct TerracedHills : IComputeShader { /// /// The current time since the start of the application. diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs index 60e1af58..a3c03f54 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs @@ -7,7 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct TriangleGridContouring : IPixelShader +internal readonly partial struct TriangleGridContouring : IComputeShader { /// /// The current time Hlsl.Since the start of the application. diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs index 3e44c208..091813da 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs @@ -7,7 +7,7 @@ namespace ComputeSharp.SwapChain.Shaders; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct TwoTiledTruchet : IPixelShader +internal readonly partial struct TwoTiledTruchet : IComputeShader { /// /// The current time since the start of the application. diff --git a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationFactory{T}.cs b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationFactory{T}.cs index 24fe342a..817e981f 100644 --- a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationFactory{T}.cs +++ b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationFactory{T}.cs @@ -11,7 +11,7 @@ namespace ComputeSharp.SwapChain.Backend; /// The main point of this type is to hide the complexity of from the non-NativeAOT sample. /// internal static class Win32ApplicationFactory - where T : struct, IPixelShader + where T : struct, IComputeShader { /// /// The instance used to create shaders to run. diff --git a/src/ComputeSharp.Dynamic/Shaders/Interop/ReflectionServices.cs b/src/ComputeSharp.Dynamic/Shaders/Interop/ReflectionServices.cs index 7ebb877f..c16e6b14 100644 --- a/src/ComputeSharp.Dynamic/Shaders/Interop/ReflectionServices.cs +++ b/src/ComputeSharp.Dynamic/Shaders/Interop/ReflectionServices.cs @@ -70,7 +70,7 @@ public static class ReflectionServices /// the APIs to dispatch a shader, the thread sizes would actually be set to a proper value insead. /// public static ShaderInfo GetShaderInfo() - where T : struct, IPixelShader + where T : struct, IComputeShader where TPixel : unmanaged { return GetNonGenericShaderInfo(default(T)); @@ -89,7 +89,7 @@ public static class ReflectionServices /// the APIs to dispatch a shader, the thread sizes would actually be set to a proper value insead. /// public static unsafe ShaderInfo GetShaderInfo(in T shader) - where T : struct, IPixelShader + where T : struct, IComputeShader where TPixel : unmanaged { return GetNonGenericShaderInfo(in shader); diff --git a/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj b/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj index ae2b90c9..d47c90c9 100644 --- a/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj +++ b/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj @@ -66,7 +66,7 @@ - + diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.cs index 92d1d182..29b99943 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.CreateBuildHlslSourceMethod.cs @@ -59,14 +59,14 @@ partial class IShaderGenerator Dictionary constantDefinitions = new(SymbolEqualityComparer.Default); // A given type can only represent a single shader type - if (structDeclarationSymbol.AllInterfaces.Count(static interfaceSymbol => interfaceSymbol is { Name: nameof(IComputeShader) } or { IsGenericType: true, Name: nameof(IPixelShader) }) > 1) + if (structDeclarationSymbol.AllInterfaces.Count(static interfaceSymbol => interfaceSymbol is { Name: nameof(IComputeShader) } or { IsGenericType: true, Name: nameof(IComputeShader) }) > 1) { diagnostics.Add(MultipleShaderTypesImplemented, structDeclarationSymbol, structDeclarationSymbol); } // Explore the syntax tree and extract the processed info SemanticModelProvider semanticModelProvider = new(compilation); - INamedTypeSymbol? pixelShaderSymbol = structDeclarationSymbol.AllInterfaces.FirstOrDefault(static interfaceSymbol => interfaceSymbol is { IsGenericType: true, Name: nameof(IPixelShader) }); + INamedTypeSymbol? pixelShaderSymbol = structDeclarationSymbol.AllInterfaces.FirstOrDefault(static interfaceSymbol => interfaceSymbol is { IsGenericType: true, Name: nameof(IComputeShader) }); bool isComputeShader = pixelShaderSymbol is null; string? implicitTextureType = isComputeShader ? null : HlslKnownTypes.GetMappedNameForPixelShaderType(pixelShaderSymbol!); (ImmutableArray<(string MetadataName, string Name, string HlslType)> resourceFields, ImmutableArray<(string Name, string HlslType)> valueFields) = GetInstanceFields(diagnostics, structDeclarationSymbol, discoveredTypes, isComputeShader); @@ -364,7 +364,7 @@ partial class IShaderGenerator methodDeclarationSymbol.TypeParameters.Length == 0 && methodDeclarationSymbol.Parameters.Length == 0) || (!isComputeShader && - methodDeclarationSymbol.Name == nameof(IPixelShader.Execute) && + methodDeclarationSymbol.Name == nameof(IComputeShader.Execute) && methodDeclarationSymbol.ReturnType is not null && // TODO: match for pixel type methodDeclarationSymbol.TypeParameters.Length == 0 && methodDeclarationSymbol.Parameters.Length == 0); diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.Helpers.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.Helpers.cs index f12485d9..e979cb19 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.Helpers.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.Helpers.cs @@ -15,7 +15,7 @@ partial class IShaderGenerator private static bool TryGetIsPixelShaderLike(INamedTypeSymbol typeSymbol, Compilation compilation, out bool result) { INamedTypeSymbol computeShaderSymbol = compilation.GetTypeByMetadataName("ComputeSharp.IComputeShader")!; - INamedTypeSymbol pixelShaderSymbol = compilation.GetTypeByMetadataName("ComputeSharp.IPixelShader`1")!; + INamedTypeSymbol pixelShaderSymbol = compilation.GetTypeByMetadataName("ComputeSharp.IComputeShader`1")!; foreach (INamedTypeSymbol interfaceSymbol in typeSymbol.AllInterfaces) { diff --git a/src/ComputeSharp.SourceGenerators/IShaderGenerator.cs b/src/ComputeSharp.SourceGenerators/IShaderGenerator.cs index f1d5f259..24559ce2 100644 --- a/src/ComputeSharp.SourceGenerators/IShaderGenerator.cs +++ b/src/ComputeSharp.SourceGenerators/IShaderGenerator.cs @@ -12,7 +12,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; namespace ComputeSharp.SourceGenerators; /// -/// A source generator creating data loaders for and types. +/// A source generator creating data loaders for and types. /// [Generator(LanguageNames.CSharp)] public sealed partial class IShaderGenerator : IIncrementalGenerator diff --git a/src/ComputeSharp.WinUI/ShaderRunner{T}.cs b/src/ComputeSharp.WinUI/ShaderRunner{T}.cs index 7ed4ce51..0ad131f0 100644 --- a/src/ComputeSharp.WinUI/ShaderRunner{T}.cs +++ b/src/ComputeSharp.WinUI/ShaderRunner{T}.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.WinUI; /// /// The type of shader to use to render frames. public sealed class ShaderRunner : IShaderRunner - where T : struct, IPixelShader + where T : struct, IComputeShader { /// /// The instance used to create shaders to run. diff --git a/src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs b/src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs index f614e7c9..fb39c5f0 100644 --- a/src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs +++ b/src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs @@ -18,7 +18,7 @@ namespace ComputeSharp; /// /// // A pixel shader that is dispatched on a target texture /// [EmbeddedBytecode(DispatchAxis.XY)] -/// struct MyShader : IPixelShader<float4> +/// struct MyShader : IComputeShader<float4> /// { /// } /// diff --git a/src/ComputeSharp/Core/Interfaces/IComputeShader{TPixel}.cs b/src/ComputeSharp/Core/Interfaces/IComputeShader{TPixel}.cs new file mode 100644 index 00000000..c661f72d --- /dev/null +++ b/src/ComputeSharp/Core/Interfaces/IComputeShader{TPixel}.cs @@ -0,0 +1,22 @@ +using ComputeSharp.__Internals; + +#pragma warning disable CS0618 + +namespace ComputeSharp; + +/// +/// An representing a compute shader writing into a target texture. +/// +/// The type of pixels being written by the compute shader. +/// +/// This interface allows implementing logic analogous of pixel shaders, but via compute shaders. +/// +public interface IComputeShader : IShader + where TPixel : unmanaged +{ + /// + /// Executes the current compute shader. + /// + /// The pixel value for the current invocation. + TPixel Execute(); +} \ No newline at end of file diff --git a/src/ComputeSharp/Core/Interfaces/IPixelShader{TPixel}.cs b/src/ComputeSharp/Core/Interfaces/IPixelShader{TPixel}.cs deleted file mode 100644 index b12cf074..00000000 --- a/src/ComputeSharp/Core/Interfaces/IPixelShader{TPixel}.cs +++ /dev/null @@ -1,18 +0,0 @@ -using ComputeSharp.__Internals; - -#pragma warning disable CS0618 - -namespace ComputeSharp; - -/// -/// An representing a pixel shader. -/// -public interface IPixelShader : IShader - where TPixel : unmanaged -{ - /// - /// Executes the current pixel shader. - /// - /// The pixel value for the current invocation. - TPixel Execute(); -} \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs index c492f2c4..6b026dd6 100644 --- a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs +++ b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs @@ -71,7 +71,7 @@ public static partial class GraphicsDeviceExtensions /// The to use to run the shader. /// The target texture to apply the pixel shader to. public static void ForEach(this GraphicsDevice device, IReadWriteNormalizedTexture2D texture) - where T : struct, IPixelShader + where T : struct, IComputeShader where TPixel : unmanaged { default(ArgumentNullException).ThrowIfNull(device); @@ -91,7 +91,7 @@ public static partial class GraphicsDeviceExtensions /// The target texture to apply the pixel shader to. /// The input instance representing the pixel shader to run. public static void ForEach(this GraphicsDevice device, IReadWriteNormalizedTexture2D texture, in T shader) - where T : struct, IPixelShader + where T : struct, IComputeShader where TPixel : unmanaged { default(ArgumentNullException).ThrowIfNull(device); diff --git a/src/ComputeSharp/Shaders/ComputeContext.cs b/src/ComputeSharp/Shaders/ComputeContext.cs index 0f92e29f..7db08910 100644 --- a/src/ComputeSharp/Shaders/ComputeContext.cs +++ b/src/ComputeSharp/Shaders/ComputeContext.cs @@ -191,7 +191,7 @@ public struct ComputeContext : IDisposable, IAsyncDisposable /// The target texture to invoke the pixel shader upon. /// The input instance representing the pixel shader to run. internal readonly unsafe void Run(IReadWriteNormalizedTexture2D texture, ref T shader) - where T : struct, IPixelShader + where T : struct, IComputeShader where TPixel : unmanaged { default(InvalidOperationException).ThrowIf(this.device is null); diff --git a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs index 163037a3..0776a540 100644 --- a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs +++ b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs @@ -526,7 +526,7 @@ public static class ComputeContextExtensions /// The to use to run the shader. /// The target texture to apply the pixel shader to. public static void ForEach(this in ComputeContext context, IReadWriteNormalizedTexture2D texture) - where T : struct, IPixelShader + where T : struct, IComputeShader where TPixel : unmanaged { default(ArgumentNullException).ThrowIfNull(texture); @@ -543,7 +543,7 @@ public static class ComputeContextExtensions /// The target texture to apply the pixel shader to. /// The input instance representing the pixel shader to run. public static void ForEach(this in ComputeContext context, IReadWriteNormalizedTexture2D texture, in T shader) - where T : struct, IPixelShader + where T : struct, IComputeShader where TPixel : unmanaged { default(ArgumentNullException).ThrowIfNull(texture); diff --git a/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs b/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs index af76a1ac..c1fcf6a7 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs @@ -177,7 +177,7 @@ public partial class DeviceDisposalTests } [EmbeddedBytecode(DispatchAxis.XY)] - private partial struct HelloWorldShader : IPixelShader + private partial struct HelloWorldShader : IComputeShader { public float4 Execute() { diff --git a/tests/ComputeSharp.Tests.DisableDynamicCompilation/DispatchTests.cs b/tests/ComputeSharp.Tests.DisableDynamicCompilation/DispatchTests.cs index 775d0256..b0d1ec55 100644 --- a/tests/ComputeSharp.Tests.DisableDynamicCompilation/DispatchTests.cs +++ b/tests/ComputeSharp.Tests.DisableDynamicCompilation/DispatchTests.cs @@ -76,7 +76,7 @@ public partial class DispatchTests [AutoConstructor] [EmbeddedBytecode(8, 8, 1)] - internal readonly partial struct PixelShader : IPixelShader + internal readonly partial struct PixelShader : IComputeShader { private readonly float b; private readonly float a; diff --git a/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs b/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs index 9352326b..07ce4586 100644 --- a/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs +++ b/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs @@ -1464,12 +1464,12 @@ public class DiagnosticsTests namespace ComputeSharp { public interface IComputeShader { } - public interface IPixelShader { } + public interface IComputeShader { } } namespace MyFancyApp.Sample { - public struct MyShader : IComputeShader, IPixelShader + public struct MyShader : IComputeShader, IComputeShader { public void Execute() { diff --git a/tests/ComputeSharp.Tests/ComputeContextTests.cs b/tests/ComputeSharp.Tests/ComputeContextTests.cs index 07f12e49..adff51ed 100644 --- a/tests/ComputeSharp.Tests/ComputeContextTests.cs +++ b/tests/ComputeSharp.Tests/ComputeContextTests.cs @@ -1309,7 +1309,7 @@ public partial class ComputeContextTests [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] - internal readonly partial struct ClearPixelShader : IPixelShader + internal readonly partial struct ClearPixelShader : IComputeShader { /// public float4 Execute() @@ -1320,7 +1320,7 @@ public partial class ComputeContextTests [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] - internal readonly partial struct ColorPixelShader : IPixelShader + internal readonly partial struct ColorPixelShader : IComputeShader { public readonly float4 color; @@ -1333,7 +1333,7 @@ public partial class ComputeContextTests [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] - internal readonly partial struct LinearSampling2DPixelShader : IPixelShader + internal readonly partial struct LinearSampling2DPixelShader : IComputeShader { public readonly IReadOnlyTexture2D source; @@ -1365,7 +1365,7 @@ public partial class ComputeContextTests [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] - internal readonly partial struct LinearSamplingFromNormalized2DPixelShader : IPixelShader + internal readonly partial struct LinearSamplingFromNormalized2DPixelShader : IComputeShader { public readonly IReadOnlyNormalizedTexture2D source; @@ -1378,7 +1378,7 @@ public partial class ComputeContextTests [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] - internal readonly partial struct CopyToOutputPixelShader : IPixelShader + internal readonly partial struct CopyToOutputPixelShader : IComputeShader { public readonly IReadOnlyNormalizedTexture2D source; @@ -1391,7 +1391,7 @@ public partial class ComputeContextTests [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] - internal readonly partial struct InvertPixelShader : IPixelShader + internal readonly partial struct InvertPixelShader : IComputeShader { public readonly IReadWriteNormalizedTexture2D source; diff --git a/tests/ComputeSharp.Tests/DispatchTests.cs b/tests/ComputeSharp.Tests/DispatchTests.cs index 1bd1c4e0..8c0f47f4 100644 --- a/tests/ComputeSharp.Tests/DispatchTests.cs +++ b/tests/ComputeSharp.Tests/DispatchTests.cs @@ -291,7 +291,7 @@ public partial class DispatchTests } [EmbeddedBytecode(DispatchAxis.XY)] - internal readonly partial struct DispatchPixelShader : IPixelShader + internal readonly partial struct DispatchPixelShader : IComputeShader { public float4 Execute() { diff --git a/tests/ComputeSharp.Tests/IPixelShaderTests.cs b/tests/ComputeSharp.Tests/IPixelShaderTests.cs index f81606a4..7fad3712 100644 --- a/tests/ComputeSharp.Tests/IPixelShaderTests.cs +++ b/tests/ComputeSharp.Tests/IPixelShaderTests.cs @@ -36,7 +36,7 @@ public partial class IPixelShaderTests [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] - internal readonly partial struct EarlyReturnShader : IPixelShader + internal readonly partial struct EarlyReturnShader : IComputeShader { public float4 Execute() { diff --git a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs index 34ee62e0..b44ddc23 100644 --- a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs +++ b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs @@ -294,7 +294,7 @@ namespace ComputeSharp.Tests } [EmbeddedBytecode(DispatchAxis.XY)] - public readonly partial struct StatelessPixelShader : IPixelShader + public readonly partial struct StatelessPixelShader : IComputeShader { /// public float4 Execute() @@ -406,7 +406,7 @@ namespace ComputeSharp.Tests _ = ReflectionServices.GetShaderInfo(); } - public interface IMyBaseShader : IPixelShader + public interface IMyBaseShader : IComputeShader where T : unmanaged { public int A { get; } diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs b/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs index 5b0a6bad..43c0573f 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; /// [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] -internal readonly partial struct HelloWorld : IPixelShader +internal readonly partial struct HelloWorld : IComputeShader { /// /// The current time since the start of the application. diff --git a/tests/ComputeSharp.Tests/ShadersTests.cs b/tests/ComputeSharp.Tests/ShadersTests.cs index e765128a..b49e9af8 100644 --- a/tests/ComputeSharp.Tests/ShadersTests.cs +++ b/tests/ComputeSharp.Tests/ShadersTests.cs @@ -185,7 +185,7 @@ public class ShadersTests else { static void RunPixelShader(ReadWriteTexture2D texture) - where T : struct, IPixelShader + where T : struct, IComputeShader { ShaderInfo info = ReflectionServices.GetShaderInfo(); @@ -230,7 +230,7 @@ public class ShadersTests Func, TPixel> pixelFactory, float delta) where TCompute : struct, IComputeShader - where TPixel : struct, IPixelShader + where TPixel : struct, IComputeShader { _ = device.Get(); diff --git a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs index f204cb24..dbc26b43 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs +++ b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs @@ -107,7 +107,7 @@ partial class Texture2DTests [AutoConstructor] [EmbeddedBytecode(DispatchAxis.XY)] - public readonly partial struct SamplingPixelShader : IPixelShader + public readonly partial struct SamplingPixelShader : IComputeShader { public readonly IReadOnlyNormalizedTexture2D texture;