From AnimatedComputeShaderPanel to ComputeShaderPanel in WinUI 3
diluculo opened this issue · 0 comments
I'm currently working on visualizing voltage distribution in a WinUI 3 app. Currently, I'm using AnimatedComputeShaderPanel
of ComputeSharp v2.0.3
, but I'd like to migrate to ComputeShaderPanel
since the calculation at each pixel coordinate isn't actually time-dependent.
My first question is whether ComputeShaderPanel
is suitable for static visualization tasks. If so, I would like to know whether it can help reduce the GPU load.
Here's the code snippet using AnimatedComputeShaderPanel
:
<computesharp:AnimatedComputeShaderPanel x:Name="ShaderLayer"/>
And in the code-behind, I'm setting up AnimatedComputeShaderPanel
like this:
ShaderLayer.ShaderRunner = new ShaderRunner<Heatmap>(t => new Heatmap(settings, ... ));
The shader Heatmap
is
[EmbeddedBytecode(DispatchAxis.XY)]
[AutoConstructor]
public readonly partial struct Heatmap : IPixelShader<float4>
{
[AutoConstructor]
public readonly partial struct Settings
{
public readonly Bool isDarkTheme;
public readonly Bool renderingAxisLines;
// other properties...
}
// other settings and private methods...
public float4 Execute()
{
// Shader execution logic...
}
));
When attempting to switch to ComputeShaderPanel
in XAML, however, I encountered no rendering result.
Could you guide me on how to accomplish this task? Thank you.