Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing DirectX11 CompileFromFile Errors on Windows #5

Open
JustinBonus opened this issue Aug 25, 2023 · 1 comment
Open

Fixing DirectX11 CompileFromFile Errors on Windows #5

JustinBonus opened this issue Aug 25, 2023 · 1 comment

Comments

@JustinBonus
Copy link

Noting a bug + make-shift user solution + potential permanent solution for others regarding DirectX11 libraries / run-time compilation. This repositories owner knows about part of the issue, seen in both the User Manual for Celeris and:
#1

--- Issue:

Though Celeris app worked out-of-the-box on my Windows 10 Home system, it threw a 'CompileFromFile' error on a Windows 10 Enterprise system when loading a simulation via a cml file. It causes the same issues on a Wine emulation of Windows10 with Ubuntu 18.04.

I believe this is a D3DCompileFromFile() vs D3DX11CompileFromFile() issue. The latter is used in engine.cpp of the source code. Windows 8+ does not support D3DX11 SDK libraries natively, though games / visual studio sometimes install them. See:
https://gamedev.stackexchange.com/questions/136165/d3dx11compilefromfile-function-problem-directx11

--- Quick fix for users:

Download the the D3DX files from the following MS 2010 web link, as mentioned in the Celeris User Manual. Ignore that the dxwebsetup.exe is for Windows 7:
https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=35&tduid=(d5c34b75227807aea00cad2fc302b7da)(256380)(2459594)(TnL5HPStwNw-wC6WISUgqQM1hpaZ1Sq5Fg)()

This might fix things immediately for you, but it did not work on my system. However, it was fixed for me by:

right-click on the dxwebsetup.exe
Properties
Compatibility
Run this program in compatibility mode for :
Windows XP (Service Pack 2/3) [Or whichever Windows XP version is available for you]
Apply
OK
Try the Celeris.exe again

If it doesn't work still, you can check if DirectX is configured properly with command 'dxdiag' (called from the Windows search bar).

--- Potential code fix:

When using D3DX11CompileFromFile() or D3DCompileFromFile() in engine.cpp, may need to add
#include<D3DX11async.h>
or
#include <d3dcompiler.h>
respectively to the file for the desired function. Ideally, swap D3DX11CompileFromFile() -> D3DCompileFromFile(), making any necessary changes for the function arguments
https://learn.microsoft.com/en-us/windows/win32/direct3d11/d3dx11compilefromfile?redirectedfrom=MSDN  
https://learn.microsoft.com/en-us/windows/win32/api/d3dcompiler/nf-d3dcompiler-d3dcompilefromfile 

It would be better to do the latter D3DCompileFromFile() way as it is the modern DirectX approach. May also need to move HLSL / FX files around in the folders. See:
https://walbourn.github.io/hlsl-fxc-and-d3dcompile/

  • Justin
@collinjroland
Copy link

collinjroland commented Oct 1, 2024

FYI the MS 2010 web link mentioned in this comment and in the Celeris user manual is no longer accessible. I am also experiencing issues with DirectX11 libraries on a Windows 11 Home machine, will keep digging.

EDIT

Installed DirectX 11 using this link and Celeris seems to be functional now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants