mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 17:34:34 +00:00
Merge branch 'odin-lang:master' into haiku
This commit is contained in:
30
.github/workflows/nightly.yml
vendored
30
.github/workflows/nightly.yml
vendored
@@ -63,11 +63,13 @@ jobs:
|
||||
cp -r core dist
|
||||
cp -r vendor dist
|
||||
cp -r examples dist
|
||||
# Zipping so executable permissions are retained, see https://github.com/actions/upload-artifact/issues/38
|
||||
zip -r dist.zip dist
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: ubuntu_artifacts
|
||||
path: dist
|
||||
path: dist.zip
|
||||
build_macos:
|
||||
name: MacOS Build
|
||||
if: github.repository == 'odin-lang/Odin'
|
||||
@@ -76,15 +78,13 @@ jobs:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Download LLVM and setup PATH
|
||||
run: |
|
||||
brew install llvm@13
|
||||
brew install llvm@13 dylibbundler
|
||||
echo "/usr/local/opt/llvm@13/bin" >> $GITHUB_PATH
|
||||
TMP_PATH=$(xcrun --show-sdk-path)/user/include
|
||||
echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
|
||||
- name: build odin
|
||||
run: make nightly
|
||||
- name: Odin run
|
||||
run: ./odin run examples/demo
|
||||
- name: Copy artifacts
|
||||
- name: Bundle
|
||||
run: |
|
||||
mkdir dist
|
||||
cp odin dist
|
||||
@@ -94,11 +94,16 @@ jobs:
|
||||
cp -r core dist
|
||||
cp -r vendor dist
|
||||
cp -r examples dist
|
||||
dylibbundler -b -x dist/odin -d dist/libs -od -p @executable_path/libs
|
||||
# Zipping so executable permissions are retained, see https://github.com/actions/upload-artifact/issues/38
|
||||
zip -r dist.zip dist
|
||||
- name: Odin run
|
||||
run: ./dist/odin run examples/demo
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: macos_artifacts
|
||||
path: dist
|
||||
path: dist.zip
|
||||
build_macos_arm:
|
||||
name: MacOS ARM Build
|
||||
if: github.repository == 'odin-lang/Odin'
|
||||
@@ -107,15 +112,13 @@ jobs:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Download LLVM and setup PATH
|
||||
run: |
|
||||
brew install llvm@13
|
||||
brew install llvm@13 dylibbundler
|
||||
echo "/opt/homebrew/opt/llvm@13/bin" >> $GITHUB_PATH
|
||||
TMP_PATH=$(xcrun --show-sdk-path)/user/include
|
||||
echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
|
||||
- name: build odin
|
||||
run: make nightly
|
||||
- name: Odin run
|
||||
run: ./odin run examples/demo
|
||||
- name: Copy artifacts
|
||||
- name: Bundle
|
||||
run: |
|
||||
mkdir dist
|
||||
cp odin dist
|
||||
@@ -125,11 +128,16 @@ jobs:
|
||||
cp -r core dist
|
||||
cp -r vendor dist
|
||||
cp -r examples dist
|
||||
dylibbundler -b -x dist/odin -d dist/libs -od -p @executable_path/libs
|
||||
# Zipping so executable permissions are retained, see https://github.com/actions/upload-artifact/issues/38
|
||||
zip -r dist.zip dist
|
||||
- name: Odin run
|
||||
run: ./dist/odin run examples/demo
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: macos_arm_artifacts
|
||||
path: dist
|
||||
path: dist.zip
|
||||
upload_b2:
|
||||
runs-on: [ubuntu-latest]
|
||||
needs: [build_windows, build_macos, build_macos_arm, build_ubuntu]
|
||||
|
||||
@@ -280,7 +280,7 @@ Typeid_Kind :: enum u8 {
|
||||
|
||||
// NOTE(bill): only the ones that are needed (not all types)
|
||||
// This will be set by the compiler
|
||||
type_table: []Type_Info
|
||||
type_table: []^Type_Info
|
||||
|
||||
args__: []cstring
|
||||
|
||||
@@ -609,7 +609,7 @@ __type_info_of :: proc "contextless" (id: typeid) -> ^Type_Info #no_bounds_check
|
||||
if n < 0 || n >= len(type_table) {
|
||||
n = 0
|
||||
}
|
||||
return &type_table[n]
|
||||
return type_table[n]
|
||||
}
|
||||
|
||||
when !ODIN_NO_RTTI {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package os
|
||||
|
||||
import "base:runtime"
|
||||
import "core:mem"
|
||||
import "core:strconv"
|
||||
import "core:unicode/utf8"
|
||||
|
||||
@@ -160,13 +159,11 @@ write_entire_file :: proc(name: string, data: []byte, truncate := true) -> (succ
|
||||
}
|
||||
|
||||
write_ptr :: proc(fd: Handle, data: rawptr, len: int) -> (int, Errno) {
|
||||
s := transmute([]byte)mem.Raw_Slice{data, len}
|
||||
return write(fd, s)
|
||||
return write(fd, ([^]byte)(data)[:len])
|
||||
}
|
||||
|
||||
read_ptr :: proc(fd: Handle, data: rawptr, len: int) -> (int, Errno) {
|
||||
s := transmute([]byte)mem.Raw_Slice{data, len}
|
||||
return read(fd, s)
|
||||
return read(fd, ([^]byte)(data)[:len])
|
||||
}
|
||||
|
||||
heap_allocator_proc :: runtime.heap_allocator_proc
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package os2
|
||||
|
||||
import "core:mem"
|
||||
import "base:runtime"
|
||||
import "core:strconv"
|
||||
import "core:unicode/utf8"
|
||||
@@ -64,13 +63,11 @@ write_encoded_rune :: proc(f: ^File, r: rune) -> (n: int, err: Error) {
|
||||
|
||||
|
||||
write_ptr :: proc(f: ^File, data: rawptr, len: int) -> (n: int, err: Error) {
|
||||
s := transmute([]byte)mem.Raw_Slice{data, len}
|
||||
return write(f, s)
|
||||
return write(f, ([^]byte)(data)[:len])
|
||||
}
|
||||
|
||||
read_ptr :: proc(f: ^File, data: rawptr, len: int) -> (n: int, err: Error) {
|
||||
s := transmute([]byte)mem.Raw_Slice{data, len}
|
||||
return read(f, s)
|
||||
return read(f, ([^]byte)(data)[:len])
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1053,41 +1053,6 @@ struct lbGlobalVariable {
|
||||
bool is_initialized;
|
||||
};
|
||||
|
||||
gb_internal lbProcedure *lb_create_startup_type_info(lbModule *m) {
|
||||
if (build_context.no_rtti) {
|
||||
return nullptr;
|
||||
}
|
||||
Type *proc_type = alloc_type_proc(nullptr, nullptr, 0, nullptr, 0, false, ProcCC_CDecl);
|
||||
|
||||
lbProcedure *p = lb_create_dummy_procedure(m, str_lit(LB_STARTUP_TYPE_INFO_PROC_NAME), proc_type);
|
||||
p->is_startup = true;
|
||||
LLVMSetLinkage(p->value, LLVMInternalLinkage);
|
||||
|
||||
lb_add_attribute_to_proc(m, p->value, "nounwind");
|
||||
// lb_add_attribute_to_proc(p->module, p->value, "mustprogress");
|
||||
// lb_add_attribute_to_proc(p->module, p->value, "nofree");
|
||||
// lb_add_attribute_to_proc(p->module, p->value, "norecurse");
|
||||
// lb_add_attribute_to_proc(p->module, p->value, "nosync");
|
||||
// lb_add_attribute_to_proc(p->module, p->value, "willreturn");
|
||||
if (!LB_USE_GIANT_PACKED_STRUCT) {
|
||||
lb_add_attribute_to_proc(m, p->value, "optnone");
|
||||
lb_add_attribute_to_proc(m, p->value, "noinline");
|
||||
}
|
||||
|
||||
lb_begin_procedure_body(p);
|
||||
|
||||
lb_setup_type_info_data(p);
|
||||
|
||||
lb_end_procedure_body(p);
|
||||
|
||||
if (!m->debug_builder && LLVMVerifyFunction(p->value, LLVMReturnStatusAction)) {
|
||||
gb_printf_err("LLVM CODE GEN FAILED FOR PROCEDURE: %s\n", "main");
|
||||
LLVMDumpValue(p->value);
|
||||
gb_printf_err("\n\n\n\n");
|
||||
LLVMVerifyFunction(p->value, LLVMAbortProcessAction);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
gb_internal lbProcedure *lb_create_objc_names(lbModule *main_module) {
|
||||
if (build_context.metrics.os != TargetOs_darwin) {
|
||||
@@ -1129,7 +1094,7 @@ gb_internal void lb_finalize_objc_names(lbProcedure *p) {
|
||||
lb_end_procedure_body(p);
|
||||
}
|
||||
|
||||
gb_internal lbProcedure *lb_create_startup_runtime(lbModule *main_module, lbProcedure *startup_type_info, lbProcedure *objc_names, Array<lbGlobalVariable> &global_variables) { // Startup Runtime
|
||||
gb_internal lbProcedure *lb_create_startup_runtime(lbModule *main_module, lbProcedure *objc_names, Array<lbGlobalVariable> &global_variables) { // Startup Runtime
|
||||
Type *proc_type = alloc_type_proc(nullptr, nullptr, 0, nullptr, 0, false, ProcCC_Odin);
|
||||
|
||||
lbProcedure *p = lb_create_dummy_procedure(main_module, str_lit(LB_STARTUP_RUNTIME_PROC_NAME), proc_type);
|
||||
@@ -1139,9 +1104,7 @@ gb_internal lbProcedure *lb_create_startup_runtime(lbModule *main_module, lbProc
|
||||
|
||||
lb_begin_procedure_body(p);
|
||||
|
||||
if (startup_type_info) {
|
||||
LLVMBuildCall2(p->builder, lb_type_internal_for_procedures_raw(main_module, startup_type_info->type), startup_type_info->value, nullptr, 0, "");
|
||||
}
|
||||
lb_setup_type_info_data(main_module);
|
||||
|
||||
if (objc_names) {
|
||||
LLVMBuildCall2(p->builder, lb_type_internal_for_procedures_raw(main_module, objc_names->type), objc_names->value, nullptr, 0, "");
|
||||
@@ -1201,7 +1164,7 @@ gb_internal lbProcedure *lb_create_startup_runtime(lbModule *main_module, lbProc
|
||||
lbValue data = lb_emit_struct_ep(p, var.var, 0);
|
||||
lbValue ti = lb_emit_struct_ep(p, var.var, 1);
|
||||
lb_emit_store(p, data, lb_emit_conv(p, gp, t_rawptr));
|
||||
lb_emit_store(p, ti, lb_type_info(main_module, var_type));
|
||||
lb_emit_store(p, ti, lb_type_info(p, var_type));
|
||||
} else {
|
||||
LLVMTypeRef vt = llvm_addr_type(p->module, var.var);
|
||||
lbValue src0 = lb_emit_conv(p, var.init, t);
|
||||
@@ -1426,7 +1389,6 @@ gb_internal WORKER_TASK_PROC(lb_llvm_function_pass_per_module) {
|
||||
}
|
||||
|
||||
if (m == &m->gen->default_module) {
|
||||
lb_llvm_function_pass_per_function_internal(m, m->gen->startup_type_info);
|
||||
lb_llvm_function_pass_per_function_internal(m, m->gen->startup_runtime);
|
||||
lb_llvm_function_pass_per_function_internal(m, m->gen->cleanup_runtime);
|
||||
lb_llvm_function_pass_per_function_internal(m, m->gen->objc_names);
|
||||
@@ -2691,17 +2653,19 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
|
||||
|
||||
{ // Add type info data
|
||||
isize max_type_info_count = info->minimum_dependency_type_info_set.count+1;
|
||||
Type *t = alloc_type_array(t_type_info, max_type_info_count);
|
||||
Type *t = alloc_type_array(t_type_info_ptr, max_type_info_count);
|
||||
|
||||
// IMPORTANT NOTE(bill): As LLVM does not have a union type, an array of unions cannot be initialized
|
||||
// at compile time without cheating in some way. This means to emulate an array of unions is to use
|
||||
// a giant packed struct of "corrected" data types.
|
||||
|
||||
LLVMTypeRef internal_llvm_type = lb_setup_type_info_data_internal_type(m, max_type_info_count);
|
||||
LLVMTypeRef internal_llvm_type = lb_type(m, t);
|
||||
|
||||
LLVMValueRef g = LLVMAddGlobal(m->mod, internal_llvm_type, LB_TYPE_INFO_DATA_NAME);
|
||||
LLVMSetInitializer(g, LLVMConstNull(internal_llvm_type));
|
||||
LLVMSetLinkage(g, USE_SEPARATE_MODULES ? LLVMExternalLinkage : LLVMInternalLinkage);
|
||||
LLVMSetUnnamedAddress(g, LLVMGlobalUnnamedAddr);
|
||||
LLVMSetGlobalConstant(g, /*true*/false);
|
||||
|
||||
lbValue value = {};
|
||||
value.value = g;
|
||||
@@ -2710,11 +2674,6 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
|
||||
lb_global_type_info_data_entity = alloc_entity_variable(nullptr, make_token_ident(LB_TYPE_INFO_DATA_NAME), t, EntityState_Resolved);
|
||||
lb_add_entity(m, lb_global_type_info_data_entity, value);
|
||||
|
||||
if (LB_USE_GIANT_PACKED_STRUCT) {
|
||||
LLVMSetLinkage(g, LLVMPrivateLinkage);
|
||||
LLVMSetUnnamedAddress(g, LLVMGlobalUnnamedAddr);
|
||||
LLVMSetGlobalConstant(g, /*true*/false);
|
||||
}
|
||||
}
|
||||
{ // Type info member buffer
|
||||
// NOTE(bill): Removes need for heap allocation by making it global memory
|
||||
@@ -2750,9 +2709,7 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
|
||||
LLVMValueRef g = LLVMAddGlobal(m->mod, lb_type(m, t), name);
|
||||
LLVMSetInitializer(g, LLVMConstNull(lb_type(m, t)));
|
||||
LLVMSetLinkage(g, LLVMInternalLinkage);
|
||||
if (LB_USE_GIANT_PACKED_STRUCT) {
|
||||
lb_make_global_private_const(g);
|
||||
}
|
||||
lb_make_global_private_const(g);
|
||||
return lb_addr({g, alloc_type_pointer(t)});
|
||||
};
|
||||
|
||||
@@ -2921,12 +2878,11 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
|
||||
}
|
||||
}
|
||||
|
||||
TIME_SECTION("LLVM Runtime Type Information Creation");
|
||||
gen->startup_type_info = lb_create_startup_type_info(default_module);
|
||||
TIME_SECTION("LLVM Runtime Objective-C Names Creation");
|
||||
gen->objc_names = lb_create_objc_names(default_module);
|
||||
|
||||
TIME_SECTION("LLVM Runtime Startup Creation (Global Variables & @(init))");
|
||||
gen->startup_runtime = lb_create_startup_runtime(default_module, gen->startup_type_info, gen->objc_names, global_variables);
|
||||
gen->startup_runtime = lb_create_startup_runtime(default_module, gen->objc_names, global_variables);
|
||||
|
||||
TIME_SECTION("LLVM Runtime Cleanup Creation & @(fini)");
|
||||
gen->cleanup_runtime = lb_create_cleanup_runtime(default_module);
|
||||
|
||||
@@ -225,7 +225,6 @@ struct lbGenerator : LinkerData {
|
||||
std::atomic<u32> global_array_index;
|
||||
std::atomic<u32> global_generated_index;
|
||||
|
||||
lbProcedure *startup_type_info;
|
||||
lbProcedure *startup_runtime;
|
||||
lbProcedure *cleanup_runtime;
|
||||
lbProcedure *objc_names;
|
||||
@@ -486,7 +485,7 @@ gb_internal lbValue lb_emit_mul_add(lbProcedure *p, lbValue a, lbValue b, lbValu
|
||||
|
||||
gb_internal void lb_fill_slice(lbProcedure *p, lbAddr const &slice, lbValue base_elem, lbValue len);
|
||||
|
||||
gb_internal lbValue lb_type_info(lbModule *m, Type *type);
|
||||
gb_internal lbValue lb_type_info(lbProcedure *p, Type *type);
|
||||
|
||||
gb_internal lbValue lb_find_or_add_entity_string(lbModule *m, String const &str);
|
||||
gb_internal lbValue lb_generate_anonymous_proc_lit(lbModule *m, String const &prefix_name, Ast *expr, lbProcedure *parent = nullptr);
|
||||
@@ -587,7 +586,6 @@ gb_internal LLVMTypeRef llvm_array_type(LLVMTypeRef ElementType, uint64_t Elemen
|
||||
|
||||
#define LB_STARTUP_RUNTIME_PROC_NAME "__$startup_runtime"
|
||||
#define LB_CLEANUP_RUNTIME_PROC_NAME "__$cleanup_runtime"
|
||||
#define LB_STARTUP_TYPE_INFO_PROC_NAME "__$startup_type_info"
|
||||
#define LB_TYPE_INFO_DATA_NAME "__$type_info_data"
|
||||
#define LB_TYPE_INFO_TYPES_NAME "__$type_info_types_data"
|
||||
#define LB_TYPE_INFO_NAMES_NAME "__$type_info_names_data"
|
||||
|
||||
@@ -1755,7 +1755,7 @@ gb_internal lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValu
|
||||
TypeAndValue tav = type_and_value_of_expr(arg);
|
||||
if (tav.mode == Addressing_Type) {
|
||||
Type *t = default_type(type_of_expr(arg));
|
||||
return lb_type_info(p->module, t);
|
||||
return lb_type_info(p, t);
|
||||
}
|
||||
GB_ASSERT(is_type_typeid(tav.type));
|
||||
|
||||
@@ -3361,9 +3361,9 @@ gb_internal lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr) {
|
||||
for (Ast *var_arg : variadic) {
|
||||
lbValue arg = lb_build_expr(p, var_arg);
|
||||
if (is_type_any(elem_type)) {
|
||||
array_add(&args, lb_emit_conv(p, arg, default_type(arg.type)));
|
||||
array_add(&args, lb_emit_conv(p, arg, c_vararg_promote_type(default_type(arg.type))));
|
||||
} else {
|
||||
array_add(&args, lb_emit_conv(p, arg, elem_type));
|
||||
array_add(&args, lb_emit_conv(p, arg, c_vararg_promote_type(elem_type)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -748,7 +748,7 @@ gb_internal void lb_build_range_enum(lbProcedure *p, Type *enum_type, Type *val_
|
||||
i64 enum_count = t->Enum.fields.count;
|
||||
lbValue max_count = lb_const_int(m, t_int, enum_count);
|
||||
|
||||
lbValue ti = lb_type_info(m, t);
|
||||
lbValue ti = lb_type_info(p, t);
|
||||
lbValue variant = lb_emit_struct_ep(p, ti, 4);
|
||||
lbValue eti_ptr = lb_emit_conv(p, variant, t_type_info_enum_ptr);
|
||||
lbValue values = lb_emit_load(p, lb_emit_struct_ep(p, eti_ptr, 2));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -365,6 +365,9 @@ enum Typeid_Kind : u8 {
|
||||
Typeid_Matrix,
|
||||
Typeid_SoaPointer,
|
||||
Typeid_Bit_Field,
|
||||
|
||||
Typeid__COUNT
|
||||
|
||||
};
|
||||
|
||||
// IMPORTANT NOTE(bill): This must match the same as the in core.odin
|
||||
@@ -562,6 +565,14 @@ gb_global Type *t_f16 = &basic_types[Basic_f16];
|
||||
gb_global Type *t_f32 = &basic_types[Basic_f32];
|
||||
gb_global Type *t_f64 = &basic_types[Basic_f64];
|
||||
|
||||
gb_global Type *t_f16be = &basic_types[Basic_f16be];
|
||||
gb_global Type *t_f32be = &basic_types[Basic_f32be];
|
||||
gb_global Type *t_f64be = &basic_types[Basic_f64be];
|
||||
|
||||
gb_global Type *t_f16le = &basic_types[Basic_f16le];
|
||||
gb_global Type *t_f32le = &basic_types[Basic_f32le];
|
||||
gb_global Type *t_f64le = &basic_types[Basic_f64le];
|
||||
|
||||
gb_global Type *t_complex32 = &basic_types[Basic_complex32];
|
||||
gb_global Type *t_complex64 = &basic_types[Basic_complex64];
|
||||
gb_global Type *t_complex128 = &basic_types[Basic_complex128];
|
||||
@@ -2819,6 +2830,49 @@ gb_internal Type *default_type(Type *type) {
|
||||
return type;
|
||||
}
|
||||
|
||||
// See https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions
|
||||
gb_internal Type *c_vararg_promote_type(Type *type) {
|
||||
GB_ASSERT(type != nullptr);
|
||||
|
||||
Type *core = core_type(type);
|
||||
|
||||
if (core->kind == Type_BitSet) {
|
||||
core = core_type(bit_set_to_int(core));
|
||||
}
|
||||
|
||||
if (core->kind == Type_Basic) {
|
||||
switch (core->Basic.kind) {
|
||||
case Basic_f32:
|
||||
case Basic_UntypedFloat:
|
||||
return t_f64;
|
||||
case Basic_f32le:
|
||||
return t_f64le;
|
||||
case Basic_f32be:
|
||||
return t_f64be;
|
||||
|
||||
case Basic_UntypedBool:
|
||||
case Basic_bool:
|
||||
case Basic_b8:
|
||||
case Basic_b16:
|
||||
case Basic_i8:
|
||||
case Basic_i16:
|
||||
case Basic_u8:
|
||||
case Basic_u16:
|
||||
return t_i32;
|
||||
|
||||
case Basic_i16le:
|
||||
case Basic_u16le:
|
||||
return t_i32le;
|
||||
|
||||
case Basic_i16be:
|
||||
case Basic_u16be:
|
||||
return t_i32be;
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
gb_internal bool union_variant_index_types_equal(Type *v, Type *vt) {
|
||||
if (are_types_identical(v, vt)) {
|
||||
return true;
|
||||
|
||||
61
vendor/egl/egl.odin
vendored
Normal file
61
vendor/egl/egl.odin
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
//+build linux
|
||||
package egl
|
||||
|
||||
NativeDisplayType :: distinct rawptr
|
||||
NativeWindowType :: distinct rawptr
|
||||
Display :: distinct rawptr
|
||||
Surface :: distinct rawptr
|
||||
Config :: distinct rawptr
|
||||
Context :: distinct rawptr
|
||||
|
||||
NO_DISPLAY :: Display(uintptr(0))
|
||||
NO_CONTEXT :: Context(uintptr(0))
|
||||
NO_SURFACE :: Surface(uintptr(0))
|
||||
|
||||
CONTEXT_OPENGL_CORE_PROFILE_BIT :: 0x00000001
|
||||
WINDOW_BIT :: 0x0004
|
||||
OPENGL_BIT :: 0x0008
|
||||
|
||||
BLUE_SIZE :: 0x3022
|
||||
GREEN_SIZE :: 0x3023
|
||||
RED_SIZE :: 0x3024
|
||||
DEPTH_SIZE :: 0x3025
|
||||
STENCIL_SIZE :: 0x3026
|
||||
|
||||
SURFACE_TYPE :: 0x3033
|
||||
NONE :: 0x3038
|
||||
COLOR_BUFFER_TYPE :: 0x303F
|
||||
RENDERABLE_TYPE :: 0x3040
|
||||
CONFORMANT :: 0x3042
|
||||
|
||||
BACK_BUFFER :: 0x3084
|
||||
RENDER_BUFFER :: 0x3086
|
||||
GL_COLORSPACE_SRGB :: 0x3089
|
||||
GL_COLORSPACE_LINEAR :: 0x308A
|
||||
RGB_BUFFER :: 0x308E
|
||||
GL_COLORSPACE :: 0x309D
|
||||
|
||||
CONTEXT_MAJOR_VERSION :: 0x3098
|
||||
CONTEXT_MINOR_VERSION :: 0x30FB
|
||||
CONTEXT_OPENGL_PROFILE_MASK :: 0x30FD
|
||||
|
||||
OPENGL_API :: 0x30A2
|
||||
|
||||
foreign import egl "system:EGL"
|
||||
@(default_calling_convention="c", link_prefix="egl")
|
||||
foreign egl {
|
||||
GetDisplay :: proc(display: NativeDisplayType) -> Display ---
|
||||
Initialize :: proc(display: Display, major: ^i32, minor: ^i32) -> i32 ---
|
||||
BindAPI :: proc(api: u32) -> i32 ---
|
||||
ChooseConfig :: proc(display: Display, attrib_list: ^i32, configs: ^Context, config_size: i32, num_config: ^i32) -> i32 ---
|
||||
CreateWindowSurface :: proc(display: Display, config: Config, native_window: NativeWindowType, attrib_list: ^i32) -> Surface ---
|
||||
CreateContext :: proc(display: Display, config: Config, share_context: Context, attrib_list: ^i32) -> Context ---
|
||||
MakeCurrent :: proc(display: Display, draw: Surface, read: Surface, ctx: Context) -> i32 ---
|
||||
SwapInterval :: proc(display: Display, interval: i32) -> i32 ---
|
||||
SwapBuffers :: proc(display: Display, surface: Surface) -> i32 ---
|
||||
GetProcAddress :: proc(name: cstring) -> rawptr ---
|
||||
}
|
||||
|
||||
gl_set_proc_address :: proc(p: rawptr, name: cstring) {
|
||||
(^rawptr)(p)^ = GetProcAddress(name)
|
||||
}
|
||||
5
vendor/glfw/wrapper.odin
vendored
5
vendor/glfw/wrapper.odin
vendored
@@ -149,8 +149,9 @@ WaitEvents :: glfw.WaitEvents
|
||||
WaitEventsTimeout :: glfw.WaitEventsTimeout
|
||||
PostEmptyEvent :: glfw.PostEmptyEvent
|
||||
|
||||
GetInputMode :: glfw.GetInputMode
|
||||
SetInputMode :: glfw.SetInputMode
|
||||
RawMouseMotionSupported :: glfw.RawMouseMotionSupported
|
||||
GetInputMode :: glfw.GetInputMode
|
||||
SetInputMode :: glfw.SetInputMode
|
||||
|
||||
GetMouseButton :: glfw.GetMouseButton
|
||||
GetCursorPos :: proc "c" (window: WindowHandle) -> (xpos, ypos: f64) {
|
||||
|
||||
13
vendor/raylib/raylib.odin
vendored
13
vendor/raylib/raylib.odin
vendored
@@ -318,11 +318,11 @@ GlyphInfo :: struct {
|
||||
// Font type, includes texture and charSet array data
|
||||
Font :: struct {
|
||||
baseSize: c.int, // Base size (default chars height)
|
||||
charsCount: c.int, // Number of characters
|
||||
charsPadding: c.int, // Padding around the chars
|
||||
glyphCount: c.int, // Number of characters
|
||||
glyphPadding: c.int, // Padding around the chars
|
||||
texture: Texture2D, // Characters texture atlas
|
||||
recs: [^]Rectangle, // Characters rectangles in texture
|
||||
chars: [^]GlyphInfo, // Characters info data
|
||||
glyphs: [^]GlyphInfo, // Characters info data
|
||||
}
|
||||
|
||||
// Camera type, defines a camera position/orientation in 3d space
|
||||
@@ -404,7 +404,7 @@ BoneInfo :: struct {
|
||||
}
|
||||
|
||||
// Model type
|
||||
Model :: struct {
|
||||
Model :: struct #align(align_of(uintptr)) {
|
||||
transform: Matrix, // Local transform matrix
|
||||
|
||||
meshCount: c.int, // Number of meshes
|
||||
@@ -425,7 +425,7 @@ ModelAnimation :: struct {
|
||||
frameCount: c.int, // Number of animation frames
|
||||
bones: [^]BoneInfo, // Bones information (skeleton)
|
||||
framePoses: [^][^]Transform, // Poses array by frame
|
||||
name: [32]u8, // Animation name
|
||||
name: [32]byte, // Animation name
|
||||
}
|
||||
|
||||
// Ray type (useful for raycast)
|
||||
@@ -491,7 +491,6 @@ VrDeviceInfo :: struct {
|
||||
vResolution: c.int, // Vertical resolution in pixels
|
||||
hScreenSize: f32, // Horizontal size in meters
|
||||
vScreenSize: f32, // Vertical size in meters
|
||||
vScreenCenter: f32, // Screen center in meters
|
||||
eyeToScreenDistance: f32, // Distance between eye and display in meters
|
||||
lensSeparationDistance: f32, // Lens separation distance in meters
|
||||
interpupillaryDistance: f32, // IPD (distance between pupils) in meters
|
||||
@@ -500,7 +499,7 @@ VrDeviceInfo :: struct {
|
||||
}
|
||||
|
||||
// VR Stereo rendering configuration for simulator
|
||||
VrStereoConfig :: struct {
|
||||
VrStereoConfig :: struct #align(4) {
|
||||
projection: [2]Matrix, // VR projection matrices (per eye)
|
||||
viewOffset: [2]Matrix, // VR view offset matrices (per eye)
|
||||
leftLensCenter: [2]f32, // VR left lens center
|
||||
|
||||
Reference in New Issue
Block a user