I eventually found that tutorial (a link would have been very helpful!) but I don't know where to get the source code and libraries from. There's a link to an old website belonging to my ISP. but that's long since gone. So I had to laboriously type in the definitions from scratch (I don't guarantee they are correct), which gave me this for the "to create a device and a swap chain" panel:
Code: Select all
Width% = 640
Height% = 512
SYS "SDL_LoadObject", "D3D11.DLL" TO d3d11%
SYS "SDL_LoadFunction", d3d11%, "D3D11CreateDeviceAndSwapChain" TO `D3D11CreateDeviceAndSwapChain`
DIM DXGI_RATIONAL{Numerator%, Denominator%}
DIM DXGI_SAMPLE_DESC{Count%, Quality%}
DIM DXGI_MODE_DESC{Width%, Height%, RefreshRate{} = DXGI_RATIONAL{}, \
\ Format%, ScanlineOrdering%, Scaling%}
DIM DXGI_SWAP_CHAIN_DESC{BufferDesc{}=DXGI_MODE_DESC{}, SampleDesc{}=DXGI_SAMPLE_DESC{}, \
\ BufferUsage%, BufferCount%, OutputWindow%, Windowed%, SwapEffect%, Flags%}
DXGI_FORMAT_R8G8B8A8_UNORM = 28
DXGI_USAGE_RENDER_TARGET_OUTPUT = 32
D3D_DRIVER_TYPE_HARDWARE = 1
D3D11_SDK_VERSION = 7
NULL = 0
S_OK = 0
DIM sd{} = DXGI_SWAP_CHAIN_DESC{}
sd.BufferCount% = 1
sd.BufferDesc.Width% = Width%
sd.BufferDesc.Height% = Height%
sd.BufferDesc.Format% = DXGI_FORMAT_R8G8B8A8_UNORM
sd.BufferDesc.RefreshRate.Numerator% = 60
sd.BufferDesc.RefreshRate.Denominator% = 1
sd.BufferUsage% = DXGI_USAGE_RENDER_TARGET_OUTPUT
sd.OutputWindow% = @hwnd%
sd.SampleDesc.Count% = 1
sd.SampleDesc.Quality% = 0
sd.Windowed% = 1
SYS `D3D11CreateDeviceAndSwapChain`, NULL, D3D_DRIVER_TYPE_HARDWARE, \
\ NULL, 0, NULL, 0, D3D11_SDK_VERSION, sd{}, ^pSwapChain%, \
\ ^pd3dDevice%, NULL, ^pImmediateContext% TO hr%
IF hr% <> S_OK ERROR 100, "CreateDeviceAndSwapChain failed: "+STR$~hr%
!(^IDXGISwapChain{}+4) = !pSwapChain%
!(^ID3D11Device{}+4) = !pd3dDevice%
!(^ID3D11DeviceContext{}+4) = !pImmediateContext%
Please POST A MINIMAL REPRODUCIBLE EXAMPLE of any code which is failing, rather than expecting me to do all the work.