简体   繁体   中英

Compile DirectX 11 shader without effects or d3dcompiler.h

I am attempting to compile a DirectX 11 shader on a Windows 7 machine using Visual Studio 2010 on a university computer. I could compile them very well using the contents of d3dcompiler.h on my home Windows 8 computer without Effects, but the unversity computers seem to be missing both Effects and d3dcompiler.h. I don't have administrative access, so I can't install the SDK or similar. Is there an alternative means of compiling HLSL shaders? Or would I have to resort to somehow compiling the d3dcompiler lib file for VS2010 on my own computer and copying it over? I'm asking because I'd really like to be able to work on my game project at university, but this is proving to be more difficult than I have anticipated. Thanks for any help! :D

VS 2012 and VS 2013 include the Windows 8.x SDK so they already have the HLSL compiler FXC.EXE tool and D3DCompile API. VS 2010 is prior to that integration so you have to use the legacy DirectX SDK*

If you are not using the Effects 11 system or D3DReflect generally, you can just precompile your shaders at home. You can either have FXC generate C headers with data blocks in them or binary shader files. This is the technique used for DirectX Tool Kit which includes all it's shader prebuilt as C headers, and most games ship with all their shaders prebuilt as binaries.

With Effects 11 you can also precompile your shaders, but it needs the D3DCompile API at runtime to do the shader reflection.

If your university systems have the legacy DirectX SDK installed, then your project is probably just missing the VC++ Directories settings to get to those include/lib paths.

Footnote* = Actually, you can also use the Windows 8.x SDK with VS 2010 but it's unlikely that your university computer systems have it installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM