From 5e8c4dbe2bde2fb5ad3caa525765e66e993808c7 Mon Sep 17 00:00:00 2001 From: Gust Date: Tue, 11 Nov 2025 20:38:37 +0800 Subject: [PATCH 1/7] Update JsonParser.java --- .../src/main/java/org/mini/json/JsonParser.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/minijvm/java/src/main/java/org/mini/json/JsonParser.java b/minijvm/java/src/main/java/org/mini/json/JsonParser.java index f50b4cd6..426b1a72 100755 --- a/minijvm/java/src/main/java/org/mini/json/JsonParser.java +++ b/minijvm/java/src/main/java/org/mini/json/JsonParser.java @@ -124,13 +124,13 @@ public static interface JsonCell { public static class JsonMap extends HashMap implements JsonCell { public int getType() { - return 0; + return TYPE_MAP; } } public static class JsonList extends ArrayList implements JsonCell { public int getType() { - return 1; + return TYPE_LIST; } } @@ -142,7 +142,7 @@ public JsonString(String s) { } public int getType() { - return 2; + return TYPE_STRING; } public String toString() { @@ -158,7 +158,7 @@ public JsonNumber(String s) { } public int getType() { - return 3; + return TYPE_NUMBER; } public String toString() { @@ -519,7 +519,7 @@ public Object map2obj(JsonCell json, Class clazz, String types) { if (deser != null) return deser.deserialize(json, types); switch (json.getType()) { - case 0: + case JsonCell.TYPE_MAP: map = (JsonMap) json; ins = findInjectableValues(clazz); if (ins == null) @@ -551,7 +551,7 @@ public Object map2obj(JsonCell json, Class clazz, String types) { SysLog.warn("[JSON]" + clazz.getName() + " field '" + fieldName + "' setter not found.", new Object[0]); } return ins; - case 1: + case JsonCell.TYPE_LIST: if (types == null) SysLog.warn("[JSON] need type declare , class:" + clazz, new Object[0]); if (clazz == null) @@ -589,9 +589,9 @@ public Object map2obj(JsonCell json, Class clazz, String types) { collection.add(object); } return collection; - case 2: + case JsonCell.TYPE_STRING: return ((JsonString) json).str; - case 3: + case JsonCell.TYPE_NUMBER: return ((JsonNumber) json).getValue(clazz); } } catch (Exception e) { From 41eed84937da72cb756338a02c783eb7548014e2 Mon Sep 17 00:00:00 2001 From: Gust Date: Wed, 12 Nov 2025 00:07:51 +0800 Subject: [PATCH 2/7] save stack space --- minijvm/c/jvm/interpreter.c | 2143 +++++++++++++++++------------------ minijvm/c/jvm/jvm.h | 21 + 2 files changed, 1082 insertions(+), 1082 deletions(-) diff --git a/minijvm/c/jvm/interpreter.c b/minijvm/c/jvm/interpreter.c index 7fb673e1..da962a28 100755 --- a/minijvm/c/jvm/interpreter.c +++ b/minijvm/c/jvm/interpreter.c @@ -125,10 +125,10 @@ static s32 filterClassName(Utf8String *clsName) { } #define check_gc_pause(offset){\ - if (offset < 0 && thrd_info->suspend_count) {\ + if (offset < 0 && r->thrd_info->suspend_count) {\ \ - runtime->stack->sp = sp;\ - check_suspend_and_pause(runtime);\ + r->stack->sp = sp;\ + check_suspend_and_pause(r);\ }\ } @@ -518,50 +518,30 @@ static inline s32 _optimize_inline_setter(JClass *clazz, s32 cfrIdx, Runtime *ru s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { - //shared local var for opcode - Instance *ins; - s32 idx; - s32 offset; - s32 count; - FieldInfo *fi; - MethodInfo *m; - c8 *ptr; - s32 ival1, ival2; - f64 dval1, dval2; - f32 fval1, fval2; - s64 lval1, lval2; - __refer rval1, rval2; - ConstantMethodRef *cmr; - ConstantFieldRef *cfr; - JClass *other; - StackEntry entry; - Utf8String *ustr; - ConstantInvokeDynamic *cid; - BootstrapMethod *bootMethod; + //local var for control MiniJVM *jvm; s32 ret; c8 const *err_msg; - Runtime *runtime; - JavaThreadInfo *thrd_info; + Runtime *r; RuntimeStack *stack; LocalVarItem *localvar; JClass *clazz; - //register u8 *runtime->pc; + //register u8 *r->pc; register StackEntry *sp; //start ret = RUNTIME_STATUS_NORMAL; - runtime = runtime_create_inl(pruntime); + r = runtime_create_inl(pruntime); - jvm = runtime->jvm; + jvm = r->jvm; clazz = method->_this_class; - runtime->clazz = clazz; - runtime->method = method; + r->clazz = clazz; + r->method = method; while (clazz->status < CLASS_STATUS_CLINITING) { - class_clinit(clazz, runtime); + class_clinit(clazz, r); } #if _JVM_DEBUG_LOG_LEVEL > 3 invoke_deepth(pruntime); @@ -575,7 +555,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { // s32 debug = 1; // } - stack = runtime->stack; + stack = r->stack; if (!(method->is_native)) { CodeAttribute *ca = method->converted_code; @@ -584,40 +564,40 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { if (stack->max_size < (stack->sp - stack->store) + ca->max_stack) { jvm_printf("Stack overflow :\n"); - print_runtime_stack(runtime); + print_runtime_stack(r); exit(1); } - runtime->pc = ca->code; + r->pc = ca->code; - localvar_init(runtime, ca->max_locals, method->para_slots); + localvar_init(r, ca->max_locals, method->para_slots); //method sync begin - if (method->is_sync)_synchronized_lock_method(method, runtime); + if (method->is_sync)_synchronized_lock_method(method, r); - if (runtime->thrd_info->is_stop) {//if stop=1 then exit thread + if (r->thrd_info->is_stop) {//if stop=1 then exit thread ret = RUNTIME_STATUS_ERROR; goto label_exit_while; } if (JIT_ENABLE && ca->jit.state == JIT_GEN_SUCCESS) { //jvm_printf("jit call %s.%s()\n", method->_this_class->name->data, method->name->data); - ret = ca->jit.func(method, runtime); + ret = ca->jit.func(method, r); if (!ret) { switch (method->return_slots) { case 0: {// V - localvar_dispose(runtime); + localvar_dispose(r); break; } case 1: { // F I R - peek_entry(stack->sp - method->return_slots, &entry); - localvar_dispose(runtime); - push_entry(stack, &entry); + peek_entry(stack->sp - method->return_slots, &r->entry); + localvar_dispose(r); + push_entry(stack, &r->entry); break; } case 2: {//J D return type , 2slots - lval1 = pop_long(stack); - localvar_dispose(runtime); - push_long(stack, lval1); + r->lval1 = pop_long(stack); + localvar_dispose(r); + push_long(stack, r->lval1); break; } default: { @@ -631,29 +611,28 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { spin_lock(&ca->compile_lock); if (ca->jit.state == JIT_GEN_UNKNOW) {//re test //jvm_printf("enter jit %s.%s()\n", utf8_cstr(method->_this_class->name), utf8_cstr(method->name)); - construct_jit(method, runtime); + construct_jit(method, r); } spin_unlock(&ca->compile_lock); } } - thrd_info = runtime->thrd_info; - localvar = runtime->localvar; - sp = runtime->stack->sp; + localvar = r->localvar; + sp = r->stack->sp; do { if (jdwp_client_count(jvm->jdwpserver)) { stack->sp = sp; - if (!runtime->thrd_info->no_pause) { + if (!r->thrd_info->no_pause) { //breakpoint if (method->breakpoint) { - jdwp_check_breakpoint(runtime); + jdwp_check_breakpoint(r); } //debug step - if (thrd_info->jdwp_step->active) {//单步状态 - thrd_info->jdwp_step->bytecode_count++; - jdwp_check_debug_step(runtime); + if (r->thrd_info->jdwp_step->active) {//单步状态 + r->thrd_info->jdwp_step->bytecode_count++; + jdwp_check_debug_step(r); } } sp = stack->sp; @@ -661,29 +640,29 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { } #if _JVM_DEBUG_LOG_LEVEL > 1 if (jvm->collector->isworldstoped && thrd_info->top_runtime != jvm->collector->runtime) { - jvm_printf("[ERROR] world stopped, but thread is running: %llx\n", (s64) (intptr_t) runtime->thrd_info->jthread); + jvm_printf("[ERROR] world stopped, but thread is running: %llx\n", (s64) (intptr_t) r->thrd_info->jthread); } #endif //_JVM_DEBUG_LOG_LEVEL > 1 #if _JVM_DEBUG_PROFILE - u8 cur_inst = *runtime->pc; + u8 cur_inst = *r->pc; s64 spent = 0; s64 start_at = nanoTime(); #endif /* ======================================================opcode start=================================================*/ #ifdef __JVM_DEBUG__ - s64 inst_pc = runtime->pc - ca->code; + s64 inst_pc = r->pc - ca->code; #endif - switch (*runtime->pc) { + switch (*r->pc) { case op_nop: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("nop\n"); #endif - runtime->pc++; + r->pc++; break; } @@ -691,59 +670,59 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_aconst_null: { (sp++)->rvalue = NULL; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("aconst_null: push %d into stack\n", 0); #endif - runtime->pc++; + r->pc++; break; } case op_iconst_m1: { (sp++)->ivalue = -1; - runtime->pc++; + r->pc++; break; } case op_iconst_0: { (sp++)->ivalue = 0; - runtime->pc++; + r->pc++; break; } case op_iconst_1: { (sp++)->ivalue = 1; - runtime->pc++; + r->pc++; break; } case op_iconst_2: { (sp++)->ivalue = 2; - runtime->pc++; + r->pc++; break; } case op_iconst_3: { (sp++)->ivalue = 3; - runtime->pc++; + r->pc++; break; } case op_iconst_4: { (sp++)->ivalue = 4; - runtime->pc++; + r->pc++; break; } case op_iconst_5: { (sp++)->ivalue = 5; - runtime->pc++; + r->pc++; break; } @@ -751,7 +730,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lconst_0: { (sp++)->lvalue = 0; sp++; - runtime->pc++; + r->pc++; break; } @@ -759,28 +738,28 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lconst_1: { (sp++)->lvalue = 1; sp++; - runtime->pc++; + r->pc++; break; } case op_fconst_0: { (sp++)->fvalue = 0; - runtime->pc++; + r->pc++; break; } case op_fconst_1: { (sp++)->fvalue = 1; - runtime->pc++; + r->pc++; break; } case op_fconst_2: { (sp++)->fvalue = 2; - runtime->pc++; + r->pc++; break; } @@ -788,7 +767,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_dconst_0: { (sp++)->dvalue = 0; sp++; - runtime->pc++; + r->pc++; break; } @@ -796,19 +775,19 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_dconst_1: { (sp++)->dvalue = 1; sp++; - runtime->pc++; + r->pc++; break; } case op_bipush: { - (sp++)->ivalue = (s8) runtime->pc[1]; + (sp++)->ivalue = (s8) r->pc[1]; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("bipush a byte %d onto the stack \n", (sp - 1)->ivalue); #endif - runtime->pc += 2; + r->pc += 2; break; } @@ -816,54 +795,54 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_sipush: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("sipush value %d\n", *((s16 *) (runtime->pc + 1))); + invoke_deepth(r); + jvm_printf("sipush value %d\n", *((s16 *) (r->pc + 1))); #endif - (sp++)->ivalue = *((s16 *) (runtime->pc + 1)); - runtime->pc += 3; + (sp++)->ivalue = *((s16 *) (r->pc + 1)); + r->pc += 3; break; } case op_ldc: case op_ldc_w: { - if (*runtime->pc == op_ldc) { - idx = runtime->pc[1]; - runtime->pc += 2; + if (*r->pc == op_ldc) { + r->idx = r->pc[1]; + r->pc += 2; } else { - idx = *((u16 *) (runtime->pc + 1)); - runtime->pc += 3; + r->idx = *((u16 *) (r->pc + 1)); + r->pc += 3; } - ConstantItem *item = class_get_constant_item(clazz, idx); + ConstantItem *item = class_get_constant_item(clazz, r->idx); switch (item->tag) { case CONSTANT_INTEGER: case CONSTANT_FLOAT: { - ival1 = class_get_constant_integer(clazz, idx); - (sp++)->ivalue = ival1; + r->ival1 = class_get_constant_integer(clazz, r->idx); + (sp++)->ivalue = r->ival1; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("ldc: [%x] \n", ival1); + invoke_deepth(r); + jvm_printf("ldc: [%x] \n", r->ival1); #endif break; } case CONSTANT_STRING_REF: { - ConstantUTF8 *cutf = class_get_constant_utf8(clazz, class_get_constant_stringref(clazz, idx)->stringIndex); + ConstantUTF8 *cutf = class_get_constant_utf8(clazz, class_get_constant_stringref(clazz, r->idx)->stringIndex); (sp++)->rvalue = cutf->jstr; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("ldc: [%llx] =\"%s\"\n", (s64) (intptr_t) cutf->jstr, utf8_cstr(cutf->utfstr)); #endif break; } case CONSTANT_CLASS: { stack->sp = sp; - other = classes_load_get_with_clinit(clazz->jloader, class_get_constant_classref(clazz, idx)->name, runtime); - if (!other->ins_class) { - other->ins_class = insOfJavaLangClass_create_get(runtime, other); + r->other = classes_load_get_with_clinit(clazz->jloader, class_get_constant_classref(clazz, r->idx)->name, r); + if (!r->other->ins_class) { + r->other->ins_class = insOfJavaLangClass_create_get(r, r->other); } sp = stack->sp; - (sp++)->rvalue = other->ins_class; + (sp++)->rvalue = r->other->ins_class; break; } default: { @@ -876,14 +855,14 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ldc2_w: { - lval1 = class_get_constant_long(clazz, *((u16 *) (runtime->pc + 1)));//long or double - (sp++)->lvalue = lval1; + r->lval1 = class_get_constant_long(clazz, *((u16 *) (r->pc + 1)));//long or double + (sp++)->lvalue = r->lval1; sp++; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("ldc2_w: push a constant(%d) [%llx] onto the stack \n", *((u16 *) (runtime->pc + 1)), (sp - 2)->lvalue); + invoke_deepth(r); + jvm_printf("ldc2_w: push a constant(%d) [%llx] onto the stack \n", *((u16 *) (r->pc + 1)), (sp - 2)->lvalue); #endif - runtime->pc += 3; + r->pc += 3; break; } @@ -891,51 +870,51 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_iload: case op_fload: { - (sp++)->ivalue = localvar[(u8) runtime->pc[1]].ivalue; - runtime->pc += 2; + (sp++)->ivalue = localvar[(u8) r->pc[1]].ivalue; + r->pc += 2; break; } case op_aload: { - (sp++)->rvalue = localvar[(u8) runtime->pc[1]].rvalue; - runtime->pc += 2; + (sp++)->rvalue = localvar[(u8) r->pc[1]].rvalue; + r->pc += 2; break; } case op_lload: case op_dload: { - (sp++)->lvalue = localvar[(u8) runtime->pc[1]].lvalue; + (sp++)->lvalue = localvar[(u8) r->pc[1]].lvalue; sp++; - runtime->pc += 2; + r->pc += 2; break; } case op_fload_0: case op_iload_0: { (sp++)->ivalue = localvar[0].ivalue; - runtime->pc++; + r->pc++; break; } case op_fload_1: case op_iload_1: { (sp++)->ivalue = localvar[1].ivalue; - runtime->pc++; + r->pc++; break; } case op_fload_2: case op_iload_2: { (sp++)->ivalue = localvar[2].ivalue; - runtime->pc++; + r->pc++; break; } case op_fload_3: case op_iload_3: { (sp++)->ivalue = localvar[3].ivalue; - runtime->pc++; + r->pc++; break; } @@ -943,7 +922,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lload_0: { (sp++)->lvalue = localvar[0].lvalue; (sp++); - runtime->pc++; + r->pc++; break; } @@ -951,7 +930,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lload_1: { (sp++)->lvalue = localvar[1].lvalue; (sp++); - runtime->pc++; + r->pc++; break; } @@ -959,7 +938,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lload_2: { (sp++)->lvalue = localvar[2].lvalue; (sp++); - runtime->pc++; + r->pc++; break; } @@ -967,55 +946,55 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lload_3: { (sp++)->lvalue = localvar[3].lvalue; (sp++); - runtime->pc++; + r->pc++; break; } case op_aload_0: { (sp++)->rvalue = localvar[0].rvalue; - runtime->pc++; + r->pc++; break; } case op_aload_1: { (sp++)->rvalue = localvar[1].rvalue; - runtime->pc++; + r->pc++; break; } case op_aload_2: { (sp++)->rvalue = localvar[2].rvalue; - runtime->pc++; + r->pc++; break; } case op_aload_3: { (sp++)->rvalue = localvar[3].rvalue; - runtime->pc++; + r->pc++; break; } case op_iaload: case op_faload: { - idx = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->idx = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; - } else if (idx < 0 || idx >= ins->arr_length) { + } else if (r->idx < 0 || r->idx >= r->ins->arr_length) { goto label_outofbounds_throw; } else { - ival1 = *((s32 *) (ins->arr_body) + idx); - (sp++)->ivalue = ival1; + r->ival1 = *((s32 *) (r->ins->arr_body) + r->idx); + (sp++)->ivalue = r->ival1; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("if_aload push arr[%llx].(%d)=%x:%d:%lf into stack\n", (u64) (intptr_t) ins, idx, ival1, ival1, *(f32 *) &ival1); + invoke_deepth(r); + jvm_printf("if_aload push arr[%llx].(%d)=%x:%d:%lf into stack\n", (u64) (intptr_t) r->ins, r->idx, r->ival1, r->ival1, *(f32 *) &r->ival1); #endif - runtime->pc++; + r->pc++; } break; } @@ -1023,110 +1002,110 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_laload: case op_daload: { - idx = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->idx = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; - } else if (idx < 0 || idx >= ins->arr_length) { + } else if (r->idx < 0 || r->idx >= r->ins->arr_length) { goto label_outofbounds_throw; } else { - lval1 = *(((s64 *) ins->arr_body) + idx); - (sp++)->lvalue = lval1; + r->lval1 = *(((s64 *) r->ins->arr_body) + r->idx); + (sp++)->lvalue = r->lval1; (sp++); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("ld_aload push arr[%llx].(%d)=%llx:%lld:%lf into stack\n", (u64) (intptr_t) ins, idx, lval1, lval1, *(f64 *) &lval1); + invoke_deepth(r); + jvm_printf("ld_aload push arr[%llx].(%d)=%llx:%lld:%lf into stack\n", (u64) (intptr_t) r->ins, r->idx, r->lval1, r->lval1, *(f64 *) &r->lval1); #endif - runtime->pc++; + r->pc++; } break; } case op_aaload: { - idx = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->idx = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; - } else if (idx < 0 || idx >= ins->arr_length) { + } else if (r->idx < 0 || r->idx >= r->ins->arr_length) { goto label_outofbounds_throw; } else { - rval1 = *(((__refer *) ins->arr_body) + idx); - (sp++)->rvalue = rval1; + r->rval1 = *(((__refer *) r->ins->arr_body) + r->idx); + (sp++)->rvalue = r->rval1; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("aaload push arr[%llx].(%d)=%llx:%lld into stack\n", (u64) (intptr_t) ins, idx, (s64) (intptr_t) rval1, (s64) (intptr_t) rval1); + invoke_deepth(r); + jvm_printf("aaload push arr[%llx].(%d)=%llx:%lld into stack\n", (u64) (intptr_t) r->ins, r->idx, (s64) (intptr_t) r->rval1, (s64) (intptr_t) r->rval1); #endif - runtime->pc++; + r->pc++; } break; } case op_baload: { - idx = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->idx = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; - } else if (idx < 0 || idx >= ins->arr_length) { + } else if (r->idx < 0 || r->idx >= r->ins->arr_length) { goto label_outofbounds_throw; } else { - ival1 = *(((s8 *) ins->arr_body) + idx); - (sp++)->ivalue = ival1; + r->ival1 = *(((s8 *) r->ins->arr_body) + r->idx); + (sp++)->ivalue = r->ival1; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("iaload push arr[%llx].(%d)=%x:%d:%lf into stack\n", (u64) (intptr_t) ins, idx, ival1, ival1, *(f32 *) &ival1); + invoke_deepth(r); + jvm_printf("iaload push arr[%llx].(%d)=%x:%d:%lf into stack\n", (u64) (intptr_t) r->ins, r->idx, r->ival1, r->ival1, *(f32 *) &r->ival1); #endif - runtime->pc++; + r->pc++; } break; } case op_caload: { - idx = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->idx = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; - } else if (idx < 0 || idx >= ins->arr_length) { + } else if (r->idx < 0 || r->idx >= r->ins->arr_length) { goto label_outofbounds_throw; } else { - ival1 = *(((u16 *) ins->arr_body) + idx); - (sp++)->ivalue = ival1; + r->ival1 = *(((u16 *) r->ins->arr_body) + r->idx); + (sp++)->ivalue = r->ival1; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("iaload push arr[%llx].(%d)=%x:%d:%lf into stack\n", (u64) (intptr_t) ins, idx, ival1, ival1, *(f32 *) &ival1); + invoke_deepth(r); + jvm_printf("iaload push arr[%llx].(%d)=%x:%d:%lf into stack\n", (u64) (intptr_t) r->ins, r->idx, r->ival1, r->ival1, *(f32 *) &r->ival1); #endif - runtime->pc++; + r->pc++; } break; } case op_saload: { - idx = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->idx = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; - } else if (idx < 0 || idx >= ins->arr_length) { + } else if (r->idx < 0 || r->idx >= r->ins->arr_length) { goto label_outofbounds_throw; } else { - ival1 = *(((s16 *) ins->arr_body) + idx); - (sp++)->ivalue = ival1; + r->ival1 = *(((s16 *) r->ins->arr_body) + r->idx); + (sp++)->ivalue = r->ival1; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("iaload push arr[%llx].(%d)=%x:%d:%lf into stack\n", (u64) (intptr_t) ins, idx, ival1, ival1, *(f32 *) &ival1); + invoke_deepth(r); + jvm_printf("iaload push arr[%llx].(%d)=%x:%d:%lf into stack\n", (u64) (intptr_t) r->ins, r->idx, r->ival1, r->ival1, *(f32 *) &r->ival1); #endif - runtime->pc++; + r->pc++; } break; } @@ -1134,14 +1113,14 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_istore: case op_fstore: { - localvar[(u8) runtime->pc[1]].ivalue = (--sp)->ivalue; - runtime->pc += 2; + localvar[(u8) r->pc[1]].ivalue = (--sp)->ivalue; + r->pc += 2; break; } case op_astore: { - localvar[(u8) runtime->pc[1]].rvalue = (--sp)->rvalue; - runtime->pc += 2; + localvar[(u8) r->pc[1]].rvalue = (--sp)->rvalue; + r->pc += 2; break; } @@ -1150,8 +1129,8 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_dstore: { --sp; --sp; - localvar[(u8) runtime->pc[1]].lvalue = (sp)->lvalue; - runtime->pc += 2; + localvar[(u8) r->pc[1]].lvalue = (sp)->lvalue; + r->pc += 2; break; } @@ -1159,28 +1138,28 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_fstore_0: case op_istore_0: { localvar[0].ivalue = (--sp)->ivalue; - runtime->pc++; + r->pc++; break; } case op_fstore_1: case op_istore_1: { localvar[1].ivalue = (--sp)->ivalue; - runtime->pc++; + r->pc++; break; } case op_fstore_2: case op_istore_2: { localvar[2].ivalue = (--sp)->ivalue; - runtime->pc++; + r->pc++; break; } case op_fstore_3: case op_istore_3: { localvar[3].ivalue = (--sp)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -1188,7 +1167,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lstore_0: { --sp; localvar[0].lvalue = (--sp)->lvalue; - runtime->pc++; + r->pc++; break; } @@ -1196,7 +1175,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lstore_1: { --sp; localvar[1].lvalue = (--sp)->lvalue; - runtime->pc++; + r->pc++; break; } @@ -1204,7 +1183,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lstore_2: { --sp; localvar[2].lvalue = (--sp)->lvalue; - runtime->pc++; + r->pc++; break; } @@ -1212,56 +1191,56 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lstore_3: { --sp; localvar[3].lvalue = (--sp)->lvalue; - runtime->pc++; + r->pc++; break; } case op_astore_0: { localvar[0].rvalue = (--sp)->rvalue; - runtime->pc++; + r->pc++; break; } case op_astore_1: { localvar[1].rvalue = (--sp)->rvalue; - runtime->pc++; + r->pc++; break; } case op_astore_2: { localvar[2].rvalue = (--sp)->rvalue; - runtime->pc++; + r->pc++; break; } case op_astore_3: { localvar[3].rvalue = (--sp)->rvalue; - runtime->pc++; + r->pc++; break; } case op_fastore: case op_iastore: { - ival1 = (--sp)->ivalue; - idx = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->ival1 = (--sp)->ivalue; + r->idx = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; - } else if (idx < 0 || idx >= ins->arr_length) { + } else if (r->idx < 0 || r->idx >= r->ins->arr_length) { goto label_outofbounds_throw; } else { - *(((s32 *) ins->arr_body) + idx) = ival1; + *(((s32 *) r->ins->arr_body) + r->idx) = r->ival1; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("iastore: save array[%llx].(%d)=%d)\n", (s64) (intptr_t) ins, idx, ival1); + invoke_deepth(r); + jvm_printf("iastore: save array[%llx].(%d)=%d)\n", (s64) (intptr_t) r->ins, r->idx, r->ival1); #endif - runtime->pc++; + r->pc++; } break; } @@ -1270,110 +1249,110 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_dastore: case op_lastore: { --sp; - lval1 = (--sp)->lvalue; - idx = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->lval1 = (--sp)->lvalue; + r->idx = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; - } else if (idx < 0 || idx >= ins->arr_length) { + } else if (r->idx < 0 || r->idx >= r->ins->arr_length) { goto label_outofbounds_throw; } else { - *(((s64 *) ins->arr_body) + idx) = lval1; + *(((s64 *) r->ins->arr_body) + r->idx) = r->lval1; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("iastore: save array[%llx].(%d)=%lld)\n", (s64) (intptr_t) ins, idx, lval1); + invoke_deepth(r); + jvm_printf("iastore: save array[%llx].(%d)=%lld)\n", (s64) (intptr_t) r->ins, r->idx, r->lval1); #endif - runtime->pc++; + r->pc++; } break; } case op_aastore: { - rval1 = (--sp)->rvalue; - idx = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->rval1 = (--sp)->rvalue; + r->idx = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; - } else if (idx < 0 || idx >= ins->arr_length) { + } else if (r->idx < 0 || r->idx >= r->ins->arr_length) { goto label_outofbounds_throw; } else { - *(((__refer *) ins->arr_body) + idx) = rval1; + *(((__refer *) r->ins->arr_body) + r->idx) = r->rval1; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("iastore: save array[%llx].(%d)=%llx)\n", (s64) (intptr_t) ins, idx, (s64) (intptr_t) rval1); + invoke_deepth(r); + jvm_printf("iastore: save array[%llx].(%d)=%llx)\n", (s64) (intptr_t) r->ins, r->idx, (s64) (intptr_t) r->rval1); #endif - runtime->pc++; + r->pc++; } break; } case op_bastore: { - ival1 = (--sp)->ivalue; - idx = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->ival1 = (--sp)->ivalue; + r->idx = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; - } else if (idx < 0 || idx >= ins->arr_length) { + } else if (r->idx < 0 || r->idx >= r->ins->arr_length) { goto label_outofbounds_throw; } else { - *(((s8 *) ins->arr_body) + idx) = (s8) ival1; + *(((s8 *) r->ins->arr_body) + r->idx) = (s8) r->ival1; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("iastore: save array[%llx].(%d)=%d)\n", (s64) (intptr_t) ins, idx, ival1); + invoke_deepth(r); + jvm_printf("iastore: save array[%llx].(%d)=%d)\n", (s64) (intptr_t) r->ins, r->idx, r->ival1); #endif - runtime->pc++; + r->pc++; } break; } case op_castore: { - ival1 = (--sp)->ivalue; - idx = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->ival1 = (--sp)->ivalue; + r->idx = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; - } else if (idx < 0 || idx >= ins->arr_length) { + } else if (r->idx < 0 || r->idx >= r->ins->arr_length) { goto label_outofbounds_throw; } else { - *(((u16 *) ins->arr_body) + idx) = (u16) ival1; + *(((u16 *) r->ins->arr_body) + r->idx) = (u16) r->ival1; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("iastore: save array[%llx].(%d)=%d)\n", (s64) (intptr_t) ins, idx, ival1); + invoke_deepth(r); + jvm_printf("iastore: save array[%llx].(%d)=%d)\n", (s64) (intptr_t) r->ins, r->idx, r->ival1); #endif - runtime->pc++; + r->pc++; } break; } case op_sastore: { - ival1 = (--sp)->ivalue; - idx = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->ival1 = (--sp)->ivalue; + r->idx = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; - } else if (idx < 0 || idx >= ins->arr_length) { + } else if (r->idx < 0 || r->idx >= r->ins->arr_length) { goto label_outofbounds_throw; } else { - *(((s16 *) ins->arr_body) + idx) = (s16) ival1; + *(((s16 *) r->ins->arr_body) + r->idx) = (s16) r->ival1; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("iastore: save array[%llx].(%d)=%d)\n", (s64) (intptr_t) ins, idx, ival1); + invoke_deepth(r); + jvm_printf("iastore: save array[%llx].(%d)=%d)\n", (s64) (intptr_t) r->ins, r->idx, r->ival1); #endif - runtime->pc++; + r->pc++; } break; } @@ -1382,10 +1361,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_pop: { --sp; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("pop\n"); #endif - runtime->pc++; + r->pc++; break; } @@ -1396,10 +1375,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { --sp; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("pop2\n"); #endif - runtime->pc++; + r->pc++; break; } @@ -1410,10 +1389,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { sp++; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("dup\n"); #endif - runtime->pc++; + r->pc++; break; } @@ -1426,10 +1405,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { sp++; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("dup_x1\n"); #endif - runtime->pc++; + r->pc++; break; } @@ -1443,10 +1422,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { sp++; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("dup_x2 \n"); #endif - runtime->pc++; + r->pc++; break; } @@ -1459,10 +1438,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { sp++; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("dup2\n"); #endif - runtime->pc++; + r->pc++; break; } @@ -1479,10 +1458,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("dup2_x1\n"); #endif - runtime->pc++; + r->pc++; break; } @@ -1499,10 +1478,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { *(sp - 5) = *(sp - 1); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("dup2_x2\n"); #endif - runtime->pc++; + r->pc++; break; } @@ -1516,10 +1495,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("swap\n"); #endif - runtime->pc++; + r->pc++; break; } @@ -1530,10 +1509,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { --sp; (sp - 1)->ivalue += (sp - 0)->ivalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("iadd: %d\n", (sp - 1)->ivalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1545,10 +1524,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { (sp - 2)->lvalue += (sp - 0)->lvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("ladd: %lld\n", (sp - 2)->lvalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1559,10 +1538,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { (sp - 1)->fvalue += (sp - 0)->fvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("fadd: %f\n", (sp - 1)->fvalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1574,10 +1553,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { (sp - 2)->dvalue += (sp - 0)->dvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("dadd: %lf\n", (sp - 2)->dvalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1588,10 +1567,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { (sp - 1)->ivalue -= (sp - 0)->ivalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("isub : %d\n", (sp - 1)->ivalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1603,10 +1582,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { (sp - 2)->lvalue -= (sp - 0)->lvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("lsub: %lld\n", (sp - 2)->lvalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1617,10 +1596,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { (sp - 1)->fvalue -= (sp - 0)->fvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("fsub: %f\n", (sp - 1)->fvalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1632,11 +1611,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { (sp - 2)->dvalue -= (sp - 0)->dvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("dsub: %lf\n", (sp - 2)->dvalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1647,10 +1626,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { --sp; (sp - 1)->ivalue *= (sp - 0)->ivalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("imul: %d\n", (sp - 1)->ivalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1662,10 +1641,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { (sp - 2)->lvalue *= (sp - 0)->lvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("lmul: %lld\n", (sp - 2)->lvalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1675,10 +1654,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { --sp; (sp - 1)->fvalue *= (sp - 0)->fvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("fmul: %f\n", (sp - 1)->fvalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1689,10 +1668,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { --sp; (sp - 2)->dvalue *= (sp - 0)->dvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("dmul: %lf\n", (sp - 2)->dvalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1701,7 +1680,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_idiv: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("idiv: %d\n", (sp - 1)->ivalue); #endif if (!(sp - 1)->ivalue) { @@ -1709,7 +1688,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { } else { --sp; (sp - 1)->ivalue /= (sp - 0)->ivalue; - runtime->pc++; + r->pc++; } break; @@ -1718,7 +1697,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ldiv: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("ldiv: %lld\n", (sp - 2)->lvalue); #endif if (!(sp - 2)->lvalue) { @@ -1727,7 +1706,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { --sp; --sp; (sp - 2)->lvalue /= (sp - 0)->lvalue; - runtime->pc++; + r->pc++; } break; @@ -1735,31 +1714,31 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_fdiv: { - // there isn't runtime exception throw + // there isn't r exception throw // https://github.com/digitalgust/miniJVM/issues/30 --sp; (sp - 1)->fvalue /= (sp - 0)->fvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("fdiv: %f\n", (sp - 1)->fvalue); #endif - runtime->pc++; + r->pc++; break; } case op_ddiv: { - // there isn't runtime exception throw + // there isn't r exception throw // https://github.com/digitalgust/miniJVM/issues/30 --sp; --sp; (sp - 2)->dvalue /= (sp - 0)->dvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("ddiv: %lf\n", (sp - 2)->dvalue); #endif - runtime->pc++; + r->pc++; break; } @@ -1771,10 +1750,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { --sp; (sp - 1)->ivalue %= (sp - 0)->ivalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("irem: %d\n", (sp - 1)->ivalue); #endif - runtime->pc++; + r->pc++; } break; } @@ -1789,47 +1768,47 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { (sp - 2)->lvalue %= (sp - 0)->lvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("lrem: %lld\n", (sp - 2)->lvalue); #endif - runtime->pc++; + r->pc++; } break; } case op_frem: { - // there isn't runtime exception throw + // there isn't r exception throw // https://github.com/digitalgust/miniJVM/issues/30 --sp; - fval1 = (sp - 0)->fvalue; - fval2 = (sp - 1)->fvalue; - f32 v = fval2 - ((s32) (fval2 / fval1) * fval1); + r->fval1 = (sp - 0)->fvalue; + r->fval2 = (sp - 1)->fvalue; + f32 v = r->fval2 - ((s32) (r->fval2 / r->fval1) * r->fval1); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("frem: %f\n", (sp - 1)->fvalue); #endif (sp - 1)->fvalue = v; - runtime->pc++; + r->pc++; break; } case op_drem: { - // there isn't runtime exception throw + // there isn't r exception throw // https://github.com/digitalgust/miniJVM/issues/30 --sp; --sp; - dval1 = (sp - 0)->dvalue; - dval2 = (sp - 2)->dvalue; - f64 v = dval2 - ((s64) (dval2 / dval1) * dval1);; + r->dval1 = (sp - 0)->dvalue; + r->dval2 = (sp - 2)->dvalue; + f64 v = r->dval2 - ((s64) (r->dval2 / r->dval1) * r->dval1);; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("drem: %lf\n", (sp - 2)->dvalue); #endif (sp - 2)->dvalue = v; - runtime->pc++; + r->pc++; break; } @@ -1837,11 +1816,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ineg: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("ineg: %d\n", (sp - 1)->ivalue); #endif (sp - 1)->ivalue = -(sp - 1)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -1850,11 +1829,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lneg: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("lneg: %lld\n", (sp - 2)->lvalue); #endif (sp - 2)->lvalue = -(sp - 2)->lvalue; - runtime->pc++; + r->pc++; break; } @@ -1863,11 +1842,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_fneg: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("fneg: %f\n", (sp - 1)->fvalue); #endif (sp - 1)->fvalue = -(sp - 1)->fvalue; - runtime->pc++; + r->pc++; break; } @@ -1876,11 +1855,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_dneg: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("dneg: %lf\n", (sp - 2)->dvalue); #endif (sp - 2)->dvalue = -(sp - 2)->dvalue; - runtime->pc++; + r->pc++; break; } @@ -1889,12 +1868,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ishl: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("ishl: %x << %x \n", (sp - 2)->ivalue, (sp - 1)->ivalue); #endif --sp; (sp - 1)->ivalue <<= (sp - 0)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -1903,12 +1882,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lshl: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("lshl: %llx << %x \n", (sp - 3)->lvalue, (sp - 1)->ivalue); #endif --sp; (sp - 2)->lvalue <<= (sp - 0)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -1917,12 +1896,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ishr: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("ishr: %x >> %x \n", (sp - 2)->ivalue, (sp - 1)->ivalue); #endif --sp; (sp - 1)->ivalue >>= (sp - 0)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -1931,12 +1910,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lshr: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("lshr: %llx >> %x \n", (sp - 3)->lvalue, (sp - 1)->ivalue); #endif --sp; (sp - 2)->lvalue >>= (sp - 0)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -1945,12 +1924,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_iushr: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("iushr: %x >>> %x \n", (sp - 2)->uivalue, (sp - 1)->ivalue); #endif --sp; (sp - 1)->uivalue >>= (sp - 0)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -1959,12 +1938,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lushr: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("lushr: %llx >>> %x \n", (sp - 3)->ulvalue, (sp - 1)->ivalue); #endif --sp; (sp - 2)->ulvalue >>= (sp - 0)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -1973,12 +1952,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_iand: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("iand: %x & %x \n", (sp - 2)->ivalue, (sp - 1)->ivalue); #endif --sp; (sp - 1)->ivalue &= (sp - 0)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -1987,13 +1966,13 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_land: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("land: %llx & %llx \n", (sp - 4)->lvalue, (sp - 2)->lvalue); #endif --sp; --sp; (sp - 2)->lvalue &= (sp - 0)->lvalue; - runtime->pc++; + r->pc++; break; } @@ -2002,12 +1981,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ior: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("ior: %x & %x \n", (sp - 2)->ivalue, (sp - 1)->ivalue); #endif --sp; (sp - 1)->ivalue |= (sp - 0)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -2016,13 +1995,13 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lor: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("lor: %llx | %llx \n", (sp - 4)->lvalue, (sp - 2)->lvalue); #endif --sp; --sp; (sp - 2)->lvalue |= (sp - 0)->lvalue; - runtime->pc++; + r->pc++; break; } @@ -2031,12 +2010,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ixor: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("ixor: %x ^ %x \n", (sp - 2)->ivalue, (sp - 1)->ivalue); #endif --sp; (sp - 1)->ivalue ^= (sp - 0)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -2045,24 +2024,24 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lxor: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("lxor: %llx ^ %llx \n", (sp - 4)->lvalue, (sp - 2)->lvalue); #endif --sp; --sp; (sp - 2)->lvalue ^= (sp - 0)->lvalue; - runtime->pc++; + r->pc++; break; } case op_iinc: { - localvar[(u8) runtime->pc[1]].ivalue += (s8) runtime->pc[2]; - runtime->pc += 3; + localvar[(u8) r->pc[1]].ivalue += (s8) r->pc[2]; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("iinc: localvar(%d) = %d , inc %d\n", (u8) runtime->pc[1], runtime->localvar[(u8) runtime->pc[1]].ivalue, (s8) runtime->pc[2]); + invoke_deepth(r); + jvm_printf("iinc: localvar(%d) = %d , inc %d\n", (u8) r->pc[1], r->localvar[(u8) r->pc[1]].ivalue, (s8) r->pc[2]); #endif break; @@ -2072,12 +2051,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_i2l: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("i2l: %d\n", (sp - 1)->ivalue); #endif ++sp; (sp - 2)->lvalue = (s64) (sp - 2)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -2085,11 +2064,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_i2f: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("i2f: %d\n", (sp - 1)->ivalue); #endif (sp - 1)->fvalue = (f32) (sp - 1)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -2097,12 +2076,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_i2d: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("i2d: %d\n", (sp - 1)->ivalue); #endif ++sp; (sp - 2)->dvalue = (f64) (sp - 2)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -2111,12 +2090,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_l2i: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("l2i: %lld\n", (sp - 2)->lvalue); #endif --sp; (sp - 1)->ivalue = (s32) (sp - 1)->lvalue; - runtime->pc++; + r->pc++; break; } @@ -2125,12 +2104,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_l2f: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("l2f: %lld\n", (sp - 2)->lvalue); #endif --sp; (sp - 1)->fvalue = (f32) (sp - 1)->lvalue; - runtime->pc++; + r->pc++; break; } @@ -2139,11 +2118,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_l2d: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("l2d: %lld\n", (sp - 2)->lvalue); #endif (sp - 2)->dvalue = (f64) (sp - 2)->lvalue; - runtime->pc++; + r->pc++; break; } @@ -2151,11 +2130,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_f2i: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("f2i: %f\n", (sp - 1)->fvalue); #endif (sp - 1)->ivalue = (s32) (sp - 1)->fvalue; - runtime->pc++; + r->pc++; break; } @@ -2163,12 +2142,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_f2l: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("f2l: %f\n", (sp - 1)->fvalue); #endif ++sp; (sp - 2)->lvalue = (s64) (sp - 2)->fvalue; - runtime->pc++; + r->pc++; break; } @@ -2176,12 +2155,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_f2d: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("f2d: %f\n", (sp - 1)->fvalue); #endif ++sp; (sp - 2)->dvalue = (f64) (sp - 2)->fvalue; - runtime->pc++; + r->pc++; break; } @@ -2189,12 +2168,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_d2i: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("d2i: %lf\n", (sp - 2)->dvalue); #endif --sp; (sp - 1)->ivalue = (s32) (sp - 1)->dvalue; - runtime->pc++; + r->pc++; break; } @@ -2202,11 +2181,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_d2l: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("d2l: %lf\n", (sp - 2)->dvalue); #endif (sp - 2)->lvalue = (s64) (sp - 2)->dvalue; - runtime->pc++; + r->pc++; break; } @@ -2214,12 +2193,12 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_d2f: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("d2f: %lf\n", (sp - 2)->dvalue); #endif --sp; (sp - 1)->fvalue = (f32) (sp - 1)->dvalue; - runtime->pc++; + r->pc++; break; } @@ -2228,11 +2207,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_i2b: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("i2b: %d\n", (sp - 1)->ivalue); #endif (sp - 1)->ivalue = (s8) (sp - 1)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -2241,11 +2220,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_i2c: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("i2c: %d\n", (sp - 1)->ivalue); #endif (sp - 1)->ivalue = (u16) (sp - 1)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -2253,11 +2232,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_i2s: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("i2s: %d\n", (sp - 1)->ivalue); #endif (sp - 1)->ivalue = (s16) (sp - 1)->ivalue; - runtime->pc++; + r->pc++; break; } @@ -2265,58 +2244,58 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lcmp: { --sp; - lval1 = (--sp)->lvalue; + r->lval1 = (--sp)->lvalue; --sp; - lval2 = (--sp)->lvalue; - s32 result = lval2 == lval1 ? 0 : (lval2 > lval1 ? 1 : -1); + r->lval2 = (--sp)->lvalue; + s32 result = r->lval2 == r->lval1 ? 0 : (r->lval2 > r->lval1 ? 1 : -1); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("lcmp: %llx cmp %llx = %d\n", lval2, lval1, result); + invoke_deepth(r); + jvm_printf("lcmp: %llx cmp %llx = %d\n", r->lval2, r->lval1, result); #endif (sp++)->ivalue = result; - runtime->pc++; + r->pc++; break; } case op_fcmpl: { - fval1 = (--sp)->fvalue; - fval2 = (--sp)->fvalue; + r->fval1 = (--sp)->fvalue; + r->fval2 = (--sp)->fvalue; if ((sp + 0)->uivalue == 0x7fc00000 || (sp + 1)->uivalue == 0x7fc00000) { (sp++)->ivalue = -1; } else { - s32 result = fval2 == fval1 ? 0 : (fval2 > fval1 ? 1 : -1); + s32 result = r->fval2 == r->fval1 ? 0 : (r->fval2 > r->fval1 ? 1 : -1); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("fcmpl: %f < %f = %d\n", fval2, fval1, result); + invoke_deepth(r); + jvm_printf("fcmpl: %f < %f = %d\n", r->fval2, r->fval1, result); #endif (sp++)->ivalue = result; } - runtime->pc++; + r->pc++; break; } case op_fcmpg: { - fval1 = (--sp)->fvalue; - fval2 = (--sp)->fvalue; + r->fval1 = (--sp)->fvalue; + r->fval2 = (--sp)->fvalue; if ((sp + 0)->uivalue == 0x7fc00000 || (sp + 1)->uivalue == 0x7fc00000) { (sp++)->ivalue = 1; } else { - s32 result = fval2 == fval1 ? 0 : (fval2 > fval1 ? 1 : -1); + s32 result = r->fval2 == r->fval1 ? 0 : (r->fval2 > r->fval1 ? 1 : -1); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("fcmpg: %f > %f = %d\n", fval2, fval1, result); + invoke_deepth(r); + jvm_printf("fcmpg: %f > %f = %d\n", r->fval2, r->fval1, result); #endif (sp++)->ivalue = result; } - runtime->pc++; + r->pc++; break; } @@ -2324,21 +2303,21 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_dcmpl: { --sp; - dval1 = (--sp)->dvalue; + r->dval1 = (--sp)->dvalue; --sp; - dval2 = (--sp)->dvalue; + r->dval2 = (--sp)->dvalue; if ((sp + 0)->ulvalue == 0x7ff8000000000000L || (sp + 2)->ulvalue == 0x7ff8000000000000L) { (sp++)->ivalue = -1; } else { - s32 result = dval2 == dval1 ? 0 : (dval2 > dval1 ? 1 : -1); + s32 result = r->dval2 == r->dval1 ? 0 : (r->dval2 > r->dval1 ? 1 : -1); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("dcmpl: %lf < %lf = %d\n", lval2, dval1, result); + invoke_deepth(r); + jvm_printf("dcmpl: %lf < %lf = %d\n", r->lval2, r->dval1, result); #endif (sp++)->ivalue = result; } - runtime->pc++; + r->pc++; break; } @@ -2346,38 +2325,38 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_dcmpg: { --sp; - dval1 = (--sp)->dvalue; + r->dval1 = (--sp)->dvalue; --sp; - dval2 = (--sp)->dvalue; + r->dval2 = (--sp)->dvalue; if ((sp + 0)->ulvalue == 0x7ff8000000000000L || (sp + 2)->ulvalue == 0x7ff8000000000000L) { (sp++)->ivalue = 1; } else { - s32 result = dval2 == dval1 ? 0 : (dval2 > dval1 ? 1 : -1); + s32 result = r->dval2 == r->dval1 ? 0 : (r->dval2 > r->dval1 ? 1 : -1); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("dcmpg: %lf > %lf = %d\n", lval2, dval1, result); + invoke_deepth(r); + jvm_printf("dcmpg: %lf > %lf = %d\n", r->lval2, r->dval1, result); #endif (sp++)->ivalue = result; } - runtime->pc++; + r->pc++; break; } case op_ifeq: { - ival1 = (--sp)->ivalue; - if (ival1 == 0) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->ival1 = (--sp)->ivalue; + if (r->ival1 == 0) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("ifeq: %d != 0 then jump \n", ival1); + invoke_deepth(r); + jvm_printf("ifeq: %d != 0 then jump \n", r->ival1); #endif @@ -2386,17 +2365,17 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ifne: { - ival1 = (--sp)->ivalue; - if (ival1 != 0) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->ival1 = (--sp)->ivalue; + if (r->ival1 != 0) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("ifne: %d != 0 then jump\n", ival1); + invoke_deepth(r); + jvm_printf("ifne: %d != 0 then jump\n", r->ival1); #endif @@ -2405,17 +2384,17 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_iflt: { - ival1 = (--sp)->ivalue; - if (ival1 < 0) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->ival1 = (--sp)->ivalue; + if (r->ival1 < 0) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("iflt: %d < 0 then jump \n", ival1); + invoke_deepth(r); + jvm_printf("iflt: %d < 0 then jump \n", r->ival1); #endif @@ -2424,17 +2403,17 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ifge: { - ival1 = (--sp)->ivalue; - if (ival1 >= 0) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->ival1 = (--sp)->ivalue; + if (r->ival1 >= 0) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("ifge: %d >= 0 then jump \n", ival1); + invoke_deepth(r); + jvm_printf("ifge: %d >= 0 then jump \n", r->ival1); #endif @@ -2443,17 +2422,17 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ifgt: { - ival1 = (--sp)->ivalue; - if (ival1 > 0) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->ival1 = (--sp)->ivalue; + if (r->ival1 > 0) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("ifgt: %d > 0 then jump \n", ival1); + invoke_deepth(r); + jvm_printf("ifgt: %d > 0 then jump \n", r->ival1); #endif @@ -2462,17 +2441,17 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ifle: { - ival1 = (--sp)->ivalue; - if (ival1 <= 0) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->ival1 = (--sp)->ivalue; + if (r->ival1 <= 0) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("ifle: %d <= 0 then jump \n", ival1); + invoke_deepth(r); + jvm_printf("ifle: %d <= 0 then jump \n", r->ival1); #endif @@ -2481,18 +2460,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_if_icmpeq: { - ival2 = (--sp)->ivalue; - ival1 = (--sp)->ivalue; - if (ival1 == ival2) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->ival2 = (--sp)->ivalue; + r->ival1 = (--sp)->ivalue; + if (r->ival1 == r->ival2) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("if_icmpeq: %lld == %lld \n", (s64) (intptr_t) ival1, (s64) (intptr_t) ival2); + invoke_deepth(r); + jvm_printf("if_icmpeq: %lld == %lld \n", (s64) (intptr_t) r->ival1, (s64) (intptr_t) r->ival2); #endif break; @@ -2500,18 +2479,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_if_icmpne: { - ival2 = (--sp)->ivalue; - ival1 = (--sp)->ivalue; - if (ival1 != ival2) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->ival2 = (--sp)->ivalue; + r->ival1 = (--sp)->ivalue; + if (r->ival1 != r->ival2) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("if_icmpne: %lld != %lld \n", (s64) (intptr_t) ival1, (s64) (intptr_t) ival2); + invoke_deepth(r); + jvm_printf("if_icmpne: %lld != %lld \n", (s64) (intptr_t) r->ival1, (s64) (intptr_t) r->ival2); #endif break; @@ -2519,18 +2498,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_if_icmplt: { - ival2 = (--sp)->ivalue; - ival1 = (--sp)->ivalue; - if (ival1 < ival2) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->ival2 = (--sp)->ivalue; + r->ival1 = (--sp)->ivalue; + if (r->ival1 < r->ival2) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("if_icmplt: %lld < %lld \n", (s64) (intptr_t) ival1, (s64) (intptr_t) ival2); + invoke_deepth(r); + jvm_printf("if_icmplt: %lld < %lld \n", (s64) (intptr_t) r->ival1, (s64) (intptr_t) r->ival2); #endif break; @@ -2538,18 +2517,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_if_icmpge: { - ival2 = (--sp)->ivalue; - ival1 = (--sp)->ivalue; - if (ival1 >= ival2) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->ival2 = (--sp)->ivalue; + r->ival1 = (--sp)->ivalue; + if (r->ival1 >= r->ival2) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("if_icmpge: %lld >= %lld \n", (s64) (intptr_t) ival1, (s64) (intptr_t) ival2); + invoke_deepth(r); + jvm_printf("if_icmpge: %lld >= %lld \n", (s64) (intptr_t) r->ival1, (s64) (intptr_t) r->ival2); #endif break; @@ -2557,18 +2536,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_if_icmpgt: { - ival2 = (--sp)->ivalue; - ival1 = (--sp)->ivalue; - if (ival1 > ival2) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->ival2 = (--sp)->ivalue; + r->ival1 = (--sp)->ivalue; + if (r->ival1 > r->ival2) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("if_icmpgt: %lld > %lld \n", (s64) (intptr_t) ival1, (s64) (intptr_t) ival2); + invoke_deepth(r); + jvm_printf("if_icmpgt: %lld > %lld \n", (s64) (intptr_t) r->ival1, (s64) (intptr_t) r->ival2); #endif break; @@ -2576,18 +2555,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_if_icmple: { - ival2 = (--sp)->ivalue; - ival1 = (--sp)->ivalue; - if (ival1 <= ival2) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->ival2 = (--sp)->ivalue; + r->ival1 = (--sp)->ivalue; + if (r->ival1 <= r->ival2) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("if_icmple: %lld <= %lld \n", (s64) (intptr_t) ival1, (s64) (intptr_t) ival2); + invoke_deepth(r); + jvm_printf("if_icmple: %lld <= %lld \n", (s64) (intptr_t) r->ival1, (s64) (intptr_t) r->ival2); #endif break; @@ -2595,18 +2574,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_if_acmpeq: { - rval2 = (--sp)->rvalue; - rval1 = (--sp)->rvalue; - if (rval1 == rval2) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->rval2 = (--sp)->rvalue; + r->rval1 = (--sp)->rvalue; + if (r->rval1 == r->rval2) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("if_acmpeq: %lld == %lld \n", (s64) (intptr_t) rval1, (s64) (intptr_t) rval2); + invoke_deepth(r); + jvm_printf("if_acmpeq: %lld == %lld \n", (s64) (intptr_t) r->rval1, (s64) (intptr_t) r->rval2); #endif break; @@ -2614,18 +2593,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_if_acmpne: { - rval2 = (--sp)->rvalue; - rval1 = (--sp)->rvalue; - if (rval1 != rval2) { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->rval2 = (--sp)->rvalue; + r->rval1 = (--sp)->rvalue; + if (r->rval1 != r->rval2) { + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("if_acmpne: %lld != %lld \n", (s64) (intptr_t) rval1, (s64) (intptr_t) rval2); + invoke_deepth(r); + jvm_printf("if_acmpne: %lld != %lld \n", (s64) (intptr_t) r->rval1, (s64) (intptr_t) r->rval2); #endif break; @@ -2634,67 +2613,67 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_goto: { - offset = *((s16 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->offset = *((s16 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("goto: %d\n", offset); + invoke_deepth(r); + jvm_printf("goto: %d\n", r->offset); #endif break; } case op_jsr: { - offset = *((s16 *) (runtime->pc + 1)); - (sp++)->rvalue = (runtime->pc + 3); + r->offset = *((s16 *) (r->pc + 1)); + (sp++)->rvalue = (r->pc + 3); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("jsr: %d\n", offset); + invoke_deepth(r); + jvm_printf("jsr: %d\n", r->offset); #endif - runtime->pc += offset; + r->pc += r->offset; break; } case op_ret: { - __returnaddress addr = (__refer) (intptr_t) localvar[(u8) runtime->pc[1]].rvalue; + __returnaddress addr = (__refer) (intptr_t) localvar[(u8) r->pc[1]].rvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("ret: %x\n", (s64) (intptr_t) addr); #endif - runtime->pc = (u8 *) addr; + r->pc = (u8 *) addr; break; } case op_tableswitch: { - idx = (s32) (4 - ((((u64) (intptr_t) runtime->pc) - (u64) (intptr_t) (ca->code)) % 4));//4 byte对齐 - - s32 default_offset = *((s32 *) (runtime->pc + idx)); - idx += 4; - s32 low = *((s32 *) (runtime->pc + idx)); - idx += 4; - s32 high = *((s32 *) (runtime->pc + idx)); - idx += 4; - - ival1 = (--sp)->ivalue;// pop an int from the stack - offset = 0; - if (ival1 < low || ival1 > high) { // if its less than or greater than , - offset = default_offset; // branch to default + r->idx = (s32) (4 - ((((u64) (intptr_t) r->pc) - (u64) (intptr_t) (ca->code)) % 4));//4 byte对齐 + + s32 default_offset = *((s32 *) (r->pc + r->idx)); + r->idx += 4; + s32 low = *((s32 *) (r->pc + r->idx)); + r->idx += 4; + s32 high = *((s32 *) (r->pc + r->idx)); + r->idx += 4; + + r->ival1 = (--sp)->ivalue;// pop an int from the stack + r->offset = 0; + if (r->ival1 < low || r->ival1 > high) { // if its less than or greater than , + r->offset = default_offset; // branch to default } else { // otherwise - idx += (ival1 - low) * 4; + r->idx += (r->ival1 - low) * 4; - offset = *((s32 *) (runtime->pc + idx)); // branch to entry in table + r->offset = *((s32 *) (r->pc + r->idx)); // branch to r->entry in table } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("tableswitch: val=%d, offset=%d\n", ival1, offset); + invoke_deepth(r); + jvm_printf("tableswitch: val=%d, r->offset=%d\n", r->ival1, r->offset); #endif - runtime->pc += offset; + r->pc += r->offset; break; @@ -2702,33 +2681,33 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_lookupswitch: { - idx = (s32) (4 - ((((u64) (intptr_t) runtime->pc) - (u64) (intptr_t) (ca->code)) % 4));//4 byte对齐 + r->idx = (s32) (4 - ((((u64) (intptr_t) r->pc) - (u64) (intptr_t) (ca->code)) % 4));//4 byte对齐 - s32 default_offset = *((s32 *) (runtime->pc + idx)); - idx += 4; - s32 n = *((s32 *) (runtime->pc + idx)); - idx += 4; + s32 default_offset = *((s32 *) (r->pc + r->idx)); + r->idx += 4; + s32 n = *((s32 *) (r->pc + r->idx)); + r->idx += 4; s32 i, key; - ival1 = (--sp)->ivalue;// pop an int from the stack - offset = default_offset; + r->ival1 = (--sp)->ivalue;// pop an int from the stack + r->offset = default_offset; for (i = 0; i < n; i++) { - key = *((s32 *) (runtime->pc + idx)); - idx += 4; - if (key == ival1) { - offset = *((s32 *) (runtime->pc + idx)); + key = *((s32 *) (r->pc + r->idx)); + r->idx += 4; + if (key == r->ival1) { + r->offset = *((s32 *) (r->pc + r->idx)); break; } else { - idx += 4; + r->idx += 4; } } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("tableswitch: val=%d, offset=%d\n", ival1, offset); + invoke_deepth(r); + jvm_printf("tableswitch: val=%d, r->offset=%d\n", r->ival1, r->offset); #endif - runtime->pc += offset; + r->pc += r->offset; break; } @@ -2738,15 +2717,15 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_dreturn: { #if _JVM_DEBUG_LOG_LEVEL > 5 - peek_entry(stack->sp - 1, &entry); - invoke_deepth(runtime); - jvm_printf("ld_return=%lld/[%llx]\n", entry_2_long(&entry), entry_2_long(&entry)); + peek_entry(stack->sp - 1, &r->entry); + invoke_deepth(r); + jvm_printf("ld_return=%lld/[%llx]\n", entry_2_long(&r->entry), entry_2_long(&r->entry)); #endif --sp; - lval1 = (--sp)->lvalue; + r->lval1 = (--sp)->lvalue; stack->sp = sp; - localvar_dispose(runtime); - push_long(stack, lval1); + localvar_dispose(r); + push_long(stack, r->lval1); goto label_exit_while; break; } @@ -2754,26 +2733,26 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ireturn: case op_freturn: { - ival1 = (--sp)->ivalue; + r->ival1 = (--sp)->ivalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("if_return=%d/%f\n", ival1, *(f32 *) &ival1); + invoke_deepth(r); + jvm_printf("if_return=%d/%f\n", r->ival1, *(f32 *) &r->ival1); #endif stack->sp = sp; - localvar_dispose(runtime); - push_int(stack, ival1); + localvar_dispose(r); + push_int(stack, r->ival1); goto label_exit_while; break; } case op_areturn: { - rval1 = (--sp)->rvalue; + r->rval1 = (--sp)->rvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("a_return=[%llx]\n", (s64) (intptr_t) rval1); + invoke_deepth(r); + jvm_printf("a_return=[%llx]\n", (s64) (intptr_t) r->rval1); #endif stack->sp = sp; - localvar_dispose(runtime); - push_ref(stack, rval1); + localvar_dispose(r); + push_ref(stack, r->rval1); goto label_exit_while; break; } @@ -2781,11 +2760,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_return: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("return: \n"); #endif stack->sp = sp; - localvar_dispose(runtime); + localvar_dispose(r); goto label_exit_while; break; } @@ -2793,46 +2772,46 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_getstatic: { stack->sp = sp; - idx = *((u16 *) (runtime->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - if (!fi) { - cfr = class_get_constant_fieldref(clazz, idx); + r->idx = *((u16 *) (r->pc + 1)); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + if (!r->fi) { + r->cfr = class_get_constant_fieldref(clazz, r->idx); stack->sp = sp; - fi = find_fieldInfo_by_fieldref(clazz, cfr->item.index, runtime); + r->fi = find_fieldInfo_by_fieldref(clazz, r->cfr->item.index, r); sp = stack->sp; - cfr->fieldInfo = fi; - if (!fi) { - err_msg = utf8_cstr(cfr->name); + r->cfr->fieldInfo = r->fi; + if (!r->fi) { + err_msg = utf8_cstr(r->cfr->name); goto label_nosuchfield_throw; } } - if (fi->_this_class->status < CLASS_STATUS_CLINITED) { + if (r->fi->_this_class->status < CLASS_STATUS_CLINITED) { stack->sp = sp; - class_clinit(fi->_this_class, runtime); + class_clinit(r->fi->_this_class, r); sp = stack->sp; } - if (fi->isrefer) { - *runtime->pc = op_getstatic_ref; + if (r->fi->isrefer) { + *r->pc = op_getstatic_ref; } else { // check variable type to determine s64/s32/f64/f32 - switch (fi->datatype_bytes) { + switch (r->fi->datatype_bytes) { case 4: { - *runtime->pc = op_getstatic_int; + *r->pc = op_getstatic_int; break; } case 1: { - *runtime->pc = op_getstatic_byte; + *r->pc = op_getstatic_byte; break; } case 8: { - *runtime->pc = op_getstatic_long; + *r->pc = op_getstatic_long; break; } case 2: { - if (fi->datatype_idx == DATATYPE_JCHAR) { - *runtime->pc = op_getstatic_jchar; + if (r->fi->datatype_idx == DATATYPE_JCHAR) { + *r->pc = op_getstatic_jchar; } else { - *runtime->pc = op_getstatic_short; + *r->pc = op_getstatic_short; } break; } @@ -2847,46 +2826,46 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_putstatic: { - idx = *((u16 *) (runtime->pc + 1)); + r->idx = *((u16 *) (r->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - if (!fi) { - cfr = class_get_constant_fieldref(clazz, idx); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + if (!r->fi) { + r->cfr = class_get_constant_fieldref(clazz, r->idx); stack->sp = sp; - fi = find_fieldInfo_by_fieldref(clazz, cfr->item.index, runtime); + r->fi = find_fieldInfo_by_fieldref(clazz, r->cfr->item.index, r); sp = stack->sp; - cfr->fieldInfo = fi; - if (!fi) { - err_msg = utf8_cstr(cfr->name); + r->cfr->fieldInfo = r->fi; + if (!r->fi) { + err_msg = utf8_cstr(r->cfr->name); goto label_nosuchfield_throw; } } - if (fi->_this_class->status < CLASS_STATUS_CLINITED) { + if (r->fi->_this_class->status < CLASS_STATUS_CLINITED) { stack->sp = sp; - class_clinit(fi->_this_class, runtime); + class_clinit(r->fi->_this_class, r); sp = stack->sp; } - if (fi->isrefer) {// garbage collection mark - *runtime->pc = op_putstatic_ref; + if (r->fi->isrefer) {// garbage collection mark + *r->pc = op_putstatic_ref; } else { // check variable type to determain long/s32/f64/f32 // non-reference type - switch (fi->datatype_bytes) { + switch (r->fi->datatype_bytes) { case 4: { - *runtime->pc = op_putstatic_int; + *r->pc = op_putstatic_int; break; } case 1: { - *runtime->pc = op_putstatic_byte; + *r->pc = op_putstatic_byte; break; } case 8: { - *runtime->pc = op_putstatic_long; + *r->pc = op_putstatic_long; break; } case 2: { - *runtime->pc = op_putstatic_short; + *r->pc = op_putstatic_short; break; } default: { @@ -2902,8 +2881,8 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { s8 byte_changed = 0; spin_lock(&jvm->lock_cloader); { - if (*(runtime->pc) == op_getfield) { - idx = *((u16 *) (runtime->pc + 1)); + if (*(r->pc) == op_getfield) { + r->idx = *((u16 *) (r->pc + 1)); } else { byte_changed = 1; } @@ -2911,47 +2890,47 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { spin_unlock(&jvm->lock_cloader); if (!byte_changed) { - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - if (!fi) { - cfr = class_get_constant_fieldref(clazz, idx); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + if (!r->fi) { + r->cfr = class_get_constant_fieldref(clazz, r->idx); stack->sp = sp; - fi = find_fieldInfo_by_fieldref(clazz, cfr->item.index, runtime); + r->fi = find_fieldInfo_by_fieldref(clazz, r->cfr->item.index, r); sp = stack->sp; - cfr->fieldInfo = fi; - if (!fi) { - err_msg = utf8_cstr(cfr->name); + r->cfr->fieldInfo = r->fi; + if (!r->fi) { + err_msg = utf8_cstr(r->cfr->name); goto label_nosuchfield_throw; } } - if (fi->_this_class->status < CLASS_STATUS_CLINITED) { + if (r->fi->_this_class->status < CLASS_STATUS_CLINITED) { stack->sp = sp; - class_clinit(fi->_this_class, runtime); + class_clinit(r->fi->_this_class, r); sp = stack->sp; } spin_lock(&jvm->lock_cloader); { - if (fi->isrefer) { - *runtime->pc = op_getfield_ref; + if (r->fi->isrefer) { + *r->pc = op_getfield_ref; } else { // check variable type to determine s64/s32/f64/f32 - switch (fi->datatype_bytes) { + switch (r->fi->datatype_bytes) { case 4: { - *runtime->pc = op_getfield_int; + *r->pc = op_getfield_int; break; } case 1: { - *runtime->pc = op_getfield_byte; + *r->pc = op_getfield_byte; break; } case 8: { - *runtime->pc = op_getfield_long; + *r->pc = op_getfield_long; break; } case 2: { - if (fi->datatype_idx == DATATYPE_JCHAR) { - *runtime->pc = op_getfield_jchar; + if (r->fi->datatype_idx == DATATYPE_JCHAR) { + *r->pc = op_getfield_jchar; } else { - *runtime->pc = op_getfield_short; + *r->pc = op_getfield_short; } break; } @@ -2960,24 +2939,24 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { } } } - *((u16 *) (runtime->pc + 1)) = fi->offset_instance; + *((u16 *) (r->pc + 1)) = r->fi->offset_instance; } spin_unlock(&jvm->lock_cloader); } else { - //jvm_printf("getfield byte code changed by other thread.\n"); + //jvm_printf("getfield byte code changed by r->other thread.\n"); } break; } case op_putfield: { - //there were a multithread error , one enter the ins but changed by another + //there were a multithread error , one enter the r->ins but changed by another s8 byte_changed = 0; spin_lock(&jvm->lock_cloader); { - if (*(runtime->pc) == op_putfield) { - idx = *((u16 *) (runtime->pc + 1)); + if (*(r->pc) == op_putfield) { + r->idx = *((u16 *) (r->pc + 1)); } else { byte_changed = 1; } @@ -2985,45 +2964,45 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { spin_unlock(&jvm->lock_cloader); if (!byte_changed) { - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - if (!fi) { - cfr = class_get_constant_fieldref(clazz, idx); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + if (!r->fi) { + r->cfr = class_get_constant_fieldref(clazz, r->idx); stack->sp = sp; - fi = find_fieldInfo_by_fieldref(clazz, cfr->item.index, runtime); + r->fi = find_fieldInfo_by_fieldref(clazz, r->cfr->item.index, r); sp = stack->sp; - cfr->fieldInfo = fi; - if (!fi) { - err_msg = utf8_cstr(cfr->name); + r->cfr->fieldInfo = r->fi; + if (!r->fi) { + err_msg = utf8_cstr(r->cfr->name); goto label_nosuchfield_throw; } } - if (fi->_this_class->status < CLASS_STATUS_CLINITED) { + if (r->fi->_this_class->status < CLASS_STATUS_CLINITED) { stack->sp = sp; - class_clinit(fi->_this_class, runtime); + class_clinit(r->fi->_this_class, r); sp = stack->sp; } spin_lock(&jvm->lock_cloader); { - if (fi->isrefer) {// garbage collection flag - *runtime->pc = op_putfield_ref; + if (r->fi->isrefer) {// garbage collection flag + *r->pc = op_putfield_ref; } else { // non-reference type - switch (fi->datatype_bytes) { + switch (r->fi->datatype_bytes) { case 4: { - *runtime->pc = op_putfield_int; + *r->pc = op_putfield_int; break; } case 1: { - *runtime->pc = op_putfield_byte; + *r->pc = op_putfield_byte; break; } case 8: { - *runtime->pc = op_putfield_long; + *r->pc = op_putfield_long; break; } case 2: { - *runtime->pc = op_putfield_short; + *r->pc = op_putfield_short; break; } default: { @@ -3031,11 +3010,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { } } } - *((u16 *) (runtime->pc + 1)) = fi->offset_instance; + *((u16 *) (r->pc + 1)) = r->fi->offset_instance; } spin_unlock(&jvm->lock_cloader); } else { - //jvm_printf("putfield byte code changed by other thread.\n"); + //jvm_printf("putfield byte code changed by r->other thread.\n"); } break; } @@ -3043,60 +3022,60 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_invokevirtual: { - cmr = class_get_constant_method_ref(clazz, *((u16 *) (runtime->pc + 1))); + r->cmr = class_get_constant_method_ref(clazz, *((u16 *) (r->pc + 1))); - ins = (sp - 1 - cmr->para_slots)->rvalue; - if (!ins) { + r->ins = (sp - 1 - r->cmr->para_slots)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - m = (MethodInfo *) pairlist_get(cmr->virtual_methods, ins->mb.clazz); - if (!m) { + r->m = (MethodInfo *) pairlist_get(r->cmr->virtual_methods, r->ins->mb.clazz); + if (!r->m) { stack->sp = sp; - m = find_instance_methodInfo_by_name(ins, cmr->name, cmr->descriptor, runtime); + r->m = find_instance_methodInfo_by_name(r->ins, r->cmr->name, r->cmr->descriptor, r); sp = stack->sp; spin_lock(&jvm->lock_cloader); { - pairlist_put(cmr->virtual_methods, ins->mb.clazz, m);//放入缓存,以便下次直接调用 + pairlist_put(r->cmr->virtual_methods, r->ins->mb.clazz, r->m);//放入缓存,以便下次直接调用 } spin_unlock(&jvm->lock_cloader); } - if (!m) { - err_msg = utf8_cstr(cmr->name); + if (!r->m) { + err_msg = utf8_cstr(r->cmr->name); goto label_nosuchmethod_throw; } else { s8 match = 0; - if (m->is_getter) {//optimize getter eg: int getSize(){return size;} - ptr = (c8 *) m->converted_code->bytecode_for_jit;//must use original bytecode + if (r->m->is_getter) {//optimize getter eg: int getSize(){return size;} + r->ptr = (c8 *) r->m->converted_code->bytecode_for_jit;//must use original bytecode match = 1; //do getter here - idx = *((u16 *) (ptr + 2));//field desc index - other = m->_this_class; + r->idx = *((u16 *) (r->ptr + 2));//field desc index + r->other = r->m->_this_class; stack->sp = sp; - ret = _optimize_inline_getter(other, idx, runtime); + ret = _optimize_inline_getter(r->other, r->idx, r); sp = stack->sp; if (ret) { goto label_exception_handle; } - //jvm_printf("methodcall getter %s.%s %d in %s.%s\n", utf8_cstr(m->_this_class->name), utf8_cstr(m->name), m->_this_class->status, utf8_cstr(clazz->name), utf8_cstr(method->name)); - runtime->pc += 3; - } else if (m->is_setter) {//optimize setter eg: void setSize(int size){this.size=size;} - ptr = (c8 *) m->converted_code->bytecode_for_jit;//must use original bytecode + //jvm_printf("methodcall getter %s.%s %d in %s.%s\n", utf8_cstr(r->m->_this_class->name), utf8_cstr(r->m->name), r->m->_this_class->status, utf8_cstr(clazz->name), utf8_cstr(method->name)); + r->pc += 3; + } else if (r->m->is_setter) {//optimize setter eg: void setSize(int size){this.size=size;} + r->ptr = (c8 *) r->m->converted_code->bytecode_for_jit;//must use original bytecode match = 1; //do setter here - idx = *((u16 *) (ptr + 3));//field desc index - other = m->_this_class; + r->idx = *((u16 *) (r->ptr + 3));//field desc index + r->other = r->m->_this_class; stack->sp = sp; - ret = _optimize_inline_setter(other, idx, runtime); + ret = _optimize_inline_setter(r->other, r->idx, r); sp = stack->sp; if (ret) { goto label_exception_handle; } - //jvm_printf("methodcall setter %s.%s %d in %s.%s\n", utf8_cstr(m->_this_class->name), utf8_cstr(m->name), m->_this_class->status, utf8_cstr(clazz->name), utf8_cstr(method->name)); - runtime->pc += 3; + //jvm_printf("methodcall setter %s.%s %d in %s.%s\n", utf8_cstr(r->m->_this_class->name), utf8_cstr(r->m->name), r->m->_this_class->status, utf8_cstr(clazz->name), utf8_cstr(method->name)); + r->pc += 3; } if (!match) { - *runtime->pc = op_invokevirtual_fast; + *r->pc = op_invokevirtual_fast; } } } @@ -3106,30 +3085,30 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_invokespecial: { - cmr = class_get_constant_method_ref(clazz, *((u16 *) (runtime->pc + 1))); - m = cmr->methodInfo; + r->cmr = class_get_constant_method_ref(clazz, *((u16 *) (r->pc + 1))); + r->m = r->cmr->methodInfo; - if (!m) { - err_msg = utf8_cstr(cmr->name); + if (!r->m) { + err_msg = utf8_cstr(r->cmr->name); goto label_nosuchmethod_throw; } else { - *runtime->pc = op_invokespecial_fast; - _optimize_empty_method_call(m, ca, runtime->pc);//if method is empty ,bytecode would replaced 'nop' and 'pop' para + *r->pc = op_invokespecial_fast; + _optimize_empty_method_call(r->m, ca, r->pc);//if method is empty ,bytecode would replaced 'nop' and 'pop' para } break; } case op_invokestatic: { - cmr = class_get_constant_method_ref(clazz, *((u16 *) (runtime->pc + 1))); - m = cmr->methodInfo; + r->cmr = class_get_constant_method_ref(clazz, *((u16 *) (r->pc + 1))); + r->m = r->cmr->methodInfo; - if (!m) { - err_msg = utf8_cstr(cmr->name); + if (!r->m) { + err_msg = utf8_cstr(r->cmr->name); goto label_nosuchmethod_throw; } else { - *runtime->pc = op_invokestatic_fast; - _optimize_empty_method_call(m, ca, runtime->pc); + *r->pc = op_invokestatic_fast; + _optimize_empty_method_call(r->m, ca, r->pc); } break; } @@ -3137,28 +3116,28 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_invokeinterface: { - //s32 paraCount = (u8) runtime->pc[3]; - cmr = class_get_constant_method_ref(clazz, *((u16 *) (runtime->pc + 1))); - ins = (sp - 1 - cmr->para_slots)->rvalue; - if (!ins) { + //s32 paraCount = (u8) r->pc[3]; + r->cmr = class_get_constant_method_ref(clazz, *((u16 *) (r->pc + 1))); + r->ins = (sp - 1 - r->cmr->para_slots)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - m = (MethodInfo *) pairlist_get(cmr->virtual_methods, ins->mb.clazz); - if (!m) { + r->m = (MethodInfo *) pairlist_get(r->cmr->virtual_methods, r->ins->mb.clazz); + if (!r->m) { stack->sp = sp; - m = find_instance_methodInfo_by_name(ins, cmr->name, cmr->descriptor, runtime); + r->m = find_instance_methodInfo_by_name(r->ins, r->cmr->name, r->cmr->descriptor, r); sp = stack->sp; spin_lock(&jvm->lock_cloader); { - pairlist_put(cmr->virtual_methods, ins->mb.clazz, m);// store in cache for direct use in the next call + pairlist_put(r->cmr->virtual_methods, r->ins->mb.clazz, r->m);// store in cache for direct use in the next call } spin_unlock(&jvm->lock_cloader); } - if (!m) { - err_msg = utf8_cstr(cmr->name); + if (!r->m) { + err_msg = utf8_cstr(r->cmr->name); goto label_nosuchmethod_throw; } else { - *runtime->pc = op_invokeinterface_fast; + *r->pc = op_invokeinterface_fast; } } break; @@ -3166,110 +3145,110 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_invokedynamic: { - //get bootMethod struct - cid = class_get_invoke_dynamic(clazz, *((u16 *) (runtime->pc + 1))); - bootMethod = &clazz->bootstrapMethodAttr->bootstrap_methods[cid->bootstrap_method_attr_index];//Boot + //get r->bootMethod struct + r->cid = class_get_invoke_dynamic(clazz, *((u16 *) (r->pc + 1))); + r->bootMethod = &clazz->bootstrapMethodAttr->bootstrap_methods[r->cid->bootstrap_method_attr_index];//Boot - if (bootMethod->make == NULL) { + if (r->bootMethod->make == NULL) { stack->sp = sp; - ret = invokedynamic_prepare(runtime, bootMethod, cid); + ret = invokedynamic_prepare(r, r->bootMethod, r->cid); sp = stack->sp; if (ret) { goto label_exception_handle; } } - m = bootMethod->make; + r->m = r->bootMethod->make; - if (!m) { + if (!r->m) { err_msg = "Lambda generated method"; goto label_nosuchmethod_throw; } else { - *runtime->pc = op_invokedynamic_fast; + *r->pc = op_invokedynamic_fast; } break; } case op_new: { - idx = *((u16 *) (runtime->pc + 1)); + r->idx = *((u16 *) (r->pc + 1)); stack->sp = sp; - other = getClassByConstantClassRef(clazz, idx, runtime); - ins = NULL; - if (other) { - ins = instance_create(runtime, other); + r->other = getClassByConstantClassRef(clazz, r->idx, r); + r->ins = NULL; + if (r->other) { + r->ins = instance_create(r, r->other); } sp = stack->sp; - (sp++)->rvalue = ins; + (sp++)->rvalue = r->ins; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("new %s [%llx]\n", utf8_cstr(other->name), (s64) (intptr_t) ins); + invoke_deepth(r); + jvm_printf("new %s [%llx]\n", utf8_cstr(r->other->name), (s64) (intptr_t) r->ins); #endif - runtime->pc += 3; + r->pc += 3; break; } case op_newarray: { - idx = runtime->pc[1]; + r->idx = r->pc[1]; - count = (--sp)->ivalue; + r->count = (--sp)->ivalue; stack->sp = sp; - ins = jarray_create_by_type_index(runtime, count, idx); + r->ins = jarray_create_by_type_index(r, r->count, r->idx); sp = stack->sp; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("(a)newarray [%llx] type:%c , count:%d \n", (s64) (intptr_t) ins, getDataTypeTag(idx), count); + invoke_deepth(r); + jvm_printf("(a)newarray [%llx] type:%c , r->count:%d \n", (s64) (intptr_t) r->ins, getDataTypeTag(r->idx), r->count); #endif - (sp++)->rvalue = ins; - runtime->pc += 2; + (sp++)->rvalue = r->ins; + r->pc += 2; break; } case op_anewarray: { - idx = *((u16 *) (runtime->pc + 1)); + r->idx = *((u16 *) (r->pc + 1)); - count = (--sp)->ivalue; - other = pairlist_get(clazz->arr_class_type, (__refer) (intptr_t) idx); + r->count = (--sp)->ivalue; + r->other = pairlist_get(clazz->arr_class_type, (__refer) (intptr_t) r->idx); stack->sp = sp; - if (!other) {//cache to speed - other = array_class_get_by_name(runtime, runtime->clazz->jloader, class_get_utf8_string(clazz, idx)); + if (!r->other) {//cache to speed + r->other = array_class_get_by_name(r, r->clazz->jloader, class_get_utf8_string(clazz, r->idx)); spin_lock(&jvm->lock_cloader); { - pairlist_put(clazz->arr_class_type, (__refer) (intptr_t) idx, other); + pairlist_put(clazz->arr_class_type, (__refer) (intptr_t) r->idx, r->other); } spin_unlock(&jvm->lock_cloader); } - ins = jarray_create_by_class(runtime, count, other); + r->ins = jarray_create_by_class(r, r->count, r->other); sp = stack->sp; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("(a)newarray [%llx] type:%d , count:%d \n", (s64) (intptr_t) ins, other->arr_class_type, count); + invoke_deepth(r); + jvm_printf("(a)newarray [%llx] type:%d , r->count:%d \n", (s64) (intptr_t) r->ins, r->other->arr_class_type, r->count); #endif - (sp++)->rvalue = ins; - runtime->pc += 3; + (sp++)->rvalue = r->ins; + r->pc += 3; break; } case op_arraylength: { - ins = (--sp)->rvalue; + r->ins = (--sp)->rvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("arraylength [%llx].arr_body[%llx] len:%d \n", (s64) (intptr_t) ins, (s64) (intptr_t) ins->arr_body, ins->arr_length); + invoke_deepth(r); + jvm_printf("arraylength [%llx].arr_body[%llx] len:%d \n", (s64) (intptr_t) r->ins, (s64) (intptr_t) r->ins->arr_body, r->ins->arr_length); #endif - if (!ins) { + if (!r->ins) { goto label_null_throw; } else { - (sp++)->ivalue = ins->arr_length; - runtime->pc++; + (sp++)->ivalue = r->ins->arr_length; + r->pc++; } break; } @@ -3278,10 +3257,10 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_athrow: { #if _JVM_DEBUG_LOG_LEVEL > 5 - ins = (Instance *) pop_ref(stack); - push_ref(stack, (__refer) ins); - invoke_deepth(runtime); - jvm_printf("athrow [%llx].exception throws \n", (s64) (intptr_t) ins); + r->ins = (Instance *) pop_ref(stack); + push_ref(stack, (__refer) r->ins); + invoke_deepth(r); + jvm_printf("athrow [%llx].exception throws \n", (s64) (intptr_t) r->ins); #endif stack->sp = sp; goto label_exception_handle; @@ -3290,21 +3269,21 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_checkcast: { - idx = *((u16 *) (runtime->pc + 1)); + r->idx = *((u16 *) (r->pc + 1)); - ins = (--sp)->rvalue; + r->ins = (--sp)->rvalue; stack->sp = sp; - if (!checkcast(runtime, ins, idx)) { + if (!checkcast(r, r->ins, r->idx)) { goto label_checkcast_throw; } else { sp = stack->sp; - (sp++)->rvalue = ins; - runtime->pc += 3; + (sp++)->rvalue = r->ins; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("checkcast %s instancof %s \n", utf8_cstr(ins->mb.clazz->name), utf8_cstr(class_get_constant_classref(clazz, idx)->name)); + invoke_deepth(r); + jvm_printf("checkcast %s instancof %s \n", utf8_cstr(r->ins->mb.clazz->name), utf8_cstr(class_get_constant_classref(clazz, r->idx)->name)); #endif break; @@ -3312,14 +3291,14 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_instanceof: { - ins = (--sp)->rvalue; - idx = *((u16 *) (runtime->pc + 1)); + r->ins = (--sp)->rvalue; + r->idx = *((u16 *) (r->pc + 1)); s8 checkok = 0; - if (!ins) { - } else if (ins->mb.type & (MEM_TYPE_INS | MEM_TYPE_ARR)) { + if (!r->ins) { + } else if (r->ins->mb.type & (MEM_TYPE_INS | MEM_TYPE_ARR)) { stack->sp = sp; - if (instance_of(ins, getClassByConstantClassRef(clazz, idx, runtime))) { + if (instance_of(r->ins, getClassByConstantClassRef(clazz, r->idx, r))) { checkok = 1; } sp = stack->sp; @@ -3327,43 +3306,43 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { (sp++)->ivalue = checkok; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("instanceof [%llx] instancof %s \n", (s64) (intptr_t) ins, utf8_cstr(class_get_constant_classref(clazz, idx)->name)); + invoke_deepth(r); + jvm_printf("instanceof [%llx] instancof %s \n", (s64) (intptr_t) r->ins, utf8_cstr(class_get_constant_classref(clazz, r->idx)->name)); #endif - runtime->pc += 3; + r->pc += 3; break; } case op_monitorenter: { - ins = (--sp)->rvalue; + r->ins = (--sp)->rvalue; stack->sp = sp; - if (!ins)goto label_null_throw; - jthread_lock(&ins->mb, runtime); + if (!r->ins)goto label_null_throw; + jthread_lock(&r->ins->mb, r); sp = stack->sp; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("monitorenter [%llx] %s \n", (s64) (intptr_t) ins, ins ? utf8_cstr(ins->mb.clazz->name) : "null"); + invoke_deepth(r); + jvm_printf("monitorenter [%llx] %s \n", (s64) (intptr_t) r->ins, r->ins ? utf8_cstr(r->ins->mb.clazz->name) : "null"); #endif - runtime->pc++; + r->pc++; break; } case op_monitorexit: { - ins = (--sp)->rvalue; + r->ins = (--sp)->rvalue; stack->sp = sp; - if (!ins)goto label_null_throw; - int ret = jthread_unlock(&ins->mb, runtime); + if (!r->ins)goto label_null_throw; + int ret = jthread_unlock(&r->ins->mb, r); if (ret < 0) { s32 debug = 1; } sp = stack->sp; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("monitorexit [%llx] %s \n", (s64) (intptr_t) ins, ins ? utf8_cstr(ins->mb.clazz->name) : "null"); + invoke_deepth(r); + jvm_printf("monitorexit [%llx] %s \n", (s64) (intptr_t) r->ins, r->ins ? utf8_cstr(r->ins->mb.clazz->name) : "null"); #endif - runtime->pc++; + r->pc++; break; } @@ -3371,69 +3350,69 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_wide: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("wide \n"); #endif - runtime->pc++; - switch (*runtime->pc) { + r->pc++; + switch (*r->pc) { case op_iload: case op_fload: { - (sp++)->ivalue = localvar[*((u16 *) (runtime->pc + 1))].ivalue; - runtime->pc += 3; + (sp++)->ivalue = localvar[*((u16 *) (r->pc + 1))].ivalue; + r->pc += 3; break; } case op_aload: { - (sp++)->rvalue = localvar[*((u16 *) (runtime->pc + 1))].rvalue; - runtime->pc += 3; + (sp++)->rvalue = localvar[*((u16 *) (r->pc + 1))].rvalue; + r->pc += 3; break; } case op_lload: case op_dload: { - (sp++)->lvalue = localvar[*((u16 *) (runtime->pc + 1))].lvalue; + (sp++)->lvalue = localvar[*((u16 *) (r->pc + 1))].lvalue; sp++; - runtime->pc += 3; + r->pc += 3; break; } case op_istore: case op_fstore: { - localvar[*((u16 *) (runtime->pc + 1))].ivalue = (--sp)->ivalue; - runtime->pc += 3; + localvar[*((u16 *) (r->pc + 1))].ivalue = (--sp)->ivalue; + r->pc += 3; break; } case op_astore: { - localvar[*((u16 *) (runtime->pc + 1))].rvalue = (--sp)->rvalue; - runtime->pc += 3; + localvar[*((u16 *) (r->pc + 1))].rvalue = (--sp)->rvalue; + r->pc += 3; break; } case op_lstore: case op_dstore: { --sp; - localvar[*((u16 *) (runtime->pc + 1))].lvalue = (--sp)->lvalue; - runtime->pc += 3; + localvar[*((u16 *) (r->pc + 1))].lvalue = (--sp)->lvalue; + r->pc += 3; break; } case op_ret: { - __refer addr = (__refer) (intptr_t) localvar[*((u16 *) (runtime->pc + 1))].lvalue; + __refer addr = (__refer) (intptr_t) localvar[*((u16 *) (r->pc + 1))].lvalue; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("wide ret: %x\n", (s64) (intptr_t) addr); #endif - runtime->pc = (u8 *) addr; + r->pc = (u8 *) addr; break; } case op_iinc : { - localvar[*((u16 *) (runtime->pc + 1))].ivalue += *((s16 *) (runtime->pc + 3)); + localvar[*((u16 *) (r->pc + 1))].ivalue += *((s16 *) (r->pc + 3)); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("wide iinc: localvar(%d) = %d , inc %d\n", *((u16 *) (runtime->pc + 1)), runtime->localvar[*((u16 *) (runtime->pc + 1))].ivalue, *((u16 *) (runtime->pc + 3))); + invoke_deepth(r); + jvm_printf("wide iinc: localvar(%d) = %d , inc %d\n", *((u16 *) (r->pc + 1)), r->localvar[*((u16 *) (r->pc + 1))].ivalue, *((u16 *) (r->pc + 3))); #endif - runtime->pc += 5; + r->pc += 5; break; } default: - _op_notsupport(runtime->pc, runtime); + _op_notsupport(r->pc, r); } break; } @@ -3442,41 +3421,41 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_multianewarray: { //data type index - ustr = class_get_utf8_string(clazz, *((u16 *) (runtime->pc + 1))); + r->ustr = class_get_utf8_string(clazz, *((u16 *) (r->pc + 1))); //array dim - count = (u8) runtime->pc[3]; + r->count = (u8) r->pc[3]; #ifdef __JVM_OS_VS__ s32 dim[32]; #else - s32 dim[count]; + s32 dim[r->count]; #endif - for (idx = 0; idx < count; idx++) - dim[idx] = (--sp)->ivalue; + for (r->idx = 0; r->idx < r->count; r->idx++) + dim[r->idx] = (--sp)->ivalue; stack->sp = sp; - ins = jarray_multi_create(runtime, dim, count, ustr, 0); + r->ins = jarray_multi_create(r, dim, r->count, r->ustr, 0); sp = stack->sp; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("multianewarray [%llx] type:%s , count:%d \n", (s64) (intptr_t) ins, utf8_cstr(ustr), count); + invoke_deepth(r); + jvm_printf("multianewarray [%llx] type:%s , r->count:%d \n", (s64) (intptr_t) r->ins, utf8_cstr(r->ustr), r->count); #endif - (sp++)->rvalue = ins; - runtime->pc += 4; + (sp++)->rvalue = r->ins; + r->pc += 4; break; } case op_ifnull: { - ins = (--sp)->rvalue; - if (!ins) { + r->ins = (--sp)->rvalue; + if (!r->ins) { - runtime->pc += *((s16 *) (runtime->pc + 1)); + r->pc += *((s16 *) (r->pc + 1)); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("ifnonnull: %d/%llx != 0 then jump %d \n", (s32) (intptr_t) ins, (s64) (intptr_t) ins); + invoke_deepth(r); + jvm_printf("ifnonnull: %d/%llx != 0 then jump %d \n", (s32) (intptr_t) r->ins, (s64) (intptr_t) r->ins); #endif @@ -3485,27 +3464,27 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_ifnonnull: { - ins = (--sp)->rvalue; - if (ins) { - runtime->pc += *((s16 *) (runtime->pc + 1)); + r->ins = (--sp)->rvalue; + if (r->ins) { + r->pc += *((s16 *) (r->pc + 1)); } else { - runtime->pc += 3; + r->pc += 3; } #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("ifnonnull: %d/%llx != 0 then \n", (s32) (intptr_t) ins, (s64) (intptr_t) ins); + invoke_deepth(r); + jvm_printf("ifnonnull: %d/%llx != 0 then \n", (s32) (intptr_t) r->ins, (s64) (intptr_t) r->ins); #endif break; } case op_goto_w: { - offset = *((s32 *) (runtime->pc + 1)); - runtime->pc += offset; - check_gc_pause(offset); + r->offset = *((s32 *) (r->pc + 1)); + r->pc += r->offset; + check_gc_pause(r->offset); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("goto: %d\n", offset); + invoke_deepth(r); + jvm_printf("goto: %d\n", r->offset); #endif break; } @@ -3513,13 +3492,13 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_jsr_w: { - offset = *((s32 *) (runtime->pc + 1)); - (sp++)->rvalue = (runtime->pc + 3); + r->offset = *((s32 *) (r->pc + 1)); + (sp++)->rvalue = (r->pc + 3); #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("jsr_w: %d\n", offset); + invoke_deepth(r); + jvm_printf("jsr_w: %d\n", r->offset); #endif - runtime->pc += offset; + r->pc += r->offset; break; } @@ -3527,7 +3506,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_breakpoint: { #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("breakpoint \n"); #endif break; @@ -3535,167 +3514,167 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_getstatic_ref: { - idx = *((u16 *) (runtime->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - ptr = getStaticFieldPtr(fi); + r->idx = *((u16 *) (r->pc + 1)); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + r->ptr = getStaticFieldPtr(r->fi); - (sp++)->rvalue = *((__refer *) ptr); - runtime->pc += 3; + (sp++)->rvalue = *((__refer *) r->ptr); + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: ref %d = %s.%s \n", "getstatic", (s64) (intptr_t) getFieldRefer(ptr), utf8_cstr(clazz->name), utf8_cstr(fi->name), getFieldLong(ptr)); + invoke_deepth(r); + jvm_printf("%s: ref %d = %s.%s \n", "getstatic", (s64) (intptr_t) getFieldRefer(r->ptr), utf8_cstr(clazz->name), utf8_cstr(r->fi->name), getFieldLong(r->ptr)); #endif break; } case op_getstatic_long: { - idx = *((u16 *) (runtime->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - ptr = getStaticFieldPtr(fi); - (sp++)->lvalue = *((s64 *) ptr); + r->idx = *((u16 *) (r->pc + 1)); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + r->ptr = getStaticFieldPtr(r->fi); + (sp++)->lvalue = *((s64 *) r->ptr); sp++; - runtime->pc += 3; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: long %d = %s.%s \n", "getstatic", getFieldLong(ptr), utf8_cstr(clazz->name), utf8_cstr(fi->name), getFieldLong(ptr)); + invoke_deepth(r); + jvm_printf("%s: long %d = %s.%s \n", "getstatic", getFieldLong(r->ptr), utf8_cstr(clazz->name), utf8_cstr(r->fi->name), getFieldLong(r->ptr)); #endif break; } case op_getstatic_int: { - idx = *((u16 *) (runtime->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - ptr = getStaticFieldPtr(fi); - (sp++)->ivalue = *((s32 *) ptr); - runtime->pc += 3; + r->idx = *((u16 *) (r->pc + 1)); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + r->ptr = getStaticFieldPtr(r->fi); + (sp++)->ivalue = *((s32 *) r->ptr); + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: int %d = %s.%s \n", "getstatic", (s32) getFieldInt(ptr), utf8_cstr(clazz->name), utf8_cstr(fi->name), getFieldLong(ptr)); + invoke_deepth(r); + jvm_printf("%s: int %d = %s.%s \n", "getstatic", (s32) getFieldInt(r->ptr), utf8_cstr(clazz->name), utf8_cstr(r->fi->name), getFieldLong(r->ptr)); #endif break; } case op_getstatic_short: { - idx = *((u16 *) (runtime->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - ptr = getStaticFieldPtr(fi); - (sp++)->ivalue = *((s16 *) ptr); - runtime->pc += 3; + r->idx = *((u16 *) (r->pc + 1)); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + r->ptr = getStaticFieldPtr(r->fi); + (sp++)->ivalue = *((s16 *) r->ptr); + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: short %d = %s.%s \n", "getstatic", (s32) getFieldShort(ptr), utf8_cstr(clazz->name), utf8_cstr(fi->name), getFieldLong(ptr)); + invoke_deepth(r); + jvm_printf("%s: short %d = %s.%s \n", "getstatic", (s32) getFieldShort(r->ptr), utf8_cstr(clazz->name), utf8_cstr(r->fi->name), getFieldLong(r->ptr)); #endif break; } case op_getstatic_jchar: { - idx = *((u16 *) (runtime->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - ptr = getStaticFieldPtr(fi); - (sp++)->ivalue = *((u16 *) ptr); - runtime->pc += 3; + r->idx = *((u16 *) (r->pc + 1)); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + r->ptr = getStaticFieldPtr(r->fi); + (sp++)->ivalue = *((u16 *) r->ptr); + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: char %d = %s.%s \n", "getstatic", (s32) (u16) getFieldChar(ptr), utf8_cstr(clazz->name), utf8_cstr(fi->name), getFieldLong(ptr)); + invoke_deepth(r); + jvm_printf("%s: char %d = %s.%s \n", "getstatic", (s32) (u16) getFieldChar(r->ptr), utf8_cstr(clazz->name), utf8_cstr(r->fi->name), getFieldLong(r->ptr)); #endif break; } case op_getstatic_byte: { - idx = *((u16 *) (runtime->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - ptr = getStaticFieldPtr(fi); - (sp++)->ivalue = *((s8 *) ptr); - runtime->pc += 3; + r->idx = *((u16 *) (r->pc + 1)); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + r->ptr = getStaticFieldPtr(r->fi); + (sp++)->ivalue = *((s8 *) r->ptr); + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: byte %d = %s.%s \n", "getstatic", (s32) getFieldByte(ptr), utf8_cstr(clazz->name), utf8_cstr(fi->name), getFieldLong(ptr)); + invoke_deepth(r); + jvm_printf("%s: byte %d = %s.%s \n", "getstatic", (s32) getFieldByte(r->ptr), utf8_cstr(clazz->name), utf8_cstr(r->fi->name), getFieldLong(r->ptr)); #endif break; } case op_putstatic_ref: { - idx = *((u16 *) (runtime->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - ptr = getStaticFieldPtr(fi); - *((__refer *) ptr) = (--sp)->rvalue; - runtime->pc += 3; + r->idx = *((u16 *) (r->pc + 1)); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + r->ptr = getStaticFieldPtr(r->fi); + *((__refer *) r->ptr) = (--sp)->rvalue; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: ref %s.%s = %llx \n", "putstatic", utf8_cstr(clazz->name), utf8_cstr(fi->name), (s64) (intptr_t) getFieldRefer(ptr)); + invoke_deepth(r); + jvm_printf("%s: ref %s.%s = %llx \n", "putstatic", utf8_cstr(clazz->name), utf8_cstr(r->fi->name), (s64) (intptr_t) getFieldRefer(r->ptr)); #endif break; } case op_putstatic_long: { - idx = *((u16 *) (runtime->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - ptr = getStaticFieldPtr(fi); + r->idx = *((u16 *) (r->pc + 1)); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + r->ptr = getStaticFieldPtr(r->fi); --sp; - *((s64 *) ptr) = (--sp)->lvalue; - runtime->pc += 3; + *((s64 *) r->ptr) = (--sp)->lvalue; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: long %s.%s = %lld \n", "putstatic", utf8_cstr(clazz->name), utf8_cstr(fi->name), getFieldLong(ptr)); + invoke_deepth(r); + jvm_printf("%s: long %s.%s = %lld \n", "putstatic", utf8_cstr(clazz->name), utf8_cstr(r->fi->name), getFieldLong(r->ptr)); #endif break; } case op_putstatic_int: { - idx = *((u16 *) (runtime->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - ptr = getStaticFieldPtr(fi); - *((s32 *) ptr) = (--sp)->ivalue; - runtime->pc += 3; + r->idx = *((u16 *) (r->pc + 1)); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + r->ptr = getStaticFieldPtr(r->fi); + *((s32 *) r->ptr) = (--sp)->ivalue; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: int %s.%s = %d \n", "putstatic", utf8_cstr(clazz->name), utf8_cstr(fi->name), (s32) getFieldInt(ptr)); + invoke_deepth(r); + jvm_printf("%s: int %s.%s = %d \n", "putstatic", utf8_cstr(clazz->name), utf8_cstr(r->fi->name), (s32) getFieldInt(r->ptr)); #endif break; } case op_putstatic_short: { - idx = *((u16 *) (runtime->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - ptr = getStaticFieldPtr(fi); - *((s16 *) ptr) = (s16) (--sp)->ivalue; - runtime->pc += 3; + r->idx = *((u16 *) (r->pc + 1)); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + r->ptr = getStaticFieldPtr(r->fi); + *((s16 *) r->ptr) = (s16) (--sp)->ivalue; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: short %s.%s = %d \n", "putstatic", utf8_cstr(clazz->name), utf8_cstr(fi->name), (s32) getFieldShort(ptr)); + invoke_deepth(r); + jvm_printf("%s: short %s.%s = %d \n", "putstatic", utf8_cstr(clazz->name), utf8_cstr(r->fi->name), (s32) getFieldShort(r->ptr)); #endif break; } case op_putstatic_byte: { - idx = *((u16 *) (runtime->pc + 1)); - fi = class_get_constant_fieldref(clazz, idx)->fieldInfo; - ptr = getStaticFieldPtr(fi); - *((s8 *) ptr) = (s8) (--sp)->ivalue; - runtime->pc += 3; + r->idx = *((u16 *) (r->pc + 1)); + r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; + r->ptr = getStaticFieldPtr(r->fi); + *((s8 *) r->ptr) = (s8) (--sp)->ivalue; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: byte %s.%s = %d \n", "putstatic", utf8_cstr(clazz->name), utf8_cstr(fi->name), (s32) getFieldByte(ptr)); + invoke_deepth(r); + jvm_printf("%s: byte %s.%s = %d \n", "putstatic", utf8_cstr(clazz->name), utf8_cstr(r->fi->name), (s32) getFieldByte(r->ptr)); #endif break; } case op_getfield_ref: { - offset = *((u16 *) (runtime->pc + 1)); - ins = (--sp)->rvalue; - if (!ins) { + r->offset = *((u16 *) (r->pc + 1)); + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - ptr = &(ins->obj_fields[offset]); + r->ptr = &(r->ins->obj_fields[r->offset]); - (sp++)->rvalue = *((__refer *) ptr); - runtime->pc += 3; + (sp++)->rvalue = *((__refer *) r->ptr); + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: ref %llx = %s. \n", "getfield", getFieldRefer(ptr), utf8_cstr(clazz->name)); + invoke_deepth(r); + jvm_printf("%s: ref %llx = %s. \n", "getfield", getFieldRefer(r->ptr), utf8_cstr(clazz->name)); #endif } break; @@ -3703,19 +3682,19 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_getfield_long: { - offset = *((u16 *) (runtime->pc + 1)); - ins = (--sp)->rvalue; - if (!ins) { + r->offset = *((u16 *) (r->pc + 1)); + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - ptr = &(ins->obj_fields[offset]); + r->ptr = &(r->ins->obj_fields[r->offset]); - (sp++)->lvalue = *((s64 *) ptr); + (sp++)->lvalue = *((s64 *) r->ptr); sp++; - runtime->pc += 3; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: long %lld = %s. \n", "getfield", getFieldLong(ptr), utf8_cstr(ins->mb.clazz->name)); + invoke_deepth(r); + jvm_printf("%s: long %lld = %s. \n", "getfield", getFieldLong(r->ptr), utf8_cstr(r->ins->mb.clazz->name)); #endif } break; @@ -3723,18 +3702,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_getfield_int: { - offset = *((u16 *) (runtime->pc + 1)); - ins = (--sp)->rvalue; - if (!ins) { + r->offset = *((u16 *) (r->pc + 1)); + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - ptr = &(ins->obj_fields[offset]); + r->ptr = &(r->ins->obj_fields[r->offset]); - (sp++)->ivalue = *((s32 *) ptr); - runtime->pc += 3; + (sp++)->ivalue = *((s32 *) r->ptr); + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: int %d = %s \n", "getfield", (s32) getFieldInt(ptr), utf8_cstr(clazz->name)); + invoke_deepth(r); + jvm_printf("%s: int %d = %s \n", "getfield", (s32) getFieldInt(r->ptr), utf8_cstr(clazz->name)); #endif } break; @@ -3742,18 +3721,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_getfield_short: { - offset = *((u16 *) (runtime->pc + 1)); - ins = (--sp)->rvalue; - if (!ins) { + r->offset = *((u16 *) (r->pc + 1)); + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - ptr = &(ins->obj_fields[offset]); + r->ptr = &(r->ins->obj_fields[r->offset]); - (sp++)->ivalue = *((s16 *) ptr); - runtime->pc += 3; + (sp++)->ivalue = *((s16 *) r->ptr); + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: short %d = %s \n", "getfield", (s32) getFieldShort(ptr), utf8_cstr(clazz->name)); + invoke_deepth(r); + jvm_printf("%s: short %d = %s \n", "getfield", (s32) getFieldShort(r->ptr), utf8_cstr(clazz->name)); #endif } break; @@ -3761,18 +3740,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_getfield_jchar: { - offset = *((u16 *) (runtime->pc + 1)); - ins = (--sp)->rvalue; - if (!ins) { + r->offset = *((u16 *) (r->pc + 1)); + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - ptr = &(ins->obj_fields[offset]); + r->ptr = &(r->ins->obj_fields[r->offset]); - (sp++)->ivalue = *((u16 *) ptr); - runtime->pc += 3; + (sp++)->ivalue = *((u16 *) r->ptr); + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: char %d = %s \n", "getfield", (s32) (u16) getFieldChar(ptr), utf8_cstr(clazz->name)); + invoke_deepth(r); + jvm_printf("%s: char %d = %s \n", "getfield", (s32) (u16) getFieldChar(r->ptr), utf8_cstr(clazz->name)); #endif } break; @@ -3780,18 +3759,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_getfield_byte: { - offset = *((u16 *) (runtime->pc + 1)); - ins = (--sp)->rvalue; - if (!ins) { + r->offset = *((u16 *) (r->pc + 1)); + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - ptr = &(ins->obj_fields[offset]); + r->ptr = &(r->ins->obj_fields[r->offset]); - (sp++)->ivalue = *((s8 *) ptr); - runtime->pc += 3; + (sp++)->ivalue = *((s8 *) r->ptr); + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: byte %d = %s \n", "getfield", (s32) getFieldByte(ptr), utf8_cstr(clazz->name)); + invoke_deepth(r); + jvm_printf("%s: byte %d = %s \n", "getfield", (s32) getFieldByte(r->ptr), utf8_cstr(clazz->name)); #endif } break; @@ -3799,18 +3778,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_putfield_ref: { - offset = *((u16 *) (runtime->pc + 1)); - rval1 = (--sp)->rvalue; - ins = (--sp)->rvalue; - if (!ins) { + r->offset = *((u16 *) (r->pc + 1)); + r->rval1 = (--sp)->rvalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; } else { // check variable type to determain long/s32/f64/f32 - ptr = &(ins->obj_fields[offset]); - *((__refer *) ptr) = rval1; - runtime->pc += 3; + r->ptr = &(r->ins->obj_fields[r->offset]); + *((__refer *) r->ptr) = r->rval1; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("%s: ref %s\n", "putfield", utf8_cstr(clazz->name)); #endif } @@ -3819,18 +3798,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_putfield_long: { - offset = *((u16 *) (runtime->pc + 1)); + r->offset = *((u16 *) (r->pc + 1)); --sp; - lval1 = (--sp)->lvalue; - ins = (--sp)->rvalue; - if (!ins) { + r->lval1 = (--sp)->lvalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - ptr = &(ins->obj_fields[offset]); - *((s64 *) ptr) = lval1; - runtime->pc += 3; + r->ptr = &(r->ins->obj_fields[r->offset]); + *((s64 *) r->ptr) = r->lval1; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); + invoke_deepth(r); jvm_printf("%s: long %s\n", "putfield", utf8_cstr(clazz->name)); #endif } @@ -3839,18 +3818,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_putfield_int: { - offset = *((u16 *) (runtime->pc + 1)); - ival1 = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->offset = *((u16 *) (r->pc + 1)); + r->ival1 = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - ptr = &(ins->obj_fields[offset]); - *((s32 *) ptr) = ival1; - runtime->pc += 3; + r->ptr = &(r->ins->obj_fields[r->offset]); + *((s32 *) r->ptr) = r->ival1; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: int %s.= %d\n", "putfield", utf8_cstr(clazz->name), ival1); + invoke_deepth(r); + jvm_printf("%s: int %s.= %d\n", "putfield", utf8_cstr(clazz->name), r->ival1); #endif } break; @@ -3858,18 +3837,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_putfield_short: { - offset = *((u16 *) (runtime->pc + 1)); - ival1 = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->offset = *((u16 *) (r->pc + 1)); + r->ival1 = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - ptr = &(ins->obj_fields[offset]); - *((s16 *) ptr) = (s16) ival1; - runtime->pc += 3; + r->ptr = &(r->ins->obj_fields[r->offset]); + *((s16 *) r->ptr) = (s16) r->ival1; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: short %s. = %d\n", "putfield", utf8_cstr(clazz->name), ival1); + invoke_deepth(r); + jvm_printf("%s: short %s. = %d\n", "putfield", utf8_cstr(clazz->name), r->ival1); #endif } break; @@ -3877,18 +3856,18 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_putfield_byte: { - offset = *((u16 *) (runtime->pc + 1)); - ival1 = (--sp)->ivalue; - ins = (--sp)->rvalue; - if (!ins) { + r->offset = *((u16 *) (r->pc + 1)); + r->ival1 = (--sp)->ivalue; + r->ins = (--sp)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - ptr = &(ins->obj_fields[offset]); - *((s8 *) ptr) = (s8) ival1; - runtime->pc += 3; + r->ptr = &(r->ins->obj_fields[r->offset]); + *((s8 *) r->ptr) = (s8) r->ival1; + r->pc += 3; #if _JVM_DEBUG_LOG_LEVEL > 5 - invoke_deepth(runtime); - jvm_printf("%s: byte %s. = %d\n", "putfield", utf8_cstr(clazz->name), ival1); + invoke_deepth(r); + jvm_printf("%s: byte %s. = %d\n", "putfield", utf8_cstr(clazz->name), r->ival1); #endif } break; @@ -3897,25 +3876,25 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_invokevirtual_fast: { - cmr = class_get_constant_method_ref(clazz, *((u16 *) (runtime->pc + 1))); - ins = (sp - 1 - cmr->para_slots)->rvalue; - if (!ins) { + r->cmr = class_get_constant_method_ref(clazz, *((u16 *) (r->pc + 1))); + r->ins = (sp - 1 - r->cmr->para_slots)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - m = (MethodInfo *) pairlist_get(cmr->virtual_methods, ins->mb.clazz); + r->m = (MethodInfo *) pairlist_get(r->cmr->virtual_methods, r->ins->mb.clazz); #if _JVM_DEBUG_PROFILE spent = nanoTime() - start_at; #endif - if (!m) { - *runtime->pc = op_invokevirtual; + if (!r->m) { + *r->pc = op_invokevirtual; } else { stack->sp = sp; - ret = execute_method_impl(m, runtime); + ret = execute_method_impl(r->m, r); sp = stack->sp; if (ret) { goto label_exception_handle; } - runtime->pc += 3; + r->pc += 3; } } @@ -3924,61 +3903,61 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_invokespecial_fast: { - cmr = class_get_constant_method_ref(clazz, *((u16 *) (runtime->pc + 1))); - m = cmr->methodInfo; + r->cmr = class_get_constant_method_ref(clazz, *((u16 *) (r->pc + 1))); + r->m = r->cmr->methodInfo; #if _JVM_DEBUG_PROFILE spent = nanoTime() - start_at; #endif stack->sp = sp; - ret = execute_method_impl(m, runtime); + ret = execute_method_impl(r->m, r); sp = stack->sp; if (ret) { goto label_exception_handle; } - runtime->pc += 3; + r->pc += 3; break; } case op_invokestatic_fast: { - cmr = class_get_constant_method_ref(clazz, *((u16 *) (runtime->pc + 1))); - m = cmr->methodInfo; + r->cmr = class_get_constant_method_ref(clazz, *((u16 *) (r->pc + 1))); + r->m = r->cmr->methodInfo; #if _JVM_DEBUG_PROFILE spent = nanoTime() - start_at; #endif stack->sp = sp; - ret = execute_method_impl(m, runtime); + ret = execute_method_impl(r->m, r); sp = stack->sp; if (ret) { goto label_exception_handle; } - runtime->pc += 3; + r->pc += 3; break; } case op_invokeinterface_fast: { //此cmr所描述的方法,对于不同的实例,有不同的method - cmr = class_get_constant_method_ref(clazz, *((u16 *) (runtime->pc + 1))); + r->cmr = class_get_constant_method_ref(clazz, *((u16 *) (r->pc + 1))); - ins = (sp - 1 - cmr->para_slots)->rvalue; - if (!ins) { + r->ins = (sp - 1 - r->cmr->para_slots)->rvalue; + if (!r->ins) { goto label_null_throw; } else { - m = (MethodInfo *) pairlist_get(cmr->virtual_methods, ins->mb.clazz); + r->m = (MethodInfo *) pairlist_get(r->cmr->virtual_methods, r->ins->mb.clazz); #if _JVM_DEBUG_PROFILE spent = nanoTime() - start_at; #endif - if (!m) { - *runtime->pc = op_invokeinterface; + if (!r->m) { + *r->pc = op_invokeinterface; } else { stack->sp = sp; - ret = execute_method_impl(m, runtime); + ret = execute_method_impl(r->m, r); sp = stack->sp; if (ret) { goto label_exception_handle; } - runtime->pc += 5; + r->pc += 5; } } break; @@ -3986,31 +3965,31 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_invokedynamic_fast: { - //get bootMethod struct - cid = class_get_invoke_dynamic(clazz, *((u16 *) (runtime->pc + 1))); - bootMethod = &clazz->bootstrapMethodAttr->bootstrap_methods[cid->bootstrap_method_attr_index];//Boot - m = bootMethod->make; + //get r->bootMethod struct + r->cid = class_get_invoke_dynamic(clazz, *((u16 *) (r->pc + 1))); + r->bootMethod = &clazz->bootstrapMethodAttr->bootstrap_methods[r->cid->bootstrap_method_attr_index];//Boot + r->m = r->bootMethod->make; #if _JVM_DEBUG_PROFILE spent = nanoTime() - start_at; #endif // run make to generate instance of Lambda Class stack->sp = sp; - ret = execute_method_impl(m, runtime); + ret = execute_method_impl(r->m, r); sp = stack->sp; if (ret) { goto label_exception_handle; } - runtime->pc += 5; + r->pc += 5; break; } default: - _op_notsupport(runtime->pc, runtime); + _op_notsupport(r->pc, r); } - /* ================================== runtime->pc end =============================*/ + /* ================================== r->pc end =============================*/ #if _JVM_DEBUG_PROFILE //time @@ -4021,42 +4000,42 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { label_outofbounds_throw: { stack->sp = sp; - push_ref(stack, (__refer) exception_create(JVM_EXCEPTION_ARRAYINDEXOUTOFBOUNDS, runtime)); + push_ref(stack, (__refer) exception_create(JVM_EXCEPTION_ARRAYINDEXOUTOFBOUNDS, r)); goto label_exception_handle; } label_null_throw: { stack->sp = sp; - push_ref(stack, (__refer) exception_create(JVM_EXCEPTION_NULLPOINTER, runtime)); + push_ref(stack, (__refer) exception_create(JVM_EXCEPTION_NULLPOINTER, r)); goto label_exception_handle; } label_nosuchmethod_throw: { stack->sp = sp; - push_ref(stack, (__refer) exception_create_str(JVM_EXCEPTION_NOSUCHMETHOD, runtime, err_msg)); + push_ref(stack, (__refer) exception_create_str(JVM_EXCEPTION_NOSUCHMETHOD, r, err_msg)); goto label_exception_handle; } label_nosuchfield_throw: { stack->sp = sp; - push_ref(stack, (__refer) exception_create_str(JVM_EXCEPTION_NOSUCHFIELD, runtime, err_msg)); + push_ref(stack, (__refer) exception_create_str(JVM_EXCEPTION_NOSUCHFIELD, r, err_msg)); goto label_exception_handle; } label_arrithmetic_throw: { stack->sp = sp; - push_ref(stack, (__refer) exception_create(JVM_EXCEPTION_ARRITHMETIC, runtime)); + push_ref(stack, (__refer) exception_create(JVM_EXCEPTION_ARRITHMETIC, r)); goto label_exception_handle; } label_checkcast_throw: { stack->sp = sp; - push_ref(stack, (__refer) exception_create(JVM_EXCEPTION_CLASSCAST, runtime)); + push_ref(stack, (__refer) exception_create(JVM_EXCEPTION_CLASSCAST, r)); goto label_exception_handle; } @@ -4067,13 +4046,13 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { // there is exception handle, but not error handle ret = RUNTIME_STATUS_EXCEPTION; - if (exception_handle(runtime->stack, runtime)) { + if (exception_handle(r->stack, r)) { ret = RUNTIME_STATUS_NORMAL; - runtime_clear_stacktrack(runtime); + runtime_clear_stacktrack(r); } else { - arraylist_push_back(runtime->thrd_info->stacktrack, method); - arraylist_push_back(runtime->thrd_info->lineNo, (__refer) (intptr_t) getLineNumByIndex(ca, (s32) (runtime->pc - ca->code))); + arraylist_push_back(r->thrd_info->stacktrack, method); + arraylist_push_back(r->thrd_info->lineNo, (__refer) (intptr_t) getLineNumByIndex(ca, (s32) (r->pc - ca->code))); break; } sp = stack->sp; @@ -4096,50 +4075,50 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { } //sync end - if (method->is_sync)_synchronized_unlock_method(method, runtime); + if (method->is_sync)_synchronized_unlock_method(method, r); } else { jvm_printf("method code attribute is null."); } } else {// native method - localvar_init(runtime, method->para_slots, method->para_slots); + localvar_init(r, method->para_slots, method->para_slots); // cache native method calls if (!method->native_func) { // find and cache the native method java_native_method *native = find_native_method(jvm, utf8_cstr(clazz->name), utf8_cstr(method->name), utf8_cstr(method->descriptor)); if (!native) { - _nosuchmethod_check_exception(utf8_cstr(method->name), stack, runtime); + _nosuchmethod_check_exception(utf8_cstr(method->name), stack, r); ret = RUNTIME_STATUS_EXCEPTION; } else { method->native_func = native->func_pointer; } } - if (runtime->thrd_info->is_stop) {//if stop=1 then exit thread + if (r->thrd_info->is_stop) {//if stop=1 then exit thread ret = RUNTIME_STATUS_ERROR; } else if (method->native_func) { - if (method->is_sync)_synchronized_lock_method(method, runtime); - ret = method->native_func(runtime, clazz); - if (method->is_sync)_synchronized_unlock_method(method, runtime); + if (method->is_sync)_synchronized_lock_method(method, r); + ret = method->native_func(r, clazz); + if (method->is_sync)_synchronized_unlock_method(method, r); if (ret) { - ins = pop_ref(stack); - localvar_dispose(runtime); - push_ref(stack, ins); + r->ins = pop_ref(stack); + localvar_dispose(r); + push_ref(stack, r->ins); } else { switch (method->return_slots) { case 0: {// V - localvar_dispose(runtime); + localvar_dispose(r); break; } case 1: { // F I R - peek_entry(stack->sp - method->return_slots, &entry); - localvar_dispose(runtime); - push_entry(stack, &entry); + peek_entry(stack->sp - method->return_slots, &r->entry); + localvar_dispose(r); + push_entry(stack, &r->entry); break; } case 2: {//J D return type , 2slots - lval1 = pop_long(stack); - localvar_dispose(runtime); - push_long(stack, lval1); + r->lval1 = pop_long(stack); + localvar_dispose(r); + push_long(stack, r->lval1); break; } default: { @@ -4153,14 +4132,14 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { #if _JVM_DEBUG_LOG_LEVEL > 3 if (ret != RUNTIME_STATUS_EXCEPTION) { - if (stack->sp != runtime->localvar + method->return_slots) { - invoke_deepth(runtime); - jvm_printf("Thread.stop = %d | Stack size %s.%s%s in:%d out:%d \n", runtime->thrd_info->is_stop, utf8_cstr(clazz->name), utf8_cstr(method->name), utf8_cstr(method->descriptor), (runtime->localvar - runtime->stack->store), stack_size(stack)); - if (!runtime->thrd_info->is_stop)exit(1);//if is_stop , the stack will confuse + if (stack->sp != r->localvar + method->return_slots) { + invoke_deepth(r); + jvm_printf("Thread.stop = %d | Stack size %s.%s%s in:%d out:%d \n", r->thrd_info->is_stop, utf8_cstr(clazz->name), utf8_cstr(method->name), utf8_cstr(method->descriptor), (r->localvar - r->stack->store), stack_size(stack)); + if (!r->thrd_info->is_stop)exit(1);//if is_stop , the stack will confuse } } #endif - runtime_destroy_inl(runtime); + runtime_destroy_inl(r); pruntime->son = NULL; //must clear , required for getLastSon() #if _JVM_DEBUG_LOG_LEVEL > 3 diff --git a/minijvm/c/jvm/jvm.h b/minijvm/c/jvm/jvm.h index ed4bb1cc..cb8fabd1 100644 --- a/minijvm/c/jvm/jvm.h +++ b/minijvm/c/jvm/jvm.h @@ -1400,6 +1400,27 @@ struct _Runtime { }; JniEnv *jnienv; + + //shared local var for opcode , this usually in cache 1 + Instance *ins; + s32 idx; + s32 offset; + s32 count; + FieldInfo *fi; + MethodInfo *m; + c8 *ptr; + s32 ival1, ival2; + f64 dval1, dval2; + f32 fval1, fval2; + s64 lval1, lval2; + __refer rval1, rval2; + ConstantMethodRef *cmr; + ConstantFieldRef *cfr; + JClass *other; + StackEntry entry; + Utf8String *ustr; + ConstantInvokeDynamic *cid; + BootstrapMethod *bootMethod; }; //======================= stack ============================= From 4e3d2ada30a55c485956af66e9a9548d229d488c Mon Sep 17 00:00:00 2001 From: Gust Date: Wed, 12 Nov 2025 00:25:14 +0800 Subject: [PATCH 3/7] update Runtime struct --- minijvm/c/jvm/interpreter.c | 62 +++++++++++++++++-------------------- minijvm/c/jvm/jvm.h | 23 +++++++------- 2 files changed, 40 insertions(+), 45 deletions(-) diff --git a/minijvm/c/jvm/interpreter.c b/minijvm/c/jvm/interpreter.c index da962a28..e1bb6da8 100755 --- a/minijvm/c/jvm/interpreter.c +++ b/minijvm/c/jvm/interpreter.c @@ -518,12 +518,8 @@ static inline s32 _optimize_inline_setter(JClass *clazz, s32 cfrIdx, Runtime *ru s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { - - //local var for control - MiniJVM *jvm; s32 ret; - c8 const *err_msg; Runtime *r; RuntimeStack *stack; LocalVarItem *localvar; @@ -535,8 +531,6 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { ret = RUNTIME_STATUS_NORMAL; r = runtime_create_inl(pruntime); - jvm = r->jvm; - clazz = method->_this_class; r->clazz = clazz; r->method = method; @@ -621,7 +615,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { sp = r->stack->sp; do { - if (jdwp_client_count(jvm->jdwpserver)) { + if (jdwp_client_count(r->jvm->jdwpserver)) { stack->sp = sp; if (!r->thrd_info->no_pause) { @@ -639,7 +633,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { check_gc_pause(-1); //step debug required } #if _JVM_DEBUG_LOG_LEVEL > 1 - if (jvm->collector->isworldstoped && thrd_info->top_runtime != jvm->collector->runtime) { + if (r->jvm->collector->isworldstoped && thrd_info->top_runtime != r->jvm->collector->runtime) { jvm_printf("[ERROR] world stopped, but thread is running: %llx\n", (s64) (intptr_t) r->thrd_info->jthread); } #endif //_JVM_DEBUG_LOG_LEVEL > 1 @@ -2781,7 +2775,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { sp = stack->sp; r->cfr->fieldInfo = r->fi; if (!r->fi) { - err_msg = utf8_cstr(r->cfr->name); + r->err_msg = utf8_cstr(r->cfr->name); goto label_nosuchfield_throw; } } @@ -2837,7 +2831,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { r->cfr->fieldInfo = r->fi; if (!r->fi) { - err_msg = utf8_cstr(r->cfr->name); + r->err_msg = utf8_cstr(r->cfr->name); goto label_nosuchfield_throw; } } @@ -2879,7 +2873,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { case op_getfield: { s8 byte_changed = 0; - spin_lock(&jvm->lock_cloader); + spin_lock(&r->jvm->lock_cloader); { if (*(r->pc) == op_getfield) { r->idx = *((u16 *) (r->pc + 1)); @@ -2887,7 +2881,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { byte_changed = 1; } } - spin_unlock(&jvm->lock_cloader); + spin_unlock(&r->jvm->lock_cloader); if (!byte_changed) { r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; @@ -2898,7 +2892,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { sp = stack->sp; r->cfr->fieldInfo = r->fi; if (!r->fi) { - err_msg = utf8_cstr(r->cfr->name); + r->err_msg = utf8_cstr(r->cfr->name); goto label_nosuchfield_throw; } } @@ -2907,7 +2901,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { class_clinit(r->fi->_this_class, r); sp = stack->sp; } - spin_lock(&jvm->lock_cloader); + spin_lock(&r->jvm->lock_cloader); { if (r->fi->isrefer) { *r->pc = op_getfield_ref; @@ -2941,7 +2935,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { } *((u16 *) (r->pc + 1)) = r->fi->offset_instance; } - spin_unlock(&jvm->lock_cloader); + spin_unlock(&r->jvm->lock_cloader); } else { //jvm_printf("getfield byte code changed by r->other thread.\n"); } @@ -2953,7 +2947,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { //there were a multithread error , one enter the r->ins but changed by another s8 byte_changed = 0; - spin_lock(&jvm->lock_cloader); + spin_lock(&r->jvm->lock_cloader); { if (*(r->pc) == op_putfield) { r->idx = *((u16 *) (r->pc + 1)); @@ -2961,7 +2955,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { byte_changed = 1; } } - spin_unlock(&jvm->lock_cloader); + spin_unlock(&r->jvm->lock_cloader); if (!byte_changed) { r->fi = class_get_constant_fieldref(clazz, r->idx)->fieldInfo; @@ -2973,7 +2967,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { sp = stack->sp; r->cfr->fieldInfo = r->fi; if (!r->fi) { - err_msg = utf8_cstr(r->cfr->name); + r->err_msg = utf8_cstr(r->cfr->name); goto label_nosuchfield_throw; } } @@ -2982,7 +2976,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { class_clinit(r->fi->_this_class, r); sp = stack->sp; } - spin_lock(&jvm->lock_cloader); + spin_lock(&r->jvm->lock_cloader); { if (r->fi->isrefer) {// garbage collection flag *r->pc = op_putfield_ref; @@ -3012,7 +3006,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { } *((u16 *) (r->pc + 1)) = r->fi->offset_instance; } - spin_unlock(&jvm->lock_cloader); + spin_unlock(&r->jvm->lock_cloader); } else { //jvm_printf("putfield byte code changed by r->other thread.\n"); } @@ -3033,15 +3027,15 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { stack->sp = sp; r->m = find_instance_methodInfo_by_name(r->ins, r->cmr->name, r->cmr->descriptor, r); sp = stack->sp; - spin_lock(&jvm->lock_cloader); + spin_lock(&r->jvm->lock_cloader); { pairlist_put(r->cmr->virtual_methods, r->ins->mb.clazz, r->m);//放入缓存,以便下次直接调用 } - spin_unlock(&jvm->lock_cloader); + spin_unlock(&r->jvm->lock_cloader); } if (!r->m) { - err_msg = utf8_cstr(r->cmr->name); + r->err_msg = utf8_cstr(r->cmr->name); goto label_nosuchmethod_throw; } else { s8 match = 0; @@ -3089,7 +3083,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { r->m = r->cmr->methodInfo; if (!r->m) { - err_msg = utf8_cstr(r->cmr->name); + r->err_msg = utf8_cstr(r->cmr->name); goto label_nosuchmethod_throw; } else { *r->pc = op_invokespecial_fast; @@ -3104,7 +3098,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { r->m = r->cmr->methodInfo; if (!r->m) { - err_msg = utf8_cstr(r->cmr->name); + r->err_msg = utf8_cstr(r->cmr->name); goto label_nosuchmethod_throw; } else { *r->pc = op_invokestatic_fast; @@ -3127,14 +3121,14 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { stack->sp = sp; r->m = find_instance_methodInfo_by_name(r->ins, r->cmr->name, r->cmr->descriptor, r); sp = stack->sp; - spin_lock(&jvm->lock_cloader); + spin_lock(&r->jvm->lock_cloader); { pairlist_put(r->cmr->virtual_methods, r->ins->mb.clazz, r->m);// store in cache for direct use in the next call } - spin_unlock(&jvm->lock_cloader); + spin_unlock(&r->jvm->lock_cloader); } if (!r->m) { - err_msg = utf8_cstr(r->cmr->name); + r->err_msg = utf8_cstr(r->cmr->name); goto label_nosuchmethod_throw; } else { *r->pc = op_invokeinterface_fast; @@ -3160,7 +3154,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { r->m = r->bootMethod->make; if (!r->m) { - err_msg = "Lambda generated method"; + r->err_msg = "Lambda generated method err"; goto label_nosuchmethod_throw; } else { *r->pc = op_invokedynamic_fast; @@ -3218,11 +3212,11 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { stack->sp = sp; if (!r->other) {//cache to speed r->other = array_class_get_by_name(r, r->clazz->jloader, class_get_utf8_string(clazz, r->idx)); - spin_lock(&jvm->lock_cloader); + spin_lock(&r->jvm->lock_cloader); { pairlist_put(clazz->arr_class_type, (__refer) (intptr_t) r->idx, r->other); } - spin_unlock(&jvm->lock_cloader); + spin_unlock(&r->jvm->lock_cloader); } r->ins = jarray_create_by_class(r, r->count, r->other); sp = stack->sp; @@ -4014,14 +4008,14 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { label_nosuchmethod_throw: { stack->sp = sp; - push_ref(stack, (__refer) exception_create_str(JVM_EXCEPTION_NOSUCHMETHOD, r, err_msg)); + push_ref(stack, (__refer) exception_create_str(JVM_EXCEPTION_NOSUCHMETHOD, r, r->err_msg)); goto label_exception_handle; } label_nosuchfield_throw: { stack->sp = sp; - push_ref(stack, (__refer) exception_create_str(JVM_EXCEPTION_NOSUCHFIELD, r, err_msg)); + push_ref(stack, (__refer) exception_create_str(JVM_EXCEPTION_NOSUCHFIELD, r, r->err_msg)); goto label_exception_handle; } @@ -4084,7 +4078,7 @@ s32 execute_method_impl(MethodInfo *method, Runtime *pruntime) { localvar_init(r, method->para_slots, method->para_slots); // cache native method calls if (!method->native_func) { // find and cache the native method - java_native_method *native = find_native_method(jvm, utf8_cstr(clazz->name), utf8_cstr(method->name), utf8_cstr(method->descriptor)); + java_native_method *native = find_native_method(r->jvm, utf8_cstr(clazz->name), utf8_cstr(method->name), utf8_cstr(method->descriptor)); if (!native) { _nosuchmethod_check_exception(utf8_cstr(method->name), stack, r); ret = RUNTIME_STATUS_EXCEPTION; diff --git a/minijvm/c/jvm/jvm.h b/minijvm/c/jvm/jvm.h index cb8fabd1..87e323e7 100644 --- a/minijvm/c/jvm/jvm.h +++ b/minijvm/c/jvm/jvm.h @@ -1402,25 +1402,26 @@ struct _Runtime { JniEnv *jnienv; //shared local var for opcode , this usually in cache 1 - Instance *ins; - s32 idx; - s32 offset; - s32 count; + StackEntry entry; FieldInfo *fi; MethodInfo *m; - c8 *ptr; - s32 ival1, ival2; - f64 dval1, dval2; - f32 fval1, fval2; - s64 lval1, lval2; - __refer rval1, rval2; + Instance *ins; ConstantMethodRef *cmr; ConstantFieldRef *cfr; JClass *other; - StackEntry entry; Utf8String *ustr; ConstantInvokeDynamic *cid; BootstrapMethod *bootMethod; + c8 const *err_msg; + c8 *ptr; + __refer rval1, rval2; + s32 ival1, ival2; + f64 dval1, dval2; + f32 fval1, fval2; + s64 lval1, lval2; + s32 idx; + s32 offset; + s32 count; }; //======================= stack ============================= From b087cfa008d3c496ef7f7d8c246d963b4f8b78ff Mon Sep 17 00:00:00 2001 From: Gust Date: Wed, 3 Dec 2025 22:27:05 +0800 Subject: [PATCH 4/7] android add wechat pay support --- mobile/androidapp/app/build.gradle | 5 +- .../app/src/main/AndroidManifest.xml | 17 +- .../minijvm/activity/JvmNativeActivity.java | 117 ++- .../org/minijvm/activity/bridge/Base64.java | 270 ++++++ .../minijvm/activity/bridge/JsonParser.java | 809 ++++++++---------- .../minijvm/activity/bridge/JsonPrinter.java | 2 +- .../activity/wxapi/WXPayEntryActivity.java | 46 + 7 files changed, 795 insertions(+), 471 deletions(-) create mode 100644 mobile/androidapp/app/src/main/java/org/minijvm/activity/bridge/Base64.java create mode 100644 mobile/androidapp/app/src/main/java/org/minijvm/activity/wxapi/WXPayEntryActivity.java diff --git a/mobile/androidapp/app/build.gradle b/mobile/androidapp/app/build.gradle index 4674489a..c962ca8b 100644 --- a/mobile/androidapp/app/build.gradle +++ b/mobile/androidapp/app/build.gradle @@ -18,10 +18,10 @@ android { compileSdkVersion 34 defaultConfig { applicationId "org.minijvm.activity" - minSdkVersion 19 + minSdkVersion 21 targetSdkVersion 34 versionCode 1 - versionName "1.0.7" + versionName "1.0.9" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { @@ -63,6 +63,7 @@ android { dependencies { api 'com.alipay.sdk:alipaysdk-android:+@aar' + api 'com.tencent.mm.opensdk:wechat-sdk-android:+' implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:26.1.0' testImplementation 'junit:junit:4.12' diff --git a/mobile/androidapp/app/src/main/AndroidManifest.xml b/mobile/androidapp/app/src/main/AndroidManifest.xml index c0f26839..04001b71 100644 --- a/mobile/androidapp/app/src/main/AndroidManifest.xml +++ b/mobile/androidapp/app/src/main/AndroidManifest.xml @@ -2,6 +2,14 @@ + + + + + + + + @@ -36,6 +44,13 @@ + - \ No newline at end of file + diff --git a/mobile/androidapp/app/src/main/java/org/minijvm/activity/JvmNativeActivity.java b/mobile/androidapp/app/src/main/java/org/minijvm/activity/JvmNativeActivity.java index 868a5f7d..10eb303b 100644 --- a/mobile/androidapp/app/src/main/java/org/minijvm/activity/JvmNativeActivity.java +++ b/mobile/androidapp/app/src/main/java/org/minijvm/activity/JvmNativeActivity.java @@ -26,7 +26,6 @@ import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.text.Editable; -import android.text.InputType; import android.text.TextWatcher; import android.util.Log; import android.view.KeyEvent; @@ -46,7 +45,11 @@ import com.alipay.sdk.app.AuthTask; import com.alipay.sdk.app.PayTask; +import com.tencent.mm.opensdk.modelpay.PayReq; +import com.tencent.mm.opensdk.openapi.IWXAPI; +import com.tencent.mm.opensdk.openapi.WXAPIFactory; +import org.minijvm.activity.bridge.Base64; import org.minijvm.activity.bridge.JsonPrinter; import org.minijvm.activity.bridge.RMCDescriptor; import org.minijvm.activity.bridge.ReflectUtil; @@ -88,11 +91,14 @@ public class JvmNativeActivity extends NativeActivity { // 用于存储等待权限的图片裁剪请求 private Bitmap mPendingBitmapToSave = null; private String mPendingFilename = null; - + // 用于存储等待权限的视频保存请求 private String mPendingVideoPath = null; private String mPendingVideoFilename = null; + public static IWXAPI sWxApi; + public static String sWxAppId; + // android:name="android.app.NativeActivity" @Override protected void onCreate(Bundle savedInstanceState) { @@ -409,7 +415,7 @@ public void onRequestPermissionsResult(int requestCode, mPendingBitmapToSave = null; mPendingFilename = null; } - + // 如果有待处理的视频保存请求,现在执行它 if (mPendingVideoPath != null) { boolean saved = saveVideoToGalleryLegacy(mPendingVideoPath, mPendingVideoFilename); @@ -432,7 +438,7 @@ public void onRequestPermissionsResult(int requestCode, } mPendingBitmapToSave = null; mPendingFilename = null; - + // 清除待处理的视频请求 mPendingVideoPath = null; mPendingVideoFilename = null; @@ -466,7 +472,7 @@ protected void onDestroy() { mPendingBitmapToSave.recycle(); mPendingBitmapToSave = null; } - + // 清理待处理的视频请求 mPendingVideoPath = null; mPendingVideoFilename = null; @@ -880,22 +886,22 @@ public void run() { /** * 处理视频文件,直接保存到相册而不做裁剪 - * - * @param uid 用户ID - * @param videoPath 视频文件路径 + * + * @param uid 用户ID + * @param videoPath 视频文件路径 * @param saveToGallery 是否保存到相册 */ private void handleVideoFile(int uid, String videoPath, boolean saveToGallery) { try { // 获取实际的文件路径 String actualPath = getActualVideoPath(videoPath); - + if (actualPath == null || !new File(actualPath).exists()) { // 文件不存在,返回失败 onPhotoPicked(uid, null, null); return; } - + if (saveToGallery) { boolean savedToGallery = saveVideoToGallery(actualPath, null); if (savedToGallery) { @@ -908,19 +914,19 @@ public void run() { }); } } - + // 无论是否保存到相册,都返回原始路径 onPhotoPicked(uid, actualPath, null); - + } catch (Exception e) { e.printStackTrace(); onPhotoPicked(uid, null, null); } } - + /** * 获取视频文件的实际路径 - * + * * @param uris URI字符串 * @return 实际文件路径 */ @@ -934,11 +940,11 @@ private String getActualVideoPath(String uris) { return uris; } } - + // 尝试作为URI处理 Uri uri = Uri.parse(uris); String scheme = uri.getScheme(); - + if ("file".equals(scheme)) { // file:// URI String path = uri.getPath(); @@ -961,10 +967,10 @@ private String getActualVideoPath(String uris) { } return null; } - + /** * 将content URI的视频复制到临时文件 - * + * * @param uri content URI * @return 临时文件路径 */ @@ -974,21 +980,21 @@ private String copyContentUriToTempFile(Uri uri) { if (inputStream == null) { return null; } - + // 创建临时文件 String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); File tempFile = new File(getPhotoStorage(), "temp_video_" + timeStamp + ".mp4"); - + FileOutputStream outputStream = new FileOutputStream(tempFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } - + inputStream.close(); outputStream.close(); - + return tempFile.getAbsolutePath(); } catch (Exception e) { e.printStackTrace(); @@ -1434,19 +1440,72 @@ public int openOtherApp(String urls, String more, int detectAppInstalled) { /** - * 支付宝支付业务示例 + * 支付宝支付业务示例, 被minijvm的 rmi调用 */ public Map payV2(String orderInfo) { - Thread t = new Thread(() -> { - PayTask alipay = new PayTask(JvmNativeActivity.this); - Map result = alipay.payV2(orderInfo, true); - Log.i("msp", result.toString()); - }); - t.start(); + try { + String decOrderInfo = new String(Base64.decode(orderInfo), "utf-8"); + Thread t = new Thread(() -> { + PayTask alipay = new PayTask(JvmNativeActivity.this); + Map result = alipay.payV2(decOrderInfo, true); + Log.i("msg", result.toString()); + }); + t.start(); + } catch (Exception e) { + e.printStackTrace(); + } return new HashMap<>(); } + /** + * 微信支付, 被minijvm的 rmi调用 + * + * @param orderInfo + * @return + */ + public Map wxPay(String orderInfo) { + try { + orderInfo = new String(Base64.decode(orderInfo), "utf-8"); + org.minijvm.activity.bridge.JsonParser parser = new org.minijvm.activity.bridge.JsonParser<>(); + Map params = parser.deserial(orderInfo, Map.class); + String appId = String.valueOf(params.get("appid")); + String partnerId = String.valueOf(params.get("partnerid")); + String prepayId = String.valueOf(params.get("prepayid")); + String packageValue = String.valueOf(params.get("package")); + String nonceStr = String.valueOf(params.get("noncestr")); + String timestamp = String.valueOf(params.get("timestamp")); + String sign = String.valueOf(params.get("sign")); + + runOnUiThread(new Runnable() { + @Override + public void run() { + sWxAppId = appId; + sWxApi = WXAPIFactory.createWXAPI(JvmNativeActivity.this, appId, true); + sWxApi.registerApp(appId); + if (!sWxApi.isWXAppInstalled()) { + Toast.makeText(JvmNativeActivity.this, "WeChat not installed", Toast.LENGTH_SHORT).show(); + } else { + PayReq req = new PayReq(); + req.appId = appId; + req.partnerId = partnerId; + req.prepayId = prepayId; + req.packageValue = packageValue; + req.nonceStr = nonceStr; + req.timeStamp = timestamp; + req.sign = sign; + sWxApi.sendReq(req); + } + } + }); + + + } catch (Exception e) { + e.printStackTrace(); + } + return new HashMap<>(); + } + /** * 支付宝账户授权业务示例 */ diff --git a/mobile/androidapp/app/src/main/java/org/minijvm/activity/bridge/Base64.java b/mobile/androidapp/app/src/main/java/org/minijvm/activity/bridge/Base64.java new file mode 100644 index 00000000..80fc909a --- /dev/null +++ b/mobile/androidapp/app/src/main/java/org/minijvm/activity/bridge/Base64.java @@ -0,0 +1,270 @@ +/* + * + * Copyright 1990-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version + * 2 only, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is + * included at /legal/license.txt). + * + * You should have received a copy of the GNU General Public License + * version 2 along with this work; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 or visit www.sun.com if you need additional + * information or have any questions. + * + */ + + +package org.minijvm.activity.bridge; + +import java.io.IOException; + +/** + * This class contains a Base64 encoder and decoder. It cannot be + * instantiated. The encoder and decoder are based on RFC 1521, except that + * encoder do not break up lines and the decoder will treat a line break as + * as invalid characters. This done since MIDP JAD's can not have line breaks + * with in an attribute. Also different RFC's use different lengths for + * base64 strings such as; 76 for 1521, 64 for 1421, and no breaks for 2228. + *

+ * For example to decode: + *

+ *      String  encodedData;
+ *      byte    binaryData[];
+ *
+ *      binaryData = Base64.decode(encodedData);
+ * 
+ * This will decode the String in encodedData and give you an array + * of bytes in the array binaryData. + *

+ * On errors, this class throws an IOException with the following detail + * strings: + *

+ *    "Base64 string not a mulitple of 4"
+ *    "Invalid character in Base64 string"
+ * 
+ */ + +public class Base64 { + /** + * prevents anyone from instantiating this class + */ + private Base64() { + } + + /** + * This character array provides the alphabet map from RFC1521. + */ + private final static char ALPHABET[] = { + // 0 1 2 3 4 5 6 7 + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 0 + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 1 + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 2 + 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', // 3 + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 4 + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 5 + 'w', 'x', 'y', 'z', '0', '1', '2', '3', // 6 + '4', '5', '6', '7', '8', '9', '+', '/' // 7 + }; + + /** + * Decodes a 7 bit Base64 character into its binary value. + */ + private static int valueDecoding[] = new int[128]; + + /** + * initializes the value decoding array from the + * character map + */ + static { + for (int i = 0; i < valueDecoding.length; i++) { + valueDecoding[i] = -1; + } + + for (int i = 0; i < ALPHABET.length; i++) { + valueDecoding[ALPHABET[i]] = i; + } + } + + public static String encode(byte[] data) { + return encode(data, 0, data.length); + } + + /** + * Converts a byte array into a Base64 encoded string. + * + * @param data bytes to encode + * @param offset which byte to start at + * @param length how many bytes to encode; padding will be added if needed + * @return base64 encoding of data; 4 chars for every 3 bytes + */ + public static String encode(byte[] data, int offset, int length) { + int i; + int encodedLen; + char[] encoded; + + // 4 chars for 3 bytes, run input up to a multiple of 3 + encodedLen = (length + 2) / 3 * 4; + encoded = new char[encodedLen]; + + for (i = 0, encodedLen = 0; encodedLen < encoded.length; + i += 3, encodedLen += 4) { + encodeQuantum(data, offset + i, length - i, encoded, encodedLen); + } + + return new String(encoded); + } + + /** + * Encodes 1, 2, or 3 bytes of data as 4 Base64 chars. + * + * @param in buffer of bytes to encode + * @param inOffset where the first byte to encode is + * @param len how many bytes to encode + * @param out buffer to put the output in + * @param outOffset where in the output buffer to put the chars + */ + private static void encodeQuantum(byte in[], int inOffset, int len, + char out[], int outOffset) { + byte a = 0, b = 0, c = 0; + + a = in[inOffset]; + out[outOffset] = ALPHABET[(a >>> 2) & 0x3F]; + + if (len > 2) { + b = in[inOffset + 1]; + c = in[inOffset + 2]; + out[outOffset + 1] = ALPHABET[((a << 4) & 0x30) + + ((b >>> 4) & 0xf)]; + out[outOffset + 2] = ALPHABET[((b << 2) & 0x3c) + + ((c >>> 6) & 0x3)]; + out[outOffset + 3] = ALPHABET[c & 0x3F]; + } else if (len > 1) { + b = in[inOffset + 1]; + out[outOffset + 1] = ALPHABET[((a << 4) & 0x30) + + ((b >>> 4) & 0xf)]; + out[outOffset + 2] = ALPHABET[((b << 2) & 0x3c) + + ((c >>> 6) & 0x3)]; + out[outOffset + 3] = '='; + } else { + out[outOffset + 1] = ALPHABET[((a << 4) & 0x30) + + ((b >>> 4) & 0xf)]; + out[outOffset + 2] = '='; + out[outOffset + 3] = '='; + } + } + + /** + * Converts a Base64 encoded string to a byte array. + * + * @param encoded Base64 encoded data + * @return decode binary data; 3 bytes for every 4 chars - minus padding + * @throws IOException is thrown, if an I/O error occurs reading the data + */ + public static byte[] decode(String encoded) + throws IOException { + return decode(encoded, 0, encoded.length()); + } + + /** + * Converts an embedded Base64 encoded string to a byte array. + * + * @param encoded a String with Base64 data embedded in it + * @param offset which char of the String to start at + * @param length how many chars to decode; must be a multiple of 4 + * @return decode binary data; 3 bytes for every 4 chars - minus padding + * @throws IOException is thrown, if an I/O error occurs reading the data + */ + public static byte[] decode(String encoded, int offset, int length) + throws IOException { + int i; + int decodedLen; + byte[] decoded; + + // the input must be a multiple of 4 + if (length % 4 != 0) { + throw new IOException( + "Base64 string length is not multiple of 4"); + } + + // 4 chars for 3 bytes, but there may have been pad bytes + decodedLen = length / 4 * 3; + if (encoded.charAt(offset + length - 1) == '=') { + decodedLen--; + if (encoded.charAt(offset + length - 2) == '=') { + decodedLen--; + } + } + + decoded = new byte[decodedLen]; + for (i = 0, decodedLen = 0; i < length; i += 4, decodedLen += 3) { + decodeQuantum(encoded.charAt(offset + i), + encoded.charAt(offset + i + 1), + encoded.charAt(offset + i + 2), + encoded.charAt(offset + i + 3), + decoded, decodedLen); + } + + return decoded; + } + + /** + * Decode 4 Base64 chars as 1, 2, or 3 bytes of data. + * + * @param in1 first char of quantum to decode + * @param in2 second char of quantum to decode + * @param in3 third char of quantum to decode + * @param in4 forth char of quantum to decode + * @param out buffer to put the output in + * @param outOffset where in the output buffer to put the bytes + */ + private static void decodeQuantum(char in1, char in2, char in3, char in4, + byte[] out, int outOffset) + throws IOException { + int a = 0, b = 0, c = 0, d = 0; + int pad = 0; + + a = valueDecoding[in1 & 127]; + b = valueDecoding[in2 & 127]; + + if (in4 == '=') { + pad++; + if (in3 == '=') { + pad++; + } else { + c = valueDecoding[in3 & 127]; + } + } else { + c = valueDecoding[in3 & 127]; + d = valueDecoding[in4 & 127]; + } + + if (a < 0 || b < 0 || c < 0 || d < 0) { + throw new IOException("Invalid character in Base64 string"); + } + + // the first byte is the 6 bits of a and 2 bits of b + out[outOffset] = (byte) (((a << 2) & 0xfc) | ((b >>> 4) & 3)); + + if (pad < 2) { + // the second byte is 4 bits of b and 4 bits of c + out[outOffset + 1] = (byte) (((b << 4) & 0xf0) | ((c >>> 2) & 0xf)); + + if (pad < 1) { + // the third byte is 2 bits of c and 4 bits of d + out[outOffset + 2] = + (byte) (((c << 6) & 0xc0) | (d & 0x3f)); + } + } + } +} diff --git a/mobile/androidapp/app/src/main/java/org/minijvm/activity/bridge/JsonParser.java b/mobile/androidapp/app/src/main/java/org/minijvm/activity/bridge/JsonParser.java index e3318ce1..40f3a990 100644 --- a/mobile/androidapp/app/src/main/java/org/minijvm/activity/bridge/JsonParser.java +++ b/mobile/androidapp/app/src/main/java/org/minijvm/activity/bridge/JsonParser.java @@ -1,49 +1,51 @@ package org.minijvm.activity.bridge; +import android.util.Log; + import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Type; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + -/** - * same as jackson jason - * - * @param - */ public class JsonParser { + private List modules = new ArrayList<>(); - private List modules = new ArrayList(); private InjectableValues injectableValues = null; + ClassLoader classLoader; public JsonParser() { - SimpleModule module = new SimpleModule(); module.addDeserializer(List.class, new StdDeserializer(null) { @Override public Object deserialize(JsonCell p, String types) { - return map2obj(p, ArrayList.class, types); + return JsonParser.this.map2obj(p, ArrayList.class, types); } }); module.addDeserializer(Set.class, new StdDeserializer(null) { @Override public Object deserialize(JsonCell p, String types) { - return map2obj(p, LinkedHashSet.class, types); + return JsonParser.this.map2obj(p, LinkedHashSet.class, types); } }); module.addDeserializer(Map.class, new StdDeserializer(null) { - @Override public Object deserialize(JsonCell p, String types) { - Map map = new HashMap(); - + Map map = new HashMap<>(); if (types == null || types.indexOf(',') < 0) { - JsonMap jsonMap = (JsonMap) p; + JsonMap jsonMap = (JsonMap) p; for (JsonCell key : jsonMap.keySet()) { try { - Object K = map2obj(key, null, null); - Object V = map2obj(jsonMap.get(key), null, null); + Object K = JsonParser.this.map2obj(key, null, null); + Object V = JsonParser.this.map2obj(jsonMap.get(key), null, null); map.put(K, V); } catch (Exception e) { e.printStackTrace(); @@ -51,46 +53,40 @@ public Object deserialize(JsonCell p, String types) { } } else { String qualifier = types.substring(types.indexOf('<') + 1, types.lastIndexOf('>')); - //resolve key value qualifier int left = qualifier.indexOf('<'); int comma = qualifier.indexOf(','); int splitPos = comma; - if (left >= 0 && left < comma) { //the left type contains '<' + if (left >= 0 && left < comma) { int leftCnt = 1; int i; - //find matched right '>' for (i = left + 1; leftCnt > 0; i++) { - ;//start from '<', end with '>' char c = qualifier.charAt(i); - if (c == '<') leftCnt++; - if (c == '>') leftCnt--; + if (c == '<') + leftCnt++; + if (c == '>') + leftCnt--; } splitPos = i; } String keyClassName = qualifier.substring(0, splitPos).trim(); String valueClassName = qualifier.substring(splitPos + 1).trim(); - String keyType = keyClassName; - if (keyType.indexOf('<') >= 0) { + if (keyType.indexOf('<') >= 0) keyType = keyType.substring(0, keyType.indexOf('<')); - } String valueType = valueClassName; - if (valueType.indexOf('<') >= 0) { + if (valueType.indexOf('<') >= 0) valueType = valueType.substring(0, valueType.indexOf('<')); - } keyType = TypeNameConverter.convertTypeNameToClassName(keyType); valueType = TypeNameConverter.convertTypeNameToClassName(valueType); - JsonMap jsonMap = (JsonMap) p; + JsonMap jsonMap = (JsonMap) p; for (JsonCell key : jsonMap.keySet()) { try { - Object K = map2obj(key, Class.forName(keyType, true, classLoader), keyClassName); - if (K instanceof Polymorphic) { - K = map2obj(key, ((Polymorphic) K).getType(), keyClassName); - } - Object V = map2obj(jsonMap.get(key), Class.forName(valueType, true, classLoader), valueClassName); - if (V instanceof Polymorphic) { - V = map2obj(jsonMap.get(key), ((Polymorphic) V).getType(), valueClassName); - } + Object K = JsonParser.this.map2obj(key, Class.forName(keyType, true, JsonParser.this.classLoader), keyClassName); + if (K instanceof JsonParser.Polymorphic) + K = JsonParser.this.map2obj(key, ((Polymorphic) K).getType(), keyClassName); + Object V = JsonParser.this.map2obj(jsonMap.get(key), Class.forName(valueType, true, JsonParser.this.classLoader), valueClassName); + if (V instanceof JsonParser.Polymorphic) + V = JsonParser.this.map2obj(jsonMap.get(key), ((Polymorphic) V).getType(), valueClassName); map.put(K, V); } catch (ClassNotFoundException e) { e.printStackTrace(); @@ -100,31 +96,29 @@ public Object deserialize(JsonCell p, String types) { return map; } }); - registerModule(module); } - public ClassLoader getClassLoader() { - return classLoader; + return this.classLoader; } public void setClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; } - /** - * 多态实现 - */ - public interface Polymorphic { + public static interface Polymorphic { Class getType(); } - public interface JsonCell { - int TYPE_MAP = 0; - int TYPE_LIST = 1; - int TYPE_STRING = 2; - int TYPE_NUMBER = 3; + public static interface JsonCell { + public static final int TYPE_MAP = 0; + + public static final int TYPE_LIST = 1; + + public static final int TYPE_STRING = 2; + + public static final int TYPE_NUMBER = 3; int getType(); } @@ -145,7 +139,7 @@ public static class JsonString implements JsonCell { String str; public JsonString(String s) { - str = s; + this.str = s; } public int getType() { @@ -153,15 +147,15 @@ public int getType() { } public String toString() { - return str; + return this.str; } } - public static class JsonNumber implements JsonCell { //include null too + public static class JsonNumber implements JsonCell { String numStr; public JsonNumber(String s) { - numStr = s; + this.numStr = s; } public int getType() { @@ -169,480 +163,437 @@ public int getType() { } public String toString() { - return numStr; + return this.numStr; } public float asFloat() { - return Float.parseFloat(numStr); + return Float.parseFloat(this.numStr); } public double asDouble() { - return Double.parseDouble(numStr); + return Double.parseDouble(this.numStr); } public int asInt() { - return Integer.parseInt(numStr); + return Integer.parseInt(this.numStr); } public long asLong() { - return Long.parseLong(numStr); + return Long.parseLong(this.numStr); } public byte asByte() { - return Byte.parseByte(numStr); + return Byte.parseByte(this.numStr); } public short asShort() { - return Short.parseShort(numStr); + return Short.parseShort(this.numStr); } public char asChar() { - return numStr.charAt(0); + return this.numStr.charAt(0); } public Object getValue(Class clazz) { - if (clazz == Integer.class || clazz == int.class) { - return Integer.decode(numStr); - } else if (clazz == Float.class || clazz == float.class) { - return Float.valueOf(numStr); - } else if (clazz == Long.class || clazz == long.class) { - return Long.decode(numStr); - } else if (clazz == Double.class || clazz == double.class) { - return Double.valueOf(numStr); - } else if (clazz == Short.class || clazz == short.class) { - return Short.decode(numStr); - } else if (clazz == Byte.class || clazz == byte.class) { - return Byte.decode(numStr); - } else if (clazz == Character.class || clazz == char.class) { - return Character.valueOf(numStr.charAt(0)); - } else if (clazz == Boolean.class || clazz == boolean.class) { - return Boolean.valueOf(numStr); - } else { - //guess - - if (numStr.equals("null")) { - return null; - } - try { - return Integer.valueOf(numStr); - } catch (Exception e) { - } - try { - return Long.valueOf(numStr); - } catch (Exception e) { - } - try { - return Float.valueOf(numStr); - } catch (Exception e) { - } + if (clazz == Integer.class || clazz == int.class) + return Integer.decode(this.numStr); + if (clazz == Float.class || clazz == float.class) + return Float.valueOf(this.numStr); + if (clazz == Long.class || clazz == long.class) + return Long.decode(this.numStr); + if (clazz == Double.class || clazz == double.class) + return Double.valueOf(this.numStr); + if (clazz == Short.class || clazz == short.class) + return Short.decode(this.numStr); + if (clazz == Byte.class || clazz == byte.class) + return Byte.decode(this.numStr); + if (clazz == Character.class || clazz == char.class) + return Character.valueOf(this.numStr.charAt(0)); + if (clazz == Boolean.class || clazz == boolean.class) + return Boolean.valueOf(this.numStr); + if (this.numStr.equalsIgnoreCase("true")) + return Boolean.TRUE; + if (this.numStr.equalsIgnoreCase("false")) + return Boolean.FALSE; + if (this.numStr.equals("null")) + return null; + try { + return Integer.valueOf(this.numStr); + } catch (Exception exception) { try { - return Double.valueOf(numStr); - } catch (Exception e) { + return Long.valueOf(this.numStr); + } catch (Exception exception1) { + try { + return Float.valueOf(this.numStr); + } catch (Exception exception2) { + try { + return Double.valueOf(this.numStr); + } catch (Exception exception3) { + throw new IllegalArgumentException(); + } + } } - throw new IllegalArgumentException(); } } } - public abstract static class StdDeserializer { + public static abstract class StdDeserializer { public StdDeserializer(Class c) { - } - abstract public T deserialize(JsonCell p, String types); + public abstract T deserialize(JsonCell param1JsonCell, String param1String); } public static class SimpleModule { - Map serializeLib = new HashMap<>(); + Map serializeLib = (Map) new HashMap<>(); public SimpleModule addDeserializer(Class key, StdDeserializer value) { - serializeLib.put(key, value); + this.serializeLib.put(key, value); return this; } } - public void registerModule(SimpleModule module) { - modules.add(module); + this.modules.add(module); } private StdDeserializer findDeserializer(Class c) { - for (SimpleModule module : modules) { + for (SimpleModule module : this.modules) { StdDeserializer ds = module.serializeLib.get(c); - if (ds != null) { + if (ds != null) return ds; - } } return null; } - public static class InjectableValues { - Map values = new HashMap<>(); + Map values = (Map) new HashMap<>(); public void addValue(Class c, Object o) { - values.put(c, o); + this.values.put(c, o); } } public void setInjectableValues(InjectableValues values) { - injectableValues = values; + this.injectableValues = values; } - private Object findInjectableValues(Class c) { - if (injectableValues == null) return null; - Object ds = injectableValues.values.get(c); - if (ds != null) { + if (this.injectableValues == null) + return null; + Object ds = this.injectableValues.values.get(c); + if (ds != null) return ds; + return null; + } + + private static Method getMethodByName(String name, Class clazz) { + String mName = "set" + name.substring(0, 1).toUpperCase() + name.substring(1); + Method[] methods = clazz.getMethods(); + for (Method m : methods) { + if (m.getName().equals(mName) && (m.getParameterTypes()).length == 1) + return m; } return null; } + static class ParseToken { + String source; - static private int getNext(String s, int index, StringBuilder sb) { - sb.setLength(0); - int len = s.length(); - while (index < len) { - char ch = s.charAt(index); - if (ch == '\"') {//string - sb.append(ch); - index++; - while ((ch = s.charAt(index)) != '\"') {//string end - if (ch != '\\') {// - sb.append(ch); - } else { - index++; - ch = s.charAt(index); - if (ch == 'r') { - sb.append('\r'); - } else if (ch == 'n') { - sb.append('\n'); - } else if (ch == 't') { - sb.append('\t'); - } else if (ch == 'b') { - sb.append('\b'); - } else if (ch == 'f') { - sb.append('\f'); - } else if (ch == 'u') { - StringBuilder sb2 = new StringBuilder(); - for (int i = 0; i < 4; i++) { - index++; - sb2.append(s.charAt(index)); - } - sb.append((char) Integer.parseInt(sb2.toString(), 16)); - } else { - sb.append(ch); - } - } - index++; - } - sb.append(ch); - index++; - break; - } else if (ch == '{') { - boolean inQuot = false;//if brace in string - int braceCnt = 0;// - while (!((ch = s.charAt(index)) == '}' && braceCnt == 1 && !inQuot)) {// {"ab}cd"} - if (ch == '\"') {//string started - int slash = 0;// - for (int j = index - 1; j >= 0; j--) { - if (s.charAt(j) != '\\') {// process "abc\\\"def" - break; - } - slash++; - } - if (slash % 2 == 0) {// - inQuot = !inQuot; - } - } - // - if (!inQuot) { - if (ch == '{') { - braceCnt++; - } else if (ch == '}') { - braceCnt--; - } - } - sb.append(ch); - index++; - } - sb.append(ch); - index++; + int pos; + + Object parentContainer; + + JsonCell containerKey; + + JsonCell result; + + ParseToken(String source, int pos) { + this.source = source; + this.pos = pos; + } + + ParseToken(String source, int pos, Object parentContainer, JsonCell containerKey) { + this.source = source; + this.pos = pos; + this.parentContainer = parentContainer; + this.containerKey = containerKey; + } + + void skipWhitespace() { + while (this.pos < this.source.length() && Character.isWhitespace(this.source.charAt(this.pos))) + this.pos++; + } + + char currentChar() { + return (this.pos < this.source.length()) ? this.source.charAt(this.pos) : Character.MIN_VALUE; + } + + boolean isEnd() { + return (this.pos >= this.source.length()); + } + + void advance() { + this.pos++; + } + } + + private static void parseAndFillDirect(ParseToken token) { + token.skipWhitespace(); + if (token.isEnd()) + return; + char ch = token.currentChar(); + if (ch == '{') { + JsonMap newMap = new JsonMap<>(); + putIntoContainer(token.parentContainer, token.containerKey, newMap); + parseMapDirect(token, newMap); + } else if (ch == '[') { + JsonList newList = new JsonList<>(); + putIntoContainer(token.parentContainer, token.containerKey, newList); + parseListDirect(token, newList); + } else if (ch == '"') { + parseStringDirect(token); + putIntoContainer(token.parentContainer, token.containerKey, token.result); + } else { + parseNumberDirect(token); + putIntoContainer(token.parentContainer, token.containerKey, token.result); + } + } + + private static void putIntoContainer(Object container, JsonCell key, JsonCell value) { + if (container instanceof JsonMap) { + ((JsonMap) container).put(key, value); + } else if (container instanceof JsonList) { + ((JsonList) container).add(value); + } + } + + private static void parseStringDirect(ParseToken token) { + StringBuilder sb = new StringBuilder(); + token.advance(); + while (!token.isEnd()) { + char ch = token.currentChar(); + if (ch == '"') { + token.advance(); break; - } else if (ch == '[') { - boolean inQuot = false;// - int bracketCnt = 0;// - while (!((ch = s.charAt(index)) == ']' && bracketCnt == 1 && !inQuot)) {// - if (ch == '\"') {// - int slash = 0;// - for (int j = index - 1; j >= 0; j--) { - if (s.charAt(j) != '\\') { - break; - } - slash++; - } - if (slash % 2 == 0) {// - inQuot = !inQuot; - } - } - // - if (!inQuot) { - if (ch == '[') { - bracketCnt++; - } else if (ch == ']') { - bracketCnt--; + } + if (ch == '\\') { + token.advance(); + if (!token.isEnd()) { + ch = token.currentChar(); + if (ch == 'r') { + sb.append('\r'); + } else if (ch == 'n') { + sb.append('\n'); + } else if (ch == 't') { + sb.append('\t'); + } else if (ch == 'b') { + sb.append('\b'); + } else if (ch == 'f') { + sb.append('\f'); + } else if (ch == 'u') { + StringBuilder unicode = new StringBuilder(); + for (int i = 0; i < 4 && !token.isEnd(); i++) { + token.advance(); + if (!token.isEnd()) + unicode.append(token.currentChar()); } + sb.append((char) Integer.parseInt(unicode.toString(), 16)); + } else { + sb.append(ch); } - sb.append(ch); - index++; } - sb.append(ch); - index++; - break; - } else if (ch == ' ' || ch == '\r' || ch == '\n' || ch == '\t') { - index++; - } else if (ch == ':') { - sb.append(ch); - index++; - break; - } else if (ch == ',') { - sb.append(ch); - index++; - break; - } else if (ch == '}' || ch == ']') { - break; } else { - while (index < len) { - ch = s.charAt(index); - sb.append(ch); - if (index + 1 < len) { - char nextch = s.charAt(index + 1); - if (nextch == ',' || nextch == ':' || nextch == ']' || nextch == '}') { - break; - } - } - index++; - } - index++; - break; + sb.append(ch); } + token.advance(); } - //System.out.println("parse:" + sb.toString()); - return index; + token.result = new JsonString(sb.toString()); } - - static private JsonMap parseMap(String s, int pos) { - if (s == null || s.charAt(0) != '{') { - return null; - } else { - pos++; - StringBuilder sb = new StringBuilder(); - JsonMap map = new JsonMap(); - while (true) { - //name - pos = getNext(s, pos, sb); - if (sb.length() == 0) { - break; - } -// if (sb.charAt(0) != '"') { -// throw new RuntimeException("[JSON]error: field name need quotation : " + s); -// } - String name = sb.toString();//sb.substring(1, sb.length() - 1); - JsonCell cell = parse(name, 0); - //: - pos = getNext(s, pos, sb); - //value - pos = getNext(s, pos, sb); - String value = sb.toString(); - map.put(cell, parse(value, 0)); - //, - pos = getNext(s, pos, sb); - if (sb.length() == 0) { - break; - } - - } - return map; + private static void parseNumberDirect(ParseToken token) { + StringBuilder sb = new StringBuilder(); + while (!token.isEnd()) { + char ch = token.currentChar(); + if (ch == ',' || ch == '}' || ch == ']' || Character.isWhitespace(ch)) + break; + sb.append(ch); + token.advance(); } + token.result = new JsonNumber(sb.toString()); } - static private JsonList parseList(String s, int pos) { - if (s == null || s.charAt(0) != '[') { - return null; - } else { - pos++; - StringBuilder sb = new StringBuilder(); - JsonList list = new JsonList(); - while (true) { - //value - pos = getNext(s, pos, sb); - if (sb.length() == 0) { - break; - } - String value = sb.toString(); - list.add(parse(value, 0)); - //, - pos = getNext(s, pos, sb); - if (sb.length() == 0) { - break; - } + private static void parseMapDirect(ParseToken token, JsonMap targetMap) { + token.advance(); + while (!token.isEnd()) { + token.skipWhitespace(); + if (token.isEnd() || token.currentChar() == '}') { + if (!token.isEnd()) + token.advance(); + break; } - return list; + parseStringDirect(token); + JsonCell key = token.result; + token.skipWhitespace(); + if (!token.isEnd() && token.currentChar() == ':') + token.advance(); + token.skipWhitespace(); + Object tempParentContainer = token.parentContainer; + JsonCell tempContainerKey = token.containerKey; + token.parentContainer = targetMap; + token.containerKey = key; + parseAndFillDirect(token); + token.parentContainer = tempParentContainer; + token.containerKey = tempContainerKey; + token.skipWhitespace(); + if (!token.isEnd() && token.currentChar() == ',') + token.advance(); + token.skipWhitespace(); } - } - static private Method getMethodByName(String name, Class clazz) { - String mName = "set" + name.substring(0, 1).toUpperCase() + name.substring(1); - Method[] methods = clazz.getMethods(); - for (Method m : methods) { - if (m.getName().equals(mName) && m.getParameterTypes().length == 1) { - return m; + private static void parseListDirect(ParseToken token, JsonList targetList) { + token.advance(); + while (!token.isEnd()) { + token.skipWhitespace(); + if (token.isEnd() || token.currentChar() == ']') { + if (!token.isEnd()) + token.advance(); + break; } + Object tempParentContainer = token.parentContainer; + JsonCell tempContainerKey = token.containerKey; + token.parentContainer = targetList; + token.containerKey = null; + parseAndFillDirect(token); + token.parentContainer = tempParentContainer; + token.containerKey = tempContainerKey; + token.skipWhitespace(); + if (!token.isEnd() && token.currentChar() == ',') + token.advance(); + token.skipWhitespace(); } - return null; } - /** - * @param s - * @return - */ - static public final JsonCell parse(String s, int pos) { + public static final JsonCell parse(String s, int pos) { try { - if (s.length() == 0) { + if (s.length() == 0) return null; - } - s = s.trim(); - char ch = s.charAt(0); + ParseToken token = new ParseToken(s.trim(), 0); + char ch = token.currentChar(); if (ch == '{') { - return parseMap(s, pos); - } else if (ch == '[') { - return parseList(s, pos); - } else if (ch == '"') { - return new JsonString(s.substring(1, s.length() - 1)); - } else { - return new JsonNumber(s); + JsonMap rootMap = new JsonMap<>(); + parseMapDirect(token, rootMap); + return rootMap; + } + if (ch == '[') { + JsonList rootList = new JsonList<>(); + parseListDirect(token, rootList); + return rootList; } + if (ch == '"') { + parseStringDirect(token); + return token.result; + } + parseNumberDirect(token); + return token.result; } catch (Exception ex) { ex.printStackTrace(); + return null; } - return null; } - public Object map2obj(JsonCell json, Class clazz, String types) { - if (json == null) { + if (json == null) return null; - } try { - if (clazz == null && types == null && json.getType() == JsonCell.TYPE_MAP) { + JsonMap map; + JsonList list; + Object ins; + Class clazzQualified; + Field[] fields; + String typevar; + Collection collection; + if (clazz == null && types == null && json.getType() == 0) clazz = Map.class; - } StdDeserializer deser = findDeserializer(clazz); - if (deser != null) { // process list map set + if (deser != null) return deser.deserialize(json, types); - } - //other class switch (json.getType()) { - case JsonCell.TYPE_MAP: { - JsonMap map = (JsonMap) json; - Object ins = findInjectableValues(clazz);//get default value - if (ins == null) ins = clazz.newInstance(); - Field[] fields = clazz.getFields(); + case JsonCell.TYPE_MAP: + map = (JsonMap) json; + ins = findInjectableValues(clazz); + if (ins == null) + ins = clazz.newInstance(); + fields = clazz.getFields(); for (Field f : fields) { - Class c = f.getType(); + Class c = f.getType(); Object o = findInjectableValues(c); - if (o != null) { + if (o != null) f.set(ins, o); - } } for (JsonCell jc : map.keySet()) { - if (jc.getType() != JsonCell.TYPE_STRING) { + if (jc.getType() != 2) throw new RuntimeException("[JSON]error: field name need quotation : " + jc.toString()); - } String fieldName = ((JsonString) jc).toString(); JsonCell childJson = map.get(jc); -// if (fieldName.equals("COLOR_0")) { -// int debug = 1; -// } - Method method = getMethodByName(fieldName, clazz); if (method != null) { Type[] pt = method.getGenericParameterTypes(); - //System.out.println(method); - Class childClazz = method.getParameterTypes()[0]; + Class childClazz = method.getParameterTypes()[0]; try { - method.invoke(ins, map2obj(childJson, childClazz, pt[0].getTypeName())); + method.invoke(ins, new Object[]{map2obj(childJson, childClazz, pt[0].getTypeName())}); } catch (Exception e) { e.printStackTrace(); } - } else { - if (!(ins instanceof Polymorphic)) { - System.out.println("[JSON]warn :" + clazz.getName() + " field '" + fieldName + "' setter not found."); - } + continue; } + if (!(ins instanceof Polymorphic)) + System.out.println("[JSON]" + clazz.getName() + " field '" + fieldName + "' setter not found."); } return ins; - } - case JsonCell.TYPE_LIST: { - - if (types == null) { - System.out.println("[JSON]warn: need type declare , class:" + clazz); - } - - if (clazz == null) { + case JsonCell.TYPE_LIST: + if (types == null) + System.out.println("[JSON] need type declare , class:" + clazz); + if (clazz == null) clazz = ArrayList.class; - } - - JsonList list = (JsonList) json; + list = (JsonList) json; if (clazz.isArray()) { - String typevar = types; - if (typevar != null && typevar.indexOf('[') >= 0) { - typevar = typevar.substring(1); - } - + String str = types; + if (str != null && str.indexOf('[') >= 0) + str = str.substring(1); Object array = Array.newInstance(clazz.getComponentType(), list.size()); int i = 0; for (JsonCell cell : list) { - Object ins = map2obj(cell, clazz.getComponentType(), typevar); - Array.set(array, i, ins); + Object object = map2obj(cell, clazz.getComponentType(), str); + Array.set(array, i, object); i++; } return array; - } else { - Class clazzQualified = null; - String typevar = null; - if (types != null) { - typevar = types; - if (typevar.indexOf('<') > 0) { - typevar = typevar.substring(typevar.indexOf('<') + 1, typevar.length() - 1); - } - String className = typevar; - if (className.indexOf('<') >= 0) { - className = className.substring(0, className.indexOf('<')); - } - clazzQualified = Class.forName(className, true, classLoader); - } - Collection collection = (Collection) clazz.newInstance(); - for (JsonCell cell : list) { - Object ins = map2obj(cell, clazzQualified, typevar); - if (ins instanceof Polymorphic) { - ins = map2obj(cell, ((Polymorphic) ins).getType(), typevar); - } - collection.add(ins); - } - return collection; } - } - case JsonCell.TYPE_STRING: { + clazzQualified = null; + typevar = null; + if (types != null) { + typevar = types; + if (typevar.indexOf('<') > 0) + typevar = typevar.substring(typevar.indexOf('<') + 1, typevar.length() - 1); + String className = typevar; + if (className.indexOf('<') >= 0) + className = className.substring(0, className.indexOf('<')); + clazzQualified = Class.forName(className, true, this.classLoader); + } + collection = (Collection) clazz.newInstance(); + for (JsonCell cell : list) { + Object object = map2obj(cell, clazzQualified, typevar); + if (object instanceof Polymorphic) + object = map2obj(cell, ((Polymorphic) object).getType(), typevar); + collection.add(object); + } + return collection; + case JsonCell.TYPE_STRING: return ((JsonString) json).str; - } - case JsonCell.TYPE_NUMBER: { + case JsonCell.TYPE_NUMBER: return ((JsonNumber) json).getValue(clazz); - } - } } catch (Exception e) { System.err.println("error on parse " + clazz + " , str:" + json.toString()); @@ -651,67 +602,52 @@ public Object map2obj(JsonCell json, Class clazz, String types) { return null; } - public final T deserial(String s, Class clazz) { - if (clazz == null) throw new RuntimeException("Class can't null"); - classLoader = clazz.getClassLoader(); + return deserial(s, clazz, null); + } + + public final T deserial(String s, Class clazz, ClassLoader classLoader) { + return deserial(s, clazz, classLoader, null); + } + + public final T deserial(String s, Class clazz, ClassLoader classLoader, String types) { + if (clazz == null) + throw new RuntimeException("Class can't null"); + if (classLoader == null) + classLoader = Thread.currentThread().getContextClassLoader(); + this.classLoader = classLoader; JsonCell json = parse(s, 0); - return (T) map2obj(json, clazz, null); + return (T) map2obj(json, clazz, types); } - /** - * @param str - * @return true= - */ - static public final boolean isJsonString(String str) { - if (str == null) { + public static final boolean isJsonString(String str) { + if (str == null) return true; - } return (str.startsWith("{") || str.startsWith("[")); } - public static class TypeNameConverter { - - /** - * 将Java类型名称转换为其对应的类名表示形式。 - * "java.lang.String" -> "java.lang.String" - * "java.lang.String[]" -> "[Ljava.lang.String;" - * "int[][]" -> "[[I" - * - * @param typeName 类型名称,如 "java.lang.String" 或 "java.lang.String[]" 或 "int[][]" - * @return 转换后的类名,如 "java.lang.String" 对于数组类型,或者 "[Ljava.lang.String;" 对于非数组类型 - */ public static String convertTypeNameToClassName(String typeName) { if (typeName.endsWith("[]")) { - // 如果是数组类型,则转换为类名表示形式 int arrayDimension = 0; while (typeName.endsWith("[]")) { typeName = typeName.substring(0, typeName.length() - 2); arrayDimension++; } - if (isPrimitiveType(typeName)) { - // 如果是基本类型,使用JVM的内部表示 - return new String(new char[arrayDimension]).replace("\0", "[") + primitiveTypeToInternalForm(typeName); - } else { - // 如果是引用类型,使用标准的类名表示 - return new String(new char[arrayDimension]).replace("\0", "[") + "L" + typeName + ";"; - } - } else { - // 如果是非数组类型,直接返回或转换基本类型 - if (isPrimitiveType(typeName)) { - return primitiveTypeToInternalForm(typeName); - } else { - return typeName; - } + if (isPrimitiveType(typeName)) + return (new String(new char[arrayDimension])).replace("\000", "[") + primitiveTypeToInternalForm(typeName); + return (new String(new char[arrayDimension])).replace("\000", "[") + "L" + typeName + ";"; } + if (isPrimitiveType(typeName)) + return primitiveTypeToInternalForm(typeName); + return typeName; } private static boolean isPrimitiveType(String typeName) { - return typeName.equals("boolean") || typeName.equals("byte") || - typeName.equals("char") || typeName.equals("short") || - typeName.equals("int") || typeName.equals("long") || - typeName.equals("float") || typeName.equals("double"); + return (typeName.equals("boolean") || typeName.equals("byte") || typeName + .equals("char") || typeName.equals("short") || typeName + .equals("int") || typeName.equals("long") || typeName + .equals("float") || typeName.equals("double")); } private static String primitiveTypeToInternalForm(String typeName) { @@ -732,11 +668,8 @@ private static String primitiveTypeToInternalForm(String typeName) { return "F"; case "double": return "D"; - default: - throw new IllegalArgumentException("Invalid primitive type: " + typeName); } + throw new IllegalArgumentException("Invalid primitive type: " + typeName); } - } } - diff --git a/mobile/androidapp/app/src/main/java/org/minijvm/activity/bridge/JsonPrinter.java b/mobile/androidapp/app/src/main/java/org/minijvm/activity/bridge/JsonPrinter.java index 53f24afd..c4591fae 100644 --- a/mobile/androidapp/app/src/main/java/org/minijvm/activity/bridge/JsonPrinter.java +++ b/mobile/androidapp/app/src/main/java/org/minijvm/activity/bridge/JsonPrinter.java @@ -49,7 +49,7 @@ StringBuilder print(Object obj, StringBuilder sb) { e.printStackTrace(); } } else { - System.out.println("[JSON]warn :" + clazz.getName() + " field '" + fieldName + "' getter not found."); + System.out.println("[JSON]" + clazz.getName() + " field '" + fieldName + "' getter not found."); } } sb.append("}"); diff --git a/mobile/androidapp/app/src/main/java/org/minijvm/activity/wxapi/WXPayEntryActivity.java b/mobile/androidapp/app/src/main/java/org/minijvm/activity/wxapi/WXPayEntryActivity.java new file mode 100644 index 00000000..9a50f7e5 --- /dev/null +++ b/mobile/androidapp/app/src/main/java/org/minijvm/activity/wxapi/WXPayEntryActivity.java @@ -0,0 +1,46 @@ +package org.minijvm.activity.wxapi; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.widget.Toast; + +import com.tencent.mm.opensdk.constants.ConstantsAPI; +import com.tencent.mm.opensdk.modelbase.BaseReq; +import com.tencent.mm.opensdk.modelbase.BaseResp; +import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; +import com.tencent.mm.opensdk.openapi.WXAPIFactory; + +import org.minijvm.activity.JvmNativeActivity; + +public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (JvmNativeActivity.sWxApi == null && JvmNativeActivity.sWxAppId != null) { + JvmNativeActivity.sWxApi = WXAPIFactory.createWXAPI(this, JvmNativeActivity.sWxAppId, true); + JvmNativeActivity.sWxApi.registerApp(JvmNativeActivity.sWxAppId); + } + if (JvmNativeActivity.sWxApi != null) { + JvmNativeActivity.sWxApi.handleIntent(getIntent(), this); + } else { + finish(); + } + } + + @Override + public void onReq(BaseReq baseReq) { + } + + @Override + public void onResp(BaseResp baseResp) { + if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) { + int code = baseResp.errCode; + Log.i("wxpay", "code=" + code + ", msg=" + baseResp.errStr); + Toast.makeText(this, code == 0 ? "Pay success" : "Pay failed: " + code, Toast.LENGTH_SHORT).show(); + } + finish(); + } +} + From 8dc87ce77e7527a7aa2f33bd391681dc83a13d62 Mon Sep 17 00:00:00 2001 From: Gust Date: Fri, 5 Dec 2025 22:37:28 +0800 Subject: [PATCH 5/7] update opengl , optimize jsonparser --- .../glfw_gui/c/deps/include/KHR/khrplatform.h | 37 +- desktop/glfw_gui/c/deps/include/glad/glad.c | 1800 ++++++----- desktop/glfw_gui/c/deps/include/glad/glad.h | 623 +++- .../c/deps/include/glad/glad_jni_assist.h | 15 + desktop/glfw_gui/c/jni_gl.c | 2625 ++++++++++++++++- desktop/glfw_gui/c/media.c | 7 +- desktop/glfw_gui/c/media.h | 4 +- .../glfw_gui/java/GenJniCode/GenJniCode.iml | 11 +- .../src/org/mini/jnibuilder/GL_h_2_java.java | 1 + .../src/org/mini/jnibuilder/GL_java_2_c.java | 6 +- .../java/src/main/java/org/mini/gl/GL.java | 251 +- .../java/org/mini/apploader/AppManager.java | 1 + .../java/org/mini/glwrap/GLFrameBuffer.java | 8 +- .../src/main/java/org/mini/gui/GTextBox.java | 44 +- .../java/org/mini/gui/gscript/Stdlib.java | 46 + .../org/mini/layout/guilib/GuiScriptLib.java | 9 +- .../src/main/resource/res/ui/AppManager.xml | 4 +- minijvm/c/jvm/jni_std.c | 13 +- .../main/java/org/mini/json/JsonParser.java | 38 +- mobile/c/gui/glad/glad.c | 630 ++-- mobile/c/gui/jni_gl.c | 26 +- mobile/c/gui/media.c | 27 +- mobile/c/gui/media.h | 2 + .../src/org/mini/jnibuilder/GL_h_2_java.java | 5 +- .../src/org/mini/jnibuilder/GL_java_2_c.java | 40 +- .../mini/jnibuilder/GL_java_2_c_for_cc.java | 5 +- .../jnibuilder/{Util.java => JniUtil.java} | 2 +- .../org/mini/jnibuilder/Nanovg_h_2_java.java | 72 +- .../org/mini/jnibuilder/Nanovg_java_2_c.java | 10 +- .../jnibuilder/Nanovg_java_2_c_for_cc.java | 6 +- mobile/java/glfm_gui/glfm_gui.iml | 2 +- .../src/main/java/org/mini/gl/GL.java | 1 + 32 files changed, 5094 insertions(+), 1277 deletions(-) rename mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/{Util.java => JniUtil.java} (98%) diff --git a/desktop/glfw_gui/c/deps/include/KHR/khrplatform.h b/desktop/glfw_gui/c/deps/include/KHR/khrplatform.h index 975bbffe..01646449 100644 --- a/desktop/glfw_gui/c/deps/include/KHR/khrplatform.h +++ b/desktop/glfw_gui/c/deps/include/KHR/khrplatform.h @@ -90,12 +90,20 @@ * int arg2) KHRONOS_APIATTRIBUTES; */ +#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC) +# define KHRONOS_STATIC 1 +#endif + /*------------------------------------------------------------------------- * Definition of KHRONOS_APICALL *------------------------------------------------------------------------- * This precedes the return type of the function in the function prototype. */ -#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +#if defined(KHRONOS_STATIC) + /* If the preprocessor constant KHRONOS_STATIC is defined, make the + * header compatible with static linking. */ +# define KHRONOS_APICALL +#elif defined(_WIN32) # define KHRONOS_APICALL __declspec(dllimport) #elif defined (__SYMBIAN32__) # define KHRONOS_APICALL IMPORT_C @@ -145,6 +153,20 @@ typedef int64_t khronos_int64_t; typedef uint64_t khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 +/* + * To support platform where unsigned long cannot be used interchangeably with + * inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t. + * Ideally, we could just use (u)intptr_t everywhere, but this could result in + * ABI breakage if khronos_uintptr_t is changed from unsigned long to + * unsigned long long or similar (this results in different C++ name mangling). + * To avoid changes for existing platforms, we restrict usage of intptr_t to + * platforms where the size of a pointer is larger than the size of long. + */ +#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__) +#if __SIZEOF_POINTER__ > __SIZEOF_LONG__ +#define KHRONOS_USE_INTPTR_T +#endif +#endif #elif defined(__VMS ) || defined(__sgi) @@ -227,14 +249,21 @@ typedef unsigned short int khronos_uint16_t; * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears * to be the only LLP64 architecture in current use. */ -#ifdef _WIN64 +#ifdef KHRONOS_USE_INTPTR_T +typedef intptr_t khronos_intptr_t; +typedef uintptr_t khronos_uintptr_t; +#elif defined(_WIN64) typedef signed long long int khronos_intptr_t; typedef unsigned long long int khronos_uintptr_t; -typedef signed long long int khronos_ssize_t; -typedef unsigned long long int khronos_usize_t; #else typedef signed long int khronos_intptr_t; typedef unsigned long int khronos_uintptr_t; +#endif + +#if defined(_WIN64) +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else typedef signed long int khronos_ssize_t; typedef unsigned long int khronos_usize_t; #endif diff --git a/desktop/glfw_gui/c/deps/include/glad/glad.c b/desktop/glfw_gui/c/deps/include/glad/glad.c index 9044ea22..7fad9c0f 100644 --- a/desktop/glfw_gui/c/deps/include/glad/glad.c +++ b/desktop/glfw_gui/c/deps/include/glad/glad.c @@ -1,21 +1,22 @@ /* - OpenGL loader generated by glad 0.1.24a0 on Fri Jun 1 15:44:29 2018. + OpenGL loader generated by glad 0.1.36 on Fri Dec 5 02:18:01 2025. Language/Generator: C/C++ Specification: gl - APIs: gl=3.3 + APIs: gl=4.1 Profile: compatibility Extensions: Loader: True Local files: False Omit khrplatform: False + Reproducible: False Commandline: - --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="" + --profile="compatibility" --api="gl=4.1" --generator="c" --spec="gl" --extensions="" Online: - http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3 + https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D4.1 */ #include @@ -23,9 +24,12 @@ #include #include -static void* get_proc(const char *namez); +extern void* get_proc(const char *namez); #if defined(_WIN32) || defined(__CYGWIN__) +#ifndef _WINDOWS_ +#undef APIENTRY +#endif #include static HMODULE libGL; @@ -54,8 +58,9 @@ int open_gl(void) { #ifndef IS_UWP libGL = LoadLibraryW(L"opengl32.dll"); if(libGL != NULL) { - gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE)GetProcAddress( - libGL, "wglGetProcAddress"); + void (* tmp)(void); + tmp = (void(*)(void)) GetProcAddress(libGL, "wglGetProcAddress"); + gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE) tmp; return gladGetProcAddressPtr != NULL; } #endif @@ -74,7 +79,7 @@ void close_gl(void) { #include static void* libGL; -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__HAIKU__) typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*); static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; #endif @@ -97,7 +102,7 @@ int open_gl(void) { libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL); if(libGL != NULL) { -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) return 1; #else gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL, @@ -119,12 +124,12 @@ void close_gl(void) { } #endif -static +extern void* get_proc(const char *namez) { void* result = NULL; if(libGL == NULL) return NULL; -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__HAIKU__) if(gladGetProcAddressPtr != NULL) { result = gladGetProcAddressPtr(namez); } @@ -151,7 +156,7 @@ int gladLoadGL(void) { return status; } -struct gladGLversionStruct GLVersion; +struct gladGLversionStruct GLVersion = { 0, 0 }; #if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0) #define _GLAD_IS_SOME_NEW_VERSION 1 @@ -171,29 +176,25 @@ static int get_exts(void) { exts = (const char *)glGetString(GL_EXTENSIONS); #ifdef _GLAD_IS_SOME_NEW_VERSION } else { - unsigned int index; + int index; num_exts_i = 0; glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i); if (num_exts_i > 0) { - exts_i = (char **)realloc((void *)exts_i, (size_t)num_exts_i * (sizeof *exts_i)); + exts_i = (char **)malloc((size_t)num_exts_i * (sizeof *exts_i)); } if (exts_i == NULL) { return 0; } - for(index = 0; index < (unsigned)num_exts_i; index++) { + for(index = 0; index < num_exts_i; index++) { const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index); size_t len = strlen(gl_str_tmp); char *local_str = (char*)malloc((len+1) * sizeof(char)); if(local_str != NULL) { -#if _MSC_VER >= 1400 - strncpy_s(local_str, len+1, gl_str_tmp, len); -#else - strncpy(local_str, gl_str_tmp, len+1); -#endif + memcpy(local_str, gl_str_tmp, (len+1) * sizeof(char)); } exts_i[index] = local_str; } @@ -254,742 +255,878 @@ static int has_ext(const char *ext) { return 0; } -int GLAD_GL_VERSION_1_0; -int GLAD_GL_VERSION_1_1; -int GLAD_GL_VERSION_1_2; -int GLAD_GL_VERSION_1_3; -int GLAD_GL_VERSION_1_4; -int GLAD_GL_VERSION_1_5; -int GLAD_GL_VERSION_2_0; -int GLAD_GL_VERSION_2_1; -int GLAD_GL_VERSION_3_0; -int GLAD_GL_VERSION_3_1; -int GLAD_GL_VERSION_3_2; -int GLAD_GL_VERSION_3_3; -PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; -PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui; -PFNGLWINDOWPOS2SPROC glad_glWindowPos2s; -PFNGLWINDOWPOS2IPROC glad_glWindowPos2i; -PFNGLWINDOWPOS2FPROC glad_glWindowPos2f; -PFNGLWINDOWPOS2DPROC glad_glWindowPos2d; -PFNGLVERTEX2FVPROC glad_glVertex2fv; -PFNGLINDEXIPROC glad_glIndexi; -PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; -PFNGLRECTDVPROC glad_glRectdv; -PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; -PFNGLEVALCOORD2DPROC glad_glEvalCoord2d; -PFNGLEVALCOORD2FPROC glad_glEvalCoord2f; -PFNGLINDEXDPROC glad_glIndexd; -PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; -PFNGLINDEXFPROC glad_glIndexf; -PFNGLBINDSAMPLERPROC glad_glBindSampler; -PFNGLLINEWIDTHPROC glad_glLineWidth; -PFNGLCOLORP3UIVPROC glad_glColorP3uiv; -PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v; -PFNGLGETMAPFVPROC glad_glGetMapfv; -PFNGLINDEXSPROC glad_glIndexs; -PFNGLCOMPILESHADERPROC glad_glCompileShader; -PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying; -PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv; -PFNGLINDEXFVPROC glad_glIndexfv; -PFNGLFOGIVPROC glad_glFogiv; -PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; -PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv; -PFNGLLIGHTMODELIVPROC glad_glLightModeliv; -PFNGLCOLOR4UIPROC glad_glColor4ui; -PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv; -PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui; -PFNGLFOGFVPROC glad_glFogfv; -PFNGLVERTEXP4UIPROC glad_glVertexP4ui; -PFNGLENABLEIPROC glad_glEnablei; -PFNGLVERTEX4IVPROC glad_glVertex4iv; -PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv; -PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv; -PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui; -PFNGLCREATESHADERPROC glad_glCreateShader; -PFNGLISBUFFERPROC glad_glIsBuffer; -PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv; -PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; -PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; -PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; -PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; -PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; -PFNGLVERTEX4FVPROC glad_glVertex4fv; -PFNGLBINDTEXTUREPROC glad_glBindTexture; -PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; -PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv; -PFNGLSAMPLEMASKIPROC glad_glSampleMaski; -PFNGLVERTEXP2UIPROC glad_glVertexP2ui; -PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex; -PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv; -PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; -PFNGLPOINTSIZEPROC glad_glPointSize; -PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; -PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; -PFNGLCOLOR4BVPROC glad_glColor4bv; -PFNGLRASTERPOS2FPROC glad_glRasterPos2f; -PFNGLRASTERPOS2DPROC glad_glRasterPos2d; -PFNGLLOADIDENTITYPROC glad_glLoadIdentity; -PFNGLRASTERPOS2IPROC glad_glRasterPos2i; -PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; -PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; -PFNGLCOLOR3BPROC glad_glColor3b; -PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv; -PFNGLEDGEFLAGPROC glad_glEdgeFlag; -PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers; -PFNGLVERTEX3DPROC glad_glVertex3d; -PFNGLVERTEX3FPROC glad_glVertex3f; -PFNGLVERTEX3IPROC glad_glVertex3i; -PFNGLCOLOR3IPROC glad_glColor3i; -PFNGLUNIFORM3FPROC glad_glUniform3f; -PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; -PFNGLCOLOR3SPROC glad_glColor3s; -PFNGLVERTEX3SPROC glad_glVertex3s; -PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui; -PFNGLCOLORMASKIPROC glad_glColorMaski; -PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi; -PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv; -PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; -PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui; -PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv; -PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex; -PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; -PFNGLVERTEX2IVPROC glad_glVertex2iv; -PFNGLCOLOR3SVPROC glad_glColor3sv; -PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; -PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; -PFNGLNORMALPOINTERPROC glad_glNormalPointer; -PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv; -PFNGLVERTEX4SVPROC glad_glVertex4sv; -PFNGLPASSTHROUGHPROC glad_glPassThrough; -PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui; -PFNGLFOGIPROC glad_glFogi; -PFNGLBEGINPROC glad_glBegin; -PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv; -PFNGLCOLOR3UBVPROC glad_glColor3ubv; -PFNGLVERTEXPOINTERPROC glad_glVertexPointer; -PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv; -PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; -PFNGLDRAWARRAYSPROC glad_glDrawArrays; -PFNGLUNIFORM1UIPROC glad_glUniform1ui; -PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d; -PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f; -PFNGLLIGHTFVPROC glad_glLightfv; -PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui; -PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; -PFNGLCLEARPROC glad_glClear; -PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i; -PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName; -PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s; -PFNGLISENABLEDPROC glad_glIsEnabled; -PFNGLSTENCILOPPROC glad_glStencilOp; -PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; -PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; -PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; -PFNGLTRANSLATEFPROC glad_glTranslatef; -PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; -PFNGLTRANSLATEDPROC glad_glTranslated; -PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv; -PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation; -PFNGLTEXIMAGE1DPROC glad_glTexImage1D; -PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv; -PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; -PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv; -PFNGLGETMATERIALFVPROC glad_glGetMaterialfv; -PFNGLGETTEXIMAGEPROC glad_glGetTexImage; -PFNGLFOGCOORDFVPROC glad_glFogCoordfv; -PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv; -PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; -PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v; -PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; -PFNGLINDEXSVPROC glad_glIndexsv; -PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; -PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; -PFNGLVERTEX3IVPROC glad_glVertex3iv; -PFNGLBITMAPPROC glad_glBitmap; -PFNGLMATERIALIPROC glad_glMateriali; -PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; -PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; -PFNGLGETQUERYIVPROC glad_glGetQueryiv; -PFNGLTEXCOORD4FPROC glad_glTexCoord4f; -PFNGLTEXCOORD4DPROC glad_glTexCoord4d; -PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv; -PFNGLTEXCOORD4IPROC glad_glTexCoord4i; -PFNGLMATERIALFPROC glad_glMaterialf; -PFNGLTEXCOORD4SPROC glad_glTexCoord4s; -PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices; -PFNGLISSHADERPROC glad_glIsShader; -PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s; -PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv; -PFNGLVERTEX3DVPROC glad_glVertex3dv; -PFNGLGETINTEGER64VPROC glad_glGetInteger64v; -PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; -PFNGLENABLEPROC glad_glEnable; -PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv; -PFNGLCOLOR4FVPROC glad_glColor4fv; -PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv; -PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv; -PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; -PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv; -PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i; -PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv; -PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv; -PFNGLTEXGENFPROC glad_glTexGenf; -PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv; -PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui; -PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui; -PFNGLGETPOINTERVPROC glad_glGetPointerv; -PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; -PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv; -PFNGLNORMAL3FVPROC glad_glNormal3fv; -PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s; -PFNGLDEPTHRANGEPROC glad_glDepthRange; -PFNGLFRUSTUMPROC glad_glFrustum; -PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv; -PFNGLDRAWBUFFERPROC glad_glDrawBuffer; -PFNGLPUSHMATRIXPROC glad_glPushMatrix; -PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv; -PFNGLORTHOPROC glad_glOrtho; -PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced; -PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv; -PFNGLCLEARINDEXPROC glad_glClearIndex; -PFNGLMAP1DPROC glad_glMap1d; -PFNGLMAP1FPROC glad_glMap1f; -PFNGLFLUSHPROC glad_glFlush; -PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; -PFNGLINDEXIVPROC glad_glIndexiv; -PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv; -PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; -PFNGLPIXELZOOMPROC glad_glPixelZoom; -PFNGLFENCESYNCPROC glad_glFenceSync; -PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; -PFNGLCOLORP3UIPROC glad_glColorP3ui; -PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; -PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender; -PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex; -PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; -PFNGLLIGHTIPROC glad_glLighti; -PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv; -PFNGLLIGHTFPROC glad_glLightf; -PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; -PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; -PFNGLGENSAMPLERSPROC glad_glGenSamplers; -PFNGLCLAMPCOLORPROC glad_glClampColor; -PFNGLUNIFORM4IVPROC glad_glUniform4iv; -PFNGLCLEARSTENCILPROC glad_glClearStencil; -PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv; -PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv; -PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv; -PFNGLGENTEXTURESPROC glad_glGenTextures; -PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv; -PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv; -PFNGLINDEXPOINTERPROC glad_glIndexPointer; -PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; -PFNGLISSYNCPROC glad_glIsSync; -PFNGLVERTEX2FPROC glad_glVertex2f; -PFNGLVERTEX2DPROC glad_glVertex2d; -PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; -PFNGLUNIFORM2IPROC glad_glUniform2i; -PFNGLMAPGRID2DPROC glad_glMapGrid2d; -PFNGLMAPGRID2FPROC glad_glMapGrid2f; -PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui; -PFNGLVERTEX2IPROC glad_glVertex2i; -PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; -PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; -PFNGLVERTEX2SPROC glad_glVertex2s; -PFNGLNORMAL3BVPROC glad_glNormal3bv; -PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; -PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange; -PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv; -PFNGLVERTEX3SVPROC glad_glVertex3sv; -PFNGLGENQUERIESPROC glad_glGenQueries; -PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv; -PFNGLTEXENVFPROC glad_glTexEnvf; -PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui; -PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; -PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v; -PFNGLFOGCOORDDPROC glad_glFogCoordd; -PFNGLFOGCOORDFPROC glad_glFogCoordf; -PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; -PFNGLTEXENVIPROC glad_glTexEnvi; -PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv; -PFNGLISENABLEDIPROC glad_glIsEnabledi; -PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui; -PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i; -PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed; -PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv; -PFNGLUNIFORM2IVPROC glad_glUniform2iv; -PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; -PFNGLUNIFORM4UIVPROC glad_glUniform4uiv; -PFNGLMATRIXMODEPROC glad_glMatrixMode; -PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer; -PFNGLGETMAPIVPROC glad_glGetMapiv; -PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; -PFNGLGETSHADERIVPROC glad_glGetShaderiv; -PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d; -PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f; -PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation; -PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures; -PFNGLCALLLISTPROC glad_glCallList; -PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv; -PFNGLGETDOUBLEVPROC glad_glGetDoublev; -PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv; -PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; -PFNGLLIGHTMODELFPROC glad_glLightModelf; -PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; -PFNGLVERTEX2SVPROC glad_glVertex2sv; -PFNGLLIGHTMODELIPROC glad_glLightModeli; -PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv; -PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv; -PFNGLUNIFORM3FVPROC glad_glUniform3fv; -PFNGLPIXELSTOREIPROC glad_glPixelStorei; -PFNGLCALLLISTSPROC glad_glCallLists; -PFNGLMAPBUFFERPROC glad_glMapBuffer; -PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d; -PFNGLTEXCOORD3IPROC glad_glTexCoord3i; -PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv; -PFNGLRASTERPOS3IPROC glad_glRasterPos3i; -PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b; -PFNGLRASTERPOS3DPROC glad_glRasterPos3d; -PFNGLRASTERPOS3FPROC glad_glRasterPos3f; -PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; -PFNGLTEXCOORD3FPROC glad_glTexCoord3f; -PFNGLDELETESYNCPROC glad_glDeleteSync; -PFNGLTEXCOORD3DPROC glad_glTexCoord3d; -PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample; -PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; -PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; -PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; -PFNGLTEXCOORD3SPROC glad_glTexCoord3s; -PFNGLUNIFORM3IVPROC glad_glUniform3iv; -PFNGLRASTERPOS3SPROC glad_glRasterPos3s; -PFNGLPOLYGONMODEPROC glad_glPolygonMode; -PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; -PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv; -PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident; -PFNGLISLISTPROC glad_glIsList; -PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv; -PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv; -PFNGLCOLOR4SPROC glad_glColor4s; -PFNGLUSEPROGRAMPROC glad_glUseProgram; -PFNGLLINESTIPPLEPROC glad_glLineStipple; -PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv; -PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; -PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; -PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv; -PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; -PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; -PFNGLCOLOR4BPROC glad_glColor4b; -PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f; -PFNGLCOLOR4FPROC glad_glColor4f; -PFNGLCOLOR4DPROC glad_glColor4d; -PFNGLCOLOR4IPROC glad_glColor4i; -PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv; -PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex; -PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv; -PFNGLVERTEX2DVPROC glad_glVertex2dv; -PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv; -PFNGLUNIFORM2UIVPROC glad_glUniform2uiv; -PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; -PFNGLFINISHPROC glad_glFinish; -PFNGLGETBOOLEANVPROC glad_glGetBooleanv; -PFNGLDELETESHADERPROC glad_glDeleteShader; -PFNGLDRAWELEMENTSPROC glad_glDrawElements; -PFNGLRASTERPOS2SPROC glad_glRasterPos2s; -PFNGLGETMAPDVPROC glad_glGetMapdv; -PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; -PFNGLMATERIALFVPROC glad_glMaterialfv; -PFNGLVIEWPORTPROC glad_glViewport; -PFNGLUNIFORM1UIVPROC glad_glUniform1uiv; -PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings; -PFNGLINDEXDVPROC glad_glIndexdv; -PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; -PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv; -PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i; -PFNGLCLEARDEPTHPROC glad_glClearDepth; -PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv; -PFNGLTEXPARAMETERFPROC glad_glTexParameterf; -PFNGLTEXPARAMETERIPROC glad_glTexParameteri; -PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; -PFNGLTEXBUFFERPROC glad_glTexBuffer; -PFNGLPOPNAMEPROC glad_glPopName; -PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; -PFNGLPIXELSTOREFPROC glad_glPixelStoref; -PFNGLUNIFORM3UIVPROC glad_glUniform3uiv; -PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv; -PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv; -PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv; -PFNGLRECTIPROC glad_glRecti; -PFNGLCOLOR4UBPROC glad_glColor4ub; -PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf; -PFNGLRECTFPROC glad_glRectf; -PFNGLRECTDPROC glad_glRectd; -PFNGLNORMAL3SVPROC glad_glNormal3sv; -PFNGLNEWLISTPROC glad_glNewList; -PFNGLCOLOR4USPROC glad_glColor4us; -PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv; -PFNGLLINKPROGRAMPROC glad_glLinkProgram; -PFNGLHINTPROC glad_glHint; -PFNGLRECTSPROC glad_glRects; -PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv; -PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv; -PFNGLGETSTRINGPROC glad_glGetString; -PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv; -PFNGLEDGEFLAGVPROC glad_glEdgeFlagv; -PFNGLDETACHSHADERPROC glad_glDetachShader; -PFNGLSCALEFPROC glad_glScalef; -PFNGLENDQUERYPROC glad_glEndQuery; -PFNGLSCALEDPROC glad_glScaled; -PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer; -PFNGLCOPYPIXELSPROC glad_glCopyPixels; -PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui; -PFNGLPOPATTRIBPROC glad_glPopAttrib; -PFNGLDELETETEXTURESPROC glad_glDeleteTextures; -PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; -PFNGLDELETEQUERIESPROC glad_glDeleteQueries; -PFNGLNORMALP3UIVPROC glad_glNormalP3uiv; -PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; -PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; -PFNGLINITNAMESPROC glad_glInitNames; -PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v; -PFNGLCOLOR3DVPROC glad_glColor3dv; -PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i; -PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; -PFNGLWAITSYNCPROC glad_glWaitSync; -PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; -PFNGLCOLORMATERIALPROC glad_glColorMaterial; -PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; -PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri; -PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf; -PFNGLUNIFORM1FPROC glad_glUniform1f; -PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; -PFNGLRENDERMODEPROC glad_glRenderMode; -PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; -PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv; -PFNGLUNIFORM1IPROC glad_glUniform1i; -PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; -PFNGLUNIFORM3IPROC glad_glUniform3i; -PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi; -PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; -PFNGLDISABLEPROC glad_glDisable; -PFNGLLOGICOPPROC glad_glLogicOp; -PFNGLEVALPOINT2PROC glad_glEvalPoint2; -PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf; -PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i; -PFNGLUNIFORM4UIPROC glad_glUniform4ui; -PFNGLCOLOR3FPROC glad_glColor3f; -PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; -PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv; -PFNGLRECTFVPROC glad_glRectfv; -PFNGLCULLFACEPROC glad_glCullFace; -PFNGLGETLIGHTFVPROC glad_glGetLightfv; -PFNGLCOLOR3DPROC glad_glColor3d; -PFNGLTEXGENDPROC glad_glTexGend; -PFNGLTEXGENIPROC glad_glTexGeni; -PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s; -PFNGLGETSTRINGIPROC glad_glGetStringi; -PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i; -PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f; -PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d; -PFNGLATTACHSHADERPROC glad_glAttachShader; -PFNGLFOGCOORDDVPROC glad_glFogCoorddv; -PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; -PFNGLGETTEXGENFVPROC glad_glGetTexGenfv; -PFNGLQUERYCOUNTERPROC glad_glQueryCounter; -PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer; -PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex; -PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; -PFNGLTEXGENIVPROC glad_glTexGeniv; -PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv; -PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv; -PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture; -PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv; -PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us; -PFNGLNORMALP3UIPROC glad_glNormalP3ui; -PFNGLTEXENVFVPROC glad_glTexEnvfv; -PFNGLREADBUFFERPROC glad_glReadBuffer; -PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv; -PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced; -PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; -PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv; -PFNGLLIGHTMODELFVPROC glad_glLightModelfv; -PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv; -PFNGLDELETELISTSPROC glad_glDeleteLists; -PFNGLGETCLIPPLANEPROC glad_glGetClipPlane; -PFNGLVERTEX4DVPROC glad_glVertex4dv; -PFNGLTEXCOORD2DPROC glad_glTexCoord2d; -PFNGLPOPMATRIXPROC glad_glPopMatrix; -PFNGLTEXCOORD2FPROC glad_glTexCoord2f; -PFNGLCOLOR4IVPROC glad_glColor4iv; -PFNGLINDEXUBVPROC glad_glIndexubv; -PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; -PFNGLTEXCOORD2IPROC glad_glTexCoord2i; -PFNGLRASTERPOS4DPROC glad_glRasterPos4d; -PFNGLRASTERPOS4FPROC glad_glRasterPos4f; -PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; -PFNGLTEXCOORD2SPROC glad_glTexCoord2s; -PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; -PFNGLVERTEX3FVPROC glad_glVertex3fv; -PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv; -PFNGLMATERIALIVPROC glad_glMaterialiv; -PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv; -PFNGLISPROGRAMPROC glad_glIsProgram; -PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; -PFNGLVERTEX4SPROC glad_glVertex4s; -PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; -PFNGLNORMAL3DVPROC glad_glNormal3dv; -PFNGLUNIFORM4IPROC glad_glUniform4i; -PFNGLACTIVETEXTUREPROC glad_glActiveTexture; -PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; -PFNGLROTATEDPROC glad_glRotated; -PFNGLROTATEFPROC glad_glRotatef; -PFNGLVERTEX4IPROC glad_glVertex4i; -PFNGLREADPIXELSPROC glad_glReadPixels; -PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv; -PFNGLLOADNAMEPROC glad_glLoadName; -PFNGLUNIFORM4FPROC glad_glUniform4f; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; -PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; -PFNGLSHADEMODELPROC glad_glShadeModel; -PFNGLMAPGRID1DPROC glad_glMapGrid1d; -PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; -PFNGLMAPGRID1FPROC glad_glMapGrid1f; -PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv; -PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState; -PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv; -PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex; -PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer; -PFNGLALPHAFUNCPROC glad_glAlphaFunc; -PFNGLUNIFORM1IVPROC glad_glUniform1iv; -PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv; -PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; -PFNGLSTENCILFUNCPROC glad_glStencilFunc; -PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv; -PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding; -PFNGLCOLOR4UIVPROC glad_glColor4uiv; -PFNGLRECTIVPROC glad_glRectiv; -PFNGLCOLORP4UIPROC glad_glColorP4ui; -PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv; -PFNGLEVALMESH2PROC glad_glEvalMesh2; -PFNGLEVALMESH1PROC glad_glEvalMesh1; -PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer; -PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; -PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv; -PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv; -PFNGLCOLOR4UBVPROC glad_glColor4ubv; -PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd; -PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf; -PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i; -PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv; -PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; -PFNGLTEXENVIVPROC glad_glTexEnviv; -PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; -PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui; -PFNGLGENBUFFERSPROC glad_glGenBuffers; -PFNGLSELECTBUFFERPROC glad_glSelectBuffer; -PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; -PFNGLPUSHATTRIBPROC glad_glPushAttrib; -PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer; -PFNGLBLENDFUNCPROC glad_glBlendFunc; -PFNGLCREATEPROGRAMPROC glad_glCreateProgram; -PFNGLTEXIMAGE3DPROC glad_glTexImage3D; -PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; -PFNGLLIGHTIVPROC glad_glLightiv; -PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex; -PFNGLTEXGENFVPROC glad_glTexGenfv; -PFNGLENDPROC glad_glEnd; -PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; -PFNGLSCISSORPROC glad_glScissor; -PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv; -PFNGLCLIPPLANEPROC glad_glClipPlane; -PFNGLPUSHNAMEPROC glad_glPushName; -PFNGLTEXGENDVPROC glad_glTexGendv; -PFNGLINDEXUBPROC glad_glIndexub; -PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv; -PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv; -PFNGLRASTERPOS4IPROC glad_glRasterPos4i; -PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd; -PFNGLCLEARCOLORPROC glad_glClearColor; -PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; -PFNGLNORMAL3SPROC glad_glNormal3s; -PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; -PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv; -PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; -PFNGLCOLORP4UIVPROC glad_glColorP4uiv; -PFNGLBLENDCOLORPROC glad_glBlendColor; -PFNGLWINDOWPOS3DPROC glad_glWindowPos3d; -PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv; -PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv; -PFNGLUNIFORM3UIPROC glad_glUniform3ui; -PFNGLCOLOR4DVPROC glad_glColor4dv; -PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv; -PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; -PFNGLUNIFORM2FVPROC glad_glUniform2fv; -PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub; -PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui; -PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv; -PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv; -PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange; -PFNGLNORMAL3IVPROC glad_glNormal3iv; -PFNGLWINDOWPOS3SPROC glad_glWindowPos3s; -PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; -PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv; -PFNGLWINDOWPOS3IPROC glad_glWindowPos3i; -PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s; -PFNGLWINDOWPOS3FPROC glad_glWindowPos3f; -PFNGLCOLOR3USPROC glad_glColor3us; -PFNGLCOLOR3UIVPROC glad_glColor3uiv; -PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; -PFNGLGETLIGHTIVPROC glad_glGetLightiv; -PFNGLDEPTHFUNCPROC glad_glDepthFunc; -PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; -PFNGLLISTBASEPROC glad_glListBase; -PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f; -PFNGLCOLOR3UBPROC glad_glColor3ub; -PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d; -PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv; -PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; -PFNGLCOLOR3UIPROC glad_glColor3ui; -PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i; -PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple; -PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync; -PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui; -PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv; -PFNGLCOLORMASKPROC glad_glColorMask; -PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv; -PFNGLBLENDEQUATIONPROC glad_glBlendEquation; -PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; -PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv; -PFNGLRASTERPOS4SPROC glad_glRasterPos4s; -PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback; -PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; -PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv; -PFNGLCOLOR4SVPROC glad_glColor4sv; -PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib; -PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback; -PFNGLFOGFPROC glad_glFogf; -PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv; -PFNGLISSAMPLERPROC glad_glIsSampler; -PFNGLVERTEXP3UIPROC glad_glVertexP3ui; -PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor; -PFNGLCOLOR3IVPROC glad_glColor3iv; -PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; -PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; -PFNGLTEXCOORD1IPROC glad_glTexCoord1i; -PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; -PFNGLTEXCOORD1DPROC glad_glTexCoord1d; -PFNGLTEXCOORD1FPROC glad_glTexCoord1f; -PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender; -PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState; -PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; -PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; -PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv; -PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; -PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; -PFNGLTEXCOORD1SPROC glad_glTexCoord1s; -PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase; -PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; -PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; -PFNGLGENLISTSPROC glad_glGenLists; -PFNGLCOLOR3BVPROC glad_glColor3bv; -PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange; -PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture; -PFNGLGETTEXGENDVPROC glad_glGetTexGendv; -PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; -PFNGLENDLISTPROC glad_glEndList; -PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv; -PFNGLUNIFORM2UIPROC glad_glUniform2ui; -PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv; -PFNGLCOLOR3USVPROC glad_glColor3usv; -PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv; -PFNGLDISABLEIPROC glad_glDisablei; -PFNGLINDEXMASKPROC glad_glIndexMask; -PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib; -PFNGLSHADERSOURCEPROC glad_glShaderSource; -PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName; -PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv; -PFNGLCLEARACCUMPROC glad_glClearAccum; -PFNGLGETSYNCIVPROC glad_glGetSynciv; -PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv; -PFNGLUNIFORM2FPROC glad_glUniform2f; -PFNGLBEGINQUERYPROC glad_glBeginQuery; -PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex; -PFNGLBINDBUFFERPROC glad_glBindBuffer; -PFNGLMAP2DPROC glad_glMap2d; -PFNGLMAP2FPROC glad_glMap2f; -PFNGLVERTEX4DPROC glad_glVertex4d; -PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; -PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv; -PFNGLBUFFERDATAPROC glad_glBufferData; -PFNGLEVALPOINT1PROC glad_glEvalPoint1; -PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv; -PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv; -PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui; -PFNGLGETERRORPROC glad_glGetError; -PFNGLGETTEXENVIVPROC glad_glGetTexEnviv; -PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; -PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui; -PFNGLGETFLOATVPROC glad_glGetFloatv; -PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; -PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv; -PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; -PFNGLEVALCOORD1DPROC glad_glEvalCoord1d; -PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; -PFNGLEVALCOORD1FPROC glad_glEvalCoord1f; -PFNGLPIXELMAPFVPROC glad_glPixelMapfv; -PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv; -PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv; -PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv; -PFNGLGETINTEGERVPROC glad_glGetIntegerv; -PFNGLACCUMPROC glad_glAccum; -PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; -PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv; -PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv; -PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv; -PFNGLISQUERYPROC glad_glIsQuery; -PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; -PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv; -PFNGLTEXIMAGE2DPROC glad_glTexImage2D; -PFNGLSTENCILMASKPROC glad_glStencilMask; -PFNGLDRAWPIXELSPROC glad_glDrawPixels; -PFNGLMULTMATRIXDPROC glad_glMultMatrixd; -PFNGLMULTMATRIXFPROC glad_glMultMatrixf; -PFNGLISTEXTUREPROC glad_glIsTexture; -PFNGLGETMATERIALIVPROC glad_glGetMaterialiv; -PFNGLUNIFORM1FVPROC glad_glUniform1fv; -PFNGLLOADMATRIXFPROC glad_glLoadMatrixf; -PFNGLLOADMATRIXDPROC glad_glLoadMatrixd; -PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; -PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; -PFNGLVERTEX4FPROC glad_glVertex4f; -PFNGLRECTSVPROC glad_glRectsv; -PFNGLCOLOR4USVPROC glad_glColor4usv; -PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple; -PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays; -PFNGLNORMAL3IPROC glad_glNormal3i; -PFNGLNORMAL3FPROC glad_glNormal3f; -PFNGLNORMAL3DPROC glad_glNormal3d; -PFNGLNORMAL3BPROC glad_glNormal3b; -PFNGLPIXELMAPUSVPROC glad_glPixelMapusv; -PFNGLGETTEXGENIVPROC glad_glGetTexGeniv; -PFNGLARRAYELEMENTPROC glad_glArrayElement; -PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData; -PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv; -PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; -PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; -PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; -PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v; -PFNGLDEPTHMASKPROC glad_glDepthMask; -PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; -PFNGLCOLOR3FVPROC glad_glColor3fv; -PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample; -PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; -PFNGLUNIFORM4FVPROC glad_glUniform4fv; -PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; -PFNGLCOLORPOINTERPROC glad_glColorPointer; -PFNGLFRONTFACEPROC glad_glFrontFace; -PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v; -PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv; +int GLAD_GL_VERSION_1_0 = 0; +int GLAD_GL_VERSION_1_1 = 0; +int GLAD_GL_VERSION_1_2 = 0; +int GLAD_GL_VERSION_1_3 = 0; +int GLAD_GL_VERSION_1_4 = 0; +int GLAD_GL_VERSION_1_5 = 0; +int GLAD_GL_VERSION_2_0 = 0; +int GLAD_GL_VERSION_2_1 = 0; +int GLAD_GL_VERSION_3_0 = 0; +int GLAD_GL_VERSION_3_1 = 0; +int GLAD_GL_VERSION_3_2 = 0; +int GLAD_GL_VERSION_3_3 = 0; +int GLAD_GL_VERSION_4_0 = 0; +int GLAD_GL_VERSION_4_1 = 0; +PFNGLACCUMPROC glad_glAccum = NULL; +PFNGLACTIVESHADERPROGRAMPROC glad_glActiveShaderProgram = NULL; +PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL; +PFNGLALPHAFUNCPROC glad_glAlphaFunc = NULL; +PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident = NULL; +PFNGLARRAYELEMENTPROC glad_glArrayElement = NULL; +PFNGLATTACHSHADERPROC glad_glAttachShader = NULL; +PFNGLBEGINPROC glad_glBegin = NULL; +PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender = NULL; +PFNGLBEGINQUERYPROC glad_glBeginQuery = NULL; +PFNGLBEGINQUERYINDEXEDPROC glad_glBeginQueryIndexed = NULL; +PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback = NULL; +PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation = NULL; +PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL; +PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase = NULL; +PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange = NULL; +PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation = NULL; +PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed = NULL; +PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer = NULL; +PFNGLBINDPROGRAMPIPELINEPROC glad_glBindProgramPipeline = NULL; +PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer = NULL; +PFNGLBINDSAMPLERPROC glad_glBindSampler = NULL; +PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL; +PFNGLBINDTRANSFORMFEEDBACKPROC glad_glBindTransformFeedback = NULL; +PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray = NULL; +PFNGLBITMAPPROC glad_glBitmap = NULL; +PFNGLBLENDCOLORPROC glad_glBlendColor = NULL; +PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL; +PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate = NULL; +PFNGLBLENDEQUATIONSEPARATEIPROC glad_glBlendEquationSeparatei = NULL; +PFNGLBLENDEQUATIONIPROC glad_glBlendEquationi = NULL; +PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL; +PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL; +PFNGLBLENDFUNCSEPARATEIPROC glad_glBlendFuncSeparatei = NULL; +PFNGLBLENDFUNCIPROC glad_glBlendFunci = NULL; +PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer = NULL; +PFNGLBUFFERDATAPROC glad_glBufferData = NULL; +PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL; +PFNGLCALLLISTPROC glad_glCallList = NULL; +PFNGLCALLLISTSPROC glad_glCallLists = NULL; +PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus = NULL; +PFNGLCLAMPCOLORPROC glad_glClampColor = NULL; +PFNGLCLEARPROC glad_glClear = NULL; +PFNGLCLEARACCUMPROC glad_glClearAccum = NULL; +PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi = NULL; +PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv = NULL; +PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv = NULL; +PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv = NULL; +PFNGLCLEARCOLORPROC glad_glClearColor = NULL; +PFNGLCLEARDEPTHPROC glad_glClearDepth = NULL; +PFNGLCLEARDEPTHFPROC glad_glClearDepthf = NULL; +PFNGLCLEARINDEXPROC glad_glClearIndex = NULL; +PFNGLCLEARSTENCILPROC glad_glClearStencil = NULL; +PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture = NULL; +PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync = NULL; +PFNGLCLIPPLANEPROC glad_glClipPlane = NULL; +PFNGLCOLOR3BPROC glad_glColor3b = NULL; +PFNGLCOLOR3BVPROC glad_glColor3bv = NULL; +PFNGLCOLOR3DPROC glad_glColor3d = NULL; +PFNGLCOLOR3DVPROC glad_glColor3dv = NULL; +PFNGLCOLOR3FPROC glad_glColor3f = NULL; +PFNGLCOLOR3FVPROC glad_glColor3fv = NULL; +PFNGLCOLOR3IPROC glad_glColor3i = NULL; +PFNGLCOLOR3IVPROC glad_glColor3iv = NULL; +PFNGLCOLOR3SPROC glad_glColor3s = NULL; +PFNGLCOLOR3SVPROC glad_glColor3sv = NULL; +PFNGLCOLOR3UBPROC glad_glColor3ub = NULL; +PFNGLCOLOR3UBVPROC glad_glColor3ubv = NULL; +PFNGLCOLOR3UIPROC glad_glColor3ui = NULL; +PFNGLCOLOR3UIVPROC glad_glColor3uiv = NULL; +PFNGLCOLOR3USPROC glad_glColor3us = NULL; +PFNGLCOLOR3USVPROC glad_glColor3usv = NULL; +PFNGLCOLOR4BPROC glad_glColor4b = NULL; +PFNGLCOLOR4BVPROC glad_glColor4bv = NULL; +PFNGLCOLOR4DPROC glad_glColor4d = NULL; +PFNGLCOLOR4DVPROC glad_glColor4dv = NULL; +PFNGLCOLOR4FPROC glad_glColor4f = NULL; +PFNGLCOLOR4FVPROC glad_glColor4fv = NULL; +PFNGLCOLOR4IPROC glad_glColor4i = NULL; +PFNGLCOLOR4IVPROC glad_glColor4iv = NULL; +PFNGLCOLOR4SPROC glad_glColor4s = NULL; +PFNGLCOLOR4SVPROC glad_glColor4sv = NULL; +PFNGLCOLOR4UBPROC glad_glColor4ub = NULL; +PFNGLCOLOR4UBVPROC glad_glColor4ubv = NULL; +PFNGLCOLOR4UIPROC glad_glColor4ui = NULL; +PFNGLCOLOR4UIVPROC glad_glColor4uiv = NULL; +PFNGLCOLOR4USPROC glad_glColor4us = NULL; +PFNGLCOLOR4USVPROC glad_glColor4usv = NULL; +PFNGLCOLORMASKPROC glad_glColorMask = NULL; +PFNGLCOLORMASKIPROC glad_glColorMaski = NULL; +PFNGLCOLORMATERIALPROC glad_glColorMaterial = NULL; +PFNGLCOLORP3UIPROC glad_glColorP3ui = NULL; +PFNGLCOLORP3UIVPROC glad_glColorP3uiv = NULL; +PFNGLCOLORP4UIPROC glad_glColorP4ui = NULL; +PFNGLCOLORP4UIVPROC glad_glColorP4uiv = NULL; +PFNGLCOLORPOINTERPROC glad_glColorPointer = NULL; +PFNGLCOMPILESHADERPROC glad_glCompileShader = NULL; +PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D = NULL; +PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL; +PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D = NULL; +PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData = NULL; +PFNGLCOPYPIXELSPROC glad_glCopyPixels = NULL; +PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D = NULL; +PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL; +PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D = NULL; +PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL; +PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D = NULL; +PFNGLCREATEPROGRAMPROC glad_glCreateProgram = NULL; +PFNGLCREATESHADERPROC glad_glCreateShader = NULL; +PFNGLCREATESHADERPROGRAMVPROC glad_glCreateShaderProgramv = NULL; +PFNGLCULLFACEPROC glad_glCullFace = NULL; +PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL; +PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers = NULL; +PFNGLDELETELISTSPROC glad_glDeleteLists = NULL; +PFNGLDELETEPROGRAMPROC glad_glDeleteProgram = NULL; +PFNGLDELETEPROGRAMPIPELINESPROC glad_glDeleteProgramPipelines = NULL; +PFNGLDELETEQUERIESPROC glad_glDeleteQueries = NULL; +PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers = NULL; +PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers = NULL; +PFNGLDELETESHADERPROC glad_glDeleteShader = NULL; +PFNGLDELETESYNCPROC glad_glDeleteSync = NULL; +PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL; +PFNGLDELETETRANSFORMFEEDBACKSPROC glad_glDeleteTransformFeedbacks = NULL; +PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays = NULL; +PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL; +PFNGLDEPTHMASKPROC glad_glDepthMask = NULL; +PFNGLDEPTHRANGEPROC glad_glDepthRange = NULL; +PFNGLDEPTHRANGEARRAYVPROC glad_glDepthRangeArrayv = NULL; +PFNGLDEPTHRANGEINDEXEDPROC glad_glDepthRangeIndexed = NULL; +PFNGLDEPTHRANGEFPROC glad_glDepthRangef = NULL; +PFNGLDETACHSHADERPROC glad_glDetachShader = NULL; +PFNGLDISABLEPROC glad_glDisable = NULL; +PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState = NULL; +PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray = NULL; +PFNGLDISABLEIPROC glad_glDisablei = NULL; +PFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL; +PFNGLDRAWARRAYSINDIRECTPROC glad_glDrawArraysIndirect = NULL; +PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced = NULL; +PFNGLDRAWBUFFERPROC glad_glDrawBuffer = NULL; +PFNGLDRAWBUFFERSPROC glad_glDrawBuffers = NULL; +PFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL; +PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex = NULL; +PFNGLDRAWELEMENTSINDIRECTPROC glad_glDrawElementsIndirect = NULL; +PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced = NULL; +PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex = NULL; +PFNGLDRAWPIXELSPROC glad_glDrawPixels = NULL; +PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements = NULL; +PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex = NULL; +PFNGLDRAWTRANSFORMFEEDBACKPROC glad_glDrawTransformFeedback = NULL; +PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC glad_glDrawTransformFeedbackStream = NULL; +PFNGLEDGEFLAGPROC glad_glEdgeFlag = NULL; +PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer = NULL; +PFNGLEDGEFLAGVPROC glad_glEdgeFlagv = NULL; +PFNGLENABLEPROC glad_glEnable = NULL; +PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState = NULL; +PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray = NULL; +PFNGLENABLEIPROC glad_glEnablei = NULL; +PFNGLENDPROC glad_glEnd = NULL; +PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender = NULL; +PFNGLENDLISTPROC glad_glEndList = NULL; +PFNGLENDQUERYPROC glad_glEndQuery = NULL; +PFNGLENDQUERYINDEXEDPROC glad_glEndQueryIndexed = NULL; +PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback = NULL; +PFNGLEVALCOORD1DPROC glad_glEvalCoord1d = NULL; +PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv = NULL; +PFNGLEVALCOORD1FPROC glad_glEvalCoord1f = NULL; +PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv = NULL; +PFNGLEVALCOORD2DPROC glad_glEvalCoord2d = NULL; +PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv = NULL; +PFNGLEVALCOORD2FPROC glad_glEvalCoord2f = NULL; +PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv = NULL; +PFNGLEVALMESH1PROC glad_glEvalMesh1 = NULL; +PFNGLEVALMESH2PROC glad_glEvalMesh2 = NULL; +PFNGLEVALPOINT1PROC glad_glEvalPoint1 = NULL; +PFNGLEVALPOINT2PROC glad_glEvalPoint2 = NULL; +PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer = NULL; +PFNGLFENCESYNCPROC glad_glFenceSync = NULL; +PFNGLFINISHPROC glad_glFinish = NULL; +PFNGLFLUSHPROC glad_glFlush = NULL; +PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange = NULL; +PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer = NULL; +PFNGLFOGCOORDDPROC glad_glFogCoordd = NULL; +PFNGLFOGCOORDDVPROC glad_glFogCoorddv = NULL; +PFNGLFOGCOORDFPROC glad_glFogCoordf = NULL; +PFNGLFOGCOORDFVPROC glad_glFogCoordfv = NULL; +PFNGLFOGFPROC glad_glFogf = NULL; +PFNGLFOGFVPROC glad_glFogfv = NULL; +PFNGLFOGIPROC glad_glFogi = NULL; +PFNGLFOGIVPROC glad_glFogiv = NULL; +PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer = NULL; +PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture = NULL; +PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D = NULL; +PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D = NULL; +PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D = NULL; +PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer = NULL; +PFNGLFRONTFACEPROC glad_glFrontFace = NULL; +PFNGLFRUSTUMPROC glad_glFrustum = NULL; +PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL; +PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers = NULL; +PFNGLGENLISTSPROC glad_glGenLists = NULL; +PFNGLGENPROGRAMPIPELINESPROC glad_glGenProgramPipelines = NULL; +PFNGLGENQUERIESPROC glad_glGenQueries = NULL; +PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers = NULL; +PFNGLGENSAMPLERSPROC glad_glGenSamplers = NULL; +PFNGLGENTEXTURESPROC glad_glGenTextures = NULL; +PFNGLGENTRANSFORMFEEDBACKSPROC glad_glGenTransformFeedbacks = NULL; +PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays = NULL; +PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap = NULL; +PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib = NULL; +PFNGLGETACTIVESUBROUTINENAMEPROC glad_glGetActiveSubroutineName = NULL; +PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glad_glGetActiveSubroutineUniformName = NULL; +PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glad_glGetActiveSubroutineUniformiv = NULL; +PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform = NULL; +PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName = NULL; +PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv = NULL; +PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName = NULL; +PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv = NULL; +PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders = NULL; +PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation = NULL; +PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v = NULL; +PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL; +PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v = NULL; +PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL; +PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv = NULL; +PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData = NULL; +PFNGLGETCLIPPLANEPROC glad_glGetClipPlane = NULL; +PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage = NULL; +PFNGLGETDOUBLEI_VPROC glad_glGetDoublei_v = NULL; +PFNGLGETDOUBLEVPROC glad_glGetDoublev = NULL; +PFNGLGETERRORPROC glad_glGetError = NULL; +PFNGLGETFLOATI_VPROC glad_glGetFloati_v = NULL; +PFNGLGETFLOATVPROC glad_glGetFloatv = NULL; +PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex = NULL; +PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation = NULL; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv = NULL; +PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v = NULL; +PFNGLGETINTEGER64VPROC glad_glGetInteger64v = NULL; +PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v = NULL; +PFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL; +PFNGLGETLIGHTFVPROC glad_glGetLightfv = NULL; +PFNGLGETLIGHTIVPROC glad_glGetLightiv = NULL; +PFNGLGETMAPDVPROC glad_glGetMapdv = NULL; +PFNGLGETMAPFVPROC glad_glGetMapfv = NULL; +PFNGLGETMAPIVPROC glad_glGetMapiv = NULL; +PFNGLGETMATERIALFVPROC glad_glGetMaterialfv = NULL; +PFNGLGETMATERIALIVPROC glad_glGetMaterialiv = NULL; +PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv = NULL; +PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv = NULL; +PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv = NULL; +PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv = NULL; +PFNGLGETPOINTERVPROC glad_glGetPointerv = NULL; +PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple = NULL; +PFNGLGETPROGRAMBINARYPROC glad_glGetProgramBinary = NULL; +PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog = NULL; +PFNGLGETPROGRAMPIPELINEINFOLOGPROC glad_glGetProgramPipelineInfoLog = NULL; +PFNGLGETPROGRAMPIPELINEIVPROC glad_glGetProgramPipelineiv = NULL; +PFNGLGETPROGRAMSTAGEIVPROC glad_glGetProgramStageiv = NULL; +PFNGLGETPROGRAMIVPROC glad_glGetProgramiv = NULL; +PFNGLGETQUERYINDEXEDIVPROC glad_glGetQueryIndexediv = NULL; +PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v = NULL; +PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv = NULL; +PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v = NULL; +PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv = NULL; +PFNGLGETQUERYIVPROC glad_glGetQueryiv = NULL; +PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv = NULL; +PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv = NULL; +PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv = NULL; +PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv = NULL; +PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv = NULL; +PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog = NULL; +PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat = NULL; +PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource = NULL; +PFNGLGETSHADERIVPROC glad_glGetShaderiv = NULL; +PFNGLGETSTRINGPROC glad_glGetString = NULL; +PFNGLGETSTRINGIPROC glad_glGetStringi = NULL; +PFNGLGETSUBROUTINEINDEXPROC glad_glGetSubroutineIndex = NULL; +PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC glad_glGetSubroutineUniformLocation = NULL; +PFNGLGETSYNCIVPROC glad_glGetSynciv = NULL; +PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv = NULL; +PFNGLGETTEXENVIVPROC glad_glGetTexEnviv = NULL; +PFNGLGETTEXGENDVPROC glad_glGetTexGendv = NULL; +PFNGLGETTEXGENFVPROC glad_glGetTexGenfv = NULL; +PFNGLGETTEXGENIVPROC glad_glGetTexGeniv = NULL; +PFNGLGETTEXIMAGEPROC glad_glGetTexImage = NULL; +PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv = NULL; +PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv = NULL; +PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv = NULL; +PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv = NULL; +PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL; +PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL; +PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying = NULL; +PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex = NULL; +PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices = NULL; +PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation = NULL; +PFNGLGETUNIFORMSUBROUTINEUIVPROC glad_glGetUniformSubroutineuiv = NULL; +PFNGLGETUNIFORMDVPROC glad_glGetUniformdv = NULL; +PFNGLGETUNIFORMFVPROC glad_glGetUniformfv = NULL; +PFNGLGETUNIFORMIVPROC glad_glGetUniformiv = NULL; +PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv = NULL; +PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv = NULL; +PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv = NULL; +PFNGLGETVERTEXATTRIBLDVPROC glad_glGetVertexAttribLdv = NULL; +PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv = NULL; +PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv = NULL; +PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv = NULL; +PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv = NULL; +PFNGLHINTPROC glad_glHint = NULL; +PFNGLINDEXMASKPROC glad_glIndexMask = NULL; +PFNGLINDEXPOINTERPROC glad_glIndexPointer = NULL; +PFNGLINDEXDPROC glad_glIndexd = NULL; +PFNGLINDEXDVPROC glad_glIndexdv = NULL; +PFNGLINDEXFPROC glad_glIndexf = NULL; +PFNGLINDEXFVPROC glad_glIndexfv = NULL; +PFNGLINDEXIPROC glad_glIndexi = NULL; +PFNGLINDEXIVPROC glad_glIndexiv = NULL; +PFNGLINDEXSPROC glad_glIndexs = NULL; +PFNGLINDEXSVPROC glad_glIndexsv = NULL; +PFNGLINDEXUBPROC glad_glIndexub = NULL; +PFNGLINDEXUBVPROC glad_glIndexubv = NULL; +PFNGLINITNAMESPROC glad_glInitNames = NULL; +PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays = NULL; +PFNGLISBUFFERPROC glad_glIsBuffer = NULL; +PFNGLISENABLEDPROC glad_glIsEnabled = NULL; +PFNGLISENABLEDIPROC glad_glIsEnabledi = NULL; +PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer = NULL; +PFNGLISLISTPROC glad_glIsList = NULL; +PFNGLISPROGRAMPROC glad_glIsProgram = NULL; +PFNGLISPROGRAMPIPELINEPROC glad_glIsProgramPipeline = NULL; +PFNGLISQUERYPROC glad_glIsQuery = NULL; +PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL; +PFNGLISSAMPLERPROC glad_glIsSampler = NULL; +PFNGLISSHADERPROC glad_glIsShader = NULL; +PFNGLISSYNCPROC glad_glIsSync = NULL; +PFNGLISTEXTUREPROC glad_glIsTexture = NULL; +PFNGLISTRANSFORMFEEDBACKPROC glad_glIsTransformFeedback = NULL; +PFNGLISVERTEXARRAYPROC glad_glIsVertexArray = NULL; +PFNGLLIGHTMODELFPROC glad_glLightModelf = NULL; +PFNGLLIGHTMODELFVPROC glad_glLightModelfv = NULL; +PFNGLLIGHTMODELIPROC glad_glLightModeli = NULL; +PFNGLLIGHTMODELIVPROC glad_glLightModeliv = NULL; +PFNGLLIGHTFPROC glad_glLightf = NULL; +PFNGLLIGHTFVPROC glad_glLightfv = NULL; +PFNGLLIGHTIPROC glad_glLighti = NULL; +PFNGLLIGHTIVPROC glad_glLightiv = NULL; +PFNGLLINESTIPPLEPROC glad_glLineStipple = NULL; +PFNGLLINEWIDTHPROC glad_glLineWidth = NULL; +PFNGLLINKPROGRAMPROC glad_glLinkProgram = NULL; +PFNGLLISTBASEPROC glad_glListBase = NULL; +PFNGLLOADIDENTITYPROC glad_glLoadIdentity = NULL; +PFNGLLOADMATRIXDPROC glad_glLoadMatrixd = NULL; +PFNGLLOADMATRIXFPROC glad_glLoadMatrixf = NULL; +PFNGLLOADNAMEPROC glad_glLoadName = NULL; +PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd = NULL; +PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf = NULL; +PFNGLLOGICOPPROC glad_glLogicOp = NULL; +PFNGLMAP1DPROC glad_glMap1d = NULL; +PFNGLMAP1FPROC glad_glMap1f = NULL; +PFNGLMAP2DPROC glad_glMap2d = NULL; +PFNGLMAP2FPROC glad_glMap2f = NULL; +PFNGLMAPBUFFERPROC glad_glMapBuffer = NULL; +PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange = NULL; +PFNGLMAPGRID1DPROC glad_glMapGrid1d = NULL; +PFNGLMAPGRID1FPROC glad_glMapGrid1f = NULL; +PFNGLMAPGRID2DPROC glad_glMapGrid2d = NULL; +PFNGLMAPGRID2FPROC glad_glMapGrid2f = NULL; +PFNGLMATERIALFPROC glad_glMaterialf = NULL; +PFNGLMATERIALFVPROC glad_glMaterialfv = NULL; +PFNGLMATERIALIPROC glad_glMateriali = NULL; +PFNGLMATERIALIVPROC glad_glMaterialiv = NULL; +PFNGLMATRIXMODEPROC glad_glMatrixMode = NULL; +PFNGLMINSAMPLESHADINGPROC glad_glMinSampleShading = NULL; +PFNGLMULTMATRIXDPROC glad_glMultMatrixd = NULL; +PFNGLMULTMATRIXFPROC glad_glMultMatrixf = NULL; +PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd = NULL; +PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf = NULL; +PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays = NULL; +PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements = NULL; +PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex = NULL; +PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d = NULL; +PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv = NULL; +PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f = NULL; +PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv = NULL; +PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i = NULL; +PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv = NULL; +PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s = NULL; +PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv = NULL; +PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d = NULL; +PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv = NULL; +PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f = NULL; +PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv = NULL; +PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i = NULL; +PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv = NULL; +PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s = NULL; +PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv = NULL; +PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d = NULL; +PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv = NULL; +PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f = NULL; +PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv = NULL; +PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i = NULL; +PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv = NULL; +PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s = NULL; +PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv = NULL; +PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d = NULL; +PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv = NULL; +PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f = NULL; +PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv = NULL; +PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i = NULL; +PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv = NULL; +PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s = NULL; +PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv = NULL; +PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui = NULL; +PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv = NULL; +PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui = NULL; +PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv = NULL; +PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui = NULL; +PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv = NULL; +PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui = NULL; +PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv = NULL; +PFNGLNEWLISTPROC glad_glNewList = NULL; +PFNGLNORMAL3BPROC glad_glNormal3b = NULL; +PFNGLNORMAL3BVPROC glad_glNormal3bv = NULL; +PFNGLNORMAL3DPROC glad_glNormal3d = NULL; +PFNGLNORMAL3DVPROC glad_glNormal3dv = NULL; +PFNGLNORMAL3FPROC glad_glNormal3f = NULL; +PFNGLNORMAL3FVPROC glad_glNormal3fv = NULL; +PFNGLNORMAL3IPROC glad_glNormal3i = NULL; +PFNGLNORMAL3IVPROC glad_glNormal3iv = NULL; +PFNGLNORMAL3SPROC glad_glNormal3s = NULL; +PFNGLNORMAL3SVPROC glad_glNormal3sv = NULL; +PFNGLNORMALP3UIPROC glad_glNormalP3ui = NULL; +PFNGLNORMALP3UIVPROC glad_glNormalP3uiv = NULL; +PFNGLNORMALPOINTERPROC glad_glNormalPointer = NULL; +PFNGLORTHOPROC glad_glOrtho = NULL; +PFNGLPASSTHROUGHPROC glad_glPassThrough = NULL; +PFNGLPATCHPARAMETERFVPROC glad_glPatchParameterfv = NULL; +PFNGLPATCHPARAMETERIPROC glad_glPatchParameteri = NULL; +PFNGLPAUSETRANSFORMFEEDBACKPROC glad_glPauseTransformFeedback = NULL; +PFNGLPIXELMAPFVPROC glad_glPixelMapfv = NULL; +PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv = NULL; +PFNGLPIXELMAPUSVPROC glad_glPixelMapusv = NULL; +PFNGLPIXELSTOREFPROC glad_glPixelStoref = NULL; +PFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL; +PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf = NULL; +PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi = NULL; +PFNGLPIXELZOOMPROC glad_glPixelZoom = NULL; +PFNGLPOINTPARAMETERFPROC glad_glPointParameterf = NULL; +PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv = NULL; +PFNGLPOINTPARAMETERIPROC glad_glPointParameteri = NULL; +PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv = NULL; +PFNGLPOINTSIZEPROC glad_glPointSize = NULL; +PFNGLPOLYGONMODEPROC glad_glPolygonMode = NULL; +PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL; +PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple = NULL; +PFNGLPOPATTRIBPROC glad_glPopAttrib = NULL; +PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib = NULL; +PFNGLPOPMATRIXPROC glad_glPopMatrix = NULL; +PFNGLPOPNAMEPROC glad_glPopName = NULL; +PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex = NULL; +PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures = NULL; +PFNGLPROGRAMBINARYPROC glad_glProgramBinary = NULL; +PFNGLPROGRAMPARAMETERIPROC glad_glProgramParameteri = NULL; +PFNGLPROGRAMUNIFORM1DPROC glad_glProgramUniform1d = NULL; +PFNGLPROGRAMUNIFORM1DVPROC glad_glProgramUniform1dv = NULL; +PFNGLPROGRAMUNIFORM1FPROC glad_glProgramUniform1f = NULL; +PFNGLPROGRAMUNIFORM1FVPROC glad_glProgramUniform1fv = NULL; +PFNGLPROGRAMUNIFORM1IPROC glad_glProgramUniform1i = NULL; +PFNGLPROGRAMUNIFORM1IVPROC glad_glProgramUniform1iv = NULL; +PFNGLPROGRAMUNIFORM1UIPROC glad_glProgramUniform1ui = NULL; +PFNGLPROGRAMUNIFORM1UIVPROC glad_glProgramUniform1uiv = NULL; +PFNGLPROGRAMUNIFORM2DPROC glad_glProgramUniform2d = NULL; +PFNGLPROGRAMUNIFORM2DVPROC glad_glProgramUniform2dv = NULL; +PFNGLPROGRAMUNIFORM2FPROC glad_glProgramUniform2f = NULL; +PFNGLPROGRAMUNIFORM2FVPROC glad_glProgramUniform2fv = NULL; +PFNGLPROGRAMUNIFORM2IPROC glad_glProgramUniform2i = NULL; +PFNGLPROGRAMUNIFORM2IVPROC glad_glProgramUniform2iv = NULL; +PFNGLPROGRAMUNIFORM2UIPROC glad_glProgramUniform2ui = NULL; +PFNGLPROGRAMUNIFORM2UIVPROC glad_glProgramUniform2uiv = NULL; +PFNGLPROGRAMUNIFORM3DPROC glad_glProgramUniform3d = NULL; +PFNGLPROGRAMUNIFORM3DVPROC glad_glProgramUniform3dv = NULL; +PFNGLPROGRAMUNIFORM3FPROC glad_glProgramUniform3f = NULL; +PFNGLPROGRAMUNIFORM3FVPROC glad_glProgramUniform3fv = NULL; +PFNGLPROGRAMUNIFORM3IPROC glad_glProgramUniform3i = NULL; +PFNGLPROGRAMUNIFORM3IVPROC glad_glProgramUniform3iv = NULL; +PFNGLPROGRAMUNIFORM3UIPROC glad_glProgramUniform3ui = NULL; +PFNGLPROGRAMUNIFORM3UIVPROC glad_glProgramUniform3uiv = NULL; +PFNGLPROGRAMUNIFORM4DPROC glad_glProgramUniform4d = NULL; +PFNGLPROGRAMUNIFORM4DVPROC glad_glProgramUniform4dv = NULL; +PFNGLPROGRAMUNIFORM4FPROC glad_glProgramUniform4f = NULL; +PFNGLPROGRAMUNIFORM4FVPROC glad_glProgramUniform4fv = NULL; +PFNGLPROGRAMUNIFORM4IPROC glad_glProgramUniform4i = NULL; +PFNGLPROGRAMUNIFORM4IVPROC glad_glProgramUniform4iv = NULL; +PFNGLPROGRAMUNIFORM4UIPROC glad_glProgramUniform4ui = NULL; +PFNGLPROGRAMUNIFORM4UIVPROC glad_glProgramUniform4uiv = NULL; +PFNGLPROGRAMUNIFORMMATRIX2DVPROC glad_glProgramUniformMatrix2dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX2FVPROC glad_glProgramUniformMatrix2fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC glad_glProgramUniformMatrix2x3dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC glad_glProgramUniformMatrix2x3fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC glad_glProgramUniformMatrix2x4dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC glad_glProgramUniformMatrix2x4fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX3DVPROC glad_glProgramUniformMatrix3dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX3FVPROC glad_glProgramUniformMatrix3fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC glad_glProgramUniformMatrix3x2dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC glad_glProgramUniformMatrix3x2fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC glad_glProgramUniformMatrix3x4dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC glad_glProgramUniformMatrix3x4fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX4DVPROC glad_glProgramUniformMatrix4dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX4FVPROC glad_glProgramUniformMatrix4fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC glad_glProgramUniformMatrix4x2dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC glad_glProgramUniformMatrix4x2fv = NULL; +PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC glad_glProgramUniformMatrix4x3dv = NULL; +PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC glad_glProgramUniformMatrix4x3fv = NULL; +PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex = NULL; +PFNGLPUSHATTRIBPROC glad_glPushAttrib = NULL; +PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib = NULL; +PFNGLPUSHMATRIXPROC glad_glPushMatrix = NULL; +PFNGLPUSHNAMEPROC glad_glPushName = NULL; +PFNGLQUERYCOUNTERPROC glad_glQueryCounter = NULL; +PFNGLRASTERPOS2DPROC glad_glRasterPos2d = NULL; +PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv = NULL; +PFNGLRASTERPOS2FPROC glad_glRasterPos2f = NULL; +PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv = NULL; +PFNGLRASTERPOS2IPROC glad_glRasterPos2i = NULL; +PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv = NULL; +PFNGLRASTERPOS2SPROC glad_glRasterPos2s = NULL; +PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv = NULL; +PFNGLRASTERPOS3DPROC glad_glRasterPos3d = NULL; +PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv = NULL; +PFNGLRASTERPOS3FPROC glad_glRasterPos3f = NULL; +PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv = NULL; +PFNGLRASTERPOS3IPROC glad_glRasterPos3i = NULL; +PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv = NULL; +PFNGLRASTERPOS3SPROC glad_glRasterPos3s = NULL; +PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv = NULL; +PFNGLRASTERPOS4DPROC glad_glRasterPos4d = NULL; +PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv = NULL; +PFNGLRASTERPOS4FPROC glad_glRasterPos4f = NULL; +PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv = NULL; +PFNGLRASTERPOS4IPROC glad_glRasterPos4i = NULL; +PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv = NULL; +PFNGLRASTERPOS4SPROC glad_glRasterPos4s = NULL; +PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv = NULL; +PFNGLREADBUFFERPROC glad_glReadBuffer = NULL; +PFNGLREADPIXELSPROC glad_glReadPixels = NULL; +PFNGLRECTDPROC glad_glRectd = NULL; +PFNGLRECTDVPROC glad_glRectdv = NULL; +PFNGLRECTFPROC glad_glRectf = NULL; +PFNGLRECTFVPROC glad_glRectfv = NULL; +PFNGLRECTIPROC glad_glRecti = NULL; +PFNGLRECTIVPROC glad_glRectiv = NULL; +PFNGLRECTSPROC glad_glRects = NULL; +PFNGLRECTSVPROC glad_glRectsv = NULL; +PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler = NULL; +PFNGLRENDERMODEPROC glad_glRenderMode = NULL; +PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage = NULL; +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample = NULL; +PFNGLRESUMETRANSFORMFEEDBACKPROC glad_glResumeTransformFeedback = NULL; +PFNGLROTATEDPROC glad_glRotated = NULL; +PFNGLROTATEFPROC glad_glRotatef = NULL; +PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL; +PFNGLSAMPLEMASKIPROC glad_glSampleMaski = NULL; +PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv = NULL; +PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv = NULL; +PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf = NULL; +PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv = NULL; +PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri = NULL; +PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv = NULL; +PFNGLSCALEDPROC glad_glScaled = NULL; +PFNGLSCALEFPROC glad_glScalef = NULL; +PFNGLSCISSORPROC glad_glScissor = NULL; +PFNGLSCISSORARRAYVPROC glad_glScissorArrayv = NULL; +PFNGLSCISSORINDEXEDPROC glad_glScissorIndexed = NULL; +PFNGLSCISSORINDEXEDVPROC glad_glScissorIndexedv = NULL; +PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b = NULL; +PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv = NULL; +PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d = NULL; +PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv = NULL; +PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f = NULL; +PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv = NULL; +PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i = NULL; +PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv = NULL; +PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s = NULL; +PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv = NULL; +PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub = NULL; +PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv = NULL; +PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui = NULL; +PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv = NULL; +PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us = NULL; +PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv = NULL; +PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui = NULL; +PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv = NULL; +PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer = NULL; +PFNGLSELECTBUFFERPROC glad_glSelectBuffer = NULL; +PFNGLSHADEMODELPROC glad_glShadeModel = NULL; +PFNGLSHADERBINARYPROC glad_glShaderBinary = NULL; +PFNGLSHADERSOURCEPROC glad_glShaderSource = NULL; +PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL; +PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate = NULL; +PFNGLSTENCILMASKPROC glad_glStencilMask = NULL; +PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate = NULL; +PFNGLSTENCILOPPROC glad_glStencilOp = NULL; +PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate = NULL; +PFNGLTEXBUFFERPROC glad_glTexBuffer = NULL; +PFNGLTEXCOORD1DPROC glad_glTexCoord1d = NULL; +PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv = NULL; +PFNGLTEXCOORD1FPROC glad_glTexCoord1f = NULL; +PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv = NULL; +PFNGLTEXCOORD1IPROC glad_glTexCoord1i = NULL; +PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv = NULL; +PFNGLTEXCOORD1SPROC glad_glTexCoord1s = NULL; +PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv = NULL; +PFNGLTEXCOORD2DPROC glad_glTexCoord2d = NULL; +PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv = NULL; +PFNGLTEXCOORD2FPROC glad_glTexCoord2f = NULL; +PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv = NULL; +PFNGLTEXCOORD2IPROC glad_glTexCoord2i = NULL; +PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv = NULL; +PFNGLTEXCOORD2SPROC glad_glTexCoord2s = NULL; +PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv = NULL; +PFNGLTEXCOORD3DPROC glad_glTexCoord3d = NULL; +PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv = NULL; +PFNGLTEXCOORD3FPROC glad_glTexCoord3f = NULL; +PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv = NULL; +PFNGLTEXCOORD3IPROC glad_glTexCoord3i = NULL; +PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv = NULL; +PFNGLTEXCOORD3SPROC glad_glTexCoord3s = NULL; +PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv = NULL; +PFNGLTEXCOORD4DPROC glad_glTexCoord4d = NULL; +PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv = NULL; +PFNGLTEXCOORD4FPROC glad_glTexCoord4f = NULL; +PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv = NULL; +PFNGLTEXCOORD4IPROC glad_glTexCoord4i = NULL; +PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv = NULL; +PFNGLTEXCOORD4SPROC glad_glTexCoord4s = NULL; +PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv = NULL; +PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui = NULL; +PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv = NULL; +PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui = NULL; +PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv = NULL; +PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui = NULL; +PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv = NULL; +PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui = NULL; +PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv = NULL; +PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer = NULL; +PFNGLTEXENVFPROC glad_glTexEnvf = NULL; +PFNGLTEXENVFVPROC glad_glTexEnvfv = NULL; +PFNGLTEXENVIPROC glad_glTexEnvi = NULL; +PFNGLTEXENVIVPROC glad_glTexEnviv = NULL; +PFNGLTEXGENDPROC glad_glTexGend = NULL; +PFNGLTEXGENDVPROC glad_glTexGendv = NULL; +PFNGLTEXGENFPROC glad_glTexGenf = NULL; +PFNGLTEXGENFVPROC glad_glTexGenfv = NULL; +PFNGLTEXGENIPROC glad_glTexGeni = NULL; +PFNGLTEXGENIVPROC glad_glTexGeniv = NULL; +PFNGLTEXIMAGE1DPROC glad_glTexImage1D = NULL; +PFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL; +PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample = NULL; +PFNGLTEXIMAGE3DPROC glad_glTexImage3D = NULL; +PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample = NULL; +PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv = NULL; +PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv = NULL; +PFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL; +PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL; +PFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL; +PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL; +PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D = NULL; +PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL; +PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D = NULL; +PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings = NULL; +PFNGLTRANSLATEDPROC glad_glTranslated = NULL; +PFNGLTRANSLATEFPROC glad_glTranslatef = NULL; +PFNGLUNIFORM1DPROC glad_glUniform1d = NULL; +PFNGLUNIFORM1DVPROC glad_glUniform1dv = NULL; +PFNGLUNIFORM1FPROC glad_glUniform1f = NULL; +PFNGLUNIFORM1FVPROC glad_glUniform1fv = NULL; +PFNGLUNIFORM1IPROC glad_glUniform1i = NULL; +PFNGLUNIFORM1IVPROC glad_glUniform1iv = NULL; +PFNGLUNIFORM1UIPROC glad_glUniform1ui = NULL; +PFNGLUNIFORM1UIVPROC glad_glUniform1uiv = NULL; +PFNGLUNIFORM2DPROC glad_glUniform2d = NULL; +PFNGLUNIFORM2DVPROC glad_glUniform2dv = NULL; +PFNGLUNIFORM2FPROC glad_glUniform2f = NULL; +PFNGLUNIFORM2FVPROC glad_glUniform2fv = NULL; +PFNGLUNIFORM2IPROC glad_glUniform2i = NULL; +PFNGLUNIFORM2IVPROC glad_glUniform2iv = NULL; +PFNGLUNIFORM2UIPROC glad_glUniform2ui = NULL; +PFNGLUNIFORM2UIVPROC glad_glUniform2uiv = NULL; +PFNGLUNIFORM3DPROC glad_glUniform3d = NULL; +PFNGLUNIFORM3DVPROC glad_glUniform3dv = NULL; +PFNGLUNIFORM3FPROC glad_glUniform3f = NULL; +PFNGLUNIFORM3FVPROC glad_glUniform3fv = NULL; +PFNGLUNIFORM3IPROC glad_glUniform3i = NULL; +PFNGLUNIFORM3IVPROC glad_glUniform3iv = NULL; +PFNGLUNIFORM3UIPROC glad_glUniform3ui = NULL; +PFNGLUNIFORM3UIVPROC glad_glUniform3uiv = NULL; +PFNGLUNIFORM4DPROC glad_glUniform4d = NULL; +PFNGLUNIFORM4DVPROC glad_glUniform4dv = NULL; +PFNGLUNIFORM4FPROC glad_glUniform4f = NULL; +PFNGLUNIFORM4FVPROC glad_glUniform4fv = NULL; +PFNGLUNIFORM4IPROC glad_glUniform4i = NULL; +PFNGLUNIFORM4IVPROC glad_glUniform4iv = NULL; +PFNGLUNIFORM4UIPROC glad_glUniform4ui = NULL; +PFNGLUNIFORM4UIVPROC glad_glUniform4uiv = NULL; +PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding = NULL; +PFNGLUNIFORMMATRIX2DVPROC glad_glUniformMatrix2dv = NULL; +PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv = NULL; +PFNGLUNIFORMMATRIX2X3DVPROC glad_glUniformMatrix2x3dv = NULL; +PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv = NULL; +PFNGLUNIFORMMATRIX2X4DVPROC glad_glUniformMatrix2x4dv = NULL; +PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv = NULL; +PFNGLUNIFORMMATRIX3DVPROC glad_glUniformMatrix3dv = NULL; +PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv = NULL; +PFNGLUNIFORMMATRIX3X2DVPROC glad_glUniformMatrix3x2dv = NULL; +PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv = NULL; +PFNGLUNIFORMMATRIX3X4DVPROC glad_glUniformMatrix3x4dv = NULL; +PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv = NULL; +PFNGLUNIFORMMATRIX4DVPROC glad_glUniformMatrix4dv = NULL; +PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv = NULL; +PFNGLUNIFORMMATRIX4X2DVPROC glad_glUniformMatrix4x2dv = NULL; +PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv = NULL; +PFNGLUNIFORMMATRIX4X3DVPROC glad_glUniformMatrix4x3dv = NULL; +PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv = NULL; +PFNGLUNIFORMSUBROUTINESUIVPROC glad_glUniformSubroutinesuiv = NULL; +PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer = NULL; +PFNGLUSEPROGRAMPROC glad_glUseProgram = NULL; +PFNGLUSEPROGRAMSTAGESPROC glad_glUseProgramStages = NULL; +PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram = NULL; +PFNGLVALIDATEPROGRAMPIPELINEPROC glad_glValidateProgramPipeline = NULL; +PFNGLVERTEX2DPROC glad_glVertex2d = NULL; +PFNGLVERTEX2DVPROC glad_glVertex2dv = NULL; +PFNGLVERTEX2FPROC glad_glVertex2f = NULL; +PFNGLVERTEX2FVPROC glad_glVertex2fv = NULL; +PFNGLVERTEX2IPROC glad_glVertex2i = NULL; +PFNGLVERTEX2IVPROC glad_glVertex2iv = NULL; +PFNGLVERTEX2SPROC glad_glVertex2s = NULL; +PFNGLVERTEX2SVPROC glad_glVertex2sv = NULL; +PFNGLVERTEX3DPROC glad_glVertex3d = NULL; +PFNGLVERTEX3DVPROC glad_glVertex3dv = NULL; +PFNGLVERTEX3FPROC glad_glVertex3f = NULL; +PFNGLVERTEX3FVPROC glad_glVertex3fv = NULL; +PFNGLVERTEX3IPROC glad_glVertex3i = NULL; +PFNGLVERTEX3IVPROC glad_glVertex3iv = NULL; +PFNGLVERTEX3SPROC glad_glVertex3s = NULL; +PFNGLVERTEX3SVPROC glad_glVertex3sv = NULL; +PFNGLVERTEX4DPROC glad_glVertex4d = NULL; +PFNGLVERTEX4DVPROC glad_glVertex4dv = NULL; +PFNGLVERTEX4FPROC glad_glVertex4f = NULL; +PFNGLVERTEX4FVPROC glad_glVertex4fv = NULL; +PFNGLVERTEX4IPROC glad_glVertex4i = NULL; +PFNGLVERTEX4IVPROC glad_glVertex4iv = NULL; +PFNGLVERTEX4SPROC glad_glVertex4s = NULL; +PFNGLVERTEX4SVPROC glad_glVertex4sv = NULL; +PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d = NULL; +PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv = NULL; +PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f = NULL; +PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv = NULL; +PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s = NULL; +PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv = NULL; +PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d = NULL; +PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv = NULL; +PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f = NULL; +PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv = NULL; +PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s = NULL; +PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv = NULL; +PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d = NULL; +PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv = NULL; +PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f = NULL; +PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv = NULL; +PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s = NULL; +PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv = NULL; +PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv = NULL; +PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv = NULL; +PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv = NULL; +PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub = NULL; +PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv = NULL; +PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv = NULL; +PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv = NULL; +PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv = NULL; +PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d = NULL; +PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv = NULL; +PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f = NULL; +PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv = NULL; +PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv = NULL; +PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s = NULL; +PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv = NULL; +PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv = NULL; +PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv = NULL; +PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv = NULL; +PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor = NULL; +PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i = NULL; +PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv = NULL; +PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui = NULL; +PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv = NULL; +PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i = NULL; +PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv = NULL; +PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui = NULL; +PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv = NULL; +PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i = NULL; +PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv = NULL; +PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui = NULL; +PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv = NULL; +PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv = NULL; +PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i = NULL; +PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv = NULL; +PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv = NULL; +PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv = NULL; +PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui = NULL; +PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv = NULL; +PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv = NULL; +PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer = NULL; +PFNGLVERTEXATTRIBL1DPROC glad_glVertexAttribL1d = NULL; +PFNGLVERTEXATTRIBL1DVPROC glad_glVertexAttribL1dv = NULL; +PFNGLVERTEXATTRIBL2DPROC glad_glVertexAttribL2d = NULL; +PFNGLVERTEXATTRIBL2DVPROC glad_glVertexAttribL2dv = NULL; +PFNGLVERTEXATTRIBL3DPROC glad_glVertexAttribL3d = NULL; +PFNGLVERTEXATTRIBL3DVPROC glad_glVertexAttribL3dv = NULL; +PFNGLVERTEXATTRIBL4DPROC glad_glVertexAttribL4d = NULL; +PFNGLVERTEXATTRIBL4DVPROC glad_glVertexAttribL4dv = NULL; +PFNGLVERTEXATTRIBLPOINTERPROC glad_glVertexAttribLPointer = NULL; +PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui = NULL; +PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv = NULL; +PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui = NULL; +PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv = NULL; +PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui = NULL; +PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv = NULL; +PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui = NULL; +PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv = NULL; +PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL; +PFNGLVERTEXP2UIPROC glad_glVertexP2ui = NULL; +PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv = NULL; +PFNGLVERTEXP3UIPROC glad_glVertexP3ui = NULL; +PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv = NULL; +PFNGLVERTEXP4UIPROC glad_glVertexP4ui = NULL; +PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv = NULL; +PFNGLVERTEXPOINTERPROC glad_glVertexPointer = NULL; +PFNGLVIEWPORTPROC glad_glViewport = NULL; +PFNGLVIEWPORTARRAYVPROC glad_glViewportArrayv = NULL; +PFNGLVIEWPORTINDEXEDFPROC glad_glViewportIndexedf = NULL; +PFNGLVIEWPORTINDEXEDFVPROC glad_glViewportIndexedfv = NULL; +PFNGLWAITSYNCPROC glad_glWaitSync = NULL; +PFNGLWINDOWPOS2DPROC glad_glWindowPos2d = NULL; +PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv = NULL; +PFNGLWINDOWPOS2FPROC glad_glWindowPos2f = NULL; +PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv = NULL; +PFNGLWINDOWPOS2IPROC glad_glWindowPos2i = NULL; +PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv = NULL; +PFNGLWINDOWPOS2SPROC glad_glWindowPos2s = NULL; +PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv = NULL; +PFNGLWINDOWPOS3DPROC glad_glWindowPos3d = NULL; +PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv = NULL; +PFNGLWINDOWPOS3FPROC glad_glWindowPos3f = NULL; +PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv = NULL; +PFNGLWINDOWPOS3IPROC glad_glWindowPos3i = NULL; +PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv = NULL; +PFNGLWINDOWPOS3SPROC glad_glWindowPos3s = NULL; +PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv = NULL; static void load_GL_VERSION_1_0(GLADloadproc load) { if(!GLAD_GL_VERSION_1_0) return; glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); @@ -1753,6 +1890,147 @@ static void load_GL_VERSION_3_3(GLADloadproc load) { glad_glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC)load("glSecondaryColorP3ui"); glad_glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC)load("glSecondaryColorP3uiv"); } +static void load_GL_VERSION_4_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_4_0) return; + glad_glMinSampleShading = (PFNGLMINSAMPLESHADINGPROC)load("glMinSampleShading"); + glad_glBlendEquationi = (PFNGLBLENDEQUATIONIPROC)load("glBlendEquationi"); + glad_glBlendEquationSeparatei = (PFNGLBLENDEQUATIONSEPARATEIPROC)load("glBlendEquationSeparatei"); + glad_glBlendFunci = (PFNGLBLENDFUNCIPROC)load("glBlendFunci"); + glad_glBlendFuncSeparatei = (PFNGLBLENDFUNCSEPARATEIPROC)load("glBlendFuncSeparatei"); + glad_glDrawArraysIndirect = (PFNGLDRAWARRAYSINDIRECTPROC)load("glDrawArraysIndirect"); + glad_glDrawElementsIndirect = (PFNGLDRAWELEMENTSINDIRECTPROC)load("glDrawElementsIndirect"); + glad_glUniform1d = (PFNGLUNIFORM1DPROC)load("glUniform1d"); + glad_glUniform2d = (PFNGLUNIFORM2DPROC)load("glUniform2d"); + glad_glUniform3d = (PFNGLUNIFORM3DPROC)load("glUniform3d"); + glad_glUniform4d = (PFNGLUNIFORM4DPROC)load("glUniform4d"); + glad_glUniform1dv = (PFNGLUNIFORM1DVPROC)load("glUniform1dv"); + glad_glUniform2dv = (PFNGLUNIFORM2DVPROC)load("glUniform2dv"); + glad_glUniform3dv = (PFNGLUNIFORM3DVPROC)load("glUniform3dv"); + glad_glUniform4dv = (PFNGLUNIFORM4DVPROC)load("glUniform4dv"); + glad_glUniformMatrix2dv = (PFNGLUNIFORMMATRIX2DVPROC)load("glUniformMatrix2dv"); + glad_glUniformMatrix3dv = (PFNGLUNIFORMMATRIX3DVPROC)load("glUniformMatrix3dv"); + glad_glUniformMatrix4dv = (PFNGLUNIFORMMATRIX4DVPROC)load("glUniformMatrix4dv"); + glad_glUniformMatrix2x3dv = (PFNGLUNIFORMMATRIX2X3DVPROC)load("glUniformMatrix2x3dv"); + glad_glUniformMatrix2x4dv = (PFNGLUNIFORMMATRIX2X4DVPROC)load("glUniformMatrix2x4dv"); + glad_glUniformMatrix3x2dv = (PFNGLUNIFORMMATRIX3X2DVPROC)load("glUniformMatrix3x2dv"); + glad_glUniformMatrix3x4dv = (PFNGLUNIFORMMATRIX3X4DVPROC)load("glUniformMatrix3x4dv"); + glad_glUniformMatrix4x2dv = (PFNGLUNIFORMMATRIX4X2DVPROC)load("glUniformMatrix4x2dv"); + glad_glUniformMatrix4x3dv = (PFNGLUNIFORMMATRIX4X3DVPROC)load("glUniformMatrix4x3dv"); + glad_glGetUniformdv = (PFNGLGETUNIFORMDVPROC)load("glGetUniformdv"); + glad_glGetSubroutineUniformLocation = (PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC)load("glGetSubroutineUniformLocation"); + glad_glGetSubroutineIndex = (PFNGLGETSUBROUTINEINDEXPROC)load("glGetSubroutineIndex"); + glad_glGetActiveSubroutineUniformiv = (PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC)load("glGetActiveSubroutineUniformiv"); + glad_glGetActiveSubroutineUniformName = (PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)load("glGetActiveSubroutineUniformName"); + glad_glGetActiveSubroutineName = (PFNGLGETACTIVESUBROUTINENAMEPROC)load("glGetActiveSubroutineName"); + glad_glUniformSubroutinesuiv = (PFNGLUNIFORMSUBROUTINESUIVPROC)load("glUniformSubroutinesuiv"); + glad_glGetUniformSubroutineuiv = (PFNGLGETUNIFORMSUBROUTINEUIVPROC)load("glGetUniformSubroutineuiv"); + glad_glGetProgramStageiv = (PFNGLGETPROGRAMSTAGEIVPROC)load("glGetProgramStageiv"); + glad_glPatchParameteri = (PFNGLPATCHPARAMETERIPROC)load("glPatchParameteri"); + glad_glPatchParameterfv = (PFNGLPATCHPARAMETERFVPROC)load("glPatchParameterfv"); + glad_glBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC)load("glBindTransformFeedback"); + glad_glDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC)load("glDeleteTransformFeedbacks"); + glad_glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC)load("glGenTransformFeedbacks"); + glad_glIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC)load("glIsTransformFeedback"); + glad_glPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC)load("glPauseTransformFeedback"); + glad_glResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC)load("glResumeTransformFeedback"); + glad_glDrawTransformFeedback = (PFNGLDRAWTRANSFORMFEEDBACKPROC)load("glDrawTransformFeedback"); + glad_glDrawTransformFeedbackStream = (PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC)load("glDrawTransformFeedbackStream"); + glad_glBeginQueryIndexed = (PFNGLBEGINQUERYINDEXEDPROC)load("glBeginQueryIndexed"); + glad_glEndQueryIndexed = (PFNGLENDQUERYINDEXEDPROC)load("glEndQueryIndexed"); + glad_glGetQueryIndexediv = (PFNGLGETQUERYINDEXEDIVPROC)load("glGetQueryIndexediv"); +} +static void load_GL_VERSION_4_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_4_1) return; + glad_glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC)load("glReleaseShaderCompiler"); + glad_glShaderBinary = (PFNGLSHADERBINARYPROC)load("glShaderBinary"); + glad_glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC)load("glGetShaderPrecisionFormat"); + glad_glDepthRangef = (PFNGLDEPTHRANGEFPROC)load("glDepthRangef"); + glad_glClearDepthf = (PFNGLCLEARDEPTHFPROC)load("glClearDepthf"); + glad_glGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC)load("glGetProgramBinary"); + glad_glProgramBinary = (PFNGLPROGRAMBINARYPROC)load("glProgramBinary"); + glad_glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC)load("glProgramParameteri"); + glad_glUseProgramStages = (PFNGLUSEPROGRAMSTAGESPROC)load("glUseProgramStages"); + glad_glActiveShaderProgram = (PFNGLACTIVESHADERPROGRAMPROC)load("glActiveShaderProgram"); + glad_glCreateShaderProgramv = (PFNGLCREATESHADERPROGRAMVPROC)load("glCreateShaderProgramv"); + glad_glBindProgramPipeline = (PFNGLBINDPROGRAMPIPELINEPROC)load("glBindProgramPipeline"); + glad_glDeleteProgramPipelines = (PFNGLDELETEPROGRAMPIPELINESPROC)load("glDeleteProgramPipelines"); + glad_glGenProgramPipelines = (PFNGLGENPROGRAMPIPELINESPROC)load("glGenProgramPipelines"); + glad_glIsProgramPipeline = (PFNGLISPROGRAMPIPELINEPROC)load("glIsProgramPipeline"); + glad_glGetProgramPipelineiv = (PFNGLGETPROGRAMPIPELINEIVPROC)load("glGetProgramPipelineiv"); + glad_glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC)load("glProgramParameteri"); + glad_glProgramUniform1i = (PFNGLPROGRAMUNIFORM1IPROC)load("glProgramUniform1i"); + glad_glProgramUniform1iv = (PFNGLPROGRAMUNIFORM1IVPROC)load("glProgramUniform1iv"); + glad_glProgramUniform1f = (PFNGLPROGRAMUNIFORM1FPROC)load("glProgramUniform1f"); + glad_glProgramUniform1fv = (PFNGLPROGRAMUNIFORM1FVPROC)load("glProgramUniform1fv"); + glad_glProgramUniform1d = (PFNGLPROGRAMUNIFORM1DPROC)load("glProgramUniform1d"); + glad_glProgramUniform1dv = (PFNGLPROGRAMUNIFORM1DVPROC)load("glProgramUniform1dv"); + glad_glProgramUniform1ui = (PFNGLPROGRAMUNIFORM1UIPROC)load("glProgramUniform1ui"); + glad_glProgramUniform1uiv = (PFNGLPROGRAMUNIFORM1UIVPROC)load("glProgramUniform1uiv"); + glad_glProgramUniform2i = (PFNGLPROGRAMUNIFORM2IPROC)load("glProgramUniform2i"); + glad_glProgramUniform2iv = (PFNGLPROGRAMUNIFORM2IVPROC)load("glProgramUniform2iv"); + glad_glProgramUniform2f = (PFNGLPROGRAMUNIFORM2FPROC)load("glProgramUniform2f"); + glad_glProgramUniform2fv = (PFNGLPROGRAMUNIFORM2FVPROC)load("glProgramUniform2fv"); + glad_glProgramUniform2d = (PFNGLPROGRAMUNIFORM2DPROC)load("glProgramUniform2d"); + glad_glProgramUniform2dv = (PFNGLPROGRAMUNIFORM2DVPROC)load("glProgramUniform2dv"); + glad_glProgramUniform2ui = (PFNGLPROGRAMUNIFORM2UIPROC)load("glProgramUniform2ui"); + glad_glProgramUniform2uiv = (PFNGLPROGRAMUNIFORM2UIVPROC)load("glProgramUniform2uiv"); + glad_glProgramUniform3i = (PFNGLPROGRAMUNIFORM3IPROC)load("glProgramUniform3i"); + glad_glProgramUniform3iv = (PFNGLPROGRAMUNIFORM3IVPROC)load("glProgramUniform3iv"); + glad_glProgramUniform3f = (PFNGLPROGRAMUNIFORM3FPROC)load("glProgramUniform3f"); + glad_glProgramUniform3fv = (PFNGLPROGRAMUNIFORM3FVPROC)load("glProgramUniform3fv"); + glad_glProgramUniform3d = (PFNGLPROGRAMUNIFORM3DPROC)load("glProgramUniform3d"); + glad_glProgramUniform3dv = (PFNGLPROGRAMUNIFORM3DVPROC)load("glProgramUniform3dv"); + glad_glProgramUniform3ui = (PFNGLPROGRAMUNIFORM3UIPROC)load("glProgramUniform3ui"); + glad_glProgramUniform3uiv = (PFNGLPROGRAMUNIFORM3UIVPROC)load("glProgramUniform3uiv"); + glad_glProgramUniform4i = (PFNGLPROGRAMUNIFORM4IPROC)load("glProgramUniform4i"); + glad_glProgramUniform4iv = (PFNGLPROGRAMUNIFORM4IVPROC)load("glProgramUniform4iv"); + glad_glProgramUniform4f = (PFNGLPROGRAMUNIFORM4FPROC)load("glProgramUniform4f"); + glad_glProgramUniform4fv = (PFNGLPROGRAMUNIFORM4FVPROC)load("glProgramUniform4fv"); + glad_glProgramUniform4d = (PFNGLPROGRAMUNIFORM4DPROC)load("glProgramUniform4d"); + glad_glProgramUniform4dv = (PFNGLPROGRAMUNIFORM4DVPROC)load("glProgramUniform4dv"); + glad_glProgramUniform4ui = (PFNGLPROGRAMUNIFORM4UIPROC)load("glProgramUniform4ui"); + glad_glProgramUniform4uiv = (PFNGLPROGRAMUNIFORM4UIVPROC)load("glProgramUniform4uiv"); + glad_glProgramUniformMatrix2fv = (PFNGLPROGRAMUNIFORMMATRIX2FVPROC)load("glProgramUniformMatrix2fv"); + glad_glProgramUniformMatrix3fv = (PFNGLPROGRAMUNIFORMMATRIX3FVPROC)load("glProgramUniformMatrix3fv"); + glad_glProgramUniformMatrix4fv = (PFNGLPROGRAMUNIFORMMATRIX4FVPROC)load("glProgramUniformMatrix4fv"); + glad_glProgramUniformMatrix2dv = (PFNGLPROGRAMUNIFORMMATRIX2DVPROC)load("glProgramUniformMatrix2dv"); + glad_glProgramUniformMatrix3dv = (PFNGLPROGRAMUNIFORMMATRIX3DVPROC)load("glProgramUniformMatrix3dv"); + glad_glProgramUniformMatrix4dv = (PFNGLPROGRAMUNIFORMMATRIX4DVPROC)load("glProgramUniformMatrix4dv"); + glad_glProgramUniformMatrix2x3fv = (PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC)load("glProgramUniformMatrix2x3fv"); + glad_glProgramUniformMatrix3x2fv = (PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC)load("glProgramUniformMatrix3x2fv"); + glad_glProgramUniformMatrix2x4fv = (PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC)load("glProgramUniformMatrix2x4fv"); + glad_glProgramUniformMatrix4x2fv = (PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC)load("glProgramUniformMatrix4x2fv"); + glad_glProgramUniformMatrix3x4fv = (PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC)load("glProgramUniformMatrix3x4fv"); + glad_glProgramUniformMatrix4x3fv = (PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC)load("glProgramUniformMatrix4x3fv"); + glad_glProgramUniformMatrix2x3dv = (PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC)load("glProgramUniformMatrix2x3dv"); + glad_glProgramUniformMatrix3x2dv = (PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC)load("glProgramUniformMatrix3x2dv"); + glad_glProgramUniformMatrix2x4dv = (PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC)load("glProgramUniformMatrix2x4dv"); + glad_glProgramUniformMatrix4x2dv = (PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC)load("glProgramUniformMatrix4x2dv"); + glad_glProgramUniformMatrix3x4dv = (PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC)load("glProgramUniformMatrix3x4dv"); + glad_glProgramUniformMatrix4x3dv = (PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC)load("glProgramUniformMatrix4x3dv"); + glad_glValidateProgramPipeline = (PFNGLVALIDATEPROGRAMPIPELINEPROC)load("glValidateProgramPipeline"); + glad_glGetProgramPipelineInfoLog = (PFNGLGETPROGRAMPIPELINEINFOLOGPROC)load("glGetProgramPipelineInfoLog"); + glad_glVertexAttribL1d = (PFNGLVERTEXATTRIBL1DPROC)load("glVertexAttribL1d"); + glad_glVertexAttribL2d = (PFNGLVERTEXATTRIBL2DPROC)load("glVertexAttribL2d"); + glad_glVertexAttribL3d = (PFNGLVERTEXATTRIBL3DPROC)load("glVertexAttribL3d"); + glad_glVertexAttribL4d = (PFNGLVERTEXATTRIBL4DPROC)load("glVertexAttribL4d"); + glad_glVertexAttribL1dv = (PFNGLVERTEXATTRIBL1DVPROC)load("glVertexAttribL1dv"); + glad_glVertexAttribL2dv = (PFNGLVERTEXATTRIBL2DVPROC)load("glVertexAttribL2dv"); + glad_glVertexAttribL3dv = (PFNGLVERTEXATTRIBL3DVPROC)load("glVertexAttribL3dv"); + glad_glVertexAttribL4dv = (PFNGLVERTEXATTRIBL4DVPROC)load("glVertexAttribL4dv"); + glad_glVertexAttribLPointer = (PFNGLVERTEXATTRIBLPOINTERPROC)load("glVertexAttribLPointer"); + glad_glGetVertexAttribLdv = (PFNGLGETVERTEXATTRIBLDVPROC)load("glGetVertexAttribLdv"); + glad_glViewportArrayv = (PFNGLVIEWPORTARRAYVPROC)load("glViewportArrayv"); + glad_glViewportIndexedf = (PFNGLVIEWPORTINDEXEDFPROC)load("glViewportIndexedf"); + glad_glViewportIndexedfv = (PFNGLVIEWPORTINDEXEDFVPROC)load("glViewportIndexedfv"); + glad_glScissorArrayv = (PFNGLSCISSORARRAYVPROC)load("glScissorArrayv"); + glad_glScissorIndexed = (PFNGLSCISSORINDEXEDPROC)load("glScissorIndexed"); + glad_glScissorIndexedv = (PFNGLSCISSORINDEXEDVPROC)load("glScissorIndexedv"); + glad_glDepthRangeArrayv = (PFNGLDEPTHRANGEARRAYVPROC)load("glDepthRangeArrayv"); + glad_glDepthRangeIndexed = (PFNGLDEPTHRANGEINDEXEDPROC)load("glDepthRangeIndexed"); + glad_glGetFloati_v = (PFNGLGETFLOATI_VPROC)load("glGetFloati_v"); + glad_glGetDoublei_v = (PFNGLGETDOUBLEI_VPROC)load("glGetDoublei_v"); +} static int find_extensionsGL(void) { if (!get_exts()) return 0; (void)&has_ext; @@ -1808,9 +2086,11 @@ static void find_coreGL(void) { GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3; GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3; GLAD_GL_VERSION_3_3 = (major == 3 && minor >= 3) || major > 3; - if (GLVersion.major > 3 || (GLVersion.major >= 3 && GLVersion.minor >= 3)) { - max_loaded_major = 3; - max_loaded_minor = 3; + GLAD_GL_VERSION_4_0 = (major == 4 && minor >= 0) || major > 4; + GLAD_GL_VERSION_4_1 = (major == 4 && minor >= 1) || major > 4; + if (GLVersion.major > 4 || (GLVersion.major >= 4 && GLVersion.minor >= 1)) { + max_loaded_major = 4; + max_loaded_minor = 1; } } @@ -1832,6 +2112,8 @@ int gladLoadGLLoader(GLADloadproc load) { load_GL_VERSION_3_1(load); load_GL_VERSION_3_2(load); load_GL_VERSION_3_3(load); + load_GL_VERSION_4_0(load); + load_GL_VERSION_4_1(load); if (!find_extensionsGL()) return 0; return GLVersion.major != 0 || GLVersion.minor != 0; diff --git a/desktop/glfw_gui/c/deps/include/glad/glad.h b/desktop/glfw_gui/c/deps/include/glad/glad.h index eab0fb00..10346136 100644 --- a/desktop/glfw_gui/c/deps/include/glad/glad.h +++ b/desktop/glfw_gui/c/deps/include/glad/glad.h @@ -1,21 +1,22 @@ /* - OpenGL loader generated by glad 0.1.24a0 on Fri Jun 1 15:44:29 2018. + OpenGL loader generated by glad 0.1.36 on Fri Dec 5 02:18:01 2025. Language/Generator: C/C++ Specification: gl - APIs: gl=3.3 + APIs: gl=4.1 Profile: compatibility Extensions: Loader: True Local files: False Omit khrplatform: False + Reproducible: False Commandline: - --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="" + --profile="compatibility" --api="gl=4.1" --generator="c" --spec="gl" --extensions="" Online: - http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3 + https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D4.1 */ @@ -28,13 +29,7 @@ #define __gl_h_ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif -#ifndef NOMINMAX -#define NOMINMAX 1 -#endif -#include +#define APIENTRY __stdcall #endif #ifndef APIENTRY @@ -44,6 +39,10 @@ #define APIENTRYP APIENTRY * #endif +#ifndef GLAPIENTRY +#define GLAPIENTRY APIENTRY +#endif + #ifdef __cplusplus extern "C" { #endif @@ -87,59 +86,21 @@ GLAPI int gladLoadGL(void); GLAPI int gladLoadGLLoader(GLADloadproc); -#include #include -#ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glxext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GL_EXT_timer_query extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include -#elif defined(__sun__) || defined(__digital__) -#include -#if defined(__STDC__) -#if defined(__arch64__) || defined(_LP64) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include -#elif defined(__SCO__) || defined(__USLC__) -#include -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -/* Fallback if nothing above works */ -#include -#endif -#endif typedef unsigned int GLenum; typedef unsigned char GLboolean; typedef unsigned int GLbitfield; typedef void GLvoid; -typedef signed char GLbyte; -typedef short GLshort; +typedef khronos_int8_t GLbyte; +typedef khronos_uint8_t GLubyte; +typedef khronos_int16_t GLshort; +typedef khronos_uint16_t GLushort; typedef int GLint; -typedef int GLclampx; -typedef unsigned char GLubyte; -typedef unsigned short GLushort; typedef unsigned int GLuint; +typedef khronos_int32_t GLclampx; typedef int GLsizei; -typedef float GLfloat; -typedef float GLclampf; +typedef khronos_float_t GLfloat; +typedef khronos_float_t GLclampf; typedef double GLdouble; typedef double GLclampd; typedef void *GLeglClientBufferEXT; @@ -151,25 +112,17 @@ typedef void *GLhandleARB; #else typedef unsigned int GLhandleARB; #endif -typedef unsigned short GLhalfARB; -typedef unsigned short GLhalf; -typedef GLint GLfixed; +typedef khronos_uint16_t GLhalf; +typedef khronos_uint16_t GLhalfARB; +typedef khronos_int32_t GLfixed; typedef khronos_intptr_t GLintptr; +typedef khronos_intptr_t GLintptrARB; typedef khronos_ssize_t GLsizeiptr; -typedef int64_t GLint64; -typedef uint64_t GLuint64; -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) -typedef long GLintptrARB; -#else -typedef ptrdiff_t GLintptrARB; -#endif -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) -typedef long GLsizeiptrARB; -#else -typedef ptrdiff_t GLsizeiptrARB; -#endif -typedef int64_t GLint64EXT; -typedef uint64_t GLuint64EXT; +typedef khronos_ssize_t GLsizeiptrARB; +typedef khronos_int64_t GLint64; +typedef khronos_int64_t GLint64EXT; +typedef khronos_uint64_t GLuint64; +typedef khronos_uint64_t GLuint64EXT; typedef struct __GLsync *GLsync; struct _cl_context; struct _cl_event; @@ -1430,6 +1383,118 @@ typedef void (APIENTRY *GLVULKANPROCNV)(void); #define GL_TIME_ELAPSED 0x88BF #define GL_TIMESTAMP 0x8E28 #define GL_INT_2_10_10_10_REV 0x8D9F +#define GL_SAMPLE_SHADING 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F +#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F +#define GL_DRAW_INDIRECT_BUFFER 0x8F3F +#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 +#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D +#define GL_MAX_VERTEX_STREAMS 0x8E71 +#define GL_DOUBLE_VEC2 0x8FFC +#define GL_DOUBLE_VEC3 0x8FFD +#define GL_DOUBLE_VEC4 0x8FFE +#define GL_DOUBLE_MAT2 0x8F46 +#define GL_DOUBLE_MAT3 0x8F47 +#define GL_DOUBLE_MAT4 0x8F48 +#define GL_DOUBLE_MAT2x3 0x8F49 +#define GL_DOUBLE_MAT2x4 0x8F4A +#define GL_DOUBLE_MAT3x2 0x8F4B +#define GL_DOUBLE_MAT3x4 0x8F4C +#define GL_DOUBLE_MAT4x2 0x8F4D +#define GL_DOUBLE_MAT4x3 0x8F4E +#define GL_ACTIVE_SUBROUTINES 0x8DE5 +#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 +#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 +#define GL_MAX_SUBROUTINES 0x8DE7 +#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 +#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A +#define GL_COMPATIBLE_SUBROUTINES 0x8E4B +#define GL_PATCHES 0x000E +#define GL_PATCH_VERTICES 0x8E72 +#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 +#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 +#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 +#define GL_TESS_GEN_MODE 0x8E76 +#define GL_TESS_GEN_SPACING 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 +#define GL_TESS_GEN_POINT_MODE 0x8E79 +#define GL_ISOLINES 0x8E7A +#define GL_FRACTIONAL_ODD 0x8E7B +#define GL_FRACTIONAL_EVEN 0x8E7C +#define GL_MAX_PATCH_VERTICES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 +#define GL_TESS_EVALUATION_SHADER 0x8E87 +#define GL_TESS_CONTROL_SHADER 0x8E88 +#define GL_TRANSFORM_FEEDBACK 0x8E22 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 +#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 +#define GL_FIXED 0x140C +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_RGB565 0x8D62 +#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 +#define GL_PROGRAM_BINARY_LENGTH 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE +#define GL_PROGRAM_BINARY_FORMATS 0x87FF +#define GL_VERTEX_SHADER_BIT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT 0x00000002 +#define GL_GEOMETRY_SHADER_BIT 0x00000004 +#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 +#define GL_ALL_SHADER_BITS 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE 0x8258 +#define GL_ACTIVE_PROGRAM 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING 0x825A +#define GL_MAX_VIEWPORTS 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE 0x825D +#define GL_LAYER_PROVOKING_VERTEX 0x825E +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F +#define GL_UNDEFINED_VERTEX 0x8260 #ifndef GL_VERSION_1_0 #define GL_VERSION_1_0 1 GLAPI int GLAD_GL_VERSION_1_0; @@ -3447,7 +3512,7 @@ GLAPI PFNGLWAITSYNCPROC glad_glWaitSync; typedef void (APIENTRYP PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 *data); GLAPI PFNGLGETINTEGER64VPROC glad_glGetInteger64v; #define glGetInteger64v glad_glGetInteger64v -typedef void (APIENTRYP PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); GLAPI PFNGLGETSYNCIVPROC glad_glGetSynciv; #define glGetSynciv glad_glGetSynciv typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC)(GLenum target, GLuint index, GLint64 *data); @@ -3650,6 +3715,416 @@ typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC)(GLenum type, const GLuint GLAPI PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv; #define glSecondaryColorP3uiv glad_glSecondaryColorP3uiv #endif +#ifndef GL_VERSION_4_0 +#define GL_VERSION_4_0 1 +GLAPI int GLAD_GL_VERSION_4_0; +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC)(GLfloat value); +GLAPI PFNGLMINSAMPLESHADINGPROC glad_glMinSampleShading; +#define glMinSampleShading glad_glMinSampleShading +typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC)(GLuint buf, GLenum mode); +GLAPI PFNGLBLENDEQUATIONIPROC glad_glBlendEquationi; +#define glBlendEquationi glad_glBlendEquationi +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC)(GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI PFNGLBLENDEQUATIONSEPARATEIPROC glad_glBlendEquationSeparatei; +#define glBlendEquationSeparatei glad_glBlendEquationSeparatei +typedef void (APIENTRYP PFNGLBLENDFUNCIPROC)(GLuint buf, GLenum src, GLenum dst); +GLAPI PFNGLBLENDFUNCIPROC glad_glBlendFunci; +#define glBlendFunci glad_glBlendFunci +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC)(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GLAPI PFNGLBLENDFUNCSEPARATEIPROC glad_glBlendFuncSeparatei; +#define glBlendFuncSeparatei glad_glBlendFuncSeparatei +typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC)(GLenum mode, const void *indirect); +GLAPI PFNGLDRAWARRAYSINDIRECTPROC glad_glDrawArraysIndirect; +#define glDrawArraysIndirect glad_glDrawArraysIndirect +typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC)(GLenum mode, GLenum type, const void *indirect); +GLAPI PFNGLDRAWELEMENTSINDIRECTPROC glad_glDrawElementsIndirect; +#define glDrawElementsIndirect glad_glDrawElementsIndirect +typedef void (APIENTRYP PFNGLUNIFORM1DPROC)(GLint location, GLdouble x); +GLAPI PFNGLUNIFORM1DPROC glad_glUniform1d; +#define glUniform1d glad_glUniform1d +typedef void (APIENTRYP PFNGLUNIFORM2DPROC)(GLint location, GLdouble x, GLdouble y); +GLAPI PFNGLUNIFORM2DPROC glad_glUniform2d; +#define glUniform2d glad_glUniform2d +typedef void (APIENTRYP PFNGLUNIFORM3DPROC)(GLint location, GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLUNIFORM3DPROC glad_glUniform3d; +#define glUniform3d glad_glUniform3d +typedef void (APIENTRYP PFNGLUNIFORM4DPROC)(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLUNIFORM4DPROC glad_glUniform4d; +#define glUniform4d glad_glUniform4d +typedef void (APIENTRYP PFNGLUNIFORM1DVPROC)(GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLUNIFORM1DVPROC glad_glUniform1dv; +#define glUniform1dv glad_glUniform1dv +typedef void (APIENTRYP PFNGLUNIFORM2DVPROC)(GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLUNIFORM2DVPROC glad_glUniform2dv; +#define glUniform2dv glad_glUniform2dv +typedef void (APIENTRYP PFNGLUNIFORM3DVPROC)(GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLUNIFORM3DVPROC glad_glUniform3dv; +#define glUniform3dv glad_glUniform3dv +typedef void (APIENTRYP PFNGLUNIFORM4DVPROC)(GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLUNIFORM4DVPROC glad_glUniform4dv; +#define glUniform4dv glad_glUniform4dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX2DVPROC glad_glUniformMatrix2dv; +#define glUniformMatrix2dv glad_glUniformMatrix2dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX3DVPROC glad_glUniformMatrix3dv; +#define glUniformMatrix3dv glad_glUniformMatrix3dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX4DVPROC glad_glUniformMatrix4dv; +#define glUniformMatrix4dv glad_glUniformMatrix4dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX2X3DVPROC glad_glUniformMatrix2x3dv; +#define glUniformMatrix2x3dv glad_glUniformMatrix2x3dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX2X4DVPROC glad_glUniformMatrix2x4dv; +#define glUniformMatrix2x4dv glad_glUniformMatrix2x4dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX3X2DVPROC glad_glUniformMatrix3x2dv; +#define glUniformMatrix3x2dv glad_glUniformMatrix3x2dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX3X4DVPROC glad_glUniformMatrix3x4dv; +#define glUniformMatrix3x4dv glad_glUniformMatrix3x4dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX4X2DVPROC glad_glUniformMatrix4x2dv; +#define glUniformMatrix4x2dv glad_glUniformMatrix4x2dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX4X3DVPROC glad_glUniformMatrix4x3dv; +#define glUniformMatrix4x3dv glad_glUniformMatrix4x3dv +typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC)(GLuint program, GLint location, GLdouble *params); +GLAPI PFNGLGETUNIFORMDVPROC glad_glGetUniformdv; +#define glGetUniformdv glad_glGetUniformdv +typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC)(GLuint program, GLenum shadertype, const GLchar *name); +GLAPI PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC glad_glGetSubroutineUniformLocation; +#define glGetSubroutineUniformLocation glad_glGetSubroutineUniformLocation +typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC)(GLuint program, GLenum shadertype, const GLchar *name); +GLAPI PFNGLGETSUBROUTINEINDEXPROC glad_glGetSubroutineIndex; +#define glGetSubroutineIndex glad_glGetSubroutineIndex +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC)(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +GLAPI PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glad_glGetActiveSubroutineUniformiv; +#define glGetActiveSubroutineUniformiv glad_glGetActiveSubroutineUniformiv +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GLAPI PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glad_glGetActiveSubroutineUniformName; +#define glGetActiveSubroutineUniformName glad_glGetActiveSubroutineUniformName +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC)(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GLAPI PFNGLGETACTIVESUBROUTINENAMEPROC glad_glGetActiveSubroutineName; +#define glGetActiveSubroutineName glad_glGetActiveSubroutineName +typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC)(GLenum shadertype, GLsizei count, const GLuint *indices); +GLAPI PFNGLUNIFORMSUBROUTINESUIVPROC glad_glUniformSubroutinesuiv; +#define glUniformSubroutinesuiv glad_glUniformSubroutinesuiv +typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC)(GLenum shadertype, GLint location, GLuint *params); +GLAPI PFNGLGETUNIFORMSUBROUTINEUIVPROC glad_glGetUniformSubroutineuiv; +#define glGetUniformSubroutineuiv glad_glGetUniformSubroutineuiv +typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC)(GLuint program, GLenum shadertype, GLenum pname, GLint *values); +GLAPI PFNGLGETPROGRAMSTAGEIVPROC glad_glGetProgramStageiv; +#define glGetProgramStageiv glad_glGetProgramStageiv +typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC)(GLenum pname, GLint value); +GLAPI PFNGLPATCHPARAMETERIPROC glad_glPatchParameteri; +#define glPatchParameteri glad_glPatchParameteri +typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC)(GLenum pname, const GLfloat *values); +GLAPI PFNGLPATCHPARAMETERFVPROC glad_glPatchParameterfv; +#define glPatchParameterfv glad_glPatchParameterfv +typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC)(GLenum target, GLuint id); +GLAPI PFNGLBINDTRANSFORMFEEDBACKPROC glad_glBindTransformFeedback; +#define glBindTransformFeedback glad_glBindTransformFeedback +typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC)(GLsizei n, const GLuint *ids); +GLAPI PFNGLDELETETRANSFORMFEEDBACKSPROC glad_glDeleteTransformFeedbacks; +#define glDeleteTransformFeedbacks glad_glDeleteTransformFeedbacks +typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC)(GLsizei n, GLuint *ids); +GLAPI PFNGLGENTRANSFORMFEEDBACKSPROC glad_glGenTransformFeedbacks; +#define glGenTransformFeedbacks glad_glGenTransformFeedbacks +typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC)(GLuint id); +GLAPI PFNGLISTRANSFORMFEEDBACKPROC glad_glIsTransformFeedback; +#define glIsTransformFeedback glad_glIsTransformFeedback +typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC)(void); +GLAPI PFNGLPAUSETRANSFORMFEEDBACKPROC glad_glPauseTransformFeedback; +#define glPauseTransformFeedback glad_glPauseTransformFeedback +typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC)(void); +GLAPI PFNGLRESUMETRANSFORMFEEDBACKPROC glad_glResumeTransformFeedback; +#define glResumeTransformFeedback glad_glResumeTransformFeedback +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC)(GLenum mode, GLuint id); +GLAPI PFNGLDRAWTRANSFORMFEEDBACKPROC glad_glDrawTransformFeedback; +#define glDrawTransformFeedback glad_glDrawTransformFeedback +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC)(GLenum mode, GLuint id, GLuint stream); +GLAPI PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC glad_glDrawTransformFeedbackStream; +#define glDrawTransformFeedbackStream glad_glDrawTransformFeedbackStream +typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC)(GLenum target, GLuint index, GLuint id); +GLAPI PFNGLBEGINQUERYINDEXEDPROC glad_glBeginQueryIndexed; +#define glBeginQueryIndexed glad_glBeginQueryIndexed +typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC)(GLenum target, GLuint index); +GLAPI PFNGLENDQUERYINDEXEDPROC glad_glEndQueryIndexed; +#define glEndQueryIndexed glad_glEndQueryIndexed +typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC)(GLenum target, GLuint index, GLenum pname, GLint *params); +GLAPI PFNGLGETQUERYINDEXEDIVPROC glad_glGetQueryIndexediv; +#define glGetQueryIndexediv glad_glGetQueryIndexediv +#endif +#ifndef GL_VERSION_4_1 +#define GL_VERSION_4_1 1 +GLAPI int GLAD_GL_VERSION_4_1; +typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC)(void); +GLAPI PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler; +#define glReleaseShaderCompiler glad_glReleaseShaderCompiler +typedef void (APIENTRYP PFNGLSHADERBINARYPROC)(GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); +GLAPI PFNGLSHADERBINARYPROC glad_glShaderBinary; +#define glShaderBinary glad_glShaderBinary +typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC)(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GLAPI PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat; +#define glGetShaderPrecisionFormat glad_glGetShaderPrecisionFormat +typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC)(GLfloat n, GLfloat f); +GLAPI PFNGLDEPTHRANGEFPROC glad_glDepthRangef; +#define glDepthRangef glad_glDepthRangef +typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC)(GLfloat d); +GLAPI PFNGLCLEARDEPTHFPROC glad_glClearDepthf; +#define glClearDepthf glad_glClearDepthf +typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +GLAPI PFNGLGETPROGRAMBINARYPROC glad_glGetProgramBinary; +#define glGetProgramBinary glad_glGetProgramBinary +typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC)(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); +GLAPI PFNGLPROGRAMBINARYPROC glad_glProgramBinary; +#define glProgramBinary glad_glProgramBinary +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC)(GLuint program, GLenum pname, GLint value); +GLAPI PFNGLPROGRAMPARAMETERIPROC glad_glProgramParameteri; +#define glProgramParameteri glad_glProgramParameteri +typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC)(GLuint pipeline, GLbitfield stages, GLuint program); +GLAPI PFNGLUSEPROGRAMSTAGESPROC glad_glUseProgramStages; +#define glUseProgramStages glad_glUseProgramStages +typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC)(GLuint pipeline, GLuint program); +GLAPI PFNGLACTIVESHADERPROGRAMPROC glad_glActiveShaderProgram; +#define glActiveShaderProgram glad_glActiveShaderProgram +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC)(GLenum type, GLsizei count, const GLchar *const*strings); +GLAPI PFNGLCREATESHADERPROGRAMVPROC glad_glCreateShaderProgramv; +#define glCreateShaderProgramv glad_glCreateShaderProgramv +typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC)(GLuint pipeline); +GLAPI PFNGLBINDPROGRAMPIPELINEPROC glad_glBindProgramPipeline; +#define glBindProgramPipeline glad_glBindProgramPipeline +typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC)(GLsizei n, const GLuint *pipelines); +GLAPI PFNGLDELETEPROGRAMPIPELINESPROC glad_glDeleteProgramPipelines; +#define glDeleteProgramPipelines glad_glDeleteProgramPipelines +typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC)(GLsizei n, GLuint *pipelines); +GLAPI PFNGLGENPROGRAMPIPELINESPROC glad_glGenProgramPipelines; +#define glGenProgramPipelines glad_glGenProgramPipelines +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC)(GLuint pipeline); +GLAPI PFNGLISPROGRAMPIPELINEPROC glad_glIsProgramPipeline; +#define glIsProgramPipeline glad_glIsProgramPipeline +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC)(GLuint pipeline, GLenum pname, GLint *params); +GLAPI PFNGLGETPROGRAMPIPELINEIVPROC glad_glGetProgramPipelineiv; +#define glGetProgramPipelineiv glad_glGetProgramPipelineiv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC)(GLuint program, GLint location, GLint v0); +GLAPI PFNGLPROGRAMUNIFORM1IPROC glad_glProgramUniform1i; +#define glProgramUniform1i glad_glProgramUniform1i +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLPROGRAMUNIFORM1IVPROC glad_glProgramUniform1iv; +#define glProgramUniform1iv glad_glProgramUniform1iv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC)(GLuint program, GLint location, GLfloat v0); +GLAPI PFNGLPROGRAMUNIFORM1FPROC glad_glProgramUniform1f; +#define glProgramUniform1f glad_glProgramUniform1f +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORM1FVPROC glad_glProgramUniform1fv; +#define glProgramUniform1fv glad_glProgramUniform1fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC)(GLuint program, GLint location, GLdouble v0); +GLAPI PFNGLPROGRAMUNIFORM1DPROC glad_glProgramUniform1d; +#define glProgramUniform1d glad_glProgramUniform1d +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC)(GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORM1DVPROC glad_glProgramUniform1dv; +#define glProgramUniform1dv glad_glProgramUniform1dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC)(GLuint program, GLint location, GLuint v0); +GLAPI PFNGLPROGRAMUNIFORM1UIPROC glad_glProgramUniform1ui; +#define glProgramUniform1ui glad_glProgramUniform1ui +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC)(GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLPROGRAMUNIFORM1UIVPROC glad_glProgramUniform1uiv; +#define glProgramUniform1uiv glad_glProgramUniform1uiv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC)(GLuint program, GLint location, GLint v0, GLint v1); +GLAPI PFNGLPROGRAMUNIFORM2IPROC glad_glProgramUniform2i; +#define glProgramUniform2i glad_glProgramUniform2i +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLPROGRAMUNIFORM2IVPROC glad_glProgramUniform2iv; +#define glProgramUniform2iv glad_glProgramUniform2iv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC)(GLuint program, GLint location, GLfloat v0, GLfloat v1); +GLAPI PFNGLPROGRAMUNIFORM2FPROC glad_glProgramUniform2f; +#define glProgramUniform2f glad_glProgramUniform2f +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORM2FVPROC glad_glProgramUniform2fv; +#define glProgramUniform2fv glad_glProgramUniform2fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC)(GLuint program, GLint location, GLdouble v0, GLdouble v1); +GLAPI PFNGLPROGRAMUNIFORM2DPROC glad_glProgramUniform2d; +#define glProgramUniform2d glad_glProgramUniform2d +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC)(GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORM2DVPROC glad_glProgramUniform2dv; +#define glProgramUniform2dv glad_glProgramUniform2dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC)(GLuint program, GLint location, GLuint v0, GLuint v1); +GLAPI PFNGLPROGRAMUNIFORM2UIPROC glad_glProgramUniform2ui; +#define glProgramUniform2ui glad_glProgramUniform2ui +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC)(GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLPROGRAMUNIFORM2UIVPROC glad_glProgramUniform2uiv; +#define glProgramUniform2uiv glad_glProgramUniform2uiv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC)(GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GLAPI PFNGLPROGRAMUNIFORM3IPROC glad_glProgramUniform3i; +#define glProgramUniform3i glad_glProgramUniform3i +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLPROGRAMUNIFORM3IVPROC glad_glProgramUniform3iv; +#define glProgramUniform3iv glad_glProgramUniform3iv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC)(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI PFNGLPROGRAMUNIFORM3FPROC glad_glProgramUniform3f; +#define glProgramUniform3f glad_glProgramUniform3f +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORM3FVPROC glad_glProgramUniform3fv; +#define glProgramUniform3fv glad_glProgramUniform3fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC)(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +GLAPI PFNGLPROGRAMUNIFORM3DPROC glad_glProgramUniform3d; +#define glProgramUniform3d glad_glProgramUniform3d +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC)(GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORM3DVPROC glad_glProgramUniform3dv; +#define glProgramUniform3dv glad_glProgramUniform3dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC)(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI PFNGLPROGRAMUNIFORM3UIPROC glad_glProgramUniform3ui; +#define glProgramUniform3ui glad_glProgramUniform3ui +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC)(GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLPROGRAMUNIFORM3UIVPROC glad_glProgramUniform3uiv; +#define glProgramUniform3uiv glad_glProgramUniform3uiv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC)(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI PFNGLPROGRAMUNIFORM4IPROC glad_glProgramUniform4i; +#define glProgramUniform4i glad_glProgramUniform4i +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLPROGRAMUNIFORM4IVPROC glad_glProgramUniform4iv; +#define glProgramUniform4iv glad_glProgramUniform4iv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC)(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI PFNGLPROGRAMUNIFORM4FPROC glad_glProgramUniform4f; +#define glProgramUniform4f glad_glProgramUniform4f +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORM4FVPROC glad_glProgramUniform4fv; +#define glProgramUniform4fv glad_glProgramUniform4fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC)(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +GLAPI PFNGLPROGRAMUNIFORM4DPROC glad_glProgramUniform4d; +#define glProgramUniform4d glad_glProgramUniform4d +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC)(GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORM4DVPROC glad_glProgramUniform4dv; +#define glProgramUniform4dv glad_glProgramUniform4dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC)(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI PFNGLPROGRAMUNIFORM4UIPROC glad_glProgramUniform4ui; +#define glProgramUniform4ui glad_glProgramUniform4ui +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC)(GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLPROGRAMUNIFORM4UIVPROC glad_glProgramUniform4uiv; +#define glProgramUniform4uiv glad_glProgramUniform4uiv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX2FVPROC glad_glProgramUniformMatrix2fv; +#define glProgramUniformMatrix2fv glad_glProgramUniformMatrix2fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX3FVPROC glad_glProgramUniformMatrix3fv; +#define glProgramUniformMatrix3fv glad_glProgramUniformMatrix3fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX4FVPROC glad_glProgramUniformMatrix4fv; +#define glProgramUniformMatrix4fv glad_glProgramUniformMatrix4fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX2DVPROC glad_glProgramUniformMatrix2dv; +#define glProgramUniformMatrix2dv glad_glProgramUniformMatrix2dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX3DVPROC glad_glProgramUniformMatrix3dv; +#define glProgramUniformMatrix3dv glad_glProgramUniformMatrix3dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX4DVPROC glad_glProgramUniformMatrix4dv; +#define glProgramUniformMatrix4dv glad_glProgramUniformMatrix4dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC glad_glProgramUniformMatrix2x3fv; +#define glProgramUniformMatrix2x3fv glad_glProgramUniformMatrix2x3fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC glad_glProgramUniformMatrix3x2fv; +#define glProgramUniformMatrix3x2fv glad_glProgramUniformMatrix3x2fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC glad_glProgramUniformMatrix2x4fv; +#define glProgramUniformMatrix2x4fv glad_glProgramUniformMatrix2x4fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC glad_glProgramUniformMatrix4x2fv; +#define glProgramUniformMatrix4x2fv glad_glProgramUniformMatrix4x2fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC glad_glProgramUniformMatrix3x4fv; +#define glProgramUniformMatrix3x4fv glad_glProgramUniformMatrix3x4fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC glad_glProgramUniformMatrix4x3fv; +#define glProgramUniformMatrix4x3fv glad_glProgramUniformMatrix4x3fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC glad_glProgramUniformMatrix2x3dv; +#define glProgramUniformMatrix2x3dv glad_glProgramUniformMatrix2x3dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC glad_glProgramUniformMatrix3x2dv; +#define glProgramUniformMatrix3x2dv glad_glProgramUniformMatrix3x2dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC glad_glProgramUniformMatrix2x4dv; +#define glProgramUniformMatrix2x4dv glad_glProgramUniformMatrix2x4dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC glad_glProgramUniformMatrix4x2dv; +#define glProgramUniformMatrix4x2dv glad_glProgramUniformMatrix4x2dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC glad_glProgramUniformMatrix3x4dv; +#define glProgramUniformMatrix3x4dv glad_glProgramUniformMatrix3x4dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC glad_glProgramUniformMatrix4x3dv; +#define glProgramUniformMatrix4x3dv glad_glProgramUniformMatrix4x3dv +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC)(GLuint pipeline); +GLAPI PFNGLVALIDATEPROGRAMPIPELINEPROC glad_glValidateProgramPipeline; +#define glValidateProgramPipeline glad_glValidateProgramPipeline +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC)(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI PFNGLGETPROGRAMPIPELINEINFOLOGPROC glad_glGetProgramPipelineInfoLog; +#define glGetProgramPipelineInfoLog glad_glGetProgramPipelineInfoLog +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC)(GLuint index, GLdouble x); +GLAPI PFNGLVERTEXATTRIBL1DPROC glad_glVertexAttribL1d; +#define glVertexAttribL1d glad_glVertexAttribL1d +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC)(GLuint index, GLdouble x, GLdouble y); +GLAPI PFNGLVERTEXATTRIBL2DPROC glad_glVertexAttribL2d; +#define glVertexAttribL2d glad_glVertexAttribL2d +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLVERTEXATTRIBL3DPROC glad_glVertexAttribL3d; +#define glVertexAttribL3d glad_glVertexAttribL3d +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLVERTEXATTRIBL4DPROC glad_glVertexAttribL4d; +#define glVertexAttribL4d glad_glVertexAttribL4d +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIBL1DVPROC glad_glVertexAttribL1dv; +#define glVertexAttribL1dv glad_glVertexAttribL1dv +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIBL2DVPROC glad_glVertexAttribL2dv; +#define glVertexAttribL2dv glad_glVertexAttribL2dv +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIBL3DVPROC glad_glVertexAttribL3dv; +#define glVertexAttribL3dv glad_glVertexAttribL3dv +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIBL4DVPROC glad_glVertexAttribL4dv; +#define glVertexAttribL4dv glad_glVertexAttribL4dv +typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLVERTEXATTRIBLPOINTERPROC glad_glVertexAttribLPointer; +#define glVertexAttribLPointer glad_glVertexAttribLPointer +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC)(GLuint index, GLenum pname, GLdouble *params); +GLAPI PFNGLGETVERTEXATTRIBLDVPROC glad_glGetVertexAttribLdv; +#define glGetVertexAttribLdv glad_glGetVertexAttribLdv +typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC)(GLuint first, GLsizei count, const GLfloat *v); +GLAPI PFNGLVIEWPORTARRAYVPROC glad_glViewportArrayv; +#define glViewportArrayv glad_glViewportArrayv +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GLAPI PFNGLVIEWPORTINDEXEDFPROC glad_glViewportIndexedf; +#define glViewportIndexedf glad_glViewportIndexedf +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVIEWPORTINDEXEDFVPROC glad_glViewportIndexedfv; +#define glViewportIndexedfv glad_glViewportIndexedfv +typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC)(GLuint first, GLsizei count, const GLint *v); +GLAPI PFNGLSCISSORARRAYVPROC glad_glScissorArrayv; +#define glScissorArrayv glad_glScissorArrayv +typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC)(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GLAPI PFNGLSCISSORINDEXEDPROC glad_glScissorIndexed; +#define glScissorIndexed glad_glScissorIndexed +typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLSCISSORINDEXEDVPROC glad_glScissorIndexedv; +#define glScissorIndexedv glad_glScissorIndexedv +typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC)(GLuint first, GLsizei count, const GLdouble *v); +GLAPI PFNGLDEPTHRANGEARRAYVPROC glad_glDepthRangeArrayv; +#define glDepthRangeArrayv glad_glDepthRangeArrayv +typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC)(GLuint index, GLdouble n, GLdouble f); +GLAPI PFNGLDEPTHRANGEINDEXEDPROC glad_glDepthRangeIndexed; +#define glDepthRangeIndexed glad_glDepthRangeIndexed +typedef void (APIENTRYP PFNGLGETFLOATI_VPROC)(GLenum target, GLuint index, GLfloat *data); +GLAPI PFNGLGETFLOATI_VPROC glad_glGetFloati_v; +#define glGetFloati_v glad_glGetFloati_v +typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC)(GLenum target, GLuint index, GLdouble *data); +GLAPI PFNGLGETDOUBLEI_VPROC glad_glGetDoublei_v; +#define glGetDoublei_v glad_glGetDoublei_v +#endif #ifdef __cplusplus } diff --git a/desktop/glfw_gui/c/deps/include/glad/glad_jni_assist.h b/desktop/glfw_gui/c/deps/include/glad/glad_jni_assist.h index 8d962eb8..7cc9b2aa 100644 --- a/desktop/glfw_gui/c/deps/include/glad/glad_jni_assist.h +++ b/desktop/glfw_gui/c/deps/include/glad/glad_jni_assist.h @@ -54,6 +54,21 @@ GLAPI PFNGLGETSTRINGPROC glad_glGetString; // return 0; //} +// +//int org_mini_gl_GL_get_proc(Runtime *runtime, JClass *clazz) { +// JniEnv *env = runtime->jnienv; +// s32 pos = 0; +// Instance *nameArr = env->localvar_getRefer(runtime, pos++); +// c8 *cstr = nameArr->arr_body; +// if (cstr) { +// void *addr = get_proc(cstr); +// s64 value = (s64) (intptr_t) addr; +// env->push_long(runtime->stack, value); +// } else { +// env->push_long(runtime->stack, 0); +// } +// return 0; +//} diff --git a/desktop/glfw_gui/c/jni_gl.c b/desktop/glfw_gui/c/jni_gl.c index 70fa0b5b..df6324e4 100644 --- a/desktop/glfw_gui/c/jni_gl.c +++ b/desktop/glfw_gui/c/jni_gl.c @@ -19,6 +19,23 @@ int org_mini_gl_GL_init(Runtime *runtime, JClass *clazz) { return 0; } +int org_mini_gl_GL_get_gl_proc(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + Instance *namez = env->localvar_getRefer(runtime->localvar, pos++); + Utf8String *u_namez; + if(namez){ + u_namez = env->utf8_create(); + env->jstring_2_utf8(namez, u_namez, runtime); + } + + GLint64 _re_val = get_gl_proc((const char*)(env->utf8_cstr(u_namez))); + s64 ret_value = *((s64*)&_re_val);env->push_long(runtime->stack, ret_value); + env->utf8_destory(u_namez); + return 0; +} + int org_mini_gl_GL_glCullFace(Runtime *runtime, JClass *clazz) { JniEnv *env = runtime->jnienv; s32 pos = 0; @@ -10986,7 +11003,7 @@ int org_mini_gl_GL_glGetSynciv(Runtime *runtime, JClass *clazz) { intptr_t psync = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; s32 ppname = env->localvar_getInt(runtime->localvar, pos++); - s32 pbufSize = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); Instance *plength = env->localvar_getRefer(runtime->localvar, pos++); int offset_plength = env->localvar_getInt(runtime->localvar, pos++); __refer ptr_plength = NULL; @@ -11002,7 +11019,7 @@ int org_mini_gl_GL_glGetSynciv(Runtime *runtime, JClass *clazz) { ptr_pvalues = pvalues->arr_body + offset_pvalues; } else if(offset_pvalues) { ptr_pvalues = (__refer)(intptr_t)offset_pvalues;} - glGetSynciv((GLsync)psync, (GLenum)ppname, (GLsizei)pbufSize, (GLsizei*)(ptr_plength), (GLint*)(ptr_pvalues)); + glGetSynciv((GLsync)psync, (GLenum)ppname, (GLsizei)pcount, (GLsizei*)(ptr_plength), (GLint*)(ptr_pvalues)); return 0; @@ -12110,12 +12127,2482 @@ int org_mini_gl_GL_glSecondaryColorP3uiv(Runtime *runtime, JClass *clazz) { return 0; } +int org_mini_gl_GL_glMinSampleShading(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + Int2Float pvalue;pvalue.i = env->localvar_getInt(runtime->localvar, pos++); + + glMinSampleShading((GLfloat)pvalue.f); + + + return 0; +} + +int org_mini_gl_GL_glBlendEquationi(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pbuf = env->localvar_getInt(runtime->localvar, pos++); + s32 pmode = env->localvar_getInt(runtime->localvar, pos++); + + glBlendEquationi((GLuint)pbuf, (GLenum)pmode); + + + return 0; +} + +int org_mini_gl_GL_glBlendEquationSeparatei(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pbuf = env->localvar_getInt(runtime->localvar, pos++); + s32 pmodeRGB = env->localvar_getInt(runtime->localvar, pos++); + s32 pmodeAlpha = env->localvar_getInt(runtime->localvar, pos++); + + glBlendEquationSeparatei((GLuint)pbuf, (GLenum)pmodeRGB, (GLenum)pmodeAlpha); + + + return 0; +} + +int org_mini_gl_GL_glBlendFunci(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pbuf = env->localvar_getInt(runtime->localvar, pos++); + s32 psrc = env->localvar_getInt(runtime->localvar, pos++); + s32 pdst = env->localvar_getInt(runtime->localvar, pos++); + + glBlendFunci((GLuint)pbuf, (GLenum)psrc, (GLenum)pdst); + + + return 0; +} + +int org_mini_gl_GL_glBlendFuncSeparatei(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pbuf = env->localvar_getInt(runtime->localvar, pos++); + s32 psrcRGB = env->localvar_getInt(runtime->localvar, pos++); + s32 pdstRGB = env->localvar_getInt(runtime->localvar, pos++); + s32 psrcAlpha = env->localvar_getInt(runtime->localvar, pos++); + s32 pdstAlpha = env->localvar_getInt(runtime->localvar, pos++); + + glBlendFuncSeparatei((GLuint)pbuf, (GLenum)psrcRGB, (GLenum)pdstRGB, (GLenum)psrcAlpha, (GLenum)pdstAlpha); + + + return 0; +} + +int org_mini_gl_GL_glDrawArraysIndirect(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pmode = env->localvar_getInt(runtime->localvar, pos++); + Instance *pindirect = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pindirect = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pindirect = NULL; + if(pindirect){ + offset_pindirect *= env->data_type_bytes[pindirect->mb.arr_type_index]; + ptr_pindirect = pindirect->arr_body + offset_pindirect; + } else if(offset_pindirect) { ptr_pindirect = (__refer)(intptr_t)offset_pindirect;} + + glDrawArraysIndirect((GLenum)pmode, (const void*)(ptr_pindirect)); + + + return 0; +} + +int org_mini_gl_GL_glDrawElementsIndirect(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pmode = env->localvar_getInt(runtime->localvar, pos++); + s32 ptype = env->localvar_getInt(runtime->localvar, pos++); + Instance *pindirect = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pindirect = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pindirect = NULL; + if(pindirect){ + offset_pindirect *= env->data_type_bytes[pindirect->mb.arr_type_index]; + ptr_pindirect = pindirect->arr_body + offset_pindirect; + } else if(offset_pindirect) { ptr_pindirect = (__refer)(intptr_t)offset_pindirect;} + + glDrawElementsIndirect((GLenum)pmode, (GLenum)ptype, (const void*)(ptr_pindirect)); + + + return 0; +} + +int org_mini_gl_GL_glUniform1d(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Long2Double px;px.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glUniform1d((GLint)plocation, (GLdouble)px.d); + + + return 0; +} + +int org_mini_gl_GL_glUniform2d(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Long2Double px;px.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double py;py.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glUniform2d((GLint)plocation, (GLdouble)px.d, (GLdouble)py.d); + + + return 0; +} + +int org_mini_gl_GL_glUniform3d(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Long2Double px;px.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double py;py.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pz;pz.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glUniform3d((GLint)plocation, (GLdouble)px.d, (GLdouble)py.d, (GLdouble)pz.d); + + + return 0; +} + +int org_mini_gl_GL_glUniform4d(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Long2Double px;px.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double py;py.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pz;pz.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pw;pw.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glUniform4d((GLint)plocation, (GLdouble)px.d, (GLdouble)py.d, (GLdouble)pz.d, (GLdouble)pw.d); + + + return 0; +} + +int org_mini_gl_GL_glUniform1dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniform1dv((GLint)plocation, (GLsizei)pcount, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glUniform2dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniform2dv((GLint)plocation, (GLsizei)pcount, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glUniform3dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniform3dv((GLint)plocation, (GLsizei)pcount, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glUniform4dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniform4dv((GLint)plocation, (GLsizei)pcount, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glUniformMatrix2dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniformMatrix2dv((GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glUniformMatrix3dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniformMatrix3dv((GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glUniformMatrix4dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniformMatrix4dv((GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glUniformMatrix2x3dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniformMatrix2x3dv((GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glUniformMatrix2x4dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniformMatrix2x4dv((GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glUniformMatrix3x2dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniformMatrix3x2dv((GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glUniformMatrix3x4dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniformMatrix3x4dv((GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glUniformMatrix4x2dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniformMatrix4x2dv((GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glUniformMatrix4x3dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glUniformMatrix4x3dv((GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glGetUniformdv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Instance *pparams = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pparams = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pparams = NULL; + if(pparams){ + offset_pparams *= env->data_type_bytes[pparams->mb.arr_type_index]; + ptr_pparams = pparams->arr_body + offset_pparams; + } else if(offset_pparams) { ptr_pparams = (__refer)(intptr_t)offset_pparams;} + + glGetUniformdv((GLuint)pprogram, (GLint)plocation, (GLdouble*)(ptr_pparams)); + + + return 0; +} + +int org_mini_gl_GL_glGetSubroutineUniformLocation(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 pshadertype = env->localvar_getInt(runtime->localvar, pos++); + Instance *pname = env->localvar_getRefer(runtime->localvar, pos++); + __refer ptr_pname = pname->arr_body ; + + GLint _re_val = glGetSubroutineUniformLocation((GLuint)pprogram, (GLenum)pshadertype, (const GLchar*)(ptr_pname)); + s32 ret_value = *((s32*)&_re_val);env->push_int(runtime->stack, ret_value); + + return 0; +} + +int org_mini_gl_GL_glGetSubroutineIndex(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 pshadertype = env->localvar_getInt(runtime->localvar, pos++); + Instance *pname = env->localvar_getRefer(runtime->localvar, pos++); + __refer ptr_pname = pname->arr_body ; + + GLuint _re_val = glGetSubroutineIndex((GLuint)pprogram, (GLenum)pshadertype, (const GLchar*)(ptr_pname)); + s32 ret_value = *((s32*)&_re_val);env->push_int(runtime->stack, ret_value); + + return 0; +} + +int org_mini_gl_GL_glGetActiveSubroutineUniformiv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 pshadertype = env->localvar_getInt(runtime->localvar, pos++); + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + s32 ppname = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalues = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalues = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalues = NULL; + if(pvalues){ + offset_pvalues *= env->data_type_bytes[pvalues->mb.arr_type_index]; + ptr_pvalues = pvalues->arr_body + offset_pvalues; + } else if(offset_pvalues) { ptr_pvalues = (__refer)(intptr_t)offset_pvalues;} + + glGetActiveSubroutineUniformiv((GLuint)pprogram, (GLenum)pshadertype, (GLuint)pindex, (GLenum)ppname, (GLint*)(ptr_pvalues)); + + + return 0; +} + +int org_mini_gl_GL_glGetActiveSubroutineUniformName(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 pshadertype = env->localvar_getInt(runtime->localvar, pos++); + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + s32 pbufSize = env->localvar_getInt(runtime->localvar, pos++); + Instance *plength = env->localvar_getRefer(runtime->localvar, pos++); + int offset_plength = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_plength = NULL; + if(plength){ + offset_plength *= env->data_type_bytes[plength->mb.arr_type_index]; + ptr_plength = plength->arr_body + offset_plength; + } else if(offset_plength) { ptr_plength = (__refer)(intptr_t)offset_plength;} + Instance *pname = env->localvar_getRefer(runtime->localvar, pos++); + __refer ptr_pname = pname->arr_body ; + + glGetActiveSubroutineUniformName((GLuint)pprogram, (GLenum)pshadertype, (GLuint)pindex, (GLsizei)pbufSize, (GLsizei*)(ptr_plength), (GLchar*)(ptr_pname)); + + + return 0; +} + +int org_mini_gl_GL_glGetActiveSubroutineName(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 pshadertype = env->localvar_getInt(runtime->localvar, pos++); + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + s32 pbufSize = env->localvar_getInt(runtime->localvar, pos++); + Instance *plength = env->localvar_getRefer(runtime->localvar, pos++); + int offset_plength = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_plength = NULL; + if(plength){ + offset_plength *= env->data_type_bytes[plength->mb.arr_type_index]; + ptr_plength = plength->arr_body + offset_plength; + } else if(offset_plength) { ptr_plength = (__refer)(intptr_t)offset_plength;} + Instance *pname = env->localvar_getRefer(runtime->localvar, pos++); + __refer ptr_pname = pname->arr_body ; + + glGetActiveSubroutineName((GLuint)pprogram, (GLenum)pshadertype, (GLuint)pindex, (GLsizei)pbufSize, (GLsizei*)(ptr_plength), (GLchar*)(ptr_pname)); + + + return 0; +} + +int org_mini_gl_GL_glUniformSubroutinesuiv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pshadertype = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pindices = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pindices = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pindices = NULL; + if(pindices){ + offset_pindices *= env->data_type_bytes[pindices->mb.arr_type_index]; + ptr_pindices = pindices->arr_body + offset_pindices; + } else if(offset_pindices) { ptr_pindices = (__refer)(intptr_t)offset_pindices;} + + glUniformSubroutinesuiv((GLenum)pshadertype, (GLsizei)pcount, (const GLuint*)(ptr_pindices)); + + + return 0; +} + +int org_mini_gl_GL_glGetUniformSubroutineuiv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pshadertype = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Instance *pparams = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pparams = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pparams = NULL; + if(pparams){ + offset_pparams *= env->data_type_bytes[pparams->mb.arr_type_index]; + ptr_pparams = pparams->arr_body + offset_pparams; + } else if(offset_pparams) { ptr_pparams = (__refer)(intptr_t)offset_pparams;} + + glGetUniformSubroutineuiv((GLenum)pshadertype, (GLint)plocation, (GLuint*)(ptr_pparams)); + + + return 0; +} + +int org_mini_gl_GL_glGetProgramStageiv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 pshadertype = env->localvar_getInt(runtime->localvar, pos++); + s32 ppname = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalues = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalues = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalues = NULL; + if(pvalues){ + offset_pvalues *= env->data_type_bytes[pvalues->mb.arr_type_index]; + ptr_pvalues = pvalues->arr_body + offset_pvalues; + } else if(offset_pvalues) { ptr_pvalues = (__refer)(intptr_t)offset_pvalues;} + + glGetProgramStageiv((GLuint)pprogram, (GLenum)pshadertype, (GLenum)ppname, (GLint*)(ptr_pvalues)); + + + return 0; +} + +int org_mini_gl_GL_glPatchParameteri(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ppname = env->localvar_getInt(runtime->localvar, pos++); + s32 pvalue = env->localvar_getInt(runtime->localvar, pos++); + + glPatchParameteri((GLenum)ppname, (GLint)pvalue); + + + return 0; +} + +int org_mini_gl_GL_glPatchParameterfv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ppname = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalues = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalues = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalues = NULL; + if(pvalues){ + offset_pvalues *= env->data_type_bytes[pvalues->mb.arr_type_index]; + ptr_pvalues = pvalues->arr_body + offset_pvalues; + } else if(offset_pvalues) { ptr_pvalues = (__refer)(intptr_t)offset_pvalues;} + + glPatchParameterfv((GLenum)ppname, (const GLfloat*)(ptr_pvalues)); + + + return 0; +} + +int org_mini_gl_GL_glBindTransformFeedback(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ptarget = env->localvar_getInt(runtime->localvar, pos++); + s32 pid = env->localvar_getInt(runtime->localvar, pos++); + + glBindTransformFeedback((GLenum)ptarget, (GLuint)pid); + + + return 0; +} + +int org_mini_gl_GL_glDeleteTransformFeedbacks(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pn = env->localvar_getInt(runtime->localvar, pos++); + Instance *pids = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pids = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pids = NULL; + if(pids){ + offset_pids *= env->data_type_bytes[pids->mb.arr_type_index]; + ptr_pids = pids->arr_body + offset_pids; + } else if(offset_pids) { ptr_pids = (__refer)(intptr_t)offset_pids;} + + glDeleteTransformFeedbacks((GLsizei)pn, (const GLuint*)(ptr_pids)); + + + return 0; +} + +int org_mini_gl_GL_glGenTransformFeedbacks(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pn = env->localvar_getInt(runtime->localvar, pos++); + Instance *pids = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pids = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pids = NULL; + if(pids){ + offset_pids *= env->data_type_bytes[pids->mb.arr_type_index]; + ptr_pids = pids->arr_body + offset_pids; + } else if(offset_pids) { ptr_pids = (__refer)(intptr_t)offset_pids;} + + glGenTransformFeedbacks((GLsizei)pn, (GLuint*)(ptr_pids)); + + + return 0; +} + +int org_mini_gl_GL_glIsTransformFeedback(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pid = env->localvar_getInt(runtime->localvar, pos++); + + GLboolean _re_val = glIsTransformFeedback((GLuint)pid); + s32 ret_value = *((s32*)&_re_val);env->push_int(runtime->stack, ret_value); + + return 0; +} + +int org_mini_gl_GL_glPauseTransformFeedback(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + + glPauseTransformFeedback(); + + + return 0; +} + +int org_mini_gl_GL_glResumeTransformFeedback(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + + glResumeTransformFeedback(); + + + return 0; +} + +int org_mini_gl_GL_glDrawTransformFeedback(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pmode = env->localvar_getInt(runtime->localvar, pos++); + s32 pid = env->localvar_getInt(runtime->localvar, pos++); + + glDrawTransformFeedback((GLenum)pmode, (GLuint)pid); + + + return 0; +} + +int org_mini_gl_GL_glDrawTransformFeedbackStream(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pmode = env->localvar_getInt(runtime->localvar, pos++); + s32 pid = env->localvar_getInt(runtime->localvar, pos++); + s32 pstream = env->localvar_getInt(runtime->localvar, pos++); + + glDrawTransformFeedbackStream((GLenum)pmode, (GLuint)pid, (GLuint)pstream); + + + return 0; +} + +int org_mini_gl_GL_glBeginQueryIndexed(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ptarget = env->localvar_getInt(runtime->localvar, pos++); + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + s32 pid = env->localvar_getInt(runtime->localvar, pos++); + + glBeginQueryIndexed((GLenum)ptarget, (GLuint)pindex, (GLuint)pid); + + + return 0; +} + +int org_mini_gl_GL_glEndQueryIndexed(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ptarget = env->localvar_getInt(runtime->localvar, pos++); + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + + glEndQueryIndexed((GLenum)ptarget, (GLuint)pindex); + + + return 0; +} + +int org_mini_gl_GL_glGetQueryIndexediv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ptarget = env->localvar_getInt(runtime->localvar, pos++); + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + s32 ppname = env->localvar_getInt(runtime->localvar, pos++); + Instance *pparams = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pparams = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pparams = NULL; + if(pparams){ + offset_pparams *= env->data_type_bytes[pparams->mb.arr_type_index]; + ptr_pparams = pparams->arr_body + offset_pparams; + } else if(offset_pparams) { ptr_pparams = (__refer)(intptr_t)offset_pparams;} + + glGetQueryIndexediv((GLenum)ptarget, (GLuint)pindex, (GLenum)ppname, (GLint*)(ptr_pparams)); + + + return 0; +} + +int org_mini_gl_GL_glReleaseShaderCompiler(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + + glReleaseShaderCompiler(); + + + return 0; +} + +int org_mini_gl_GL_glShaderBinary(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pshaders = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pshaders = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pshaders = NULL; + if(pshaders){ + offset_pshaders *= env->data_type_bytes[pshaders->mb.arr_type_index]; + ptr_pshaders = pshaders->arr_body + offset_pshaders; + } else if(offset_pshaders) { ptr_pshaders = (__refer)(intptr_t)offset_pshaders;} + s32 pbinaryFormat = env->localvar_getInt(runtime->localvar, pos++); + Instance *pbinary = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pbinary = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pbinary = NULL; + if(pbinary){ + offset_pbinary *= env->data_type_bytes[pbinary->mb.arr_type_index]; + ptr_pbinary = pbinary->arr_body + offset_pbinary; + } else if(offset_pbinary) { ptr_pbinary = (__refer)(intptr_t)offset_pbinary;} + s32 plength = env->localvar_getInt(runtime->localvar, pos++); + + glShaderBinary((GLsizei)pcount, (const GLuint*)(ptr_pshaders), (GLenum)pbinaryFormat, (const void*)(ptr_pbinary), (GLsizei)plength); + + + return 0; +} + +int org_mini_gl_GL_glGetShaderPrecisionFormat(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pshadertype = env->localvar_getInt(runtime->localvar, pos++); + s32 pprecisiontype = env->localvar_getInt(runtime->localvar, pos++); + Instance *prange = env->localvar_getRefer(runtime->localvar, pos++); + int offset_prange = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_prange = NULL; + if(prange){ + offset_prange *= env->data_type_bytes[prange->mb.arr_type_index]; + ptr_prange = prange->arr_body + offset_prange; + } else if(offset_prange) { ptr_prange = (__refer)(intptr_t)offset_prange;} + Instance *pprecision = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pprecision = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pprecision = NULL; + if(pprecision){ + offset_pprecision *= env->data_type_bytes[pprecision->mb.arr_type_index]; + ptr_pprecision = pprecision->arr_body + offset_pprecision; + } else if(offset_pprecision) { ptr_pprecision = (__refer)(intptr_t)offset_pprecision;} + + glGetShaderPrecisionFormat((GLenum)pshadertype, (GLenum)pprecisiontype, (GLint*)(ptr_prange), (GLint*)(ptr_pprecision)); + + + return 0; +} + +int org_mini_gl_GL_glDepthRangef(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + Int2Float pn;pn.i = env->localvar_getInt(runtime->localvar, pos++); + Int2Float pf;pf.i = env->localvar_getInt(runtime->localvar, pos++); + + glDepthRangef((GLfloat)pn.f, (GLfloat)pf.f); + + + return 0; +} + +int org_mini_gl_GL_glClearDepthf(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + Int2Float pd;pd.i = env->localvar_getInt(runtime->localvar, pos++); + + glClearDepthf((GLfloat)pd.f); + + + return 0; +} + +int org_mini_gl_GL_glGetProgramBinary(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 pbufSize = env->localvar_getInt(runtime->localvar, pos++); + Instance *plength = env->localvar_getRefer(runtime->localvar, pos++); + int offset_plength = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_plength = NULL; + if(plength){ + offset_plength *= env->data_type_bytes[plength->mb.arr_type_index]; + ptr_plength = plength->arr_body + offset_plength; + } else if(offset_plength) { ptr_plength = (__refer)(intptr_t)offset_plength;} + Instance *pbinaryFormat = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pbinaryFormat = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pbinaryFormat = NULL; + if(pbinaryFormat){ + offset_pbinaryFormat *= env->data_type_bytes[pbinaryFormat->mb.arr_type_index]; + ptr_pbinaryFormat = pbinaryFormat->arr_body + offset_pbinaryFormat; + } else if(offset_pbinaryFormat) { ptr_pbinaryFormat = (__refer)(intptr_t)offset_pbinaryFormat;} + Instance *pbinary = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pbinary = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pbinary = NULL; + if(pbinary){ + offset_pbinary *= env->data_type_bytes[pbinary->mb.arr_type_index]; + ptr_pbinary = pbinary->arr_body + offset_pbinary; + } else if(offset_pbinary) { ptr_pbinary = (__refer)(intptr_t)offset_pbinary;} + + glGetProgramBinary((GLuint)pprogram, (GLsizei)pbufSize, (GLsizei*)(ptr_plength), (GLenum*)(ptr_pbinaryFormat), (void*)(ptr_pbinary)); + + + return 0; +} + +int org_mini_gl_GL_glProgramBinary(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 pbinaryFormat = env->localvar_getInt(runtime->localvar, pos++); + Instance *pbinary = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pbinary = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pbinary = NULL; + if(pbinary){ + offset_pbinary *= env->data_type_bytes[pbinary->mb.arr_type_index]; + ptr_pbinary = pbinary->arr_body + offset_pbinary; + } else if(offset_pbinary) { ptr_pbinary = (__refer)(intptr_t)offset_pbinary;} + s32 plength = env->localvar_getInt(runtime->localvar, pos++); + + glProgramBinary((GLuint)pprogram, (GLenum)pbinaryFormat, (const void*)(ptr_pbinary), (GLsizei)plength); + + + return 0; +} + +int org_mini_gl_GL_glProgramParameteri(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 ppname = env->localvar_getInt(runtime->localvar, pos++); + s32 pvalue = env->localvar_getInt(runtime->localvar, pos++); + + glProgramParameteri((GLuint)pprogram, (GLenum)ppname, (GLint)pvalue); + + + return 0; +} + +int org_mini_gl_GL_glUseProgramStages(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ppipeline = env->localvar_getInt(runtime->localvar, pos++); + s32 pstages = env->localvar_getInt(runtime->localvar, pos++); + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + + glUseProgramStages((GLuint)ppipeline, (GLbitfield)pstages, (GLuint)pprogram); + + + return 0; +} + +int org_mini_gl_GL_glActiveShaderProgram(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ppipeline = env->localvar_getInt(runtime->localvar, pos++); + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + + glActiveShaderProgram((GLuint)ppipeline, (GLuint)pprogram); + + + return 0; +} + +int org_mini_gl_GL_glCreateShaderProgramv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ptype = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pstrings = env->localvar_getRefer(runtime->localvar, pos++); + CStringArr *ptr_pstrings = NULL; + if(pstrings){ + ptr_pstrings = env->cstringarr_create(pstrings); + } + + GLuint _re_val = glCreateShaderProgramv((GLenum)ptype, (GLsizei)pcount, (const GLchar*const*)(ptr_pstrings->arr_body)); + s32 ret_value = *((s32*)&_re_val);env->push_int(runtime->stack, ret_value); + env->cstringarr_destory(ptr_pstrings); + return 0; +} + +int org_mini_gl_GL_glBindProgramPipeline(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ppipeline = env->localvar_getInt(runtime->localvar, pos++); + + glBindProgramPipeline((GLuint)ppipeline); + + + return 0; +} + +int org_mini_gl_GL_glDeleteProgramPipelines(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pn = env->localvar_getInt(runtime->localvar, pos++); + Instance *ppipelines = env->localvar_getRefer(runtime->localvar, pos++); + int offset_ppipelines = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_ppipelines = NULL; + if(ppipelines){ + offset_ppipelines *= env->data_type_bytes[ppipelines->mb.arr_type_index]; + ptr_ppipelines = ppipelines->arr_body + offset_ppipelines; + } else if(offset_ppipelines) { ptr_ppipelines = (__refer)(intptr_t)offset_ppipelines;} + + glDeleteProgramPipelines((GLsizei)pn, (const GLuint*)(ptr_ppipelines)); + + + return 0; +} + +int org_mini_gl_GL_glGenProgramPipelines(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pn = env->localvar_getInt(runtime->localvar, pos++); + Instance *ppipelines = env->localvar_getRefer(runtime->localvar, pos++); + int offset_ppipelines = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_ppipelines = NULL; + if(ppipelines){ + offset_ppipelines *= env->data_type_bytes[ppipelines->mb.arr_type_index]; + ptr_ppipelines = ppipelines->arr_body + offset_ppipelines; + } else if(offset_ppipelines) { ptr_ppipelines = (__refer)(intptr_t)offset_ppipelines;} + + glGenProgramPipelines((GLsizei)pn, (GLuint*)(ptr_ppipelines)); + + + return 0; +} + +int org_mini_gl_GL_glIsProgramPipeline(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ppipeline = env->localvar_getInt(runtime->localvar, pos++); + + GLboolean _re_val = glIsProgramPipeline((GLuint)ppipeline); + s32 ret_value = *((s32*)&_re_val);env->push_int(runtime->stack, ret_value); + + return 0; +} + +int org_mini_gl_GL_glGetProgramPipelineiv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ppipeline = env->localvar_getInt(runtime->localvar, pos++); + s32 ppname = env->localvar_getInt(runtime->localvar, pos++); + Instance *pparams = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pparams = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pparams = NULL; + if(pparams){ + offset_pparams *= env->data_type_bytes[pparams->mb.arr_type_index]; + ptr_pparams = pparams->arr_body + offset_pparams; + } else if(offset_pparams) { ptr_pparams = (__refer)(intptr_t)offset_pparams;} + + glGetProgramPipelineiv((GLuint)ppipeline, (GLenum)ppname, (GLint*)(ptr_pparams)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform1i(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pv0 = env->localvar_getInt(runtime->localvar, pos++); + + glProgramUniform1i((GLuint)pprogram, (GLint)plocation, (GLint)pv0); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform1iv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform1iv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLint*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform1f(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Int2Float pv0;pv0.i = env->localvar_getInt(runtime->localvar, pos++); + + glProgramUniform1f((GLuint)pprogram, (GLint)plocation, (GLfloat)pv0.f); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform1fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform1fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform1d(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Long2Double pv0;pv0.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glProgramUniform1d((GLuint)pprogram, (GLint)plocation, (GLdouble)pv0.d); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform1dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform1dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform1ui(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pv0 = env->localvar_getInt(runtime->localvar, pos++); + + glProgramUniform1ui((GLuint)pprogram, (GLint)plocation, (GLuint)pv0); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform1uiv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform1uiv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLuint*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform2i(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pv0 = env->localvar_getInt(runtime->localvar, pos++); + s32 pv1 = env->localvar_getInt(runtime->localvar, pos++); + + glProgramUniform2i((GLuint)pprogram, (GLint)plocation, (GLint)pv0, (GLint)pv1); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform2iv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform2iv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLint*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform2f(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Int2Float pv0;pv0.i = env->localvar_getInt(runtime->localvar, pos++); + Int2Float pv1;pv1.i = env->localvar_getInt(runtime->localvar, pos++); + + glProgramUniform2f((GLuint)pprogram, (GLint)plocation, (GLfloat)pv0.f, (GLfloat)pv1.f); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform2fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform2fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform2d(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Long2Double pv0;pv0.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pv1;pv1.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glProgramUniform2d((GLuint)pprogram, (GLint)plocation, (GLdouble)pv0.d, (GLdouble)pv1.d); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform2dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform2dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform2ui(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pv0 = env->localvar_getInt(runtime->localvar, pos++); + s32 pv1 = env->localvar_getInt(runtime->localvar, pos++); + + glProgramUniform2ui((GLuint)pprogram, (GLint)plocation, (GLuint)pv0, (GLuint)pv1); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform2uiv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform2uiv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLuint*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform3i(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pv0 = env->localvar_getInt(runtime->localvar, pos++); + s32 pv1 = env->localvar_getInt(runtime->localvar, pos++); + s32 pv2 = env->localvar_getInt(runtime->localvar, pos++); + + glProgramUniform3i((GLuint)pprogram, (GLint)plocation, (GLint)pv0, (GLint)pv1, (GLint)pv2); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform3iv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform3iv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLint*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform3f(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Int2Float pv0;pv0.i = env->localvar_getInt(runtime->localvar, pos++); + Int2Float pv1;pv1.i = env->localvar_getInt(runtime->localvar, pos++); + Int2Float pv2;pv2.i = env->localvar_getInt(runtime->localvar, pos++); + + glProgramUniform3f((GLuint)pprogram, (GLint)plocation, (GLfloat)pv0.f, (GLfloat)pv1.f, (GLfloat)pv2.f); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform3fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform3fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform3d(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Long2Double pv0;pv0.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pv1;pv1.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pv2;pv2.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glProgramUniform3d((GLuint)pprogram, (GLint)plocation, (GLdouble)pv0.d, (GLdouble)pv1.d, (GLdouble)pv2.d); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform3dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform3dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform3ui(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pv0 = env->localvar_getInt(runtime->localvar, pos++); + s32 pv1 = env->localvar_getInt(runtime->localvar, pos++); + s32 pv2 = env->localvar_getInt(runtime->localvar, pos++); + + glProgramUniform3ui((GLuint)pprogram, (GLint)plocation, (GLuint)pv0, (GLuint)pv1, (GLuint)pv2); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform3uiv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform3uiv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLuint*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform4i(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pv0 = env->localvar_getInt(runtime->localvar, pos++); + s32 pv1 = env->localvar_getInt(runtime->localvar, pos++); + s32 pv2 = env->localvar_getInt(runtime->localvar, pos++); + s32 pv3 = env->localvar_getInt(runtime->localvar, pos++); + + glProgramUniform4i((GLuint)pprogram, (GLint)plocation, (GLint)pv0, (GLint)pv1, (GLint)pv2, (GLint)pv3); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform4iv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform4iv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLint*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform4f(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Int2Float pv0;pv0.i = env->localvar_getInt(runtime->localvar, pos++); + Int2Float pv1;pv1.i = env->localvar_getInt(runtime->localvar, pos++); + Int2Float pv2;pv2.i = env->localvar_getInt(runtime->localvar, pos++); + Int2Float pv3;pv3.i = env->localvar_getInt(runtime->localvar, pos++); + + glProgramUniform4f((GLuint)pprogram, (GLint)plocation, (GLfloat)pv0.f, (GLfloat)pv1.f, (GLfloat)pv2.f, (GLfloat)pv3.f); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform4fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform4fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform4d(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + Long2Double pv0;pv0.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pv1;pv1.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pv2;pv2.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pv3;pv3.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glProgramUniform4d((GLuint)pprogram, (GLint)plocation, (GLdouble)pv0.d, (GLdouble)pv1.d, (GLdouble)pv2.d, (GLdouble)pv3.d); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform4dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform4dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform4ui(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pv0 = env->localvar_getInt(runtime->localvar, pos++); + s32 pv1 = env->localvar_getInt(runtime->localvar, pos++); + s32 pv2 = env->localvar_getInt(runtime->localvar, pos++); + s32 pv3 = env->localvar_getInt(runtime->localvar, pos++); + + glProgramUniform4ui((GLuint)pprogram, (GLint)plocation, (GLuint)pv0, (GLuint)pv1, (GLuint)pv2, (GLuint)pv3); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniform4uiv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniform4uiv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (const GLuint*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix2fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix2fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix3fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix3fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix4fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix4fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix2dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix2dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix3dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix3dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix4dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix4dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix2x3fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix2x3fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix3x2fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix3x2fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix2x4fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix2x4fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix4x2fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix4x2fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix3x4fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix3x4fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix4x3fv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix4x3fv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLfloat*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix2x3dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix2x3dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix3x2dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix3x2dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix2x4dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix2x4dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix4x2dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix4x2dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix3x4dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix3x4dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glProgramUniformMatrix4x3dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pprogram = env->localvar_getInt(runtime->localvar, pos++); + s32 plocation = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + s32 ptranspose = env->localvar_getInt(runtime->localvar, pos++); + Instance *pvalue = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pvalue = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pvalue = NULL; + if(pvalue){ + offset_pvalue *= env->data_type_bytes[pvalue->mb.arr_type_index]; + ptr_pvalue = pvalue->arr_body + offset_pvalue; + } else if(offset_pvalue) { ptr_pvalue = (__refer)(intptr_t)offset_pvalue;} + + glProgramUniformMatrix4x3dv((GLuint)pprogram, (GLint)plocation, (GLsizei)pcount, (GLboolean)ptranspose, (const GLdouble*)(ptr_pvalue)); + + + return 0; +} + +int org_mini_gl_GL_glValidateProgramPipeline(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ppipeline = env->localvar_getInt(runtime->localvar, pos++); + + glValidateProgramPipeline((GLuint)ppipeline); + + + return 0; +} + +int org_mini_gl_GL_glGetProgramPipelineInfoLog(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ppipeline = env->localvar_getInt(runtime->localvar, pos++); + s32 pbufSize = env->localvar_getInt(runtime->localvar, pos++); + Instance *plength = env->localvar_getRefer(runtime->localvar, pos++); + int offset_plength = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_plength = NULL; + if(plength){ + offset_plength *= env->data_type_bytes[plength->mb.arr_type_index]; + ptr_plength = plength->arr_body + offset_plength; + } else if(offset_plength) { ptr_plength = (__refer)(intptr_t)offset_plength;} + Instance *pinfoLog = env->localvar_getRefer(runtime->localvar, pos++); + __refer ptr_pinfoLog = pinfoLog->arr_body ; + + glGetProgramPipelineInfoLog((GLuint)ppipeline, (GLsizei)pbufSize, (GLsizei*)(ptr_plength), (GLchar*)(ptr_pinfoLog)); + + + return 0; +} + +int org_mini_gl_GL_glVertexAttribL1d(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Long2Double px;px.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glVertexAttribL1d((GLuint)pindex, (GLdouble)px.d); + + + return 0; +} + +int org_mini_gl_GL_glVertexAttribL2d(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Long2Double px;px.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double py;py.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glVertexAttribL2d((GLuint)pindex, (GLdouble)px.d, (GLdouble)py.d); + + + return 0; +} + +int org_mini_gl_GL_glVertexAttribL3d(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Long2Double px;px.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double py;py.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pz;pz.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glVertexAttribL3d((GLuint)pindex, (GLdouble)px.d, (GLdouble)py.d, (GLdouble)pz.d); + + + return 0; +} + +int org_mini_gl_GL_glVertexAttribL4d(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Long2Double px;px.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double py;py.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pz;pz.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pw;pw.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glVertexAttribL4d((GLuint)pindex, (GLdouble)px.d, (GLdouble)py.d, (GLdouble)pz.d, (GLdouble)pw.d); + + + return 0; +} + +int org_mini_gl_GL_glVertexAttribL1dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Instance *pv = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pv = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pv = NULL; + if(pv){ + offset_pv *= env->data_type_bytes[pv->mb.arr_type_index]; + ptr_pv = pv->arr_body + offset_pv; + } else if(offset_pv) { ptr_pv = (__refer)(intptr_t)offset_pv;} + + glVertexAttribL1dv((GLuint)pindex, (const GLdouble*)(ptr_pv)); + + + return 0; +} + +int org_mini_gl_GL_glVertexAttribL2dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Instance *pv = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pv = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pv = NULL; + if(pv){ + offset_pv *= env->data_type_bytes[pv->mb.arr_type_index]; + ptr_pv = pv->arr_body + offset_pv; + } else if(offset_pv) { ptr_pv = (__refer)(intptr_t)offset_pv;} + + glVertexAttribL2dv((GLuint)pindex, (const GLdouble*)(ptr_pv)); + + + return 0; +} + +int org_mini_gl_GL_glVertexAttribL3dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Instance *pv = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pv = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pv = NULL; + if(pv){ + offset_pv *= env->data_type_bytes[pv->mb.arr_type_index]; + ptr_pv = pv->arr_body + offset_pv; + } else if(offset_pv) { ptr_pv = (__refer)(intptr_t)offset_pv;} + + glVertexAttribL3dv((GLuint)pindex, (const GLdouble*)(ptr_pv)); + + + return 0; +} + +int org_mini_gl_GL_glVertexAttribL4dv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Instance *pv = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pv = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pv = NULL; + if(pv){ + offset_pv *= env->data_type_bytes[pv->mb.arr_type_index]; + ptr_pv = pv->arr_body + offset_pv; + } else if(offset_pv) { ptr_pv = (__refer)(intptr_t)offset_pv;} + + glVertexAttribL4dv((GLuint)pindex, (const GLdouble*)(ptr_pv)); + + + return 0; +} + +int org_mini_gl_GL_glVertexAttribLPointer(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + s32 psize = env->localvar_getInt(runtime->localvar, pos++); + s32 ptype = env->localvar_getInt(runtime->localvar, pos++); + s32 pstride = env->localvar_getInt(runtime->localvar, pos++); + Instance *ppointer = env->localvar_getRefer(runtime->localvar, pos++); + int offset_ppointer = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_ppointer = NULL; + if(ppointer){ + offset_ppointer *= env->data_type_bytes[ppointer->mb.arr_type_index]; + ptr_ppointer = ppointer->arr_body + offset_ppointer; + } else if(offset_ppointer) { ptr_ppointer = (__refer)(intptr_t)offset_ppointer;} + + glVertexAttribLPointer((GLuint)pindex, (GLint)psize, (GLenum)ptype, (GLsizei)pstride, (const void*)(ptr_ppointer)); + + + return 0; +} + +int org_mini_gl_GL_glGetVertexAttribLdv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + s32 ppname = env->localvar_getInt(runtime->localvar, pos++); + Instance *pparams = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pparams = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pparams = NULL; + if(pparams){ + offset_pparams *= env->data_type_bytes[pparams->mb.arr_type_index]; + ptr_pparams = pparams->arr_body + offset_pparams; + } else if(offset_pparams) { ptr_pparams = (__refer)(intptr_t)offset_pparams;} + + glGetVertexAttribLdv((GLuint)pindex, (GLenum)ppname, (GLdouble*)(ptr_pparams)); + + + return 0; +} + +int org_mini_gl_GL_glViewportArrayv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pfirst = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pv = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pv = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pv = NULL; + if(pv){ + offset_pv *= env->data_type_bytes[pv->mb.arr_type_index]; + ptr_pv = pv->arr_body + offset_pv; + } else if(offset_pv) { ptr_pv = (__refer)(intptr_t)offset_pv;} + + glViewportArrayv((GLuint)pfirst, (GLsizei)pcount, (const GLfloat*)(ptr_pv)); + + + return 0; +} + +int org_mini_gl_GL_glViewportIndexedf(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Int2Float px;px.i = env->localvar_getInt(runtime->localvar, pos++); + Int2Float py;py.i = env->localvar_getInt(runtime->localvar, pos++); + Int2Float pw;pw.i = env->localvar_getInt(runtime->localvar, pos++); + Int2Float ph;ph.i = env->localvar_getInt(runtime->localvar, pos++); + + glViewportIndexedf((GLuint)pindex, (GLfloat)px.f, (GLfloat)py.f, (GLfloat)pw.f, (GLfloat)ph.f); + + + return 0; +} + +int org_mini_gl_GL_glViewportIndexedfv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Instance *pv = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pv = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pv = NULL; + if(pv){ + offset_pv *= env->data_type_bytes[pv->mb.arr_type_index]; + ptr_pv = pv->arr_body + offset_pv; + } else if(offset_pv) { ptr_pv = (__refer)(intptr_t)offset_pv;} + + glViewportIndexedfv((GLuint)pindex, (const GLfloat*)(ptr_pv)); + + + return 0; +} + +int org_mini_gl_GL_glScissorArrayv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pfirst = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pv = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pv = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pv = NULL; + if(pv){ + offset_pv *= env->data_type_bytes[pv->mb.arr_type_index]; + ptr_pv = pv->arr_body + offset_pv; + } else if(offset_pv) { ptr_pv = (__refer)(intptr_t)offset_pv;} + + glScissorArrayv((GLuint)pfirst, (GLsizei)pcount, (const GLint*)(ptr_pv)); + + + return 0; +} + +int org_mini_gl_GL_glScissorIndexed(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + s32 pleft = env->localvar_getInt(runtime->localvar, pos++); + s32 pbottom = env->localvar_getInt(runtime->localvar, pos++); + s32 pwidth = env->localvar_getInt(runtime->localvar, pos++); + s32 pheight = env->localvar_getInt(runtime->localvar, pos++); + + glScissorIndexed((GLuint)pindex, (GLint)pleft, (GLint)pbottom, (GLsizei)pwidth, (GLsizei)pheight); + + + return 0; +} + +int org_mini_gl_GL_glScissorIndexedv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Instance *pv = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pv = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pv = NULL; + if(pv){ + offset_pv *= env->data_type_bytes[pv->mb.arr_type_index]; + ptr_pv = pv->arr_body + offset_pv; + } else if(offset_pv) { ptr_pv = (__refer)(intptr_t)offset_pv;} + + glScissorIndexedv((GLuint)pindex, (const GLint*)(ptr_pv)); + + + return 0; +} + +int org_mini_gl_GL_glDepthRangeArrayv(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pfirst = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); + Instance *pv = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pv = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pv = NULL; + if(pv){ + offset_pv *= env->data_type_bytes[pv->mb.arr_type_index]; + ptr_pv = pv->arr_body + offset_pv; + } else if(offset_pv) { ptr_pv = (__refer)(intptr_t)offset_pv;} + + glDepthRangeArrayv((GLuint)pfirst, (GLsizei)pcount, (const GLdouble*)(ptr_pv)); + + + return 0; +} + +int org_mini_gl_GL_glDepthRangeIndexed(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Long2Double pn;pn.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + Long2Double pf;pf.l = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; + + glDepthRangeIndexed((GLuint)pindex, (GLdouble)pn.d, (GLdouble)pf.d); + + + return 0; +} + +int org_mini_gl_GL_glGetFloati_v(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ptarget = env->localvar_getInt(runtime->localvar, pos++); + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Instance *pdata = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pdata = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pdata = NULL; + if(pdata){ + offset_pdata *= env->data_type_bytes[pdata->mb.arr_type_index]; + ptr_pdata = pdata->arr_body + offset_pdata; + } else if(offset_pdata) { ptr_pdata = (__refer)(intptr_t)offset_pdata;} + + glGetFloati_v((GLenum)ptarget, (GLuint)pindex, (GLfloat*)(ptr_pdata)); + + + return 0; +} + +int org_mini_gl_GL_glGetDoublei_v(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + s32 ptarget = env->localvar_getInt(runtime->localvar, pos++); + s32 pindex = env->localvar_getInt(runtime->localvar, pos++); + Instance *pdata = env->localvar_getRefer(runtime->localvar, pos++); + int offset_pdata = env->localvar_getInt(runtime->localvar, pos++); + __refer ptr_pdata = NULL; + if(pdata){ + offset_pdata *= env->data_type_bytes[pdata->mb.arr_type_index]; + ptr_pdata = pdata->arr_body + offset_pdata; + } else if(offset_pdata) { ptr_pdata = (__refer)(intptr_t)offset_pdata;} + + glGetDoublei_v((GLenum)ptarget, (GLuint)pindex, (GLdouble*)(ptr_pdata)); + + + return 0; +} + static java_native_method method_gl_table[] = { {"org/mini/gl/GL", "init", "()V", org_mini_gl_GL_init}, +{"org/mini/gl/GL", "get_gl_proc", "(Ljava/lang/String;)J", org_mini_gl_GL_get_gl_proc}, {"org/mini/gl/GL", "glCullFace", "(I)V", org_mini_gl_GL_glCullFace}, {"org/mini/gl/GL", "glFrontFace", "(I)V", org_mini_gl_GL_glFrontFace}, {"org/mini/gl/GL", "glHint", "(II)V", org_mini_gl_GL_glHint}, @@ -12840,6 +15327,140 @@ static java_native_method method_gl_table[] = { {"org/mini/gl/GL", "glColorP4uiv", "(I[II)V", org_mini_gl_GL_glColorP4uiv}, {"org/mini/gl/GL", "glSecondaryColorP3ui", "(II)V", org_mini_gl_GL_glSecondaryColorP3ui}, {"org/mini/gl/GL", "glSecondaryColorP3uiv", "(I[II)V", org_mini_gl_GL_glSecondaryColorP3uiv}, +{"org/mini/gl/GL", "glMinSampleShading", "(F)V", org_mini_gl_GL_glMinSampleShading}, +{"org/mini/gl/GL", "glBlendEquationi", "(II)V", org_mini_gl_GL_glBlendEquationi}, +{"org/mini/gl/GL", "glBlendEquationSeparatei", "(III)V", org_mini_gl_GL_glBlendEquationSeparatei}, +{"org/mini/gl/GL", "glBlendFunci", "(III)V", org_mini_gl_GL_glBlendFunci}, +{"org/mini/gl/GL", "glBlendFuncSeparatei", "(IIIII)V", org_mini_gl_GL_glBlendFuncSeparatei}, +{"org/mini/gl/GL", "glDrawArraysIndirect", "(ILjava/lang/Object;I)V", org_mini_gl_GL_glDrawArraysIndirect}, +{"org/mini/gl/GL", "glDrawElementsIndirect", "(IILjava/lang/Object;I)V", org_mini_gl_GL_glDrawElementsIndirect}, +{"org/mini/gl/GL", "glUniform1d", "(ID)V", org_mini_gl_GL_glUniform1d}, +{"org/mini/gl/GL", "glUniform2d", "(IDD)V", org_mini_gl_GL_glUniform2d}, +{"org/mini/gl/GL", "glUniform3d", "(IDDD)V", org_mini_gl_GL_glUniform3d}, +{"org/mini/gl/GL", "glUniform4d", "(IDDDD)V", org_mini_gl_GL_glUniform4d}, +{"org/mini/gl/GL", "glUniform1dv", "(II[DI)V", org_mini_gl_GL_glUniform1dv}, +{"org/mini/gl/GL", "glUniform2dv", "(II[DI)V", org_mini_gl_GL_glUniform2dv}, +{"org/mini/gl/GL", "glUniform3dv", "(II[DI)V", org_mini_gl_GL_glUniform3dv}, +{"org/mini/gl/GL", "glUniform4dv", "(II[DI)V", org_mini_gl_GL_glUniform4dv}, +{"org/mini/gl/GL", "glUniformMatrix2dv", "(III[DI)V", org_mini_gl_GL_glUniformMatrix2dv}, +{"org/mini/gl/GL", "glUniformMatrix3dv", "(III[DI)V", org_mini_gl_GL_glUniformMatrix3dv}, +{"org/mini/gl/GL", "glUniformMatrix4dv", "(III[DI)V", org_mini_gl_GL_glUniformMatrix4dv}, +{"org/mini/gl/GL", "glUniformMatrix2x3dv", "(III[DI)V", org_mini_gl_GL_glUniformMatrix2x3dv}, +{"org/mini/gl/GL", "glUniformMatrix2x4dv", "(III[DI)V", org_mini_gl_GL_glUniformMatrix2x4dv}, +{"org/mini/gl/GL", "glUniformMatrix3x2dv", "(III[DI)V", org_mini_gl_GL_glUniformMatrix3x2dv}, +{"org/mini/gl/GL", "glUniformMatrix3x4dv", "(III[DI)V", org_mini_gl_GL_glUniformMatrix3x4dv}, +{"org/mini/gl/GL", "glUniformMatrix4x2dv", "(III[DI)V", org_mini_gl_GL_glUniformMatrix4x2dv}, +{"org/mini/gl/GL", "glUniformMatrix4x3dv", "(III[DI)V", org_mini_gl_GL_glUniformMatrix4x3dv}, +{"org/mini/gl/GL", "glGetUniformdv", "(II[DI)V", org_mini_gl_GL_glGetUniformdv}, +{"org/mini/gl/GL", "glGetSubroutineUniformLocation", "(II[B)I", org_mini_gl_GL_glGetSubroutineUniformLocation}, +{"org/mini/gl/GL", "glGetSubroutineIndex", "(II[B)I", org_mini_gl_GL_glGetSubroutineIndex}, +{"org/mini/gl/GL", "glGetActiveSubroutineUniformiv", "(IIII[II)V", org_mini_gl_GL_glGetActiveSubroutineUniformiv}, +{"org/mini/gl/GL", "glGetActiveSubroutineUniformName", "(IIII[II[B)V", org_mini_gl_GL_glGetActiveSubroutineUniformName}, +{"org/mini/gl/GL", "glGetActiveSubroutineName", "(IIII[II[B)V", org_mini_gl_GL_glGetActiveSubroutineName}, +{"org/mini/gl/GL", "glUniformSubroutinesuiv", "(II[II)V", org_mini_gl_GL_glUniformSubroutinesuiv}, +{"org/mini/gl/GL", "glGetUniformSubroutineuiv", "(II[II)V", org_mini_gl_GL_glGetUniformSubroutineuiv}, +{"org/mini/gl/GL", "glGetProgramStageiv", "(III[II)V", org_mini_gl_GL_glGetProgramStageiv}, +{"org/mini/gl/GL", "glPatchParameteri", "(II)V", org_mini_gl_GL_glPatchParameteri}, +{"org/mini/gl/GL", "glPatchParameterfv", "(I[FI)V", org_mini_gl_GL_glPatchParameterfv}, +{"org/mini/gl/GL", "glBindTransformFeedback", "(II)V", org_mini_gl_GL_glBindTransformFeedback}, +{"org/mini/gl/GL", "glDeleteTransformFeedbacks", "(I[II)V", org_mini_gl_GL_glDeleteTransformFeedbacks}, +{"org/mini/gl/GL", "glGenTransformFeedbacks", "(I[II)V", org_mini_gl_GL_glGenTransformFeedbacks}, +{"org/mini/gl/GL", "glIsTransformFeedback", "(I)I", org_mini_gl_GL_glIsTransformFeedback}, +{"org/mini/gl/GL", "glPauseTransformFeedback", "()V", org_mini_gl_GL_glPauseTransformFeedback}, +{"org/mini/gl/GL", "glResumeTransformFeedback", "()V", org_mini_gl_GL_glResumeTransformFeedback}, +{"org/mini/gl/GL", "glDrawTransformFeedback", "(II)V", org_mini_gl_GL_glDrawTransformFeedback}, +{"org/mini/gl/GL", "glDrawTransformFeedbackStream", "(III)V", org_mini_gl_GL_glDrawTransformFeedbackStream}, +{"org/mini/gl/GL", "glBeginQueryIndexed", "(III)V", org_mini_gl_GL_glBeginQueryIndexed}, +{"org/mini/gl/GL", "glEndQueryIndexed", "(II)V", org_mini_gl_GL_glEndQueryIndexed}, +{"org/mini/gl/GL", "glGetQueryIndexediv", "(III[II)V", org_mini_gl_GL_glGetQueryIndexediv}, +{"org/mini/gl/GL", "glReleaseShaderCompiler", "()V", org_mini_gl_GL_glReleaseShaderCompiler}, +{"org/mini/gl/GL", "glShaderBinary", "(I[IIILjava/lang/Object;II)V", org_mini_gl_GL_glShaderBinary}, +{"org/mini/gl/GL", "glGetShaderPrecisionFormat", "(II[II[II)V", org_mini_gl_GL_glGetShaderPrecisionFormat}, +{"org/mini/gl/GL", "glDepthRangef", "(FF)V", org_mini_gl_GL_glDepthRangef}, +{"org/mini/gl/GL", "glClearDepthf", "(F)V", org_mini_gl_GL_glClearDepthf}, +{"org/mini/gl/GL", "glGetProgramBinary", "(II[II[IILjava/lang/Object;I)V", org_mini_gl_GL_glGetProgramBinary}, +{"org/mini/gl/GL", "glProgramBinary", "(IILjava/lang/Object;II)V", org_mini_gl_GL_glProgramBinary}, +{"org/mini/gl/GL", "glProgramParameteri", "(III)V", org_mini_gl_GL_glProgramParameteri}, +{"org/mini/gl/GL", "glUseProgramStages", "(III)V", org_mini_gl_GL_glUseProgramStages}, +{"org/mini/gl/GL", "glActiveShaderProgram", "(II)V", org_mini_gl_GL_glActiveShaderProgram}, +{"org/mini/gl/GL", "glCreateShaderProgramv", "(II[[B)I", org_mini_gl_GL_glCreateShaderProgramv}, +{"org/mini/gl/GL", "glBindProgramPipeline", "(I)V", org_mini_gl_GL_glBindProgramPipeline}, +{"org/mini/gl/GL", "glDeleteProgramPipelines", "(I[II)V", org_mini_gl_GL_glDeleteProgramPipelines}, +{"org/mini/gl/GL", "glGenProgramPipelines", "(I[II)V", org_mini_gl_GL_glGenProgramPipelines}, +{"org/mini/gl/GL", "glIsProgramPipeline", "(I)I", org_mini_gl_GL_glIsProgramPipeline}, +{"org/mini/gl/GL", "glGetProgramPipelineiv", "(II[II)V", org_mini_gl_GL_glGetProgramPipelineiv}, +{"org/mini/gl/GL", "glProgramUniform1i", "(III)V", org_mini_gl_GL_glProgramUniform1i}, +{"org/mini/gl/GL", "glProgramUniform1iv", "(III[II)V", org_mini_gl_GL_glProgramUniform1iv}, +{"org/mini/gl/GL", "glProgramUniform1f", "(IIF)V", org_mini_gl_GL_glProgramUniform1f}, +{"org/mini/gl/GL", "glProgramUniform1fv", "(III[FI)V", org_mini_gl_GL_glProgramUniform1fv}, +{"org/mini/gl/GL", "glProgramUniform1d", "(IID)V", org_mini_gl_GL_glProgramUniform1d}, +{"org/mini/gl/GL", "glProgramUniform1dv", "(III[DI)V", org_mini_gl_GL_glProgramUniform1dv}, +{"org/mini/gl/GL", "glProgramUniform1ui", "(III)V", org_mini_gl_GL_glProgramUniform1ui}, +{"org/mini/gl/GL", "glProgramUniform1uiv", "(III[II)V", org_mini_gl_GL_glProgramUniform1uiv}, +{"org/mini/gl/GL", "glProgramUniform2i", "(IIII)V", org_mini_gl_GL_glProgramUniform2i}, +{"org/mini/gl/GL", "glProgramUniform2iv", "(III[II)V", org_mini_gl_GL_glProgramUniform2iv}, +{"org/mini/gl/GL", "glProgramUniform2f", "(IIFF)V", org_mini_gl_GL_glProgramUniform2f}, +{"org/mini/gl/GL", "glProgramUniform2fv", "(III[FI)V", org_mini_gl_GL_glProgramUniform2fv}, +{"org/mini/gl/GL", "glProgramUniform2d", "(IIDD)V", org_mini_gl_GL_glProgramUniform2d}, +{"org/mini/gl/GL", "glProgramUniform2dv", "(III[DI)V", org_mini_gl_GL_glProgramUniform2dv}, +{"org/mini/gl/GL", "glProgramUniform2ui", "(IIII)V", org_mini_gl_GL_glProgramUniform2ui}, +{"org/mini/gl/GL", "glProgramUniform2uiv", "(III[II)V", org_mini_gl_GL_glProgramUniform2uiv}, +{"org/mini/gl/GL", "glProgramUniform3i", "(IIIII)V", org_mini_gl_GL_glProgramUniform3i}, +{"org/mini/gl/GL", "glProgramUniform3iv", "(III[II)V", org_mini_gl_GL_glProgramUniform3iv}, +{"org/mini/gl/GL", "glProgramUniform3f", "(IIFFF)V", org_mini_gl_GL_glProgramUniform3f}, +{"org/mini/gl/GL", "glProgramUniform3fv", "(III[FI)V", org_mini_gl_GL_glProgramUniform3fv}, +{"org/mini/gl/GL", "glProgramUniform3d", "(IIDDD)V", org_mini_gl_GL_glProgramUniform3d}, +{"org/mini/gl/GL", "glProgramUniform3dv", "(III[DI)V", org_mini_gl_GL_glProgramUniform3dv}, +{"org/mini/gl/GL", "glProgramUniform3ui", "(IIIII)V", org_mini_gl_GL_glProgramUniform3ui}, +{"org/mini/gl/GL", "glProgramUniform3uiv", "(III[II)V", org_mini_gl_GL_glProgramUniform3uiv}, +{"org/mini/gl/GL", "glProgramUniform4i", "(IIIIII)V", org_mini_gl_GL_glProgramUniform4i}, +{"org/mini/gl/GL", "glProgramUniform4iv", "(III[II)V", org_mini_gl_GL_glProgramUniform4iv}, +{"org/mini/gl/GL", "glProgramUniform4f", "(IIFFFF)V", org_mini_gl_GL_glProgramUniform4f}, +{"org/mini/gl/GL", "glProgramUniform4fv", "(III[FI)V", org_mini_gl_GL_glProgramUniform4fv}, +{"org/mini/gl/GL", "glProgramUniform4d", "(IIDDDD)V", org_mini_gl_GL_glProgramUniform4d}, +{"org/mini/gl/GL", "glProgramUniform4dv", "(III[DI)V", org_mini_gl_GL_glProgramUniform4dv}, +{"org/mini/gl/GL", "glProgramUniform4ui", "(IIIIII)V", org_mini_gl_GL_glProgramUniform4ui}, +{"org/mini/gl/GL", "glProgramUniform4uiv", "(III[II)V", org_mini_gl_GL_glProgramUniform4uiv}, +{"org/mini/gl/GL", "glProgramUniformMatrix2fv", "(IIII[FI)V", org_mini_gl_GL_glProgramUniformMatrix2fv}, +{"org/mini/gl/GL", "glProgramUniformMatrix3fv", "(IIII[FI)V", org_mini_gl_GL_glProgramUniformMatrix3fv}, +{"org/mini/gl/GL", "glProgramUniformMatrix4fv", "(IIII[FI)V", org_mini_gl_GL_glProgramUniformMatrix4fv}, +{"org/mini/gl/GL", "glProgramUniformMatrix2dv", "(IIII[DI)V", org_mini_gl_GL_glProgramUniformMatrix2dv}, +{"org/mini/gl/GL", "glProgramUniformMatrix3dv", "(IIII[DI)V", org_mini_gl_GL_glProgramUniformMatrix3dv}, +{"org/mini/gl/GL", "glProgramUniformMatrix4dv", "(IIII[DI)V", org_mini_gl_GL_glProgramUniformMatrix4dv}, +{"org/mini/gl/GL", "glProgramUniformMatrix2x3fv", "(IIII[FI)V", org_mini_gl_GL_glProgramUniformMatrix2x3fv}, +{"org/mini/gl/GL", "glProgramUniformMatrix3x2fv", "(IIII[FI)V", org_mini_gl_GL_glProgramUniformMatrix3x2fv}, +{"org/mini/gl/GL", "glProgramUniformMatrix2x4fv", "(IIII[FI)V", org_mini_gl_GL_glProgramUniformMatrix2x4fv}, +{"org/mini/gl/GL", "glProgramUniformMatrix4x2fv", "(IIII[FI)V", org_mini_gl_GL_glProgramUniformMatrix4x2fv}, +{"org/mini/gl/GL", "glProgramUniformMatrix3x4fv", "(IIII[FI)V", org_mini_gl_GL_glProgramUniformMatrix3x4fv}, +{"org/mini/gl/GL", "glProgramUniformMatrix4x3fv", "(IIII[FI)V", org_mini_gl_GL_glProgramUniformMatrix4x3fv}, +{"org/mini/gl/GL", "glProgramUniformMatrix2x3dv", "(IIII[DI)V", org_mini_gl_GL_glProgramUniformMatrix2x3dv}, +{"org/mini/gl/GL", "glProgramUniformMatrix3x2dv", "(IIII[DI)V", org_mini_gl_GL_glProgramUniformMatrix3x2dv}, +{"org/mini/gl/GL", "glProgramUniformMatrix2x4dv", "(IIII[DI)V", org_mini_gl_GL_glProgramUniformMatrix2x4dv}, +{"org/mini/gl/GL", "glProgramUniformMatrix4x2dv", "(IIII[DI)V", org_mini_gl_GL_glProgramUniformMatrix4x2dv}, +{"org/mini/gl/GL", "glProgramUniformMatrix3x4dv", "(IIII[DI)V", org_mini_gl_GL_glProgramUniformMatrix3x4dv}, +{"org/mini/gl/GL", "glProgramUniformMatrix4x3dv", "(IIII[DI)V", org_mini_gl_GL_glProgramUniformMatrix4x3dv}, +{"org/mini/gl/GL", "glValidateProgramPipeline", "(I)V", org_mini_gl_GL_glValidateProgramPipeline}, +{"org/mini/gl/GL", "glGetProgramPipelineInfoLog", "(II[II[B)V", org_mini_gl_GL_glGetProgramPipelineInfoLog}, +{"org/mini/gl/GL", "glVertexAttribL1d", "(ID)V", org_mini_gl_GL_glVertexAttribL1d}, +{"org/mini/gl/GL", "glVertexAttribL2d", "(IDD)V", org_mini_gl_GL_glVertexAttribL2d}, +{"org/mini/gl/GL", "glVertexAttribL3d", "(IDDD)V", org_mini_gl_GL_glVertexAttribL3d}, +{"org/mini/gl/GL", "glVertexAttribL4d", "(IDDDD)V", org_mini_gl_GL_glVertexAttribL4d}, +{"org/mini/gl/GL", "glVertexAttribL1dv", "(I[DI)V", org_mini_gl_GL_glVertexAttribL1dv}, +{"org/mini/gl/GL", "glVertexAttribL2dv", "(I[DI)V", org_mini_gl_GL_glVertexAttribL2dv}, +{"org/mini/gl/GL", "glVertexAttribL3dv", "(I[DI)V", org_mini_gl_GL_glVertexAttribL3dv}, +{"org/mini/gl/GL", "glVertexAttribL4dv", "(I[DI)V", org_mini_gl_GL_glVertexAttribL4dv}, +{"org/mini/gl/GL", "glVertexAttribLPointer", "(IIIILjava/lang/Object;I)V", org_mini_gl_GL_glVertexAttribLPointer}, +{"org/mini/gl/GL", "glGetVertexAttribLdv", "(II[DI)V", org_mini_gl_GL_glGetVertexAttribLdv}, +{"org/mini/gl/GL", "glViewportArrayv", "(II[FI)V", org_mini_gl_GL_glViewportArrayv}, +{"org/mini/gl/GL", "glViewportIndexedf", "(IFFFF)V", org_mini_gl_GL_glViewportIndexedf}, +{"org/mini/gl/GL", "glViewportIndexedfv", "(I[FI)V", org_mini_gl_GL_glViewportIndexedfv}, +{"org/mini/gl/GL", "glScissorArrayv", "(II[II)V", org_mini_gl_GL_glScissorArrayv}, +{"org/mini/gl/GL", "glScissorIndexed", "(IIIII)V", org_mini_gl_GL_glScissorIndexed}, +{"org/mini/gl/GL", "glScissorIndexedv", "(I[II)V", org_mini_gl_GL_glScissorIndexedv}, +{"org/mini/gl/GL", "glDepthRangeArrayv", "(II[DI)V", org_mini_gl_GL_glDepthRangeArrayv}, +{"org/mini/gl/GL", "glDepthRangeIndexed", "(IDD)V", org_mini_gl_GL_glDepthRangeIndexed}, +{"org/mini/gl/GL", "glGetFloati_v", "(II[FI)V", org_mini_gl_GL_glGetFloati_v}, +{"org/mini/gl/GL", "glGetDoublei_v", "(II[DI)V", org_mini_gl_GL_glGetDoublei_v}, }; s32 count_GLFuncTable() { diff --git a/desktop/glfw_gui/c/media.c b/desktop/glfw_gui/c/media.c index b314727d..7d5d09b4 100644 --- a/desktop/glfw_gui/c/media.c +++ b/desktop/glfw_gui/c/media.c @@ -7,7 +7,6 @@ #include "jvm.h" #include "media.h" - void JNI_OnLoad(MiniJVM *jvm) { memset(&refers, 0, sizeof(GlobeRefer)); JniEnv *env = jvm->env; @@ -51,6 +50,12 @@ Runtime *getRuntimeCurThread(JniEnv *env) { * DEMO * * ===============================================================*/ +extern void *get_proc(const char *namez); + +s64 get_gl_proc(const char *namez) { + void *ptr = get_proc(namez); + return (s64) (intptr_t) ptr; +} int main(void) { diff --git a/desktop/glfw_gui/c/media.h b/desktop/glfw_gui/c/media.h index f085a151..43281d8c 100644 --- a/desktop/glfw_gui/c/media.h +++ b/desktop/glfw_gui/c/media.h @@ -34,7 +34,9 @@ s32 count_MiniAudioFuncTable(); // Runtime *getRuntimeCurThread(JniEnv *env); -static void init(){} +s64 get_gl_proc(const char *namez); + +static void init() {} struct _GlobeRefer { MiniJVM *jvm; diff --git a/desktop/glfw_gui/java/GenJniCode/GenJniCode.iml b/desktop/glfw_gui/java/GenJniCode/GenJniCode.iml index 4be7e396..c90834f2 100644 --- a/desktop/glfw_gui/java/GenJniCode/GenJniCode.iml +++ b/desktop/glfw_gui/java/GenJniCode/GenJniCode.iml @@ -5,16 +5,7 @@ - - - - - - - - - - + \ No newline at end of file diff --git a/desktop/glfw_gui/java/GenJniCode/src/org/mini/jnibuilder/GL_h_2_java.java b/desktop/glfw_gui/java/GenJniCode/src/org/mini/jnibuilder/GL_h_2_java.java index 099199ab..19d6d88e 100644 --- a/desktop/glfw_gui/java/GenJniCode/src/org/mini/jnibuilder/GL_h_2_java.java +++ b/desktop/glfw_gui/java/GenJniCode/src/org/mini/jnibuilder/GL_h_2_java.java @@ -34,6 +34,7 @@ public static void main(String[] args) { + " }\n" + "${FIELDS}\n" + " public static native void init();// //void\n" + + " public static native long get_gl_proc(String namez);//const char* //GLint64\n" + "${METHODS}\n" + "}\n\n"; String FIELDS = "${FIELDS}"; diff --git a/desktop/glfw_gui/java/GenJniCode/src/org/mini/jnibuilder/GL_java_2_c.java b/desktop/glfw_gui/java/GenJniCode/src/org/mini/jnibuilder/GL_java_2_c.java index 9bf72c1b..819f5b7b 100644 --- a/desktop/glfw_gui/java/GenJniCode/src/org/mini/jnibuilder/GL_java_2_c.java +++ b/desktop/glfw_gui/java/GenJniCode/src/org/mini/jnibuilder/GL_java_2_c.java @@ -280,14 +280,12 @@ void buildC() { javaArgvCode += "D"; } else if ("String".equals(argvType)) { varCode += " Instance *" + argvName + " = env->localvar_getRefer(runtime->localvar, pos++);\n"; - varCode += " __refer ptr_" + argvName + " = NULL;\n"; varCode += " Utf8String *u_" + argvName + ";\n"; varCode += " if(" + argvName + "){\n"; varCode += " u_" + argvName + " = env->utf8_create();\n"; - varCode += " env->jstring_2_utf8(" + argvName + ", u_" + argvName + ");\n"; - varCode += " ptr_" + argvName + " = env->utf8_cstr(u_" + argvName + ");\n"; + varCode += " env->jstring_2_utf8(" + argvName + ", u_" + argvName + ", runtime);\n"; varCode += " }\n"; - curArgvName = "(ptr_" + argvName + ")"; + curArgvName = "(env->utf8_cstr(u_" + argvName + "))"; releaseMemCode += "env->utf8_destory(u_" + argvName + ");"; javaArgvCode += "Ljava/lang/String;"; } else if ("byte[][]".equals(argvType) || "byte[]...".equals(argvType)) { diff --git a/desktop/glfw_gui/java/src/main/java/org/mini/gl/GL.java b/desktop/glfw_gui/java/src/main/java/org/mini/gl/GL.java index a9842d5e..38ef6384 100644 --- a/desktop/glfw_gui/java/src/main/java/org/mini/gl/GL.java +++ b/desktop/glfw_gui/java/src/main/java/org/mini/gl/GL.java @@ -1255,6 +1255,118 @@ public class GL { public static final int GL_TIME_ELAPSED = 0x88BF; public static final int GL_TIMESTAMP = 0x8E28; public static final int GL_INT_2_10_10_10_REV = 0x8D9F; + public static final int GL_SAMPLE_SHADING = 0x8C36; + public static final int GL_MIN_SAMPLE_SHADING_VALUE = 0x8C37; + public static final int GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET = 0x8E5E; + public static final int GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET = 0x8E5F; + public static final int GL_TEXTURE_CUBE_MAP_ARRAY = 0x9009; + public static final int GL_TEXTURE_BINDING_CUBE_MAP_ARRAY = 0x900A; + public static final int GL_PROXY_TEXTURE_CUBE_MAP_ARRAY = 0x900B; + public static final int GL_SAMPLER_CUBE_MAP_ARRAY = 0x900C; + public static final int GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW = 0x900D; + public static final int GL_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900E; + public static final int GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900F; + public static final int GL_DRAW_INDIRECT_BUFFER = 0x8F3F; + public static final int GL_DRAW_INDIRECT_BUFFER_BINDING = 0x8F43; + public static final int GL_GEOMETRY_SHADER_INVOCATIONS = 0x887F; + public static final int GL_MAX_GEOMETRY_SHADER_INVOCATIONS = 0x8E5A; + public static final int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5B; + public static final int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5C; + public static final int GL_FRAGMENT_INTERPOLATION_OFFSET_BITS = 0x8E5D; + public static final int GL_MAX_VERTEX_STREAMS = 0x8E71; + public static final int GL_DOUBLE_VEC2 = 0x8FFC; + public static final int GL_DOUBLE_VEC3 = 0x8FFD; + public static final int GL_DOUBLE_VEC4 = 0x8FFE; + public static final int GL_DOUBLE_MAT2 = 0x8F46; + public static final int GL_DOUBLE_MAT3 = 0x8F47; + public static final int GL_DOUBLE_MAT4 = 0x8F48; + public static final int GL_DOUBLE_MAT2x3 = 0x8F49; + public static final int GL_DOUBLE_MAT2x4 = 0x8F4A; + public static final int GL_DOUBLE_MAT3x2 = 0x8F4B; + public static final int GL_DOUBLE_MAT3x4 = 0x8F4C; + public static final int GL_DOUBLE_MAT4x2 = 0x8F4D; + public static final int GL_DOUBLE_MAT4x3 = 0x8F4E; + public static final int GL_ACTIVE_SUBROUTINES = 0x8DE5; + public static final int GL_ACTIVE_SUBROUTINE_UNIFORMS = 0x8DE6; + public static final int GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS = 0x8E47; + public static final int GL_ACTIVE_SUBROUTINE_MAX_LENGTH = 0x8E48; + public static final int GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH = 0x8E49; + public static final int GL_MAX_SUBROUTINES = 0x8DE7; + public static final int GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS = 0x8DE8; + public static final int GL_NUM_COMPATIBLE_SUBROUTINES = 0x8E4A; + public static final int GL_COMPATIBLE_SUBROUTINES = 0x8E4B; + public static final int GL_PATCHES = 0x000E; + public static final int GL_PATCH_VERTICES = 0x8E72; + public static final int GL_PATCH_DEFAULT_INNER_LEVEL = 0x8E73; + public static final int GL_PATCH_DEFAULT_OUTER_LEVEL = 0x8E74; + public static final int GL_TESS_CONTROL_OUTPUT_VERTICES = 0x8E75; + public static final int GL_TESS_GEN_MODE = 0x8E76; + public static final int GL_TESS_GEN_SPACING = 0x8E77; + public static final int GL_TESS_GEN_VERTEX_ORDER = 0x8E78; + public static final int GL_TESS_GEN_POINT_MODE = 0x8E79; + public static final int GL_ISOLINES = 0x8E7A; + public static final int GL_FRACTIONAL_ODD = 0x8E7B; + public static final int GL_FRACTIONAL_EVEN = 0x8E7C; + public static final int GL_MAX_PATCH_VERTICES = 0x8E7D; + public static final int GL_MAX_TESS_GEN_LEVEL = 0x8E7E; + public static final int GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS = 0x8E7F; + public static final int GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E80; + public static final int GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS = 0x8E81; + public static final int GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS = 0x8E82; + public static final int GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS = 0x8E83; + public static final int GL_MAX_TESS_PATCH_COMPONENTS = 0x8E84; + public static final int GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS = 0x8E85; + public static final int GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS = 0x8E86; + public static final int GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS = 0x8E89; + public static final int GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS = 0x8E8A; + public static final int GL_MAX_TESS_CONTROL_INPUT_COMPONENTS = 0x886C; + public static final int GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS = 0x886D; + public static final int GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS = 0x8E1E; + public static final int GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E1F; + public static final int GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER = 0x84F0; + public static final int GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER = 0x84F1; + public static final int GL_TESS_EVALUATION_SHADER = 0x8E87; + public static final int GL_TESS_CONTROL_SHADER = 0x8E88; + public static final int GL_TRANSFORM_FEEDBACK = 0x8E22; + public static final int GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED = 0x8E23; + public static final int GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE = 0x8E24; + public static final int GL_TRANSFORM_FEEDBACK_BINDING = 0x8E25; + public static final int GL_MAX_TRANSFORM_FEEDBACK_BUFFERS = 0x8E70; + public static final int GL_FIXED = 0x140C; + public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; + public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; + public static final int GL_LOW_FLOAT = 0x8DF0; + public static final int GL_MEDIUM_FLOAT = 0x8DF1; + public static final int GL_HIGH_FLOAT = 0x8DF2; + public static final int GL_LOW_INT = 0x8DF3; + public static final int GL_MEDIUM_INT = 0x8DF4; + public static final int GL_HIGH_INT = 0x8DF5; + public static final int GL_SHADER_COMPILER = 0x8DFA; + public static final int GL_SHADER_BINARY_FORMATS = 0x8DF8; + public static final int GL_NUM_SHADER_BINARY_FORMATS = 0x8DF9; + public static final int GL_MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; + public static final int GL_MAX_VARYING_VECTORS = 0x8DFC; + public static final int GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; + public static final int GL_RGB565 = 0x8D62; + public static final int GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257; + public static final int GL_PROGRAM_BINARY_LENGTH = 0x8741; + public static final int GL_NUM_PROGRAM_BINARY_FORMATS = 0x87FE; + public static final int GL_PROGRAM_BINARY_FORMATS = 0x87FF; + public static final int GL_VERTEX_SHADER_BIT = 0x00000001; + public static final int GL_FRAGMENT_SHADER_BIT = 0x00000002; + public static final int GL_GEOMETRY_SHADER_BIT = 0x00000004; + public static final int GL_TESS_CONTROL_SHADER_BIT = 0x00000008; + public static final int GL_TESS_EVALUATION_SHADER_BIT = 0x00000010; + public static final long GL_ALL_SHADER_BITS = 0xFFFFFFFFL; + public static final int GL_PROGRAM_SEPARABLE = 0x8258; + public static final int GL_ACTIVE_PROGRAM = 0x8259; + public static final int GL_PROGRAM_PIPELINE_BINDING = 0x825A; + public static final int GL_MAX_VIEWPORTS = 0x825B; + public static final int GL_VIEWPORT_SUBPIXEL_BITS = 0x825C; + public static final int GL_VIEWPORT_BOUNDS_RANGE = 0x825D; + public static final int GL_LAYER_PROVOKING_VERTEX = 0x825E; + public static final int GL_VIEWPORT_INDEX_PROVOKING_VERTEX = 0x825F; + public static final int GL_UNDEFINED_VERTEX = 0x8260; public static final int GL_VERSION_1_0 = 1; public static final int GL_VERSION_1_1 = 1; public static final int GL_VERSION_1_2 = 1; @@ -1267,8 +1379,11 @@ public class GL { public static final int GL_VERSION_3_1 = 1; public static final int GL_VERSION_3_2 = 1; public static final int GL_VERSION_3_3 = 1; + public static final int GL_VERSION_4_0 = 1; + public static final int GL_VERSION_4_1 = 1; public static native void init();// //void + public static native long get_gl_proc(String namez);//const char* //GLint64 public static native void glCullFace(int pmode); //GLenum, //void public static native void glFrontFace(int pmode); //GLenum, //void public static native void glHint(int ptarget, int pmode); //GLenum,GLenum, //void @@ -1927,7 +2042,7 @@ public class GL { public static native int glClientWaitSync(long psync, int pflags, long ptimeout); //GLsync,GLbitfield,GLuint64, //GLenum public static native void glWaitSync(long psync, int pflags, long ptimeout); //GLsync,GLbitfield,GLuint64, //void public static native void glGetInteger64v(int ppname, long[] pdata, int offset_pdata); //GLenum,GLint64*, //void - public static native void glGetSynciv(long psync, int ppname, int pbufSize, int[] plength, int offset_plength, int[] pvalues, int offset_pvalues); //GLsync,GLenum,GLsizei,GLsizei*,GLint*, //void + public static native void glGetSynciv(long psync, int ppname, int pcount, int[] plength, int offset_plength, int[] pvalues, int offset_pvalues); //GLsync,GLenum,GLsizei,GLsizei*,GLint*, //void public static native void glGetInteger64i_v(int ptarget, int pindex, long[] pdata, int offset_pdata); //GLenum,GLuint,GLint64*, //void public static native void glGetBufferParameteri64v(int ptarget, int ppname, long[] pparams, int offset_pparams); //GLenum,GLenum,GLint64*, //void public static native void glFramebufferTexture(int ptarget, int pattachment, int ptexture, int plevel); //GLenum,GLenum,GLuint,GLint, //void @@ -1993,6 +2108,140 @@ public class GL { public static native void glColorP4uiv(int ptype, int[] pcolor, int offset_pcolor); //GLenum,const GLuint*, //void public static native void glSecondaryColorP3ui(int ptype, int pcolor); //GLenum,GLuint, //void public static native void glSecondaryColorP3uiv(int ptype, int[] pcolor, int offset_pcolor); //GLenum,const GLuint*, //void + public static native void glMinSampleShading(float pvalue); //GLfloat, //void + public static native void glBlendEquationi(int pbuf, int pmode); //GLuint,GLenum, //void + public static native void glBlendEquationSeparatei(int pbuf, int pmodeRGB, int pmodeAlpha); //GLuint,GLenum,GLenum, //void + public static native void glBlendFunci(int pbuf, int psrc, int pdst); //GLuint,GLenum,GLenum, //void + public static native void glBlendFuncSeparatei(int pbuf, int psrcRGB, int pdstRGB, int psrcAlpha, int pdstAlpha); //GLuint,GLenum,GLenum,GLenum,GLenum, //void + public static native void glDrawArraysIndirect(int pmode, Object pindirect, int offset_pindirect); //GLenum,const void*, //void + public static native void glDrawElementsIndirect(int pmode, int ptype, Object pindirect, int offset_pindirect); //GLenum,GLenum,const void*, //void + public static native void glUniform1d(int plocation, double px); //GLint,GLdouble, //void + public static native void glUniform2d(int plocation, double px, double py); //GLint,GLdouble,GLdouble, //void + public static native void glUniform3d(int plocation, double px, double py, double pz); //GLint,GLdouble,GLdouble,GLdouble, //void + public static native void glUniform4d(int plocation, double px, double py, double pz, double pw); //GLint,GLdouble,GLdouble,GLdouble,GLdouble, //void + public static native void glUniform1dv(int plocation, int pcount, double[] pvalue, int offset_pvalue); //GLint,GLsizei,const GLdouble*, //void + public static native void glUniform2dv(int plocation, int pcount, double[] pvalue, int offset_pvalue); //GLint,GLsizei,const GLdouble*, //void + public static native void glUniform3dv(int plocation, int pcount, double[] pvalue, int offset_pvalue); //GLint,GLsizei,const GLdouble*, //void + public static native void glUniform4dv(int plocation, int pcount, double[] pvalue, int offset_pvalue); //GLint,GLsizei,const GLdouble*, //void + public static native void glUniformMatrix2dv(int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glUniformMatrix3dv(int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glUniformMatrix4dv(int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glUniformMatrix2x3dv(int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glUniformMatrix2x4dv(int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glUniformMatrix3x2dv(int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glUniformMatrix3x4dv(int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glUniformMatrix4x2dv(int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glUniformMatrix4x3dv(int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glGetUniformdv(int pprogram, int plocation, double[] pparams, int offset_pparams); //GLuint,GLint,GLdouble*, //void + public static native int glGetSubroutineUniformLocation(int pprogram, int pshadertype, byte[] pname); //GLuint,GLenum,const GLchar*, //GLint + public static native int glGetSubroutineIndex(int pprogram, int pshadertype, byte[] pname); //GLuint,GLenum,const GLchar*, //GLuint + public static native void glGetActiveSubroutineUniformiv(int pprogram, int pshadertype, int pindex, int ppname, int[] pvalues, int offset_pvalues); //GLuint,GLenum,GLuint,GLenum,GLint*, //void + public static native void glGetActiveSubroutineUniformName(int pprogram, int pshadertype, int pindex, int pbufSize, int[] plength, int offset_plength, byte[] pname); //GLuint,GLenum,GLuint,GLsizei,GLsizei*,GLchar*, //void + public static native void glGetActiveSubroutineName(int pprogram, int pshadertype, int pindex, int pbufSize, int[] plength, int offset_plength, byte[] pname); //GLuint,GLenum,GLuint,GLsizei,GLsizei*,GLchar*, //void + public static native void glUniformSubroutinesuiv(int pshadertype, int pcount, int[] pindices, int offset_pindices); //GLenum,GLsizei,const GLuint*, //void + public static native void glGetUniformSubroutineuiv(int pshadertype, int plocation, int[] pparams, int offset_pparams); //GLenum,GLint,GLuint*, //void + public static native void glGetProgramStageiv(int pprogram, int pshadertype, int ppname, int[] pvalues, int offset_pvalues); //GLuint,GLenum,GLenum,GLint*, //void + public static native void glPatchParameteri(int ppname, int pvalue); //GLenum,GLint, //void + public static native void glPatchParameterfv(int ppname, float[] pvalues, int offset_pvalues); //GLenum,const GLfloat*, //void + public static native void glBindTransformFeedback(int ptarget, int pid); //GLenum,GLuint, //void + public static native void glDeleteTransformFeedbacks(int pn, int[] pids, int offset_pids); //GLsizei,const GLuint*, //void + public static native void glGenTransformFeedbacks(int pn, int[] pids, int offset_pids); //GLsizei,GLuint*, //void + public static native int glIsTransformFeedback(int pid); //GLuint, //GLboolean + public static native void glPauseTransformFeedback(); //void, //void + public static native void glResumeTransformFeedback(); //void, //void + public static native void glDrawTransformFeedback(int pmode, int pid); //GLenum,GLuint, //void + public static native void glDrawTransformFeedbackStream(int pmode, int pid, int pstream); //GLenum,GLuint,GLuint, //void + public static native void glBeginQueryIndexed(int ptarget, int pindex, int pid); //GLenum,GLuint,GLuint, //void + public static native void glEndQueryIndexed(int ptarget, int pindex); //GLenum,GLuint, //void + public static native void glGetQueryIndexediv(int ptarget, int pindex, int ppname, int[] pparams, int offset_pparams); //GLenum,GLuint,GLenum,GLint*, //void + public static native void glReleaseShaderCompiler(); //void, //void + public static native void glShaderBinary(int pcount, int[] pshaders, int offset_pshaders, int pbinaryFormat, Object pbinary, int offset_pbinary, int plength); //GLsizei,const GLuint*,GLenum,const void*,GLsizei, //void + public static native void glGetShaderPrecisionFormat(int pshadertype, int pprecisiontype, int[] prange, int offset_prange, int[] pprecision, int offset_pprecision); //GLenum,GLenum,GLint*,GLint*, //void + public static native void glDepthRangef(float pn, float pf); //GLfloat,GLfloat, //void + public static native void glClearDepthf(float pd); //GLfloat, //void + public static native void glGetProgramBinary(int pprogram, int pbufSize, int[] plength, int offset_plength, int[] pbinaryFormat, int offset_pbinaryFormat, Object pbinary, int offset_pbinary); //GLuint,GLsizei,GLsizei*,GLenum*,void*, //void + public static native void glProgramBinary(int pprogram, int pbinaryFormat, Object pbinary, int offset_pbinary, int plength); //GLuint,GLenum,const void*,GLsizei, //void + public static native void glProgramParameteri(int pprogram, int ppname, int pvalue); //GLuint,GLenum,GLint, //void + public static native void glUseProgramStages(int ppipeline, int pstages, int pprogram); //GLuint,GLbitfield,GLuint, //void + public static native void glActiveShaderProgram(int ppipeline, int pprogram); //GLuint,GLuint, //void + public static native int glCreateShaderProgramv(int ptype, int pcount, byte[][] pstrings); //GLenum,GLsizei,const GLchar*const*, //GLuint + public static native void glBindProgramPipeline(int ppipeline); //GLuint, //void + public static native void glDeleteProgramPipelines(int pn, int[] ppipelines, int offset_ppipelines); //GLsizei,const GLuint*, //void + public static native void glGenProgramPipelines(int pn, int[] ppipelines, int offset_ppipelines); //GLsizei,GLuint*, //void + public static native int glIsProgramPipeline(int ppipeline); //GLuint, //GLboolean + public static native void glGetProgramPipelineiv(int ppipeline, int ppname, int[] pparams, int offset_pparams); //GLuint,GLenum,GLint*, //void + public static native void glProgramUniform1i(int pprogram, int plocation, int pv0); //GLuint,GLint,GLint, //void + public static native void glProgramUniform1iv(int pprogram, int plocation, int pcount, int[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLint*, //void + public static native void glProgramUniform1f(int pprogram, int plocation, float pv0); //GLuint,GLint,GLfloat, //void + public static native void glProgramUniform1fv(int pprogram, int plocation, int pcount, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLfloat*, //void + public static native void glProgramUniform1d(int pprogram, int plocation, double pv0); //GLuint,GLint,GLdouble, //void + public static native void glProgramUniform1dv(int pprogram, int plocation, int pcount, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLdouble*, //void + public static native void glProgramUniform1ui(int pprogram, int plocation, int pv0); //GLuint,GLint,GLuint, //void + public static native void glProgramUniform1uiv(int pprogram, int plocation, int pcount, int[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLuint*, //void + public static native void glProgramUniform2i(int pprogram, int plocation, int pv0, int pv1); //GLuint,GLint,GLint,GLint, //void + public static native void glProgramUniform2iv(int pprogram, int plocation, int pcount, int[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLint*, //void + public static native void glProgramUniform2f(int pprogram, int plocation, float pv0, float pv1); //GLuint,GLint,GLfloat,GLfloat, //void + public static native void glProgramUniform2fv(int pprogram, int plocation, int pcount, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLfloat*, //void + public static native void glProgramUniform2d(int pprogram, int plocation, double pv0, double pv1); //GLuint,GLint,GLdouble,GLdouble, //void + public static native void glProgramUniform2dv(int pprogram, int plocation, int pcount, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLdouble*, //void + public static native void glProgramUniform2ui(int pprogram, int plocation, int pv0, int pv1); //GLuint,GLint,GLuint,GLuint, //void + public static native void glProgramUniform2uiv(int pprogram, int plocation, int pcount, int[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLuint*, //void + public static native void glProgramUniform3i(int pprogram, int plocation, int pv0, int pv1, int pv2); //GLuint,GLint,GLint,GLint,GLint, //void + public static native void glProgramUniform3iv(int pprogram, int plocation, int pcount, int[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLint*, //void + public static native void glProgramUniform3f(int pprogram, int plocation, float pv0, float pv1, float pv2); //GLuint,GLint,GLfloat,GLfloat,GLfloat, //void + public static native void glProgramUniform3fv(int pprogram, int plocation, int pcount, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLfloat*, //void + public static native void glProgramUniform3d(int pprogram, int plocation, double pv0, double pv1, double pv2); //GLuint,GLint,GLdouble,GLdouble,GLdouble, //void + public static native void glProgramUniform3dv(int pprogram, int plocation, int pcount, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLdouble*, //void + public static native void glProgramUniform3ui(int pprogram, int plocation, int pv0, int pv1, int pv2); //GLuint,GLint,GLuint,GLuint,GLuint, //void + public static native void glProgramUniform3uiv(int pprogram, int plocation, int pcount, int[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLuint*, //void + public static native void glProgramUniform4i(int pprogram, int plocation, int pv0, int pv1, int pv2, int pv3); //GLuint,GLint,GLint,GLint,GLint,GLint, //void + public static native void glProgramUniform4iv(int pprogram, int plocation, int pcount, int[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLint*, //void + public static native void glProgramUniform4f(int pprogram, int plocation, float pv0, float pv1, float pv2, float pv3); //GLuint,GLint,GLfloat,GLfloat,GLfloat,GLfloat, //void + public static native void glProgramUniform4fv(int pprogram, int plocation, int pcount, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLfloat*, //void + public static native void glProgramUniform4d(int pprogram, int plocation, double pv0, double pv1, double pv2, double pv3); //GLuint,GLint,GLdouble,GLdouble,GLdouble,GLdouble, //void + public static native void glProgramUniform4dv(int pprogram, int plocation, int pcount, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLdouble*, //void + public static native void glProgramUniform4ui(int pprogram, int plocation, int pv0, int pv1, int pv2, int pv3); //GLuint,GLint,GLuint,GLuint,GLuint,GLuint, //void + public static native void glProgramUniform4uiv(int pprogram, int plocation, int pcount, int[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,const GLuint*, //void + public static native void glProgramUniformMatrix2fv(int pprogram, int plocation, int pcount, int ptranspose, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLfloat*, //void + public static native void glProgramUniformMatrix3fv(int pprogram, int plocation, int pcount, int ptranspose, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLfloat*, //void + public static native void glProgramUniformMatrix4fv(int pprogram, int plocation, int pcount, int ptranspose, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLfloat*, //void + public static native void glProgramUniformMatrix2dv(int pprogram, int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glProgramUniformMatrix3dv(int pprogram, int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glProgramUniformMatrix4dv(int pprogram, int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glProgramUniformMatrix2x3fv(int pprogram, int plocation, int pcount, int ptranspose, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLfloat*, //void + public static native void glProgramUniformMatrix3x2fv(int pprogram, int plocation, int pcount, int ptranspose, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLfloat*, //void + public static native void glProgramUniformMatrix2x4fv(int pprogram, int plocation, int pcount, int ptranspose, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLfloat*, //void + public static native void glProgramUniformMatrix4x2fv(int pprogram, int plocation, int pcount, int ptranspose, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLfloat*, //void + public static native void glProgramUniformMatrix3x4fv(int pprogram, int plocation, int pcount, int ptranspose, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLfloat*, //void + public static native void glProgramUniformMatrix4x3fv(int pprogram, int plocation, int pcount, int ptranspose, float[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLfloat*, //void + public static native void glProgramUniformMatrix2x3dv(int pprogram, int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glProgramUniformMatrix3x2dv(int pprogram, int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glProgramUniformMatrix2x4dv(int pprogram, int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glProgramUniformMatrix4x2dv(int pprogram, int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glProgramUniformMatrix3x4dv(int pprogram, int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glProgramUniformMatrix4x3dv(int pprogram, int plocation, int pcount, int ptranspose, double[] pvalue, int offset_pvalue); //GLuint,GLint,GLsizei,GLboolean,const GLdouble*, //void + public static native void glValidateProgramPipeline(int ppipeline); //GLuint, //void + public static native void glGetProgramPipelineInfoLog(int ppipeline, int pbufSize, int[] plength, int offset_plength, byte[] pinfoLog); //GLuint,GLsizei,GLsizei*,GLchar*, //void + public static native void glVertexAttribL1d(int pindex, double px); //GLuint,GLdouble, //void + public static native void glVertexAttribL2d(int pindex, double px, double py); //GLuint,GLdouble,GLdouble, //void + public static native void glVertexAttribL3d(int pindex, double px, double py, double pz); //GLuint,GLdouble,GLdouble,GLdouble, //void + public static native void glVertexAttribL4d(int pindex, double px, double py, double pz, double pw); //GLuint,GLdouble,GLdouble,GLdouble,GLdouble, //void + public static native void glVertexAttribL1dv(int pindex, double[] pv, int offset_pv); //GLuint,const GLdouble*, //void + public static native void glVertexAttribL2dv(int pindex, double[] pv, int offset_pv); //GLuint,const GLdouble*, //void + public static native void glVertexAttribL3dv(int pindex, double[] pv, int offset_pv); //GLuint,const GLdouble*, //void + public static native void glVertexAttribL4dv(int pindex, double[] pv, int offset_pv); //GLuint,const GLdouble*, //void + public static native void glVertexAttribLPointer(int pindex, int psize, int ptype, int pstride, Object ppointer, int offset_ppointer); //GLuint,GLint,GLenum,GLsizei,const void*, //void + public static native void glGetVertexAttribLdv(int pindex, int ppname, double[] pparams, int offset_pparams); //GLuint,GLenum,GLdouble*, //void + public static native void glViewportArrayv(int pfirst, int pcount, float[] pv, int offset_pv); //GLuint,GLsizei,const GLfloat*, //void + public static native void glViewportIndexedf(int pindex, float px, float py, float pw, float ph); //GLuint,GLfloat,GLfloat,GLfloat,GLfloat, //void + public static native void glViewportIndexedfv(int pindex, float[] pv, int offset_pv); //GLuint,const GLfloat*, //void + public static native void glScissorArrayv(int pfirst, int pcount, int[] pv, int offset_pv); //GLuint,GLsizei,const GLint*, //void + public static native void glScissorIndexed(int pindex, int pleft, int pbottom, int pwidth, int pheight); //GLuint,GLint,GLint,GLsizei,GLsizei, //void + public static native void glScissorIndexedv(int pindex, int[] pv, int offset_pv); //GLuint,const GLint*, //void + public static native void glDepthRangeArrayv(int pfirst, int pcount, double[] pv, int offset_pv); //GLuint,GLsizei,const GLdouble*, //void + public static native void glDepthRangeIndexed(int pindex, double pn, double pf); //GLuint,GLdouble,GLdouble, //void + public static native void glGetFloati_v(int ptarget, int pindex, float[] pdata, int offset_pdata); //GLenum,GLuint,GLfloat*, //void + public static native void glGetDoublei_v(int ptarget, int pindex, double[] pdata, int offset_pdata); //GLenum,GLuint,GLdouble*, //void } diff --git a/extlib/xgui/src/main/java/org/mini/apploader/AppManager.java b/extlib/xgui/src/main/java/org/mini/apploader/AppManager.java index 1acc5dfb..c7c8685b 100644 --- a/extlib/xgui/src/main/java/org/mini/apploader/AppManager.java +++ b/extlib/xgui/src/main/java/org/mini/apploader/AppManager.java @@ -837,6 +837,7 @@ public void setEnvVar(String envName, String envValue) { envValue = ""; } String enLow = envName.toLowerCase(); + //System.out.println("setEnvVar:" + enLow + "=" + envValue); AppLoader.setProperty(enLow, envValue); } diff --git a/extlib/xgui/src/main/java/org/mini/glwrap/GLFrameBuffer.java b/extlib/xgui/src/main/java/org/mini/glwrap/GLFrameBuffer.java index 6c480749..8d4c717f 100644 --- a/extlib/xgui/src/main/java/org/mini/glwrap/GLFrameBuffer.java +++ b/extlib/xgui/src/main/java/org/mini/glwrap/GLFrameBuffer.java @@ -38,13 +38,17 @@ static class Cleaner implements Runnable { @Override public void run() { glDeleteTextures(rendertext.length, rendertext, 0); - glDeleteRenderbuffers(renderbuf1.length, renderbuf1, 0); + glDeleteTextures(renderbuf1.length, renderbuf1, 0); glDeleteFramebuffers(fboobj.length, fboobj, 0); SysLog.info("delete fbo success"); } } public GLFrameBuffer(int w, int h) { + this(w, h, 2.f); + } + + public GLFrameBuffer(int w, int h, float scale) { texture_w = w * 2; texture_h = h * 2; } @@ -97,7 +101,7 @@ public int getDepthTexture() { public void delete() { glBindFramebuffer(GL_FRAMEBUFFER, 0); glDeleteTextures(rendertex.length, rendertex, 0); - glDeleteRenderbuffers(depth_stencil_buffer.length, depth_stencil_buffer, 0); + glDeleteTextures(depth_stencil_buffer.length, depth_stencil_buffer, 0); glDeleteFramebuffers(fbo.length, fbo, 0); } diff --git a/extlib/xgui/src/main/java/org/mini/gui/GTextBox.java b/extlib/xgui/src/main/java/org/mini/gui/GTextBox.java index 22f6c4b6..1a7635d6 100644 --- a/extlib/xgui/src/main/java/org/mini/gui/GTextBox.java +++ b/extlib/xgui/src/main/java/org/mini/gui/GTextBox.java @@ -532,12 +532,10 @@ public void keyEventGlfw(int key, int scanCode, int action, int mods) { break; } case Glfw.GLFW_KEY_DELETE: { - if (textsb.length() > caretIndex) { - if (isSelected()) { - deleteSelectedText(); - } else { - deleteTextByIndex(caretIndex); - } + if (isSelected()) { + deleteSelectedText(); + } else if (textsb.length() > caretIndex) { + deleteTextByIndex(caretIndex); } break; } @@ -599,24 +597,26 @@ public void keyEventGlfw(int key, int scanCode, int action, int mods) { case Glfw.GLFW_KEY_LEFT: { if (textsb.length() > 0 && caretIndex > 0) { int[] pos = editArea.getCaretPosFromArea(); - if (pos != null) { - if (pos[1] < getY() + lineh[0] * 2 && scroll > 0f) {//需要向上滚动 - setScroll(scroll - lineh[0] / (editArea.totalTextHeight - editArea.showAreaHeight)); - } else { - setCaretIndex(caretIndex - 1); + if (pos != null && pos[1] < getY() + lineh[0] * 2 && scroll > 0f) { + float denom = (editArea.totalTextHeight - editArea.showAreaHeight); + if (denom > 0f) { + setScroll(scroll - lineh[0] / denom); } } + setCaretIndex(caretIndex - 1); } break; } case Glfw.GLFW_KEY_RIGHT: { if (textsb.length() > caretIndex) { int[] pos = editArea.getCaretPosFromArea(); - if (pos[1] > getY() + getH() - lineh[0] * 2 && scroll < 1.0f) {//需要向下滚动 - setScroll(scroll + lineh[0] / (editArea.totalTextHeight - editArea.showAreaHeight)); - } else { - setCaretIndex(caretIndex + 1); + if (pos != null && pos[1] > getY() + getH() - lineh[0] * 2 && scroll < 1.0f) { + float denom = (editArea.totalTextHeight - editArea.showAreaHeight); + if (denom > 0f) { + setScroll(scroll + lineh[0] / denom); + } } + setCaretIndex(caretIndex + 1); } break; } @@ -646,11 +646,19 @@ public void keyEventGlfw(int key, int scanCode, int action, int mods) { int[] pos = editArea.getCaretPosFromArea(); if (pos != null) { if (pos[1] > getY() + getH() - lineh[0]) { - setScroll(scroll + lineh[0] / (editArea.totalTextHeight - editArea.showAreaHeight)); + float denom = (editArea.totalTextHeight - editArea.showAreaHeight); + if (denom > 0f) { + setScroll(scroll + lineh[0] / denom); + } } else { - int cart = editArea.getCaretIndexFromArea(pos[0], pos[1] + (int) (lineh[0] * 1.5f));//定位到下一行中央 - if (cart >= 0) { + int cart = editArea.getCaretIndexFromArea(pos[0], pos[1] + (int) (lineh[0] * 1.5f)); + if (cart >= 0 && cart < textsb.length()) { setCaretIndex(cart); + } else if (cart >= textsb.length()) { + float denom = (editArea.totalTextHeight - editArea.showAreaHeight); + if (scroll < 1.0f && denom > 0f) { + setScroll(scroll + lineh[0] / denom); + } } } } else { diff --git a/extlib/xgui/src/main/java/org/mini/gui/gscript/Stdlib.java b/extlib/xgui/src/main/java/org/mini/gui/gscript/Stdlib.java index 68c25457..59e43589 100644 --- a/extlib/xgui/src/main/java/org/mini/gui/gscript/Stdlib.java +++ b/extlib/xgui/src/main/java/org/mini/gui/gscript/Stdlib.java @@ -109,10 +109,13 @@ public Stdlib(Interpreter inp) { methodNames.put("int2str".toLowerCase(), this::int2str);//字符串转int methodNames.put("str2double".toLowerCase(), this::str2double); // methodNames.put("double2str".toLowerCase(), this::double2str); // + methodNames.put("double2float".toLowerCase(), this::double2float); // + methodNames.put("float2double".toLowerCase(), this::float2double); // methodNames.put("isNumStr".toLowerCase(), this::isNumStr);//是数字串 methodNames.put("int2float".toLowerCase(), this::int2float); methodNames.put("float2int".toLowerCase(), this::float2int); methodNames.put("isFloat".toLowerCase(), this::isFloat); + methodNames.put("isDouble".toLowerCase(), this::isDouble); } @@ -723,6 +726,31 @@ private DataType str2double(ArrayList para) { return null; } + private DataType double2float(ArrayList para) { + try { + Object obj = Interpreter.popBackObject(para); + if (obj instanceof Double) { + return Interpreter.getCachedObj(((Double) obj).floatValue()); + } + } catch (Exception e) { + //e.printStackTrace(); + } + throw new RuntimeException("double-obj required"); + } + + private DataType float2double(ArrayList para) { + try { + Object obj = Interpreter.popBackObject(para); + if (obj instanceof Float) { + return Interpreter.getCachedObj(((Float) obj).doubleValue()); + } + } catch (Exception e) { + //e.printStackTrace(); + } + throw new RuntimeException("double-obj required"); + } + + private DataType double2str(ArrayList para) { try { Object d = Interpreter.popBackObject(para); @@ -1068,4 +1096,22 @@ private DataType isFloat(ArrayList para) { } return Interpreter.getCachedBool(b); } + + private DataType isDouble(ArrayList para) { + DataType f = Interpreter.popBack(para); + boolean b = false; + if (f.type == DataType.DTYPE_STR) { + try { + Double.parseDouble(f.getString()); + b = true; + } catch (Exception e) { + } + } + if (!b) { + if (f.type == DataType.DTYPE_OBJ) { + b = ((Obj) f).getVal() instanceof Double; + } + } + return Interpreter.getCachedBool(b); + } } diff --git a/extlib/xgui/src/main/java/org/mini/layout/guilib/GuiScriptLib.java b/extlib/xgui/src/main/java/org/mini/layout/guilib/GuiScriptLib.java index 9235a5ec..8d0e7b9b 100644 --- a/extlib/xgui/src/main/java/org/mini/layout/guilib/GuiScriptLib.java +++ b/extlib/xgui/src/main/java/org/mini/layout/guilib/GuiScriptLib.java @@ -164,8 +164,8 @@ public static void doCallback(GForm form, String callback, String para) { } if (gobj != null) { Interpreter inp = gobj.getInterpreter(); - inp.callSub(ss[1] + "(" + para + ")"); - return; + inp.putGlobalVar("callbackPara", Interpreter.getCachedStr(para)); + inp.callSub(ss[1] + "(callbackPara)"); } } //System.out.println("[WARN]httpRequest callback no GContainer specified: " + callback); @@ -187,7 +187,10 @@ public static void doHttpCallback(GForm form, String callback, String url, int c } if (gobj != null) { Interpreter inp = gobj.getInterpreter(); - inp.callSub(ss[1] + "(\"" + url + "\"," + code + ",\"" + reply + "\")"); + inp.putGlobalVar("httpReplyUrl", Interpreter.getCachedStr(url)); + inp.putGlobalVar("httpReplyCode", Interpreter.getCachedInt(code)); + inp.putGlobalVar("httpReplyMsg", Interpreter.getCachedStr(reply)); + inp.callSub(ss[1] + "(httpReplyUrl,httpReplyCode,httpReplyMsg)"); return; } } diff --git a/extlib/xgui/src/main/resource/res/ui/AppManager.xml b/extlib/xgui/src/main/resource/res/ui/AppManager.xml index d599816c..9b3ac61b 100644 --- a/extlib/xgui/src/main/resource/res/ui/AppManager.xml +++ b/extlib/xgui/src/main/resource/res/ui/AppManager.xml @@ -400,10 +400,10 @@ sub setSystemBright() enable = getSwitch("SW_SYSTEM_BRIGHT") if(enable) - setEnv("SCREEN_SYSTEM","1") + setEnv("SYSTEM_BRIGHT","1") setScreenBrightness(-100) #-1.0表示跟随系统亮度 else - setEnv("SCREEN_SYSTEM","0") + setEnv("SYSTEM_BRIGHT","0") eif setBrightness() ret diff --git a/minijvm/c/jvm/jni_std.c b/minijvm/c/jvm/jni_std.c index 746765f8..b5239be0 100644 --- a/minijvm/c/jvm/jni_std.c +++ b/minijvm/c/jvm/jni_std.c @@ -105,10 +105,15 @@ s32 java_lang_Class_newInstance(Runtime *runtime, JClass *clazz) { Instance *ins = NULL; s32 ret = 0; if (cl && !cl->mb.arr_type_index) {//class exists and not array class - ins = instance_create(runtime, cl); - instance_hold_to_thread(ins, runtime); - instance_init(ins, runtime); - instance_release_from_thread(ins, runtime); + if (cl->cff.access_flags & (ACC_ABSTRACT | ACC_INTERFACE)) { + //if class is abstract or interface, can't new + + } else { + ins = instance_create(runtime, cl); + instance_hold_to_thread(ins, runtime); + instance_init(ins, runtime); + instance_release_from_thread(ins, runtime); + } } if (ins) { push_ref(stack, (__refer) ins); diff --git a/minijvm/java/src/main/java/org/mini/json/JsonParser.java b/minijvm/java/src/main/java/org/mini/json/JsonParser.java index 426b1a72..00e48fb1 100755 --- a/minijvm/java/src/main/java/org/mini/json/JsonParser.java +++ b/minijvm/java/src/main/java/org/mini/json/JsonParser.java @@ -19,8 +19,27 @@ public class JsonParser { private InjectableValues injectableValues = null; + private Object[] callPara = {null}; + + static List sbpool = new ArrayList<>(); + ClassLoader classLoader; + static synchronized StringBuilder getStringBuilder() { + if (sbpool.size() > 0) { + return sbpool.remove(sbpool.size() - 1); + } else { + return new StringBuilder(); + } + } + + static synchronized void releaseStringBuilder(StringBuilder sb) { + if (sbpool.size() < 10) { + sb.setLength(0); + sbpool.add(sb); + } + } + public JsonParser() { SimpleModule module = new SimpleModule(); module.addDeserializer(List.class, new StdDeserializer(null) { @@ -368,7 +387,7 @@ private static void putIntoContainer(Object container, JsonCell key, JsonCell va } private static void parseStringDirect(ParseToken token) { - StringBuilder sb = new StringBuilder(); + StringBuilder sb = getStringBuilder(); token.advance(); while (!token.isEnd()) { char ch = token.currentChar(); @@ -391,13 +410,14 @@ private static void parseStringDirect(ParseToken token) { } else if (ch == 'f') { sb.append('\f'); } else if (ch == 'u') { - StringBuilder unicode = new StringBuilder(); + StringBuilder unicode = getStringBuilder(); for (int i = 0; i < 4 && !token.isEnd(); i++) { token.advance(); if (!token.isEnd()) unicode.append(token.currentChar()); } sb.append((char) Integer.parseInt(unicode.toString(), 16)); + releaseStringBuilder(unicode); } else { sb.append(ch); } @@ -408,10 +428,11 @@ private static void parseStringDirect(ParseToken token) { token.advance(); } token.result = new JsonString(sb.toString()); + releaseStringBuilder(sb); } private static void parseNumberDirect(ParseToken token) { - StringBuilder sb = new StringBuilder(); + StringBuilder sb = getStringBuilder(); while (!token.isEnd()) { char ch = token.currentChar(); if (ch == ',' || ch == '}' || ch == ']' || Character.isWhitespace(ch)) @@ -420,6 +441,7 @@ private static void parseNumberDirect(ParseToken token) { token.advance(); } token.result = new JsonNumber(sb.toString()); + releaseStringBuilder(sb); } private static void parseMapDirect(ParseToken token, JsonMap targetMap) { @@ -541,19 +563,20 @@ public Object map2obj(JsonCell json, Class clazz, String types) { Type[] pt = method.getGenericParameterTypes(); Class childClazz = method.getParameterTypes()[0]; try { - method.invoke(ins, new Object[]{map2obj(childJson, childClazz, pt[0].getTypeName())}); + callPara[0] = map2obj(childJson, childClazz, pt[0].getTypeName()); + method.invoke(ins, callPara); } catch (Exception e) { e.printStackTrace(); } continue; } if (!(ins instanceof Polymorphic)) - SysLog.warn("[JSON]" + clazz.getName() + " field '" + fieldName + "' setter not found.", new Object[0]); + SysLog.warn("[JSON]" + clazz.getName() + " field '" + fieldName + "' setter not found."); } return ins; case JsonCell.TYPE_LIST: if (types == null) - SysLog.warn("[JSON] need type declare , class:" + clazz, new Object[0]); + SysLog.warn("[JSON] need type declare , class:" + clazz); if (clazz == null) clazz = ArrayList.class; list = (JsonList) json; @@ -616,7 +639,8 @@ public final T deserial(String s, Class clazz, ClassLoader classLoader, Strin classLoader = Thread.currentThread().getContextClassLoader(); this.classLoader = classLoader; JsonCell json = parse(s, 0); - return (T) map2obj(json, clazz, types); + T t= (T) map2obj(json, clazz, types); + return t; } public static final boolean isJsonString(String str) { diff --git a/mobile/c/gui/glad/glad.c b/mobile/c/gui/glad/glad.c index 204e6730..4f5ef4c9 100644 --- a/mobile/c/gui/glad/glad.c +++ b/mobile/c/gui/glad/glad.c @@ -24,7 +24,7 @@ #include #include -struct gladGLversionStruct GLVersion = { 0, 0 }; +struct gladGLversionStruct GLVersion = {0, 0}; #if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0) #define _GLAD_IS_SOME_NEW_VERSION 1 @@ -39,9 +39,9 @@ static char **exts_i = NULL; static int get_exts(void) { #ifdef _GLAD_IS_SOME_NEW_VERSION - if(max_loaded_major < 3) { + if (max_loaded_major < 3) { #endif - exts = (const char *)glGetString(GL_EXTENSIONS); + exts = (const char *) glGetString(GL_EXTENSIONS); #ifdef _GLAD_IS_SOME_NEW_VERSION } else { unsigned int index; @@ -49,20 +49,20 @@ static int get_exts(void) { num_exts_i = 0; glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i); if (num_exts_i > 0) { - exts_i = (char **)malloc((size_t)num_exts_i * (sizeof *exts_i)); + exts_i = (char **) malloc((size_t) num_exts_i * (sizeof *exts_i)); } if (exts_i == NULL) { return 0; } - for(index = 0; index < (unsigned)num_exts_i; index++) { - const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index); + for (index = 0; index < (unsigned) num_exts_i; index++) { + const char *gl_str_tmp = (const char *) glGetStringi(GL_EXTENSIONS, index); size_t len = strlen(gl_str_tmp); - char *local_str = (char*)malloc((len+1) * sizeof(char)); - if(local_str != NULL) { - memcpy(local_str, gl_str_tmp, (len+1) * sizeof(char)); + char *local_str = (char *) malloc((len + 1) * sizeof(char)); + if (local_str != NULL) { + memcpy(local_str, gl_str_tmp, (len + 1) * sizeof(char)); } exts_i[index] = local_str; } @@ -74,34 +74,36 @@ static int get_exts(void) { static void free_exts(void) { if (exts_i != NULL) { int index; - for(index = 0; index < num_exts_i; index++) { - free((char *)exts_i[index]); + for (index = 0; index < num_exts_i; index++) { + free((char *) exts_i[index]); } - free((void *)exts_i); + free((void *) exts_i); exts_i = NULL; } } -static int has_ext(const char *ext) { +extern int has_ext(const char *ext); + +int has_ext(const char *ext) { #ifdef _GLAD_IS_SOME_NEW_VERSION - if(max_loaded_major < 3) { + if (max_loaded_major < 3) { #endif const char *extensions; const char *loc; const char *terminator; extensions = exts; - if(extensions == NULL || ext == NULL) { + if (extensions == NULL || ext == NULL) { return 0; } - while(1) { + while (1) { loc = strstr(extensions, ext); - if(loc == NULL) { + if (loc == NULL) { return 0; } terminator = loc + strlen(ext); - if((loc == extensions || *(loc - 1) == ' ') && + if ((loc == extensions || *(loc - 1) == ' ') && (*terminator == ' ' || *terminator == '\0')) { return 1; } @@ -110,11 +112,11 @@ static int has_ext(const char *ext) { #ifdef _GLAD_IS_SOME_NEW_VERSION } else { int index; - if(exts_i == NULL) return 0; - for(index = 0; index < num_exts_i; index++) { + if (exts_i == NULL) return 0; + for (index = 0; index < num_exts_i; index++) { const char *e = exts_i[index]; - if(exts_i[index] != NULL && strcmp(e, ext) == 0) { + if (exts_i[index] != NULL && strcmp(e, ext) == 0) { return 1; } } @@ -123,6 +125,7 @@ static int has_ext(const char *ext) { return 0; } + int GLAD_GL_ES_VERSION_2_0 = 0; int GLAD_GL_ES_VERSION_3_0 = 0; PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL; @@ -371,263 +374,289 @@ PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer = NULL; PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL; PFNGLVIEWPORTPROC glad_glViewport = NULL; PFNGLWAITSYNCPROC glad_glWaitSync = NULL; + static void load_GL_ES_VERSION_2_0(GLADloadproc load) { - if(!GLAD_GL_ES_VERSION_2_0) return; - glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture"); - glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader"); - glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation"); - glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer"); - glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer"); - glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer"); - glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture"); - glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor"); - glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation"); - glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate"); - glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc"); - glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate"); - glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData"); - glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData"); - glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus"); - glad_glClear = (PFNGLCLEARPROC)load("glClear"); - glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor"); - glad_glClearDepthf = (PFNGLCLEARDEPTHFPROC)load("glClearDepthf"); - glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil"); - glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask"); - glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader"); - glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D"); - glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D"); - glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D"); - glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D"); - glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram"); - glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader"); - glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); - glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers"); - glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers"); - glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram"); - glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers"); - glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader"); - glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures"); - glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc"); - glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask"); - glad_glDepthRangef = (PFNGLDEPTHRANGEFPROC)load("glDepthRangef"); - glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader"); - glad_glDisable = (PFNGLDISABLEPROC)load("glDisable"); - glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray"); - glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays"); - glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements"); - glad_glEnable = (PFNGLENABLEPROC)load("glEnable"); - glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray"); - glad_glFinish = (PFNGLFINISHPROC)load("glFinish"); - glad_glFlush = (PFNGLFLUSHPROC)load("glFlush"); - glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer"); - glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D"); - glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace"); - glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers"); - glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap"); - glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers"); - glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers"); - glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures"); - glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib"); - glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform"); - glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders"); - glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation"); - glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv"); - glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); - glad_glGetError = (PFNGLGETERRORPROC)load("glGetError"); - glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv"); - glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv"); - glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv"); - glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv"); - glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog"); - glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv"); - glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv"); - glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog"); - glad_glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC)load("glGetShaderPrecisionFormat"); - glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource"); - glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv"); - glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv"); - glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv"); - glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv"); - glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation"); - glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv"); - glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv"); - glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv"); - glad_glHint = (PFNGLHINTPROC)load("glHint"); - glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer"); - glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled"); - glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer"); - glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram"); - glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer"); - glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader"); - glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture"); - glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth"); - glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram"); - glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei"); - glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset"); - glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels"); - glad_glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC)load("glReleaseShaderCompiler"); - glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage"); - glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage"); - glad_glScissor = (PFNGLSCISSORPROC)load("glScissor"); - glad_glShaderBinary = (PFNGLSHADERBINARYPROC)load("glShaderBinary"); - glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource"); - glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc"); - glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate"); - glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask"); - glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate"); - glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp"); - glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate"); - glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D"); - glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf"); - glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv"); - glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri"); - glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv"); - glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D"); - glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f"); - glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv"); - glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i"); - glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv"); - glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f"); - glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv"); - glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i"); - glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv"); - glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f"); - glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv"); - glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i"); - glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv"); - glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f"); - glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv"); - glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i"); - glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv"); - glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv"); - glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv"); - glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv"); - glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram"); - glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram"); - glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f"); - glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv"); - glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f"); - glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv"); - glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f"); - glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv"); - glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f"); - glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv"); - glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer"); - glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport"); + if (!GLAD_GL_ES_VERSION_2_0) return; + glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC) load("glActiveTexture"); + glad_glAttachShader = (PFNGLATTACHSHADERPROC) load("glAttachShader"); + glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC) load("glBindAttribLocation"); + glad_glBindBuffer = (PFNGLBINDBUFFERPROC) load("glBindBuffer"); + glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) load("glBindFramebuffer"); + glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) load("glBindRenderbuffer"); + glad_glBindTexture = (PFNGLBINDTEXTUREPROC) load("glBindTexture"); + glad_glBlendColor = (PFNGLBLENDCOLORPROC) load("glBlendColor"); + glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC) load("glBlendEquation"); + glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC) load("glBlendEquationSeparate"); + glad_glBlendFunc = (PFNGLBLENDFUNCPROC) load("glBlendFunc"); + glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) load("glBlendFuncSeparate"); + glad_glBufferData = (PFNGLBUFFERDATAPROC) load("glBufferData"); + glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC) load("glBufferSubData"); + glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) load( + "glCheckFramebufferStatus"); + glad_glClear = (PFNGLCLEARPROC) load("glClear"); + glad_glClearColor = (PFNGLCLEARCOLORPROC) load("glClearColor"); + glad_glClearDepthf = (PFNGLCLEARDEPTHFPROC) load("glClearDepthf"); + glad_glClearStencil = (PFNGLCLEARSTENCILPROC) load("glClearStencil"); + glad_glColorMask = (PFNGLCOLORMASKPROC) load("glColorMask"); + glad_glCompileShader = (PFNGLCOMPILESHADERPROC) load("glCompileShader"); + glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC) load("glCompressedTexImage2D"); + glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) load( + "glCompressedTexSubImage2D"); + glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC) load("glCopyTexImage2D"); + glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC) load("glCopyTexSubImage2D"); + glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC) load("glCreateProgram"); + glad_glCreateShader = (PFNGLCREATESHADERPROC) load("glCreateShader"); + glad_glCullFace = (PFNGLCULLFACEPROC) load("glCullFace"); + glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC) load("glDeleteBuffers"); + glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) load("glDeleteFramebuffers"); + glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC) load("glDeleteProgram"); + glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) load("glDeleteRenderbuffers"); + glad_glDeleteShader = (PFNGLDELETESHADERPROC) load("glDeleteShader"); + glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC) load("glDeleteTextures"); + glad_glDepthFunc = (PFNGLDEPTHFUNCPROC) load("glDepthFunc"); + glad_glDepthMask = (PFNGLDEPTHMASKPROC) load("glDepthMask"); + glad_glDepthRangef = (PFNGLDEPTHRANGEFPROC) load("glDepthRangef"); + glad_glDetachShader = (PFNGLDETACHSHADERPROC) load("glDetachShader"); + glad_glDisable = (PFNGLDISABLEPROC) load("glDisable"); + glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) load( + "glDisableVertexAttribArray"); + glad_glDrawArrays = (PFNGLDRAWARRAYSPROC) load("glDrawArrays"); + glad_glDrawElements = (PFNGLDRAWELEMENTSPROC) load("glDrawElements"); + glad_glEnable = (PFNGLENABLEPROC) load("glEnable"); + glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) load( + "glEnableVertexAttribArray"); + glad_glFinish = (PFNGLFINISHPROC) load("glFinish"); + glad_glFlush = (PFNGLFLUSHPROC) load("glFlush"); + glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) load( + "glFramebufferRenderbuffer"); + glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) load("glFramebufferTexture2D"); + glad_glFrontFace = (PFNGLFRONTFACEPROC) load("glFrontFace"); + glad_glGenBuffers = (PFNGLGENBUFFERSPROC) load("glGenBuffers"); + glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) load("glGenerateMipmap"); + glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) load("glGenFramebuffers"); + glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) load("glGenRenderbuffers"); + glad_glGenTextures = (PFNGLGENTEXTURESPROC) load("glGenTextures"); + glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC) load("glGetActiveAttrib"); + glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC) load("glGetActiveUniform"); + glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC) load("glGetAttachedShaders"); + glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC) load("glGetAttribLocation"); + glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC) load("glGetBooleanv"); + glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC) load("glGetBufferParameteriv"); + glad_glGetError = (PFNGLGETERRORPROC) load("glGetError"); + glad_glGetFloatv = (PFNGLGETFLOATVPROC) load("glGetFloatv"); + glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) load( + "glGetFramebufferAttachmentParameteriv"); + glad_glGetIntegerv = (PFNGLGETINTEGERVPROC) load("glGetIntegerv"); + glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC) load("glGetProgramiv"); + glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) load("glGetProgramInfoLog"); + glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) load( + "glGetRenderbufferParameteriv"); + glad_glGetShaderiv = (PFNGLGETSHADERIVPROC) load("glGetShaderiv"); + glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) load("glGetShaderInfoLog"); + glad_glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC) load( + "glGetShaderPrecisionFormat"); + glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC) load("glGetShaderSource"); + glad_glGetString = (PFNGLGETSTRINGPROC) load("glGetString"); + glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC) load("glGetTexParameterfv"); + glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC) load("glGetTexParameteriv"); + glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC) load("glGetUniformfv"); + glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC) load("glGetUniformiv"); + glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) load("glGetUniformLocation"); + glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC) load("glGetVertexAttribfv"); + glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC) load("glGetVertexAttribiv"); + glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC) load( + "glGetVertexAttribPointerv"); + glad_glHint = (PFNGLHINTPROC) load("glHint"); + glad_glIsBuffer = (PFNGLISBUFFERPROC) load("glIsBuffer"); + glad_glIsEnabled = (PFNGLISENABLEDPROC) load("glIsEnabled"); + glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) load("glIsFramebuffer"); + glad_glIsProgram = (PFNGLISPROGRAMPROC) load("glIsProgram"); + glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) load("glIsRenderbuffer"); + glad_glIsShader = (PFNGLISSHADERPROC) load("glIsShader"); + glad_glIsTexture = (PFNGLISTEXTUREPROC) load("glIsTexture"); + glad_glLineWidth = (PFNGLLINEWIDTHPROC) load("glLineWidth"); + glad_glLinkProgram = (PFNGLLINKPROGRAMPROC) load("glLinkProgram"); + glad_glPixelStorei = (PFNGLPIXELSTOREIPROC) load("glPixelStorei"); + glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC) load("glPolygonOffset"); + glad_glReadPixels = (PFNGLREADPIXELSPROC) load("glReadPixels"); + glad_glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC) load("glReleaseShaderCompiler"); + glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) load("glRenderbufferStorage"); + glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC) load("glSampleCoverage"); + glad_glScissor = (PFNGLSCISSORPROC) load("glScissor"); + glad_glShaderBinary = (PFNGLSHADERBINARYPROC) load("glShaderBinary"); + glad_glShaderSource = (PFNGLSHADERSOURCEPROC) load("glShaderSource"); + glad_glStencilFunc = (PFNGLSTENCILFUNCPROC) load("glStencilFunc"); + glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC) load("glStencilFuncSeparate"); + glad_glStencilMask = (PFNGLSTENCILMASKPROC) load("glStencilMask"); + glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC) load("glStencilMaskSeparate"); + glad_glStencilOp = (PFNGLSTENCILOPPROC) load("glStencilOp"); + glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) load("glStencilOpSeparate"); + glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC) load("glTexImage2D"); + glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC) load("glTexParameterf"); + glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC) load("glTexParameterfv"); + glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC) load("glTexParameteri"); + glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC) load("glTexParameteriv"); + glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC) load("glTexSubImage2D"); + glad_glUniform1f = (PFNGLUNIFORM1FPROC) load("glUniform1f"); + glad_glUniform1fv = (PFNGLUNIFORM1FVPROC) load("glUniform1fv"); + glad_glUniform1i = (PFNGLUNIFORM1IPROC) load("glUniform1i"); + glad_glUniform1iv = (PFNGLUNIFORM1IVPROC) load("glUniform1iv"); + glad_glUniform2f = (PFNGLUNIFORM2FPROC) load("glUniform2f"); + glad_glUniform2fv = (PFNGLUNIFORM2FVPROC) load("glUniform2fv"); + glad_glUniform2i = (PFNGLUNIFORM2IPROC) load("glUniform2i"); + glad_glUniform2iv = (PFNGLUNIFORM2IVPROC) load("glUniform2iv"); + glad_glUniform3f = (PFNGLUNIFORM3FPROC) load("glUniform3f"); + glad_glUniform3fv = (PFNGLUNIFORM3FVPROC) load("glUniform3fv"); + glad_glUniform3i = (PFNGLUNIFORM3IPROC) load("glUniform3i"); + glad_glUniform3iv = (PFNGLUNIFORM3IVPROC) load("glUniform3iv"); + glad_glUniform4f = (PFNGLUNIFORM4FPROC) load("glUniform4f"); + glad_glUniform4fv = (PFNGLUNIFORM4FVPROC) load("glUniform4fv"); + glad_glUniform4i = (PFNGLUNIFORM4IPROC) load("glUniform4i"); + glad_glUniform4iv = (PFNGLUNIFORM4IVPROC) load("glUniform4iv"); + glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC) load("glUniformMatrix2fv"); + glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC) load("glUniformMatrix3fv"); + glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) load("glUniformMatrix4fv"); + glad_glUseProgram = (PFNGLUSEPROGRAMPROC) load("glUseProgram"); + glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC) load("glValidateProgram"); + glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC) load("glVertexAttrib1f"); + glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC) load("glVertexAttrib1fv"); + glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC) load("glVertexAttrib2f"); + glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC) load("glVertexAttrib2fv"); + glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC) load("glVertexAttrib3f"); + glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC) load("glVertexAttrib3fv"); + glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC) load("glVertexAttrib4f"); + glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC) load("glVertexAttrib4fv"); + glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) load("glVertexAttribPointer"); + glad_glViewport = (PFNGLVIEWPORTPROC) load("glViewport"); } + static void load_GL_ES_VERSION_3_0(GLADloadproc load) { - if(!GLAD_GL_ES_VERSION_3_0) return; - glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer"); - glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements"); - glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D"); - glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D"); - glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D"); - glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D"); - glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D"); - glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries"); - glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries"); - glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery"); - glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery"); - glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery"); - glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv"); - glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv"); - glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer"); - glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv"); - glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers"); - glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv"); - glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv"); - glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv"); - glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv"); - glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv"); - glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv"); - glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer"); - glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample"); - glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer"); - glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load("glMapBufferRange"); - glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load("glFlushMappedBufferRange"); - glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray"); - glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays"); - glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays"); - glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray"); - glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); - glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load("glBeginTransformFeedback"); - glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load("glEndTransformFeedback"); - glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); - glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); - glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load("glTransformFeedbackVaryings"); - glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load("glGetTransformFeedbackVarying"); - glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load("glVertexAttribIPointer"); - glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load("glGetVertexAttribIiv"); - glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load("glGetVertexAttribIuiv"); - glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load("glVertexAttribI4i"); - glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load("glVertexAttribI4ui"); - glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load("glVertexAttribI4iv"); - glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load("glVertexAttribI4uiv"); - glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load("glGetUniformuiv"); - glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load("glGetFragDataLocation"); - glad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load("glUniform1ui"); - glad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load("glUniform2ui"); - glad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load("glUniform3ui"); - glad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load("glUniform4ui"); - glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load("glUniform1uiv"); - glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load("glUniform2uiv"); - glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load("glUniform3uiv"); - glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load("glUniform4uiv"); - glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load("glClearBufferiv"); - glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load("glClearBufferuiv"); - glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load("glClearBufferfv"); - glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load("glClearBufferfi"); - glad_glGetStringi = (PFNGLGETSTRINGIPROC)load("glGetStringi"); - glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load("glCopyBufferSubData"); - glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load("glGetUniformIndices"); - glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load("glGetActiveUniformsiv"); - glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load("glGetUniformBlockIndex"); - glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load("glGetActiveUniformBlockiv"); - glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load("glGetActiveUniformBlockName"); - glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load("glUniformBlockBinding"); - glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load("glDrawArraysInstanced"); - glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load("glDrawElementsInstanced"); - glad_glFenceSync = (PFNGLFENCESYNCPROC)load("glFenceSync"); - glad_glIsSync = (PFNGLISSYNCPROC)load("glIsSync"); - glad_glDeleteSync = (PFNGLDELETESYNCPROC)load("glDeleteSync"); - glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)load("glClientWaitSync"); - glad_glWaitSync = (PFNGLWAITSYNCPROC)load("glWaitSync"); - glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC)load("glGetInteger64v"); - glad_glGetSynciv = (PFNGLGETSYNCIVPROC)load("glGetSynciv"); - glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)load("glGetInteger64i_v"); - glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)load("glGetBufferParameteri64v"); - glad_glGenSamplers = (PFNGLGENSAMPLERSPROC)load("glGenSamplers"); - glad_glDeleteSamplers = (PFNGLDELETESAMPLERSPROC)load("glDeleteSamplers"); - glad_glIsSampler = (PFNGLISSAMPLERPROC)load("glIsSampler"); - glad_glBindSampler = (PFNGLBINDSAMPLERPROC)load("glBindSampler"); - glad_glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC)load("glSamplerParameteri"); - glad_glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC)load("glSamplerParameteriv"); - glad_glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC)load("glSamplerParameterf"); - glad_glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC)load("glSamplerParameterfv"); - glad_glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC)load("glGetSamplerParameteriv"); - glad_glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC)load("glGetSamplerParameterfv"); - glad_glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)load("glVertexAttribDivisor"); - glad_glBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC)load("glBindTransformFeedback"); - glad_glDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC)load("glDeleteTransformFeedbacks"); - glad_glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC)load("glGenTransformFeedbacks"); - glad_glIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC)load("glIsTransformFeedback"); - glad_glPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC)load("glPauseTransformFeedback"); - glad_glResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC)load("glResumeTransformFeedback"); - glad_glGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC)load("glGetProgramBinary"); - glad_glProgramBinary = (PFNGLPROGRAMBINARYPROC)load("glProgramBinary"); - glad_glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC)load("glProgramParameteri"); - glad_glInvalidateFramebuffer = (PFNGLINVALIDATEFRAMEBUFFERPROC)load("glInvalidateFramebuffer"); - glad_glInvalidateSubFramebuffer = (PFNGLINVALIDATESUBFRAMEBUFFERPROC)load("glInvalidateSubFramebuffer"); - glad_glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)load("glTexStorage2D"); - glad_glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)load("glTexStorage3D"); - glad_glGetInternalformativ = (PFNGLGETINTERNALFORMATIVPROC)load("glGetInternalformativ"); + if (!GLAD_GL_ES_VERSION_3_0) return; + glad_glReadBuffer = (PFNGLREADBUFFERPROC) load("glReadBuffer"); + glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC) load("glDrawRangeElements"); + glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC) load("glTexImage3D"); + glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC) load("glTexSubImage3D"); + glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC) load("glCopyTexSubImage3D"); + glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC) load("glCompressedTexImage3D"); + glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) load( + "glCompressedTexSubImage3D"); + glad_glGenQueries = (PFNGLGENQUERIESPROC) load("glGenQueries"); + glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC) load("glDeleteQueries"); + glad_glIsQuery = (PFNGLISQUERYPROC) load("glIsQuery"); + glad_glBeginQuery = (PFNGLBEGINQUERYPROC) load("glBeginQuery"); + glad_glEndQuery = (PFNGLENDQUERYPROC) load("glEndQuery"); + glad_glGetQueryiv = (PFNGLGETQUERYIVPROC) load("glGetQueryiv"); + glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC) load("glGetQueryObjectuiv"); + glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC) load("glUnmapBuffer"); + glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC) load("glGetBufferPointerv"); + glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC) load("glDrawBuffers"); + glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC) load("glUniformMatrix2x3fv"); + glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC) load("glUniformMatrix3x2fv"); + glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC) load("glUniformMatrix2x4fv"); + glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC) load("glUniformMatrix4x2fv"); + glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC) load("glUniformMatrix3x4fv"); + glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC) load("glUniformMatrix4x3fv"); + glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC) load("glBlitFramebuffer"); + glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) load( + "glRenderbufferStorageMultisample"); + glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) load( + "glFramebufferTextureLayer"); + glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC) load("glMapBufferRange"); + glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC) load( + "glFlushMappedBufferRange"); + glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC) load("glBindVertexArray"); + glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC) load("glDeleteVertexArrays"); + glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) load("glGenVertexArrays"); + glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC) load("glIsVertexArray"); + glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC) load("glGetIntegeri_v"); + glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC) load( + "glBeginTransformFeedback"); + glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC) load("glEndTransformFeedback"); + glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC) load("glBindBufferRange"); + glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC) load("glBindBufferBase"); + glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC) load( + "glTransformFeedbackVaryings"); + glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) load( + "glGetTransformFeedbackVarying"); + glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC) load("glVertexAttribIPointer"); + glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC) load("glGetVertexAttribIiv"); + glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC) load("glGetVertexAttribIuiv"); + glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC) load("glVertexAttribI4i"); + glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC) load("glVertexAttribI4ui"); + glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC) load("glVertexAttribI4iv"); + glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC) load("glVertexAttribI4uiv"); + glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC) load("glGetUniformuiv"); + glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC) load("glGetFragDataLocation"); + glad_glUniform1ui = (PFNGLUNIFORM1UIPROC) load("glUniform1ui"); + glad_glUniform2ui = (PFNGLUNIFORM2UIPROC) load("glUniform2ui"); + glad_glUniform3ui = (PFNGLUNIFORM3UIPROC) load("glUniform3ui"); + glad_glUniform4ui = (PFNGLUNIFORM4UIPROC) load("glUniform4ui"); + glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC) load("glUniform1uiv"); + glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC) load("glUniform2uiv"); + glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC) load("glUniform3uiv"); + glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC) load("glUniform4uiv"); + glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC) load("glClearBufferiv"); + glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC) load("glClearBufferuiv"); + glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC) load("glClearBufferfv"); + glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC) load("glClearBufferfi"); + glad_glGetStringi = (PFNGLGETSTRINGIPROC) load("glGetStringi"); + glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC) load("glCopyBufferSubData"); + glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC) load("glGetUniformIndices"); + glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC) load("glGetActiveUniformsiv"); + glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC) load("glGetUniformBlockIndex"); + glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC) load( + "glGetActiveUniformBlockiv"); + glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) load( + "glGetActiveUniformBlockName"); + glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC) load("glUniformBlockBinding"); + glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) load("glDrawArraysInstanced"); + glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) load("glDrawElementsInstanced"); + glad_glFenceSync = (PFNGLFENCESYNCPROC) load("glFenceSync"); + glad_glIsSync = (PFNGLISSYNCPROC) load("glIsSync"); + glad_glDeleteSync = (PFNGLDELETESYNCPROC) load("glDeleteSync"); + glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC) load("glClientWaitSync"); + glad_glWaitSync = (PFNGLWAITSYNCPROC) load("glWaitSync"); + glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC) load("glGetInteger64v"); + glad_glGetSynciv = (PFNGLGETSYNCIVPROC) load("glGetSynciv"); + glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC) load("glGetInteger64i_v"); + glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC) load( + "glGetBufferParameteri64v"); + glad_glGenSamplers = (PFNGLGENSAMPLERSPROC) load("glGenSamplers"); + glad_glDeleteSamplers = (PFNGLDELETESAMPLERSPROC) load("glDeleteSamplers"); + glad_glIsSampler = (PFNGLISSAMPLERPROC) load("glIsSampler"); + glad_glBindSampler = (PFNGLBINDSAMPLERPROC) load("glBindSampler"); + glad_glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC) load("glSamplerParameteri"); + glad_glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC) load("glSamplerParameteriv"); + glad_glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC) load("glSamplerParameterf"); + glad_glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC) load("glSamplerParameterfv"); + glad_glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC) load("glGetSamplerParameteriv"); + glad_glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC) load("glGetSamplerParameterfv"); + glad_glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) load("glVertexAttribDivisor"); + glad_glBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC) load("glBindTransformFeedback"); + glad_glDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC) load( + "glDeleteTransformFeedbacks"); + glad_glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC) load("glGenTransformFeedbacks"); + glad_glIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC) load("glIsTransformFeedback"); + glad_glPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC) load( + "glPauseTransformFeedback"); + glad_glResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC) load( + "glResumeTransformFeedback"); + glad_glGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC) load("glGetProgramBinary"); + glad_glProgramBinary = (PFNGLPROGRAMBINARYPROC) load("glProgramBinary"); + glad_glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC) load("glProgramParameteri"); + glad_glInvalidateFramebuffer = (PFNGLINVALIDATEFRAMEBUFFERPROC) load("glInvalidateFramebuffer"); + glad_glInvalidateSubFramebuffer = (PFNGLINVALIDATESUBFRAMEBUFFERPROC) load( + "glInvalidateSubFramebuffer"); + glad_glTexStorage2D = (PFNGLTEXSTORAGE2DPROC) load("glTexStorage2D"); + glad_glTexStorage3D = (PFNGLTEXSTORAGE3DPROC) load("glTexStorage3D"); + glad_glGetInternalformativ = (PFNGLGETINTERNALFORMATIVPROC) load("glGetInternalformativ"); } + static int find_extensionsGLES2(void) { - if (!get_exts()) return 0; - (void)&has_ext; - free_exts(); - return 1; + if (!get_exts()) return 0; + (void) &has_ext; + free_exts(); + return 1; } static void find_coreGLES2(void) { @@ -638,18 +667,18 @@ static void find_coreGLES2(void) { */ int i, major, minor; - const char* version; - const char* prefixes[] = { - "OpenGL ES-CM ", - "OpenGL ES-CL ", - "OpenGL ES ", - NULL + const char *version; + const char *prefixes[] = { + "OpenGL ES-CM ", + "OpenGL ES-CL ", + "OpenGL ES ", + NULL }; - version = (const char*) glGetString(GL_VERSION); + version = (const char *) glGetString(GL_VERSION); if (!version) return; - for (i = 0; prefixes[i]; i++) { + for (i = 0; prefixes[i]; i++) { const size_t length = strlen(prefixes[i]); if (strncmp(version, prefixes[i], length) == 0) { version += length; @@ -664,26 +693,29 @@ static void find_coreGLES2(void) { sscanf(version, "%d.%d", &major, &minor); #endif - GLVersion.major = major; GLVersion.minor = minor; - max_loaded_major = major; max_loaded_minor = minor; - GLAD_GL_ES_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; - GLAD_GL_ES_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3; - if (GLVersion.major > 3 || (GLVersion.major >= 3 && GLVersion.minor >= 0)) { - max_loaded_major = 3; - max_loaded_minor = 0; - } + GLVersion.major = major; + GLVersion.minor = minor; + max_loaded_major = major; + max_loaded_minor = minor; + GLAD_GL_ES_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; + GLAD_GL_ES_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3; + if (GLVersion.major > 3 || (GLVersion.major >= 3 && GLVersion.minor >= 0)) { + max_loaded_major = 3; + max_loaded_minor = 0; + } } int gladLoadGLES2Loader(GLADloadproc load) { - GLVersion.major = 0; GLVersion.minor = 0; - glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - if(glGetString == NULL) return 0; - if(glGetString(GL_VERSION) == NULL) return 0; - find_coreGLES2(); - load_GL_ES_VERSION_2_0(load); - load_GL_ES_VERSION_3_0(load); - - if (!find_extensionsGLES2()) return 0; - return GLVersion.major != 0 || GLVersion.minor != 0; + GLVersion.major = 0; + GLVersion.minor = 0; + glGetString = (PFNGLGETSTRINGPROC) load("glGetString"); + if (glGetString == NULL) return 0; + if (glGetString(GL_VERSION) == NULL) return 0; + find_coreGLES2(); + load_GL_ES_VERSION_2_0(load); + load_GL_ES_VERSION_3_0(load); + + if (!find_extensionsGLES2()) return 0; + return GLVersion.major != 0 || GLVersion.minor != 0; } diff --git a/mobile/c/gui/jni_gl.c b/mobile/c/gui/jni_gl.c index 72b32790..ac82d544 100644 --- a/mobile/c/gui/jni_gl.c +++ b/mobile/c/gui/jni_gl.c @@ -9,6 +9,23 @@ #include "jvm.h" #include "media.h" +int org_mini_gl_GL_get_gl_proc(Runtime *runtime, JClass *clazz) { + JniEnv *env = runtime->jnienv; + s32 pos = 0; + + Instance *namez = env->localvar_getRefer(runtime->localvar, pos++); + Utf8String *u_namez; + if(namez){ + u_namez = env->utf8_create(); + env->jstring_2_utf8(namez, u_namez, runtime); + } + + GLint64 _re_val = get_gl_proc((const char*)(env->utf8_cstr(u_namez))); + s64 ret_value = *((s64*)&_re_val);env->push_long(runtime->stack, ret_value); + env->utf8_destory(u_namez); + return 0; +} + int org_mini_gl_GL_glActiveTexture(Runtime *runtime, JClass *clazz) { JniEnv *env = runtime->jnienv; s32 pos = 0; @@ -3773,7 +3790,7 @@ int org_mini_gl_GL_glGetSynciv(Runtime *runtime, JClass *clazz) { intptr_t psync = env->localvar_getLong_2slot(runtime->localvar, pos);pos += 2; s32 ppname = env->localvar_getInt(runtime->localvar, pos++); - s32 pbufSize = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); Instance *plength = env->localvar_getRefer(runtime->localvar, pos++); int offset_plength = env->localvar_getInt(runtime->localvar, pos++); __refer ptr_plength = NULL; @@ -3789,7 +3806,7 @@ int org_mini_gl_GL_glGetSynciv(Runtime *runtime, JClass *clazz) { ptr_pvalues = pvalues->arr_body + offset_pvalues; } else if(offset_pvalues) { ptr_pvalues = (__refer)(intptr_t)offset_pvalues;} - glGetSynciv((GLsync)psync, (GLenum)ppname, (GLsizei)pbufSize, (GLsizei*)(ptr_plength), (GLint*)(ptr_pvalues)); + glGetSynciv((GLsync)psync, (GLenum)ppname, (GLsizei)pcount, (GLsizei*)(ptr_plength), (GLint*)(ptr_pvalues)); return 0; @@ -4257,7 +4274,7 @@ int org_mini_gl_GL_glGetInternalformativ(Runtime *runtime, JClass *clazz) { s32 ptarget = env->localvar_getInt(runtime->localvar, pos++); s32 pinternalformat = env->localvar_getInt(runtime->localvar, pos++); s32 ppname = env->localvar_getInt(runtime->localvar, pos++); - s32 pbufSize = env->localvar_getInt(runtime->localvar, pos++); + s32 pcount = env->localvar_getInt(runtime->localvar, pos++); Instance *pparams = env->localvar_getRefer(runtime->localvar, pos++); int offset_pparams = env->localvar_getInt(runtime->localvar, pos++); __refer ptr_pparams = NULL; @@ -4266,7 +4283,7 @@ int org_mini_gl_GL_glGetInternalformativ(Runtime *runtime, JClass *clazz) { ptr_pparams = pparams->arr_body + offset_pparams; } else if(offset_pparams) { ptr_pparams = (__refer)(intptr_t)offset_pparams;} - glGetInternalformativ((GLenum)ptarget, (GLenum)pinternalformat, (GLenum)ppname, (GLsizei)pbufSize, (GLint*)(ptr_pparams)); + glGetInternalformativ((GLenum)ptarget, (GLenum)pinternalformat, (GLenum)ppname, (GLsizei)pcount, (GLint*)(ptr_pparams)); return 0; @@ -4277,6 +4294,7 @@ int org_mini_gl_GL_glGetInternalformativ(Runtime *runtime, JClass *clazz) { static java_native_method method_gl_table[] = { +{"org/mini/gl/GL", "get_gl_proc", "(Ljava/lang/String;)J", org_mini_gl_GL_get_gl_proc}, {"org/mini/gl/GL", "glActiveTexture", "(I)V", org_mini_gl_GL_glActiveTexture}, {"org/mini/gl/GL", "glAttachShader", "(II)V", org_mini_gl_GL_glAttachShader}, {"org/mini/gl/GL", "glBindAttribLocation", "(II[B)V", org_mini_gl_GL_glBindAttribLocation}, diff --git a/mobile/c/gui/media.c b/mobile/c/gui/media.c index 40d37de7..c9ddf049 100755 --- a/mobile/c/gui/media.c +++ b/mobile/c/gui/media.c @@ -11,7 +11,7 @@ void JNI_OnLoad_mini(MiniJVM *jvm) { JniEnv *env = jvm->env; refers.env = env; - refers.runtime_list=pairlist_create(10); + refers.runtime_list = pairlist_create(10); env->native_reg_lib(jvm, ptr_GlfmFuncTable(), count_GlfmFuncTable()); @@ -27,22 +27,23 @@ void JNI_OnUnload_mini(MiniJVM *jvm) { env->native_remove_lib(jvm, ptr_NanovgFuncTable()); s32 i; - for(i=0;icount;i++){ - Runtime *runtime=pairlist_get_pair(refers.runtime_list, i).right; - if(runtime){ + for (i = 0; i < refers.runtime_list->count; i++) { + Runtime *runtime = pairlist_get_pair(refers.runtime_list, i).right; + if (runtime) { thread_unboundle(runtime); runtime_destroy(runtime); } } pairlist_destroy(refers.runtime_list); - + } tss_t TSS_KEY_RUNTIME_OF_THREAD; + Runtime *getRuntimeCurThread(JniEnv *env) { - static s32 init=0; - if(!init){ - tss_create(&TSS_KEY_RUNTIME_OF_THREAD,NULL); + static s32 init = 0; + if (!init) { + tss_create(&TSS_KEY_RUNTIME_OF_THREAD, NULL); //tss_create(&TSS_KEY_RUNTIME_OF_THREAD,(tss_dtor_t)env->runtime_destory); init = 1; } @@ -55,9 +56,9 @@ Runtime *getRuntimeCurThread(JniEnv *env) { runtime = env->runtime_create(refers.jvm); env->thread_boundle(runtime); env->jthread_set_daemon_value(runtime->thrd_info->jthread, runtime, 1); - tss_set(TSS_KEY_RUNTIME_OF_THREAD,runtime); + tss_set(TSS_KEY_RUNTIME_OF_THREAD, runtime); } - + return runtime;// } @@ -67,3 +68,9 @@ Runtime *getRuntimeCurThread(JniEnv *env) { * * ===============================================================*/ +extern int has_ext(const char *ext); + +s64 get_gl_proc(const char *namez) { + int has = has_ext(namez); + return (s64) (intptr_t) has; +} diff --git a/mobile/c/gui/media.h b/mobile/c/gui/media.h index 88e14986..a648a2b6 100755 --- a/mobile/c/gui/media.h +++ b/mobile/c/gui/media.h @@ -34,6 +34,8 @@ s32 count_MiniAudioFuncTable(); // Runtime *getRuntimeCurThread(JniEnv *env); +s64 get_gl_proc(const char *namez); + struct _GlobeRefer { MiniJVM *jvm; JniEnv *env; diff --git a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/GL_h_2_java.java b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/GL_h_2_java.java index 3392099c..11132e3f 100644 --- a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/GL_h_2_java.java +++ b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/GL_h_2_java.java @@ -13,8 +13,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import static org.mini.jnibuilder.Util.getType; -import static org.mini.jnibuilder.Util.isTypes; +import static org.mini.jnibuilder.JniUtil.getType; +import static org.mini.jnibuilder.JniUtil.isTypes; /** * @@ -37,6 +37,7 @@ public static void main(String[] args) { + "public class GL {\n" + "${FIELDS}\n" + " //public static native int gladLoadGLES2Loader();// //int\n" + + " public static native long get_gl_proc(String namez);//const char* //GLint64\n" + "${METHODS}\n" + "}\n\n"; String FIELDS = "${FIELDS}"; diff --git a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/GL_java_2_c.java b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/GL_java_2_c.java index 07b79842..8ee94eb8 100644 --- a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/GL_java_2_c.java +++ b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/GL_java_2_c.java @@ -13,8 +13,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import static org.mini.jnibuilder.Util.isPointer; -import static org.mini.jnibuilder.Util.isTypes; +import static org.mini.jnibuilder.JniUtil.isPointer; +import static org.mini.jnibuilder.JniUtil.isTypes; /** * @@ -30,7 +30,7 @@ public static void main(String[] args) { String[] path = {"src/main/java/org/mini/gl/GL.java", "org_mini_gl_GL_", "org/mini/gl/GL", "../../c/gui/jni_gl.c"}; String[] ignore_list = {"", - "",}; + "",}; String C_BODY_HEADER = ""// @@ -49,26 +49,26 @@ public static void main(String[] args) { String TOOL_FUNC = // "s32 count_GLFuncTable() {\n" - + " return sizeof(method_gl_table) / sizeof(java_native_method);\n" - + "}\n" - + "\n" - + "__refer ptr_GLFuncTable() {\n" - + " return &method_gl_table[0];\n" - + "}"; + + " return sizeof(method_gl_table) / sizeof(java_native_method);\n" + + "}\n" + + "\n" + + "__refer ptr_GLFuncTable() {\n" + + " return &method_gl_table[0];\n" + + "}"; String FUNC_TABLE_HEADER = "static java_native_method method_gl_table[] = {\n\n"; String FUNC_TABLE_FOOTER = "};\n\n"; String FUNC_BODY_TEMPLATE = // "int ${PKG_NAME}${METHOD_NAME}(Runtime *runtime, JClass *clazz) {\n" - + " JniEnv *env = runtime->jnienv;\n" - + " s32 pos = 0;\n" - + " \n${GET_VAR}\n" - + " ${RETURN_TYPE}${METHOD_NAME}(${NATIVE_ARGV});\n" - + " ${PUSH_RESULT}\n" - + " ${RELEASE_MEM}\n" - + " return 0;\n" - + "}\n\n"; + + " JniEnv *env = runtime->jnienv;\n" + + " s32 pos = 0;\n" + + " \n${GET_VAR}\n" + + " ${RETURN_TYPE}${METHOD_NAME}(${NATIVE_ARGV});\n" + + " ${PUSH_RESULT}\n" + + " ${RELEASE_MEM}\n" + + " return 0;\n" + + "}\n\n"; String PKG_NAME = "${PKG_NAME}"; String PKG_PATH = "${PKG_PATH}"; String METHOD_NAME = "${METHOD_NAME}"; @@ -285,14 +285,12 @@ void buildC() { javaArgvCode += "D"; } else if ("String".equals(argvType)) { varCode += " Instance *" + argvName + " = env->localvar_getRefer(runtime->localvar, pos++);\n"; - varCode += " __refer ptr_" + argvName + " = NULL;\n"; varCode += " Utf8String *u_" + argvName + ";\n"; varCode += " if(" + argvName + "){\n"; varCode += " u_" + argvName + " = env->utf8_create();\n"; - varCode += " env->jstring_2_utf8(" + argvName + ", u_" + argvName + ");\n"; - varCode += " ptr_" + argvName + " = env->utf8_cstr(u_" + argvName + ");\n"; + varCode += " env->jstring_2_utf8(" + argvName + ", u_" + argvName + ", runtime);\n"; varCode += " }\n"; - curArgvName = "(ptr_" + argvName + ")"; + curArgvName = "(env->utf8_cstr(u_" + argvName + "))"; releaseMemCode += "env->utf8_destory(u_" + argvName + ");"; javaArgvCode += "Ljava/lang/String;"; } else if ("byte[][]".equals(argvType) || "byte[]...".equals(argvType)) { diff --git a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/GL_java_2_c_for_cc.java b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/GL_java_2_c_for_cc.java index 08801f13..70afc017 100644 --- a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/GL_java_2_c_for_cc.java +++ b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/GL_java_2_c_for_cc.java @@ -6,12 +6,11 @@ package org.mini.jnibuilder; import java.io.*; -import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List; -import static org.mini.jnibuilder.Util.isPointer; -import static org.mini.jnibuilder.Util.isTypes; +import static org.mini.jnibuilder.JniUtil.isPointer; +import static org.mini.jnibuilder.JniUtil.isTypes; /** * @author gust diff --git a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Util.java b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/JniUtil.java similarity index 98% rename from mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Util.java rename to mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/JniUtil.java index 1eea3dcb..4bb9a6e2 100644 --- a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Util.java +++ b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/JniUtil.java @@ -9,7 +9,7 @@ * * @author gust */ -public class Util { +public class JniUtil { public static boolean isPointer(String nativeTypeStr) { return nativeTypeStr.contains("/*ptr*/"); diff --git a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Nanovg_h_2_java.java b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Nanovg_h_2_java.java index 66d7720b..2f885cfe 100644 --- a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Nanovg_h_2_java.java +++ b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Nanovg_h_2_java.java @@ -214,7 +214,7 @@ void buildC() { String[] nArgvs = mdef.split(","); for (int j = 0; j < nArgvs.length; j++) { String nargv = nArgvs[j].trim(); - String arType = Util.getType(TYPES_ALL, nargv); + String arType = JniUtil.getType(TYPES_ALL, nargv); String arName = "arg" + j; if (arType == null) { System.out.println("error argv type:" + nargv); @@ -227,52 +227,52 @@ void buildC() { arName = arName.trim(); arName = "p" + arName; - if (Util.isTypes(INT_TYPE, arType)) { + if (JniUtil.isTypes(INT_TYPE, arType)) { javaArgvCode += "int " + arName; - } else if (Util.isTypes(ARR_INT_TYPE, arType)) { + } else if (JniUtil.isTypes(ARR_INT_TYPE, arType)) { javaArgvCode += "int[] " + arName; - } else if (Util.isTypes(SHORT_TYPE, arType)) { + } else if (JniUtil.isTypes(SHORT_TYPE, arType)) { javaArgvCode += "short " + arName; - } else if (Util.isTypes(ARR_SHORT_TYPE, arType)) { + } else if (JniUtil.isTypes(ARR_SHORT_TYPE, arType)) { javaArgvCode += "short[] " + arName; - } else if (Util.isTypes(BYTE_TYPE, arType)) { + } else if (JniUtil.isTypes(BYTE_TYPE, arType)) { javaArgvCode += "byte " + arName; - } else if (Util.isTypes(ARR_BYTE_TYPE, arType)) { + } else if (JniUtil.isTypes(ARR_BYTE_TYPE, arType)) { javaArgvCode += "byte[] " + arName; - } else if (Util.isTypes(LONG_TYPE, arType)) { + } else if (JniUtil.isTypes(LONG_TYPE, arType)) { javaArgvCode += "long " + arName; - } else if (Util.isTypes(ARR_LONG_TYPE, arType)) { + } else if (JniUtil.isTypes(ARR_LONG_TYPE, arType)) { javaArgvCode += "long[] " + arName; - } else if (Util.isTypes(FLOAT_TYPE, arType)) { + } else if (JniUtil.isTypes(FLOAT_TYPE, arType)) { javaArgvCode += "float " + arName; - } else if (Util.isTypes(ARR_FLOAT_TYPE, arType)) { + } else if (JniUtil.isTypes(ARR_FLOAT_TYPE, arType)) { javaArgvCode += "float[] " + arName; - } else if (Util.isTypes(DOUBLE_TYPE, arType)) { + } else if (JniUtil.isTypes(DOUBLE_TYPE, arType)) { javaArgvCode += "double " + arName; - } else if (Util.isTypes(ARR_DOUBLE_TYPE, arType)) { + } else if (JniUtil.isTypes(ARR_DOUBLE_TYPE, arType)) { javaArgvCode += "double[] " + arName; - } else if (Util.isTypes(OBJECT_TYPE, arType)) { + } else if (JniUtil.isTypes(OBJECT_TYPE, arType)) { javaArgvCode += "long " + arName; arType += "/*ptr*/"; - } else if (Util.isTypes(ARR_OBJECT_TYPE, arType)) { + } else if (JniUtil.isTypes(ARR_OBJECT_TYPE, arType)) { javaArgvCode += "long[] " + arName; arType += "/*ptr*/"; - } else if (Util.isTypes(MULT_TYPE, arType)) { + } else if (JniUtil.isTypes(MULT_TYPE, arType)) { javaArgvCode += "byte[]" + arType + " " + arName; - } else if (Util.isTypes(STRUCT_FLOAT_ARR_TYPE, arType)) { + } else if (JniUtil.isTypes(STRUCT_FLOAT_ARR_TYPE, arType)) { javaArgvCode += "float[] " + arName; arType += "/*none_ptr*/"; - } else if (Util.isTypes(STRUCT_INT_ARR_TYPE, arType)) { + } else if (JniUtil.isTypes(STRUCT_INT_ARR_TYPE, arType)) { javaArgvCode += "int[] " + arName; arType += "/*none_ptr*/"; - } else if (Util.isTypes(STRUCT_BYTE_ARR_TYPE, arType)) { + } else if (JniUtil.isTypes(STRUCT_BYTE_ARR_TYPE, arType)) { javaArgvCode += "byte[] " + arName; arType += "/*none_ptr*/"; - } else if (Util.isTypes(STRING_TYPE, arType)) { + } else if (JniUtil.isTypes(STRING_TYPE, arType)) { javaArgvCode += "byte[] " + arName; - } else if (Util.isTypes(ARR_STRING_TYPE, arType)) { + } else if (JniUtil.isTypes(ARR_STRING_TYPE, arType)) { javaArgvCode += "byte[][] " + arName; - } else if (Util.isTypes(VOID_TYPE, arType)) { + } else if (JniUtil.isTypes(VOID_TYPE, arType)) { } else { System.out.println("java argv type:" + arType); } @@ -288,36 +288,36 @@ void buildC() { // mtype = mtype.replace(" *", "*"); String nativeReturnCode = mtype; - if (Util.isTypes(BYTE_TYPE, mtype)) { + if (JniUtil.isTypes(BYTE_TYPE, mtype)) { javaReturnCode = "byte"; - } else if (Util.isTypes(INT_TYPE, mtype)) { + } else if (JniUtil.isTypes(INT_TYPE, mtype)) { javaReturnCode = "int"; - } else if (Util.isTypes(ARR_INT_TYPE, mtype)) { + } else if (JniUtil.isTypes(ARR_INT_TYPE, mtype)) { javaReturnCode = "int[]"; - } else if (Util.isTypes(FLOAT_TYPE, mtype)) { + } else if (JniUtil.isTypes(FLOAT_TYPE, mtype)) { javaReturnCode = "float"; - } else if (Util.isTypes(ARR_FLOAT_TYPE, mtype)) { + } else if (JniUtil.isTypes(ARR_FLOAT_TYPE, mtype)) { javaReturnCode = "float[]"; - } else if (Util.isTypes(LONG_TYPE, mtype)) { + } else if (JniUtil.isTypes(LONG_TYPE, mtype)) { javaReturnCode = "long"; - } else if (Util.isTypes(ARR_BYTE_TYPE, mtype)) { + } else if (JniUtil.isTypes(ARR_BYTE_TYPE, mtype)) { javaReturnCode = "byte[]"; - } else if (Util.isTypes(STRING_TYPE, mtype)) { + } else if (JniUtil.isTypes(STRING_TYPE, mtype)) { javaReturnCode = "byte[]"; - } else if (Util.isTypes(DOUBLE_TYPE, mtype)) { + } else if (JniUtil.isTypes(DOUBLE_TYPE, mtype)) { javaReturnCode = "double"; - } else if (Util.isTypes(ARR_LONG_TYPE, mtype)) { + } else if (JniUtil.isTypes(ARR_LONG_TYPE, mtype)) { javaReturnCode = "long[]"; - } else if (Util.isTypes(OBJECT_TYPE, mtype)) { + } else if (JniUtil.isTypes(OBJECT_TYPE, mtype)) { javaReturnCode += "long "; nativeReturnCode += "/*ptr*/ "; - } else if (Util.isTypes(STRUCT_FLOAT_ARR_TYPE, mtype)) { + } else if (JniUtil.isTypes(STRUCT_FLOAT_ARR_TYPE, mtype)) { javaReturnCode += "float[] "; nativeReturnCode += "/*none_ptr*/ "; - } else if (Util.isTypes(STRUCT_INT_ARR_TYPE, mtype)) { + } else if (JniUtil.isTypes(STRUCT_INT_ARR_TYPE, mtype)) { javaReturnCode += "int[] "; nativeReturnCode += "/*none_ptr*/ "; - } else if (Util.isTypes(STRUCT_BYTE_ARR_TYPE, mtype)) { + } else if (JniUtil.isTypes(STRUCT_BYTE_ARR_TYPE, mtype)) { javaReturnCode += "byte[] "; nativeReturnCode += "/*none_ptr*/ "; } else if (mtype.equals("void")) { diff --git a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Nanovg_java_2_c.java b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Nanovg_java_2_c.java index a20857ed..ea02ab99 100644 --- a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Nanovg_java_2_c.java +++ b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Nanovg_java_2_c.java @@ -15,9 +15,9 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -import static org.mini.jnibuilder.Util.isConstPointer; -import static org.mini.jnibuilder.Util.isPointer; -import static org.mini.jnibuilder.Util.isTypes; +import static org.mini.jnibuilder.JniUtil.isConstPointer; +import static org.mini.jnibuilder.JniUtil.isPointer; +import static org.mini.jnibuilder.JniUtil.isTypes; /** * @@ -219,7 +219,7 @@ void buildC() { returnCode = nativeReurnType + " _re_val = "; String entryType = ""; entryType = nativeReurnType;//计算实体字节数,不能算指针大小 - if (Util.isStruct(nativeReurnType)) { + if (JniUtil.isStruct(nativeReurnType)) { pushCode += cType + "* _ptr_re_val = (" + cType + "*)&_re_val;\n"; pushCode += " s32 _struct_bytes = sizeof(_re_val);\n"; } else { @@ -347,7 +347,7 @@ void buildC() { varCode += " if(" + argvName + "){\n"; varCode += " ptr_" + argvName + " = " + argvName + "->arr_body" + ";\n"; varCode += " }\n"; - if (Util.isStruct(nativeArgvs[nativei])) { + if (JniUtil.isStruct(nativeArgvs[nativei])) { curArgvType = "*(" + nativeArgvs[nativei] + "*)"; } curArgvName = "(ptr_" + argvName + ")"; diff --git a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Nanovg_java_2_c_for_cc.java b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Nanovg_java_2_c_for_cc.java index 1a35dd36..1e01254c 100644 --- a/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Nanovg_java_2_c_for_cc.java +++ b/mobile/java/glfm_gui/GenJniCode/src/org/mini/jnibuilder/Nanovg_java_2_c_for_cc.java @@ -11,7 +11,7 @@ import java.util.logging.Level; import java.util.logging.Logger; -import static org.mini.jnibuilder.Util.*; +import static org.mini.jnibuilder.JniUtil.*; /** * @author gust @@ -194,7 +194,7 @@ void buildC() { returnCode = nativeReurnType + " _re_val = "; String entryType = ""; entryType = nativeReurnType;//计算实体字节数,不能算指针大小 - if (Util.isStruct(nativeReurnType)) { + if (JniUtil.isStruct(nativeReurnType)) { pushCode += cType + "* _ptr_re_val = (" + cType + "*)&_re_val;\n"; pushCode += " s32 _struct_bytes = sizeof(_re_val);\n"; } else { @@ -305,7 +305,7 @@ void buildC() { varCode += " __refer ptr_" + argvName + " = " + argvName + "?" + argvName + "->prop.as_s8_arr:NULL;\n"; curArgvName = "(ptr_" + argvName + ")"; - if (Util.isStruct(nativeArgvs[nativei])) { + if (JniUtil.isStruct(nativeArgvs[nativei])) { curArgvType = "*(" + nativeArgvs[nativei] + "*)"; } diff --git a/mobile/java/glfm_gui/glfm_gui.iml b/mobile/java/glfm_gui/glfm_gui.iml index 056f8821..56c79fb6 100644 --- a/mobile/java/glfm_gui/glfm_gui.iml +++ b/mobile/java/glfm_gui/glfm_gui.iml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/mobile/java/glfm_gui/src/main/java/org/mini/gl/GL.java b/mobile/java/glfm_gui/src/main/java/org/mini/gl/GL.java index 029110e2..fdc48b7d 100644 --- a/mobile/java/glfm_gui/src/main/java/org/mini/gl/GL.java +++ b/mobile/java/glfm_gui/src/main/java/org/mini/gl/GL.java @@ -627,6 +627,7 @@ public class GL { public static final int GL_ES_VERSION_3_0 = 1; //public static native int gladLoadGLES2Loader();// //int + public static native long get_gl_proc(String namez);//const char* //GLint64 public static native void glActiveTexture(int ptexture); //GLenum, //void public static native void glAttachShader(int pprogram, int pshader); //GLuint,GLuint, //void public static native void glBindAttribLocation(int pprogram, int pindex, byte[] pname); //GLuint,GLuint,const GLchar*, //void From 221f948d4c6a6cec5ff52bc5a303677b040bca0c Mon Sep 17 00:00:00 2001 From: Gust Date: Sat, 6 Dec 2025 01:48:14 +0800 Subject: [PATCH 6/7] remove ltalloc --- minijvm/c/jvm/garbage.c | 4 +- minijvm/c/jvm/jvm_util.c | 4 +- minijvm/c/utils/d_type.h | 20 +- minijvm/c/utils/ltalloc.c | 1343 ------------------------------------- minijvm/c/utils/ltalloc.h | 17 - 5 files changed, 5 insertions(+), 1383 deletions(-) delete mode 100644 minijvm/c/utils/ltalloc.c delete mode 100644 minijvm/c/utils/ltalloc.h diff --git a/minijvm/c/jvm/garbage.c b/minijvm/c/jvm/garbage.c index b3cfb321..ed825942 100644 --- a/minijvm/c/jvm/garbage.c +++ b/minijvm/c/jvm/garbage.c @@ -6,7 +6,7 @@ #if __JVM_LTALLOC__ -#include "ltalloc.h" + #endif @@ -583,7 +583,7 @@ s64 _garbage_collect(GcCollector *collector) { collector->obj_heap_size -= mem_free; spin_unlock(&collector->lock); #if __JVM_LTALLOC__ - ltsqueeze(0); + #endif #if _JVM_DEBUG_LOG_LEVEL > 1 s64 time_gc = currentTimeMillis() - time; diff --git a/minijvm/c/jvm/jvm_util.c b/minijvm/c/jvm/jvm_util.c index f0372d4f..49e93aa9 100644 --- a/minijvm/c/jvm/jvm_util.c +++ b/minijvm/c/jvm/jvm_util.c @@ -14,7 +14,7 @@ #if __JVM_LTALLOC__ -#include "ltalloc.h" + #endif @@ -792,7 +792,7 @@ s32 jthread_run(void *para) { jvm_printf("[INFO]thread over %llx , return %d , spent : %lld\n", (s64) (intptr_t) jthread, ret, spent); #endif #if __JVM_LTALLOC__ - ltonthreadexit(); + #endif thrd_exit(ret); return ret; diff --git a/minijvm/c/utils/d_type.h b/minijvm/c/utils/d_type.h index 9ab322e6..72e9ab6f 100644 --- a/minijvm/c/utils/d_type.h +++ b/minijvm/c/utils/d_type.h @@ -76,9 +76,7 @@ #if 1 #else #define __JVM_LTALLOC__ 1 - #if __JVM_LTALLOC__ - #include "ltalloc.h" - #endif + #endif #if __JVM_OS_MINGW__ || __JVM_OS_CYGWIN__ || __JVM_OS_VS__ @@ -116,22 +114,6 @@ typedef void *__returnaddress; //======================= memory manage ============================= #if __JVM_LTALLOC__ -static inline void *jvm_calloc(u32 size) { - return ltcalloc(size, 1); -} - -static inline void *jvm_malloc(u32 size) { - return ltmalloc(size); -} - -static inline void jvm_free(void *ptr) { - ltfree(ptr); -} - -static inline void *jvm_realloc(void *pPtr, u32 size) { - return ltrealloc(pPtr, size); - -} #else diff --git a/minijvm/c/utils/ltalloc.c b/minijvm/c/utils/ltalloc.c deleted file mode 100644 index cd99b2ce..00000000 --- a/minijvm/c/utils/ltalloc.c +++ /dev/null @@ -1,1343 +0,0 @@ -/* -Copyright (c) 2013, Alexander Tretyak -Copyright (c) 2015, r-lyeh -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of the author nor the names of its -contributors may be used to endorse or promote products derived -from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - Note: The latest version of this memory allocator obtainable at - http://ltalloc.googlecode.com/hg/ltalloc.cc - - Project URL: http://code.google.com/p/ltalloc -*/ - - -#if __JVM_LTALLOC__ - - - -#define LTALLOC_VERSION "2.0.2" /* (2019/04/18) - new LTALLOC_OVERFLOW_DETECTION directive -#define LTALLOC_VERSION "2.0.1" // (2018/07/09) - fix android (arm) build -#define LTALLOC_VERSION "2.0.0" // (2015/06/16) - ltcalloc(), ltmsize(), ltrealloc(), ltmemalign(), LTALLOC_AUTO_GC_INTERVAL -#define LTALLOC_VERSION "1.0.0" // (2015/06/16) - standard STL allocator provided [see ltalloc.hpp file](ltalloc.hpp) -#define LTALLOC_VERSION "0.0.0" // (2013/xx/xx) - fork from public repository */ - -// Optional user config file. Can be used to override the customizable constants and the platform specific macros. -#ifdef LTALLOC_USER_CONFIG -#include LTALLOC_USER_CONFIG -#endif - -#ifdef __cplusplus -#include -#define CPPCODE(code) code -#else -#define CPPCODE(code) -#endif - -////////////////////////////////////////////////////////////////////////// -// Customizable constants - -// Define to disable the override of the new operator (enabled by default if compiling this file in c++). -//#define LTALLOC_DISABLE_OPERATOR_NEW_OVERRIDE - -// Define to disable the use of exceptions (enabled by default if compiling this file in c++). -//#define LTALLOC_DISABLE_EXCEPTIONS -#if defined(__cplusplus) && !defined(LTALLOC_DISABLE_EXCEPTIONS) -# define CPPCODE_EXCEPTION(code) code -#else -# define CPPCODE_EXCEPTION(code) -#endif - -// Define to enable an automatic call to ltsqueeze approximately every X calls (1000 by default). The call is made during ltrealloc() -#ifdef LTALLOC_AUTO_GC_INTERVAL -# if LTALLOC_AUTO_GC_INTERVAL <= 0 -# undef LTALLOC_AUTO_GC_INTERVAL -# define LTALLOC_AUTO_GC_INTERVAL 1000 -# endif -#endif - -// Determines how accurately size classes are spaced (i.e. when = 0, allocation requests are rounded up to the nearest -// power of two (2^n), when = 1, rounded to 2^n, or (2^n)*1.5, when = 2, rounded to 2^n, (2^n)*1.25, (2^n)*1.5, or -// (2^n)*1.75, and so on); this parameter have direct influence on memory fragmentation - bigger values lead to reducing -// internal fragmentation (which can be approximately estimated as pow(0.5, VALUE)*100%), but at the same time -// increasing external fragmentation. -#ifndef LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO -#define LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO 2 -#endif - -// Size of chunk (basic allocation unit for all allocations of size <= MAX_BLOCK_SIZE); must be a power of two (as well -// as all following parameters), also should not be less than allocation granularity on Windows (which is always 64K by -// design of NT kernel). -#ifndef LTALLOC_CHUNK_SIZE -#define LTALLOC_CHUNK_SIZE (64 * 1024) -#endif - -// Maximum number of blocks to move between a thread cache and a central cache in one shot. -#ifndef LTALLOC_MAX_NUM_OF_BLOCKS_IN_BATCH -#define LTALLOC_MAX_NUM_OF_BLOCKS_IN_BATCH 256 -#endif - -// Maximum total size of blocks to move between a thread cache and a central cache in one shot (corresponds to half size -// of thread cache of each size class) -#ifndef LTALLOC_MAX_BATCH_SIZE -#define LTALLOC_MAX_BATCH_SIZE (64 * 1024) -#endif - -// Requesting memory of any size greater than this value will lead to direct call of system virtual memory allocation -// routine). -#ifndef LTALLOC_MAX_BLOCK_SIZE -#define LTALLOC_MAX_BLOCK_SIZE LTALLOC_CHUNK_SIZE -#endif - -////////////////////////////////////////////////////////////////////////// -// Platform-specific stuff - -// Assert macro. -#ifndef LTALLOC_ASSERT -#include -#define LTALLOC_ASSERT(cond) assert(cond) -#endif - -// Size of a cache line. -#ifndef LTALLOC_CACHE_LINE_SIZE -#define LTALLOC_CACHE_LINE_SIZE 64 -#endif - -// Defined to 1 when compiling in 64 bits mode (.ie pointers are 64 bits). -#ifndef LTALLOC_64BITS -#ifdef __GNUC__ -# define __STDC_LIMIT_MACROS -# include -# define LTALLOC_64BITS (UINTPTR_MAX == UINT64_MAX) -#elif _MSC_VER -# if defined(_WIN64) -# define LTALLOC_64BITS 1 -# else -# define LTALLOC_64BITS 0 -# endif -#else -# error LTALLOC_64BITS not defined. -#endif -#endif - -// Allows to declare an aligned variable or struct. Equivalent to c++11 alignas keyword. -#ifndef LTALLOC_ALIGNAS -#ifdef __GNUC__ -# define LTALLOC_ALIGNAS(a) __attribute__((aligned(a))) -#elif _MSC_VER -# define LTALLOC_ALIGNAS(a) __declspec(align(a)) -#else -# error LTALLOC_ALIGNAS not implemented. -#endif -#endif - -// Allows to declare a thread local variable. Equivalent to c++11 thread_local keyworkd. -#ifndef LTALLOC_THREAD_LOCAL -#ifdef __GNUC__ -# define LTALLOC_THREAD_LOCAL __thread -#elif _MSC_VER -# define LTALLOC_THREAD_LOCAL __declspec(thread) -#else -# error LTALLOC_THREAD_LOCAL not implemented. -#endif -#endif - -// Tells the compiler not to inline a function. -#ifndef LTALLOC_NOINLINE -#ifdef __GNUC__ -# define LTALLOC_NOINLINE __attribute__((noinline)) -#elif _MSC_VER -# define LTALLOC_NOINLINE __declspec(noinline) -#else -# define LTALLOC_NOINLINE -#endif -#endif - -// Hints to tell the compiler if a condition is likely or unlikely to be true. -#if defined(LTALLOC_LIKELY) || defined(LTALLOC_UNLIKELY) -#if !defined(LTALLOC_LIKELY) || !defined(LTALLOC_UNLIKELY) || !defined(LTALLOC_SPINLOCK_RELEASE) -# error LTALLOC_LIKELY and LTALLOC_UNLIKELY should either both be provided, or both left undefined. -#endif -#else -#if defined __GNUC__ || defined __INTEL_COMPILER -# define LTALLOC_LIKELY(x) __builtin_expect(!!(x), 1) -# define LTALLOC_UNLIKELY(x) __builtin_expect(!!(x), 0) -#else -# define LTALLOC_LIKELY(x) (x) -# define LTALLOC_UNLIKELY(x) (x) -#endif -#endif - -// LTALLOC_SPINLOCK_TYPE is the type of a spinlock. LTALLOC_SPINLOCK_ACQUIRE(lockptr) is used to lock it, -// LTALLOC_SPINLOCK_RELEASE(lockptr) to unlock it. -#if defined(LTALLOC_SPINLOCK_TYPE) || defined(LTALLOC_SPINLOCK_ACQUIRE) || defined(LTALLOC_SPINLOCK_RELEASE) -#if !defined(LTALLOC_SPINLOCK_TYPE) || !defined(LTALLOC_SPINLOCK_ACQUIRE) || !defined(LTALLOC_SPINLOCK_RELEASE) -# error LTALLOC_SPINLOCK_TYPE, LTALLOC_SPINLOCK_ACQUIRE and LTALLOC_SPINLOCK_RELEASE must either all be provided, or all left undefined. -#endif -#else - -#ifdef __GNUC__ -# define CAS_LOCK(lock) __sync_lock_test_and_set(lock, 1) -# define LTALLOC_SPINLOCK_RELEASE(lock) __sync_lock_release(lock) -# ifdef __sparc__ -# define PAUSE __asm__ __volatile__("rd %%ccr, %%g0\n\t" ::: "memory") -# elif defined(__ppc__) || defined(_ARCH_PPC) || defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_POWER) -# define PAUSE __asm__ __volatile__("or 27,27,27") -# elif defined(__ANDROID__) -# include //for sched_yield -# define PAUSE sched_yield() -# else -# define PAUSE __asm__ __volatile__("pause" ::: "memory") -# endif -#elif _MSC_VER -# include -# define CAS_LOCK(lock) _InterlockedExchange((long*)lock, 1) -# define LTALLOC_SPINLOCK_RELEASE(lock) _InterlockedExchange((long*)lock, 0) -# define PAUSE _mm_pause() -#else -# error LTALLOC_SPINLOCK_* not implemented. -#endif - -static void spinlock_acquire(volatile int *lock) -{ - if (CAS_LOCK(lock)) - while (*lock || CAS_LOCK(lock)) - PAUSE; -} - -#define LTALLOC_SPINLOCK_TYPE volatile int -#define LTALLOC_SPINLOCK_ACQUIRE(lock) spinlock_acquire(lock) -#endif - -// Searches in reverse order (from most significant bit to least) for the firt bit set in v and writes its index into r. -#ifndef LTALLOC_BIT_SCAN_REVERSE -#ifdef __GNUC__ -# define LTALLOC_BIT_SCAN_REVERSE(r, v) r = CODE3264(__builtin_clz(v) ^ 31, __builtin_clzll(v) ^ 63)//x ^ 31 = 31 - x, but gcc does not optimize 31 - __builtin_clz(x) to bsr(x), but generates 31 - (bsr(x) ^ 31) -#elif _MSC_VER -# include -# define LTALLOC_BIT_SCAN_REVERSE(r, v) CODE3264(_BitScanReverse, _BitScanReverse64)((unsigned long*)&r, v) -#else -# error LTALLOC_BIT_SCAN_REVERSE must be implemented for ltalloc to work. -#endif -#endif - -#if LTALLOC_64BITS -#define CODE3264(c32, c64) c64 -#else -#define CODE3264(c32, c64) c32 -#endif - -typedef char CODE3264_check[sizeof(void*) == CODE3264(4, 8) ? 1 : -1]; - -#ifndef LTALLOC_CANARY_TYPE -#define LTALLOC_CANARY_TYPE unsigned int -#endif - -#ifndef LTALLOC_CANARY_SIZE -#define LTALLOC_CANARY_SIZE (sizeof(LTALLOC_CANARY_TYPE)) -#endif - -#ifndef LTALLOC_CANARY -#define LTALLOC_CANARY 0xFDFDFDFD -#endif - -// LTALLOC_VMALLOC(size) allocates a size bytes of virtual memory. Returns 0 if allocation fails. The allocated memory is zeroed. -// LTALLOC_VMFREE(p, size) frees a previously allocated virtual memory. -// LTALLOC_VMALLOC_MIN_SIZE() returns the minimum size allocatable by LTALLOC_VMALLOC. -#if defined(LTALLOC_VMALLOC) || defined(LTALLOC_VMFREE) || defined(LTALLOC_VMALLOC_MIN_SIZE) -#if !defined(LTALLOC_VMALLOC) || !defined(LTALLOC_VMFREE) || !defined(LTALLOC_VMALLOC_MIN_SIZE) -# error LTALLOC_VMALLOC, LTALLOC_VMFREE and LTALLOC_VMALLOC_MIN_SIZE must either all be provided, or all left undefined. -#endif - -#else - -#ifdef _WIN32 - -#define WIN32_LEAN_AND_MEAN -#include - -static size_t get_alloc_granularity() -{ - static DWORD allocationGranularity = 0; - if (!allocationGranularity) { - SYSTEM_INFO si; - GetSystemInfo(&si); - allocationGranularity = si.dwAllocationGranularity; - } - return allocationGranularity; -} - -#define LTALLOC_VMALLOC(size) VirtualAlloc(NULL, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE) -#define LTALLOC_VMFREE(p, size) VirtualFree(p, 0, MEM_RELEASE) -#define LTALLOC_VMALLOC_MIN_SIZE() get_alloc_granularity() - -#else - -#ifndef LTALLOC_HAS_VMSIZE -#define LTALLOC_HAS_VMSIZE 0 -#endif - -#include -#include - -#include "ltalloc.h" - -static size_t page_size() -{ - LTALLOC_ASSERT((uintptr_t)MAP_FAILED+1 == 0);//have to use dynamic check somewhere, because some gcc versions (e.g. 4.4.5) won't compile typedef char MAP_FAILED_value_static_check[(uintptr_t)MAP_FAILED+1 == 0 ? 1 : -1]; - static size_t pagesize = 0; - if (!pagesize) pagesize = sysconf(_SC_PAGE_SIZE);//assuming that writing of size_t value is atomic, so this can be done safely in different simultaneously running threads - return pagesize; -} - -#define LTALLOC_VMALLOC(size) (void*)(((uintptr_t)mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0)+1)&~1)//with the conversion of MAP_FAILED to 0 -#define LTALLOC_VMFREE(p, size) munmap(p, size) -#define LTALLOC_VMALLOC_MIN_SIZE() page_size() - -#endif - -#endif - -// LTALLOC_VMSIZE(p) [OPTIONAL] returns the size of the corresponding virtual memory allocation. Define LTALLOC_HAS_VMSIZE to 0 if unavailable. -#ifdef LTALLOC_HAS_VMSIZE -#if LTALLOC_HAS_VMSIZE && !defined(LTALLOC_VMSIZE) -# error If LTALLOC_HAS_VMSIZE is defined to 1, an implementation of LTALLOC_VMSIZE must be provided. -#endif -#if LTALLOC_HAS_VMSIZE == 0 -# undef LTALLOC_VMSIZE -#endif -#else - -#ifdef _WIN32 -#define LTALLOC_HAS_VMSIZE 1 - -#define WIN32_LEAN_AND_MEAN -#include - -static size_t get_alloc_size(void *p) -{ - MEMORY_BASIC_INFORMATION mi; - VirtualQuery(p, &mi, sizeof(mi)); - return mi.RegionSize; -} - -#define LTALLOC_VMSIZE(p) get_alloc_size(p) - -#else -#define LTALLOC_HAS_VMSIZE 0 -#endif -#endif - -// LTALLOC_VMALLOC_ALIGNED(alignment, size) [OPTIONAL] allocates virtual memory with a certain alignment. -// If this macro is not defined, ltalloc implements a fallback involving calling VMALLOC potentially several times. -// If the target platform has an API for aligned virtual memory allocation, it may be more efficient to implemnt this macro with it. -#ifndef LTALLOC_VMALLOC_ALIGNED - -#ifdef _WIN32 - -#define WIN32_LEAN_AND_MEAN -#include - -static void *sys_aligned_alloc(size_t alignment, size_t size) -{ - void *p = VirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);//optimistically try mapping precisely the right amount before falling back to the slow method - LTALLOC_ASSERT(!(alignment & (alignment - 1)) && "alignment must be a power of two"); - if ((uintptr_t)p & (alignment - 1)/* && p != MAP_FAILED*/) - { - VirtualFree(p, 0, MEM_RELEASE); - static DWORD allocationGranularity = 0; - if (!allocationGranularity) { - SYSTEM_INFO si; - GetSystemInfo(&si); - allocationGranularity = si.dwAllocationGranularity; - } - if ((uintptr_t)p < 16 * 1024 * 1024)//fill "bubbles" (reserve unaligned regions) at the beginning of virtual address space, otherwise there will be always falling back to the slow method - VirtualAlloc(p, alignment - ((uintptr_t)p & (alignment - 1)), MEM_RESERVE, PAGE_NOACCESS); - do - { - p = VirtualAlloc(NULL, size + alignment - allocationGranularity, MEM_RESERVE, PAGE_NOACCESS); - if (p == NULL) return NULL; - VirtualFree(p, 0, MEM_RELEASE);//unfortunately, WinAPI doesn't support release a part of allocated region, so release a whole region - p = VirtualAlloc((void*)(((uintptr_t)p + (alignment - 1)) & ~(alignment - 1)), size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); - } while (p == NULL); - } - return p; -} - -#else - -static void *sys_aligned_alloc(size_t alignment, size_t size) -{ - void *p = LTALLOC_VMALLOC(size);//optimistically try mapping precisely the right amount before falling back to the slow method - LTALLOC_ASSERT(!(alignment & (alignment - 1)) && "alignment must be a power of two"); - if ((uintptr_t)p & (alignment - 1)) - { - LTALLOC_VMFREE(p, size); - p = LTALLOC_VMALLOC(size + alignment - LTALLOC_VMALLOC_MIN_SIZE()); - if (p) - { - uintptr_t ap = ((uintptr_t)p + (alignment - 1)) & ~(alignment - 1); - uintptr_t diff = ap - (uintptr_t)p; - if (diff) LTALLOC_VMFREE(p, diff); - diff = alignment - LTALLOC_VMALLOC_MIN_SIZE() - diff; - LTALLOC_ASSERT((intptr_t)diff >= 0); - if (diff) LTALLOC_VMFREE((void*)(ap + size), diff); - return (void*)ap; - } - } - - return p; -} -#endif - -#define LTALLOC_VMALLOC_ALIGNED(alignment, size) sys_aligned_alloc(alignment, size) -#endif - -// Define to 1 to enable an automatic call to release_thread_cache() when a thread exits. This function must be called -// to make sure no memory is leaked when a thread exits. If not supported by the current platform, it will cause a -// compilation error. In this case, define to 0 and call ltonthreadexit() manually before a thread exits. -#ifndef LTALLOC_AUTO_RELEASE_THREAD_CACHE -#define LTALLOC_AUTO_RELEASE_THREAD_CACHE 1 -#endif - -#if LTALLOC_AUTO_RELEASE_THREAD_CACHE -static void release_thread_cache(void*); -#ifdef __GNUC__ -#include -#pragma weak pthread_once -#pragma weak pthread_key_create -#pragma weak pthread_setspecific -static pthread_key_t pthread_key; -static pthread_once_t init_once = PTHREAD_ONCE_INIT; -static void init_pthread_key() { pthread_key_create(&pthread_key, release_thread_cache); } -static LTALLOC_THREAD_LOCAL int thread_initialized = 0; -static void init_pthread_destructor()//must be called only when some block placed into a thread cache's free list -{ - if (LTALLOC_UNLIKELY(!thread_initialized)) - { - thread_initialized = 1; - if (pthread_once) - { - pthread_once(&init_once, init_pthread_key); - pthread_setspecific(pthread_key, (void*)1);//set nonzero value to force calling of release_thread_cache() on thread terminate - } - } -} -#elif defined(_WIN32) -static void NTAPI on_tls_callback(PVOID h, DWORD reason, PVOID pv) { h; pv; if (reason == DLL_THREAD_DETACH) release_thread_cache(0); } -#pragma comment(linker, "/INCLUDE:" CODE3264("_","") "p_thread_callback_ltalloc") -#pragma const_seg(".CRT$XLL") -extern CPPCODE("C") const PIMAGE_TLS_CALLBACK p_thread_callback_ltalloc = on_tls_callback; -#pragma const_seg() -#define init_pthread_destructor() -#else -#error No automatic solution is implemented for this platform, you have to call ltonthreadexit() manually when a thread exits. -#endif -#else -#define init_pthread_destructor() -#endif - -// End of platform-specific stuff -////////////////////////////////////////////////////////////////////////// - -#include //for memset - -#define likely(x) LTALLOC_LIKELY(x) -#define unlikely(x) LTALLOC_UNLIKELY(x) -#define BSR(r,v) LTALLOC_BIT_SCAN_REVERSE(r, v) -#define SPINLOCK_ACQUIRE(lock) LTALLOC_SPINLOCK_ACQUIRE(lock) -#define SPINLOCK_RELEASE(lock) LTALLOC_SPINLOCK_RELEASE(lock) - -#define CHUNK_SIZE LTALLOC_CHUNK_SIZE -#define CACHE_LINE_SIZE LTALLOC_CACHE_LINE_SIZE -#define MAX_NUM_OF_BLOCKS_IN_BATCH LTALLOC_MAX_NUM_OF_BLOCKS_IN_BATCH -static const unsigned int MAX_BATCH_SIZE = LTALLOC_MAX_BATCH_SIZE; -static const unsigned int MAX_BLOCK_SIZE = LTALLOC_MAX_BLOCK_SIZE; - -#define MAX_BLOCK_SIZE (MAX_BLOCK_SIZE < CHUNK_SIZE - (CHUNK_SIZE >> (1 + LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO)) ? \ - MAX_BLOCK_SIZE : CHUNK_SIZE - (CHUNK_SIZE >> (1 + LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO))) -#define NUMBER_OF_SIZE_CLASSES ((sizeof(void*)*8 + 1) << LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO) - -// If LTALLOC_HAS_VMSIZE is not 1, fallback to storing allocation sizes in a ptrie. -// Note: it's also possible to force the ptrie function to be declared without actually being used in the allocator, for testing pruposes. -#ifndef LTALLOC_DECLARE_PTRIE -#define LTALLOC_DECLARE_PTRIE (LTALLOC_HAS_VMSIZE == 0) -#endif - -#if LTALLOC_DECLARE_PTRIE -typedef struct PTrieNode // Compressed radix tree (patricia trie) for storing sizes of system allocations -{ // This implementation have some specific properties: - uintptr_t keys[2]; // 1. There are no separate leaf nodes (with both null children), as leaf's value is stored directly in place of corresponding child node pointer. Least significant bit of that pointer used to determine its meaning (i.e., is it a value, or child node pointer). - struct PTrieNode *childNodes[2];// 2. Inserting a new element (key/value) into this tree require to create always an exactly one new node (and similarly for remove key/node operation). -} PTrieNode; // 3. Tree always contains just one node with null child (i.e. all but one nodes in any possible tree are always have two children). -#define PTRIE_NULL_NODE (PTrieNode*)(uintptr_t)1 -typedef struct PTrie -{ - PTrieNode *root; - PTrieNode *freeNodesList; - PTrieNode *newAllocatedPage; - LTALLOC_SPINLOCK_TYPE lock; -} PTrie; - -PTrie largeAllocSizes = { PTRIE_NULL_NODE, NULL, NULL }; - -static uintptr_t ptrie_lookup(PTrie *ptrie, uintptr_t key) -{ - SPINLOCK_ACQUIRE(&ptrie->lock); - PTrieNode *node = ptrie->root; - uintptr_t *lastKey = NULL; - while (!((uintptr_t)node & 1)) - { - int branch = (key >> (node->keys[0] & 0xFF)) & 1; - lastKey = &node->keys[branch]; - node = node->childNodes[branch]; - } - LTALLOC_ASSERT(lastKey && (*lastKey & ~0xFF) == key); - SPINLOCK_RELEASE(&ptrie->lock); - return (uintptr_t)node & ~1; -} - -static int ptrie_insert(PTrie *ptrie, uintptr_t key, uintptr_t value) -{ - SPINLOCK_ACQUIRE(&ptrie->lock); - // First get a new node. - // The nodes are stored in memory pages allocated for that single purpose. Free nodes are arranged in a free list - // (the first bytes in the node points to the next free page). The last bytes of the page are used to point to the - // next free page, in case several pages where allocated at the same time by different threads. - PTrieNode* newNode; - if (ptrie->freeNodesList) - ptrie->freeNodesList = *(PTrieNode**)(newNode = ptrie->freeNodesList); - else if (ptrie->newAllocatedPage) { - newNode = ptrie->newAllocatedPage; - if (!((uintptr_t)++ptrie->newAllocatedPage & (LTALLOC_VMALLOC_MIN_SIZE() - 1))) - ptrie->newAllocatedPage = ((PTrieNode**)ptrie->newAllocatedPage)[-1]; - } - else { - SPINLOCK_RELEASE(&ptrie->lock); - newNode = (PTrieNode*)LTALLOC_VMALLOC(LTALLOC_VMALLOC_MIN_SIZE()); - if (unlikely(!newNode)) { return 0; } - LTALLOC_ASSERT(((char**)((char*)newNode + LTALLOC_VMALLOC_MIN_SIZE()))[-1] == 0); - SPINLOCK_ACQUIRE(&ptrie->lock); - ((PTrieNode**)((char*)newNode + LTALLOC_VMALLOC_MIN_SIZE()))[-1] = ptrie->newAllocatedPage;//in case if other thread also have just allocated a new page - ptrie->newAllocatedPage = newNode + 1; - } - // Then, insert it. - PTrieNode **node = &ptrie->root, *n; - uintptr_t *prevKey = NULL, x, pkey; - unsigned int index, b; - LTALLOC_ASSERT(!((value & 1) | (key & 0xFF)));//check constraints for key/value - for (;;) - { - n = *node; - if (!((uintptr_t)n & 1))//not a leaf - { - int prefixEnd = n->keys[0] & 0xFF; - x = key ^ n->keys[0];// & ~0xFF; - if (!(x & (~(uintptr_t)1 << prefixEnd))) {//prefix matches, so go on - int branch = (key >> prefixEnd) & 1; - node = &n->childNodes[branch]; - prevKey = &n->keys[branch]; - } else {//insert a new node before current - pkey = n->keys[0] & ~0xFF; - break; - } - } else {//leaf - if (*node == PTRIE_NULL_NODE) { - *node = newNode; - newNode->keys[0] = key;//left prefixEnd = 0, so all following insertions will be before this node - newNode->childNodes[0] = (PTrieNode*)(value | 1); - newNode->childNodes[1] = PTRIE_NULL_NODE; - SPINLOCK_RELEASE(&ptrie->lock); - return 1; - } else { - pkey = *prevKey & ~0xFF; - x = key ^ pkey; - LTALLOC_ASSERT(x/*key != pkey*/ && "key already inserted"); - break; - } - } - } - BSR(index, x); - b = (key >> index) & 1; - newNode->keys[b] = key; - newNode->keys[b^1] = pkey; - newNode->keys[0] |= index; - newNode->childNodes[b] = (PTrieNode*)(value | 1); - newNode->childNodes[b^1] = n; - *node = newNode; - SPINLOCK_RELEASE(&ptrie->lock); - return 1; -} - -static uintptr_t ptrie_remove(PTrie *ptrie, uintptr_t key) -{ - PTrieNode **node = &ptrie->root; - uintptr_t *pkey = NULL; - LTALLOC_ASSERT(ptrie->root != PTRIE_NULL_NODE && "trie is empty!"); - for (;;) - { - PTrieNode *n = *node; - int branch = (key >> (n->keys[0] & 0xFF)) & 1; - PTrieNode *cn = n->childNodes[branch];//current child node - if ((uintptr_t)cn & 1)//leaf - { - PTrieNode *other = n->childNodes[branch^1]; - LTALLOC_ASSERT((n->keys[branch] & ~0xFF) == key); - LTALLOC_ASSERT(cn != PTRIE_NULL_NODE && "node's key is probably broken"); - // if (other == PTRIE_NULL_NODE) *node = PTRIE_NULL_NODE; else//special handling for null child nodes is not necessary - if (((uintptr_t)other & 1) && other != PTRIE_NULL_NODE)//if other node is not a pointer - *pkey = (n->keys[branch^1] & ~0xFF) | ((*pkey) & 0xFF); - *node = other; - *(PTrieNode**)n = ptrie->freeNodesList; ptrie->freeNodesList = n;//free(n); - SPINLOCK_RELEASE(&ptrie->lock); - return (uintptr_t)cn & ~1; - } - pkey = &n->keys[branch]; - node = &n->childNodes[branch]; - } -} -#endif - -typedef struct FreeBlock -{ - struct FreeBlock *next, - *nextBatch;//in the central cache blocks are organized into batches to allow fast moving blocks from thread cache and back -} FreeBlock; - -typedef struct LTALLOC_ALIGNAS(CACHE_LINE_SIZE) ChunkBase//force sizeof(Chunk) = cache line size to avoid false sharing -{ - unsigned int sizeClass; -} Chunk; - -typedef struct LTALLOC_ALIGNAS(CACHE_LINE_SIZE) ChunkSm//chunk of smallest blocks of size = sizeof(void*) -{ - unsigned int sizeClass;//struct ChunkBase chunk; - struct ChunkSm *prev, *next; - int numBatches; -#define NUM_OF_BATCHES_IN_CHUNK_SM CHUNK_SIZE/(sizeof(void*)*MAX_NUM_OF_BLOCKS_IN_BATCH) - FreeBlock *batches[NUM_OF_BATCHES_IN_CHUNK_SM];//batches of blocks inside ChunkSm have to be stored separately (as smallest blocks of size = sizeof(void*) do not have enough space to store second pointer for the batch) -} ChunkSm; - -typedef struct LTALLOC_ALIGNAS(CACHE_LINE_SIZE)//align needed to prevent cache line sharing between adjacent classes accessed from different threads -{ - LTALLOC_SPINLOCK_TYPE lock; - unsigned int freeBlocksInLastChunk; - char *lastChunk;//Chunk or ChunkSm - union { - FreeBlock *firstBatch; - ChunkSm *chunkWithFreeBatches; - }; - FreeBlock *freeList;//short list of free blocks that for some reason are not organized into batches - unsigned int freeListSize;//should be less than batch size - uintptr_t minChunkAddr, maxChunkAddr; -} CentralCache; -static CentralCache centralCache[NUMBER_OF_SIZE_CLASSES];// = {{0}}; - -typedef struct -{ - FreeBlock *freeList; - FreeBlock *tempList;//intermediate list providing a hysteresis in order to avoid a corner case of too frequent moving free blocks to the central cache and back from - int counter;//number of blocks in freeList (used to determine when to move free blocks list to the central cache) -} ThreadCache; -static LTALLOC_THREAD_LOCAL ThreadCache threadCache[NUMBER_OF_SIZE_CLASSES];// = {{0}}; - -static struct -{ - LTALLOC_SPINLOCK_TYPE lock; - void *freeChunk; - size_t size; -} pad = {0, NULL, 0}; - -static CPPCODE(inline) unsigned int get_size_class(size_t size) -{ - unsigned int index; -#if _MSC_VER && LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO == 2 - static const unsigned char small_size_classes[256] = {//have to use a const array here, because MS compiler unfortunately does not evaluate _BitScanReverse with a constant argument at compile time (as gcc does for __builtin_clz) -#if CODE3264(1, 0) - 131, 4, 15, 17, 19, 20, 21, 22, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 -#else - 131, 15, 19, 21, 23, 24, 25, 26, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47 -#endif - }; - if (size < 256 * sizeof(void*) - (sizeof(void*)-1)) - return small_size_classes[(size + (sizeof(void*)-1)) / sizeof(void*)]; -#endif - - size = (size + (sizeof(void*)-1)) & ~(sizeof(void*)-1);//minimum block size is sizeof(void*), doing this is better than just "size = max(size, sizeof(void*))" - - BSR(index, (size-1)|1);//"|1" needed because result of BSR is undefined for zero input -#if LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO == 0 - return index; -#else - return (index<> (index-LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO)); -#endif -} - -static unsigned int class_to_size(unsigned int c) -{ -#if LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO == 0 - return 2 << c; -#else -#if LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO >= CODE3264(2, 3) - if (unlikely(c < (LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO<>LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO); - else -#endif - { - c -= (1<>LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO)-LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO); - } -#endif -} - -static unsigned int batch_size(unsigned int sizeClass)//calculates a number of blocks to move between a thread cache and a central cache in one shot -{ - return ((MAX_BATCH_SIZE-1) >> (sizeClass >> LTALLOC_SIZE_CLASSES_SUBPOWER_OF_TWO)) & (MAX_NUM_OF_BLOCKS_IN_BATCH-1); -} - -void check_block_next_fb(FreeBlock *fb) -{ -#ifdef LTALLOC_NEXT_POINTER_CHECK - LTALLOC_ASSERT(fb && fb->next != fb); -#endif -} - -void check_block_next_cs(ChunkSm *fb) -{ -#ifdef LTALLOC_NEXT_POINTER_CHECK - LTALLOC_ASSERT(fb && fb->next != fb); -#endif -} - -CPPCODE(template static) void *ltmalloc(size_t size); - -CPPCODE(template ) static void *fetch_from_central_cache(size_t size, ThreadCache *tc, unsigned int sizeClass) -{ - void *p; - if (likely(size-1u <= MAX_BLOCK_SIZE-1u))//<=> if (size <= MAX_BLOCK_SIZE && size != 0) - { - FreeBlock *fb = tc->tempList; - if (fb) - { - LTALLOC_ASSERT(tc->counter == (int)batch_size(sizeClass)+1); - tc->counter = 1; - tc->freeList = fb->next; - tc->tempList = NULL; - return fb; - } - - LTALLOC_ASSERT(tc->counter == 0 || tc->counter == (int)batch_size(sizeClass)+1); - tc->counter = 1; - - {CentralCache *cc = ¢ralCache[sizeClass]; - SPINLOCK_ACQUIRE(&cc->lock); - if (unlikely(!cc->firstBatch))//no free batch - {no_free_batch:{ - unsigned int batchSize = batch_size(sizeClass)+1; - - if (cc->freeList) - { - LTALLOC_ASSERT(cc->freeListSize); - if (likely(cc->freeListSize <= batchSize + 1)) - { - tc->counter = batchSize - cc->freeListSize + 1; - // batchSize = cc->freeListSize; - cc->freeListSize = 0; - fb = cc->freeList; - cc->freeList = NULL; - } - else - { - cc->freeListSize -= batchSize; - fb = cc->freeList; - {FreeBlock *b = cc->freeList; - while (--batchSize) b = b->next; - cc->freeList = b->next; - b->next = NULL;} - } - SPINLOCK_RELEASE(&cc->lock); - tc->freeList = fb->next; - init_pthread_destructor();//this call must be placed carefully to allow recursive memory allocation from pthread_key_create (in case when ltalloc replaces the system malloc) - return fb; - } - - {unsigned int blockSize = class_to_size(sizeClass); - if (cc->freeBlocksInLastChunk) - { - char *firstFree = cc->lastChunk; - LTALLOC_ASSERT(cc->lastChunk && cc->freeBlocksInLastChunk == (CHUNK_SIZE - ((uintptr_t)cc->lastChunk & (CHUNK_SIZE-1)))/blockSize); - if (cc->freeBlocksInLastChunk < batchSize) { - tc->counter = batchSize - cc->freeBlocksInLastChunk + 1; - batchSize = cc->freeBlocksInLastChunk; - } - cc->freeBlocksInLastChunk -= batchSize; - cc->lastChunk += blockSize * batchSize; - if (cc->freeBlocksInLastChunk == 0) { - LTALLOC_ASSERT(((uintptr_t)cc->lastChunk & (CHUNK_SIZE-1)) == 0); - cc->lastChunk = ((char**)cc->lastChunk)[-1]; - if (cc->lastChunk) - cc->freeBlocksInLastChunk = (CHUNK_SIZE - ((uintptr_t)cc->lastChunk & (CHUNK_SIZE-1)))/blockSize; - } - SPINLOCK_RELEASE(&cc->lock); - fb = (FreeBlock*)firstFree; - while (--batchSize) - { - firstFree = (char*)(((FreeBlock*)firstFree)->next = (FreeBlock*)(firstFree + blockSize)); - check_block_next_fb((FreeBlock*)firstFree); - } - ((FreeBlock*)firstFree)->next = NULL; - tc->freeList = fb->next; - init_pthread_destructor(); - return fb; - } - - //Allocate new chunk - SPINLOCK_RELEASE(&cc->lock);//release lock for a while - - SPINLOCK_ACQUIRE(&pad.lock); - if (pad.freeChunk) - { - p = pad.freeChunk; - pad.freeChunk = *(void**)p; - pad.size -= CHUNK_SIZE; - SPINLOCK_RELEASE(&pad.lock); - ((char**)((char*)p + CHUNK_SIZE))[-1] = 0; - } else { - SPINLOCK_RELEASE(&pad.lock); - p = LTALLOC_VMALLOC_ALIGNED(CHUNK_SIZE, CHUNK_SIZE); - if (unlikely(!p)) { CPPCODE_EXCEPTION(if (throw_) throw std::bad_alloc(); else) return NULL; } - } - -#define CHUNK_IS_SMALL unlikely(sizeClass < get_size_class(2*sizeof(void*))) - {unsigned int numBlocksInChunk = (CHUNK_SIZE - (CHUNK_IS_SMALL ? sizeof(ChunkSm) : sizeof(Chunk)))/blockSize; -#ifndef _WIN32 - //intptr_t sz = ((CHUNK_SIZE - numBlocksInChunk*blockSize) & ~(page_size()-1)) - page_size(); - //if (sz > 0) mprotect((char*)p + page_size(), sz, PROT_NONE);//munmap((char*)p + page_size(), sz);//to make possible unmapping, we need to be more careful when returning memory to the system, not simply VMFREE(firstFreeChunk, CHUNK_SIZE), so let there be just mprotect -#endif - LTALLOC_ASSERT(((char**)((char*)p + CHUNK_SIZE))[-1] == 0);//assume that allocated memory is always zero filled (on first access); it is better not to zero it explicitly because it will lead to allocation of physical page which may never needed otherwise - if (numBlocksInChunk < batchSize) { - tc->counter = batchSize - numBlocksInChunk + 1; - batchSize = numBlocksInChunk; - } - - //Prepare chunk - ((Chunk*)p)->sizeClass = sizeClass; - {char *firstFree = (char*)p + CHUNK_SIZE - numBlocksInChunk*blockSize;//blocks in chunk are located in such way to achieve a maximum possible alignment - fb = (FreeBlock*)firstFree; - {int n = batchSize; while (--n) - { - firstFree = (char*)(((FreeBlock*)firstFree)->next = (FreeBlock*)(firstFree + blockSize)); - check_block_next_fb((FreeBlock*)firstFree); - } - } - ((FreeBlock*)firstFree)->next = NULL; - firstFree += blockSize; - - SPINLOCK_ACQUIRE(&cc->lock); - if ((uintptr_t)p < cc->minChunkAddr || !cc->minChunkAddr) cc->minChunkAddr = (uintptr_t)p; - if ((uintptr_t)p > cc->maxChunkAddr ) cc->maxChunkAddr = (uintptr_t)p; - - if (CHUNK_IS_SMALL)//special handling for smallest blocks of size = sizeof(void*) - { - ChunkSm *cs = (ChunkSm*)p; - cs->numBatches = 0; - //Insert new chunk right after chunkWithFreeBatches - cs->prev = cc->chunkWithFreeBatches; - if (cc->chunkWithFreeBatches) { - { cs->next = cc->chunkWithFreeBatches->next; check_block_next_cs(cs); } - if (cc->chunkWithFreeBatches->next) cc->chunkWithFreeBatches->next->prev = cs; - cc->chunkWithFreeBatches->next = cs; check_block_next_cs(cc->chunkWithFreeBatches); - } else { - cs->next = NULL; - cc->chunkWithFreeBatches = cs; - } - } - - if (unlikely(cc->freeBlocksInLastChunk))//so happened that other thread have already allocated chunk for the same size class while the lock was released - { - //Hook pointer to the current lastChunk at the end of new chunk (another way is just put all blocks to cc->freeList which is much less effecient) - ((char**)(((uintptr_t)firstFree & ~(CHUNK_SIZE-1)) + CHUNK_SIZE))[-1] = cc->lastChunk; - } - cc->freeBlocksInLastChunk = numBlocksInChunk - batchSize; - cc->lastChunk = firstFree; - }}}}} - else { - if (!CHUNK_IS_SMALL)//smallest blocks of size = sizeof(void*) are handled specially - { - fb = cc->firstBatch; - cc->firstBatch = fb->nextBatch; - } - else//size of block = sizeof(void*) - { - ChunkSm *cs = cc->chunkWithFreeBatches; - if (unlikely(cs->numBatches == 0)) - { - if (unlikely(cs->prev == NULL)) goto no_free_batch; - cs = cc->chunkWithFreeBatches = cs->prev; - LTALLOC_ASSERT(cs->numBatches == NUM_OF_BATCHES_IN_CHUNK_SM); - } - fb = cs->batches[--cs->numBatches]; - } - } - SPINLOCK_RELEASE(&cc->lock);} - tc->freeList = fb->next; - init_pthread_destructor(); - return fb; - } - else//allocate block directly from the system - { - if (unlikely(size == 0)) return ltmalloc CPPCODE()(1);//return NULL;//doing this check here is better than on the top level - - size = (size + CHUNK_SIZE-1) & ~(CHUNK_SIZE-1); - p = LTALLOC_VMALLOC_ALIGNED(CHUNK_SIZE, size); -#if LTALLOC_HAS_VMSIZE == 0 - if (p) { - if (unlikely(!ptrie_insert(&largeAllocSizes, (uintptr_t)p, size))) - { - LTALLOC_VMFREE(p, size); - p = NULL; - } - } -#endif - CPPCODE_EXCEPTION(if (throw_) if (unlikely(!p)) throw std::bad_alloc();) - return p; - } -} - -CPPCODE(template static) void *ltmalloc(size_t size) -{ -#ifdef LTALLOC_OVERFLOW_DETECTION - size_t size_final = size + LTALLOC_CANARY_SIZE; -#else - size_t size_final = size; -#endif - - unsigned int sizeClass = get_size_class(size_final); - ThreadCache *tc = &threadCache[sizeClass]; - FreeBlock *fb = tc->freeList; - uintptr_t buffer = (uintptr_t)(intptr_t)NULL; -#ifdef LTALLOC_OVERFLOW_DETECTION - size_t size_chunk = class_to_size(sizeClass);; -#endif - if (likely(fb)) - { - tc->freeList = fb->next; - tc->counter++; - buffer = (uintptr_t)fb; - } - else - { - buffer = (uintptr_t)fetch_from_central_cache CPPCODE()(size_final, tc, sizeClass); -#ifdef LTALLOC_OVERFLOW_DETECTION - size_chunk = ltmsize((void*)buffer); -#endif - } - -#ifdef LTALLOC_OVERFLOW_DETECTION - *(LTALLOC_CANARY_TYPE*)(buffer + size_chunk - LTALLOC_CANARY_SIZE) = LTALLOC_CANARY; -#endif - - return (void*)buffer; -} -CPPCODE(extern "C" void *ltmalloc(size_t size) {return ltmalloc(size);})//for possible external usage - -static void add_batch_to_central_cache(CentralCache *cc, unsigned int sizeClass, FreeBlock *batch) -{ - if (!CHUNK_IS_SMALL) - { - batch->nextBatch = cc->firstBatch; - cc->firstBatch = batch; - } - else - { - ChunkSm *cs = cc->chunkWithFreeBatches; - if (unlikely(cs->numBatches == NUM_OF_BATCHES_IN_CHUNK_SM)) - { - cs = cc->chunkWithFreeBatches = cc->chunkWithFreeBatches->next; - LTALLOC_ASSERT(cs && cs->numBatches == 0); - } - cs->batches[cs->numBatches++] = batch; - } -} - -static LTALLOC_NOINLINE void move_to_central_cache(ThreadCache *tc, unsigned int sizeClass) -{ - init_pthread_destructor();//needed for cases when freed memory was allocated in the other thread and no alloc was called in this thread till its termination - - tc->counter = batch_size(sizeClass); - if (tc->tempList)//move temp list to the central cache - { - CentralCache *cc = ¢ralCache[sizeClass]; - SPINLOCK_ACQUIRE(&cc->lock); - add_batch_to_central_cache(cc, sizeClass, tc->tempList); - SPINLOCK_RELEASE(&cc->lock); - } -// else if (unlikely(!tc->freeList))//this is a first call (i.e. when counter = 0) - just initialization of counter needed -// { -// tc->counter--; -// return; -// } - - tc->tempList = tc->freeList; - tc->freeList = NULL; -} - -CPPCODE(extern "C") size_t ltmsize(void *p); -CPPCODE(extern "C") void ltfree(void *p) -{ -#ifdef LTALLOC_OVERFLOW_DETECTION - if (p) - { - size_t size = ltmsize(p); - LTALLOC_ASSERT(size >= LTALLOC_CANARY_SIZE); - size_t size_without_canary = size - LTALLOC_CANARY_SIZE; - - uintptr_t ptr = (uintptr_t )p; - ptr += size_without_canary; - LTALLOC_ASSERT("memory overflow detected!" && *(LTALLOC_CANARY_TYPE*)ptr == LTALLOC_CANARY); - } -#endif - - if (likely((uintptr_t)p & (CHUNK_SIZE-1))) - { - unsigned int sizeClass = ((Chunk*)((uintptr_t)p & ~(CHUNK_SIZE-1)))->sizeClass; - ThreadCache *tc = &threadCache[sizeClass]; - - if (unlikely(--tc->counter < 0)) - move_to_central_cache(tc, sizeClass); - - ((FreeBlock*)p)->next = tc->freeList; - check_block_next_fb((FreeBlock*)p); - tc->freeList = (FreeBlock*)p; - } - else - { - if (p == NULL) return; -#if LTALLOC_HAS_VMSIZE - // Note: on Windows, VirtualFree doesn't not need the size, but calling LTALLOC_VMSIZE does not cost anything since - // it gets removed during the expansion of LTALLOC_VMFREE. - LTALLOC_VMFREE(p, LTALLOC_VMSIZE(p)); -#else - size_t size = ptrie_remove(&largeAllocSizes, (uintptr_t)p); - LTALLOC_VMFREE(p, size); -#endif - } -} - -CPPCODE(extern "C") size_t ltmsize(void *p) -{ - if (likely((uintptr_t)p & (CHUNK_SIZE-1))) - { - return class_to_size(((Chunk*)((uintptr_t)p & ~(CHUNK_SIZE-1)))->sizeClass); - } - else - { - if (p == NULL) return 0; - -#if LTALLOC_HAS_VMSIZE - size_t size = LTALLOC_VMSIZE(p); -#else - size_t size = ptrie_lookup(&largeAllocSizes, (uintptr_t)p); -#endif - -#ifdef LTALLOC_OVERFLOW_DETECTION - size -= LTALLOC_CANARY_SIZE; -#endif - - return size; - } -} - -static void release_thread_cache(void *p) -{ - unsigned int sizeClass = 0; (void)p; - for (;sizeClass < NUMBER_OF_SIZE_CLASSES; sizeClass++) - { - ThreadCache *tc = &threadCache[sizeClass]; - if (tc->freeList || tc->tempList) - { - FreeBlock *tail = tc->freeList; - unsigned int freeListSize = 1; - CentralCache *cc = ¢ralCache[sizeClass]; - - if (tail) - while (tail->next)//search for end of list - tail = tail->next, freeListSize++; - - SPINLOCK_ACQUIRE(&cc->lock); - if (tc->tempList) - add_batch_to_central_cache(cc, sizeClass, tc->tempList); - if (tc->freeList) {//append tc->freeList to cc->freeList - tail->next = cc->freeList; - check_block_next_fb(tail); - cc->freeList = tc->freeList; - LTALLOC_ASSERT(freeListSize == batch_size(sizeClass)+1 - tc->counter); - cc->freeListSize += freeListSize; - } - SPINLOCK_RELEASE(&cc->lock); - - tc->freeList = NULL; - tc->tempList = NULL; - tc->counter = 0; - } - } -} - -CPPCODE(extern "C") void ltonthreadexit() -{ - release_thread_cache(0); -} - -CPPCODE(extern "C") void ltsqueeze(size_t padsz) -{ - unsigned int sizeClass = get_size_class(2*sizeof(void*));//skip small chunks because corresponding batches can not be efficiently detached from the central cache (if that becomes relevant, may be it worths to reimplement batches for small chunks from array to linked lists) - for (;sizeClass < NUMBER_OF_SIZE_CLASSES; sizeClass++) - { - CentralCache *cc = ¢ralCache[sizeClass]; - if (cc->maxChunkAddr - cc->minChunkAddr <= CHUNK_SIZE)//preliminary check without lock (assume that writing to minChunkAddr/maxChunkAddr is atomic) - continue; - - SPINLOCK_ACQUIRE(&cc->lock); - if (cc->maxChunkAddr - cc->minChunkAddr <= CHUNK_SIZE) {//quick check for theoretical possibility that at least one chunk is totally free - SPINLOCK_RELEASE(&cc->lock); - continue; - } - {uintptr_t minChunkAddr = cc->minChunkAddr; - size_t bufferSize = ((cc->maxChunkAddr - minChunkAddr) / CHUNK_SIZE + 1) * sizeof(short); - //Quickly detach all batches of the current size class from the central cache - unsigned int freeListSize = cc->freeListSize; - FreeBlock *firstBatch = cc->firstBatch, *freeList = cc->freeList; - cc->firstBatch = NULL; - cc->freeList = NULL; - cc->freeListSize = 0; - SPINLOCK_RELEASE(&cc->lock); - - //1. Find out chunks with only free blocks via a simple counting the number of free blocks in each chunk - {char buffer[32*1024];//enough for 1GB address space - unsigned short *inChunkFreeBlocks = (unsigned short*)(bufferSize <= sizeof(buffer) ? memset(buffer, 0, bufferSize) : LTALLOC_VMALLOC(bufferSize)); - unsigned int numBlocksInChunk = (CHUNK_SIZE - (/*CHUNK_IS_SMALL ? sizeof(ChunkSm) : */sizeof(Chunk)))/class_to_size(sizeClass); - FreeBlock **pbatch, *block, **pblock; - Chunk *firstFreeChunk = NULL; - LTALLOC_ASSERT(numBlocksInChunk < (1U<<(sizeof(short)*8)));//in case if CHUNK_SIZE is too big that total count of blocks in it doesn't fit at short type (...may be use static_assert instead?) - if (inChunkFreeBlocks)//consider VMALLOC can fail - { - for (pbatch = &firstBatch; *pbatch; pbatch = &(*pbatch)->nextBatch) - for (block = *pbatch; block; block = block->next) -#define FREE_BLOCK(block) \ - if (++inChunkFreeBlocks[((uintptr_t)block - minChunkAddr) / CHUNK_SIZE] == numBlocksInChunk)/*chunk is totally free*/\ - {\ - Chunk *chunk = (Chunk*)((uintptr_t)block & ~(CHUNK_SIZE-1));\ - LTALLOC_ASSERT(chunk->sizeClass == sizeClass);/*just in case check before overwriting this info*/\ - *(Chunk**)chunk = firstFreeChunk;/*put nextFreeChunk pointer right at the beginning of Chunk as there are always must be a space for one pointer before first memory block*/\ - firstFreeChunk = chunk;\ - } - FREE_BLOCK(block) - for (pblock = &freeList; *pblock; pblock = &(*pblock)->next) - FREE_BLOCK(*pblock) -#undef FREE_BLOCK - } - else { - for (pbatch = &firstBatch; *pbatch; pbatch = &(*pbatch)->nextBatch); - for (pblock = &freeList; *pblock; pblock = &(*pblock)->next); - } - - if (firstFreeChunk)//is anything to release - { - //2. Unlink all matching blocks from the corresponding free lists - FreeBlock *additionalBatchesList = NULL, *additionalBlocksList = NULL, **abatch = &additionalBatchesList, **ablock = &additionalBlocksList; - unsigned int additionalBlocksListSize = 0, batchSize = batch_size(sizeClass)+1; - for (pbatch = &firstBatch; *pbatch;) - { - for (block = *pbatch; block; block = block->next) - if (inChunkFreeBlocks[((uintptr_t)block - minChunkAddr) / CHUNK_SIZE] == numBlocksInChunk)//if at least one block belongs to a releasable chunk, then this batch should be handled specially - { - FreeBlock *nextBatch = (*pbatch)->nextBatch; - for (block = *pbatch; block;)//re-add blocks of not-for-release chunks and organize them into another batches' list (to join it with the main later) - if (inChunkFreeBlocks[((uintptr_t)block - minChunkAddr) / CHUNK_SIZE] != numBlocksInChunk)//skip matching-for-release blocks - { - *ablock = block; - do//this loop needed only to minimize memory write operations, otherwise a simpler approach could be used (like in the next loop below) - { - ablock = &block->next; - block = block->next; - if (++additionalBlocksListSize == batchSize) - { - abatch = &(*abatch = additionalBlocksList)->nextBatch; - *abatch = NULL; - *ablock = NULL; - ablock = &additionalBlocksList; - additionalBlocksList = NULL; - additionalBlocksListSize = 0; - break;//to force *ablock = block; for starting a new batch - } - } while (block && inChunkFreeBlocks[((uintptr_t)block - minChunkAddr) / CHUNK_SIZE] != numBlocksInChunk); - } - else - block = block->next; - *ablock = NULL; - *pbatch = nextBatch;//unlink batch - goto continue_; - } - pbatch = &(*pbatch)->nextBatch; -continue_:; - } - for (block = freeList; block;) - if (inChunkFreeBlocks[((uintptr_t)block - minChunkAddr) / CHUNK_SIZE] != numBlocksInChunk) - { - //*pblock = (*pblock)->next, freeListSize--;//unlink block - ablock = &(*ablock = block)->next; - block = block->next; - *ablock = NULL; - if (++additionalBlocksListSize == batchSize) - { - abatch = &(*abatch = additionalBlocksList)->nextBatch; - *abatch = NULL; - ablock = &additionalBlocksList; - additionalBlocksList = NULL; - additionalBlocksListSize = 0; - } - } - else - block = block->next; - //Add additional lists - *abatch = *pbatch; - *pbatch = additionalBatchesList; - pblock = ablock; - freeList = additionalBlocksList; - freeListSize = additionalBlocksListSize; - - //Return back all left not-for-release blocks to the central cache as quickly as possible (as other threads may want to allocate a new memory) -#define GIVE_LISTS_BACK_TO_CC \ - SPINLOCK_ACQUIRE(&cc->lock);\ - *pbatch = cc->firstBatch;\ - cc->firstBatch = firstBatch;\ - *pblock = cc->freeList;\ - cc->freeList = freeList;\ - cc->freeListSize += freeListSize;\ - SPINLOCK_RELEASE(&cc->lock);\ - if (bufferSize > sizeof(buffer)) LTALLOC_VMFREE(inChunkFreeBlocks, bufferSize);//this better to do before 3. as kernel is likely optimized for release of just allocated range - GIVE_LISTS_BACK_TO_CC - - if (padsz) - { - SPINLOCK_ACQUIRE(&pad.lock); - if (pad.size < padsz) - { - Chunk *first = firstFreeChunk, **c; - do//put off free chunks up to a specified pad size - { - c = (Chunk**)firstFreeChunk; - firstFreeChunk = *c; - pad.size += CHUNK_SIZE; - } while (pad.size < padsz && firstFreeChunk); - *c = (Chunk*)pad.freeChunk; - pad.freeChunk = first; - } - SPINLOCK_RELEASE(&pad.lock); - } - - //3. Return memory to the system - while (firstFreeChunk) - { - Chunk *nextFreeChunk = *(Chunk**)firstFreeChunk; - LTALLOC_VMFREE(firstFreeChunk, CHUNK_SIZE); - firstFreeChunk = nextFreeChunk; - } - } - else//nothing to release - just return batches back to the central cache - { - GIVE_LISTS_BACK_TO_CC -#undef GIVE_LISTS_BACK_TO_CC - }}} - } -} - -#if defined(__cplusplus) && !defined(LTALLOC_DISABLE_OPERATOR_NEW_OVERRIDE) -// C++11 deprecates dynamic exception specifications -#if __cplusplus >= 201103L -#define THROWS noexcept(false) -#else -#define THROWS throw(std::bad_alloc) -#endif - -void *operator new (size_t size) THROWS {return ltmalloc (size);} -void *operator new (size_t size, const std::nothrow_t&) throw() {return ltmalloc(size);} -void *operator new[](size_t size) THROWS {return ltmalloc (size);} -void *operator new[](size_t size, const std::nothrow_t&) throw() {return ltmalloc(size);} - -void operator delete (void* p) throw() {ltfree(p);} -void operator delete (void* p, const std::nothrow_t&) throw() {ltfree(p);} -void operator delete[](void* p) throw() {ltfree(p);} -void operator delete[](void* p, const std::nothrow_t&) throw() {ltfree(p);} -#endif - -/* @r-lyeh's { */ -#include - -CPPCODE(extern "C") void *ltcalloc(size_t elems, size_t size) { - size *= elems; - return memset( ltmalloc( size ), 0, size ); -} -CPPCODE(extern "C") void *ltmemalign( size_t align, size_t size ) { -#ifdef LTALLOC_OVERFLOW_DETECTION - size_t align_minus_one = align - 1; - void* p = ltmalloc(((size + LTALLOC_CANARY_SIZE + align_minus_one)&~align_minus_one) - LTALLOC_CANARY_SIZE); - LTALLOC_ASSERT(((uintptr_t)p % align) == 0); - return p; -#else - return --align, ltmalloc((size + align)&~align); -#endif -} -CPPCODE(extern "C") void *ltrealloc( void *ptr, size_t sz ) { - if( !ptr ) return ltmalloc( sz ); - if( !sz ) return ltfree( ptr ), (void *)0; - size_t osz = ltmsize( ptr ); - if( sz <= osz ) { - return ptr; - } - void *nptr = memcpy( ltmalloc(sz), ptr, osz ); - ltfree( ptr ); - -#ifdef LTALLOC_AUTO_GC_INTERVAL - /* this is kind of compromise; the following call number is to guarantee - that memory gets wiped out at least every 1,000 calls between consecutive - ltrealloc() calls (I am assuming frequency usage for regular ltrealloc() is - smaller than ltmalloc() or ltfree() too; so that's why the check is here) - - @r-lyeh */ - static LTALLOC_THREAD_LOCAL unsigned times = 0; - if( !((++times) % LTALLOC_AUTO_GC_INTERVAL) ) { - ltsqueeze(0); - } -#endif - - return nptr; -} - - -#endif -/* } */ diff --git a/minijvm/c/utils/ltalloc.h b/minijvm/c/utils/ltalloc.h deleted file mode 100644 index 5a0ed57d..00000000 --- a/minijvm/c/utils/ltalloc.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include /*a more portable std::size_t definition than stddef.h itself*/ -#ifdef __cplusplus -extern "C" { -#endif -void* ltmalloc(size_t); -void ltfree(void*); -void* ltrealloc(void*, size_t); -void* ltcalloc(size_t, size_t); -void* ltmemalign(size_t, size_t); -void ltsqueeze(size_t); /*return memory to system (see README.md)*/ -size_t ltmsize(void*); -void ltonthreadexit(); -#ifdef __cplusplus -} -#endif From f5f5b91196f627d5bd17c4c99106ca18a1db13a1 Mon Sep 17 00:00:00 2001 From: Gust Date: Sat, 6 Dec 2025 02:58:51 +0800 Subject: [PATCH 7/7] Update GuiScriptLib.java --- .../src/main/java/org/mini/layout/guilib/GuiScriptLib.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extlib/xgui/src/main/java/org/mini/layout/guilib/GuiScriptLib.java b/extlib/xgui/src/main/java/org/mini/layout/guilib/GuiScriptLib.java index 8d0e7b9b..88e9e206 100644 --- a/extlib/xgui/src/main/java/org/mini/layout/guilib/GuiScriptLib.java +++ b/extlib/xgui/src/main/java/org/mini/layout/guilib/GuiScriptLib.java @@ -164,8 +164,7 @@ public static void doCallback(GForm form, String callback, String para) { } if (gobj != null) { Interpreter inp = gobj.getInterpreter(); - inp.putGlobalVar("callbackPara", Interpreter.getCachedStr(para)); - inp.callSub(ss[1] + "(callbackPara)"); + inp.callSub(ss[1] + "(" + para + ")");//!!!此处不能改全局变量,因为有的地址用字符串拼接了多个参㶼 } } //System.out.println("[WARN]httpRequest callback no GContainer specified: " + callback);