From 9718ab32e91ba632b03ad8d0f5e89a597b225a4c Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 21 Jul 2017 11:37:31 -0700 Subject: Add an API option to control emission of `#line` directives - API users can use this to get "clean" output to aid with debugging Slang issues - Also changes the prefix on intermediate files that Slang dumps, to make them easier to ignore with a regexp --- slang.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'slang.h') diff --git a/slang.h b/slang.h index a9b69d705..2485a5e57 100644 --- a/slang.h +++ b/slang.h @@ -96,6 +96,18 @@ extern "C" SLANG_COMPILE_FLAG_NO_CHECKING = 1 << 0, /**< Disable semantic checking as much as possible. */ }; + /*! + @brief Options to control emission of `#line` directives + */ + typedef unsigned int SlangLineDirectiveMode; + enum + { + SLANG_LINE_DIRECTIVE_MODE_DEFAULT = 0, /**< Default behavior: pick behavior base on target. */ + SLANG_LINE_DIRECTIVE_MODE_NONE, /**< Don't emit line directives at all. */ + SLANG_LINE_DIRECTIVE_MODE_STANDARD, /**< Emit standard C-style `#line` directives. */ + SLANG_LINE_DIRECTIVE_MODE_GLSL, /**< Emit GLSL-style directives with file *number* instead of name */ + }; + typedef int SlangSourceLanguage; enum { @@ -176,6 +188,13 @@ extern "C" SlangCompileRequest* request, int enable); + /*! + @brief Set whether (and how) `#line` directives hsould be output. + */ + SLANG_API void spSetLineDirectiveMode( + SlangCompileRequest* request, + SlangLineDirectiveMode mode); + /*! @brief Sets the target for code generation. @param ctx The compilation context. -- cgit v1.2.3