tgjones / shader-playground

Shader playground website for exploring HLSL, GLSL, SPIR-V compilers
http://shader-playground.timjones.io
BSD 2-Clause "Simplified" License
577 stars 45 forks source link

Passing options to DXC doesn't work #95

Closed Xottab-DUTY closed 3 years ago

Xottab-DUTY commented 3 years ago

I passed option /blablabla (just a random text) and got this site error:

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'Invalid value for ExtraOptions: '/blablabla'')
   at ShaderPlayground.Core.ShaderCompilerArguments.GetString(String name) in C:\Code\shader-playground\src\ShaderPlayground.Core\ShaderCompilerArguments.cs:line 63
   at ShaderPlayground.Core.Compilers.Dxc.DxcCompiler.Compile(ShaderCode shaderCode, ShaderCompilerArguments arguments) in C:\Code\shader-playground\src\ShaderPlayground.Core\Compilers\Dxc\DxcCompiler.cs:line 204
   at ShaderPlayground.Core.Compiler.Compile(ShaderCode shaderCode, CompilationStep[] compilationSteps) in C:\Code\shader-playground\src\ShaderPlayground.Core\Compiler.cs:line 125
   at ShaderPlayground.Web.Controllers.ApiController.Compile(ShaderCompilationRequestViewModel model) in C:\Code\shader-playground\src\ShaderPlayground.Web\Controllers\ApiController.cs:line 67

Normally, it should just pass it straightforward to the compiler command line without searching for allowed values.

hybridherbst commented 3 years ago

Same here, just tried with /Zi because an error log told me to

Error: Use /Zi for source location.

"Zi" does nothing and "/Zi" throws above exception.

Repro case: http://shader-playground.timjones.io/1e89247ebc1bb12902aed1baa18b3256

tgjones commented 3 years ago

This was due to over-zealous validation, which I've loosened a little. Thanks for reporting this!