Fix orphan strings in shader preprocessor

This commit is contained in:
Chaosus
2024-11-26 11:59:52 +03:00
parent 9aed9eca40
commit 5a48e527b2
4 changed files with 25 additions and 27 deletions

View File

@@ -39,7 +39,7 @@
#define HAS_WARNING(flag) (warning_flags & flag)
int ShaderLanguage::instance_counter = 0;
SafeNumeric<int> ShaderLanguage::instance_counter;
String ShaderLanguage::get_operator_text(Operator p_op) {
static const char *op_names[OP_MAX] = { "==",
@@ -11597,7 +11597,7 @@ ShaderLanguage::ShaderLanguage() {
nodes = nullptr;
completion_class = TAG_GLOBAL;
if (instance_counter == 0) {
if (instance_counter.get() == 0) {
int idx = 0;
while (builtin_func_defs[idx].name) {
if (builtin_func_defs[idx].tag == SubClassTag::TAG_GLOBAL) {
@@ -11606,7 +11606,7 @@ ShaderLanguage::ShaderLanguage() {
idx++;
}
}
instance_counter++;
instance_counter.increment();
#ifdef DEBUG_ENABLED
warnings_check_map.insert(ShaderWarning::UNUSED_CONSTANT, &used_constants);
@@ -11621,8 +11621,8 @@ ShaderLanguage::ShaderLanguage() {
ShaderLanguage::~ShaderLanguage() {
clear();
instance_counter--;
if (instance_counter == 0) {
instance_counter.decrement();
if (instance_counter.get() == 0) {
global_func_set.clear();
}
}