Merge branch 'odin-lang:master' into master

This commit is contained in:
Wes Hardee
2022-07-09 18:09:21 -05:00
committed by GitHub
21 changed files with 334 additions and 55 deletions

View File

@@ -325,9 +325,9 @@ ease :: proc "contextless" (type: Ease, p: $T) -> T
// in case type was invalid
return 0
}
Flux_Map :: struct($T: typeid) {
values: map[^T]Flux_Tween(T),
keys_to_be_deleted: [dynamic]^T,
}
Flux_Tween :: struct($T: typeid) {
@@ -353,15 +353,17 @@ Flux_Tween :: struct($T: typeid) {
}
// init flux map to a float type and a wanted cap
flux_init :: proc($T: typeid, cap := 8) -> Flux_Map(T) where intrinsics.type_is_float(T) {
flux_init :: proc($T: typeid, value_capacity := 8) -> Flux_Map(T) where intrinsics.type_is_float(T) {
return {
make(map[^T]Flux_Tween(T), cap),
values = make(map[^T]Flux_Tween(T), value_capacity),
keys_to_be_deleted = make([dynamic]^T, 0, value_capacity)
}
}
// delete map content
flux_destroy :: proc(flux: Flux_Map($T)) where intrinsics.type_is_float(T) {
delete(flux.values)
delete(flux.keys_to_be_deleted)
}
// clear map content, stops all animations
@@ -374,8 +376,8 @@ flux_clear :: proc(flux: ^Flux_Map($T)) where intrinsics.type_is_float(T) {
// return value can be used to set callbacks
flux_to :: proc(
flux: ^Flux_Map($T),
value: ^f32,
goal: f32,
value: ^T,
goal: T,
type: Ease = .Quadratic_Out,
duration: time.Duration = time.Second,
delay: f64 = 0,
@@ -413,6 +415,8 @@ flux_tween_init :: proc(tween: ^Flux_Tween($T), duration: time.Duration) where i
// calls callbacks in all stages, when they're filled
// deletes tween from the map after completion
flux_update :: proc(flux: ^Flux_Map($T), dt: f64) where intrinsics.type_is_float(T) {
clear(&flux.keys_to_be_deleted)
for key, tween in &flux.values {
delay_remainder := f64(0)
@@ -451,7 +455,8 @@ flux_update :: proc(flux: ^Flux_Map($T), dt: f64) where intrinsics.type_is_float
}
if tween.progress >= 1 {
delete_key(&flux.values, key)
// append keys to array that will be deleted after the loop
append(&flux.keys_to_be_deleted, key)
if tween.on_complete != nil {
tween.on_complete(flux, tween.data)
@@ -459,17 +464,24 @@ flux_update :: proc(flux: ^Flux_Map($T), dt: f64) where intrinsics.type_is_float
}
}
}
// loop through keys that should be deleted from the map
if len(flux.keys_to_be_deleted) != 0 {
for key in flux.keys_to_be_deleted {
delete_key(&flux.values, key)
}
}
}
// stop a specific key inside the map
// returns true when it successfully removed the key
flux_stop :: proc(flux: ^Flux_Map($T), key: ^T) -> bool where intrinsics.type_is_float(T) {
if key in flux.values {
delete_key(&flux.values, key)
return true
}
if key in flux.values {
delete_key(&flux.values, key)
return true
}
return false
return false
}
// returns the amount of time left for the tween animation, if the key exists in the map

View File

@@ -183,6 +183,7 @@ parse_file :: proc(p: ^Parser, file: ^ast.File) -> bool {
pd.name = pkg_name.text
pd.comment = p.line_comment
p.file.pkg_decl = pd
p.file.docs = docs
expect_semicolon(p, pd)

View File

@@ -384,21 +384,33 @@ set_current_directory :: proc(path: string) -> (err: Errno) {
change_directory :: proc(path: string) -> Errno {
change_directory :: proc(path: string) -> (err: Errno) {
wpath := win32.utf8_to_wstring(path, context.temp_allocator)
return Errno(win32.SetCurrentDirectoryW(wpath))
if !win32.SetCurrentDirectoryW(wpath) {
err = Errno(win32.GetLastError())
}
return
}
make_directory :: proc(path: string, mode: u32 = 0) -> Errno {
make_directory :: proc(path: string, mode: u32 = 0) -> (err: Errno) {
// Mode is unused on Windows, but is needed on *nix
wpath := win32.utf8_to_wstring(path, context.temp_allocator)
return Errno(win32.CreateDirectoryW(wpath, nil))
if !win32.CreateDirectoryW(wpath, nil) {
err = Errno(win32.GetLastError())
}
return
}
remove_directory :: proc(path: string) -> Errno {
remove_directory :: proc(path: string) -> (err: Errno) {
wpath := win32.utf8_to_wstring(path, context.temp_allocator)
return Errno(win32.RemoveDirectoryW(wpath))
if !win32.RemoveDirectoryW(wpath) {
err = Errno(win32.GetLastError())
}
return
}
@@ -464,23 +476,31 @@ fix_long_path :: proc(path: string) -> string {
}
link :: proc(old_name, new_name: string) -> Errno {
link :: proc(old_name, new_name: string) -> (err: Errno) {
n := win32.utf8_to_wstring(fix_long_path(new_name))
o := win32.utf8_to_wstring(fix_long_path(old_name))
return Errno(win32.CreateHardLinkW(n, o, nil))
}
unlink :: proc(path: string) -> Errno {
unlink :: proc(path: string) -> (err: Errno) {
wpath := win32.utf8_to_wstring(path, context.temp_allocator)
return Errno(win32.DeleteFileW(wpath))
if !win32.DeleteFileW(wpath) {
err = Errno(win32.GetLastError())
}
return
}
rename :: proc(old_path, new_path: string) -> Errno {
rename :: proc(old_path, new_path: string) -> (err: Errno) {
from := win32.utf8_to_wstring(old_path, context.temp_allocator)
to := win32.utf8_to_wstring(new_path, context.temp_allocator)
return Errno(win32.MoveFileExW(from, to, win32.MOVEFILE_REPLACE_EXISTING))
if !win32.MoveFileExW(from, to, win32.MOVEFILE_REPLACE_EXISTING) {
err = Errno(win32.GetLastError())
}
return
}

View File

@@ -267,6 +267,19 @@ type_table: []Type_Info
args__: []cstring
when ODIN_OS == .Windows {
// NOTE(Jeroen): If we're a Windows DLL, fwdReason will be populated.
// This tells a DLL if it's first loaded, about to be unloaded, or a thread is joining/exiting.
DLL_Forward_Reason :: enum u32 {
Process_Detach = 0, // About to unload DLL
Process_Attach = 1, // Entry point
Thread_Attach = 2,
Thread_Detach = 3,
}
dll_forward_reason: DLL_Forward_Reason
}
// IMPORTANT NOTE(bill): Must be in this order (as the compiler relies upon it)

View File

@@ -8,15 +8,19 @@ when ODIN_BUILD_MODE == .Dynamic {
@(link_name="DllMain", linkage="strong", require)
DllMain :: proc "stdcall" (hinstDLL: rawptr, fdwReason: u32, lpReserved: rawptr) -> b32 {
context = default_context()
switch fdwReason {
case 1: // DLL_PROCESS_ATTACH
// Populate Windows DLL-specific global
dll_forward_reason = DLL_Forward_Reason(fdwReason)
switch dll_forward_reason {
case .Process_Attach:
#force_no_inline _startup_runtime()
intrinsics.__entry_point()
case 0: // DLL_PROCESS_DETACH
case .Process_Detach:
#force_no_inline _cleanup_runtime()
case 2: // DLL_THREAD_ATTACH
case .Thread_Attach:
break
case 3: // DLL_THREAD_DETACH
case .Thread_Detach:
break
}
return true

View File

@@ -119,4 +119,13 @@ foreign advapi32 {
lpData: ^BYTE,
cbData: DWORD,
) -> LSTATUS ---
RegSetKeyValueW :: proc(
hKey: HKEY,
lpSubKey: LPCWSTR,
lpValueName: LPCWSTR,
dwType: DWORD,
lpData: LPCVOID,
cbData: DWORD,
) -> LSTATUS ---
}

View File

@@ -6,7 +6,7 @@ foreign import kernel32 "system:Kernel32.lib"
@(default_calling_convention="stdcall")
foreign kernel32 {
OutputDebugStringA :: proc(lpOutputString: LPCSTR) --- // The only A thing that is allowed
OutputDebugStringW :: proc(lpOutputString: LPCSTR) ---
OutputDebugStringW :: proc(lpOutputString: LPCWSTR) ---
ReadConsoleW :: proc(hConsoleInput: HANDLE,
lpBuffer: LPVOID,
@@ -101,7 +101,7 @@ foreign kernel32 {
GetExitCodeThread :: proc(thread: HANDLE, exit_code: ^DWORD) -> BOOL ---
TerminateThread :: proc(thread: HANDLE, exit_code: DWORD) -> BOOL ---
CreateSemaphoreW :: proc(attributes: LPSECURITY_ATTRIBUTES, initial_count, maximum_count: LONG, name: LPCSTR) -> HANDLE ---
CreateSemaphoreW :: proc(attributes: LPSECURITY_ATTRIBUTES, initial_count, maximum_count: LONG, name: LPCWSTR) -> HANDLE ---
ReleaseSemaphore :: proc(semaphore: HANDLE, release_count: LONG, previous_count: ^LONG) -> BOOL ---
CreateWaitableTimerW :: proc(

View File

@@ -196,15 +196,26 @@ OPEN_ALWAYS: DWORD : 4
OPEN_EXISTING: DWORD : 3
TRUNCATE_EXISTING: DWORD : 5
FILE_READ_DATA : DWORD : 0x00000001
FILE_LIST_DIRECTORY : DWORD : 0x00000001
FILE_WRITE_DATA : DWORD : 0x00000002
FILE_ADD_FILE : DWORD : 0x00000002
FILE_APPEND_DATA : DWORD : 0x00000004
FILE_ADD_SUBDIRECTORY : DWORD : 0x00000004
FILE_CREATE_PIPE_INSTANCE : DWORD : 0x00000004
FILE_READ_EA : DWORD : 0x00000008
FILE_WRITE_EA : DWORD : 0x00000010
FILE_EXECUTE : DWORD : 0x00000020
FILE_TRAVERSE : DWORD : 0x00000020
FILE_DELETE_CHILD : DWORD : 0x00000040
FILE_READ_ATTRIBUTES : DWORD : 0x00000080
FILE_WRITE_ATTRIBUTES : DWORD : 0x00000100
GENERIC_READ : DWORD : 0x80000000
GENERIC_WRITE : DWORD : 0x40000000
GENERIC_EXECUTE : DWORD : 0x20000000
GENERIC_ALL : DWORD : 0x10000000
FILE_WRITE_DATA: DWORD : 0x00000002
FILE_APPEND_DATA: DWORD : 0x00000004
FILE_WRITE_EA: DWORD : 0x00000010
FILE_WRITE_ATTRIBUTES: DWORD : 0x00000100
FILE_READ_ATTRIBUTES: DWORD : 0x000000080
GENERIC_READ: DWORD : 0x80000000
GENERIC_WRITE: DWORD : 0x40000000
FILE_GENERIC_WRITE: DWORD : STANDARD_RIGHTS_WRITE |
FILE_WRITE_DATA |
FILE_WRITE_ATTRIBUTES |
@@ -250,6 +261,9 @@ DIAGNOSTIC_REASON_SIMPLE_STRING :: 0x00000001
DIAGNOSTIC_REASON_DETAILED_STRING :: 0x00000002
DIAGNOSTIC_REASON_NOT_SPECIFIED :: 0x80000000
ENUM_CURRENT_SETTINGS : DWORD : 4294967295 // (DWORD)-1
ENUM_REGISTRY_SETTINGS : DWORD : 4294967294 // (DWORD)-2
// Defines for power request APIs
POWER_REQUEST_CONTEXT_VERSION :: DIAGNOSTIC_REASON_VERSION
@@ -633,6 +647,18 @@ ES_READONLY :: 0x0800
ES_WANTRETURN :: 0x1000
ES_NUMBER :: 0x2000
// Edit Control Notification Codes
EN_SETFOCUS :: 0x0100
EN_KILLFOCUS :: 0x0200
EN_CHANGE :: 0x0300
EN_UPDATE :: 0x0400
EN_ERRSPACE :: 0x0500
EN_MAXTEXT :: 0x0501
EN_HSCROLL :: 0x0601
EN_VSCROLL :: 0x0602
EN_ALIGN_LTR_EC :: 0x0700
EN_ALIGN_RTL_EC :: 0x0701
// Font Weights
FW_DONTCARE :: 0
FW_THIN :: 100
@@ -801,6 +827,57 @@ CREATESTRUCTW:: struct {
dwExStyle: DWORD,
}
DEVMODEW :: struct {
dmDeviceName: [32]wchar_t,
dmSpecVersion: WORD,
dmDriverVersion: WORD,
dmSize: WORD,
dmDriverExtra: WORD,
dmFields: DWORD,
using _: struct #raw_union {
// Printer only fields.
using _: struct {
dmOrientation: c_short,
dmPaperSize: c_short,
dmPaperLength: c_short,
dmPaperWidth: c_short,
dmScale: c_short,
dmCopies: c_short,
dmDefaultSource: c_short,
dmPrintQuality: c_short,
},
// Display only fields.
using _: struct {
dmPosition: POINT,
dmDisplayOrientation: DWORD,
dmDisplayFixedOutput: DWORD,
},
},
dmColor: c_short,
dmDuplex: c_short,
dmYResolution: c_short,
dmTTOption: c_short,
dmCollate: c_short,
dmFormName: [32]wchar_t,
dmLogPixels: WORD,
dmBitsPerPel: DWORD,
dmPelsWidth: DWORD,
dmPelsHeight: DWORD,
using _: struct #raw_union {
dmDisplayFlags: DWORD,
dmNup: DWORD,
},
dmDisplayFrequency: DWORD,
dmICMMethod: DWORD,
dmICMIntent: DWORD,
dmMediaType: DWORD,
dmDitherType: DWORD,
dmReserved1: DWORD,
dmReserved2: DWORD,
dmPanningWidth: DWORD,
dmPanningHeight: DWORD,
}
// MessageBox() Flags
MB_OK :: 0x00000000
MB_OKCANCEL :: 0x00000001

View File

@@ -135,6 +135,8 @@ foreign user32 {
SetCursorPos :: proc(X: c_int, Y: c_int) -> BOOL ---
SetCursor :: proc(hCursor: HCURSOR) -> HCURSOR ---
EnumDisplaySettingsW :: proc(lpszDeviceName: LPCWSTR, iModeNum: DWORD, lpDevMode: ^DEVMODEW) -> BOOL ---
BroadcastSystemMessageW :: proc(
flags: DWORD,
lpInfo: LPDWORD,
@@ -237,6 +239,10 @@ GET_NCHITTEST_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_s
return cast(c_short)LOWORD(cast(DWORD)wParam)
}
GET_XBUTTON_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> WORD {
GET_XBUTTON_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> WORD {
return HIWORD(cast(DWORD)wParam)
}
MAKEINTRESOURCEW :: #force_inline proc "contextless" (#any_int i: int) -> LPWSTR {
return cast(LPWSTR)uintptr(WORD(i))
}

View File

@@ -1322,6 +1322,7 @@ bool init_build_paths(String init_filename) {
}
#if defined(GB_SYSTEM_WINDOWS)
if (bc->metrics.os == TargetOs_windows) {
if (bc->resource_filepath.len > 0) {
bc->build_paths[BuildPath_RC] = path_from_string(ha, bc->resource_filepath);
bc->build_paths[BuildPath_RES] = path_from_string(ha, bc->resource_filepath);
@@ -1377,6 +1378,7 @@ bool init_build_paths(String init_filename) {
}
}
}
}
#endif
// All the build targets and OSes.

View File

@@ -3249,8 +3249,14 @@ void check_binary_expr(CheckerContext *c, Operand *x, Ast *node, Type *type_hint
return;
}
if (!are_types_identical(x->type, y->type)) {
if ((op.kind == Token_CmpAnd || op.kind == Token_CmpOr) &&
is_type_boolean(x->type) && is_type_boolean(y->type)) {
// NOTE(bill, 2022-06-26)
// Allow any boolean types within `&&` and `||`
// This is an exception to all other binary expressions since the result
// of a comparison will always be an untyped boolean, and allowing
// any boolean between these two simplifies a lot of expressions
} else if (!are_types_identical(x->type, y->type)) {
if (x->type != t_invalid &&
y->type != t_invalid) {
gbString xt = type_to_string(x->type);

View File

@@ -2142,7 +2142,26 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) {
}
if (new_name_count == 0) {
error(node, "No new declarations on the lhs");
begin_error_block();
error(node, "No new declarations on the left hand side");
bool all_underscore = true;
for_array(i, vd->names) {
Ast *name = vd->names[i];
if (name->kind == Ast_Ident) {
if (!is_blank_ident(name)) {
all_underscore = false;
break;
}
} else {
all_underscore = false;
break;
}
}
if (all_underscore) {
error_line("\tSuggestion: Try changing the declaration (:=) to an assignment (=)\n");
}
end_error_block();
}
Type *init_type = nullptr;

View File

@@ -1240,7 +1240,7 @@ Type *determine_type_from_polymorphic(CheckerContext *ctx, Type *poly_type, Oper
if (!is_operand_value(operand)) {
if (show_error) {
gbString pts = type_to_string(poly_type);
gbString ots = type_to_string(operand.type);
gbString ots = type_to_string(operand.type, true);
defer (gb_string_free(pts));
defer (gb_string_free(ots));
error(operand.expr, "Cannot determine polymorphic type from parameter: '%s' to '%s'", ots, pts);
@@ -1253,7 +1253,7 @@ Type *determine_type_from_polymorphic(CheckerContext *ctx, Type *poly_type, Oper
}
if (show_error) {
gbString pts = type_to_string(poly_type);
gbString ots = type_to_string(operand.type);
gbString ots = type_to_string(operand.type, true);
defer (gb_string_free(pts));
defer (gb_string_free(ots));
error(operand.expr, "Cannot determine polymorphic type from parameter: '%s' to '%s'", ots, pts);

View File

@@ -419,7 +419,18 @@ LLVMMetadataRef lb_debug_type_internal(lbModule *m, Type *type) {
break;
case Type_SimdVector:
return LLVMDIBuilderCreateVectorType(m->debug_builder, cast(unsigned)type->SimdVector.count, 8*cast(unsigned)type_align_of(type), lb_debug_type(m, type->SimdVector.elem), nullptr, 0);
{
LLVMMetadataRef elem = lb_debug_type(m, type->SimdVector.elem);
LLVMMetadataRef subscripts[1] = {};
subscripts[0] = LLVMDIBuilderGetOrCreateSubrange(m->debug_builder,
0ll,
type->SimdVector.count
);
return LLVMDIBuilderCreateVectorType(
m->debug_builder,
8*cast(unsigned)type_size_of(type), 8*cast(unsigned)type_align_of(type),
elem, subscripts, gb_count_of(subscripts));
}
case Type_RelativePointer: {
LLVMMetadataRef base_integer = lb_debug_type(m, type->RelativePointer.base_integer);

View File

@@ -852,6 +852,12 @@ bool lb_is_type_proc_recursive(Type *t) {
void lb_emit_store(lbProcedure *p, lbValue ptr, lbValue value) {
GB_ASSERT(value.value != nullptr);
Type *a = type_deref(ptr.type);
if (LLVMIsNull(value.value)) {
LLVMTypeRef src_t = LLVMGetElementType(LLVMTypeOf(ptr.value));
LLVMBuildStore(p->builder, LLVMConstNull(src_t), ptr.value);
return;
}
if (is_type_boolean(a)) {
// NOTE(bill): There are multiple sized booleans, thus force a conversion (if necessarily)
value = lb_emit_conv(p, value, a);
@@ -861,6 +867,20 @@ void lb_emit_store(lbProcedure *p, lbValue ptr, lbValue value) {
GB_ASSERT_MSG(are_types_identical(ca, core_type(value.type)), "%s != %s", type_to_string(a), type_to_string(value.type));
}
enum {MAX_STORE_SIZE = 64};
if (LLVMIsALoadInst(value.value) && lb_sizeof(LLVMTypeOf(value.value)) > MAX_STORE_SIZE) {
LLVMValueRef dst_ptr = ptr.value;
LLVMValueRef src_ptr = LLVMGetOperand(value.value, 0);
src_ptr = LLVMBuildPointerCast(p->builder, src_ptr, LLVMTypeOf(dst_ptr), "");
LLVMBuildMemMove(p->builder,
dst_ptr, 1,
src_ptr, 1,
LLVMConstInt(LLVMInt64TypeInContext(p->module->ctx), lb_sizeof(LLVMTypeOf(value.value)), false));
return;
}
if (lb_is_type_proc_recursive(a)) {
// NOTE(bill, 2020-11-11): Because of certain LLVM rules, a procedure value may be
// stored as regular pointer with no procedure information

View File

@@ -724,10 +724,11 @@ gb_global RecursiveMutex g_type_mutex;
struct TypePath;
i64 type_size_of (Type *t);
i64 type_align_of (Type *t);
i64 type_offset_of (Type *t, i32 index);
gbString type_to_string (Type *type, bool shorthand=false);
i64 type_size_of (Type *t);
i64 type_align_of (Type *t);
i64 type_offset_of (Type *t, i32 index);
gbString type_to_string (Type *type, bool shorthand=true);
gbString type_to_string (Type *type, gbAllocator allocator, bool shorthand=true);
i64 type_size_of_internal(Type *t, TypePath *path);
void init_map_internal_types(Type *type);
Type * bit_set_to_int(Type *t);
@@ -4287,7 +4288,7 @@ gbString write_type_to_string(gbString str, Type *type, bool shorthand=false) {
}
gbString type_to_string(Type *type, gbAllocator allocator, bool shorthand=false) {
gbString type_to_string(Type *type, gbAllocator allocator, bool shorthand) {
return write_type_to_string(gb_string_make(allocator, ""), type, shorthand);
}
gbString type_to_string(Type *type, bool shorthand) {

View File

@@ -947,6 +947,13 @@ impl_DrawTransformFeedbackStream: proc "c" (mode: u32, id: u32, stream: u32)
impl_BeginQueryIndexed: proc "c" (target: u32, index: u32, id: u32)
impl_EndQueryIndexed: proc "c" (target: u32, index: u32)
impl_GetQueryIndexediv: proc "c" (target: u32, index: u32, pname: u32, params: [^]i32)
impl_GetTextureHandleARB: proc "c" (texture: u32) -> u64
impl_GetTextureSamplerHandleARB: proc "c" (texture, sampler: u32) -> u64
impl_GetImageHandleARB: proc "c" (texture: u32, level: i32, layered: bool, layer: i32, format: u32) -> u64
impl_MakeTextureHandleResidentARB: proc "c" (handle: u64)
impl_MakeImageHandleResidentARB: proc "c" (handle: u64, access: u32)
impl_MakeTextureHandleNonResidentARB:proc "c" (handle: u64)
impl_MakeImageHandleNonResidentARB: proc "c" (handle: u64)
load_4_0 :: proc(set_proc_address: Set_Proc_Address_Type) {
set_proc_address(&impl_MinSampleShading, "glMinSampleShading")
@@ -995,6 +1002,42 @@ load_4_0 :: proc(set_proc_address: Set_Proc_Address_Type) {
set_proc_address(&impl_BeginQueryIndexed, "glBeginQueryIndexed")
set_proc_address(&impl_EndQueryIndexed, "glEndQueryIndexed")
set_proc_address(&impl_GetQueryIndexediv, "glGetQueryIndexediv")
// Load ARB (architecture review board, vendor specific) extensions that might be available
set_proc_address(&impl_GetTextureHandleARB, "glGetTextureHandleARB")
if impl_GetTextureHandleARB == nil {
set_proc_address(&impl_GetTextureHandleARB, "glGetTextureHandleNV")
}
set_proc_address(&impl_GetTextureSamplerHandleARB, "glGetTextureSamplerHandleARB")
if impl_GetTextureSamplerHandleARB == nil {
set_proc_address(&impl_GetTextureSamplerHandleARB, "glGetTextureSamplerHandleNV")
}
set_proc_address(&impl_GetImageHandleARB, "glGetImageHandleARB")
if impl_GetImageHandleARB == nil {
set_proc_address(&impl_GetImageHandleARB, "glGetImageHandleNV")
}
set_proc_address(&impl_MakeTextureHandleResidentARB, "glMakeTextureHandleResidentARB")
if impl_MakeTextureHandleResidentARB == nil {
set_proc_address(&impl_MakeTextureHandleResidentARB, "glMakeTextureHandleResidentNV")
}
set_proc_address(&impl_MakeImageHandleResidentARB, "glMakeImageHandleResidentARB")
if impl_MakeImageHandleResidentARB == nil {
set_proc_address(&impl_MakeImageHandleResidentARB, "glMakeImageHandleResidentNV")
}
set_proc_address(&impl_MakeTextureHandleNonResidentARB, "glMakeTextureHandleNonResidentARB")
if impl_MakeTextureHandleNonResidentARB == nil {
set_proc_address(&impl_MakeTextureHandleNonResidentARB, "glMakeTextureHandleNonResidentNV")
}
set_proc_address(&impl_MakeImageHandleNonResidentARB, "glMakeImageHandleNonResidentARB")
if impl_MakeImageHandleNonResidentARB == nil {
set_proc_address(&impl_MakeImageHandleNonResidentARB, "glMakeImageHandleNonResidentNV")
}
}
@@ -1594,3 +1637,4 @@ load_4_6 :: proc(set_proc_address: Set_Proc_Address_Type) {
set_proc_address(&impl_MultiDrawElementsIndirectCount, "glMultiDrawElementsIndirectCount")
set_proc_address(&impl_PolygonOffsetClamp, "glPolygonOffsetClamp")
}

View File

@@ -449,6 +449,20 @@ when !ODIN_DEBUG {
BeginQueryIndexed :: proc "c" (target: u32, index: u32, id: u32) { impl_BeginQueryIndexed(target, index, id) }
EndQueryIndexed :: proc "c" (target: u32, index: u32) { impl_EndQueryIndexed(target, index) }
GetQueryIndexediv :: proc "c" (target: u32, index: u32, pname: u32, params: [^]i32) { impl_GetQueryIndexediv(target, index, pname, params) }
GetTextureHandleARB :: proc "c" (texture: u32) -> u64
{ return impl_GetTextureHandleARB(texture) }
GetTextureSamplerHandleARB :: proc "c" (texture, sampler: u32) -> u64
{ return impl_GetTextureSamplerHandleARB(texture, sampler) }
GetImageHandleARB :: proc "c" (texture: u32, level: i32, layered: bool, layer: i32, format: u32) -> u64
{ return impl_GetImageHandleARB(texture, level, layered, layer, format) }
MakeTextureHandleResidentARB :: proc "c" (handle: u64)
{ impl_MakeTextureHandleResidentARB(handle) }
MakeImageHandleResidentARB :: proc "c" (handle: u64, access: u32)
{ impl_MakeImageHandleResidentARB(handle, access) }
MakeTextureHandleNonResidentARB:: proc "c" (handle: u64)
{ impl_MakeTextureHandleNonResidentARB(handle) }
MakeImageHandleNonResidentARB :: proc "c" (handle: u64)
{ impl_MakeImageHandleNonResidentARB(handle) }
// VERSION_4_1
ReleaseShaderCompiler :: proc "c" () { impl_ReleaseShaderCompiler() }
@@ -1249,6 +1263,22 @@ when !ODIN_DEBUG {
BeginQueryIndexed :: proc "c" (target: u32, index: u32, id: u32, loc := #caller_location) { impl_BeginQueryIndexed(target, index, id); debug_helper(loc, 0, target, index, id) }
EndQueryIndexed :: proc "c" (target: u32, index: u32, loc := #caller_location) { impl_EndQueryIndexed(target, index); debug_helper(loc, 0, target, index) }
GetQueryIndexediv :: proc "c" (target: u32, index: u32, pname: u32, params: [^]i32, loc := #caller_location) { impl_GetQueryIndexediv(target, index, pname, params); debug_helper(loc, 0, target, index, pname, params) }
GetTextureHandleARB :: proc "c" (target: u32, loc := #caller_location) -> u64
{ ret := impl_GetTextureHandleARB(target); debug_helper(loc, 0, target); return ret }
GetTextureSamplerHandleARB :: proc "c" (texture, sampler: u32, loc := #caller_location) -> u64
{ ret := impl_GetTextureSamplerHandleARB(texture, sampler); debug_helper(loc, 0, texture, sampler); return ret }
GetImageHandleARB :: proc "c" (texture: u32, level: i32, layered: bool, layer: i32, format: u32, loc := #caller_location) -> u64
{ ret := impl_GetImageHandleARB(texture, level, layered, layer, format); debug_helper(loc, 0, texture, level, layered, layer, format); return ret }
MakeTextureHandleResidentARB :: proc "c" (handle: u64, loc := #caller_location)
{ impl_MakeTextureHandleResidentARB(handle); debug_helper(loc, 0, handle) }
MakeImageHandleResidentARB :: proc "c" (handle: u64, access: u32, loc := #caller_location)
{ impl_MakeImageHandleResidentARB(handle, access); debug_helper(loc, 0, handle, access) }
MakeTextureHandleNonResidentARB:: proc "c" (handle: u64, loc := #caller_location)
{ impl_MakeTextureHandleNonResidentARB(handle); debug_helper(loc, 0, handle) }
MakeImageHandleNonResidentARB :: proc "c" (handle: u64, loc := #caller_location)
{ impl_MakeImageHandleNonResidentARB(handle); debug_helper(loc, 0, handle) }
// VERSION_4_1
ReleaseShaderCompiler :: proc "c" (loc := #caller_location) { impl_ReleaseShaderCompiler(); debug_helper(loc, 0) }

View File

@@ -1459,6 +1459,10 @@ TEXTURE_COPY_TYPE :: enum i32 {
TEXTURE_COPY_LOCATION :: struct {
pResource: ^IResource,
Type: TEXTURE_COPY_TYPE,
using _: struct #raw_union {
PlacedFootprint: PLACED_SUBRESOURCE_FOOTPRINT,
SubresourceIndex: u32,
},
}
RESOLVE_MODE :: enum i32 {

View File

@@ -477,7 +477,7 @@ DISABLE :: 0
ENABLE :: 1
GetEventState :: #force_inline proc "c" (type: EventType) -> u8 { return EventState(type, QUERY) }
GetEventState :: #force_inline proc "c" (type: EventType) -> b8 { return EventState(type, QUERY) }
@(default_calling_convention="c", link_prefix="SDL_")
@@ -488,15 +488,15 @@ foreign lib {
HasEvents :: proc(minType, maxType: EventType) -> bool ---
FlushEvent :: proc(type: EventType) ---
FlushEvents :: proc(minType, maxType: EventType) ---
PollEvent :: proc(event: ^Event) -> c.int ---
WaitEvent :: proc(event: ^Event) -> c.int ---
WaitEventTimeout :: proc(event: ^Event, timeout: c.int) -> c.int ---
PushEvent :: proc(event: ^Event) -> c.int ---
PollEvent :: proc(event: ^Event) -> bool --- // original return value is c.int
WaitEvent :: proc(event: ^Event) -> bool --- // original return value is c.int
WaitEventTimeout :: proc(event: ^Event, timeout: c.int) -> bool --- // original return value is c.int
PushEvent :: proc(event: ^Event) -> bool --- // original return value is c.int
SetEventFilter :: proc(filter: EventFilter, userdata: rawptr) ---
GetEventFilter :: proc(filter: ^EventFilter, userdata: ^rawptr) -> bool ---
AddEventWatch :: proc(filter: EventFilter, userdata: rawptr) ---
DelEventWatch :: proc(filter: EventFilter, userdata: rawptr) ---
FilterEvents :: proc(filter: EventFilter, userdata: rawptr) ---
EventState :: proc(type: EventType, state: c.int) -> u8 ---
EventState :: proc(type: EventType, state: c.int) -> b8 --- // original return value is u8
RegisterEvents :: proc(numevents: c.int) -> u32 ---
}

View File

@@ -118,7 +118,7 @@ foreign lib {
GameControllerGetStringForAxis :: proc(axis: GameControllerAxis) -> cstring ---
GameControllerGetBindForAxis :: proc(gamecontroller: ^GameController, axis: GameControllerAxis) -> GameControllerButtonBind---
GameControllerHasAxis :: proc(gamecontroller: ^GameController, axis: GameControllerAxis) -> bool ---
GameControllerGetAxis :: proc(gamecontroller: ^GameController, axis: GameControllerAxis) -> i16 ---
GameControllerGetAxis :: proc(gamecontroller: ^GameController, axis: GameControllerAxis) -> i16 ---
GameControllerGetButtonFromString :: proc(str: cstring) -> GameControllerButton ---
GameControllerGetStringForButton :: proc(button: GameControllerButton) -> cstring ---