summaryrefslogtreecommitdiff
path: root/shaderc/glslc.1
blob: 43a271ef903b511bc2bdc47baf62c36ba0021154 (plain)
    1 '\" t
    2 .\"     Title: glslc Manual
    3 .\"    Author: [see the "AUTHOR(S)" section]
    4 .\" Generator: Asciidoctor 2.0.17
    5 .\"      Date: 2022-02-03
    6 .\"    Manual: \ \&
    7 .\"    Source: \ \&
    8 .\"  Language: English
    9 .\"
   10 .TH "`GLSLC`" "1" "2022-02-03" "\ \&" "\ \&"
   11 .ie \n(.g .ds Aq \(aq
   12 .el       .ds Aq '
   13 .ss \n[.ss] 0
   14 .nh
   15 .ad l
   16 .de URL
   17 \fI\\$2\fP <\\$1>\\$3
   18 ..
   19 .als MTO URL
   20 .if \n[.g] \{\
   21 .  mso www.tmac
   22 .  am URL
   23 .    ad l
   24 .  .
   25 .  am MTO
   26 .    ad l
   27 .  .
   28 .  LINKSTYLE blue R < >
   29 .\}
   30 .SH "NAME"
   31 `glslc` \- A command\-line GLSL/HLSL to SPIR\-V compiler with Clang\-compatible arguments.
   32 .SH "SYNOPSIS"
   33 .sp
   34 .if n .RS 4
   35 .nf
   36 .fam C
   37 glslc [\-\-help]
   38 glslc [\-h]
   39 
   40 glslc [\-\-show\-limits]
   41 
   42 glslc [\-c|\-S|\-E]
   43       [\-x ...] [\-std=standard]
   44       [ ... options for resource bindings ... ]
   45       [\-fhlsl\-offsets]
   46       [\-fhlsl\-functionality1]
   47       [\-fentry\-point=<name>]
   48       [\-fauto\-map\-locations]
   49       [\-finvert\-y]
   50       [\-flimit=...]
   51       [\-flimit\-file <resource\-limits\-file>]
   52       [\-fshader\-stage=...]
   53       [\-\-target\-env=...]
   54       [\-\-target\-spv=...]
   55       [\-g]
   56       [\-O0|\-Os]
   57       [\-Idirectory...]
   58       [\-Dmacroname[=value]...]
   59       [\-w] [\-Werror]
   60       [\-o outfile]
   61       shader...
   62 .fam
   63 .fi
   64 .if n .RE
   65 .SH "DESCRIPTION"
   66 .SS "Input file languages"
   67 .sp
   68 glslc accepts both GLSL/HLSL source and SPIR\-V assembly files as inputs.
   69 .SS "Shader stage specification"
   70 .sp
   71 glslc provides three ways to specify the shader stage of a GLSL source file:
   72 \f(CR\-fshader\-stage=<stage>\fP, \f(CR#pragma shader_stage(<stage>)\fP, and file extension.
   73 The \f(CR\-fshader\-stage=\fP option overrides \f(CR#pragma shader_stage()\fP, which overrides
   74 the file extension.
   75 .sp
   76 Shader stages can be specified by naming a file with an appropriate extension
   77 as shown in the following table. \f(CR\-fshader\-stage=\fP and \f(CR#pragma shader_stage()\fP,
   78 on the other hand, enable you to specify shader stages from the command line
   79 and within the source file. Possible \f(CRstage\fPs for them are also listed in
   80 the following table. Details about \f(CR\-fshader\-stage=\fP can be found in
   81 its own section.
   82 .sp
   83 .it 1 an-trap
   84 .nr an-no-space-flag 1
   85 .nr an-break-flag 1
   86 .br
   87 .B Table 1. Shader Stage Selection
   88 .TS
   89 allbox tab(:);
   90 lt lt lt.
   91 T{
   92 .sp
   93 Shader Stage
   94 T}:T{
   95 .sp
   96 Shader File Extension
   97 T}:T{
   98 .sp
   99 \f(CR<stage>\fP
  100 T}
  101 T{
  102 .sp
  103 vertex
  104 T}:T{
  105 .sp
  106 \f(CR.vert\fP
  107 T}:T{
  108 .sp
  109 \f(CRvertex\fP
  110 T}
  111 T{
  112 .sp
  113 fragment
  114 T}:T{
  115 .sp
  116 \f(CR.frag\fP
  117 T}:T{
  118 .sp
  119 \f(CRfragment\fP
  120 T}
  121 T{
  122 .sp
  123 tesselation control
  124 T}:T{
  125 .sp
  126 \f(CR.tesc\fP
  127 T}:T{
  128 .sp
  129 \f(CRtesscontrol\fP
  130 T}
  131 T{
  132 .sp
  133 tesselation evaluation
  134 T}:T{
  135 .sp
  136 \f(CR.tese\fP
  137 T}:T{
  138 .sp
  139 \f(CRtesseval\fP
  140 T}
  141 T{
  142 .sp
  143 geometry
  144 T}:T{
  145 .sp
  146 \f(CR.geom\fP
  147 T}:T{
  148 .sp
  149 \f(CRgeometry\fP
  150 T}
  151 T{
  152 .sp
  153 compute
  154 T}:T{
  155 .sp
  156 \f(CR.comp\fP
  157 T}:T{
  158 .sp
  159 \f(CRcompute\fP
  160 T}
  161 .TE
  162 .sp
  163 .sp
  164 \f(CR#pragma shader_stage()\fP relies on the \f(CR#pragma\fP preprocessor directive; thus,
  165 the token inside \f(CRshader_stage()\fP is not subject to preprocessor macro
  166 expansion. It must be exactly one of the \f(CRstage\fPs in the above table.
  167 .sp
  168 \f(CR#pragma shader_stage()\fP behaves as follows:
  169 .sp
  170 .RS 4
  171 .ie n \{\
  172 \h'-04'\(bu\h'+03'\c
  173 .\}
  174 .el \{\
  175 .  sp -1
  176 .  IP \(bu 2.3
  177 .\}
  178 The first \f(CR#pragma shader_stage()\fP directive in a translation unit must
  179 precede any non\-preprocessor tokens.
  180 .RE
  181 .sp
  182 .RS 4
  183 .ie n \{\
  184 \h'-04'\(bu\h'+03'\c
  185 .\}
  186 .el \{\
  187 .  sp -1
  188 .  IP \(bu 2.3
  189 .\}
  190 If there is more than one \f(CR#pragma shader_stage()\fP directive in the same
  191 translation unit, all the \f(CRstage\fPs specified must be the same. Otherwise,
  192 glslc will issue an error.
  193 .RE
  194 .SS "SPIR\-V assembly files"
  195 .sp
  196 SPIR\-V assembly input files should follow the
  197 \c
  198 .URL "https://github.com/KhronosGroup/SPIRV\-Tools/blob/master/syntax.md" "syntax"
  199 defined in the \c
  200 .URL "https://github.com/KhronosGroup/SPIRV\-Tools" "SPIRV\-Tools"
  201 project and have the \f(CR.spvasm\fP extension. Command line options treat SPIR\-V
  202 assembly files differently; some may ignore them, e.g., \f(CR\-E\fP,
  203 \f(CR\-S\fP, and some may even treat them not as SPIR\-V assembly
  204 files, e.g., \f(CR\-fshader\-stage=\fP.
  205 .SS "Output file naming"
  206 .sp
  207 If a name is specified via \f(CR\-o\fP, the output file will be given that name.
  208 Otherwise,
  209 .sp
  210 .RS 4
  211 .ie n \{\
  212 \h'-04'\(bu\h'+03'\c
  213 .\}
  214 .el \{\
  215 .  sp -1
  216 .  IP \(bu 2.3
  217 .\}
  218 If a compilation stage selection option is given (\f(CR\-S\fP or \f(CR\-c\fP), there will
  219 be one output file generated per input shader file. The generated output file
  220 will end with a file extension that matches the compilation stage, which is
  221 \f(CR.spvasm\fP for \f(CR\-S\fP and \f(CR.spv\fP for \f(CR\-c\fP. The name will depend on the original
  222 file\(cqs name and extension.
  223 .sp
  224 .RS 4
  225 .ie n \{\
  226 \h'-04'\(bu\h'+03'\c
  227 .\}
  228 .el \{\
  229 .  sp -1
  230 .  IP \(bu 2.3
  231 .\}
  232 If the input file has a shader stage selection
  233 extension, the output file will be named as by appending the file extension
  234 for the compilation stage to the input file\(cqs name. E.g., \f(CRglslc \-c foo.vert\fP
  235 will generate \f(CRfoo.vert.spv\fP, and \f(CRglslc \-S bar.frag\fP will generate
  236 \f(CRbar.frag.spvasm\fP.
  237 .RE
  238 .sp
  239 .RS 4
  240 .ie n \{\
  241 \h'-04'\(bu\h'+03'\c
  242 .\}
  243 .el \{\
  244 .  sp -1
  245 .  IP \(bu 2.3
  246 .\}
  247 Otherwise, the output file will be named as by replacing the input file\(cqs
  248 file extension, if any, with the file extension for the compilation stage.
  249 E.g., \f(CRglslc \-c foo\fP will generate \f(CRfoo.spv\fP, and \f(CRglslc \-S bar.glsl\fP will
  250 generate \f(CRbar.spvasm\fP.
  251 .RE
  252 .RE
  253 .sp
  254 .RS 4
  255 .ie n \{\
  256 \h'-04'\(bu\h'+03'\c
  257 .\}
  258 .el \{\
  259 .  sp -1
  260 .  IP \(bu 2.3
  261 .\}
  262 If no compilation stage is selected, the output file will be named \f(CRa.spv\fP.
  263 .RE
  264 .SH "COMMAND LINE OPTIONS"
  265 .SS "Overall Options"
  266 .SS "\f(CR\-\-help\fP, \f(CR\-h\fP"
  267 .sp
  268 Option \f(CR\-\-help\fP or \f(CR\-h\fP tells the glslc compiler to display all available options and exit.
  269 .SS "\f(CR\-\-show\-limits\fP"
  270 .sp
  271 \f(CR\-\-show\-limits\fP shows default resource limits for shader compilation.  The syntax
  272 is the same as accepted by \f(CR\-flimit=\fP and for the contents of the file specified
  273 by \f(CR\-flimit\-file\fP.
  274 .SS "\f(CR\-o\fP"
  275 .sp
  276 \f(CR\-o\fP lets you specify the output file\(cqs name. It cannot be used when there are
  277 multiple files generated. A filename of \f(CR\-\fP represents standard output.
  278 .SS "Language and Mode Selection Options"
  279 .SS "\f(CR\-finvert\-y\fP"
  280 .sp
  281 Inverts position.Y output in a vertex shader.
  282 .SS "\f(CR\-flimit=\fP"
  283 .sp
  284 \f(CR\-flimit=<resource\-limits>\fP lets you specify resource limits.
  285 The argument should be a sequence of limit name, integer value pairs.  Tokens
  286 should be separated by whitespace.  If the same limit is specified several
  287 times, only the last setting takes effect.
  288 .sp
  289 Use \f(CR\-\-show\-limits\fP to show the default values, and example syntax.
  290 .sp
  291 This option affects all compiled shaders.
  292 .SS "\f(CR\-flimit\-file\fP"
  293 .sp
  294 \f(CR\-flimit\-file <resource\-limits\-file>\fP lets you specify resource limits in a file.
  295 The syntax of the file contents is the same as the argument to \f(CR\-flimit=\fP and
  296 the output of \f(CR\-\-show\-limits\fP.  This option accepts Glslang resource configuration
  297 files, e.g. as emitted by \f(CRglslangValidator \-c\fP.
  298 .sp
  299 This option affects all compiled shaders.
  300 .SS "\f(CR\-fshader\-stage=\fP"
  301 .sp
  302 \f(CR\-fshader\-stage=<stage>\fP lets you specify the shader stage for one or more
  303 inputs from the command line.
  304 .sp
  305 Possible values for \f(CR<stage>\fP are listed in the Shader Stage Selection table.
  306 .sp
  307 \f(CR\-fshader\-stage=\fP behaves as follows:
  308 .sp
  309 .RS 4
  310 .ie n \{\
  311 \h'-04'\(bu\h'+03'\c
  312 .\}
  313 .el \{\
  314 .  sp -1
  315 .  IP \(bu 2.3
  316 .\}
  317 \f(CR\-fshader\-stage=\fP sets the shader stage for subsequent input files. It does
  318 not affect the stages of any preceding inputs on the command line.
  319 .RE
  320 .sp
  321 .RS 4
  322 .ie n \{\
  323 \h'-04'\(bu\h'+03'\c
  324 .\}
  325 .el \{\
  326 .  sp -1
  327 .  IP \(bu 2.3
  328 .\}
  329 When supplying more than one \f(CR\-fshader\-stage=\fP argument, the most recent
  330 argument preceding an input file applies.
  331 .RE
  332 .sp
  333 .RS 4
  334 .ie n \{\
  335 \h'-04'\(bu\h'+03'\c
  336 .\}
  337 .el \{\
  338 .  sp -1
  339 .  IP \(bu 2.3
  340 .\}
  341 A shader file not ending with known shader file
  342 extensions must have a \f(CR\-fshader\-stage=\fP argument ahead of it to specify
  343 its stage.
  344 .RE
  345 .sp
  346 .RS 4
  347 .ie n \{\
  348 \h'-04'\(bu\h'+03'\c
  349 .\}
  350 .el \{\
  351 .  sp -1
  352 .  IP \(bu 2.3
  353 .\}
  354 If there is a \f(CR\-fshader\-stage=\fP before a file in which there is a \f(CR#pragma
  355 shader_stage()\fP directive, the directive is ignored and the \f(CR\-fshader\-stage=\fP
  356 argument is used instead.
  357 .RE
  358 .sp
  359 .RS 4
  360 .ie n \{\
  361 \h'-04'\(bu\h'+03'\c
  362 .\}
  363 .el \{\
  364 .  sp -1
  365 .  IP \(bu 2.3
  366 .\}
  367 If there is a \f(CR\-fshader\-stage=\fP before a file with a known shader file
  368 extension, the file extension is ignored and the \f(CR\-fshader\-stage=\fP argument
  369 is used instead.
  370 .RE
  371 .if n .sp
  372 .RS 4
  373 .it 1 an-trap
  374 .nr an-no-space-flag 1
  375 .nr an-break-flag 1
  376 .br
  377 .ps +1
  378 .B Caution
  379 .ps -1
  380 .br
  381 .sp
  382 \f(CR\-fshader\-stage=\fP overrides file extension; that means it should not
  383 be used together with SPIR\-V assembly files because glslc will treat the given
  384 SPIR\-V assembly files as GLSL source code of the given shader stage. If you
  385 need to supply both SPIR\-V assembly files and \f(CR\-fshader\-stage=\fP on the same
  386 command line, please put SPIR\-V assembly files ahead of the first
  387 \f(CR\-fshader\-stage=\fP, since \f(CR\-fshader\-stage=\fP only affects the treatment of
  388 subsequent files.
  389 .sp .5v
  390 .RE
  391 .SS "\f(CR\-std=\fP"
  392 .sp
  393 \f(CR\-std=<value>\fP lets you specify a shader version and profile on the command
  394 line. \f(CR<value>\fP can be any valid concatenation of a GLSL version number and
  395 profile, e.g., \f(CR310es\fP, \f(CR450core\fP, etc. The profile can be omitted as allowed by
  396 GLSL, e.g., \f(CR450\fP.
  397 .sp
  398 \f(CR\-std=\fP behaves as follows:
  399 .sp
  400 .RS 4
  401 .ie n \{\
  402 \h'-04'\(bu\h'+03'\c
  403 .\}
  404 .el \{\
  405 .  sp -1
  406 .  IP \(bu 2.3
  407 .\}
  408 \f(CR\-std=\fP affects the version of all GLSL inputs passed to \f(CRglslc\fP.
  409 .RE
  410 .sp
  411 .RS 4
  412 .ie n \{\
  413 \h'-04'\(bu\h'+03'\c
  414 .\}
  415 .el \{\
  416 .  sp -1
  417 .  IP \(bu 2.3
  418 .\}
  419 \f(CR\-std=\fP is ignored for HLSL inputs.
  420 .RE
  421 .sp
  422 .RS 4
  423 .ie n \{\
  424 \h'-04'\(bu\h'+03'\c
  425 .\}
  426 .el \{\
  427 .  sp -1
  428 .  IP \(bu 2.3
  429 .\}
  430 \f(CR\-std=\fP overwrites \f(CR#version\fP directives in all input shaders, including those
  431 preceding the argument.
  432 .RE
  433 .sp
  434 .RS 4
  435 .ie n \{\
  436 \h'-04'\(bu\h'+03'\c
  437 .\}
  438 .el \{\
  439 .  sp -1
  440 .  IP \(bu 2.3
  441 .\}
  442 If a \f(CR\-std=\fP argument specifies a different version from a \f(CR#version\fP
  443 directive in an input file, \f(CRglslc\fP will issue a warning.
  444 .RE
  445 .sp
  446 .RS 4
  447 .ie n \{\
  448 \h'-04'\(bu\h'+03'\c
  449 .\}
  450 .el \{\
  451 .  sp -1
  452 .  IP \(bu 2.3
  453 .\}
  454 If multiple \f(CR\-std=\fP arguments are specified on the command line, only the last
  455 one takes effect.
  456 .RE
  457 .if n .sp
  458 .RS 4
  459 .it 1 an-trap
  460 .nr an-no-space-flag 1
  461 .nr an-break-flag 1
  462 .br
  463 .ps +1
  464 .B Caution
  465 .ps -1
  466 .br
  467 .sp
  468 \f(CR\-std=\fP does not affect the \f(CR#version\fP directive in the preprocessed
  469 output. That is, when \f(CR\-std=\fP specifies a version different from the shader
  470 source code, the \f(CR#version\fP directive in preprocessed output will still be the
  471 one in the source code. But \f(CR\-std=\fP does affect the behavior of \f(CR#line\fP
  472 directives in the preprocessed output. Behavior of \f(CR#line\fP directives will
  473 follow the version specified by \f(CR\-std=\fP.
  474 .sp .5v
  475 .RE
  476 .SS "\f(CR\-\-target\-env=\fP"
  477 .sp
  478 \f(CR\-\-target\-env=<value>\fP lets you specify a target environment on the command line.
  479 This affects the generation of warnings and errors. The \f(CR<value>\fP can be one of
  480 the following:
  481 .sp
  482 .RS 4
  483 .ie n \{\
  484 \h'-04'\(bu\h'+03'\c
  485 .\}
  486 .el \{\
  487 .  sp -1
  488 .  IP \(bu 2.3
  489 .\}
  490 \f(CRvulkan\fP: create SPIR\-V under Vulkan 1.0 semantics.
  491 .RE
  492 .sp
  493 .RS 4
  494 .ie n \{\
  495 \h'-04'\(bu\h'+03'\c
  496 .\}
  497 .el \{\
  498 .  sp -1
  499 .  IP \(bu 2.3
  500 .\}
  501 \f(CRvulkan1.0\fP: create SPIR\-V under Vulkan 1.0 semantics.
  502 .RE
  503 .sp
  504 .RS 4
  505 .ie n \{\
  506 \h'-04'\(bu\h'+03'\c
  507 .\}
  508 .el \{\
  509 .  sp -1
  510 .  IP \(bu 2.3
  511 .\}
  512 \f(CRvulkan1.1\fP: create SPIR\-V under Vulkan 1.1 semantics.
  513 .RE
  514 .sp
  515 .RS 4
  516 .ie n \{\
  517 \h'-04'\(bu\h'+03'\c
  518 .\}
  519 .el \{\
  520 .  sp -1
  521 .  IP \(bu 2.3
  522 .\}
  523 \f(CRvulkan1.2\fP: create SPIR\-V under Vulkan 1.2 semantics.
  524 .RE
  525 .sp
  526 .RS 4
  527 .ie n \{\
  528 \h'-04'\(bu\h'+03'\c
  529 .\}
  530 .el \{\
  531 .  sp -1
  532 .  IP \(bu 2.3
  533 .\}
  534 \f(CRopengl\fP: create SPIR\-V under OpenGL 4.5 semantics.
  535 .RE
  536 .sp
  537 .RS 4
  538 .ie n \{\
  539 \h'-04'\(bu\h'+03'\c
  540 .\}
  541 .el \{\
  542 .  sp -1
  543 .  IP \(bu 2.3
  544 .\}
  545 \f(CRopengl4.5\fP: create SPIR\-V under OpenGL 4.5 semantics.
  546 .RE
  547 .sp
  548 Generated code uses SPIR\-V 1.0, except for code compiled for Vulkan 1.1, which uses
  549 SPIR\-V 1.3, and code compiled for Vulkan 1.2, which uses SPIR\-V 1.5.
  550 .sp
  551 If this option is not specified, a default of \f(CRvulkan1.0\fP is used.
  552 .sp
  553 Note: Support for OpenGL compatibility profile, \f(CRopengl_compat\fP, has been removed.
  554 .SS "\f(CR\-\-target\-spv=\fP"
  555 .sp
  556 \f(CR\-\-target\-spv=<value>\fP lets you specify the SPIR\-V version to be used by the generated
  557 module.  The default is to use the highest version of SPIR\-V required to be supported
  558 by the target environment.  The defaults for specific Vulkan target environments are
  559 as follows: SPIR\-V 1.0 for Vulkan 1.0, SPIR\-V 1.3 for Vulkan 1.1, and SPIR\-V 1.5 for
  560 Vulkan 1.2.
  561 .sp
  562 The \f(CR<value>\fP can be one of the following:
  563 .sp
  564 .RS 4
  565 .ie n \{\
  566 \h'-04'\(bu\h'+03'\c
  567 .\}
  568 .el \{\
  569 .  sp -1
  570 .  IP \(bu 2.3
  571 .\}
  572 \f(CRspv1.0\fP
  573 .RE
  574 .sp
  575 .RS 4
  576 .ie n \{\
  577 \h'-04'\(bu\h'+03'\c
  578 .\}
  579 .el \{\
  580 .  sp -1
  581 .  IP \(bu 2.3
  582 .\}
  583 \f(CRspv1.1\fP
  584 .RE
  585 .sp
  586 .RS 4
  587 .ie n \{\
  588 \h'-04'\(bu\h'+03'\c
  589 .\}
  590 .el \{\
  591 .  sp -1
  592 .  IP \(bu 2.3
  593 .\}
  594 \f(CRspv1.2\fP
  595 .RE
  596 .sp
  597 .RS 4
  598 .ie n \{\
  599 \h'-04'\(bu\h'+03'\c
  600 .\}
  601 .el \{\
  602 .  sp -1
  603 .  IP \(bu 2.3
  604 .\}
  605 \f(CRspv1.3\fP
  606 .RE
  607 .sp
  608 .RS 4
  609 .ie n \{\
  610 \h'-04'\(bu\h'+03'\c
  611 .\}
  612 .el \{\
  613 .  sp -1
  614 .  IP \(bu 2.3
  615 .\}
  616 \f(CRspv1.4\fP
  617 .RE
  618 .sp
  619 .RS 4
  620 .ie n \{\
  621 \h'-04'\(bu\h'+03'\c
  622 .\}
  623 .el \{\
  624 .  sp -1
  625 .  IP \(bu 2.3
  626 .\}
  627 \f(CRspv1.5\fP
  628 .RE
  629 .sp
  630 .RS 4
  631 .ie n \{\
  632 \h'-04'\(bu\h'+03'\c
  633 .\}
  634 .el \{\
  635 .  sp -1
  636 .  IP \(bu 2.3
  637 .\}
  638 \f(CRspv1.6\fP
  639 .RE
  640 .SS "\f(CR\-x\fP"
  641 .sp
  642 \f(CR\-x\fP lets you specify the language of the input shader files. Valid languages
  643 are \f(CRglsl\fP and \f(CRhlsl\fP.  If the file extension is \f(CRhlsl\fP then the default language
  644 is HLSL.  Otherwise the default is \*(Aqglsl\*(Aq.
  645 .sp
  646 Note: HLSL compilation will use HLSL packing (offset) rules for variables
  647 that are vertex shader outputs, and inputs and outputs of both geometry
  648 and pixel shaders.
  649 .SS "Compilation Stage Selection Options"
  650 .SS "\f(CR\-c\fP"
  651 .sp
  652 \f(CR\-c\fP tells the glslc compiler to run the preprocessing and compiling stage.
  653 Each input shader file results in a SPIR\-V binary file; these SPIR\-V binary
  654 files are named by the rules in the Output File Naming
  655 section.
  656 .SS "\f(CR\-E\fP"
  657 .sp
  658 \f(CR\-E\fP tells the glslc compiler to run only the preprocessing stage. It overrides
  659 \f(CR\-c\fP and \f(CR\-S\fP. Preprocessed output is written to standard output, while
  660 preprocessing errors are written to standard error. If multiple input shader
  661 files are given, their preprocessed output are all written to standard output,
  662 in the order specified on the command line.
  663 .sp
  664 glslc will do nothing for SPIR\-V assembly files with this option.
  665 .SS "\f(CR\-S\fP"
  666 .sp
  667 \f(CR\-S\fP tells the glslc compiler to run the preprocessing, compiling, and then
  668 disassembling stage. It overrides \f(CR\-c\fP. Each input shader file results in a
  669 SPIR\-V assembly file; these SPIR\-V assembly files are named by the rules in the
  670 Output File Naming section.
  671 .sp
  672 glslc will do nothing for SPIR\-V assembly files with this option.
  673 .SS "No Compilation Stage Selection"
  674 .sp
  675 If none of the above options is given, the glslc compiler will run
  676 preprocessing, compiling, and linking stages.
  677 .if n .sp
  678 .RS 4
  679 .it 1 an-trap
  680 .nr an-no-space-flag 1
  681 .nr an-break-flag 1
  682 .br
  683 .ps +1
  684 .B Warning
  685 .ps -1
  686 .br
  687 .sp
  688 Linking of multiple input shader files are not supported yet.
  689 .sp .5v
  690 .RE
  691 .SS "Preprocessor Options"
  692 .SS "\f(CR\-D\fP"
  693 .sp
  694 \f(CR\-Dmacroname[=[value]]\fP lets you define a preprocessor macro before input shader
  695 files are preprocessed. If \f(CRvalue\fP is omitted, the macro is defined with an
  696 empty value.
  697 .SS "\f(CR\-I\fP"
  698 .sp
  699 \f(CR\-Idirectory\fP or \f(CR\-I directory\fP adds the specified directory to the search path
  700 for include files.  The directory may be an absolute path or a relative path to
  701 the current working directory.
  702 .SS "Code Generation Options"
  703 .SS "\f(CR\-g\fP"
  704 .sp
  705 Requests that the compiler place source\-level debug information into the object
  706 code, such as identifier names and line numbers.
  707 .sp
  708 This option restrains \f(CR\-O\fP from turning on the strip\-debug\-info optimization
  709 pass.
  710 .if n .sp
  711 .RS 4
  712 .it 1 an-trap
  713 .nr an-no-space-flag 1
  714 .nr an-break-flag 1
  715 .br
  716 .ps +1
  717 .B Note
  718 .ps -1
  719 .br
  720 .sp
  721 Currently this option has no effect.  Full functionality depends on
  722 glslang support for generating debug info.
  723 .sp .5v
  724 .RE
  725 .SS "\f(CR\-O0\fP, \f(CR\-Os\fP"
  726 .sp
  727 \f(CR\-O\fP specifies which optimization level to use:
  728 .sp
  729 .RS 4
  730 .ie n \{\
  731 \h'-04'\(bu\h'+03'\c
  732 .\}
  733 .el \{\
  734 .  sp -1
  735 .  IP \(bu 2.3
  736 .\}
  737 \f(CR\-O0\fP means "no optimization". This level generates the most debuggable code.
  738 .RE
  739 .sp
  740 .RS 4
  741 .ie n \{\
  742 \h'-04'\(bu\h'+03'\c
  743 .\}
  744 .el \{\
  745 .  sp -1
  746 .  IP \(bu 2.3
  747 .\}
  748 \f(CR\-O\fP means the default optimization level for better performance.
  749 .RE
  750 .sp
  751 .RS 4
  752 .ie n \{\
  753 \h'-04'\(bu\h'+03'\c
  754 .\}
  755 .el \{\
  756 .  sp -1
  757 .  IP \(bu 2.3
  758 .\}
  759 \f(CR\-Os\fP enables optimizations to reduce code size.
  760 .RE
  761 .SS "\f(CR\-mfmt=<format>\fP"
  762 .sp
  763 \f(CR\-mfmt=<format>\fP selects output format for compilation output in SPIR\-V binary
  764 code form.  Supported options are listed in the
  765 binary output format options table. This
  766 option is only valid to be used when the compilation output is SPIR\-V binary
  767 code. Specifying any options listed below when the output is not SPIR\-V binary
  768 code, like disassembly (with \f(CR\-S\fP specified), text (with \f(CR\-M\fP, \f(CR\-MM\fP or \f(CR\-E\fP
  769 specified) will trigger an error.
  770 .sp
  771 .it 1 an-trap
  772 .nr an-no-space-flag 1
  773 .nr an-break-flag 1
  774 .br
  775 .B Table 2. Binary Output Format Options
  776 .TS
  777 allbox tab(:);
  778 lt lt.
  779 T{
  780 .sp
  781 Format option
  782 T}:T{
  783 .sp
  784 Description
  785 T}
  786 T{
  787 .sp
  788 bin
  789 T}:T{
  790 .sp
  791 Output SPIR\-V binary code as a sequence of binary 32\-bitwords
  792 in host native endianness. This is the default format for
  793 SPIR\-V binary compilation output.
  794 T}
  795 T{
  796 .sp
  797 num
  798 T}:T{
  799 .sp
  800 Output SPIR\-V binary code as a text file containing a list of
  801 comma\-separated hex numbers.
  802 .br
  803 Example: \f(CRglslc \-c \-mfmt=num main.vert \-o output_file.txt\fP
  804 .br
  805 Content of the output_file.txt:
  806 .br
  807 0x07230203,0x00010000,0x00080001,0x00000006...
  808 T}
  809 T{
  810 .sp
  811 c
  812 T}:T{
  813 .sp
  814 Output SPIR\-V binary code as a text file containing C\-style
  815 .br
  816 initializer list.
  817 .br
  818 This is just wrapping the output of \f(CRnum\fP option with curly
  819 brackets.
  820 .br
  821 Example: \f(CRglslc \-c \-mfmt=c main.vert \-o output_file.txt\fP
  822 .br
  823 Content of output_file.txt:
  824 .br
  825 {0x07230203, 0x00010000, 0x00080001, 0x00000006...}
  826 T}
  827 .TE
  828 .sp
  829 .SS "\f(CR\-fhlsl\-offsets\fP"
  830 .sp
  831 Use HLSL packing rules instead of GLSL rules when determining offsets of
  832 members of blocks.  This option is always on when compiling for HLSL.
  833 .SS "\f(CR\-fhlsl\-functionality1\fP"
  834 .sp
  835 Enable extension \f(CRSPV_GOOGLE_hlsl_functionality1\fP, and instructs the compiler
  836 to:
  837 .sp
  838 .RS 4
  839 .ie n \{\
  840 \h'-04'\(bu\h'+03'\c
  841 .\}
  842 .el \{\
  843 .  sp -1
  844 .  IP \(bu 2.3
  845 .\}
  846 Annotate HLSL semantic string decorations on interface objects
  847 .RE
  848 .sp
  849 .RS 4
  850 .ie n \{\
  851 \h'-04'\(bu\h'+03'\c
  852 .\}
  853 .el \{\
  854 .  sp -1
  855 .  IP \(bu 2.3
  856 .\}
  857 Explicitly record the association of a UAV resource with its companion counter buffer.
  858 .RE
  859 .sp
  860 This option can also be spelled with an underscore: \f(CR\-fhlsl_functionality1\fP.
  861 .SS "\f(CR\-fentry\-point=<name>\fP"
  862 .sp
  863 \f(CR\-fentry\-point=<name>\fP lets you specify the entry point name.  This is only
  864 significant for HLSL compilation.  The default is "main".
  865 .SS "\f(CR\-fauto\-map\-locations\fP"
  866 .sp
  867 For GLSL compilation, option \f(CR\-fauto\-map\-locations\fP directs the compiler to automatically
  868 assign location numbers to user\-defined stage input and output variables if not explicitly
  869 specified by the shader source.
  870 .sp
  871 For HLSL compilation, this option is on by default.
  872 .sp
  873 Client APIs normally require adjacent stages to agree on their I/O interface.
  874 The compiler only sees one stage at a time, so it is strongly recommended that
  875 you avoid relying on this option to assign locations.
  876 .sp
  877 Instead, an explicit binding number should be specified in the shader source, as follows:
  878 .sp
  879 .RS 4
  880 .ie n \{\
  881 \h'-04'\(bu\h'+03'\c
  882 .\}
  883 .el \{\
  884 .  sp -1
  885 .  IP \(bu 2.3
  886 .\}
  887 In a GLSL shader, use a \f(CRlocation\fP layout qualifier:
  888 .RE
  889 .sp
  890 .if n .RS 4
  891 .nf
  892 .fam C
  893 layout(location = 1) in vec4 x;
  894 .fam
  895 .fi
  896 .if n .RE
  897 .sp
  898 .RS 4
  899 .ie n \{\
  900 \h'-04'\(bu\h'+03'\c
  901 .\}
  902 .el \{\
  903 .  sp -1
  904 .  IP \(bu 2.3
  905 .\}
  906 In an HLSL shader, use a \f(CRvk::location\fP attribute:
  907 .RE
  908 .sp
  909 .if n .RS 4
  910 .nf
  911 .fam C
  912 [[vk::location(1)]] float4 FooShader(
  913   [[vk::location(0)]] float4 a,
  914   [[vk::location(2)]] float4 b) : COLOR0 {
  915   return a + b;
  916 }
  917 .fam
  918 .fi
  919 .if n .RE
  920 .SS "Warning and Error Options"
  921 .SS "\f(CR\-w\fP"
  922 .sp
  923 \f(CR\-w\fP suppresses all warning output from \f(CRglslc\fP. Any warning that would have
  924 been generated is silently ignored.
  925 .SS "\f(CR\-Werror\fP"
  926 .sp
  927 \f(CR\-Werror\fP forces any warning to be treated as an error in \f(CRglslc\fP. This means
  928 that all \f(CRwarning:\fP messages are shown as \f(CRerror:\fP and any warnings will cause
  929 a non\-zero exit code from \f(CRglslc\fP. If \f(CR\-w\fP is specified the warnings
  930 generated are suppressed before they are converted to errors.
  931 .SS "Dependency Generation Options"
  932 .SS "\f(CR\-M\fP or \f(CR\-MM\fP"
  933 .sp
  934 \f(CR\-M\fP generates \fBmake\fP dependencies. It outputs a rule suitable for \fBmake\fP
  935 describing the dependencies of the input file. Instead of outputting the result
  936 of preprocessing, the preprocessor outputs one \fBmake\fP rule containing the
  937 SPIR\-V object file name for that source file, a colon, and the names of all the
  938 included files.
  939 .sp
  940 Unless specified explicitly (with \f(CR\-MT\fP), the SPIR\-V object file name in the
  941 generated \fBmake\fP rules follows the rules of  Output File
  942 Naming as in \f(CR\-c\fP compilation stage.
  943 .sp
  944 Specifying \f(CR\-M\fP implies \f(CR\-E\fP, and suppresses warnings with an implicit \f(CR\-w\fP.
  945 By default the output will be written to stdout, unless \f(CR\-MF\fP or \f(CR\-o\fP is
  946 specified.
  947 .sp
  948 The dependency info file name can be specified by \f(CR\-o\fP and \f(CR\-MF\fP options. When
  949 both are specified, \f(CR\-o\fP option is ignored.
  950 .sp
  951 Specifying multiple input files is valid when the \fBmake\fP rules are written to
  952 stdout, which means neither \f(CR\-MF\fP nor \f(CR\-o\fP is specified. When \f(CR\-o\fP or \f(CR\-MF\fP is
  953 specified, only one input file is allowed.
  954 .sp
  955 \f(CR\-MM\fP is an alias for \f(CR\-M\fP.
  956 .sp
  957 E.g., \f(CRglslc \-M main.vert\fP will dump \f(CRmain.vert.spv: main.vert <other included
  958 files>\fP to stdout. More examples are listed in
  959 Dependency Generation Examples
  960 .SS "\f(CR\-MD\fP"
  961 .sp
  962 \f(CR\-MD\fP tells the glslc compiler to both compile the source and generate \fBmake\fP
  963 dependencies. Dependencies are written to a file whose name is determined as
  964 follows: If option \f(CR\-MF\fP is specified, use its argument. Otherwise, use the
  965 filename formed by appending \fB.d\fP to the name of the file containing
  966 compilation results.
  967 .sp
  968 Specifying multiple input files is valid when neither \f(CR\-MF\fP nor \f(CR\-o\fP is
  969 specified. When \f(CR\-o\fP or \f(CR\-MF\fP is specified, only one input file is allowed.
  970 .sp
  971 E.g., \f(CRglslc \-c \-MD main.vert\fP will generate \f(CRmain.vert.spv\fP as the SPIR\-V
  972 object file and \f(CRmain.vert.spv.d\fP as the dependency info file. More examples
  973 are listed in Dependency Generation Examples
  974 .SS "\f(CR\-MF\fP"
  975 .sp
  976 \f(CR\-MF\fP lets you specify the dependency info file name when used with \f(CR\-M\fP or
  977 \f(CR\-MD\fP. This option is invalid when used with multiple input files.
  978 .sp
  979 E.g., \f(CRglslc \-c \-MD main.vert \-MF dep_info\fP will generate \f(CRmain.vert.spv\fP as
  980 the SPIR\-V object file and \f(CRdep_info\fP as the dependency info file.
  981 .SS "\f(CR\-MT\fP"
  982 .sp
  983 \f(CR\-MT\fP lets you specify the target of the rule emitted by dependency generation
  984 when used with \f(CR\-M\fP or \f(CR\-MD\fP.  This option is invalid when used with multiple
  985 input files.
  986 .sp
  987 E.g., \f(CRglslc \-M main.vert \-MT target\fP will dump following dependency info to
  988 stdout: \f(CRtarget: main.vert <other dependent files>\fP.
  989 .sp
  990 .it 1 an-trap
  991 .nr an-no-space-flag 1
  992 .nr an-break-flag 1
  993 .br
  994 .B Table 3. Dependency Generation Examples
  995 .TS
  996 allbox tab(:);
  997 lt lt lt lt.
  998 T{
  999 .sp
 1000 Command Line Input
 1001 T}:T{
 1002 .sp
 1003 Compilation Output File
 1004 T}:T{
 1005 .sp
 1006 Dependency Output File
 1007 T}:T{
 1008 .sp
 1009 Dependency Info
 1010 T}
 1011 T{
 1012 .sp
 1013 glslc \-M main.vert
 1014 T}:T{
 1015 .sp
 1016 <NA>
 1017 T}:T{
 1018 .sp
 1019 <Stdout>
 1020 T}:T{
 1021 .sp
 1022 main.vert.spv: main.vert
 1023 T}
 1024 T{
 1025 .sp
 1026 glslc \-M a.vert b.vert
 1027 T}:T{
 1028 .sp
 1029 <NA>
 1030 T}:T{
 1031 .sp
 1032 <Stdout>
 1033 T}:T{
 1034 .sp
 1035 a.vert.spv: a.vert
 1036 T}
 1037 T{
 1038 .sp
 1039 T}:T{
 1040 .sp
 1041 <NA>
 1042 T}:T{
 1043 .sp
 1044 <Stdout>
 1045 T}:T{
 1046 .sp
 1047 b.vert.spv: b.vert
 1048 T}
 1049 T{
 1050 .sp
 1051 glslc \-M main.vert \-o dep_info
 1052 T}:T{
 1053 .sp
 1054 <NA>
 1055 T}:T{
 1056 .sp
 1057 dep_info
 1058 T}:T{
 1059 .sp
 1060 main.vert.spv: main.vert
 1061 T}
 1062 T{
 1063 .sp
 1064 glslc \-M main.vert \-MF dep_info
 1065 T}:T{
 1066 .sp
 1067 <NA>
 1068 T}:T{
 1069 .sp
 1070 dep_info
 1071 T}:T{
 1072 .sp
 1073 main.vert.spv: main.vert
 1074 T}
 1075 T{
 1076 .sp
 1077 glslc \-M main.vert \-MT target
 1078 T}:T{
 1079 .sp
 1080 <NA>
 1081 T}:T{
 1082 .sp
 1083 <Stdout>
 1084 T}:T{
 1085 .sp
 1086 target: main.vert
 1087 T}
 1088 T{
 1089 .sp
 1090 glslc \-MD main.vert
 1091 T}:T{
 1092 .sp
 1093 a.spv
 1094 T}:T{
 1095 .sp
 1096 main.vert.spv.d
 1097 T}:T{
 1098 .sp
 1099 main.vert.spv: main.vert
 1100 T}
 1101 T{
 1102 .sp
 1103 glslc \-c \-MD main.vert
 1104 T}:T{
 1105 .sp
 1106 main.vert.spv
 1107 T}:T{
 1108 .sp
 1109 main.vert.spv.d
 1110 T}:T{
 1111 .sp
 1112 main.vert.spv: main.vert
 1113 T}
 1114 T{
 1115 .sp
 1116 glslc \-c \-MD a.vert b.vert
 1117 T}:T{
 1118 .sp
 1119 a.vert.spv
 1120 T}:T{
 1121 .sp
 1122 a.vert.spv.d
 1123 T}:T{
 1124 .sp
 1125 a.vert.spv: a.vert
 1126 T}
 1127 T{
 1128 .sp
 1129 T}:T{
 1130 .sp
 1131 b.vert.spv
 1132 T}:T{
 1133 .sp
 1134 b.vert.spv.d
 1135 T}:T{
 1136 .sp
 1137 b.vert.spv: b.vert
 1138 T}
 1139 T{
 1140 .sp
 1141 glslc \-S \-MD main.vert
 1142 T}:T{
 1143 .sp
 1144 main.vert.spvasm
 1145 T}:T{
 1146 .sp
 1147 main.vert.spvasm.d
 1148 T}:T{
 1149 .sp
 1150 main.vert.spvasm: main.vert
 1151 T}
 1152 T{
 1153 .sp
 1154 glslc \-c \-MD main.vert \-MF dep_info
 1155 T}:T{
 1156 .sp
 1157 main.vert.spv
 1158 T}:T{
 1159 .sp
 1160 dep_info
 1161 T}:T{
 1162 .sp
 1163 main.vert.spv: main.vert
 1164 T}
 1165 T{
 1166 .sp
 1167 glslc \-c \-MD main.vert \-o obj
 1168 T}:T{
 1169 .sp
 1170 obj
 1171 T}:T{
 1172 .sp
 1173 obj.d
 1174 T}:T{
 1175 .sp
 1176 obj: main.vert
 1177 T}
 1178 T{
 1179 .sp
 1180 glslc \-c \-MD main.vert \-o obj \-MF dep_info \-MT target
 1181 T}:T{
 1182 .sp
 1183 obj
 1184 T}:T{
 1185 .sp
 1186 dep_info
 1187 T}:T{
 1188 .sp
 1189 target: main.vert
 1190 T}
 1191 .TE
 1192 .sp
 1193 .SS "Resource Binding Options"
 1194 .SS "\f(CR\-fauto\-bind\-uniforms\fP"
 1195 .sp
 1196 Option \f(CR\-fauto\-bind\-uniforms\fP directs the compiler to automatically assign
 1197 binding numbers to uniform variables, when an explicit binding is not
 1198 specified in the shader source.
 1199 .sp
 1200 An explicit binding number can be specified in the shader source by using
 1201 a \f(CRbinding\fP layout qualifier.  For example:
 1202 .sp
 1203 .if n .RS 4
 1204 .nf
 1205 .fam C
 1206 layout(binding = 12) uniform texture2D;
 1207 .fam
 1208 .fi
 1209 .if n .RE
 1210 .SS "\f(CR\-fhlsl\-iomap\fP"
 1211 .sp
 1212 Option \f(CR\-fhlsl\-iomap\fP directs the compiler to use HLSL register
 1213 assignments as binding values.
 1214 .SS "\f(CR\-fimage\-binding\-base\fP"
 1215 .sp
 1216 Option \f(CR\-fimage\-binding\-base [stage] base\fP sets the lowest automatically
 1217 assigned binding for images.  If a stage is specified, only affects the specified
 1218 stage.
 1219 .sp
 1220 For HLSL, sets one less than the base.
 1221 .SS "\f(CR\-fsampler\-binding\-base\fP"
 1222 .sp
 1223 Option \f(CR\-fsampler\-binding\-base [stage] base\fP sets the lowest automatically
 1224 assigned binding for samplers.  If a stage is specified, only affects the specified
 1225 stage.
 1226 .sp
 1227 For HLSL, sets one less than the base.
 1228 .SS "\f(CR\-ftexture\-binding\-base\fP"
 1229 .sp
 1230 Option \f(CR\-ftexture\-binding\-base [stage] base\fP sets the lowest automatically
 1231 assigned binding for textures.  If a stage is specified, only affects the specified
 1232 stage.
 1233 .sp
 1234 For HLSL, sets one less than the base.
 1235 .SS "\f(CR\-fubo\-binding\-base\fP"
 1236 .sp
 1237 Option \f(CR\-fubo\-binding\-base [stage] base\fP sets the lowest automatically
 1238 assigned binding for Uniform Buffer Objects (GLSL) or Cbuffers (HLSL).
 1239 If a stage is specified, only affects the specified stage.
 1240 .sp
 1241 For HLSL, sets one less than the base.
 1242 .SS "\f(CR\-fcbuffer\-binding\-base\fP"
 1243 .sp
 1244 Option \f(CR\-fcbuffer\-binding\-base [stage] base\fP is the same as
 1245 \f(CR\-fubo\-binding\-base [stage] base\fP.
 1246 .SS "\f(CR\-fssbo\-binding\-base\fP"
 1247 .sp
 1248 Option \f(CR\-fssbo\-binding\-base [stage] base\fP sets the lowest automatically
 1249 assigned binding for Shader Storage Buffer Objects (GLSL).
 1250 If a stage is specified, only affects the specified stage.
 1251 .sp
 1252 This only affects GLSL compilation.
 1253 .SS "\f(CR\-fuav\-binding\-base\fP"
 1254 .sp
 1255 Option \f(CR\-fuav\-binding\-base [stage] base\fP sets one less than the lowest
 1256 automatically assigned binding for Unordered Access Views (UAV).
 1257 If a stage is specified, only affects the specified stage.
 1258 .sp
 1259 This only affects HLSL compilation.
 1260 .SS "\f(CR\-fresource\-set\-binding\fP"
 1261 .sp
 1262 Option \f(CR\-fresource\-set\-binding [stage] <reg0> <set0> <binding0>\fP sets
 1263 the descriptor set and binding for an HLSL resource, by register name.
 1264 To specify settings for more registers, append their triples consisting
 1265 of register name, descriptor set, and binding.
 1266 .sp
 1267 Example:
 1268 .sp
 1269 .if n .RS 4
 1270 .nf
 1271 .fam C
 1272 # For a texture in register t1, use set 1 binding 0.
 1273 # For a texture in register t2, use set 1 binding 3
 1274 glslc \-x hlsl foo.frag \-fresource\-set\-binding t1 1 0 t2 1 3
 1275 .fam
 1276 .fi
 1277 .if n .RE
 1278 .sp
 1279 If a stage is specified, only affects the specified stage.
 1280 .sp
 1281 .if n .RS 4
 1282 .nf
 1283 .fam C
 1284 # Same as the previous example, but the settings only apply
 1285 # to fragment (pixel) shaders.
 1286 glslc \-x hlsl foo.frag \-fresource\-set\-binding frag t1 1 0 t2 1 3
 1287 .fam
 1288 .fi
 1289 .if n .RE
 1290 .SH "DIVERGENCE FROM AND EXTENSIONS TO GLSL SPECIFICATIONS"
 1291 .SS "Source\-filename\-based \f(CR#line\fP and \f(CR__FILE__\fP"
 1292 .sp
 1293 This section describes how the glslc compiler extends the syntax for the \f(CR#line\fP
 1294 directive and the \f(CR__FILE__\fP macro. By default, the glslc compiler enables
 1295 the \f(CRGL_GOOGLE_cpp_style_line_directive\fP extension. It will generate this
 1296 extended syntax in the preprocessed output (obtained via the \f(CR\-E\fP option).
 1297 .if n .sp
 1298 .RS 4
 1299 .it 1 an-trap
 1300 .nr an-no-space-flag 1
 1301 .nr an-break-flag 1
 1302 .br
 1303 .ps +1
 1304 .B Warning
 1305 .ps -1
 1306 .br
 1307 .sp
 1308 This section is still evolving. Expect changes.
 1309 .sp .5v
 1310 .RE
 1311 .sp
 1312 GLSL specifications have a notion of source strings.
 1313 .RS 3
 1314 .ll -.6i
 1315 .sp
 1316 The source for a single shader is an array of strings of characters from the
 1317 character set. A single shader is made from the concatenation of these strings.
 1318 .br
 1319 .RE
 1320 .ll
 1321 .RS 5
 1322 .ll -.10i
 1323 \(em Section 3.2 of both version 3.30 and 4.50
 1324 .RE
 1325 .ll
 1326 .sp
 1327 With the above notion, the second parameter to the \f(CR#line\fP directive should
 1328 be a constant integer expressions representing the source string number. Also
 1329 the \f(CR__FILE__\fP macro will "substitute a decimal integer constant that says
 1330 which source string number is currently being processed."
 1331 .sp
 1332 The glslc compiler implements the standard \f(CR#line\fP and \f(CR__FILE__\fP syntax. It
 1333 also provides an extension, \f(CRGL_GOOGLE_cpp_style_line_directive\fP, to allow
 1334 source filenames to be used instead of integer source string indices.
 1335 Specifically, the \f(CR#line\fP directive can have, after macro substitution, one of
 1336 the following three forms:
 1337 .sp
 1338 .if n .RS 4
 1339 .nf
 1340 .fam C
 1341 #line line\-number
 1342 #line line\-number integer\-source\-string\-index
 1343 #line line\-number "source\-filename"
 1344 .fam
 1345 .fi
 1346 .if n .RE
 1347 .sp
 1348 where \f(CRsource\-filename\fP can be any combinations of characters except double
 1349 quotation marks. (Note that according to the GLSL specification, "there are
 1350 no escape sequences or other uses of the backslash beyond use as the
 1351 line\-continuation character".)
 1352 .sp
 1353 And if source\-filename\-based \f(CR#line\fP is used, the \f(CR__FILE__\fP macro expands to
 1354 a string whose contents are the filename quoted with double quotation marks.
 1355 The filename is dertermined as the last of
 1356 .sp
 1357 .RS 4
 1358 .ie n \{\
 1359 \h'-04'\(bu\h'+03'\c
 1360 .\}
 1361 .el \{\
 1362 .  sp -1
 1363 .  IP \(bu 2.3
 1364 .\}
 1365 The filename given to the glslc compiler,
 1366 .RE
 1367 .sp
 1368 .RS 4
 1369 .ie n \{\
 1370 \h'-04'\(bu\h'+03'\c
 1371 .\}
 1372 .el \{\
 1373 .  sp -1
 1374 .  IP \(bu 2.3
 1375 .\}
 1376 The filename argument of the most recent \f(CR#line\fP directive, if any.
 1377 .RE
 1378 .SS "\f(CR#include\fP"
 1379 .sp
 1380 The glslc compiler extends GLSL with the include syntax by turning on the
 1381 \f(CRGL_GOOGLE_include_directive\fP extension. It will preprocess and substitute
 1382 \f(CR#include\fP directives properly with the following behaviors.
 1383 .if n .sp
 1384 .RS 4
 1385 .it 1 an-trap
 1386 .nr an-no-space-flag 1
 1387 .nr an-break-flag 1
 1388 .br
 1389 .ps +1
 1390 .B Warning
 1391 .ps -1
 1392 .br
 1393 .sp
 1394 This section is still evolving. Expect changes.
 1395 .sp .5v
 1396 .RE
 1397 .sp
 1398 If \f(CR#include\fP directives are used in a shader, there will be an \f(CR#extension
 1399 GL_GOOGLE_include_directive : enable\fP line generated into the preprocessed
 1400 output.
 1401 .sp
 1402 The \f(CRGL_GOOGLE_cpp_style_line_directive\fP extension is implicitly turned on by
 1403 the \f(CRGL_GOOGLE_include_directive\fP extension.
 1404 .sp
 1405 The file argument to \f(CR#include\fP must be enclosed in double quotes.  It must be a
 1406 relative path, using whatever path separator the OS supports.  However, the last
 1407 path element \(em the name of the file itself \(em must not contain either \*(Aq/\*(Aq or
 1408 \*(Aq\(rs\*(Aq, regardless of which path separator is used.  This will not be flagged as an
 1409 error but will instead trigger undefined behavior.  For example, let\(cqs say there
 1410 is a file named \f(CRf\(rsilename.vert\fP on a Unix OS.  It is not possible to craft a
 1411 \f(CR#include\fP that includes that file.
 1412 .sp
 1413 Furthermore, it is not possible to escape any characters in a \f(CR#include\fP
 1414 directive, so the file argument cannot contain any special characters that need
 1415 escaping in C.
 1416 .sp
 1417 The file argument is a relative path that is matched first against the including
 1418 file\(cqs own directory and then against all \f(CR\-I\fP arguments in order of their
 1419 appearance on the command line.  If the file cannot be found, \f(CRglslc\fP aborts
 1420 with an error.

Generated by cgit