Tuesday 12 October 2010

Update for use with June 2010 DirectX SDK

I've updated my Direct2D/Direct3D Delphi interface units for use with the June 2010 DirectX SDK.

The units should work with Delphi 2009, 2010 and XE. They may work (or be made to work) with other versions of Delphi.

Key changes:

UD3DCommon_JSB.pas added.
UD3DCompiler_JSB.pas added (allows D3D11 shader reflection).

Note that UD3DCommon_JSB.pas may need to be added to the "uses" section of existing applications.

See http://www.jsbmedical.co.uk/DirectXForDelphi/ for the units and effects DLL.

Note that applications that use these units will require the June 2010 DirectX redistributable files to be installed. The version suffix associated with this version is 43 (e.g. D3DCompiler_43.dll, d3dx11_43.dll etc).

Hint: You may wish to merge the new units with your existing units (e.g. using BeyondCompare) rather than overwrite them, so that you are aware of the changes.

JB.

Tuesday 19 January 2010

Runtime linking to Direct3D DLLs

I've added optional runtime linking to the Direct3D DLLs. By runtime linking I mean the linking is done when the application requests it, rather than when the application loads. When runtime linking is enabled, applications which use Direct3D DLLs will still load even if the DLLs are not present.

Typical situations where this is useful are:

1) Enabling applications which require a particular version of DirectX to display an accurate message about the problem - e.g. "Direct3D 11 is not installed".

2) Enabling Applications which work with a range of Direct3D versions (e.g. 9, 10, 10.1, 11) to be run even if one or more versions are not present.

To enable runtime linking:

1) Specify the conditional define "UseRuntimeLinking" in the base build configuration of the Delphi project.

2) Early on in your application, call the Link method (procedure) for each Direct3D header file that you are using.

E.g.

try
  DXGI_JSB.Link;
  D3D10_JSB.Link;
  D3D10_1_JSB.Link;
  D3DX10_JSB.Link;
except
  raise Exception.Create('Direct3D 10.1 is not installed.');
end;

Notes:
 
1) Call "Link" for later versions of Direct3D first, so that the user is instructed to install the latest required version of Direct3D. Typically all the Link calls and associated logic can be put in a single place such as your graphics library and called from many applications.
 
2) Call "Link" only once for each run of the application.
 
3) A special exception "E_Effects11" is raised by D3DX11_JSB if d3dx11Effects_JSB.dll is not present. The reason for this is that this DLL needs to be installed as part of the application and so requires a specific message about this file to be given to the user. (This DLL is typically put in System32 or the application folder).
 
JB.