Pre loader

Always get error on new Direct3D10RenderSurface()

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

Hi ,

I’m trying to use DirectX acceleration on my graphs. I have Windows 10, DirectX 12 with a nvidia gtx 660 graphic card.

I read your article easy fallback… and I’m trying to make it works.

I get true from Direct3D10CompatibilityHelper.SupportsDirectX10 property , but your method OnTryApplyDirectXRendererChanged fails to create

var directXSurface = new Direct3D10RenderSurface();

I always get this error

Additional information: Could not load type 'SharpDX.Color4' from assembly 'SharpDX, Version=3.0.2.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1'.

I updated via nuget all assemblies and:
SharpDx version 3.0.2.0 Runtime v4.0.30319
ShaprDX.D3DCompiler version 3.0.2.0 Runtime v4.0.30319
ShaprDX.Direct3D10 version 2.6.3.0 Runtime v4.0.30319
ShaprDX.Direct3D11 version 3.0.2.0 Runtime v4.0.30319
ShaprDX.Direct3D9 version 3.0.2.0 Runtime v4.0.30319

This is the definition of my surface

<s:SciChartSurface Name="sciChart" 
                    Grid.Row="0"
                    dirx:DirectXHelper.TryApplyDirectXRenderer="True"
                    BorderThickness="0"
                    s:ThemeManager.Theme="{Binding ElementName=ChangeThemeCombo, Path=SelectedItem}"
                    Padding="0"
                    VerticalAlignment="Stretch"
                    s:SciChartGroup.VerticalChartGroup="myCharts"
                    >

Could you help me please?

  • You must to post comments
0
0

Hi Lorenzo,

We internally reference SharpDX v2.6.3 so I think you need to ensure all SharpDX assemblies are the same version.

Let me know if that helps,

Best regards,
Andrew

  • You must to post comments
0
0

Thank you for your reply Andrew

after some investigations, I disinstalled all sharpdx reference from my project previously installed via nuget and reinstalled with the “normal” add reference, now ( I would like to upload the image to let you see, but I always get a “forbidden”) I have all the sharpdx with version 2.6.3.

please look at these pictures

https://drive.google.com/file/d/0BxnYBb7n_btoQ0pGaklpdUdBd1U/view?usp=sharing
https://drive.google.com/file/d/0BxnYBb7n_btoYUI3VWE2YUI2Qmc/view?usp=sharing

But now, on OnTryApplyDirectXRendererChanged this line: if (Direct3D10CompatibilityHelper.SupportsDirectX10)
{

I get another error:

An exception of type ‘System.TypeInitializationException’ occurred in myprogram.exe but was not handled in user code

Additional information: The type initializer for ‘SciChart.Drawing.DirectX.Context.D3D10.Direct3D10CompatibilityHelper’ threw an exception.

here you can see the screenshot with the error

https://drive.google.com/file/d/0BxnYBb7n_btoUHpRMjJPTFFqVTg/view?usp=sharing

am I doing something wrong?

  • You must to post comments
0
0

Hi Lorenzo,

I’m still assuming something is wrong with the references here. The implementation of Direct3D10CompatbilityHelper.SupportsDirectX10 simply returns three static properties:

public static bool SupportsDirectX10 
{ 
    get 
    { 
        return IsSupportedOperatingSystem && HasDirectX10RuntimeInstalled && HasDirectX10CapableGpu; 
    } 
}

The static constructor of Direct3D10CompatbilityHelper does do some checking of minimum requirements and attempts to create a SharpDX.Direct3D10.Device1 to assess compatibility, however this is thrown & caught like this:

    static Direct3D10CompatibilityHelper()
    {
        // Sets IsSupportedOperatingSystem=True if OS is greater than or equal to Windows Vista (e.g. XP should return false) 
        IsSupportedOperatingSystem = Environment.OSVersion.Version.Major >= 6;
        if (!IsSupportedOperatingSystem) return;

        // Checks Windows directories for presence of D3DX9, D3DX10 DLLs. 
        // If they don't exist, outputs the dependencies packaged with SciChart3D.Wpf.dll to user LocalAppData dir and loads those
        // 
        // Failure to find these means you need to install the DirectX runtime at https://www.microsoft.com/en-gb/download/details.aspx?id=8109
        HasDirectX10RuntimeInstalled = CheckDirectXDependencies();

        try
        {
            // Values taken from d3d10.h to check DirectX version
            const uint D3D10_SDK_VERSION = 29;
            const uint D3DX10_SDK_VERSION = 43;

            // Checks DirectX 10 GPU compatibility with the DirectX10 runtime
            HResult hResult = D3DX10CheckVersion(D3D10_SDK_VERSION, D3DX10_SDK_VERSION);
            HasDirectX10RuntimeInstalled |= hResult == HResult.S_OK;
        }
        catch { HasDirectX10RuntimeInstalled = false; }

        Device1 d3D10Device = null;
        try
        {
            d3D10Device = new SharpDX.Direct3D10.Device1(DriverType.Hardware, DeviceCreationFlags.BgraSupport, FeatureLevel.Level_10_0);
            HasDirectX10CapableGpu = true;
        }
        catch { HasDirectX10CapableGpu = false; }
        finally { Disposer.RemoveAndDispose(d3D10Device); }
    }

So you can see there is nothing here to actually throw an exception UNLESS there is a TypeInitializationException which would occur because of bad references.

Try to do this:

  1. Create a new WPF Application (completely new solution + project)
  2. Add a NuGet package reference to SciChart.DirectX from our NuGet Feed
  3. Call the method Direct3D10CompatibilityHelper.SupportsDirectX10 in the constructor of MainWindow

Does this work? Or fail?

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies