Skip to content

Commit

Permalink
Add #error shader preprocessor directive description
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaosus committed Oct 22, 2024
1 parent 6f84ac3 commit e3af8aa
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tutorials/shaders/shader_reference/shader_preprocessor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,24 @@ Defines the optional block which is included when the previously defined ``#if``

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

#error
^^^^^^

**Syntax:** ``#error <message>``

The ``#error`` directive forces the preprocessor to emit an error with optional message.
For example, it's useful when used within ``#if`` block to provide a strict limitation of the
defined value.

.. code-block:: glsl
#define MAX_LOD 3
#define LOD 4
#if LOD > MAX_LOD
#error LOD exceeds MAX_LOD
#endif
#include
^^^^^^^^

Expand Down

0 comments on commit e3af8aa

Please sign in to comment.