瀏覽代碼

Clarify `#undef` behavior on non-existing defines in Shader preprocessor

Hugo Locurcio 2 年之前
父節點
當前提交
a47366b378
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      tutorials/shaders/shader_reference/shader_preprocessor.rst

+ 4 - 0
tutorials/shaders/shader_reference/shader_preprocessor.rst

@@ -111,6 +111,10 @@ The ``#undef`` directive may be used to cancel a previously defined ``#define``
         return MY_COLOR;
     }
 
+    // Like in most preprocessors, undefining a define that was not previously defined is allowed
+    // (and won't print any warning or error).
+    #undef THIS_DOES_NOT_EXIST
+
 Without ``#undef`` in the above example, there would be a macro redefinition error.
 
 #if