Skip to content

Add #error shader preprocessor directive description #10127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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