Answered by:
No d3dx11.lib and dxerr.lib in Visual Studio 2011 beta?

Question
-
I am rewriting my D3D10 application to Metro style app with D3D11. My application need to link d3dx10.lib and dxerr.lib to build. In Windows 8 with VS2011 beta, these two files are missing in C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x86. So I wonder whether the two library files are provided in VS2011 beta? If not, what are their replacements?
- Edited by Leonard Tuesday, April 24, 2012 3:51 PM
Tuesday, April 24, 2012 3:50 PM
Answers
-
- Marked as answer by Leonard Thursday, April 26, 2012 3:22 PM
Tuesday, April 24, 2012 9:21 PM
All replies
-
- Marked as answer by Leonard Thursday, April 26, 2012 3:22 PM
Tuesday, April 24, 2012 9:21 PM -
See <http://blogs.msdn.com/b/chuckw/archive/2012/03/22/where-is-the-directx-sdk.aspx>
It's sad to find D3DX cannot be used to build Metro-style applications, as our application relies heavily on D3DX features such as vector/matrix, color, font, effect file, texturing etc. Could you please suggest some replacement libraries? In particular, what are the counterparts of the replaced functions listed below?
D3DXMatrixOrthoOffCenterLH, D3DXMatrixScaling, D3DXMatrixTranslation, D3DX10CreateEffectFromFile, and D3DX10CreateTextureFromMemory.
- Edited by Leonard Wednesday, April 25, 2012 4:14 AM
Wednesday, April 25, 2012 4:14 AM -
DirectXMath replaces D3DXMath.
D3DX10CreateTextureFromMemory can be handled in a number of ways depending on your needs. DirectXTK an DirectXTex are options here: DDSTextureLoader is a very efficient way to load .DDS files from disk and create resources from that information at runtime. WICTextureLoader is a light-weight way to load traditional image files (PNG, JPEG, etc.) using WIC and enabling auto-gen mipmapped resources at runtime--DDS is a much better choice for performance, image quality and resource types, but it does the job. DirectXTex is essentially the entire suite of texture functionality in D3DX but is really overkill for most applications--it makes most sense for build-time tools.
D3DX10CreateEffectFromFile is a more complex issue. The fact that you aren't using D3DX10CompileShaderFromFile indicates you are using Effects (aka FX10). There's really no equivalent to Effects for Metro. The DirectX SDK (June 2010) includes a shared source version of Effects 11 but it requires you have runtime support for shader meta-data reflection. This API is available in D3DCompiler_*.DLL which you can certainly use for development and for Win32 desktop applications, but you can't deploy D3DComplier_*.DLL with your Metro style app--the APIs are not considered Metro safe.
If you were using D3DX10CompileShaderFromFile, you can use D3DCompileFromFile in D3DCompiler_*.DLL very directly. Again, however, it is only supported for use for development and for Win32 desktop applications, and you must precompile all your shaders in a Metro style app before deployment.
- Edited by Chuck Walbourn - MSFTMicrosoft employee Tuesday, July 16, 2013 8:24 PM link
Wednesday, April 25, 2012 7:22 PM -
Thanks for you further help Chuck.
I am very concerned that there is no equivalent to Effect for Metro. If that's the case, then how can I define vertex shader, geometry shader, and pixel shader when developing Metro app?
Thursday, April 26, 2012 3:27 PM -
The fx profiles are essentially a meta langauge for generating individual shader permutations.
BasicHLSL.fx
...
technique RenderSceneWithTexture1NoLight { pass P0 { VertexShader = compile vs_4_0_level_9_1 RenderSceneVS( 1, true, true ); PixelShader = compile ps_4_0_level_9_1 RenderScenePS( true ); } }
Instead of doing a fx_ profile on BasicHLSL.fx once, you do individual compiles for each shader stage * technique * pass. You'll have to modify a number of elements in the .FX File since you don't have the Effects runtime doing a bunch of magic metadata in the background.
Note you can compile the same file many times with different settings, but with VS 11's MSBuild environment it's better to have an individual .hlsl file for each variation and shader stage.
BasicHLSL11_VS_Texture1Light.hlsl
#include "BasicHLSL.fx" VS_OUTPUT VSMain( float4 vPos : POSITION, float3 vNormal : NORMAL, float2 vTexCoord0 : TEXCOORD0 ) { return RenderSceneVS( vPos, Vnormal, vTexCoord0, true, true ); }
This is compiled using
fxc /Tvs_4_0_level_9_1 /EVSMain BasicHLSL11_VS_Texture1Light.hlsl
BasicHLSL11_PS_Texture1Light.hlsl
#include "BasicHLSL.fx" VS_OUTPUT PSMain( VS_OUTPUT In ) { return RenderScenePS( In, true ); }
Similiarly the pixel shader is compiled using
fxc /Tps_4_0_level_9_1 /EPSMain BasicHLSL11_PS_Texture1Light.hlsl
In fact, if you look at the legacy Direct3D 11 (June 2010) sample "DynamicShaderLinkage" and "DynamicShaderLinkageFX11" essentially the opposite is happening putting individual hlsl files into an fx file.
- Edited by Chuck Walbourn - MSFTMicrosoft employee Thursday, April 26, 2012 7:01 PM
Thursday, April 26, 2012 6:59 PM -
Monday, June 11, 2012 9:41 PM
-
You may want to review this post.Wednesday, August 21, 2013 6:21 AM