Don't right-align escaped newlines, e.g. for #define. This has previously led to long diffs in the commit history.
This commit is contained in:
parent
f4f0679a2d
commit
c5df0cb82b
144 changed files with 4519 additions and 4519 deletions
|
|
@ -72,7 +72,7 @@ public:
|
|||
|
||||
#ifndef IF_EQUAL_RETURN
|
||||
#define MAKE_FORMAT_CONST(suffix) AIMAGE_FORMAT_##suffix
|
||||
#define IF_EQUAL_RETURN(param, val) \
|
||||
#define IF_EQUAL_RETURN(param, val) \
|
||||
if (MAKE_FORMAT_CONST(val) == param) \
|
||||
return #val
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ static void _editor_init() {
|
|||
#endif // TOOLS_ENABLED
|
||||
|
||||
#define FBX_REGISTER_DOCUMENT_EXTENSION(m_doc_ext_class) \
|
||||
Ref<m_doc_ext_class> extension_##m_doc_ext_class; \
|
||||
extension_##m_doc_ext_class.instantiate(); \
|
||||
Ref<m_doc_ext_class> extension_##m_doc_ext_class; \
|
||||
extension_##m_doc_ext_class.instantiate(); \
|
||||
FBXDocument::register_gltf_document_extension(extension_##m_doc_ext_class);
|
||||
|
||||
void initialize_fbx_module(ModuleInitializationLevel p_level) {
|
||||
|
|
|
|||
|
|
@ -1116,56 +1116,56 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
incr += 3;
|
||||
} break;
|
||||
|
||||
#define DISASSEMBLE_ITERATE(m_type) \
|
||||
case OPCODE_ITERATE_##m_type: { \
|
||||
text += "for-loop (typed "; \
|
||||
text += #m_type; \
|
||||
text += ") "; \
|
||||
text += DADDR(3); \
|
||||
text += " in "; \
|
||||
text += DADDR(2); \
|
||||
text += " counter "; \
|
||||
text += DADDR(1); \
|
||||
text += " end "; \
|
||||
#define DISASSEMBLE_ITERATE(m_type) \
|
||||
case OPCODE_ITERATE_##m_type: { \
|
||||
text += "for-loop (typed "; \
|
||||
text += #m_type; \
|
||||
text += ") "; \
|
||||
text += DADDR(3); \
|
||||
text += " in "; \
|
||||
text += DADDR(2); \
|
||||
text += " counter "; \
|
||||
text += DADDR(1); \
|
||||
text += " end "; \
|
||||
text += itos(_code_ptr[ip + 4]); \
|
||||
incr += 5; \
|
||||
incr += 5; \
|
||||
} break
|
||||
|
||||
#define DISASSEMBLE_ITERATE_BEGIN(m_type) \
|
||||
case OPCODE_ITERATE_BEGIN_##m_type: { \
|
||||
text += "for-init (typed "; \
|
||||
text += #m_type; \
|
||||
text += ") "; \
|
||||
text += DADDR(3); \
|
||||
text += " in "; \
|
||||
text += DADDR(2); \
|
||||
text += " counter "; \
|
||||
text += DADDR(1); \
|
||||
text += " end "; \
|
||||
text += itos(_code_ptr[ip + 4]); \
|
||||
incr += 5; \
|
||||
text += "for-init (typed "; \
|
||||
text += #m_type; \
|
||||
text += ") "; \
|
||||
text += DADDR(3); \
|
||||
text += " in "; \
|
||||
text += DADDR(2); \
|
||||
text += " counter "; \
|
||||
text += DADDR(1); \
|
||||
text += " end "; \
|
||||
text += itos(_code_ptr[ip + 4]); \
|
||||
incr += 5; \
|
||||
} break
|
||||
|
||||
#define DISASSEMBLE_ITERATE_TYPES(m_macro) \
|
||||
m_macro(INT); \
|
||||
m_macro(FLOAT); \
|
||||
m_macro(VECTOR2); \
|
||||
m_macro(VECTOR2I); \
|
||||
m_macro(VECTOR3); \
|
||||
m_macro(VECTOR3I); \
|
||||
m_macro(STRING); \
|
||||
m_macro(DICTIONARY); \
|
||||
m_macro(ARRAY); \
|
||||
m_macro(PACKED_BYTE_ARRAY); \
|
||||
m_macro(PACKED_INT32_ARRAY); \
|
||||
m_macro(PACKED_INT64_ARRAY); \
|
||||
m_macro(PACKED_FLOAT32_ARRAY); \
|
||||
m_macro(PACKED_FLOAT64_ARRAY); \
|
||||
m_macro(PACKED_STRING_ARRAY); \
|
||||
m_macro(PACKED_VECTOR2_ARRAY); \
|
||||
m_macro(PACKED_VECTOR3_ARRAY); \
|
||||
m_macro(PACKED_COLOR_ARRAY); \
|
||||
m_macro(PACKED_VECTOR4_ARRAY); \
|
||||
m_macro(INT); \
|
||||
m_macro(FLOAT); \
|
||||
m_macro(VECTOR2); \
|
||||
m_macro(VECTOR2I); \
|
||||
m_macro(VECTOR3); \
|
||||
m_macro(VECTOR3I); \
|
||||
m_macro(STRING); \
|
||||
m_macro(DICTIONARY); \
|
||||
m_macro(ARRAY); \
|
||||
m_macro(PACKED_BYTE_ARRAY); \
|
||||
m_macro(PACKED_INT32_ARRAY); \
|
||||
m_macro(PACKED_INT64_ARRAY); \
|
||||
m_macro(PACKED_FLOAT32_ARRAY); \
|
||||
m_macro(PACKED_FLOAT64_ARRAY); \
|
||||
m_macro(PACKED_STRING_ARRAY); \
|
||||
m_macro(PACKED_VECTOR2_ARRAY); \
|
||||
m_macro(PACKED_VECTOR3_ARRAY); \
|
||||
m_macro(PACKED_COLOR_ARRAY); \
|
||||
m_macro(PACKED_VECTOR4_ARRAY); \
|
||||
m_macro(OBJECT)
|
||||
|
||||
case OPCODE_ITERATE_BEGIN: {
|
||||
|
|
@ -1256,11 +1256,11 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
|
||||
#define DISASSEMBLE_TYPE_ADJUST(m_v_type) \
|
||||
case OPCODE_TYPE_ADJUST_##m_v_type: { \
|
||||
text += "type adjust ("; \
|
||||
text += #m_v_type; \
|
||||
text += ") "; \
|
||||
text += DADDR(1); \
|
||||
incr += 2; \
|
||||
text += "type adjust ("; \
|
||||
text += #m_v_type; \
|
||||
text += ") "; \
|
||||
text += DADDR(1); \
|
||||
incr += 2; \
|
||||
} break
|
||||
|
||||
DISASSEMBLE_TYPE_ADJUST(BOOL);
|
||||
|
|
|
|||
|
|
@ -703,12 +703,12 @@ void GDScriptParser::parse_program() {
|
|||
current_class = head;
|
||||
bool can_have_class_or_extends = true;
|
||||
|
||||
#define PUSH_PENDING_ANNOTATIONS_TO_HEAD \
|
||||
if (!annotation_stack.is_empty()) { \
|
||||
#define PUSH_PENDING_ANNOTATIONS_TO_HEAD \
|
||||
if (!annotation_stack.is_empty()) { \
|
||||
for (AnnotationNode *annot : annotation_stack) { \
|
||||
head->annotations.push_back(annot); \
|
||||
} \
|
||||
annotation_stack.clear(); \
|
||||
head->annotations.push_back(annot); \
|
||||
} \
|
||||
annotation_stack.clear(); \
|
||||
}
|
||||
|
||||
while (!check(GDScriptTokenizer::Token::TK_EOF)) {
|
||||
|
|
@ -5104,14 +5104,14 @@ bool GDScriptParser::warning_ignore_annotation(AnnotationNode *p_annotation, Nod
|
|||
int end_line = p_target->end_line;
|
||||
|
||||
switch (p_target->type) {
|
||||
#define SIMPLE_CASE(m_type, m_class, m_property) \
|
||||
case m_type: { \
|
||||
#define SIMPLE_CASE(m_type, m_class, m_property) \
|
||||
case m_type: { \
|
||||
m_class *node = static_cast<m_class *>(p_target); \
|
||||
if (node->m_property == nullptr) { \
|
||||
end_line = node->start_line; \
|
||||
} else { \
|
||||
end_line = node->m_property->end_line; \
|
||||
} \
|
||||
if (node->m_property == nullptr) { \
|
||||
end_line = node->start_line; \
|
||||
} else { \
|
||||
end_line = node->m_property->end_line; \
|
||||
} \
|
||||
} break;
|
||||
|
||||
// Can contain properties (set/get).
|
||||
|
|
|
|||
|
|
@ -483,66 +483,66 @@ GDScriptTokenizer::Token GDScriptTokenizerText::annotation() {
|
|||
return annotation;
|
||||
}
|
||||
|
||||
#define KEYWORDS(KEYWORD_GROUP, KEYWORD) \
|
||||
KEYWORD_GROUP('a') \
|
||||
KEYWORD("as", Token::AS) \
|
||||
KEYWORD("and", Token::AND) \
|
||||
KEYWORD("assert", Token::ASSERT) \
|
||||
KEYWORD("await", Token::AWAIT) \
|
||||
KEYWORD_GROUP('b') \
|
||||
KEYWORD("break", Token::BREAK) \
|
||||
#define KEYWORDS(KEYWORD_GROUP, KEYWORD) \
|
||||
KEYWORD_GROUP('a') \
|
||||
KEYWORD("as", Token::AS) \
|
||||
KEYWORD("and", Token::AND) \
|
||||
KEYWORD("assert", Token::ASSERT) \
|
||||
KEYWORD("await", Token::AWAIT) \
|
||||
KEYWORD_GROUP('b') \
|
||||
KEYWORD("break", Token::BREAK) \
|
||||
KEYWORD("breakpoint", Token::BREAKPOINT) \
|
||||
KEYWORD_GROUP('c') \
|
||||
KEYWORD("class", Token::CLASS) \
|
||||
KEYWORD_GROUP('c') \
|
||||
KEYWORD("class", Token::CLASS) \
|
||||
KEYWORD("class_name", Token::CLASS_NAME) \
|
||||
KEYWORD("const", Token::TK_CONST) \
|
||||
KEYWORD("continue", Token::CONTINUE) \
|
||||
KEYWORD_GROUP('e') \
|
||||
KEYWORD("elif", Token::ELIF) \
|
||||
KEYWORD("else", Token::ELSE) \
|
||||
KEYWORD("enum", Token::ENUM) \
|
||||
KEYWORD("extends", Token::EXTENDS) \
|
||||
KEYWORD_GROUP('f') \
|
||||
KEYWORD("for", Token::FOR) \
|
||||
KEYWORD("func", Token::FUNC) \
|
||||
KEYWORD_GROUP('i') \
|
||||
KEYWORD("if", Token::IF) \
|
||||
KEYWORD("in", Token::TK_IN) \
|
||||
KEYWORD("is", Token::IS) \
|
||||
KEYWORD_GROUP('m') \
|
||||
KEYWORD("match", Token::MATCH) \
|
||||
KEYWORD_GROUP('n') \
|
||||
KEYWORD("namespace", Token::NAMESPACE) \
|
||||
KEYWORD("not", Token::NOT) \
|
||||
KEYWORD_GROUP('o') \
|
||||
KEYWORD("or", Token::OR) \
|
||||
KEYWORD_GROUP('p') \
|
||||
KEYWORD("pass", Token::PASS) \
|
||||
KEYWORD("preload", Token::PRELOAD) \
|
||||
KEYWORD_GROUP('r') \
|
||||
KEYWORD("return", Token::RETURN) \
|
||||
KEYWORD_GROUP('s') \
|
||||
KEYWORD("self", Token::SELF) \
|
||||
KEYWORD("signal", Token::SIGNAL) \
|
||||
KEYWORD("static", Token::STATIC) \
|
||||
KEYWORD("super", Token::SUPER) \
|
||||
KEYWORD_GROUP('t') \
|
||||
KEYWORD("trait", Token::TRAIT) \
|
||||
KEYWORD_GROUP('v') \
|
||||
KEYWORD("var", Token::VAR) \
|
||||
KEYWORD("void", Token::TK_VOID) \
|
||||
KEYWORD_GROUP('w') \
|
||||
KEYWORD("while", Token::WHILE) \
|
||||
KEYWORD("when", Token::WHEN) \
|
||||
KEYWORD_GROUP('y') \
|
||||
KEYWORD("yield", Token::YIELD) \
|
||||
KEYWORD_GROUP('I') \
|
||||
KEYWORD("INF", Token::CONST_INF) \
|
||||
KEYWORD_GROUP('N') \
|
||||
KEYWORD("NAN", Token::CONST_NAN) \
|
||||
KEYWORD_GROUP('P') \
|
||||
KEYWORD("PI", Token::CONST_PI) \
|
||||
KEYWORD_GROUP('T') \
|
||||
KEYWORD("const", Token::TK_CONST) \
|
||||
KEYWORD("continue", Token::CONTINUE) \
|
||||
KEYWORD_GROUP('e') \
|
||||
KEYWORD("elif", Token::ELIF) \
|
||||
KEYWORD("else", Token::ELSE) \
|
||||
KEYWORD("enum", Token::ENUM) \
|
||||
KEYWORD("extends", Token::EXTENDS) \
|
||||
KEYWORD_GROUP('f') \
|
||||
KEYWORD("for", Token::FOR) \
|
||||
KEYWORD("func", Token::FUNC) \
|
||||
KEYWORD_GROUP('i') \
|
||||
KEYWORD("if", Token::IF) \
|
||||
KEYWORD("in", Token::TK_IN) \
|
||||
KEYWORD("is", Token::IS) \
|
||||
KEYWORD_GROUP('m') \
|
||||
KEYWORD("match", Token::MATCH) \
|
||||
KEYWORD_GROUP('n') \
|
||||
KEYWORD("namespace", Token::NAMESPACE) \
|
||||
KEYWORD("not", Token::NOT) \
|
||||
KEYWORD_GROUP('o') \
|
||||
KEYWORD("or", Token::OR) \
|
||||
KEYWORD_GROUP('p') \
|
||||
KEYWORD("pass", Token::PASS) \
|
||||
KEYWORD("preload", Token::PRELOAD) \
|
||||
KEYWORD_GROUP('r') \
|
||||
KEYWORD("return", Token::RETURN) \
|
||||
KEYWORD_GROUP('s') \
|
||||
KEYWORD("self", Token::SELF) \
|
||||
KEYWORD("signal", Token::SIGNAL) \
|
||||
KEYWORD("static", Token::STATIC) \
|
||||
KEYWORD("super", Token::SUPER) \
|
||||
KEYWORD_GROUP('t') \
|
||||
KEYWORD("trait", Token::TRAIT) \
|
||||
KEYWORD_GROUP('v') \
|
||||
KEYWORD("var", Token::VAR) \
|
||||
KEYWORD("void", Token::TK_VOID) \
|
||||
KEYWORD_GROUP('w') \
|
||||
KEYWORD("while", Token::WHILE) \
|
||||
KEYWORD("when", Token::WHEN) \
|
||||
KEYWORD_GROUP('y') \
|
||||
KEYWORD("yield", Token::YIELD) \
|
||||
KEYWORD_GROUP('I') \
|
||||
KEYWORD("INF", Token::CONST_INF) \
|
||||
KEYWORD_GROUP('N') \
|
||||
KEYWORD("NAN", Token::CONST_NAN) \
|
||||
KEYWORD_GROUP('P') \
|
||||
KEYWORD("PI", Token::CONST_PI) \
|
||||
KEYWORD_GROUP('T') \
|
||||
KEYWORD("TAU", Token::CONST_TAU)
|
||||
|
||||
#define MIN_KEYWORD_LENGTH 2
|
||||
|
|
@ -604,18 +604,18 @@ GDScriptTokenizer::Token GDScriptTokenizerText::potential_identifier() {
|
|||
|
||||
// Define some helper macros for the switch case.
|
||||
#define KEYWORD_GROUP_CASE(char) \
|
||||
break; \
|
||||
break; \
|
||||
case char:
|
||||
#define KEYWORD(keyword, token_type) \
|
||||
{ \
|
||||
const int keyword_length = sizeof(keyword) - 1; \
|
||||
static_assert(keyword_length <= MAX_KEYWORD_LENGTH, "There's a keyword longer than the defined maximum length"); \
|
||||
#define KEYWORD(keyword, token_type) \
|
||||
{ \
|
||||
const int keyword_length = sizeof(keyword) - 1; \
|
||||
static_assert(keyword_length <= MAX_KEYWORD_LENGTH, "There's a keyword longer than the defined maximum length"); \
|
||||
static_assert(keyword_length >= MIN_KEYWORD_LENGTH, "There's a keyword shorter than the defined minimum length"); \
|
||||
if (keyword_length == len && name == keyword) { \
|
||||
Token kw = make_token(token_type); \
|
||||
kw.literal = name; \
|
||||
return kw; \
|
||||
} \
|
||||
if (keyword_length == len && name == keyword) { \
|
||||
Token kw = make_token(token_type); \
|
||||
kw.literal = name; \
|
||||
return kw; \
|
||||
} \
|
||||
}
|
||||
|
||||
// Find if it's a keyword.
|
||||
|
|
|
|||
|
|
@ -41,36 +41,36 @@
|
|||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
#define DEBUG_VALIDATE_ARG_COUNT(m_min_count, m_max_count) \
|
||||
if (unlikely(p_arg_count < m_min_count)) { \
|
||||
*r_ret = Variant(); \
|
||||
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; \
|
||||
r_error.expected = m_min_count; \
|
||||
return; \
|
||||
} \
|
||||
if (unlikely(p_arg_count > m_max_count)) { \
|
||||
*r_ret = Variant(); \
|
||||
#define DEBUG_VALIDATE_ARG_COUNT(m_min_count, m_max_count) \
|
||||
if (unlikely(p_arg_count < m_min_count)) { \
|
||||
*r_ret = Variant(); \
|
||||
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; \
|
||||
r_error.expected = m_min_count; \
|
||||
return; \
|
||||
} \
|
||||
if (unlikely(p_arg_count > m_max_count)) { \
|
||||
*r_ret = Variant(); \
|
||||
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; \
|
||||
r_error.expected = m_max_count; \
|
||||
return; \
|
||||
r_error.expected = m_max_count; \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define DEBUG_VALIDATE_ARG_TYPE(m_arg, m_type) \
|
||||
#define DEBUG_VALIDATE_ARG_TYPE(m_arg, m_type) \
|
||||
if (unlikely(!Variant::can_convert_strict(p_args[m_arg]->get_type(), m_type))) { \
|
||||
*r_ret = Variant(); \
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; \
|
||||
r_error.argument = m_arg; \
|
||||
r_error.expected = m_type; \
|
||||
return; \
|
||||
*r_ret = Variant(); \
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; \
|
||||
r_error.argument = m_arg; \
|
||||
r_error.expected = m_type; \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define DEBUG_VALIDATE_ARG_CUSTOM(m_arg, m_type, m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
*r_ret = m_msg; \
|
||||
#define DEBUG_VALIDATE_ARG_CUSTOM(m_arg, m_type, m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
*r_ret = m_msg; \
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; \
|
||||
r_error.argument = m_arg; \
|
||||
r_error.expected = m_type; \
|
||||
return; \
|
||||
r_error.argument = m_arg; \
|
||||
r_error.expected = m_type; \
|
||||
return; \
|
||||
}
|
||||
|
||||
#else // !DEBUG_ENABLED
|
||||
|
|
@ -81,20 +81,20 @@
|
|||
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
#define VALIDATE_ARG_CUSTOM(m_arg, m_type, m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
*r_ret = m_msg; \
|
||||
#define VALIDATE_ARG_CUSTOM(m_arg, m_type, m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
*r_ret = m_msg; \
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; \
|
||||
r_error.argument = m_arg; \
|
||||
r_error.expected = m_type; \
|
||||
return; \
|
||||
r_error.argument = m_arg; \
|
||||
r_error.expected = m_type; \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define GDFUNC_FAIL_COND_MSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
*r_ret = m_msg; \
|
||||
#define GDFUNC_FAIL_COND_MSG(m_cond, m_msg) \
|
||||
if (unlikely(m_cond)) { \
|
||||
*r_ret = m_msg; \
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; \
|
||||
return; \
|
||||
return; \
|
||||
}
|
||||
|
||||
struct GDScriptUtilityFunctionsDefinitions {
|
||||
|
|
@ -527,19 +527,19 @@ static void _register_function(const StringName &p_name, const MethodInfo &p_met
|
|||
utility_function_name_table.push_back(p_name);
|
||||
}
|
||||
|
||||
#define REGISTER_FUNC(m_func, m_is_const, m_return, m_args, m_is_vararg, m_default_args) \
|
||||
{ \
|
||||
String name(#m_func); \
|
||||
if (name.begins_with("_")) { \
|
||||
name = name.substr(1); \
|
||||
} \
|
||||
MethodInfo info = m_args; \
|
||||
info.name = name; \
|
||||
info.return_val = m_return; \
|
||||
info.default_arguments = m_default_args; \
|
||||
if (m_is_vararg) { \
|
||||
info.flags |= METHOD_FLAG_VARARG; \
|
||||
} \
|
||||
#define REGISTER_FUNC(m_func, m_is_const, m_return, m_args, m_is_vararg, m_default_args) \
|
||||
{ \
|
||||
String name(#m_func); \
|
||||
if (name.begins_with("_")) { \
|
||||
name = name.substr(1); \
|
||||
} \
|
||||
MethodInfo info = m_args; \
|
||||
info.name = name; \
|
||||
info.return_val = m_return; \
|
||||
info.default_arguments = m_default_args; \
|
||||
if (m_is_vararg) { \
|
||||
info.flags |= METHOD_FLAG_VARARG; \
|
||||
} \
|
||||
_register_function(name, info, GDScriptUtilityFunctionsDefinitions::m_func, m_is_const); \
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -251,167 +251,167 @@ void (*type_init_function_table[])(Variant *) = {
|
|||
};
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define OPCODES_TABLE \
|
||||
static const void *switch_table_ops[] = { \
|
||||
&&OPCODE_OPERATOR, \
|
||||
&&OPCODE_OPERATOR_VALIDATED, \
|
||||
&&OPCODE_TYPE_TEST_BUILTIN, \
|
||||
&&OPCODE_TYPE_TEST_ARRAY, \
|
||||
&&OPCODE_TYPE_TEST_DICTIONARY, \
|
||||
&&OPCODE_TYPE_TEST_NATIVE, \
|
||||
&&OPCODE_TYPE_TEST_SCRIPT, \
|
||||
&&OPCODE_SET_KEYED, \
|
||||
&&OPCODE_SET_KEYED_VALIDATED, \
|
||||
&&OPCODE_SET_INDEXED_VALIDATED, \
|
||||
&&OPCODE_GET_KEYED, \
|
||||
&&OPCODE_GET_KEYED_VALIDATED, \
|
||||
&&OPCODE_GET_INDEXED_VALIDATED, \
|
||||
&&OPCODE_SET_NAMED, \
|
||||
&&OPCODE_SET_NAMED_VALIDATED, \
|
||||
&&OPCODE_GET_NAMED, \
|
||||
&&OPCODE_GET_NAMED_VALIDATED, \
|
||||
&&OPCODE_SET_MEMBER, \
|
||||
&&OPCODE_GET_MEMBER, \
|
||||
&&OPCODE_SET_STATIC_VARIABLE, \
|
||||
&&OPCODE_GET_STATIC_VARIABLE, \
|
||||
&&OPCODE_ASSIGN, \
|
||||
&&OPCODE_ASSIGN_NULL, \
|
||||
&&OPCODE_ASSIGN_TRUE, \
|
||||
&&OPCODE_ASSIGN_FALSE, \
|
||||
&&OPCODE_ASSIGN_TYPED_BUILTIN, \
|
||||
&&OPCODE_ASSIGN_TYPED_ARRAY, \
|
||||
&&OPCODE_ASSIGN_TYPED_DICTIONARY, \
|
||||
&&OPCODE_ASSIGN_TYPED_NATIVE, \
|
||||
&&OPCODE_ASSIGN_TYPED_SCRIPT, \
|
||||
&&OPCODE_CAST_TO_BUILTIN, \
|
||||
&&OPCODE_CAST_TO_NATIVE, \
|
||||
&&OPCODE_CAST_TO_SCRIPT, \
|
||||
&&OPCODE_CONSTRUCT, \
|
||||
&&OPCODE_CONSTRUCT_VALIDATED, \
|
||||
&&OPCODE_CONSTRUCT_ARRAY, \
|
||||
&&OPCODE_CONSTRUCT_TYPED_ARRAY, \
|
||||
&&OPCODE_CONSTRUCT_DICTIONARY, \
|
||||
&&OPCODE_CONSTRUCT_TYPED_DICTIONARY, \
|
||||
&&OPCODE_CALL, \
|
||||
&&OPCODE_CALL_RETURN, \
|
||||
&&OPCODE_CALL_ASYNC, \
|
||||
&&OPCODE_CALL_UTILITY, \
|
||||
&&OPCODE_CALL_UTILITY_VALIDATED, \
|
||||
&&OPCODE_CALL_GDSCRIPT_UTILITY, \
|
||||
&&OPCODE_CALL_BUILTIN_TYPE_VALIDATED, \
|
||||
&&OPCODE_CALL_SELF_BASE, \
|
||||
&&OPCODE_CALL_METHOD_BIND, \
|
||||
&&OPCODE_CALL_METHOD_BIND_RET, \
|
||||
&&OPCODE_CALL_BUILTIN_STATIC, \
|
||||
&&OPCODE_CALL_NATIVE_STATIC, \
|
||||
&&OPCODE_CALL_NATIVE_STATIC_VALIDATED_RETURN, \
|
||||
#define OPCODES_TABLE \
|
||||
static const void *switch_table_ops[] = { \
|
||||
&&OPCODE_OPERATOR, \
|
||||
&&OPCODE_OPERATOR_VALIDATED, \
|
||||
&&OPCODE_TYPE_TEST_BUILTIN, \
|
||||
&&OPCODE_TYPE_TEST_ARRAY, \
|
||||
&&OPCODE_TYPE_TEST_DICTIONARY, \
|
||||
&&OPCODE_TYPE_TEST_NATIVE, \
|
||||
&&OPCODE_TYPE_TEST_SCRIPT, \
|
||||
&&OPCODE_SET_KEYED, \
|
||||
&&OPCODE_SET_KEYED_VALIDATED, \
|
||||
&&OPCODE_SET_INDEXED_VALIDATED, \
|
||||
&&OPCODE_GET_KEYED, \
|
||||
&&OPCODE_GET_KEYED_VALIDATED, \
|
||||
&&OPCODE_GET_INDEXED_VALIDATED, \
|
||||
&&OPCODE_SET_NAMED, \
|
||||
&&OPCODE_SET_NAMED_VALIDATED, \
|
||||
&&OPCODE_GET_NAMED, \
|
||||
&&OPCODE_GET_NAMED_VALIDATED, \
|
||||
&&OPCODE_SET_MEMBER, \
|
||||
&&OPCODE_GET_MEMBER, \
|
||||
&&OPCODE_SET_STATIC_VARIABLE, \
|
||||
&&OPCODE_GET_STATIC_VARIABLE, \
|
||||
&&OPCODE_ASSIGN, \
|
||||
&&OPCODE_ASSIGN_NULL, \
|
||||
&&OPCODE_ASSIGN_TRUE, \
|
||||
&&OPCODE_ASSIGN_FALSE, \
|
||||
&&OPCODE_ASSIGN_TYPED_BUILTIN, \
|
||||
&&OPCODE_ASSIGN_TYPED_ARRAY, \
|
||||
&&OPCODE_ASSIGN_TYPED_DICTIONARY, \
|
||||
&&OPCODE_ASSIGN_TYPED_NATIVE, \
|
||||
&&OPCODE_ASSIGN_TYPED_SCRIPT, \
|
||||
&&OPCODE_CAST_TO_BUILTIN, \
|
||||
&&OPCODE_CAST_TO_NATIVE, \
|
||||
&&OPCODE_CAST_TO_SCRIPT, \
|
||||
&&OPCODE_CONSTRUCT, \
|
||||
&&OPCODE_CONSTRUCT_VALIDATED, \
|
||||
&&OPCODE_CONSTRUCT_ARRAY, \
|
||||
&&OPCODE_CONSTRUCT_TYPED_ARRAY, \
|
||||
&&OPCODE_CONSTRUCT_DICTIONARY, \
|
||||
&&OPCODE_CONSTRUCT_TYPED_DICTIONARY, \
|
||||
&&OPCODE_CALL, \
|
||||
&&OPCODE_CALL_RETURN, \
|
||||
&&OPCODE_CALL_ASYNC, \
|
||||
&&OPCODE_CALL_UTILITY, \
|
||||
&&OPCODE_CALL_UTILITY_VALIDATED, \
|
||||
&&OPCODE_CALL_GDSCRIPT_UTILITY, \
|
||||
&&OPCODE_CALL_BUILTIN_TYPE_VALIDATED, \
|
||||
&&OPCODE_CALL_SELF_BASE, \
|
||||
&&OPCODE_CALL_METHOD_BIND, \
|
||||
&&OPCODE_CALL_METHOD_BIND_RET, \
|
||||
&&OPCODE_CALL_BUILTIN_STATIC, \
|
||||
&&OPCODE_CALL_NATIVE_STATIC, \
|
||||
&&OPCODE_CALL_NATIVE_STATIC_VALIDATED_RETURN, \
|
||||
&&OPCODE_CALL_NATIVE_STATIC_VALIDATED_NO_RETURN, \
|
||||
&&OPCODE_CALL_METHOD_BIND_VALIDATED_RETURN, \
|
||||
&&OPCODE_CALL_METHOD_BIND_VALIDATED_NO_RETURN, \
|
||||
&&OPCODE_AWAIT, \
|
||||
&&OPCODE_AWAIT_RESUME, \
|
||||
&&OPCODE_CREATE_LAMBDA, \
|
||||
&&OPCODE_CREATE_SELF_LAMBDA, \
|
||||
&&OPCODE_JUMP, \
|
||||
&&OPCODE_JUMP_IF, \
|
||||
&&OPCODE_JUMP_IF_NOT, \
|
||||
&&OPCODE_JUMP_TO_DEF_ARGUMENT, \
|
||||
&&OPCODE_JUMP_IF_SHARED, \
|
||||
&&OPCODE_RETURN, \
|
||||
&&OPCODE_RETURN_TYPED_BUILTIN, \
|
||||
&&OPCODE_RETURN_TYPED_ARRAY, \
|
||||
&&OPCODE_RETURN_TYPED_DICTIONARY, \
|
||||
&&OPCODE_RETURN_TYPED_NATIVE, \
|
||||
&&OPCODE_RETURN_TYPED_SCRIPT, \
|
||||
&&OPCODE_ITERATE_BEGIN, \
|
||||
&&OPCODE_ITERATE_BEGIN_INT, \
|
||||
&&OPCODE_ITERATE_BEGIN_FLOAT, \
|
||||
&&OPCODE_ITERATE_BEGIN_VECTOR2, \
|
||||
&&OPCODE_ITERATE_BEGIN_VECTOR2I, \
|
||||
&&OPCODE_ITERATE_BEGIN_VECTOR3, \
|
||||
&&OPCODE_ITERATE_BEGIN_VECTOR3I, \
|
||||
&&OPCODE_ITERATE_BEGIN_STRING, \
|
||||
&&OPCODE_ITERATE_BEGIN_DICTIONARY, \
|
||||
&&OPCODE_ITERATE_BEGIN_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_BYTE_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_INT32_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_INT64_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_FLOAT32_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_FLOAT64_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_STRING_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_VECTOR2_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_VECTOR3_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_COLOR_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_VECTOR4_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_OBJECT, \
|
||||
&&OPCODE_ITERATE_BEGIN_RANGE, \
|
||||
&&OPCODE_ITERATE, \
|
||||
&&OPCODE_ITERATE_INT, \
|
||||
&&OPCODE_ITERATE_FLOAT, \
|
||||
&&OPCODE_ITERATE_VECTOR2, \
|
||||
&&OPCODE_ITERATE_VECTOR2I, \
|
||||
&&OPCODE_ITERATE_VECTOR3, \
|
||||
&&OPCODE_ITERATE_VECTOR3I, \
|
||||
&&OPCODE_ITERATE_STRING, \
|
||||
&&OPCODE_ITERATE_DICTIONARY, \
|
||||
&&OPCODE_ITERATE_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_BYTE_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_INT32_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_INT64_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_FLOAT32_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_FLOAT64_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_STRING_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_VECTOR2_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_VECTOR3_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_COLOR_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_VECTOR4_ARRAY, \
|
||||
&&OPCODE_ITERATE_OBJECT, \
|
||||
&&OPCODE_ITERATE_RANGE, \
|
||||
&&OPCODE_STORE_GLOBAL, \
|
||||
&&OPCODE_STORE_NAMED_GLOBAL, \
|
||||
&&OPCODE_TYPE_ADJUST_BOOL, \
|
||||
&&OPCODE_TYPE_ADJUST_INT, \
|
||||
&&OPCODE_TYPE_ADJUST_FLOAT, \
|
||||
&&OPCODE_TYPE_ADJUST_STRING, \
|
||||
&&OPCODE_TYPE_ADJUST_VECTOR2, \
|
||||
&&OPCODE_TYPE_ADJUST_VECTOR2I, \
|
||||
&&OPCODE_TYPE_ADJUST_RECT2, \
|
||||
&&OPCODE_TYPE_ADJUST_RECT2I, \
|
||||
&&OPCODE_TYPE_ADJUST_VECTOR3, \
|
||||
&&OPCODE_TYPE_ADJUST_VECTOR3I, \
|
||||
&&OPCODE_TYPE_ADJUST_TRANSFORM2D, \
|
||||
&&OPCODE_TYPE_ADJUST_VECTOR4, \
|
||||
&&OPCODE_TYPE_ADJUST_VECTOR4I, \
|
||||
&&OPCODE_TYPE_ADJUST_PLANE, \
|
||||
&&OPCODE_TYPE_ADJUST_QUATERNION, \
|
||||
&&OPCODE_TYPE_ADJUST_AABB, \
|
||||
&&OPCODE_TYPE_ADJUST_BASIS, \
|
||||
&&OPCODE_TYPE_ADJUST_TRANSFORM3D, \
|
||||
&&OPCODE_TYPE_ADJUST_PROJECTION, \
|
||||
&&OPCODE_TYPE_ADJUST_COLOR, \
|
||||
&&OPCODE_TYPE_ADJUST_STRING_NAME, \
|
||||
&&OPCODE_TYPE_ADJUST_NODE_PATH, \
|
||||
&&OPCODE_TYPE_ADJUST_RID, \
|
||||
&&OPCODE_TYPE_ADJUST_OBJECT, \
|
||||
&&OPCODE_TYPE_ADJUST_CALLABLE, \
|
||||
&&OPCODE_TYPE_ADJUST_SIGNAL, \
|
||||
&&OPCODE_TYPE_ADJUST_DICTIONARY, \
|
||||
&&OPCODE_TYPE_ADJUST_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_BYTE_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_INT32_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_INT64_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_FLOAT32_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_FLOAT64_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_STRING_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_VECTOR2_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_VECTOR3_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_COLOR_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_VECTOR4_ARRAY, \
|
||||
&&OPCODE_ASSERT, \
|
||||
&&OPCODE_BREAKPOINT, \
|
||||
&&OPCODE_LINE, \
|
||||
&&OPCODE_END \
|
||||
}; \
|
||||
&&OPCODE_CALL_METHOD_BIND_VALIDATED_RETURN, \
|
||||
&&OPCODE_CALL_METHOD_BIND_VALIDATED_NO_RETURN, \
|
||||
&&OPCODE_AWAIT, \
|
||||
&&OPCODE_AWAIT_RESUME, \
|
||||
&&OPCODE_CREATE_LAMBDA, \
|
||||
&&OPCODE_CREATE_SELF_LAMBDA, \
|
||||
&&OPCODE_JUMP, \
|
||||
&&OPCODE_JUMP_IF, \
|
||||
&&OPCODE_JUMP_IF_NOT, \
|
||||
&&OPCODE_JUMP_TO_DEF_ARGUMENT, \
|
||||
&&OPCODE_JUMP_IF_SHARED, \
|
||||
&&OPCODE_RETURN, \
|
||||
&&OPCODE_RETURN_TYPED_BUILTIN, \
|
||||
&&OPCODE_RETURN_TYPED_ARRAY, \
|
||||
&&OPCODE_RETURN_TYPED_DICTIONARY, \
|
||||
&&OPCODE_RETURN_TYPED_NATIVE, \
|
||||
&&OPCODE_RETURN_TYPED_SCRIPT, \
|
||||
&&OPCODE_ITERATE_BEGIN, \
|
||||
&&OPCODE_ITERATE_BEGIN_INT, \
|
||||
&&OPCODE_ITERATE_BEGIN_FLOAT, \
|
||||
&&OPCODE_ITERATE_BEGIN_VECTOR2, \
|
||||
&&OPCODE_ITERATE_BEGIN_VECTOR2I, \
|
||||
&&OPCODE_ITERATE_BEGIN_VECTOR3, \
|
||||
&&OPCODE_ITERATE_BEGIN_VECTOR3I, \
|
||||
&&OPCODE_ITERATE_BEGIN_STRING, \
|
||||
&&OPCODE_ITERATE_BEGIN_DICTIONARY, \
|
||||
&&OPCODE_ITERATE_BEGIN_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_BYTE_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_INT32_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_INT64_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_FLOAT32_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_FLOAT64_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_STRING_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_VECTOR2_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_VECTOR3_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_COLOR_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_PACKED_VECTOR4_ARRAY, \
|
||||
&&OPCODE_ITERATE_BEGIN_OBJECT, \
|
||||
&&OPCODE_ITERATE_BEGIN_RANGE, \
|
||||
&&OPCODE_ITERATE, \
|
||||
&&OPCODE_ITERATE_INT, \
|
||||
&&OPCODE_ITERATE_FLOAT, \
|
||||
&&OPCODE_ITERATE_VECTOR2, \
|
||||
&&OPCODE_ITERATE_VECTOR2I, \
|
||||
&&OPCODE_ITERATE_VECTOR3, \
|
||||
&&OPCODE_ITERATE_VECTOR3I, \
|
||||
&&OPCODE_ITERATE_STRING, \
|
||||
&&OPCODE_ITERATE_DICTIONARY, \
|
||||
&&OPCODE_ITERATE_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_BYTE_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_INT32_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_INT64_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_FLOAT32_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_FLOAT64_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_STRING_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_VECTOR2_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_VECTOR3_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_COLOR_ARRAY, \
|
||||
&&OPCODE_ITERATE_PACKED_VECTOR4_ARRAY, \
|
||||
&&OPCODE_ITERATE_OBJECT, \
|
||||
&&OPCODE_ITERATE_RANGE, \
|
||||
&&OPCODE_STORE_GLOBAL, \
|
||||
&&OPCODE_STORE_NAMED_GLOBAL, \
|
||||
&&OPCODE_TYPE_ADJUST_BOOL, \
|
||||
&&OPCODE_TYPE_ADJUST_INT, \
|
||||
&&OPCODE_TYPE_ADJUST_FLOAT, \
|
||||
&&OPCODE_TYPE_ADJUST_STRING, \
|
||||
&&OPCODE_TYPE_ADJUST_VECTOR2, \
|
||||
&&OPCODE_TYPE_ADJUST_VECTOR2I, \
|
||||
&&OPCODE_TYPE_ADJUST_RECT2, \
|
||||
&&OPCODE_TYPE_ADJUST_RECT2I, \
|
||||
&&OPCODE_TYPE_ADJUST_VECTOR3, \
|
||||
&&OPCODE_TYPE_ADJUST_VECTOR3I, \
|
||||
&&OPCODE_TYPE_ADJUST_TRANSFORM2D, \
|
||||
&&OPCODE_TYPE_ADJUST_VECTOR4, \
|
||||
&&OPCODE_TYPE_ADJUST_VECTOR4I, \
|
||||
&&OPCODE_TYPE_ADJUST_PLANE, \
|
||||
&&OPCODE_TYPE_ADJUST_QUATERNION, \
|
||||
&&OPCODE_TYPE_ADJUST_AABB, \
|
||||
&&OPCODE_TYPE_ADJUST_BASIS, \
|
||||
&&OPCODE_TYPE_ADJUST_TRANSFORM3D, \
|
||||
&&OPCODE_TYPE_ADJUST_PROJECTION, \
|
||||
&&OPCODE_TYPE_ADJUST_COLOR, \
|
||||
&&OPCODE_TYPE_ADJUST_STRING_NAME, \
|
||||
&&OPCODE_TYPE_ADJUST_NODE_PATH, \
|
||||
&&OPCODE_TYPE_ADJUST_RID, \
|
||||
&&OPCODE_TYPE_ADJUST_OBJECT, \
|
||||
&&OPCODE_TYPE_ADJUST_CALLABLE, \
|
||||
&&OPCODE_TYPE_ADJUST_SIGNAL, \
|
||||
&&OPCODE_TYPE_ADJUST_DICTIONARY, \
|
||||
&&OPCODE_TYPE_ADJUST_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_BYTE_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_INT32_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_INT64_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_FLOAT32_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_FLOAT64_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_STRING_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_VECTOR2_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_VECTOR3_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_COLOR_ARRAY, \
|
||||
&&OPCODE_TYPE_ADJUST_PACKED_VECTOR4_ARRAY, \
|
||||
&&OPCODE_ASSERT, \
|
||||
&&OPCODE_BREAKPOINT, \
|
||||
&&OPCODE_LINE, \
|
||||
&&OPCODE_END \
|
||||
}; \
|
||||
static_assert(std_size(switch_table_ops) == (OPCODE_END + 1), "Opcodes in jump table aren't the same as opcodes in enum.");
|
||||
|
||||
#define OPCODE(m_op) \
|
||||
|
|
@ -424,7 +424,7 @@ void (*type_init_function_table[])(Variant *) = {
|
|||
#define OPCODE_SWITCH(m_test) goto *switch_table_ops[m_test];
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
#define DISPATCH_OPCODE \
|
||||
#define DISPATCH_OPCODE \
|
||||
last_opcode = _code_ptr[ip]; \
|
||||
goto *switch_table_ops[last_opcode]
|
||||
#else // !DEBUG_ENABLED
|
||||
|
|
@ -442,7 +442,7 @@ void (*type_init_function_table[])(Variant *) = {
|
|||
#define DISPATCH_OPCODE continue
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define OPCODE_SWITCH(m_test) \
|
||||
#define OPCODE_SWITCH(m_test) \
|
||||
__assume(m_test <= OPCODE_END); \
|
||||
switch (m_test)
|
||||
#else // !_MSC_VER
|
||||
|
|
@ -663,61 +663,61 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
GDScriptLanguage::get_singleton()->enter_function(&call_level, p_instance, this, stack, &ip, &line);
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
#define GD_ERR_BREAK(m_cond) \
|
||||
{ \
|
||||
if (unlikely(m_cond)) { \
|
||||
#define GD_ERR_BREAK(m_cond) \
|
||||
{ \
|
||||
if (unlikely(m_cond)) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Breaking..:"); \
|
||||
OPCODE_BREAK; \
|
||||
} \
|
||||
OPCODE_BREAK; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CHECK_SPACE(m_space) \
|
||||
GD_ERR_BREAK((ip + m_space) > _code_size)
|
||||
|
||||
#define GET_VARIANT_PTR(m_v, m_code_ofs) \
|
||||
Variant *m_v; \
|
||||
{ \
|
||||
int address = _code_ptr[ip + 1 + (m_code_ofs)]; \
|
||||
int address_type = (address & ADDR_TYPE_MASK) >> ADDR_BITS; \
|
||||
if (unlikely(address_type < 0 || address_type >= ADDR_TYPE_MAX)) { \
|
||||
err_text = "Bad address type."; \
|
||||
OPCODE_BREAK; \
|
||||
} \
|
||||
int address_index = address & ADDR_MASK; \
|
||||
#define GET_VARIANT_PTR(m_v, m_code_ofs) \
|
||||
Variant *m_v; \
|
||||
{ \
|
||||
int address = _code_ptr[ip + 1 + (m_code_ofs)]; \
|
||||
int address_type = (address & ADDR_TYPE_MASK) >> ADDR_BITS; \
|
||||
if (unlikely(address_type < 0 || address_type >= ADDR_TYPE_MAX)) { \
|
||||
err_text = "Bad address type."; \
|
||||
OPCODE_BREAK; \
|
||||
} \
|
||||
int address_index = address & ADDR_MASK; \
|
||||
if (unlikely(address_index < 0 || address_index >= variant_address_limits[address_type])) { \
|
||||
if (address_type == ADDR_TYPE_MEMBER && !p_instance) { \
|
||||
err_text = "Cannot access member without instance."; \
|
||||
} else { \
|
||||
err_text = "Bad address index."; \
|
||||
} \
|
||||
OPCODE_BREAK; \
|
||||
} \
|
||||
m_v = &variant_addresses[address_type][address_index]; \
|
||||
if (unlikely(!m_v)) \
|
||||
OPCODE_BREAK; \
|
||||
if (address_type == ADDR_TYPE_MEMBER && !p_instance) { \
|
||||
err_text = "Cannot access member without instance."; \
|
||||
} else { \
|
||||
err_text = "Bad address index."; \
|
||||
} \
|
||||
OPCODE_BREAK; \
|
||||
} \
|
||||
m_v = &variant_addresses[address_type][address_index]; \
|
||||
if (unlikely(!m_v)) \
|
||||
OPCODE_BREAK; \
|
||||
}
|
||||
|
||||
#else // !DEBUG_ENABLED
|
||||
#define GD_ERR_BREAK(m_cond)
|
||||
#define CHECK_SPACE(m_space)
|
||||
|
||||
#define GET_VARIANT_PTR(m_v, m_code_ofs) \
|
||||
Variant *m_v; \
|
||||
{ \
|
||||
int address = _code_ptr[ip + 1 + (m_code_ofs)]; \
|
||||
#define GET_VARIANT_PTR(m_v, m_code_ofs) \
|
||||
Variant *m_v; \
|
||||
{ \
|
||||
int address = _code_ptr[ip + 1 + (m_code_ofs)]; \
|
||||
m_v = &variant_addresses[(address & ADDR_TYPE_MASK) >> ADDR_BITS][address & ADDR_MASK]; \
|
||||
if (unlikely(!m_v)) \
|
||||
OPCODE_BREAK; \
|
||||
if (unlikely(!m_v)) \
|
||||
OPCODE_BREAK; \
|
||||
}
|
||||
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
#define LOAD_INSTRUCTION_ARGS \
|
||||
int instr_arg_count = _code_ptr[ip + 1]; \
|
||||
#define LOAD_INSTRUCTION_ARGS \
|
||||
int instr_arg_count = _code_ptr[ip + 1]; \
|
||||
for (int i = 0; i < instr_arg_count; i++) { \
|
||||
GET_VARIANT_PTR(v, i + 1); \
|
||||
instruction_args[i] = v; \
|
||||
} \
|
||||
GET_VARIANT_PTR(v, i + 1); \
|
||||
instruction_args[i] = v; \
|
||||
} \
|
||||
ip += 1; // Offset to skip instruction argcount.
|
||||
|
||||
#define GET_INSTRUCTION_ARG(m_v, m_idx) \
|
||||
|
|
@ -3301,25 +3301,25 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
DISPATCH_OPCODE;
|
||||
|
||||
#define OPCODE_ITERATE_BEGIN_PACKED_ARRAY(m_var_type, m_elem_type, m_get_func, m_var_ret_type, m_ret_type, m_ret_get_func) \
|
||||
OPCODE(OPCODE_ITERATE_BEGIN_PACKED_##m_var_type##_ARRAY) { \
|
||||
CHECK_SPACE(8); \
|
||||
GET_VARIANT_PTR(counter, 0); \
|
||||
GET_VARIANT_PTR(container, 1); \
|
||||
Vector<m_elem_type> *array = VariantInternal::m_get_func(container); \
|
||||
VariantInternal::initialize(counter, Variant::INT); \
|
||||
*VariantInternal::get_int(counter) = 0; \
|
||||
if (!array->is_empty()) { \
|
||||
GET_VARIANT_PTR(iterator, 2); \
|
||||
VariantInternal::initialize(iterator, Variant::m_var_ret_type); \
|
||||
m_ret_type *it = VariantInternal::m_ret_get_func(iterator); \
|
||||
*it = array->get(0); \
|
||||
ip += 5; \
|
||||
} else { \
|
||||
int jumpto = _code_ptr[ip + 4]; \
|
||||
GD_ERR_BREAK(jumpto < 0 || jumpto > _code_size); \
|
||||
ip = jumpto; \
|
||||
} \
|
||||
} \
|
||||
OPCODE(OPCODE_ITERATE_BEGIN_PACKED_##m_var_type##_ARRAY) { \
|
||||
CHECK_SPACE(8); \
|
||||
GET_VARIANT_PTR(counter, 0); \
|
||||
GET_VARIANT_PTR(container, 1); \
|
||||
Vector<m_elem_type> *array = VariantInternal::m_get_func(container); \
|
||||
VariantInternal::initialize(counter, Variant::INT); \
|
||||
*VariantInternal::get_int(counter) = 0; \
|
||||
if (!array->is_empty()) { \
|
||||
GET_VARIANT_PTR(iterator, 2); \
|
||||
VariantInternal::initialize(iterator, Variant::m_var_ret_type); \
|
||||
m_ret_type *it = VariantInternal::m_ret_get_func(iterator); \
|
||||
*it = array->get(0); \
|
||||
ip += 5; \
|
||||
} else { \
|
||||
int jumpto = _code_ptr[ip + 4]; \
|
||||
GD_ERR_BREAK(jumpto < 0 || jumpto > _code_size); \
|
||||
ip = jumpto; \
|
||||
} \
|
||||
} \
|
||||
DISPATCH_OPCODE
|
||||
|
||||
OPCODE_ITERATE_BEGIN_PACKED_ARRAY(BYTE, uint8_t, get_byte_array, INT, int64_t, get_int);
|
||||
|
|
@ -3669,24 +3669,24 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
}
|
||||
DISPATCH_OPCODE;
|
||||
|
||||
#define OPCODE_ITERATE_PACKED_ARRAY(m_var_type, m_elem_type, m_get_func, m_ret_get_func) \
|
||||
OPCODE(OPCODE_ITERATE_PACKED_##m_var_type##_ARRAY) { \
|
||||
CHECK_SPACE(4); \
|
||||
GET_VARIANT_PTR(counter, 0); \
|
||||
GET_VARIANT_PTR(container, 1); \
|
||||
#define OPCODE_ITERATE_PACKED_ARRAY(m_var_type, m_elem_type, m_get_func, m_ret_get_func) \
|
||||
OPCODE(OPCODE_ITERATE_PACKED_##m_var_type##_ARRAY) { \
|
||||
CHECK_SPACE(4); \
|
||||
GET_VARIANT_PTR(counter, 0); \
|
||||
GET_VARIANT_PTR(container, 1); \
|
||||
const Vector<m_elem_type> *array = VariantInternal::m_get_func((const Variant *)container); \
|
||||
int64_t *idx = VariantInternal::get_int(counter); \
|
||||
(*idx)++; \
|
||||
if (*idx >= array->size()) { \
|
||||
int jumpto = _code_ptr[ip + 4]; \
|
||||
GD_ERR_BREAK(jumpto < 0 || jumpto > _code_size); \
|
||||
ip = jumpto; \
|
||||
} else { \
|
||||
GET_VARIANT_PTR(iterator, 2); \
|
||||
*VariantInternal::m_ret_get_func(iterator) = array->get(*idx); \
|
||||
ip += 5; \
|
||||
} \
|
||||
} \
|
||||
int64_t *idx = VariantInternal::get_int(counter); \
|
||||
(*idx)++; \
|
||||
if (*idx >= array->size()) { \
|
||||
int jumpto = _code_ptr[ip + 4]; \
|
||||
GD_ERR_BREAK(jumpto < 0 || jumpto > _code_size); \
|
||||
ip = jumpto; \
|
||||
} else { \
|
||||
GET_VARIANT_PTR(iterator, 2); \
|
||||
*VariantInternal::m_ret_get_func(iterator) = array->get(*idx); \
|
||||
ip += 5; \
|
||||
} \
|
||||
} \
|
||||
DISPATCH_OPCODE
|
||||
|
||||
OPCODE_ITERATE_PACKED_ARRAY(BYTE, uint8_t, get_byte_array, get_int);
|
||||
|
|
@ -3810,13 +3810,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
}
|
||||
DISPATCH_OPCODE;
|
||||
|
||||
#define OPCODE_TYPE_ADJUST(m_v_type, m_c_type) \
|
||||
OPCODE(OPCODE_TYPE_ADJUST_##m_v_type) { \
|
||||
CHECK_SPACE(2); \
|
||||
GET_VARIANT_PTR(arg, 0); \
|
||||
#define OPCODE_TYPE_ADJUST(m_v_type, m_c_type) \
|
||||
OPCODE(OPCODE_TYPE_ADJUST_##m_v_type) { \
|
||||
CHECK_SPACE(2); \
|
||||
GET_VARIANT_PTR(arg, 0); \
|
||||
VariantTypeAdjust<m_c_type>::adjust(arg); \
|
||||
ip += 2; \
|
||||
} \
|
||||
ip += 2; \
|
||||
} \
|
||||
DISPATCH_OPCODE
|
||||
|
||||
OPCODE_TYPE_ADJUST(BOOL, bool);
|
||||
|
|
|
|||
|
|
@ -38,15 +38,15 @@
|
|||
#include "editor/settings/editor_settings.h"
|
||||
#include "modules/gdscript/language_server/godot_lsp.h"
|
||||
|
||||
#define LSP_CLIENT_V(m_ret_val) \
|
||||
#define LSP_CLIENT_V(m_ret_val) \
|
||||
ERR_FAIL_COND_V(latest_client_id == LSP_NO_CLIENT, m_ret_val); \
|
||||
ERR_FAIL_COND_V(!clients.has(latest_client_id), m_ret_val); \
|
||||
Ref<LSPeer> client = clients.get(latest_client_id); \
|
||||
ERR_FAIL_COND_V(!clients.has(latest_client_id), m_ret_val); \
|
||||
Ref<LSPeer> client = clients.get(latest_client_id); \
|
||||
ERR_FAIL_COND_V(!client.is_valid(), m_ret_val);
|
||||
|
||||
#define LSP_CLIENT \
|
||||
ERR_FAIL_COND(latest_client_id == LSP_NO_CLIENT); \
|
||||
ERR_FAIL_COND(!clients.has(latest_client_id)); \
|
||||
#define LSP_CLIENT \
|
||||
ERR_FAIL_COND(latest_client_id == LSP_NO_CLIENT); \
|
||||
ERR_FAIL_COND(!clients.has(latest_client_id)); \
|
||||
Ref<LSPeer> client = clients.get(latest_client_id); \
|
||||
ERR_FAIL_COND(!client.is_valid());
|
||||
|
||||
|
|
|
|||
|
|
@ -99,8 +99,8 @@ static void _editor_init() {
|
|||
#endif // TOOLS_ENABLED
|
||||
|
||||
#define GLTF_REGISTER_DOCUMENT_EXTENSION(m_doc_ext_class) \
|
||||
Ref<m_doc_ext_class> extension_##m_doc_ext_class; \
|
||||
extension_##m_doc_ext_class.instantiate(); \
|
||||
Ref<m_doc_ext_class> extension_##m_doc_ext_class; \
|
||||
extension_##m_doc_ext_class.instantiate(); \
|
||||
GLTFDocument::register_gltf_document_extension(extension_##m_doc_ext_class);
|
||||
|
||||
void initialize_gltf_module(ModuleInitializationLevel p_level) {
|
||||
|
|
|
|||
|
|
@ -374,9 +374,9 @@ public:
|
|||
|
||||
/****** SAT TESTS *******/
|
||||
|
||||
#define TEST_POINT(m_a, m_b) \
|
||||
((!separator.test_axis(((m_a) - (m_b)).normalized())) || \
|
||||
(castA && !separator.test_axis(((m_a) + p_motion_a - (m_b)).normalized())) || \
|
||||
#define TEST_POINT(m_a, m_b) \
|
||||
((!separator.test_axis(((m_a) - (m_b)).normalized())) || \
|
||||
(castA && !separator.test_axis(((m_a) + p_motion_a - (m_b)).normalized())) || \
|
||||
(castB && !separator.test_axis(((m_a) - ((m_b) + p_motion_b)).normalized())) || \
|
||||
(castA && castB && !separator.test_axis(((m_a) + p_motion_a - ((m_b) + p_motion_b)).normalized())))
|
||||
|
||||
|
|
|
|||
|
|
@ -128,19 +128,19 @@ public:
|
|||
};
|
||||
|
||||
//let the optimizer do the magic
|
||||
#define DEFAULT_PROJECT_RANGE_CAST \
|
||||
#define DEFAULT_PROJECT_RANGE_CAST \
|
||||
virtual void project_range_castv(const Vector2 &p_cast, const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const override { \
|
||||
project_range_cast(p_cast, p_normal, p_transform, r_min, r_max); \
|
||||
} \
|
||||
_FORCE_INLINE_ void project_range_cast(const Vector2 &p_cast, const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { \
|
||||
real_t mina, maxa; \
|
||||
real_t minb, maxb; \
|
||||
Transform2D ofsb = p_transform; \
|
||||
ofsb.columns[2] += p_cast; \
|
||||
project_range(p_normal, p_transform, mina, maxa); \
|
||||
project_range(p_normal, ofsb, minb, maxb); \
|
||||
r_min = MIN(mina, minb); \
|
||||
r_max = MAX(maxa, maxb); \
|
||||
project_range_cast(p_cast, p_normal, p_transform, r_min, r_max); \
|
||||
} \
|
||||
_FORCE_INLINE_ void project_range_cast(const Vector2 &p_cast, const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { \
|
||||
real_t mina, maxa; \
|
||||
real_t minb, maxb; \
|
||||
Transform2D ofsb = p_transform; \
|
||||
ofsb.columns[2] += p_cast; \
|
||||
project_range(p_normal, p_transform, mina, maxa); \
|
||||
project_range(p_normal, ofsb, minb, maxb); \
|
||||
r_min = MIN(mina, minb); \
|
||||
r_max = MAX(maxa, maxb); \
|
||||
}
|
||||
|
||||
class GodotWorldBoundaryShape2D : public GodotShape2D {
|
||||
|
|
|
|||
|
|
@ -95,25 +95,25 @@ public:
|
|||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
#define JOLT_ENSURE_SCALE_NOT_ZERO(m_transform, m_msg) \
|
||||
if (unlikely((m_transform).basis.determinant() == 0.0f)) { \
|
||||
WARN_PRINT(vformat("%s " \
|
||||
#define JOLT_ENSURE_SCALE_NOT_ZERO(m_transform, m_msg) \
|
||||
if (unlikely((m_transform).basis.determinant() == 0.0f)) { \
|
||||
WARN_PRINT(vformat("%s " \
|
||||
"The basis of the transform was singular, which is not supported by Jolt Physics. " \
|
||||
"This is likely caused by one or more axes having a scale of zero. " \
|
||||
"The basis (and thus its scale) will be treated as identity.", \
|
||||
m_msg)); \
|
||||
\
|
||||
(m_transform).basis = Basis(); \
|
||||
} else \
|
||||
"This is likely caused by one or more axes having a scale of zero. " \
|
||||
"The basis (and thus its scale) will be treated as identity.", \
|
||||
m_msg)); \
|
||||
\
|
||||
(m_transform).basis = Basis(); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
#define ERR_PRINT_INVALID_SCALE_MSG(m_scale, m_valid_scale, m_msg) \
|
||||
if (unlikely(!JoltShape3D::is_scale_valid(m_scale, valid_scale))) { \
|
||||
ERR_PRINT(vformat("%s " \
|
||||
#define ERR_PRINT_INVALID_SCALE_MSG(m_scale, m_valid_scale, m_msg) \
|
||||
if (unlikely(!JoltShape3D::is_scale_valid(m_scale, valid_scale))) { \
|
||||
ERR_PRINT(vformat("%s " \
|
||||
"A scale of %v is not supported by Jolt Physics for this shape/body. " \
|
||||
"The scale will instead be treated as %v.", \
|
||||
m_msg, m_scale, valid_scale)); \
|
||||
} else \
|
||||
"The scale will instead be treated as %v.", \
|
||||
m_msg, m_scale, valid_scale)); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
#else
|
||||
|
|
@ -124,10 +124,10 @@ public:
|
|||
|
||||
#endif
|
||||
|
||||
#define JOLT_ENSURE_SCALE_VALID(m_shape, m_scale, m_msg) \
|
||||
if (true) { \
|
||||
#define JOLT_ENSURE_SCALE_VALID(m_shape, m_scale, m_msg) \
|
||||
if (true) { \
|
||||
const Vector3 valid_scale = JoltShape3D::make_scale_valid(m_shape, m_scale); \
|
||||
ERR_PRINT_INVALID_SCALE_MSG(m_scale, valid_scale, m_msg); \
|
||||
(m_scale) = valid_scale; \
|
||||
} else \
|
||||
ERR_PRINT_INVALID_SCALE_MSG(m_scale, valid_scale, m_msg); \
|
||||
(m_scale) = valid_scale; \
|
||||
} else \
|
||||
((void)0)
|
||||
|
|
|
|||
|
|
@ -1169,19 +1169,19 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
|
|||
RID shadowmask_tex;
|
||||
RID shadowmask_tex2;
|
||||
|
||||
#define FREE_TEXTURES \
|
||||
rd->free_rid(albedo_array_tex); \
|
||||
rd->free_rid(emission_array_tex); \
|
||||
rd->free_rid(normal_tex); \
|
||||
rd->free_rid(position_tex); \
|
||||
rd->free_rid(unocclude_tex); \
|
||||
rd->free_rid(light_source_tex); \
|
||||
rd->free_rid(light_accum_tex2); \
|
||||
rd->free_rid(light_accum_tex); \
|
||||
#define FREE_TEXTURES \
|
||||
rd->free_rid(albedo_array_tex); \
|
||||
rd->free_rid(emission_array_tex); \
|
||||
rd->free_rid(normal_tex); \
|
||||
rd->free_rid(position_tex); \
|
||||
rd->free_rid(unocclude_tex); \
|
||||
rd->free_rid(light_source_tex); \
|
||||
rd->free_rid(light_accum_tex2); \
|
||||
rd->free_rid(light_accum_tex); \
|
||||
rd->free_rid(light_environment_tex); \
|
||||
if (p_bake_shadowmask) { \
|
||||
rd->free_rid(shadowmask_tex); \
|
||||
rd->free_rid(shadowmask_tex2); \
|
||||
if (p_bake_shadowmask) { \
|
||||
rd->free_rid(shadowmask_tex); \
|
||||
rd->free_rid(shadowmask_tex2); \
|
||||
}
|
||||
|
||||
{ // create all textures
|
||||
|
|
@ -1286,16 +1286,16 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
|
|||
|
||||
Vector<int> slice_seam_count;
|
||||
|
||||
#define FREE_BUFFERS \
|
||||
rd->free_rid(bake_parameters_buffer); \
|
||||
rd->free_rid(vertex_buffer); \
|
||||
rd->free_rid(triangle_buffer); \
|
||||
rd->free_rid(lights_buffer); \
|
||||
#define FREE_BUFFERS \
|
||||
rd->free_rid(bake_parameters_buffer); \
|
||||
rd->free_rid(vertex_buffer); \
|
||||
rd->free_rid(triangle_buffer); \
|
||||
rd->free_rid(lights_buffer); \
|
||||
rd->free_rid(triangle_indices_buffer); \
|
||||
rd->free_rid(cluster_indices_buffer); \
|
||||
rd->free_rid(cluster_aabbs_buffer); \
|
||||
rd->free_rid(grid_texture); \
|
||||
rd->free_rid(seams_buffer); \
|
||||
rd->free_rid(cluster_indices_buffer); \
|
||||
rd->free_rid(cluster_aabbs_buffer); \
|
||||
rd->free_rid(grid_texture); \
|
||||
rd->free_rid(seams_buffer); \
|
||||
rd->free_rid(probe_positions_buffer);
|
||||
|
||||
const uint32_t cluster_size = 16;
|
||||
|
|
@ -1537,9 +1537,9 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
|
|||
}
|
||||
#endif
|
||||
|
||||
#define FREE_RASTER_RESOURCES \
|
||||
#define FREE_RASTER_RESOURCES \
|
||||
rd->free_rid(rasterize_shader); \
|
||||
rd->free_rid(sampler); \
|
||||
rd->free_rid(sampler); \
|
||||
rd->free_rid(raster_depth_buffer);
|
||||
|
||||
/* Plot direct light */
|
||||
|
|
@ -1598,9 +1598,9 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
|
|||
|
||||
RID compute_base_uniform_set = rd->uniform_set_create(base_uniforms, compute_shader_primary, 0);
|
||||
|
||||
#define FREE_COMPUTE_RESOURCES \
|
||||
#define FREE_COMPUTE_RESOURCES \
|
||||
rd->free_rid(compute_shader_unocclude); \
|
||||
rd->free_rid(compute_shader_primary); \
|
||||
rd->free_rid(compute_shader_primary); \
|
||||
rd->free_rid(compute_shader_secondary); \
|
||||
rd->free_rid(compute_shader_light_probes);
|
||||
|
||||
|
|
@ -2179,7 +2179,7 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
|
|||
|
||||
ERR_FAIL_COND_V(blendseams_triangle_raster_shader.is_null(), BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES);
|
||||
|
||||
#define FREE_BLENDSEAMS_RESOURCES \
|
||||
#define FREE_BLENDSEAMS_RESOURCES \
|
||||
rd->free_rid(blendseams_line_raster_shader); \
|
||||
rd->free_rid(blendseams_triangle_raster_shader);
|
||||
|
||||
|
|
|
|||
|
|
@ -1575,43 +1575,43 @@ void BindingsGenerator::_generate_array_extensions(StringBuilder &p_output) {
|
|||
// The class where we put the extensions doesn't matter, so just use "GD".
|
||||
p_output.append("public static partial class " BINDINGS_GLOBAL_SCOPE_CLASS "\n{");
|
||||
|
||||
#define ARRAY_IS_EMPTY(m_type) \
|
||||
p_output.append("\n" INDENT1 "/// <summary>\n"); \
|
||||
#define ARRAY_IS_EMPTY(m_type) \
|
||||
p_output.append("\n" INDENT1 "/// <summary>\n"); \
|
||||
p_output.append(INDENT1 "/// Returns true if this " #m_type " array is empty or doesn't exist.\n"); \
|
||||
p_output.append(INDENT1 "/// </summary>\n"); \
|
||||
p_output.append(INDENT1 "/// <param name=\"instance\">The " #m_type " array check.</param>\n"); \
|
||||
p_output.append(INDENT1 "/// <returns>Whether or not the array is empty.</returns>\n"); \
|
||||
p_output.append(INDENT1 "public static bool IsEmpty(this " #m_type "[] instance)\n"); \
|
||||
p_output.append(OPEN_BLOCK_L1); \
|
||||
p_output.append(INDENT2 "return instance == null || instance.Length == 0;\n"); \
|
||||
p_output.append(INDENT1 "/// </summary>\n"); \
|
||||
p_output.append(INDENT1 "/// <param name=\"instance\">The " #m_type " array check.</param>\n"); \
|
||||
p_output.append(INDENT1 "/// <returns>Whether or not the array is empty.</returns>\n"); \
|
||||
p_output.append(INDENT1 "public static bool IsEmpty(this " #m_type "[] instance)\n"); \
|
||||
p_output.append(OPEN_BLOCK_L1); \
|
||||
p_output.append(INDENT2 "return instance == null || instance.Length == 0;\n"); \
|
||||
p_output.append(INDENT1 CLOSE_BLOCK);
|
||||
|
||||
#define ARRAY_JOIN(m_type) \
|
||||
p_output.append("\n" INDENT1 "/// <summary>\n"); \
|
||||
p_output.append(INDENT1 "/// Converts this " #m_type " array to a string delimited by the given string.\n"); \
|
||||
p_output.append(INDENT1 "/// </summary>\n"); \
|
||||
p_output.append(INDENT1 "/// <param name=\"instance\">The " #m_type " array to convert.</param>\n"); \
|
||||
p_output.append(INDENT1 "/// <param name=\"delimiter\">The delimiter to use between items.</param>\n"); \
|
||||
p_output.append(INDENT1 "/// <returns>A single string with all items.</returns>\n"); \
|
||||
p_output.append(INDENT1 "public static string Join(this " #m_type "[] instance, string delimiter = \", \")\n"); \
|
||||
p_output.append(OPEN_BLOCK_L1); \
|
||||
p_output.append(INDENT2 "return String.Join(delimiter, instance);\n"); \
|
||||
p_output.append(INDENT1 CLOSE_BLOCK);
|
||||
|
||||
#define ARRAY_STRINGIFY(m_type) \
|
||||
p_output.append("\n" INDENT1 "/// <summary>\n"); \
|
||||
p_output.append(INDENT1 "/// Converts this " #m_type " array to a string with brackets.\n"); \
|
||||
p_output.append(INDENT1 "/// </summary>\n"); \
|
||||
#define ARRAY_JOIN(m_type) \
|
||||
p_output.append("\n" INDENT1 "/// <summary>\n"); \
|
||||
p_output.append(INDENT1 "/// Converts this " #m_type " array to a string delimited by the given string.\n"); \
|
||||
p_output.append(INDENT1 "/// </summary>\n"); \
|
||||
p_output.append(INDENT1 "/// <param name=\"instance\">The " #m_type " array to convert.</param>\n"); \
|
||||
p_output.append(INDENT1 "/// <returns>A single string with all items.</returns>\n"); \
|
||||
p_output.append(INDENT1 "public static string Stringify(this " #m_type "[] instance)\n"); \
|
||||
p_output.append(OPEN_BLOCK_L1); \
|
||||
p_output.append(INDENT2 "return \"[\" + instance.Join() + \"]\";\n"); \
|
||||
p_output.append(INDENT1 "/// <param name=\"delimiter\">The delimiter to use between items.</param>\n"); \
|
||||
p_output.append(INDENT1 "/// <returns>A single string with all items.</returns>\n"); \
|
||||
p_output.append(INDENT1 "public static string Join(this " #m_type "[] instance, string delimiter = \", \")\n"); \
|
||||
p_output.append(OPEN_BLOCK_L1); \
|
||||
p_output.append(INDENT2 "return String.Join(delimiter, instance);\n"); \
|
||||
p_output.append(INDENT1 CLOSE_BLOCK);
|
||||
|
||||
#define ARRAY_ALL(m_type) \
|
||||
#define ARRAY_STRINGIFY(m_type) \
|
||||
p_output.append("\n" INDENT1 "/// <summary>\n"); \
|
||||
p_output.append(INDENT1 "/// Converts this " #m_type " array to a string with brackets.\n"); \
|
||||
p_output.append(INDENT1 "/// </summary>\n"); \
|
||||
p_output.append(INDENT1 "/// <param name=\"instance\">The " #m_type " array to convert.</param>\n"); \
|
||||
p_output.append(INDENT1 "/// <returns>A single string with all items.</returns>\n"); \
|
||||
p_output.append(INDENT1 "public static string Stringify(this " #m_type "[] instance)\n"); \
|
||||
p_output.append(OPEN_BLOCK_L1); \
|
||||
p_output.append(INDENT2 "return \"[\" + instance.Join() + \"]\";\n"); \
|
||||
p_output.append(INDENT1 CLOSE_BLOCK);
|
||||
|
||||
#define ARRAY_ALL(m_type) \
|
||||
ARRAY_IS_EMPTY(m_type) \
|
||||
ARRAY_JOIN(m_type) \
|
||||
ARRAY_JOIN(m_type) \
|
||||
ARRAY_STRINGIFY(m_type)
|
||||
|
||||
ARRAY_ALL(byte);
|
||||
|
|
@ -4739,12 +4739,12 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
|
|||
|
||||
TypeInterface itype;
|
||||
|
||||
#define INSERT_STRUCT_TYPE(m_type, m_proxy_name) \
|
||||
{ \
|
||||
#define INSERT_STRUCT_TYPE(m_type, m_proxy_name) \
|
||||
{ \
|
||||
itype = TypeInterface::create_value_type(String(#m_type), String(#m_proxy_name)); \
|
||||
itype.cs_in_expr = "&%0"; \
|
||||
itype.cs_in_expr_is_unsafe = true; \
|
||||
builtin_types.insert(itype.cname, itype); \
|
||||
itype.cs_in_expr = "&%0"; \
|
||||
itype.cs_in_expr_is_unsafe = true; \
|
||||
builtin_types.insert(itype.cname, itype); \
|
||||
}
|
||||
|
||||
INSERT_STRUCT_TYPE(Vector2, Vector2)
|
||||
|
|
@ -4781,21 +4781,21 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
|
|||
{
|
||||
// C interface for 'uint32_t' is the same as that of enums. Remember to apply
|
||||
// any of the changes done here to 'TypeInterface::postsetup_enum_type' as well.
|
||||
#define INSERT_INT_TYPE(m_name, m_int_struct_name) \
|
||||
{ \
|
||||
itype = TypeInterface::create_value_type(String(m_name)); \
|
||||
if (itype.name != "long" && itype.name != "ulong") { \
|
||||
itype.c_in = "%5%0 %1_in = %1;\n"; \
|
||||
itype.c_out = "%5return (%0)(%1);\n"; \
|
||||
itype.c_type = "long"; \
|
||||
itype.c_arg_in = "&%s_in"; \
|
||||
} else { \
|
||||
itype.c_arg_in = "&%s"; \
|
||||
} \
|
||||
itype.c_type_in = itype.name; \
|
||||
itype.c_type_out = itype.name; \
|
||||
#define INSERT_INT_TYPE(m_name, m_int_struct_name) \
|
||||
{ \
|
||||
itype = TypeInterface::create_value_type(String(m_name)); \
|
||||
if (itype.name != "long" && itype.name != "ulong") { \
|
||||
itype.c_in = "%5%0 %1_in = %1;\n"; \
|
||||
itype.c_out = "%5return (%0)(%1);\n"; \
|
||||
itype.c_type = "long"; \
|
||||
itype.c_arg_in = "&%s_in"; \
|
||||
} else { \
|
||||
itype.c_arg_in = "&%s"; \
|
||||
} \
|
||||
itype.c_type_in = itype.name; \
|
||||
itype.c_type_out = itype.name; \
|
||||
itype.c_in_vararg = "%5using godot_variant %1_in = VariantUtils.CreateFromInt(%1);\n"; \
|
||||
builtin_types.insert(itype.cname, itype); \
|
||||
builtin_types.insert(itype.cname, itype); \
|
||||
}
|
||||
|
||||
// The expected type for all integers in ptrcall is 'int64_t', so that's what we use for 'c_type'
|
||||
|
|
@ -4967,22 +4967,22 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
|
|||
itype.is_span_compatible = true;
|
||||
builtin_types.insert(itype.cname, itype);
|
||||
|
||||
#define INSERT_ARRAY_FULL(m_name, m_type, m_managed_type, m_proxy_t) \
|
||||
{ \
|
||||
itype = TypeInterface(); \
|
||||
itype.name = #m_name; \
|
||||
itype.cname = itype.name; \
|
||||
itype.proxy_name = #m_proxy_t "[]"; \
|
||||
itype.cs_type = itype.proxy_name; \
|
||||
#define INSERT_ARRAY_FULL(m_name, m_type, m_managed_type, m_proxy_t) \
|
||||
{ \
|
||||
itype = TypeInterface(); \
|
||||
itype.name = #m_name; \
|
||||
itype.cname = itype.name; \
|
||||
itype.proxy_name = #m_proxy_t "[]"; \
|
||||
itype.cs_type = itype.proxy_name; \
|
||||
itype.c_in = "%5using %0 %1_in = " C_METHOD_MONOARRAY_TO(m_type) "(%1);\n"; \
|
||||
itype.c_out = "%5return " C_METHOD_MONOARRAY_FROM(m_type) "(%1);\n"; \
|
||||
itype.c_arg_in = "&%s_in"; \
|
||||
itype.c_type = #m_managed_type; \
|
||||
itype.c_type_in = "ReadOnlySpan<" #m_proxy_t ">"; \
|
||||
itype.c_type_out = itype.proxy_name; \
|
||||
itype.c_type_is_disposable_struct = true; \
|
||||
itype.is_span_compatible = true; \
|
||||
builtin_types.insert(itype.name, itype); \
|
||||
itype.c_out = "%5return " C_METHOD_MONOARRAY_FROM(m_type) "(%1);\n"; \
|
||||
itype.c_arg_in = "&%s_in"; \
|
||||
itype.c_type = #m_managed_type; \
|
||||
itype.c_type_in = "ReadOnlySpan<" #m_proxy_t ">"; \
|
||||
itype.c_type_out = itype.proxy_name; \
|
||||
itype.c_type_is_disposable_struct = true; \
|
||||
itype.is_span_compatible = true; \
|
||||
builtin_types.insert(itype.name, itype); \
|
||||
}
|
||||
|
||||
#define INSERT_ARRAY(m_type, m_managed_type, m_proxy_t) INSERT_ARRAY_FULL(m_type, m_type, m_managed_type, m_proxy_t)
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ bool godot_api_cache_updated = false;
|
|||
void update_godot_api_cache(const ManagedCallbacks &p_managed_callbacks) {
|
||||
int checked_count = 0;
|
||||
|
||||
#define CHECK_CALLBACK_NOT_NULL_IMPL(m_var, m_class, m_method) \
|
||||
{ \
|
||||
ERR_FAIL_NULL_MSG(m_var, \
|
||||
#define CHECK_CALLBACK_NOT_NULL_IMPL(m_var, m_class, m_method) \
|
||||
{ \
|
||||
ERR_FAIL_NULL_MSG(m_var, \
|
||||
"Mono Cache: Managed callback for '" #m_class "_" #m_method "' is null."); \
|
||||
checked_count += 1; \
|
||||
checked_count += 1; \
|
||||
}
|
||||
|
||||
#define CHECK_CALLBACK_NOT_NULL(m_class, m_method) CHECK_CALLBACK_NOT_NULL_IMPL(p_managed_callbacks.m_class##_##m_method, m_class, m_method)
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@
|
|||
#define GD_UNREACHABLE() __builtin_unreachable()
|
||||
#else
|
||||
#define GD_UNREACHABLE() \
|
||||
CRASH_NOW(); \
|
||||
do { \
|
||||
CRASH_NOW(); \
|
||||
do { \
|
||||
} while (true)
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include "core/os/os.h"
|
||||
#include "scene/main/node.h"
|
||||
|
||||
#define MAKE_ROOM(m_amount) \
|
||||
#define MAKE_ROOM(m_amount) \
|
||||
if (packet_cache.size() < m_amount) \
|
||||
packet_cache.resize(m_amount);
|
||||
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ void SceneRPCInterface::_send_rpc(Node *p_node, int p_to, uint16_t p_rpc_id, con
|
|||
// Create base packet, lots of hardcode because it must be tight.
|
||||
int ofs = 0;
|
||||
|
||||
#define MAKE_ROOM(m_amount) \
|
||||
#define MAKE_ROOM(m_amount) \
|
||||
if (packet_cache.size() < m_amount) \
|
||||
packet_cache.resize(m_amount);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,43 +38,43 @@
|
|||
#include "nav_mesh_generator_2d.h"
|
||||
#endif // CLIPPER2_ENABLED
|
||||
|
||||
#define COMMAND_1(F_NAME, T_0, D_0) \
|
||||
struct MERGE(F_NAME, _command_2d) : public SetCommand2D { \
|
||||
T_0 d_0; \
|
||||
MERGE(F_NAME, _command_2d) \
|
||||
(T_0 p_d_0) : \
|
||||
d_0(p_d_0) {} \
|
||||
#define COMMAND_1(F_NAME, T_0, D_0) \
|
||||
struct MERGE(F_NAME, _command_2d) : public SetCommand2D { \
|
||||
T_0 d_0; \
|
||||
MERGE(F_NAME, _command_2d) \
|
||||
(T_0 p_d_0) : \
|
||||
d_0(p_d_0) {} \
|
||||
virtual void exec(GodotNavigationServer2D *p_server) override { \
|
||||
p_server->MERGE(_cmd_, F_NAME)(d_0); \
|
||||
} \
|
||||
}; \
|
||||
void GodotNavigationServer2D::F_NAME(T_0 D_0) { \
|
||||
auto cmd = memnew(MERGE(F_NAME, _command_2d)( \
|
||||
D_0)); \
|
||||
add_command(cmd); \
|
||||
} \
|
||||
p_server->MERGE(_cmd_, F_NAME)(d_0); \
|
||||
} \
|
||||
}; \
|
||||
void GodotNavigationServer2D::F_NAME(T_0 D_0) { \
|
||||
auto cmd = memnew(MERGE(F_NAME, _command_2d)( \
|
||||
D_0)); \
|
||||
add_command(cmd); \
|
||||
} \
|
||||
void GodotNavigationServer2D::MERGE(_cmd_, F_NAME)(T_0 D_0)
|
||||
|
||||
#define COMMAND_2(F_NAME, T_0, D_0, T_1, D_1) \
|
||||
struct MERGE(F_NAME, _command_2d) : public SetCommand2D { \
|
||||
T_0 d_0; \
|
||||
T_1 d_1; \
|
||||
MERGE(F_NAME, _command_2d) \
|
||||
( \
|
||||
T_0 p_d_0, \
|
||||
T_1 p_d_1) : \
|
||||
d_0(p_d_0), \
|
||||
d_1(p_d_1) {} \
|
||||
#define COMMAND_2(F_NAME, T_0, D_0, T_1, D_1) \
|
||||
struct MERGE(F_NAME, _command_2d) : public SetCommand2D { \
|
||||
T_0 d_0; \
|
||||
T_1 d_1; \
|
||||
MERGE(F_NAME, _command_2d) \
|
||||
( \
|
||||
T_0 p_d_0, \
|
||||
T_1 p_d_1) : \
|
||||
d_0(p_d_0), \
|
||||
d_1(p_d_1) {} \
|
||||
virtual void exec(GodotNavigationServer2D *p_server) override { \
|
||||
p_server->MERGE(_cmd_, F_NAME)(d_0, d_1); \
|
||||
} \
|
||||
}; \
|
||||
void GodotNavigationServer2D::F_NAME(T_0 D_0, T_1 D_1) { \
|
||||
auto cmd = memnew(MERGE(F_NAME, _command_2d)( \
|
||||
D_0, \
|
||||
D_1)); \
|
||||
add_command(cmd); \
|
||||
} \
|
||||
p_server->MERGE(_cmd_, F_NAME)(d_0, d_1); \
|
||||
} \
|
||||
}; \
|
||||
void GodotNavigationServer2D::F_NAME(T_0 D_0, T_1 D_1) { \
|
||||
auto cmd = memnew(MERGE(F_NAME, _command_2d)( \
|
||||
D_0, \
|
||||
D_1)); \
|
||||
add_command(cmd); \
|
||||
} \
|
||||
void GodotNavigationServer2D::MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1)
|
||||
|
||||
void GodotNavigationServer2D::init() {
|
||||
|
|
|
|||
|
|
@ -48,11 +48,11 @@
|
|||
#define MERGE_INTERNAL(A, B) A##B
|
||||
#define MERGE(A, B) MERGE_INTERNAL(A, B)
|
||||
|
||||
#define COMMAND_1(F_NAME, T_0, D_0) \
|
||||
#define COMMAND_1(F_NAME, T_0, D_0) \
|
||||
virtual void F_NAME(T_0 D_0) override; \
|
||||
void MERGE(_cmd_, F_NAME)(T_0 D_0)
|
||||
|
||||
#define COMMAND_2(F_NAME, T_0, D_0, T_1, D_1) \
|
||||
#define COMMAND_2(F_NAME, T_0, D_0, T_1, D_1) \
|
||||
virtual void F_NAME(T_0 D_0, T_1 D_1) override; \
|
||||
void MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1)
|
||||
|
||||
|
|
|
|||
|
|
@ -55,16 +55,16 @@ using namespace Nav2D;
|
|||
#define NAVMAP_ITERATION_ZERO_ERROR_MSG()
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
#define GET_MAP_ITERATION() \
|
||||
iteration_slot_rwlock.read_lock(); \
|
||||
#define GET_MAP_ITERATION() \
|
||||
iteration_slot_rwlock.read_lock(); \
|
||||
NavMapIteration2D &map_iteration = iteration_slots[iteration_slot_index]; \
|
||||
NavMapIterationRead2D iteration_read_lock(map_iteration); \
|
||||
NavMapIterationRead2D iteration_read_lock(map_iteration); \
|
||||
iteration_slot_rwlock.read_unlock();
|
||||
|
||||
#define GET_MAP_ITERATION_CONST() \
|
||||
iteration_slot_rwlock.read_lock(); \
|
||||
#define GET_MAP_ITERATION_CONST() \
|
||||
iteration_slot_rwlock.read_lock(); \
|
||||
const NavMapIteration2D &map_iteration = iteration_slots[iteration_slot_index]; \
|
||||
NavMapIterationRead2D iteration_read_lock(map_iteration); \
|
||||
NavMapIterationRead2D iteration_read_lock(map_iteration); \
|
||||
iteration_slot_rwlock.read_unlock();
|
||||
|
||||
void NavMap2D::set_cell_size(real_t p_cell_size) {
|
||||
|
|
|
|||
|
|
@ -41,43 +41,43 @@ using namespace NavigationDefaults3D;
|
|||
/// an instance of that struct with the submitted parameters.
|
||||
/// Then, that struct is stored in an array; the `sync` function consume that array.
|
||||
|
||||
#define COMMAND_1(F_NAME, T_0, D_0) \
|
||||
struct MERGE(F_NAME, _command_3d) : public SetCommand3D { \
|
||||
T_0 d_0; \
|
||||
MERGE(F_NAME, _command_3d) \
|
||||
(T_0 p_d_0) : \
|
||||
d_0(p_d_0) {} \
|
||||
#define COMMAND_1(F_NAME, T_0, D_0) \
|
||||
struct MERGE(F_NAME, _command_3d) : public SetCommand3D { \
|
||||
T_0 d_0; \
|
||||
MERGE(F_NAME, _command_3d) \
|
||||
(T_0 p_d_0) : \
|
||||
d_0(p_d_0) {} \
|
||||
virtual void exec(GodotNavigationServer3D *server) override { \
|
||||
server->MERGE(_cmd_, F_NAME)(d_0); \
|
||||
} \
|
||||
}; \
|
||||
void GodotNavigationServer3D::F_NAME(T_0 D_0) { \
|
||||
auto cmd = memnew(MERGE(F_NAME, _command_3d)( \
|
||||
D_0)); \
|
||||
add_command(cmd); \
|
||||
} \
|
||||
server->MERGE(_cmd_, F_NAME)(d_0); \
|
||||
} \
|
||||
}; \
|
||||
void GodotNavigationServer3D::F_NAME(T_0 D_0) { \
|
||||
auto cmd = memnew(MERGE(F_NAME, _command_3d)( \
|
||||
D_0)); \
|
||||
add_command(cmd); \
|
||||
} \
|
||||
void GodotNavigationServer3D::MERGE(_cmd_, F_NAME)(T_0 D_0)
|
||||
|
||||
#define COMMAND_2(F_NAME, T_0, D_0, T_1, D_1) \
|
||||
struct MERGE(F_NAME, _command_3d) : public SetCommand3D { \
|
||||
T_0 d_0; \
|
||||
T_1 d_1; \
|
||||
MERGE(F_NAME, _command_3d) \
|
||||
( \
|
||||
T_0 p_d_0, \
|
||||
T_1 p_d_1) : \
|
||||
d_0(p_d_0), \
|
||||
d_1(p_d_1) {} \
|
||||
#define COMMAND_2(F_NAME, T_0, D_0, T_1, D_1) \
|
||||
struct MERGE(F_NAME, _command_3d) : public SetCommand3D { \
|
||||
T_0 d_0; \
|
||||
T_1 d_1; \
|
||||
MERGE(F_NAME, _command_3d) \
|
||||
( \
|
||||
T_0 p_d_0, \
|
||||
T_1 p_d_1) : \
|
||||
d_0(p_d_0), \
|
||||
d_1(p_d_1) {} \
|
||||
virtual void exec(GodotNavigationServer3D *server) override { \
|
||||
server->MERGE(_cmd_, F_NAME)(d_0, d_1); \
|
||||
} \
|
||||
}; \
|
||||
void GodotNavigationServer3D::F_NAME(T_0 D_0, T_1 D_1) { \
|
||||
auto cmd = memnew(MERGE(F_NAME, _command_3d)( \
|
||||
D_0, \
|
||||
D_1)); \
|
||||
add_command(cmd); \
|
||||
} \
|
||||
server->MERGE(_cmd_, F_NAME)(d_0, d_1); \
|
||||
} \
|
||||
}; \
|
||||
void GodotNavigationServer3D::F_NAME(T_0 D_0, T_1 D_1) { \
|
||||
auto cmd = memnew(MERGE(F_NAME, _command_3d)( \
|
||||
D_0, \
|
||||
D_1)); \
|
||||
add_command(cmd); \
|
||||
} \
|
||||
void GodotNavigationServer3D::MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1)
|
||||
|
||||
GodotNavigationServer3D::GodotNavigationServer3D() {}
|
||||
|
|
|
|||
|
|
@ -48,11 +48,11 @@
|
|||
#define MERGE_INTERNAL(A, B) A##B
|
||||
#define MERGE(A, B) MERGE_INTERNAL(A, B)
|
||||
|
||||
#define COMMAND_1(F_NAME, T_0, D_0) \
|
||||
#define COMMAND_1(F_NAME, T_0, D_0) \
|
||||
virtual void F_NAME(T_0 D_0) override; \
|
||||
void MERGE(_cmd_, F_NAME)(T_0 D_0)
|
||||
|
||||
#define COMMAND_2(F_NAME, T_0, D_0, T_1, D_1) \
|
||||
#define COMMAND_2(F_NAME, T_0, D_0, T_1, D_1) \
|
||||
virtual void F_NAME(T_0 D_0, T_1 D_1) override; \
|
||||
void MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1)
|
||||
|
||||
|
|
|
|||
|
|
@ -96,21 +96,21 @@ void NavigationLink3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
// Draw axis-aligned circle.
|
||||
switch (up_axis) {
|
||||
case Vector3::AXIS_X:
|
||||
#define PUSH_OCTANT(_position, a, b) \
|
||||
lines_ptrw[index++] = _position + Vector3(0, a.x, a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, x, y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, -a.x, a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, x, y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, a.x, -a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, x, -y); \
|
||||
#define PUSH_OCTANT(_position, a, b) \
|
||||
lines_ptrw[index++] = _position + Vector3(0, a.x, a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, x, y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, -a.x, a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, x, y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, a.x, -a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, x, -y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, -a.x, -a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, x, y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, a.y, a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, y, x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, -a.y, a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, -y, x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, a.y, -a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, y, -x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, x, y); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, a.y, a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, y, x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, -a.y, a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, -y, x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, a.y, -a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, y, -x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, -a.y, -a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(0, -y, -x);
|
||||
|
||||
|
|
@ -119,21 +119,21 @@ void NavigationLink3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
#undef PUSH_OCTANT
|
||||
break;
|
||||
case Vector3::AXIS_Y:
|
||||
#define PUSH_OCTANT(_position, a, b) \
|
||||
lines_ptrw[index++] = _position + Vector3(a.x, 0, a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(x, 0, y); \
|
||||
lines_ptrw[index++] = _position + Vector3(-a.x, 0, a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(-x, 0, y); \
|
||||
lines_ptrw[index++] = _position + Vector3(a.x, 0, -a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(x, 0, -y); \
|
||||
#define PUSH_OCTANT(_position, a, b) \
|
||||
lines_ptrw[index++] = _position + Vector3(a.x, 0, a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(x, 0, y); \
|
||||
lines_ptrw[index++] = _position + Vector3(-a.x, 0, a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(-x, 0, y); \
|
||||
lines_ptrw[index++] = _position + Vector3(a.x, 0, -a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(x, 0, -y); \
|
||||
lines_ptrw[index++] = _position + Vector3(-a.x, 0, -a.y); \
|
||||
lines_ptrw[index++] = _position + Vector3(-x, 0, -y); \
|
||||
lines_ptrw[index++] = _position + Vector3(a.y, 0, a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(y, 0, x); \
|
||||
lines_ptrw[index++] = _position + Vector3(-a.y, 0, a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(-y, 0, x); \
|
||||
lines_ptrw[index++] = _position + Vector3(a.y, 0, -a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(y, 0, -x); \
|
||||
lines_ptrw[index++] = _position + Vector3(-x, 0, -y); \
|
||||
lines_ptrw[index++] = _position + Vector3(a.y, 0, a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(y, 0, x); \
|
||||
lines_ptrw[index++] = _position + Vector3(-a.y, 0, a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(-y, 0, x); \
|
||||
lines_ptrw[index++] = _position + Vector3(a.y, 0, -a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(y, 0, -x); \
|
||||
lines_ptrw[index++] = _position + Vector3(-a.y, 0, -a.x); \
|
||||
lines_ptrw[index++] = _position + Vector3(-y, 0, -x);
|
||||
|
||||
|
|
@ -142,21 +142,21 @@ void NavigationLink3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
#undef PUSH_OCTANT
|
||||
break;
|
||||
case Vector3::AXIS_Z:
|
||||
#define PUSH_OCTANT(_position, a, b) \
|
||||
lines_ptrw[index++] = _position + Vector3(a.x, a.y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(x, y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-a.x, a.y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-x, y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(a.x, -a.y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(x, -y, 0); \
|
||||
#define PUSH_OCTANT(_position, a, b) \
|
||||
lines_ptrw[index++] = _position + Vector3(a.x, a.y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(x, y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-a.x, a.y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-x, y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(a.x, -a.y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(x, -y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-a.x, -a.y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-x, -y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(a.y, a.x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(y, x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-a.y, a.x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-y, x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(a.y, -a.x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(y, -x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-x, -y, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(a.y, a.x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(y, x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-a.y, a.x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-y, x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(a.y, -a.x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(y, -x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-a.y, -a.x, 0); \
|
||||
lines_ptrw[index++] = _position + Vector3(-y, -x, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -55,16 +55,16 @@ using namespace Nav3D;
|
|||
#define NAVMAP_ITERATION_ZERO_ERROR_MSG()
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
#define GET_MAP_ITERATION() \
|
||||
iteration_slot_rwlock.read_lock(); \
|
||||
#define GET_MAP_ITERATION() \
|
||||
iteration_slot_rwlock.read_lock(); \
|
||||
NavMapIteration3D &map_iteration = iteration_slots[iteration_slot_index]; \
|
||||
NavMapIterationRead3D iteration_read_lock(map_iteration); \
|
||||
NavMapIterationRead3D iteration_read_lock(map_iteration); \
|
||||
iteration_slot_rwlock.read_unlock();
|
||||
|
||||
#define GET_MAP_ITERATION_CONST() \
|
||||
iteration_slot_rwlock.read_lock(); \
|
||||
#define GET_MAP_ITERATION_CONST() \
|
||||
iteration_slot_rwlock.read_lock(); \
|
||||
const NavMapIteration3D &map_iteration = iteration_slots[iteration_slot_index]; \
|
||||
NavMapIterationRead3D iteration_read_lock(map_iteration); \
|
||||
NavMapIterationRead3D iteration_read_lock(map_iteration); \
|
||||
iteration_slot_rwlock.read_unlock();
|
||||
|
||||
void NavMap3D::set_up(Vector3 p_up) {
|
||||
|
|
|
|||
|
|
@ -63,13 +63,13 @@ Vector<Pair<size_t, size_t>> find_approx_equal_vec_pairs(std::initializer_list<V
|
|||
return result;
|
||||
}
|
||||
|
||||
#define CHECK_ARGS_APPROX_PAIRWISE_DISTINCT_VECS(...) \
|
||||
{ \
|
||||
Vector<Pair<size_t, size_t>> equal_pairs = find_approx_equal_vec_pairs({ __VA_ARGS__ }); \
|
||||
for (Pair<size_t, size_t> p : equal_pairs) { \
|
||||
#define CHECK_ARGS_APPROX_PAIRWISE_DISTINCT_VECS(...) \
|
||||
{ \
|
||||
Vector<Pair<size_t, size_t>> equal_pairs = find_approx_equal_vec_pairs({ __VA_ARGS__ }); \
|
||||
for (Pair<size_t, size_t> p : equal_pairs) { \
|
||||
MESSAGE("Argument with index ", p.first, " is approximately equal to argument with index ", p.second); \
|
||||
} \
|
||||
CHECK_MESSAGE(equal_pairs.size() == 0, "All arguments should be pairwise distinct."); \
|
||||
} \
|
||||
CHECK_MESSAGE(equal_pairs.size() == 0, "All arguments should be pairwise distinct."); \
|
||||
}
|
||||
|
||||
Vector<real_t> get_noise_samples_1d(const FastNoiseLite &p_noise, size_t p_count = 32) {
|
||||
|
|
|
|||
|
|
@ -46,23 +46,23 @@ class JavaObject;
|
|||
|
||||
// This extension provides access to composition layers for displaying 2D content through the XR compositor.
|
||||
|
||||
#define OPENXR_LAYER_FUNC1(m_name, m_arg1) \
|
||||
void _composition_layer_##m_name##_rt(RID p_layer, m_arg1 p1) { \
|
||||
CompositionLayer *layer = composition_layer_owner.get_or_null(p_layer); \
|
||||
ERR_FAIL_NULL(layer); \
|
||||
layer->m_name(p1); \
|
||||
} \
|
||||
void composition_layer_##m_name(RID p_layer, m_arg1 p1) { \
|
||||
#define OPENXR_LAYER_FUNC1(m_name, m_arg1) \
|
||||
void _composition_layer_##m_name##_rt(RID p_layer, m_arg1 p1) { \
|
||||
CompositionLayer *layer = composition_layer_owner.get_or_null(p_layer); \
|
||||
ERR_FAIL_NULL(layer); \
|
||||
layer->m_name(p1); \
|
||||
} \
|
||||
void composition_layer_##m_name(RID p_layer, m_arg1 p1) { \
|
||||
RenderingServer::get_singleton()->call_on_render_thread(callable_mp(this, &OpenXRCompositionLayerExtension::_composition_layer_##m_name##_rt).bind(p_layer, p1)); \
|
||||
}
|
||||
|
||||
#define OPENXR_LAYER_FUNC2(m_name, m_arg1, m_arg2) \
|
||||
void _composition_layer_##m_name##_rt(RID p_layer, m_arg1 p1, m_arg2 p2) { \
|
||||
CompositionLayer *layer = composition_layer_owner.get_or_null(p_layer); \
|
||||
ERR_FAIL_NULL(layer); \
|
||||
layer->m_name(p1, p2); \
|
||||
} \
|
||||
void composition_layer_##m_name(RID p_layer, m_arg1 p1, m_arg2 p2) { \
|
||||
#define OPENXR_LAYER_FUNC2(m_name, m_arg1, m_arg2) \
|
||||
void _composition_layer_##m_name##_rt(RID p_layer, m_arg1 p1, m_arg2 p2) { \
|
||||
CompositionLayer *layer = composition_layer_owner.get_or_null(p_layer); \
|
||||
ERR_FAIL_NULL(layer); \
|
||||
layer->m_name(p1, p2); \
|
||||
} \
|
||||
void composition_layer_##m_name(RID p_layer, m_arg1 p1, m_arg2 p2) { \
|
||||
RenderingServer::get_singleton()->call_on_render_thread(callable_mp(this, &OpenXRCompositionLayerExtension::_composition_layer_##m_name##_rt).bind(p_layer, p1, p2)); \
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -315,8 +315,8 @@ void OpenXRD3D12Extension::cleanup_swapchain_graphics_data(void **p_swapchain_gr
|
|||
}
|
||||
|
||||
#define ENUM_TO_STRING_CASE(e) \
|
||||
case e: { \
|
||||
return String(#e); \
|
||||
case e: { \
|
||||
return String(#e); \
|
||||
} break;
|
||||
|
||||
String OpenXRD3D12Extension::get_swapchain_format_name(int64_t p_swapchain_format) const {
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ void OpenXRMetalExtension::get_usable_depth_formats(Vector<int64_t> &p_usable_sw
|
|||
}
|
||||
|
||||
#define ENUM_TO_STRING_CASE(m_e) \
|
||||
case m_e: { \
|
||||
return String(#m_e); \
|
||||
case m_e: { \
|
||||
return String(#m_e); \
|
||||
} break;
|
||||
|
||||
String OpenXRMetalExtension::get_swapchain_format_name(int64_t p_swapchain_format) const {
|
||||
|
|
|
|||
|
|
@ -327,8 +327,8 @@ void OpenXROpenGLExtension::cleanup_swapchain_graphics_data(void **p_swapchain_g
|
|||
}
|
||||
|
||||
#define ENUM_TO_STRING_CASE(e) \
|
||||
case e: { \
|
||||
return String(#e); \
|
||||
case e: { \
|
||||
return String(#e); \
|
||||
} break;
|
||||
|
||||
String OpenXROpenGLExtension::get_swapchain_format_name(int64_t p_swapchain_format) const {
|
||||
|
|
|
|||
|
|
@ -501,8 +501,8 @@ void OpenXRVulkanExtension::cleanup_swapchain_graphics_data(void **p_swapchain_g
|
|||
}
|
||||
|
||||
#define ENUM_TO_STRING_CASE(e) \
|
||||
case e: { \
|
||||
return String(#e); \
|
||||
case e: { \
|
||||
return String(#e); \
|
||||
} break;
|
||||
|
||||
String OpenXRVulkanExtension::get_swapchain_format_name(int64_t p_swapchain_format) const {
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@
|
|||
#include <openxr/openxr_reflection.h>
|
||||
|
||||
#define XR_ENUM_CASE_STR(name, val) \
|
||||
case name: \
|
||||
case name: \
|
||||
return #name;
|
||||
#define XR_ENUM_SWITCH(enumType, var) \
|
||||
switch (var) { \
|
||||
#define XR_ENUM_SWITCH(enumType, var) \
|
||||
switch (var) { \
|
||||
XR_LIST_ENUM_##enumType(XR_ENUM_CASE_STR) default : return "Unknown " #enumType ": " + String::num_int64(int64_t(var)); \
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,23 +32,23 @@
|
|||
|
||||
#define UNPACK(...) __VA_ARGS__
|
||||
|
||||
#define INIT_XR_FUNC_V(openxr_api, name) \
|
||||
if constexpr (true) { \
|
||||
XrResult get_instance_proc_addr_result; \
|
||||
#define INIT_XR_FUNC_V(openxr_api, name) \
|
||||
if constexpr (true) { \
|
||||
XrResult get_instance_proc_addr_result; \
|
||||
get_instance_proc_addr_result = openxr_api->get_instance_proc_addr(#name, (PFN_xrVoidFunction *)&name##_ptr); \
|
||||
ERR_FAIL_COND_V(XR_FAILED(get_instance_proc_addr_result), false); \
|
||||
} else \
|
||||
ERR_FAIL_COND_V(XR_FAILED(get_instance_proc_addr_result), false); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
#define EXT_INIT_XR_FUNC_V(name) INIT_XR_FUNC_V(OpenXRAPI::get_singleton(), name)
|
||||
#define OPENXR_API_INIT_XR_FUNC_V(name) INIT_XR_FUNC_V(this, name)
|
||||
|
||||
#define INIT_XR_FUNC(openxr_api, name) \
|
||||
if constexpr (true) { \
|
||||
XrResult get_instance_proc_addr_result; \
|
||||
#define INIT_XR_FUNC(openxr_api, name) \
|
||||
if constexpr (true) { \
|
||||
XrResult get_instance_proc_addr_result; \
|
||||
get_instance_proc_addr_result = openxr_api->get_instance_proc_addr(#name, (PFN_xrVoidFunction *)&name##_ptr); \
|
||||
ERR_FAIL_COND(XR_FAILED(get_instance_proc_addr_result)); \
|
||||
} else \
|
||||
ERR_FAIL_COND(XR_FAILED(get_instance_proc_addr_result)); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
#define EXT_INIT_XR_FUNC(name) INIT_XR_FUNC(OpenXRAPI::get_singleton(), name)
|
||||
|
|
@ -59,70 +59,70 @@
|
|||
|
||||
#define EXT_TRY_INIT_XR_FUNC(name) TRY_INIT_XR_FUNC(OpenXRAPI::get_singleton(), name)
|
||||
#define OPENXR_TRY_API_INIT_XR_FUNC(name) TRY_INIT_XR_FUNC(this, name)
|
||||
#define GDEXTENSION_INIT_XR_FUNC(name) \
|
||||
if constexpr (true) { \
|
||||
#define GDEXTENSION_INIT_XR_FUNC(name) \
|
||||
if constexpr (true) { \
|
||||
name##_ptr = reinterpret_cast<PFN_##name>(get_openxr_api()->get_instance_proc_addr(#name)); \
|
||||
ERR_FAIL_NULL(name##_ptr); \
|
||||
} else \
|
||||
ERR_FAIL_NULL(name##_ptr); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
#define GDEXTENSION_INIT_XR_FUNC_V(name) \
|
||||
if constexpr (true) { \
|
||||
#define GDEXTENSION_INIT_XR_FUNC_V(name) \
|
||||
if constexpr (true) { \
|
||||
name##_ptr = reinterpret_cast<PFN_##name>(get_openxr_api()->get_instance_proc_addr(#name)); \
|
||||
ERR_FAIL_NULL_V(name##_ptr, false); \
|
||||
} else \
|
||||
ERR_FAIL_NULL_V(name##_ptr, false); \
|
||||
} else \
|
||||
((void)0)
|
||||
|
||||
#define EXT_PROTO_XRRESULT_FUNC1(func_name, arg1_type, arg1) \
|
||||
PFN_##func_name func_name##_ptr = nullptr; \
|
||||
#define EXT_PROTO_XRRESULT_FUNC1(func_name, arg1_type, arg1) \
|
||||
PFN_##func_name func_name##_ptr = nullptr; \
|
||||
XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type p_##arg1) const { \
|
||||
if (!func_name##_ptr) { \
|
||||
return XR_ERROR_HANDLE_INVALID; \
|
||||
} \
|
||||
return (*func_name##_ptr)(p_##arg1); \
|
||||
if (!func_name##_ptr) { \
|
||||
return XR_ERROR_HANDLE_INVALID; \
|
||||
} \
|
||||
return (*func_name##_ptr)(p_##arg1); \
|
||||
}
|
||||
|
||||
#define EXT_PROTO_XRRESULT_FUNC2(func_name, arg1_type, arg1, arg2_type, arg2) \
|
||||
PFN_##func_name func_name##_ptr = nullptr; \
|
||||
#define EXT_PROTO_XRRESULT_FUNC2(func_name, arg1_type, arg1, arg2_type, arg2) \
|
||||
PFN_##func_name func_name##_ptr = nullptr; \
|
||||
XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type p_##arg1, UNPACK arg2_type p_##arg2) const { \
|
||||
if (!func_name##_ptr) { \
|
||||
return XR_ERROR_HANDLE_INVALID; \
|
||||
} \
|
||||
return (*func_name##_ptr)(p_##arg1, p_##arg2); \
|
||||
if (!func_name##_ptr) { \
|
||||
return XR_ERROR_HANDLE_INVALID; \
|
||||
} \
|
||||
return (*func_name##_ptr)(p_##arg1, p_##arg2); \
|
||||
}
|
||||
|
||||
#define EXT_PROTO_XRRESULT_FUNC3(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3) \
|
||||
PFN_##func_name func_name##_ptr = nullptr; \
|
||||
#define EXT_PROTO_XRRESULT_FUNC3(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3) \
|
||||
PFN_##func_name func_name##_ptr = nullptr; \
|
||||
XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type p_##arg1, UNPACK arg2_type p_##arg2, UNPACK arg3_type p_##arg3) const { \
|
||||
if (!func_name##_ptr) { \
|
||||
return XR_ERROR_HANDLE_INVALID; \
|
||||
} \
|
||||
return (*func_name##_ptr)(p_##arg1, p_##arg2, p_##arg3); \
|
||||
if (!func_name##_ptr) { \
|
||||
return XR_ERROR_HANDLE_INVALID; \
|
||||
} \
|
||||
return (*func_name##_ptr)(p_##arg1, p_##arg2, p_##arg3); \
|
||||
}
|
||||
|
||||
#define EXT_PROTO_XRRESULT_FUNC4(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3, arg4_type, arg4) \
|
||||
PFN_##func_name func_name##_ptr = nullptr; \
|
||||
#define EXT_PROTO_XRRESULT_FUNC4(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3, arg4_type, arg4) \
|
||||
PFN_##func_name func_name##_ptr = nullptr; \
|
||||
XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type p_##arg1, UNPACK arg2_type p_##arg2, UNPACK arg3_type p_##arg3, UNPACK arg4_type p_##arg4) const { \
|
||||
if (!func_name##_ptr) { \
|
||||
return XR_ERROR_HANDLE_INVALID; \
|
||||
} \
|
||||
return (*func_name##_ptr)(p_##arg1, p_##arg2, p_##arg3, p_##arg4); \
|
||||
if (!func_name##_ptr) { \
|
||||
return XR_ERROR_HANDLE_INVALID; \
|
||||
} \
|
||||
return (*func_name##_ptr)(p_##arg1, p_##arg2, p_##arg3, p_##arg4); \
|
||||
}
|
||||
|
||||
#define EXT_PROTO_XRRESULT_FUNC5(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3, arg4_type, arg4, arg5_type, arg5) \
|
||||
PFN_##func_name func_name##_ptr = nullptr; \
|
||||
#define EXT_PROTO_XRRESULT_FUNC5(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3, arg4_type, arg4, arg5_type, arg5) \
|
||||
PFN_##func_name func_name##_ptr = nullptr; \
|
||||
XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type p_##arg1, UNPACK arg2_type p_##arg2, UNPACK arg3_type p_##arg3, UNPACK arg4_type p_##arg4, UNPACK arg5_type p_##arg5) const { \
|
||||
if (!func_name##_ptr) { \
|
||||
return XR_ERROR_HANDLE_INVALID; \
|
||||
} \
|
||||
return (*func_name##_ptr)(p_##arg1, p_##arg2, p_##arg3, p_##arg4, p_##arg5); \
|
||||
if (!func_name##_ptr) { \
|
||||
return XR_ERROR_HANDLE_INVALID; \
|
||||
} \
|
||||
return (*func_name##_ptr)(p_##arg1, p_##arg2, p_##arg3, p_##arg4, p_##arg5); \
|
||||
}
|
||||
|
||||
#define EXT_PROTO_XRRESULT_FUNC6(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3, arg4_type, arg4, arg5_type, arg5, arg6_type, arg6) \
|
||||
PFN_##func_name func_name##_ptr = nullptr; \
|
||||
#define EXT_PROTO_XRRESULT_FUNC6(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3, arg4_type, arg4, arg5_type, arg5, arg6_type, arg6) \
|
||||
PFN_##func_name func_name##_ptr = nullptr; \
|
||||
XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type p_##arg1, UNPACK arg2_type p_##arg2, UNPACK arg3_type p_##arg3, UNPACK arg4_type p_##arg4, UNPACK arg5_type p_##arg5, UNPACK arg6_type p_##arg6) const { \
|
||||
if (!func_name##_ptr) { \
|
||||
return XR_ERROR_HANDLE_INVALID; \
|
||||
} \
|
||||
return (*func_name##_ptr)(p_##arg1, p_##arg2, p_##arg3, p_##arg4, p_##arg5, p_##arg6); \
|
||||
if (!func_name##_ptr) { \
|
||||
return XR_ERROR_HANDLE_INVALID; \
|
||||
} \
|
||||
return (*func_name##_ptr)(p_##arg1, p_##arg2, p_##arg3, p_##arg4, p_##arg5, p_##arg6); \
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ Error ImageLoaderTGA::decode_tga_rle(const uint8_t *p_compressed_buffer, size_t
|
|||
}
|
||||
|
||||
Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buffer, const tga_header_s &p_header, const uint8_t *p_palette, const bool p_is_monochrome, size_t p_input_size) {
|
||||
#define TGA_PUT_PIXEL(r, g, b, a) \
|
||||
int image_data_ofs = ((y * width) + x); \
|
||||
#define TGA_PUT_PIXEL(r, g, b, a) \
|
||||
int image_data_ofs = ((y * width) + x); \
|
||||
image_data_w[image_data_ofs * 4 + 0] = r; \
|
||||
image_data_w[image_data_ofs * 4 + 1] = g; \
|
||||
image_data_w[image_data_ofs * 4 + 2] = b; \
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ bool WSLPeer::_parse_client_request() {
|
|||
}
|
||||
requested_host = headers.has("host") ? headers.get("host") : "";
|
||||
requested_url = (use_tls ? "wss://" : "ws://") + requested_host + req[1];
|
||||
#define WSL_CHECK(NAME, VALUE) \
|
||||
#define WSL_CHECK(NAME, VALUE) \
|
||||
ERR_FAIL_COND_V_MSG(!headers.has(NAME) || headers[NAME].to_lower() != VALUE, false, \
|
||||
"Missing or invalid header '" + String(NAME) + "'. Expected value '" + VALUE + "'.");
|
||||
#define WSL_CHECK_EX(NAME) \
|
||||
|
|
@ -440,10 +440,10 @@ bool WSLPeer::_verify_server_response() {
|
|||
}
|
||||
}
|
||||
|
||||
#define WSL_CHECK(NAME, VALUE) \
|
||||
#define WSL_CHECK(NAME, VALUE) \
|
||||
ERR_FAIL_COND_V_MSG(!headers.has(NAME) || headers[NAME].to_lower() != VALUE, false, \
|
||||
"Missing or invalid header '" + String(NAME) + "'. Expected value '" + VALUE + "'.");
|
||||
#define WSL_CHECK_NC(NAME, VALUE) \
|
||||
#define WSL_CHECK_NC(NAME, VALUE) \
|
||||
ERR_FAIL_COND_V_MSG(!headers.has(NAME) || headers[NAME] != VALUE, false, \
|
||||
"Missing or invalid header '" + String(NAME) + "'. Expected value '" + VALUE + "'.");
|
||||
WSL_CHECK("connection", "upgrade");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue