delphi - Ifiremonkey 中的 DirectX 10 支持(注释 10.1)

标签 delphi delphi-xe3 direct2d directx-10

是否可以下降到 DX10 而不是 DX10.1 支持。我有一个客户的计算机仅支持DX10,因此他们无法利用Direct2D,因为FM似乎只支持10.1

我尝试修改源以使用 DX10(FMX.Canvas.D2D 和 FMX.Context.DX10),并进行另一次切换以下拉至 DX10,但一次调用似乎失败。

我修改了共享设备的创建方式

if not Assigned(FSharedDevice) then 
begin
SaveClearFPUState;
try
Flags := {$ifdef DXDEBUG}D3D10_CREATE_DEVICE_DEBUG{$else}0{$endif};
Flags := Flags or D3D10_CREATE_DEVICE_BGRA_SUPPORT;
HR := D3D10CreateDevice(nil, FDriverType, 0, Flags, D3D10_SDK_VERSION, FSharedDevice);
if Succeeded(HR) then
begin
HR := FSharedDevice.CreateBuffer(TD3D10_BufferDesc.Create(VBSize, D3D10_BIND_VERTEX_BUFFER, D3D10_USAGE_DYNAMIC, D3D10_CPU_ACCESS_WRITE), nil, @FVB);
HR := FSharedDevice.CreateBuffer(TD3D10_BufferDesc.Create(IBSize, D3D10_BIND_INDEX_BUFFER, D3D10_USAGE_DYNAMIC, D3D10_CPU_ACCESS_WRITE), nil, @FIB);
// Acquire device DXGI factory
HR := FSharedDevice.QueryInterface(IDXGIDevice, DXGIDevice);
if Succeeded(HR) and (DXGIDevice <> nil) then
begin
HR := DXGIDevice.GetParent(IDXGIAdapter, DXGIAdapter);
if Succeeded(HR) and (DXGIAdapter <> nil) then
HR := DXGIAdapter.GetParent(IDXGIFactory, FDXGIFactory);
end;
if not Assigned(FDXGIFactory) then
HR := CreateDXGIFactory(IDXGIFactory, FDXGIFactory);
end;
finally
RestoreFPUState;
end;
end;

当我使用该设备时,我使用如下代码..

SharedDevice: ID3D10Device

if Assigned(TCustomDX10Context.SharedDevice) then
begin
FillChar(Desc, SizeOf(D3D10_TEXTURE2D_DESC), 0);
Desc.Format := DXGI_FORMAT_B8G8R8A8_UNORM;
Desc.Width := 1;
Desc.Height := 1;
Desc.MipLevels := 1;
Desc.ArraySize := 1;
Desc.SampleDesc.Count := 1;
Desc.SampleDesc.Quality := 0;
Desc.Usage := D3D10_USAGE_DEFAULT;
Desc.BindFlags := D3D10_BIND_RENDER_TARGET or D3D10_BIND_SHADER_RESOURCE;
Res := TCustomDX10Context.SharedDevice.CreateTexture2D(Desc, nil, FSharedTexture);
Prop := D2D1RenderTargetProperties(TargetMode, D2D1PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED));
Res := FFactory.CreateDxgiSurfaceRenderTarget(FSharedTexture as IDXGISurface, Prop, FSharedRenderTarget);
end;

我在源代码中创建了一个开关,允许我在 10.1 和 10 设备之间切换,并修改了 FMX.Canvas.D2D 和 FMX.Context.DX10 中的所有代码以使用替代设备。

但是...

CreateDxgiSurfaceRenderTarget 失败,错误代码为 -2147024809。

因此应用程序加载,但表单都是空白,因为无法创建目标。

有哪位大师可以帮忙解决这个问题吗?

最佳答案

Direct2D 1.0 支持与 Direct3D 10.1 的互操作,但它仍然可以通过功能级别选择支持 Direct3D 10.0 硬件。我对Delphi一无所知,但是您不需要调用D3D10CreateDevice来创建Direct3D设备,而是需要调用D3D10CreateDevice1函数。然后,您可以简单地请求所需的功能级别,例如 D3D10_FEATURE_LEVEL_10_0。

关于delphi - Ifiremonkey 中的 DirectX 10 支持(注释 10.1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14345997/

相关文章:

delphi - Delphi 上通过 Winsock2 的原始 UDP 数据包

delphi - 如何创建新的荧光笔 (SynEdit)

delphi - Delphi中的UDP文件传输

delphi - TSaveTextFileDialog 和 Vcl 样式

c++ - Direct2D 深度缓冲区

c++ - 如何判断是使用 '->'还是 '.'

delphi生成随机PIN码

windows - 如何从任务栏(XE4)隐藏 firemonkey 应用程序按钮?

c++ - 形状中的 Flash "CurveTo"和 "LineTo"

android - 如何在安卓上使用第三方库?