Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From AnimatedComputeShaderPanel to ComputeShaderPanel in WinUI 3 #782

Open
diluculo opened this issue Apr 3, 2024 · 0 comments
Open

From AnimatedComputeShaderPanel to ComputeShaderPanel in WinUI 3 #782

diluculo opened this issue Apr 3, 2024 · 0 comments
Labels
question ❓ Further information is requested untriaged 🧰 A new issue that needs initial triage

Comments

@diluculo
Copy link

diluculo commented Apr 3, 2024

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.

@diluculo diluculo added question ❓ Further information is requested untriaged 🧰 A new issue that needs initial triage labels Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question ❓ Further information is requested untriaged 🧰 A new issue that needs initial triage
Projects
None yet
Development

No branches or pull requests

1 participant