mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 04:50:29 +00:00
Merge branch 'master' of https://github.com/odin-lang/Odin
This commit is contained in:
@@ -410,7 +410,7 @@ array_linear_search :: proc(x: ^$X/Array($T, $SHIFT), elem: T) -> (index: int, f
|
||||
return i, true
|
||||
}
|
||||
}
|
||||
return -1, flase
|
||||
return -1, false
|
||||
}
|
||||
|
||||
|
||||
@@ -481,7 +481,7 @@ array_iterate_by_val :: proc(it: ^Array_Iterator($T, $SHIFT)) -> (val: T, idx: i
|
||||
val = array_get(it.xar, it.idx)
|
||||
idx = it.idx
|
||||
it.idx += 1
|
||||
return val, true
|
||||
return val, idx, true
|
||||
}
|
||||
|
||||
|
||||
@@ -502,7 +502,7 @@ array_iterate_by_ptr :: proc(it: ^Array_Iterator($T, $SHIFT)) -> (val: ^T, idx:
|
||||
val = array_get_ptr(it.xar, it.idx)
|
||||
idx = it.idx
|
||||
it.idx += 1
|
||||
return val, true
|
||||
return val, idx, true
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package weistrass_tools
|
||||
package edwards_tools
|
||||
|
||||
import ed "core:crypto/_edwards25519"
|
||||
import field "core:crypto/_fiat/field_curve25519"
|
||||
@@ -78,7 +78,11 @@ main :: proc() {
|
||||
}
|
||||
}
|
||||
|
||||
fn := path.join({ODIN_ROOT, "core", "crypto", "_edwards25519", "edwards25519_table.odin"})
|
||||
fn, err := path.join({ODIN_ROOT, "core", "crypto", "_edwards25519", "edwards25519_table.odin"}, context.allocator)
|
||||
if err != .None {
|
||||
fmt.eprintfln("Join path error for edwards25519_table.odin: %v", err);
|
||||
os.exit(1);
|
||||
}
|
||||
bld: strings.Builder
|
||||
w := strings.to_writer(&bld)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package weistrass_tools
|
||||
package weierstrass_tools
|
||||
|
||||
import secec "core:crypto/_weierstrass"
|
||||
import "core:fmt"
|
||||
@@ -68,7 +68,11 @@ gen_tables :: proc($CURVE: string) {
|
||||
}
|
||||
|
||||
fn_ := "sec" + CURVE + "_table.odin"
|
||||
fn := path.join({ODIN_ROOT, "core", "crypto", "_weierstrass", fn_})
|
||||
fn, err := path.join({ODIN_ROOT, "core", "crypto", "_weierstrass", fn_}, context.allocator)
|
||||
if err != .None {
|
||||
fmt.eprintfln("Join path error for %s: %v", fn_, err);
|
||||
os.exit(1);
|
||||
}
|
||||
bld: strings.Builder
|
||||
w := strings.to_writer(&bld)
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@ import "core:hash"
|
||||
N :: 1
|
||||
|
||||
example :: proc() {
|
||||
using fmt
|
||||
|
||||
docs: [N]^xml.Document
|
||||
errs: [N]xml.Error
|
||||
times: [N]time.Duration
|
||||
@@ -59,23 +57,23 @@ example :: proc() {
|
||||
fmt.printf("[Average]: %v bytes in %.2f ms (%.2f MiB/s).\n", len(input), average_ms, average_speed)
|
||||
|
||||
if errs[0] != .None {
|
||||
printf("Load/Parse error: %v\n", errs[0])
|
||||
fmt.eprintf("Load/Parse error: %v\n", errs[0])
|
||||
if errs[0] == .File_Error {
|
||||
println("\"unicode.xml\" not found. Did you run \"tests\\download_assets.py\"?")
|
||||
fmt.eprintln("\"unicode.xml\" not found. Did you run \"tests\\download_assets.py\"?")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
charlist, charlist_ok := xml.find_child_by_ident(docs[0], 0, "charlist")
|
||||
if !charlist_ok {
|
||||
eprintln("Could not locate top-level `<charlist>` tag.")
|
||||
return
|
||||
fmt.eprintln("Could not locate top-level `<charlist>` tag.")
|
||||
return
|
||||
}
|
||||
|
||||
printf("Found `<charlist>` with %v children, %v elements total\n", len(docs[0].elements[charlist].value), docs[0].element_count)
|
||||
fmt.printf("Found `<charlist>` with %v children, %v elements total\n", len(docs[0].elements[charlist].value), docs[0].element_count)
|
||||
|
||||
crc32 := doc_hash(docs[0], false)
|
||||
printf("[%v] CRC32: 0x%08x\n", "🎉" if crc32 == 0x420dbac5 else "🤬", crc32)
|
||||
fmt.printf("[%v] CRC32: 0x%08x\n", "🎉" if crc32 == 0x420dbac5 else "🤬", crc32)
|
||||
|
||||
for round in 0..<N {
|
||||
defer xml.destroy(docs[round])
|
||||
@@ -94,8 +92,6 @@ doc_hash :: proc(doc: ^xml.Document, print := false) -> (crc32: u32) {
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
using fmt
|
||||
|
||||
track: mem.Tracking_Allocator
|
||||
mem.tracking_allocator_init(&track, context.allocator)
|
||||
context.allocator = mem.tracking_allocator(&track)
|
||||
@@ -103,10 +99,10 @@ main :: proc() {
|
||||
example()
|
||||
|
||||
if len(track.allocation_map) > 0 {
|
||||
println()
|
||||
fmt.println()
|
||||
for _, v in track.allocation_map {
|
||||
printf("%v Leaked %v bytes.\n", v.location, v.size)
|
||||
fmt.printf("%v Leaked %v bytes.\n", v.location, v.size)
|
||||
}
|
||||
}
|
||||
println("Done and cleaned up!")
|
||||
fmt.println("Done and cleaned up!")
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package hash
|
||||
|
||||
import "base:intrinsics"
|
||||
|
||||
@(optimization_mode="favor_size")
|
||||
crc32 :: proc "contextless" (data: []byte, seed := u32(0)) -> u32 #no_bounds_check {
|
||||
crc := ~seed
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package hash
|
||||
|
||||
import "core:mem"
|
||||
import "base:intrinsics"
|
||||
|
||||
@(optimization_mode="favor_size")
|
||||
adler32 :: proc "contextless" (data: []byte, seed := u32(1)) -> u32 #no_bounds_check {
|
||||
@@ -57,14 +56,14 @@ djb2 :: proc "contextless" (data: []byte, seed := u32(5381)) -> u32 {
|
||||
|
||||
djbx33a :: proc "contextless" (data: []byte, seed := u32(5381)) -> (result: [16]byte) #no_bounds_check {
|
||||
state := [4]u32{seed, seed, seed, seed}
|
||||
|
||||
|
||||
s: u32 = 0
|
||||
for p in data {
|
||||
state[s] = (state[s] << 5) + state[s] + u32(p) // hash * 33 + u32(b)
|
||||
s = (s + 1) & 3
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
(^u32le)(&result[0])^ = u32le(state[0])
|
||||
(^u32le)(&result[4])^ = u32le(state[1])
|
||||
(^u32le)(&result[8])^ = u32le(state[2])
|
||||
@@ -160,7 +159,7 @@ murmur32 :: proc "contextless" (data: []byte, seed := u32(0x9747b28c)) -> u32 {
|
||||
case 1:
|
||||
k1 ~= u32(tail[0])
|
||||
k1 *= c1_32
|
||||
k1 = (k1 << 15) | (k1 >> 17)
|
||||
k1 = (k1 << 15) | (k1 >> 17)
|
||||
k1 *= c2_32
|
||||
h1 ~= k1
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package rand
|
||||
import "base:intrinsics"
|
||||
import "base:runtime"
|
||||
|
||||
import "core:math/bits"
|
||||
|
||||
/*
|
||||
The state for a xoshiro256** pseudorandom generator.
|
||||
*/
|
||||
@@ -17,7 +15,7 @@ xoshiro256_random_generator_proc :: proc(data: rawptr, mode: runtime.Random_Gene
|
||||
read_u64 :: proc "contextless" (r: ^Xoshiro256_Random_State) -> u64 {
|
||||
// xoshiro256** output function and state transition
|
||||
|
||||
result := bits.rotate_left64(r.s[1] * 5, 7) * 9
|
||||
result := rotate_left64(r.s[1] * 5, 7) * 9
|
||||
t := r.s[1] << 17
|
||||
|
||||
r.s[2] = r.s[2] ~ r.s[0]
|
||||
@@ -25,9 +23,15 @@ xoshiro256_random_generator_proc :: proc(data: rawptr, mode: runtime.Random_Gene
|
||||
r.s[1] = r.s[1] ~ r.s[2]
|
||||
r.s[0] = r.s[0] ~ r.s[3]
|
||||
r.s[2] = r.s[2] ~ t
|
||||
r.s[3] = bits.rotate_left64(r.s[3], 45)
|
||||
r.s[3] = rotate_left64(r.s[3], 45)
|
||||
|
||||
return result
|
||||
|
||||
rotate_left64 :: proc "contextless" (x: u64, k: int) -> u64 {
|
||||
n :: 64
|
||||
s := uint(k) & (n-1)
|
||||
return x << s | x >> (n-s)
|
||||
}
|
||||
}
|
||||
|
||||
@(thread_local)
|
||||
|
||||
@@ -25,7 +25,6 @@ package net
|
||||
import "base:runtime"
|
||||
import "core:bufio"
|
||||
import "core:io"
|
||||
import "core:math/rand"
|
||||
import "core:mem"
|
||||
import "core:strings"
|
||||
import "core:time"
|
||||
@@ -192,7 +191,10 @@ get_dns_records_from_nameservers :: proc(hostname: string, type: DNS_Record_Type
|
||||
init_dns_configuration()
|
||||
context.allocator = allocator
|
||||
|
||||
id := u16be(rand.uint32())
|
||||
id: u16be
|
||||
rand_ok := runtime.random_generator_read_ptr(context.random_generator, &id, size_of(id))
|
||||
assert(rand_ok, "uninitialized gen/context.random_generator")
|
||||
|
||||
dns_packet_buf: [DNS_PACKET_MIN_LEN]byte = ---
|
||||
dns_packet := make_dns_packet(dns_packet_buf[:], id, hostname, type) or_return
|
||||
|
||||
|
||||
@@ -311,7 +311,8 @@ This procedure obtains a process handle of a process specified by `pid`.
|
||||
This procedure can be subject to race conditions. See the description of
|
||||
`Process`.
|
||||
|
||||
Use `process_close()` function to close the process handle.
|
||||
Use the `process_wait()` procedure (optionally prefaced with a `process_kill()`)
|
||||
to close and free the process handle.
|
||||
*/
|
||||
@(require_results)
|
||||
process_open :: proc(pid: int, flags := Process_Open_Flags {}) -> (Process, Error) {
|
||||
@@ -360,10 +361,8 @@ be created. It contains information such as the command line, the
|
||||
environment of the process, the starting directory and many other options.
|
||||
Most of the fields in the struct can be set to `nil` or an empty value.
|
||||
|
||||
Use `process_close` to close the handle to the process. Note, that this
|
||||
is not the same as terminating the process. One can terminate the process
|
||||
and not close the handle, in which case the handle would be leaked. In case
|
||||
the function returns an error, an invalid handle is returned.
|
||||
Use the `process_wait()` procedure (optionally prefaced with a `process_kill()`)
|
||||
to close and free the process handle.
|
||||
|
||||
This procedure is not thread-safe. It may alter the inheritance properties
|
||||
of file handles in an unpredictable manner. In case multiple threads change
|
||||
@@ -495,7 +494,7 @@ Process_State :: struct {
|
||||
// Will also store the number of the exception or signal that has crashed the
|
||||
// process.
|
||||
exit_code: int,
|
||||
// Specifies whether the termination of the process was successfull or not,
|
||||
// Specifies whether the termination of the process was successful or not,
|
||||
// i.e. whether it has crashed or not.
|
||||
// **Note(windows)**: On windows `true` is always returned, as there is no
|
||||
// reliable way to obtain information about whether the process has crashed.
|
||||
@@ -511,7 +510,9 @@ Wait for a process event.
|
||||
|
||||
This procedure blocks the execution until the process has exited or the
|
||||
timeout (if specified) has reached zero. If the timeout is `TIMEOUT_INFINITE`,
|
||||
no timeout restriction is imposed and the procedure can block indefinately.
|
||||
no timeout restriction is imposed and the procedure can block indefinitely.
|
||||
|
||||
If the timeout is 0, no blocking will be done and the current state is returned.
|
||||
|
||||
If the timeout has expired, the `General_Error.Timeout` is returned as
|
||||
the error.
|
||||
@@ -525,24 +526,25 @@ process_wait :: proc(process: Process, timeout := TIMEOUT_INFINITE) -> (Process_
|
||||
}
|
||||
|
||||
/*
|
||||
Close the handle to a process.
|
||||
Kill a process.
|
||||
|
||||
This procedure closes the handle associated with a process. It **does not**
|
||||
terminate a process, in case it was running. In case a termination is
|
||||
desired, kill the process first, wait for the process to finish,
|
||||
then close the handle.
|
||||
This procedure kills a process, specified by it's handle, `process`.
|
||||
|
||||
The process is forced to exit and can't ignore the request.
|
||||
*/
|
||||
@(require_results)
|
||||
process_close :: proc(process: Process) -> (Error) {
|
||||
return _process_close(process)
|
||||
process_kill :: proc(process: Process) -> (Error) {
|
||||
return _process_kill(process)
|
||||
}
|
||||
|
||||
/*
|
||||
Terminate a process.
|
||||
|
||||
This procedure terminates a process, specified by it's handle, `process`.
|
||||
|
||||
The process is requested to exit and can ignore the request.
|
||||
*/
|
||||
@(require_results)
|
||||
process_kill :: proc(process: Process) -> (Error) {
|
||||
return _process_kill(process)
|
||||
process_terminate :: proc(process: Process) -> (Error) {
|
||||
return _process_terminate(process)
|
||||
}
|
||||
|
||||
@@ -2,19 +2,17 @@
|
||||
#+build freebsd
|
||||
package os
|
||||
|
||||
import "core:c"
|
||||
|
||||
foreign import libc "system:c"
|
||||
foreign import dl "system:dl"
|
||||
|
||||
foreign libc {
|
||||
@(link_name="sysctlbyname")
|
||||
_sysctlbyname :: proc(path: cstring, oldp: rawptr, oldlenp: rawptr, newp: rawptr, newlen: int) -> c.int ---
|
||||
_sysctlbyname :: proc(path: cstring, oldp: rawptr, oldlenp: rawptr, newp: rawptr, newlen: int) -> i32 ---
|
||||
}
|
||||
|
||||
foreign dl {
|
||||
@(link_name="pthread_getthreadid_np")
|
||||
pthread_getthreadid_np :: proc() -> c.int ---
|
||||
pthread_getthreadid_np :: proc() -> i32 ---
|
||||
}
|
||||
|
||||
@(require_results)
|
||||
@@ -33,4 +31,4 @@ _get_processor_core_count :: proc() -> int {
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,11 +66,11 @@ _process_wait :: proc(process: Process, timeout: time.Duration) -> (process_stat
|
||||
return
|
||||
}
|
||||
|
||||
_process_close :: proc(process: Process) -> Error {
|
||||
_process_kill :: proc(process: Process) -> (err: Error) {
|
||||
return .Unsupported
|
||||
}
|
||||
|
||||
_process_kill :: proc(process: Process) -> (err: Error) {
|
||||
_process_terminate :: proc(process: Process) -> (err: Error) {
|
||||
return .Unsupported
|
||||
}
|
||||
|
||||
|
||||
@@ -5,20 +5,12 @@ package os
|
||||
import "base:runtime"
|
||||
import "base:intrinsics"
|
||||
|
||||
import "core:c"
|
||||
import "core:time"
|
||||
import "core:slice"
|
||||
import "core:strings"
|
||||
import "core:strconv"
|
||||
import "core:sys/unix"
|
||||
import "core:sys/linux"
|
||||
|
||||
foreign import libc "system:c"
|
||||
|
||||
foreign libc {
|
||||
@(link_name="get_nprocs") _unix_get_nprocs :: proc() -> c.int ---
|
||||
}
|
||||
|
||||
PIDFD_UNASSIGNED :: ~uintptr(0)
|
||||
|
||||
@(private="package")
|
||||
@@ -53,7 +45,7 @@ _get_ppid :: proc() -> int {
|
||||
|
||||
@(private="package")
|
||||
_get_current_thread_id :: proc "contextless" () -> int {
|
||||
return unix.sys_gettid()
|
||||
return int(linux.gettid())
|
||||
}
|
||||
|
||||
@(private="package")
|
||||
@@ -682,6 +674,8 @@ _reap_terminated :: proc(process: Process) -> (state: Process_State, err: Error)
|
||||
state.exit_code = int(info.status)
|
||||
state.success = false
|
||||
}
|
||||
|
||||
_process_close(process)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -723,6 +717,8 @@ _timed_wait_on_handle :: proc(process: Process, timeout: time.Duration) -> (proc
|
||||
start_tick = time.tick_now()
|
||||
continue
|
||||
}
|
||||
|
||||
_process_close(process)
|
||||
return process_state, _get_platform_error(errno)
|
||||
}
|
||||
|
||||
@@ -733,6 +729,7 @@ _timed_wait_on_handle :: proc(process: Process, timeout: time.Duration) -> (proc
|
||||
}
|
||||
|
||||
if errno = linux.waitid(.PIDFD, linux.Id(process.handle), &info, {.WEXITED, .WNOHANG, .WNOWAIT}, nil); errno != .NONE {
|
||||
_process_close(process)
|
||||
return process_state, _get_platform_error(errno)
|
||||
}
|
||||
|
||||
@@ -767,6 +764,8 @@ _timed_wait_on_handle :: proc(process: Process, timeout: time.Duration) -> (proc
|
||||
process_state.success = false
|
||||
}
|
||||
}
|
||||
|
||||
_process_close(process)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -783,6 +782,7 @@ _timed_wait_on_pid :: proc(process: Process, timeout: time.Duration) -> (process
|
||||
org_sigset: linux.Sig_Set
|
||||
errno := linux.rt_sigprocmask(.SIG_BLOCK, &sigchld_set, &org_sigset)
|
||||
if errno != .NONE {
|
||||
_process_close(process)
|
||||
return process_state, _get_platform_error(errno)
|
||||
}
|
||||
defer linux.rt_sigprocmask(.SIG_SETMASK, &org_sigset, nil)
|
||||
@@ -814,6 +814,7 @@ _timed_wait_on_pid :: proc(process: Process, timeout: time.Duration) -> (process
|
||||
timeout -= time.tick_since(start_tick)
|
||||
start_tick = time.tick_now()
|
||||
case .EINVAL:
|
||||
_process_close(process)
|
||||
return process_state, _get_platform_error(errno)
|
||||
}
|
||||
}
|
||||
@@ -852,13 +853,13 @@ _process_wait :: proc(process: Process, timeout: time.Duration) -> (Process_Stat
|
||||
return process_state, .Timeout
|
||||
}
|
||||
if errno != .NONE {
|
||||
_process_close(process)
|
||||
return process_state, _get_platform_error(errno)
|
||||
}
|
||||
|
||||
return _reap_terminated(process)
|
||||
}
|
||||
|
||||
@(private="package")
|
||||
_process_close :: proc(process: Process) -> Error {
|
||||
if process.handle == 0 || process.handle == PIDFD_UNASSIGNED {
|
||||
return nil
|
||||
@@ -872,3 +873,7 @@ _process_kill :: proc(process: Process) -> Error {
|
||||
return _get_platform_error(linux.kill(linux.Pid(process.pid), .SIGKILL))
|
||||
}
|
||||
|
||||
@(private="package")
|
||||
_process_terminate :: proc(process: Process) -> Error {
|
||||
return _get_platform_error(linux.kill(linux.Pid(process.pid), .SIGTERM))
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#+build netbsd
|
||||
package os
|
||||
|
||||
import "core:c"
|
||||
foreign import libc "system:c"
|
||||
|
||||
@(private)
|
||||
@@ -10,7 +9,7 @@ foreign libc {
|
||||
_lwp_self :: proc() -> i32 ---
|
||||
|
||||
@(link_name="sysctlbyname")
|
||||
_sysctlbyname :: proc(path: cstring, oldp: rawptr, oldlenp: rawptr, newp: rawptr, newlen: int) -> c.int ---
|
||||
_sysctlbyname :: proc(path: cstring, oldp: rawptr, oldlenp: rawptr, newp: rawptr, newlen: int) -> i32 ---
|
||||
}
|
||||
|
||||
@(require_results)
|
||||
@@ -28,4 +27,4 @@ _get_processor_core_count :: proc() -> int {
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,4 +22,4 @@ _SC_NPROCESSORS_ONLN :: 503
|
||||
@(private, require_results)
|
||||
_get_processor_core_count :: proc() -> int {
|
||||
return int(_sysconf(_SC_NPROCESSORS_ONLN))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,10 +329,6 @@ _process_wait :: proc(process: Process, timeout: time.Duration) -> (process_stat
|
||||
return
|
||||
}
|
||||
|
||||
_process_close :: proc(process: Process) -> Error {
|
||||
return nil
|
||||
}
|
||||
|
||||
_process_kill :: proc(process: Process) -> (err: Error) {
|
||||
_process_handle_still_valid(process) or_return
|
||||
|
||||
@@ -342,3 +338,13 @@ _process_kill :: proc(process: Process) -> (err: Error) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
_process_terminate :: proc(process: Process) -> (err: Error) {
|
||||
_process_handle_still_valid(process) or_return
|
||||
|
||||
if posix.kill(posix.pid_t(process.pid), .SIGTERM) != .OK {
|
||||
err = _get_platform_error()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2,19 +2,16 @@
|
||||
package os
|
||||
|
||||
import "base:runtime"
|
||||
import "base:intrinsics"
|
||||
|
||||
import "core:bytes"
|
||||
import "core:c"
|
||||
import "core:sys/darwin"
|
||||
import "core:sys/posix"
|
||||
import "core:sys/unix"
|
||||
import "core:time"
|
||||
|
||||
foreign import libc "system:System"
|
||||
foreign import pthread "system:System"
|
||||
foreign import libsystem "system:System"
|
||||
|
||||
foreign libc {
|
||||
foreign libsystem {
|
||||
sysctl :: proc "c" (
|
||||
name: [^]i32, namelen: u32,
|
||||
oldp: rawptr, oldlenp: ^uint,
|
||||
@@ -22,23 +19,24 @@ foreign libc {
|
||||
) -> posix.result ---
|
||||
|
||||
@(link_name="sysctlbyname")
|
||||
_sysctlbyname :: proc(path: cstring, oldp: rawptr, oldlenp: rawptr, newp: rawptr, newlen: int) -> c.int ---
|
||||
_sysctlbyname :: proc(path: cstring, oldp: rawptr, oldlenp: rawptr, newp: rawptr, newlen: int) -> posix.result ---
|
||||
|
||||
// NOTE(Oskar): available from OSX 10.6 and iOS 3.2.
|
||||
// For older versions there is `syscall(SYS_thread_selfid)`, but not really
|
||||
// the same thing apparently.
|
||||
pthread_threadid_np :: proc "c" (rawptr, ^u64) -> i32 ---
|
||||
}
|
||||
|
||||
_get_current_thread_id :: proc "contextless" () -> int {
|
||||
tid: u64
|
||||
// NOTE(Oskar): available from OSX 10.6 and iOS 3.2.
|
||||
// For older versions there is `syscall(SYS_thread_selfid)`, but not really
|
||||
// the same thing apparently.
|
||||
foreign pthread { pthread_threadid_np :: proc "c" (rawptr, ^u64) -> c.int --- }
|
||||
pthread_threadid_np(nil, &tid)
|
||||
return int(tid)
|
||||
}
|
||||
|
||||
_get_processor_core_count :: proc() -> int {
|
||||
count : int = 0
|
||||
count: int = 0
|
||||
count_size := size_of(count)
|
||||
if _sysctlbyname("hw.logicalcpu", &count, &count_size, nil, 0) == 0 {
|
||||
if _sysctlbyname("hw.logicalcpu", &count, &count_size, nil, 0) == .OK {
|
||||
if count > 0 {
|
||||
return count
|
||||
}
|
||||
|
||||
@@ -58,11 +58,11 @@ _process_wait :: proc(process: Process, timeout: time.Duration) -> (process_stat
|
||||
return
|
||||
}
|
||||
|
||||
_process_close :: proc(process: Process) -> Error {
|
||||
_process_kill :: proc(process: Process) -> (err: Error) {
|
||||
return .Unsupported
|
||||
}
|
||||
|
||||
_process_kill :: proc(process: Process) -> (err: Error) {
|
||||
_process_terminate :: proc(process: Process) -> (err: Error) {
|
||||
return .Unsupported
|
||||
}
|
||||
|
||||
|
||||
@@ -539,6 +539,7 @@ _process_wait :: proc(process: Process, timeout: time.Duration) -> (process_stat
|
||||
exit_code: u32
|
||||
if !win32.GetExitCodeProcess(handle, &exit_code) {
|
||||
err =_get_platform_error()
|
||||
_process_close(process)
|
||||
return
|
||||
}
|
||||
time_created: win32.FILETIME
|
||||
@@ -547,6 +548,7 @@ _process_wait :: proc(process: Process, timeout: time.Duration) -> (process_stat
|
||||
time_user: win32.FILETIME
|
||||
if !win32.GetProcessTimes(handle, &time_created, &time_exited, &time_kernel, &time_user) {
|
||||
err = _get_platform_error()
|
||||
_process_close(process)
|
||||
return
|
||||
}
|
||||
process_state = {
|
||||
@@ -557,17 +559,18 @@ _process_wait :: proc(process: Process, timeout: time.Duration) -> (process_stat
|
||||
system_time = _filetime_to_duration(time_kernel),
|
||||
user_time = _filetime_to_duration(time_user),
|
||||
}
|
||||
_process_close(process)
|
||||
return
|
||||
case win32.WAIT_TIMEOUT:
|
||||
err = General_Error.Timeout
|
||||
return
|
||||
case:
|
||||
err = _get_platform_error()
|
||||
_process_close(process)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@(private="package")
|
||||
_process_close :: proc(process: Process) -> Error {
|
||||
if !win32.CloseHandle(win32.HANDLE(process.handle)) {
|
||||
return _get_platform_error()
|
||||
@@ -587,6 +590,49 @@ _process_kill :: proc(process: Process) -> Error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@(private="package")
|
||||
_process_terminate :: proc(process: Process) -> Error {
|
||||
Enum_Windows_State :: struct {
|
||||
has_windows: bool,
|
||||
pid: int,
|
||||
}
|
||||
state: Enum_Windows_State
|
||||
state.pid = process.pid
|
||||
ok := win32.EnumWindows(
|
||||
proc "system" (hwnd: win32.HWND, lParam: win32.LPARAM) -> win32.BOOL {
|
||||
#assert(size_of(win32.LPARAM) == size_of(^Enum_Windows_State))
|
||||
state := (^Enum_Windows_State)(rawptr(uintptr(lParam)))
|
||||
|
||||
dwPid: win32.DWORD
|
||||
win32.GetWindowThreadProcessId(hwnd, &dwPid)
|
||||
if (dwPid == win32.DWORD(state.pid)) {
|
||||
state.has_windows = true
|
||||
win32.PostMessageW(hwnd, win32.WM_CLOSE, 0, 0)
|
||||
}
|
||||
|
||||
return true
|
||||
},
|
||||
win32.LPARAM(uintptr(&state)),
|
||||
)
|
||||
if state.has_windows {
|
||||
if ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
err := _get_platform_error()
|
||||
kill_err := _process_kill(process)
|
||||
return kill_err == nil ? nil : err
|
||||
}
|
||||
|
||||
if !win32.GenerateConsoleCtrlEvent(win32.CTRL_C_EVENT, win32.DWORD(process.pid)) {
|
||||
err := _get_platform_error()
|
||||
kill_err := _process_kill(process)
|
||||
return kill_err == nil ? nil : err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
_filetime_to_duration :: proc(filetime: win32.FILETIME) -> time.Duration {
|
||||
ticks := u64(filetime.dwHighDateTime)<<32 | u64(filetime.dwLowDateTime)
|
||||
return time.Duration(ticks * 100)
|
||||
|
||||
@@ -27,7 +27,7 @@ multiple memory locations between two cores. Which is why CPU's allow for
|
||||
stronger memory ordering guarantees if certain instructions or instruction
|
||||
variants are used.
|
||||
|
||||
In Odin there are 5 different memory ordering guaranties that can be provided
|
||||
In Odin there are 5 different memory ordering guarantees that can be provided
|
||||
to an atomic operation:
|
||||
|
||||
- `Relaxed`: The memory access (load or store) is unordered with respect to
|
||||
@@ -450,4 +450,4 @@ the load operation, if the comparison fails. The memory ordering for these
|
||||
operations is as specified by the `success` and `failure` parameters
|
||||
respectively.
|
||||
*/
|
||||
atomic_compare_exchange_weak_explicit :: intrinsics.atomic_compare_exchange_weak_explicit
|
||||
atomic_compare_exchange_weak_explicit :: intrinsics.atomic_compare_exchange_weak_explicit
|
||||
|
||||
@@ -526,6 +526,9 @@ to_string_hms_12 :: proc(t: Time, buf: []u8, ampm: [2]string = {" am", " pm"}) -
|
||||
h, m, s := clock(t)
|
||||
|
||||
_h := h % 12
|
||||
if _h == 0 {
|
||||
_h = 12
|
||||
}
|
||||
buf[7] = '0' + u8(s % 10); s /= 10
|
||||
buf[6] = '0' + u8(s)
|
||||
buf[5] = ':'
|
||||
@@ -535,7 +538,7 @@ to_string_hms_12 :: proc(t: Time, buf: []u8, ampm: [2]string = {" am", " pm"}) -
|
||||
buf[1] = '0' + u8(_h% 10); _h /= 10
|
||||
buf[0] = '0' + u8(_h)
|
||||
|
||||
if h < 13 {
|
||||
if h < 12 {
|
||||
copy(buf[8:], ampm[0])
|
||||
return string(buf[:MIN_HMS_LEN+len(ampm[0])])
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package xml_example
|
||||
package xml_tools
|
||||
|
||||
import "core:encoding/xml"
|
||||
import "core:os"
|
||||
@@ -20,17 +20,27 @@ Entity :: struct {
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
filename := path.join({ODIN_ROOT, "tests", "core", "assets", "XML", "unicode.xml"})
|
||||
filename, err_xml := path.join({ODIN_ROOT, "tests", "core", "assets", "XML", "unicode.xml"}, context.allocator)
|
||||
defer delete(filename)
|
||||
|
||||
generated_filename := path.join({ODIN_ROOT, "core", "encoding", "entity", "generated.odin"})
|
||||
if err_xml != .None {
|
||||
fmt.eprintfln("Join path error for unicode.xml: %v", err_xml);
|
||||
os.exit(1);
|
||||
}
|
||||
|
||||
generated_filename, err_generated := path.join({ODIN_ROOT, "core", "encoding", "entity", "generated.odin"}, context.allocator)
|
||||
defer delete(generated_filename)
|
||||
|
||||
if err_generated != .None {
|
||||
fmt.eprintfln("Join path error for generated.odin: %v", err_generated);
|
||||
os.exit(1);
|
||||
}
|
||||
|
||||
doc, err := xml.load_from_file(filename, OPTIONS, Error_Handler)
|
||||
defer xml.destroy(doc)
|
||||
|
||||
if err != .None {
|
||||
fmt.printfln("Load/Parse error: %v", err)
|
||||
fmt.eprintfln("Load/Parse error: %v", err)
|
||||
if err == .File_Error {
|
||||
fmt.eprintfln("%q not found. Did you run \"tests\\download_assets.py\"?", filename)
|
||||
}
|
||||
@@ -265,4 +275,4 @@ is_dotted_name :: proc(name: string) -> (dotted: bool) {
|
||||
if r == '.' { return true}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ test_time_and_date_formatting :: proc(t: ^testing.T) {
|
||||
d := time.Duration(now._nsec)
|
||||
|
||||
testing.expect_value(t, time.to_string_hms (now, buf[:]), "00:12:44")
|
||||
testing.expect_value(t, time.to_string_hms_12 (now, buf[:]), "00:12:44 am")
|
||||
testing.expect_value(t, time.to_string_hms_12 (now, buf[:], {"㏂", "㏘"}), "00:12:44㏂")
|
||||
testing.expect_value(t, time.to_string_hms_12 (now, buf[:]), "12:12:44 am")
|
||||
testing.expect_value(t, time.to_string_hms_12 (now, buf[:], {"㏂", "㏘"}), "12:12:44㏂")
|
||||
testing.expect_value(t, time.to_string_hms (d, buf[:]), "00:12:44")
|
||||
|
||||
testing.expect_value(t, time.to_string_yyyy_mm_dd(now, buf[:]), "1677-09-21")
|
||||
|
||||
34
vendor/directx/d3d11/d3d11.odin
vendored
34
vendor/directx/d3d11/d3d11.odin
vendored
@@ -4,7 +4,7 @@ package directx_d3d11
|
||||
foreign import "system:d3d11.lib"
|
||||
|
||||
import "../dxgi"
|
||||
import "../d3d_compiler"
|
||||
import "../d3d_common"
|
||||
import "core:sys/windows"
|
||||
|
||||
IUnknown :: dxgi.IUnknown
|
||||
@@ -26,9 +26,7 @@ LPCWSTR :: windows.LPCWSTR
|
||||
RECT :: dxgi.RECT
|
||||
SIZE :: dxgi.SIZE
|
||||
|
||||
IModuleInstance :: d3d_compiler.ID3D11ModuleInstance
|
||||
IBlob :: d3d_compiler.ID3DBlob
|
||||
IModule :: d3d_compiler.ID3D11Module
|
||||
IBlob :: d3d_common.ID3DBlob
|
||||
|
||||
@(default_calling_convention="system", link_prefix="D3D11")
|
||||
foreign d3d11 {
|
||||
@@ -3569,6 +3567,34 @@ PARAMETER_DESC :: struct {
|
||||
FirstOutComponent: u32,
|
||||
}
|
||||
|
||||
IModule :: struct #raw_union {
|
||||
#subtype iunknown: IUnknown,
|
||||
using id3d11module_vtable: ^IModule_VTable,
|
||||
}
|
||||
IModule_VTable :: struct {
|
||||
using iunknown_vtable: IUnknown_VTable,
|
||||
CreateInstance: proc "system" (this: ^IModule, pNamespace: LPCSTR, ppModuleInstance: ^^IModuleInstance) -> HRESULT,
|
||||
}
|
||||
|
||||
IModuleInstance :: struct #raw_union {
|
||||
#subtype iunknown: IUnknown,
|
||||
using id3d11moduleinstance_vtable: ^IModuleInstance_VTable,
|
||||
}
|
||||
IModuleInstance_VTable :: struct {
|
||||
using iunknown_vtable: IUnknown_VTable,
|
||||
BindConstantBuffer: proc "system" (this: ^IModuleInstance, uSrcSlot: u32, uDstSlot: u32, cbDstOffset: u32) -> HRESULT,
|
||||
BindConstantBufferByName: proc "system" (this: ^IModuleInstance, pName: LPCSTR, uDstSlot: u32, cbDstOffset: u32) -> HRESULT,
|
||||
BindResource: proc "system" (this: ^IModuleInstance, uSrcSlot: u32, uDstSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindResourceByName: proc "system" (this: ^IModuleInstance, pName: LPCSTR, uDstSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindSampler: proc "system" (this: ^IModuleInstance, uSrcSlot: u32, uDstSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindSamplerByName: proc "system" (this: ^IModuleInstance, pName: LPCSTR, uDstSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindUnorderedAccessView: proc "system" (this: ^IModuleInstance, uSrcSlot: u32, uDstSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindUnorderedAccessViewByName: proc "system" (this: ^IModuleInstance, pName: LPCSTR, uDstSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindResourceAsUnorderedAccessView: proc "system" (this: ^IModuleInstance, uSrcSrvSlot: u32, uDstUavSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindResourceAsUnorderedAccessViewByName: proc "system" (this: ^IModuleInstance, pSrvName: LPCSTR, uDstUavSlot: u32, uCount: u32) -> HRESULT,
|
||||
}
|
||||
|
||||
|
||||
ID3D11ShaderReflectionType_UUID_STRING :: "6E6FFA6A-9BAE-4613-A51E-91652D508C21"
|
||||
ID3D11ShaderReflectionType_UUID := &IID{0x6E6FFA6A, 0x9BAE, 0x4613, {0xA5, 0x1E, 0x91, 0x65, 0x2D, 0x50, 0x8C, 0x21}}
|
||||
IShaderReflectionType :: struct {
|
||||
|
||||
12
vendor/directx/d3d12/d3d12.odin
vendored
12
vendor/directx/d3d12/d3d12.odin
vendored
@@ -4,7 +4,7 @@ package directx_d3d12
|
||||
foreign import "system:d3d12.lib"
|
||||
|
||||
import "../dxgi"
|
||||
import "../d3d_compiler"
|
||||
import "../d3d_common"
|
||||
import win32 "core:sys/windows"
|
||||
|
||||
IUnknown :: dxgi.IUnknown
|
||||
@@ -26,9 +26,7 @@ RECT :: dxgi.RECT
|
||||
LPCSTR :: win32.LPCSTR
|
||||
LPCWSTR :: win32.LPCWSTR
|
||||
|
||||
IModuleInstance :: d3d_compiler.ID3D11ModuleInstance
|
||||
IBlob :: d3d_compiler.ID3DBlob
|
||||
IModule :: d3d_compiler.ID3D11Module
|
||||
IBlob :: d3d_common.ID3DBlob
|
||||
|
||||
@(default_calling_convention="system", link_prefix="D3D12")
|
||||
foreign d3d12 {
|
||||
@@ -1236,7 +1234,7 @@ TRI_STATE :: enum i32 {
|
||||
UNKNOWN = -1,
|
||||
FALSE = 0,
|
||||
TRUE = 1,
|
||||
}
|
||||
}
|
||||
|
||||
FEATURE_DATA_OPTIONS12 :: struct {
|
||||
MSPrimitivesPipelineStatisticIncludesCulledPrimitives: TRI_STATE,
|
||||
@@ -2597,7 +2595,7 @@ IDescriptorHeap_VTable :: struct {
|
||||
GetDesc: proc "system" (this: ^IDescriptorHeap, desc: ^DESCRIPTOR_HEAP_DESC),
|
||||
GetCPUDescriptorHandleForHeapStart: proc "system" (this: ^IDescriptorHeap, handle: ^CPU_DESCRIPTOR_HANDLE),
|
||||
GetGPUDescriptorHandleForHeapStart: proc "system" (this: ^IDescriptorHeap, handle: ^GPU_DESCRIPTOR_HANDLE),
|
||||
}
|
||||
}
|
||||
|
||||
IQueryHeap_UUID_STRING :: "0d9658ae-ed45-469e-a61d-970ec583cab4"
|
||||
IQueryHeap_UUID := &IID{0x0d9658ae, 0xed45, 0x469e, {0xa6, 0x1d, 0x97, 0x0e, 0xc5, 0x83, 0xca, 0xb4}}
|
||||
@@ -5495,7 +5493,7 @@ IGraphicsCommandList7_VTable :: struct {
|
||||
SHADER_VERSION_TYPE :: enum u32 {
|
||||
PIXEL_SHADER = 0,
|
||||
VERTEX_SHADER = 1,
|
||||
GEOMETRY_SHADER = 2,
|
||||
GEOMETRY_SHADER = 2,
|
||||
|
||||
HULL_SHADER = 3,
|
||||
DOMAIN_SHADER = 4,
|
||||
|
||||
25
vendor/directx/d3d_common/d3d_common.odin
vendored
Normal file
25
vendor/directx/d3d_common/d3d_common.odin
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Declarations shared between D3D versions.
|
||||
// Based on d3dcommon.h
|
||||
package d3d_common
|
||||
|
||||
import "core:sys/windows"
|
||||
|
||||
IID :: windows.IID
|
||||
SIZE_T :: windows.SIZE_T
|
||||
IUnknown :: windows.IUnknown
|
||||
IUnknown_VTable :: windows.IUnknown_VTable
|
||||
|
||||
ID3D10Blob_UUID_STRING :: "8BA5FB08-5195-40E2-AC58-0D989C3A0102"
|
||||
ID3D10Blob_UUID := &IID{0x8BA5FB08, 0x5195, 0x40E2, {0xAC, 0x58, 0x0D, 0x98, 0x9C, 0x3A, 0x01, 0x02}}
|
||||
ID3D10Blob :: struct #raw_union {
|
||||
#subtype iunknown: IUnknown,
|
||||
using id3d10blob_vtable: ^ID3D10Blob_VTable,
|
||||
}
|
||||
ID3D10Blob_VTable :: struct {
|
||||
using iunknown_vtable: IUnknown_VTable,
|
||||
GetBufferPointer: proc "system" (this: ^ID3D10Blob) -> rawptr,
|
||||
GetBufferSize: proc "system" (this: ^ID3D10Blob) -> SIZE_T,
|
||||
}
|
||||
|
||||
ID3DBlob :: ID3D10Blob
|
||||
ID3DBlob_VTable :: ID3D10Blob_VTable
|
||||
58
vendor/directx/d3d_compiler/d3d_compiler.odin
vendored
58
vendor/directx/d3d_compiler/d3d_compiler.odin
vendored
@@ -7,8 +7,9 @@ import win32 "core:sys/windows"
|
||||
D3DCOMPILER_DLL_A :: "d3dcompiler_47.dll"
|
||||
COMPILER_VERSION :: 47
|
||||
|
||||
|
||||
import "../dxgi"
|
||||
import "../d3d11"
|
||||
import "../d3d_common"
|
||||
|
||||
BOOL :: dxgi.BOOL
|
||||
IID :: dxgi.IID
|
||||
@@ -17,6 +18,8 @@ HRESULT :: dxgi.HRESULT
|
||||
IUnknown :: dxgi.IUnknown
|
||||
IUnknown_VTable :: dxgi.IUnknown_VTable
|
||||
|
||||
ID3DBlob :: d3d_common.ID3DBlob
|
||||
|
||||
LPCSTR :: win32.LPCSTR
|
||||
LPCWSTR :: win32.LPCWSTR
|
||||
|
||||
@@ -34,7 +37,7 @@ foreign d3dcompiler {
|
||||
Disassemble :: proc(pSrcData: rawptr, SrcDataSize: SIZE_T, Flags: u32, szComments: LPCSTR, ppDisassembly: ^^ID3DBlob) -> HRESULT ---
|
||||
DisassembleRegion :: proc(pSrcData: rawptr, SrcDataSize: SIZE_T, Flags: u32, szComments: LPCSTR, StartByteOffset: SIZE_T, NumInsts: SIZE_T, pFinishByteOffset: ^SIZE_T, ppDisassembly: ^^ID3DBlob) -> HRESULT ---
|
||||
CreateLinker :: proc(ppLinker: ^^ID3D11Linker) -> HRESULT ---
|
||||
LoadModule :: proc(pSrcData: rawptr, cbSrcDataSize: SIZE_T, ppModule: ^^ID3D11Module) -> HRESULT ---
|
||||
LoadModule :: proc(pSrcData: rawptr, cbSrcDataSize: SIZE_T, ppModule: ^^d3d11.IModule) -> HRESULT ---
|
||||
GetTraceInstructionOffsets :: proc(pSrcData: rawptr, SrcDataSize: SIZE_T, Flags: u32, StartInstIndex: SIZE_T, NumInsts: SIZE_T, pOffsets: ^SIZE_T, pTotalInsts: ^SIZE_T) -> HRESULT ---
|
||||
GetInputSignatureBlob :: proc(pSrcData: rawptr, SrcDataSize: SIZE_T, ppSignatureBlob: ^^ID3DBlob) -> HRESULT ---
|
||||
GetOutputSignatureBlob :: proc(pSrcData: rawptr, SrcDataSize: SIZE_T, ppSignatureBlob: ^^ID3DBlob) -> HRESULT ---
|
||||
@@ -121,29 +124,11 @@ SHADER_MACRO :: struct {
|
||||
Definition: LPCSTR,
|
||||
}
|
||||
|
||||
ID3D10Blob_UUID_STRING :: "8BA5FB08-5195-40E2-AC58-0D989C3A0102"
|
||||
ID3D10Blob_UUID := &IID{0x8BA5FB08, 0x5195, 0x40E2, {0xAC, 0x58, 0x0D, 0x98, 0x9C, 0x3A, 0x01, 0x02}}
|
||||
ID3D10Blob :: struct #raw_union {
|
||||
#subtype iunknown: IUnknown,
|
||||
using id3d10blob_vtable: ^ID3D10Blob_VTable,
|
||||
}
|
||||
ID3D10Blob_VTable :: struct {
|
||||
using iunknown_vtable: IUnknown_VTable,
|
||||
GetBufferPointer: proc "system" (this: ^ID3D10Blob) -> rawptr,
|
||||
GetBufferSize: proc "system" (this: ^ID3D10Blob) -> SIZE_T,
|
||||
}
|
||||
|
||||
|
||||
ID3DBlob :: ID3D10Blob
|
||||
ID3DBlob_VTable :: ID3D10Blob_VTable
|
||||
|
||||
|
||||
INCLUDE_TYPE :: enum i32 {
|
||||
INCLUDE_LOCAL = 0,
|
||||
INCLUDE_SYSTEM = 1,
|
||||
_10_INCLUDE_LOCAL = 0,
|
||||
_10_INCLUDE_SYSTEM = 1,
|
||||
INCLUDE_FORCE_DWORD = 2147483647,
|
||||
}
|
||||
|
||||
ID3DInclude :: struct {
|
||||
@@ -158,43 +143,14 @@ ID3DInclude_VTable :: struct {
|
||||
D3DCOMPILE_STANDARD_FILE_INCLUDE :: (^ID3DInclude)(uintptr(1))
|
||||
|
||||
|
||||
ID3D11Module :: struct #raw_union {
|
||||
#subtype iunknown: IUnknown,
|
||||
using id3d11module_vtable: ^ID3D11Module_VTable,
|
||||
}
|
||||
ID3D11Module_VTable :: struct {
|
||||
using iunknown_vtable: IUnknown_VTable,
|
||||
CreateInstance: proc "system" (this: ^ID3D11Module, pNamespace: LPCSTR, ppModuleInstance: ^^ID3D11ModuleInstance) -> HRESULT,
|
||||
}
|
||||
|
||||
|
||||
ID3D11ModuleInstance :: struct #raw_union {
|
||||
#subtype iunknown: IUnknown,
|
||||
using id3d11moduleinstance_vtable: ^ID3D11ModuleInstance_VTable,
|
||||
}
|
||||
ID3D11ModuleInstance_VTable :: struct {
|
||||
using iunknown_vtable: IUnknown_VTable,
|
||||
BindConstantBuffer: proc "system" (this: ^ID3D11ModuleInstance, uSrcSlot: u32, uDstSlot: u32, cbDstOffset: u32) -> HRESULT,
|
||||
BindConstantBufferByName: proc "system" (this: ^ID3D11ModuleInstance, pName: LPCSTR, uDstSlot: u32, cbDstOffset: u32) -> HRESULT,
|
||||
BindResource: proc "system" (this: ^ID3D11ModuleInstance, uSrcSlot: u32, uDstSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindResourceByName: proc "system" (this: ^ID3D11ModuleInstance, pName: LPCSTR, uDstSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindSampler: proc "system" (this: ^ID3D11ModuleInstance, uSrcSlot: u32, uDstSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindSamplerByName: proc "system" (this: ^ID3D11ModuleInstance, pName: LPCSTR, uDstSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindUnorderedAccessView: proc "system" (this: ^ID3D11ModuleInstance, uSrcSlot: u32, uDstSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindUnorderedAccessViewByName: proc "system" (this: ^ID3D11ModuleInstance, pName: LPCSTR, uDstSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindResourceAsUnorderedAccessView: proc "system" (this: ^ID3D11ModuleInstance, uSrcSrvSlot: u32, uDstUavSlot: u32, uCount: u32) -> HRESULT,
|
||||
BindResourceAsUnorderedAccessViewByName: proc "system" (this: ^ID3D11ModuleInstance, pSrvName: LPCSTR, uDstUavSlot: u32, uCount: u32) -> HRESULT,
|
||||
}
|
||||
|
||||
|
||||
ID3D11Linker :: struct #raw_union {
|
||||
#subtype iunknown: IUnknown,
|
||||
using id3d11linker_vtable: ^ID3D11Linker_VTable,
|
||||
}
|
||||
ID3D11Linker_VTable :: struct {
|
||||
using iunknown_vtable: IUnknown_VTable,
|
||||
Link: proc "system" (this: ^ID3D11Linker, pEntry: ^ID3D11ModuleInstance, pEntryName: LPCSTR, pTargetName: LPCSTR, uFlags: u32, ppShaderBlob: ^^ID3DBlob, ppErrorBuffer: ^^ID3DBlob) -> HRESULT,
|
||||
UseLibrary: proc "system" (this: ^ID3D11Linker, pLibraryMI: ^ID3D11ModuleInstance) -> HRESULT,
|
||||
Link: proc "system" (this: ^ID3D11Linker, pEntry: ^d3d11.IModuleInstance, pEntryName: LPCSTR, pTargetName: LPCSTR, uFlags: u32, ppShaderBlob: ^^ID3DBlob, ppErrorBuffer: ^^ID3DBlob) -> HRESULT,
|
||||
UseLibrary: proc "system" (this: ^ID3D11Linker, pLibraryMI: ^d3d11.IModuleInstance) -> HRESULT,
|
||||
AddClipPlaneFromCBuffer: proc "system" (this: ^ID3D11Linker, uCBufferSlot: u32, uCBufferEntry: u32) -> HRESULT,
|
||||
}
|
||||
|
||||
|
||||
5
vendor/directx/dxc/dxcapi.odin
vendored
5
vendor/directx/dxc/dxcapi.odin
vendored
@@ -194,7 +194,7 @@ ICompiler :: struct #raw_union {
|
||||
ICompiler_VTable :: struct {
|
||||
using iunknown_vtable: IUnknown_VTable,
|
||||
Compile: proc "system" (
|
||||
this: ^ICompiler,
|
||||
this: ^ICompiler,
|
||||
pSource: ^IBlob,
|
||||
pSourceName: wstring,
|
||||
pEntryPoint: wstring,
|
||||
@@ -206,7 +206,7 @@ ICompiler_VTable :: struct {
|
||||
pIncludeHandler: ^IIncludeHandler,
|
||||
ppResult: ^^IOperationResult) -> HRESULT,
|
||||
Preprocess: proc "system" (
|
||||
this: ^ICompiler,
|
||||
this: ^ICompiler,
|
||||
pSource: ^IBlob,
|
||||
pSourceName: wstring,
|
||||
pArguments: [^]wstring,
|
||||
@@ -303,7 +303,6 @@ DXC_OUT_KIND :: enum u32 {
|
||||
REFLECTION = 8,
|
||||
ROOT_SIGNATURE = 9,
|
||||
EXTRA_OUTPUTS = 10,
|
||||
FORCE_DWORD = 0xFFFFFFFF,
|
||||
}
|
||||
|
||||
IResult_UUID_STRING :: "58346CDA-DDE7-4497-9461-6F87AF5E0659"
|
||||
|
||||
1
vendor/directx/dxgi/dxgi.odin
vendored
1
vendor/directx/dxgi/dxgi.odin
vendored
@@ -752,7 +752,6 @@ ALPHA_MODE :: enum i32 {
|
||||
PREMULTIPLIED = 1,
|
||||
STRAIGHT = 2,
|
||||
IGNORE = 3,
|
||||
FORCE_DWORD = -1,
|
||||
}
|
||||
|
||||
|
||||
|
||||
6
vendor/miniaudio/logging.odin
vendored
6
vendor/miniaudio/logging.odin
vendored
@@ -1,6 +1,6 @@
|
||||
package miniaudio
|
||||
|
||||
import "core:c/libc"
|
||||
import "core:c"
|
||||
|
||||
foreign import lib { LIB }
|
||||
|
||||
@@ -48,12 +48,12 @@ log :: struct {
|
||||
@(default_calling_convention="c", link_prefix="ma_")
|
||||
foreign lib {
|
||||
log_callback_init :: proc(onLog: log_callback_proc, pUserData: rawptr) -> log_callback ---
|
||||
|
||||
|
||||
log_init :: proc(pAllocationCallbacks: ^allocation_callbacks, pLog: ^log) -> result ---
|
||||
log_uninit :: proc(pLog: ^log) ---
|
||||
log_register_callback :: proc(pLog: ^log, callback: log_callback) -> result ---
|
||||
log_unregister_callback :: proc(pLog: ^log, callback: log_callback) -> result ---
|
||||
log_post :: proc(pLog: ^log, level: u32, pMessage: cstring) -> result ---
|
||||
log_postv :: proc(pLog: ^log, level: u32, pFormat: cstring, args: libc.va_list) -> result ---
|
||||
log_postv :: proc(pLog: ^log, level: u32, pFormat: cstring, args: c.va_list) -> result ---
|
||||
log_postf :: proc(pLog: ^log, level: u32, pFormat: cstring, #c_vararg args: ..any) -> result ---
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user