【问题标题】:uwp directx and c# developmentuwp directx 和 c# 开发
【发布时间】:2017-03-05 19:10:45
【问题描述】:

我正在开发一个带有 3d 表示视图的UWP C# 蓝牙应用程序。 (手和手指将接收传感器 ST 微电子 WESU)

目前,我使用带有 ti 传感器标签和 DirectX 示例的蓝牙 Windows phone 8 应用程序(桌面和 Windows phone)。

现在我开始使用自定义 UWP BLE 示例(最初存在于 Windows SDK 中)从 stmicro wesu 传感器读取计算的四元数。

但现在它可以在 ble /sharpdx /uwpWindows 10 上正常工作。但是,当我现在尝试在 Lumia 640 上执行应用程序时,出现了异常。

问题在于它使用了DirectX 9,而sharp dx 在UWP 中不支持它。

sharp dx 团队向我证实UWP 不适用于DirectX 9(如果我没记错的话,请访问core.net)。

我尝试将用于像素着色器和顶点着色器的版本降级如下,但它不起作用。

所以我的问题是我如何才能在 Lumia 640 上运行 DirectX 9 Under UWP

//
using (var vertexShaderByteCode = ShaderBytecode.CompileFromFile("vertexShader.hlsl", "main", "vs_4_0_level_9_1", ShaderFlags.None))
{
    vertexShader = new D3D11.VertexShader(this.device,vertexShaderByteCode);
    inputSignature = new ShaderSignature(vertexShaderByteCode);
}

//
using (var pixelShaderByteCode = ShaderBytecode.CompileFromFile("pixelShader.hlsl", "main", "ps_4_0_level_9_1", ShaderFlags.None))
{
    pixelShader = new D3D11.PixelShader(this.device , pixelShaderByteCode);
}

【问题讨论】:

  • 根据此链接 (microsoft.com/en-gb/mobile/phone/lumia640/specifications),Lumia 640 仅支持 DirectX 11。所以它只是不支持 DirectX 9。你确定你的问题出在着色器字节码(它通常向后兼容并且在 HLSL 中不推荐使用的功能很少)而不是你引用的 SharpDX 库吗?

标签: c# uwp bluetooth-lowenergy sharpdx lumia


【解决方案1】:

好的,我同意你的观点,这只是关于 de shader

vs_4_0_level_9_1 ps_4_0_level_9_1

使用 (D3D11.Device defaultDevice = new D3D11.Device(D3D.DriverType.Hardware, D3D11.DeviceCreationFlags.None))

enter image description here

【讨论】:

    猜你喜欢
    • 2017-06-13
    • 2023-03-12
    • 1970-01-01
    • 2014-11-10
    • 1970-01-01
    • 2016-10-26
    • 2017-02-02
    • 1970-01-01
    • 2016-10-14
    相关资源
    最近更新 更多