Skip to content

Commit 1269439

Browse files
authored
Merge pull request #10127 from Chaosus/shader_pp_error
Add `#error` shader preprocessor directive description
2 parents 6f84ac3 + e3af8aa commit 1269439

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tutorials/shaders/shader_reference/shader_preprocessor.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,24 @@ Defines the optional block which is included when the previously defined ``#if``
355355

356356
Used as terminator for the ``#if``, ``#ifdef``, ``#ifndef`` or subsequent ``#else`` directives.
357357

358+
#error
359+
^^^^^^
360+
361+
**Syntax:** ``#error <message>``
362+
363+
The ``#error`` directive forces the preprocessor to emit an error with optional message.
364+
For example, it's useful when used within ``#if`` block to provide a strict limitation of the
365+
defined value.
366+
367+
.. code-block:: glsl
368+
369+
#define MAX_LOD 3
370+
#define LOD 4
371+
372+
#if LOD > MAX_LOD
373+
#error LOD exceeds MAX_LOD
374+
#endif
375+
358376
#include
359377
^^^^^^^^
360378

0 commit comments

Comments
 (0)