/// <summary> /// Converts the specified hlsl source code to glsl. /// </summary> /// <param name="hlslEntryPoint">The HLSL entry point.</param> /// <param name="stage">The stage to convert.</param> /// <param name="shader">The shader.</param> /// <param name="inputHlslFilepath">The input HLSL filepath.</param> /// <returns> /// The resulting glsl AST tree. /// </returns> private global::SiliconStudio.Shaders.Ast.Shader Convert(ParsingResult result, string hlslEntryPoint, PipelineStage stage, string inputHlslFilepath, LoggerResult log) { try { var convertor = new HlslToGlslConvertor(hlslEntryPoint, stage, ShaderModel.Model40) // TODO HARDCODED VALUE to change { KeepConstantBuffer = !isOpenGLES || isOpenGLES3, TextureFunctionsCompatibilityProfile = isOpenGLES && !isOpenGLES3, NoSwapForBinaryMatrixOperation = true, UseBindingLayout = false, UseLocationLayout = false, UseSemanticForVariable = true, IsPointSpriteShader = false, ViewFrustumRemap = true, KeepNonUniformArrayInitializers = !isOpenGLES, IsOpenGLES2 = isOpenGLES && !isOpenGLES3 }; convertor.Run(result); // After the converter we display the errors but we don't stop writing output glsl if (result.HasErrors) { //DisplayError(log, result, "Error while converting file:"); } return(result.Shader); } catch (Exception ex) { log.Error("Unexpected error while converting file [{0}] with entry point [{1}]", ex, inputHlslFilepath, hlslEntryPoint); return(null); } }
/// <summary> /// Converts the specified hlsl source code to glsl. /// </summary> /// <param name="hlslEntryPoint">The HLSL entry point.</param> /// <param name="stage">The stage to convert.</param> /// <param name="shader">The shader.</param> /// <param name="inputHlslFilepath">The input HLSL filepath.</param> /// <returns> /// The resulting glsl AST tree. /// </returns> private global::SiliconStudio.Shaders.Ast.Shader Convert(ParsingResult result, string hlslEntryPoint, PipelineStage stage, string inputHlslFilepath, IDictionary <int, string> inputAttributeNames, LoggerResult log) { try { var convertor = new HlslToGlslConvertor(shaderPlatform, shaderVersion, hlslEntryPoint, stage, ShaderModel.Model40) // TODO HARDCODED VALUE to change { // Those settings are now default values //NoSwapForBinaryMatrixOperation = true, //UnrollForLoops = true, //ViewFrustumRemap = true, //FlipRenderTarget = true, //KeepConstantBuffer = !isOpenGLES || isOpenGLES3, //TextureFunctionsCompatibilityProfile = isOpenGLES && !isOpenGLES3, //KeepNonUniformArrayInitializers = !isOpenGLES, UseBindingLayout = false, UseSemanticForVariable = true, IsPointSpriteShader = false, InputAttributeNames = inputAttributeNames }; convertor.Run(result); // After the converter we display the errors but we don't stop writing output glsl if (result.HasErrors) { //DisplayError(log, result, "Error while converting file:"); } return(result.Shader); } catch (Exception ex) { log.Error("Unexpected error while converting file [{0}] with entry point [{1}]", ex, inputHlslFilepath, hlslEntryPoint); return(null); } }
/// <summary> /// Converts the specified hlsl source code to glsl. /// </summary> /// <param name="hlslEntryPoint">The HLSL entry point.</param> /// <param name="stage">The stage to convert.</param> /// <param name="shader">The shader.</param> /// <param name="inputHlslFilepath">The input HLSL filepath.</param> /// <returns> /// The resulting glsl AST tree. /// </returns> private global::SiliconStudio.Shaders.Ast.Shader Convert(ParsingResult result, string hlslEntryPoint, PipelineStage stage, string inputHlslFilepath, LoggerResult log) { try { var convertor = new HlslToGlslConvertor(hlslEntryPoint, stage, ShaderModel.Model40) // TODO HARDCODED VALUE to change { KeepConstantBuffer = !isOpenGLES || isOpenGLES3, TextureFunctionsCompatibilityProfile = isOpenGLES && !isOpenGLES3, NoSwapForBinaryMatrixOperation = true, UseBindingLayout = false, UseLocationLayout = false, UseSemanticForVariable = true, IsPointSpriteShader = false, ViewFrustumRemap = true, FlipRenderTargetFlag = "ParadoxFlipRendertarget", KeepNonUniformArrayInitializers = !isOpenGLES, IsOpenGLES2 = isOpenGLES && !isOpenGLES3 }; convertor.Run(result); // After the converter we display the errors but we don't stop writing output glsl if (result.HasErrors) { //DisplayError(log, result, "Error while converting file:"); } return result.Shader; } catch (Exception ex) { log.Error("Unexpected error while converting file [{0}] with entry point [{1}]", ex, inputHlslFilepath, hlslEntryPoint); return null; } }
/// <summary> /// Converts the specified hlsl source code to glsl. /// </summary> /// <param name="hlslEntryPoint">The HLSL entry point.</param> /// <param name="stage">The stage to convert.</param> /// <param name="shader">The shader.</param> /// <param name="inputHlslFilepath">The input HLSL filepath.</param> /// <returns> /// The resulting glsl AST tree. /// </returns> private global::SiliconStudio.Shaders.Ast.Shader Convert(ParsingResult result, string hlslEntryPoint, PipelineStage stage, string inputHlslFilepath, IDictionary<int, string> inputAttributeNames, LoggerResult log) { try { var convertor = new HlslToGlslConvertor(shaderPlatform, shaderVersion, hlslEntryPoint, stage, ShaderModel.Model40) // TODO HARDCODED VALUE to change { // Those settings are now default values //NoSwapForBinaryMatrixOperation = true, //UnrollForLoops = true, //ViewFrustumRemap = true, //FlipRenderTarget = true, //KeepConstantBuffer = !isOpenGLES || isOpenGLES3, //TextureFunctionsCompatibilityProfile = isOpenGLES && !isOpenGLES3, //KeepNonUniformArrayInitializers = !isOpenGLES, UseBindingLayout = false, UseSemanticForVariable = true, IsPointSpriteShader = false, InputAttributeNames = inputAttributeNames }; convertor.Run(result); // After the converter we display the errors but we don't stop writing output glsl if (result.HasErrors) { //DisplayError(log, result, "Error while converting file:"); } return result.Shader; } catch (Exception ex) { log.Error("Unexpected error while converting file [{0}] with entry point [{1}]", ex, inputHlslFilepath, hlslEntryPoint); return null; } }