ValveSoftware / source-sdk-2013

The 2013 edition of the Source SDK
https://developer.valvesoftware.com/wiki/SDK2013_GettingStarted
Other
3.76k stars 2k forks source link

Invalid shader code using D3DVERTEXTEXTURESAMPLER0 that compiles. #355

Open dtugend opened 8 years ago

dtugend commented 8 years ago

For example the depthwrite_vs20.fxc and other shaders currently contain this line, which is used for shader model vs_3_0 compiles:

sampler2D morphSampler : register( D3DVERTEXTEXTURESAMPLER0, s0 );

This seems quite strange, since the HLSL register syntax expects a valid shader model instead of D3DVERTEXTEXTURESAMPLER0 there, if anything.

After lots of thinking and debugging and trial & error I have come to the conclusion, that this is actually a mistake in the shader code, because your Proxy_D3DXCompileShaderFromFile in dx_proxy.dll probably forwards to D3DXCompileShaderFromFile, which compiles for any sting in there (which is probably a bug), while fxc.exe would fail with an error like this:

depthwrite_vs20.fxc(25,41-68): error X3089: 'D3DVERTEXTEXTURESAMPLER0': invalid shader target/usage