mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 22:58:46 +00:00
Merge remote-tracking branch 'offical/master'
This commit is contained in:
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build linux, darwin, freebsd, openbsd, netbsd
|
||||
#+build linux, darwin, freebsd, openbsd, netbsd
|
||||
package ENet
|
||||
|
||||
// When we implement the appropriate bindings for Unix, the section separated
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build windows
|
||||
#+build windows
|
||||
package ENet
|
||||
|
||||
// When we implement the appropriate bindings for Windows, the section separated
|
||||
|
||||
Vendored
+19
-5
@@ -3,7 +3,11 @@ package vendor_box2d
|
||||
import "base:intrinsics"
|
||||
import "core:c"
|
||||
|
||||
@(private) VECTOR_EXT :: "avx2" when #config(VENDOR_BOX2D_ENABLE_AVX2, intrinsics.has_target_feature("avx2")) else "sse2"
|
||||
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
@(private) VECTOR_EXT :: "_simd" when #config(VENDOR_BOX2D_ENABLE_SIMD128, intrinsics.has_target_feature("simd128")) else ""
|
||||
} else {
|
||||
@(private) VECTOR_EXT :: "avx2" when #config(VENDOR_BOX2D_ENABLE_AVX2, intrinsics.has_target_feature("avx2")) else "sse2"
|
||||
}
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
@(private) LIB_PATH :: "lib/box2d_windows_amd64_" + VECTOR_EXT + ".lib"
|
||||
@@ -13,6 +17,8 @@ when ODIN_OS == .Windows {
|
||||
@(private) LIB_PATH :: "lib/box2d_darwin_amd64_" + VECTOR_EXT + ".a"
|
||||
} else when ODIN_ARCH == .amd64 {
|
||||
@(private) LIB_PATH :: "lib/box2d_other_amd64_" + VECTOR_EXT + ".a"
|
||||
} else when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
@(private) LIB_PATH :: "lib/box2d_wasm" + VECTOR_EXT + ".o"
|
||||
} else {
|
||||
@(private) LIB_PATH :: "lib/box2d_other.a"
|
||||
}
|
||||
@@ -21,8 +27,16 @@ when !#exists(LIB_PATH) {
|
||||
#panic("Could not find the compiled box2d libraries at \"" + LIB_PATH + "\", they can be compiled by running the `build.sh` script at `" + ODIN_ROOT + "vendor/box2d/build_box2d.sh\"`")
|
||||
}
|
||||
|
||||
foreign import lib {
|
||||
LIB_PATH,
|
||||
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
when VECTOR_EXT == "_simd" {
|
||||
foreign import lib "lib/box2d_wasm_simd.o"
|
||||
} else {
|
||||
foreign import lib "lib/box2d_wasm.o"
|
||||
}
|
||||
} else {
|
||||
foreign import lib {
|
||||
LIB_PATH,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -476,7 +490,7 @@ foreign lib {
|
||||
World_Step :: proc(worldId: WorldId, timeStep: f32 , subStepCount: c.int) ---
|
||||
|
||||
// Call this to draw shapes and other debug draw data
|
||||
World_Draw :: proc(worldId: WorldId, draw: DebugDraw) ---
|
||||
World_Draw :: proc(worldId: WorldId, draw: ^DebugDraw) ---
|
||||
|
||||
// Get the body events for the current time step. The event data is transient. Do not store a reference to this data.
|
||||
World_GetBodyEvents :: proc(worldId: WorldId) -> BodyEvents ---
|
||||
@@ -1520,4 +1534,4 @@ IsValid :: proc{
|
||||
Joint_IsValid,
|
||||
|
||||
IsValidRay,
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
#+build wasm32, wasm64p32
|
||||
package vendor_box2d
|
||||
|
||||
@(require) import _ "vendor:libc"
|
||||
Vendored
+9
-7
@@ -11,7 +11,7 @@ tar -xzvf "v$VERSION.tar.gz"
|
||||
|
||||
cd "box2d-$VERSION"
|
||||
|
||||
DISABLE_FLAGS="-DBOX2D_SAMPLES=OFF -DBOX2D_VALIDATE=OFF -DBOX2D_UNIT_TESTS=OFF"
|
||||
FLAGS="-DCMAKE_BUILD_TYPE=Release -DBOX2D_SAMPLES=OFF -DBOX2D_VALIDATE=OFF -DBOX2D_UNIT_TESTS=OFF"
|
||||
|
||||
case "$(uname -s)" in
|
||||
Darwin)
|
||||
@@ -21,20 +21,20 @@ Darwin)
|
||||
"x86_64" | "amd64")
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cmake $DISABLE_FLAGS -DBOX2D_AVX2=ON -DCMAKE_OSX_ARCHITECTURES=x86_64 -S . -B build
|
||||
cmake $FLAGS -DBOX2D_AVX2=ON -DCMAKE_OSX_ARCHITECTURES=x86_64 -S . -B build
|
||||
cmake --build build
|
||||
cp build/src/libbox2d.a ../lib/box2d_darwin_amd64_avx2.a
|
||||
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cmake $DISABLE_FLAGS -DBOX2D_AVX2=OFF -DCMAKE_OSX_ARCHITECTURES=x86_64 -S . -B build
|
||||
cmake $FLAGS -DBOX2D_AVX2=OFF -DCMAKE_OSX_ARCHITECTURES=x86_64 -S . -B build
|
||||
cmake --build build
|
||||
cp build/src/libbox2d.a ../lib/box2d_darwin_amd64_sse2.a
|
||||
;;
|
||||
*)
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cmake $DISABLE_FLAGS -DCMAKE_OSX_ARCHITECTURES=arm64 -S . -B build
|
||||
cmake $FLAGS -DCMAKE_OSX_ARCHITECTURES=arm64 -S . -B build
|
||||
cmake --build build
|
||||
cp build/src/libbox2d.a ../lib/box2d_darwin_arm64.a
|
||||
;;
|
||||
@@ -45,20 +45,20 @@ Darwin)
|
||||
"x86_64" | "amd64")
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cmake $DISABLE_FLAGS -DBOX2D_AVX2=ON -S . -B build
|
||||
cmake $FLAGS -DBOX2D_AVX2=ON -S . -B build
|
||||
cmake --build build
|
||||
cp build/src/libbox2d.a ../lib/box2d_other_amd64_avx2.a
|
||||
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cmake $DISABLE_FLAGS -DBOX2D_AVX2=OFF -S . -B build
|
||||
cmake $FLAGS -DBOX2D_AVX2=OFF -S . -B build
|
||||
cmake --build build
|
||||
cp build/src/libbox2d.a ../lib/box2d_other_amd64_sse2.a
|
||||
;;
|
||||
*)
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cmake $DISABLE_FLAGS -DCMAKE_OSX_ARCHITECTURES=arm64 -S . -B build
|
||||
cmake $FLAGS -DCMAKE_OSX_ARCHITECTURES=arm64 -S . -B build
|
||||
cmake --build build
|
||||
cp build/src/libbox2d.a ../lib/box2d_other.a
|
||||
;;
|
||||
@@ -68,5 +68,7 @@ esac
|
||||
|
||||
cd ..
|
||||
|
||||
make -f wasm.Makefile
|
||||
|
||||
rm -rf v3.0.0.tar.gz
|
||||
rm -rf box2d-3.0.0
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
# Custom Makefile to build box2d for Odin's WASM targets.
|
||||
# I tried to make a cmake toolchain file for this / use cmake but this is far easier.
|
||||
# NOTE: We are pretending to be emscripten to box2d so it takes WASM code paths, but we don't actually use emscripten.
|
||||
|
||||
# CC = $(shell brew --prefix llvm)/bin/clang
|
||||
# LD = $(shell brew --prefix llvm)/bin/wasm-ld
|
||||
|
||||
VERSION = 3.0.0
|
||||
SRCS = $(wildcard box2d-$(VERSION)/src/*.c)
|
||||
OBJS_SIMD = $(SRCS:.c=_simd.o)
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
SYSROOT = $(shell odin root)/vendor/libc
|
||||
CFLAGS = -Ibox2d-$(VERSION)/include -Ibox2d-$(VERSION)/Extern/simde --target=wasm32 -D__EMSCRIPTEN__ -DNDEBUG -O3 --sysroot=$(SYSROOT)
|
||||
|
||||
all: lib/box2d_wasm.o lib/box2d_wasm_simd.o clean
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
%_simd.o: %.c
|
||||
$(CC) -c $(CFLAGS) -msimd128 $< -o $@
|
||||
|
||||
lib/box2d_wasm.o: $(OBJS)
|
||||
$(LD) -r -o lib/box2d_wasm.o $(OBJS)
|
||||
|
||||
lib/box2d_wasm_simd.o: $(OBJS_SIMD)
|
||||
$(LD) -r -o lib/box2d_wasm_simd.o $(OBJS_SIMD)
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJS) $(OBJS_SIMD)
|
||||
|
||||
.PHONY: clean
|
||||
Vendored
+5
@@ -5,6 +5,7 @@ LIB :: (
|
||||
"lib/cgltf.lib" when ODIN_OS == .Windows
|
||||
else "lib/cgltf.a" when ODIN_OS == .Linux
|
||||
else "lib/darwin/cgltf.a" when ODIN_OS == .Darwin
|
||||
else "lib/cgltf_wasm.o" when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32
|
||||
else ""
|
||||
)
|
||||
|
||||
@@ -13,7 +14,11 @@ when LIB != "" {
|
||||
// Windows library is shipped with the compiler, so a Windows specific message should not be needed.
|
||||
#panic("Could not find the compiled cgltf library, it can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/cgltf/src\"`")
|
||||
}
|
||||
}
|
||||
|
||||
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
foreign import lib "lib/cgltf_wasm.o"
|
||||
} else when LIB != "" {
|
||||
foreign import lib { LIB }
|
||||
} else {
|
||||
foreign import lib "system:cgltf"
|
||||
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
#+build wasm32, wasm64p32
|
||||
package cgltf
|
||||
|
||||
@(require) import _ "vendor:libc"
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+4
@@ -6,6 +6,10 @@ else
|
||||
all: unix
|
||||
endif
|
||||
|
||||
wasm:
|
||||
mkdir -p ../lib
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc cgltf.c -o ../lib/cgltf_wasm.o
|
||||
|
||||
unix:
|
||||
mkdir -p ../lib
|
||||
$(CC) -c -O2 -Os -fPIC cgltf.c
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build ignore
|
||||
#+build ignore
|
||||
/*
|
||||
Bindings against CMark (https://github.com/commonmark/cmark)
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build linux, darwin, freebsd, openbsd, netbsd
|
||||
#+build linux, darwin, freebsd, openbsd, netbsd
|
||||
package directx_dxc
|
||||
import "core:c"
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build windows
|
||||
#+build windows
|
||||
package directx_dxc
|
||||
import win32 "core:sys/windows"
|
||||
import dxgi "vendor:directx/dxgi"
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build linux
|
||||
#+build linux
|
||||
package egl
|
||||
|
||||
NativeDisplayType :: distinct rawptr
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+vet !using-param
|
||||
#+vet !using-param
|
||||
package fontstash
|
||||
|
||||
import "base:runtime"
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build !js
|
||||
#+build !js
|
||||
package fontstash
|
||||
|
||||
import "core:log"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build js
|
||||
#+build js
|
||||
package fontstash
|
||||
|
||||
AddFontPath :: proc(
|
||||
|
||||
Vendored
+12
-2
@@ -3,7 +3,7 @@ package glfw_bindings
|
||||
import "core:c"
|
||||
import vk "vendor:vulkan"
|
||||
|
||||
GLFW_SHARED :: #config(GLFW_SHARED, false)
|
||||
GLFW_SHARED :: #config(GLFW_SHARED, ODIN_OS != .Windows && ODIN_OS != .Darwin)
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
when GLFW_SHARED {
|
||||
@@ -38,7 +38,17 @@ when ODIN_OS == .Windows {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreign import glfw "system:glfw"
|
||||
when GLFW_SHARED {
|
||||
foreign import glfw "system:glfw"
|
||||
} else {
|
||||
@(private)
|
||||
LIBGLFW3 :: "../lib/libglfw3.a"
|
||||
when !#exists(LIBGLFW3) {
|
||||
#panic("Could not find the static glfw library, add it at \"" + ODIN_ROOT + "vendor/glfw/lib/\"`")
|
||||
}
|
||||
|
||||
foreign import glfw { LIBGLFW3 }
|
||||
}
|
||||
}
|
||||
|
||||
#assert(size_of(c.int) == size_of(b32))
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build darwin
|
||||
#+build darwin
|
||||
package glfw
|
||||
|
||||
import NS "core:sys/darwin/Foundation"
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build linux
|
||||
#+build linux
|
||||
package glfw
|
||||
|
||||
import "vendor:x11/xlib"
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build windows
|
||||
#+build windows
|
||||
package glfw
|
||||
|
||||
import win32 "core:sys/windows"
|
||||
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
# vendor:libc
|
||||
|
||||
A (very small) subset of a libc implementation over Odin libraries.
|
||||
This is mainly intended for use in Odin WASM builds to allow using libraries like box2d, cgltf etc. without emscripten hacks.
|
||||
|
||||
You can use this with clang by doing `clang -c --target=wasm32 --sysroot=$(odin root)/vendor/libc` (+ all other flags and inputs).
|
||||
This will (if all the libc usage of the library is implemented) spit out a `.o` file you can use with the foreign import system.
|
||||
If you then also make sure this package is included in the Odin side of the project (`@(require) import "vendor:libc"`) you will be able
|
||||
compile to WASM like Odin expects.
|
||||
|
||||
This is currently used by `vendor:box2d`, `vendor:stb/image`, `vendor:stb/truetype`, `vendor:stb/rect_pack`, and `vendor:cgltf`.
|
||||
You can see how building works by looking at those.
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
package odin_libc
|
||||
|
||||
import "base:runtime"
|
||||
|
||||
@(require, linkage="strong", link_name="__odin_libc_assert_fail")
|
||||
__odin_libc_assert_fail :: proc "c" (func: cstring, file: cstring, line: i32, expr: cstring) -> ! {
|
||||
context = g_ctx
|
||||
loc := runtime.Source_Code_Location{
|
||||
file_path = string(file),
|
||||
line = line,
|
||||
column = 0,
|
||||
procedure = string(func),
|
||||
}
|
||||
context.assertion_failure_proc("runtime assertion", string(expr), loc)
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
#ifdef NDEBUG
|
||||
#define assert(e) ((void)0)
|
||||
#else
|
||||
|
||||
#ifdef __FILE_NAME__
|
||||
#define __ASSERT_FILE_NAME __FILE_NAME__
|
||||
#else /* __FILE_NAME__ */
|
||||
#define __ASSERT_FILE_NAME __FILE__
|
||||
#endif /* __FILE_NAME__ */
|
||||
|
||||
void __odin_libc_assert_fail(const char *, const char *, int, const char *);
|
||||
|
||||
#define assert(e) \
|
||||
(__builtin_expect(!(e), 0) ? __odin_libc_assert_fail(__func__, __ASSERT_FILE_NAME, __LINE__, #e) : (void)0)
|
||||
|
||||
#endif /* NDEBUG */
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
float sqrtf(float);
|
||||
float cosf(float);
|
||||
float sinf(float);
|
||||
float atan2f(float, float);
|
||||
bool isnan(float);
|
||||
bool isinf(float);
|
||||
double floor(double x);
|
||||
double ceil(double x);
|
||||
double sqrt(double x);
|
||||
double pow(double x, double y);
|
||||
double fmod(double x, double y);
|
||||
double cos(double x);
|
||||
double acos(double x);
|
||||
double fabs(double x);
|
||||
int abs(int);
|
||||
double ldexp(double, int);
|
||||
double exp(double);
|
||||
float log(float);
|
||||
float sin(float);
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef struct {} FILE;
|
||||
|
||||
#define SEEK_SET 0
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
|
||||
#define stdout ((FILE *)2)
|
||||
#define stderr ((FILE *)3)
|
||||
|
||||
FILE *fopen(const char *, char *);
|
||||
int fclose(FILE *);
|
||||
int fseek(FILE *, long, int);
|
||||
long ftell(FILE *);
|
||||
size_t fread(void *, size_t, size_t, FILE *);
|
||||
size_t fwrite(const void *, size_t, size_t, FILE *);
|
||||
|
||||
int vfprintf(FILE *, const char *, va_list);
|
||||
int vsnprintf(char *, size_t, const char *, va_list);
|
||||
|
||||
static inline int snprintf(char *buf, size_t size, const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
int result = vsnprintf(buf, size, fmt, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline int fprintf(FILE *f, const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
int result = vfprintf(f, fmt, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline int printf(const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
int result = vfprintf(stdout, fmt, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
#include <stddef.h>
|
||||
|
||||
void *malloc(size_t size);
|
||||
|
||||
void *aligned_alloc(size_t alignment, size_t size);
|
||||
|
||||
void free(void *);
|
||||
|
||||
void *realloc(void *, size_t);
|
||||
|
||||
void qsort(void* base, size_t num, size_t size, int (*compare)(const void*, const void*));
|
||||
|
||||
int atoi(const char *);
|
||||
long atol(const char *);
|
||||
long long atoll(const char *);
|
||||
|
||||
double atof(const char *);
|
||||
|
||||
long strtol(const char *, char **, int);
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
#include <stddef.h>
|
||||
|
||||
void *memcpy(void *, const void *, size_t);
|
||||
void *memset(void *, int, size_t);
|
||||
void *memmove(void *, void *, size_t);
|
||||
int memcmp(const void *, const void *, size_t);
|
||||
|
||||
unsigned long strlen(const char *str);
|
||||
|
||||
char *strchr(const char *, int);
|
||||
char *strrchr(const char *, int);
|
||||
|
||||
char *strncpy(char *, const char *, size_t);
|
||||
char *strcpy(char *, const char *);
|
||||
|
||||
size_t strcspn(const char *, const char *);
|
||||
|
||||
int strcmp(const char *, const char *);
|
||||
int strncmp(const char *, const char *, size_t);
|
||||
|
||||
char *strstr(const char *, const char *);
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
package odin_libc
|
||||
|
||||
import "base:runtime"
|
||||
|
||||
import "core:mem"
|
||||
|
||||
@(private)
|
||||
g_ctx: runtime.Context
|
||||
@(private)
|
||||
g_allocator: mem.Compat_Allocator
|
||||
|
||||
@(init)
|
||||
init_context :: proc() {
|
||||
g_ctx = context
|
||||
|
||||
// Wrapping the allocator with the mem.Compat_Allocator so we can
|
||||
// mimic the realloc semantics.
|
||||
mem.compat_allocator_init(&g_allocator, g_ctx.allocator)
|
||||
g_ctx.allocator = mem.compat_allocator(&g_allocator)
|
||||
}
|
||||
|
||||
// NOTE: the allocator must respect an `old_size` of `-1` on resizes!
|
||||
set_context :: proc(ctx := context) {
|
||||
g_ctx = ctx
|
||||
}
|
||||
Vendored
+100
@@ -0,0 +1,100 @@
|
||||
package odin_libc
|
||||
|
||||
import "base:builtin"
|
||||
|
||||
import "core:math"
|
||||
|
||||
@(require, linkage="strong", link_name="sqrtf")
|
||||
sqrtf :: proc "c" (v: f32) -> f32 {
|
||||
return math.sqrt(v)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="cosf")
|
||||
cosf :: proc "c" (v: f32) -> f32 {
|
||||
return math.cos(v)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="sinf")
|
||||
sinf :: proc "c" (v: f32) -> f32 {
|
||||
return math.sin(v)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="atan2f")
|
||||
atan2f :: proc "c" (v: f32, v2: f32) -> f32 {
|
||||
return math.atan2(v, v2)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="isnan")
|
||||
isnan :: proc "c" (v: f32) -> bool {
|
||||
return math.is_nan(v)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="isinf")
|
||||
isinf :: proc "c" (v: f32) -> bool {
|
||||
return math.is_inf(v)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="sqrt")
|
||||
sqrt :: proc "c" (x: f64) -> f64 {
|
||||
return math.sqrt(x)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="floor")
|
||||
floor :: proc "c" (x: f64) -> f64 {
|
||||
return math.floor(x)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="ceil")
|
||||
ceil :: proc "c" (x: f64) -> f64 {
|
||||
return math.ceil(x)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="pow")
|
||||
pow :: proc "c" (x, y: f64) -> f64 {
|
||||
return math.pow(x, y)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="fmod")
|
||||
fmod :: proc "c" (x, y: f64) -> f64 {
|
||||
return math.mod(x, y)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="cos")
|
||||
cos :: proc "c" (x: f64) -> f64 {
|
||||
return math.cos(x)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="acos")
|
||||
acos :: proc "c" (x: f64) -> f64 {
|
||||
return math.acos(x)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="fabs")
|
||||
fabs :: proc "c" (x: f64) -> f64 {
|
||||
return math.abs(x)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="abs")
|
||||
abs :: proc "c" (x: i32) -> i32 {
|
||||
return builtin.abs(x)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="ldexp")
|
||||
ldexp :: proc "c" (x: f64, y: i32) -> f64{
|
||||
return math.ldexp(x, int(y))
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="exp")
|
||||
exp :: proc "c" (x: f64) -> f64 {
|
||||
return math.exp(x)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="log")
|
||||
log :: proc "c" (x: f32) -> f32 {
|
||||
return math.ln(x)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="sin")
|
||||
sin :: proc "c" (x: f32) -> f32 {
|
||||
return math.sin(x)
|
||||
}
|
||||
Vendored
+106
@@ -0,0 +1,106 @@
|
||||
package odin_libc
|
||||
|
||||
import "core:c"
|
||||
import "core:io"
|
||||
import "core:os"
|
||||
|
||||
import stb "vendor:stb/sprintf"
|
||||
|
||||
FILE :: uintptr
|
||||
|
||||
@(require, linkage="strong", link_name="fopen")
|
||||
fopen :: proc "c" (path: cstring, mode: cstring) -> FILE {
|
||||
context = g_ctx
|
||||
unimplemented("odin_libc.fopen")
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="fseek")
|
||||
fseek :: proc "c" (file: FILE, offset: c.long, whence: i32) -> i32 {
|
||||
context = g_ctx
|
||||
handle := os.Handle(file-1)
|
||||
_, err := os.seek(handle, i64(offset), int(whence))
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="ftell")
|
||||
ftell :: proc "c" (file: FILE) -> c.long {
|
||||
context = g_ctx
|
||||
handle := os.Handle(file-1)
|
||||
off, err := os.seek(handle, 0, os.SEEK_CUR)
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
return c.long(off)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="fclose")
|
||||
fclose :: proc "c" (file: FILE) -> i32 {
|
||||
context = g_ctx
|
||||
handle := os.Handle(file-1)
|
||||
if os.close(handle) != nil {
|
||||
return -1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="fread")
|
||||
fread :: proc "c" (buffer: [^]byte, size: uint, count: uint, file: FILE) -> uint {
|
||||
context = g_ctx
|
||||
handle := os.Handle(file-1)
|
||||
n, _ := os.read(handle, buffer[:min(size, count)])
|
||||
return uint(max(0, n))
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="fwrite")
|
||||
fwrite :: proc "c" (buffer: [^]byte, size: uint, count: uint, file: FILE) -> uint {
|
||||
context = g_ctx
|
||||
handle := os.Handle(file-1)
|
||||
n, _ := os.write(handle, buffer[:min(size, count)])
|
||||
return uint(max(0, n))
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="vsnprintf")
|
||||
vsnprintf :: proc "c" (buf: [^]byte, count: uint, fmt: cstring, args: ^c.va_list) -> i32 {
|
||||
i32_count := i32(count)
|
||||
assert_contextless(i32_count >= 0)
|
||||
return stb.vsnprintf(buf, i32_count, fmt, args)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="vfprintf")
|
||||
vfprintf :: proc "c" (file: FILE, fmt: cstring, args: ^c.va_list) -> i32 {
|
||||
context = g_ctx
|
||||
|
||||
handle := os.Handle(file-1)
|
||||
|
||||
MAX_STACK :: 4096
|
||||
|
||||
buf: []byte
|
||||
stack_buf: [MAX_STACK]byte = ---
|
||||
{
|
||||
n := stb.vsnprintf(&stack_buf[0], MAX_STACK, fmt, args)
|
||||
if n <= 0 {
|
||||
return n
|
||||
}
|
||||
|
||||
if n >= MAX_STACK {
|
||||
buf = make([]byte, n)
|
||||
n2 := stb.vsnprintf(raw_data(buf), i32(len(buf)), fmt, args)
|
||||
assert(n == n2)
|
||||
} else {
|
||||
buf = stack_buf[:n]
|
||||
}
|
||||
}
|
||||
defer if len(buf) > MAX_STACK {
|
||||
delete(buf)
|
||||
}
|
||||
|
||||
_, err := io.write_full(os.stream_from_handle(handle), buf)
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
|
||||
return i32(len(buf))
|
||||
}
|
||||
Vendored
+119
@@ -0,0 +1,119 @@
|
||||
package odin_libc
|
||||
|
||||
import "base:runtime"
|
||||
|
||||
import "core:c"
|
||||
import "core:slice"
|
||||
import "core:sort"
|
||||
import "core:strconv"
|
||||
import "core:strings"
|
||||
|
||||
@(require, linkage="strong", link_name="malloc")
|
||||
malloc :: proc "c" (size: uint) -> rawptr {
|
||||
context = g_ctx
|
||||
ptr, err := runtime.mem_alloc_non_zeroed(int(size))
|
||||
assert(err == nil, "allocation failure")
|
||||
return raw_data(ptr)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="aligned_alloc")
|
||||
aligned_alloc :: proc "c" (alignment: uint, size: uint) -> rawptr {
|
||||
context = g_ctx
|
||||
ptr, err := runtime.mem_alloc_non_zeroed(int(size), int(alignment))
|
||||
assert(err == nil, "allocation failure")
|
||||
return raw_data(ptr)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="free")
|
||||
free :: proc "c" (ptr: rawptr) {
|
||||
context = g_ctx
|
||||
runtime.mem_free(ptr)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="realloc")
|
||||
realloc :: proc "c" (ptr: rawptr, new_size: uint) -> rawptr {
|
||||
context = g_ctx
|
||||
// -1 for the old_size, assumed to be wrapped with the mem.Compat_Allocator to get the right size.
|
||||
// Note that realloc does not actually care about alignment and is allowed to just align it to something
|
||||
// else than the original allocation.
|
||||
ptr, err := runtime.non_zero_mem_resize(ptr, -1, int(new_size))
|
||||
assert(err == nil, "realloc failure")
|
||||
return raw_data(ptr)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="qsort")
|
||||
qsort :: proc "c" (base: rawptr, num: uint, size: uint, cmp: proc "c" (a, b: rawptr) -> i32) {
|
||||
context = g_ctx
|
||||
|
||||
Inputs :: struct {
|
||||
base: rawptr,
|
||||
num: uint,
|
||||
size: uint,
|
||||
cmp: proc "c" (a, b: rawptr) -> i32,
|
||||
}
|
||||
|
||||
sort.sort({
|
||||
collection = &Inputs{base, num, size, cmp},
|
||||
len = proc(it: sort.Interface) -> int {
|
||||
inputs := (^Inputs)(it.collection)
|
||||
return int(inputs.num)
|
||||
},
|
||||
less = proc(it: sort.Interface, i, j: int) -> bool {
|
||||
inputs := (^Inputs)(it.collection)
|
||||
a := rawptr(uintptr(inputs.base) + (uintptr(i) * uintptr(inputs.size)))
|
||||
b := rawptr(uintptr(inputs.base) + (uintptr(j) * uintptr(inputs.size)))
|
||||
return inputs.cmp(a, b) < 0
|
||||
},
|
||||
swap = proc(it: sort.Interface, i, j: int) {
|
||||
inputs := (^Inputs)(it.collection)
|
||||
|
||||
a := rawptr(uintptr(inputs.base) + (uintptr(i) * uintptr(inputs.size)))
|
||||
b := rawptr(uintptr(inputs.base) + (uintptr(j) * uintptr(inputs.size)))
|
||||
|
||||
slice.ptr_swap_non_overlapping(a, b, int(inputs.size))
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="atoi")
|
||||
atoi :: proc "c" (str: cstring) -> i32 {
|
||||
return i32(atoll(str))
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="atol")
|
||||
atol :: proc "c" (str: cstring) -> c.long {
|
||||
return c.long(atoll(str))
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="atoll")
|
||||
atoll :: proc "c" (str: cstring) -> c.longlong {
|
||||
context = g_ctx
|
||||
|
||||
sstr := string(str)
|
||||
sstr = strings.trim_left_space(sstr)
|
||||
i, _ := strconv.parse_i64_of_base(sstr, 10)
|
||||
return c.longlong(i)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="atof")
|
||||
atof :: proc "c" (str: cstring) -> f64 {
|
||||
context = g_ctx
|
||||
|
||||
sstr := string(str)
|
||||
sstr = strings.trim_left_space(sstr)
|
||||
f, _ := strconv.parse_f64(sstr)
|
||||
return f
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="strtol")
|
||||
strtol :: proc "c" (str: cstring, str_end: ^cstring, base: i32) -> c.long {
|
||||
context = g_ctx
|
||||
|
||||
sstr := string(str)
|
||||
sstr = strings.trim_left_space(sstr)
|
||||
|
||||
n: int
|
||||
i, _ := strconv.parse_i64_of_base(sstr, int(base), &n)
|
||||
str_end ^= cstring(raw_data(sstr)[n:])
|
||||
return c.long(clamp(i, i64(min(c.long)), i64(max(c.long))))
|
||||
}
|
||||
Vendored
+111
@@ -0,0 +1,111 @@
|
||||
package odin_libc
|
||||
|
||||
import "base:intrinsics"
|
||||
|
||||
import "core:c"
|
||||
import "core:strings"
|
||||
import "core:mem"
|
||||
|
||||
// NOTE: already defined by Odin.
|
||||
// void *memcpy(void *, const void *, size_t);
|
||||
// void *memset(void *, int, size_t);
|
||||
|
||||
@(require, linkage="strong", link_name="memcmp")
|
||||
memcmp :: proc "c" (lhs: [^]byte, rhs: [^]byte, count: uint) -> i32 {
|
||||
icount := int(count)
|
||||
assert_contextless(icount >= 0)
|
||||
return i32(mem.compare(lhs[:icount], rhs[:icount]))
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="strlen")
|
||||
strlen :: proc "c" (str: cstring) -> c.ulong {
|
||||
return c.ulong(len(str))
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="strchr")
|
||||
strchr :: proc "c" (str: cstring, ch: i32) -> cstring {
|
||||
bch := u8(ch)
|
||||
sstr := string(str)
|
||||
if bch == 0 {
|
||||
return cstring(raw_data(sstr)[len(sstr):])
|
||||
}
|
||||
|
||||
idx := strings.index_byte(sstr, bch)
|
||||
if idx < 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return cstring(raw_data(sstr)[idx:])
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="strrchr")
|
||||
strrchr :: proc "c" (str: cstring, ch: i32) -> cstring {
|
||||
bch := u8(ch)
|
||||
sstr := string(str)
|
||||
if bch == 0 {
|
||||
return cstring(raw_data(sstr)[len(sstr):])
|
||||
}
|
||||
|
||||
idx := strings.last_index_byte(sstr, bch)
|
||||
if idx < 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return cstring(raw_data(sstr)[idx:])
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="strncpy")
|
||||
strncpy :: proc "c" (dst: [^]byte, src: cstring, count: uint) -> cstring {
|
||||
icount := int(count)
|
||||
assert_contextless(icount >= 0)
|
||||
cnt := min(len(src), icount)
|
||||
intrinsics.mem_copy_non_overlapping(dst, rawptr(src), cnt)
|
||||
intrinsics.mem_zero(dst, icount-cnt)
|
||||
return cstring(dst)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="strcpy")
|
||||
strcpy :: proc "c" (dst: [^]byte, src: cstring) -> cstring {
|
||||
intrinsics.mem_copy_non_overlapping(dst, rawptr(src), len(src)+1)
|
||||
return cstring(dst)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="strcspn")
|
||||
strcspn :: proc "c" (dst: cstring, src: cstring) -> uint {
|
||||
context = g_ctx
|
||||
sdst := string(dst)
|
||||
idx := strings.index_any(sdst, string(src))
|
||||
if idx == -1 {
|
||||
return len(sdst)
|
||||
}
|
||||
return uint(idx)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="strncmp")
|
||||
strncmp :: proc "c" (lhs: cstring, rhs: cstring, count: uint) -> i32 {
|
||||
icount := int(count)
|
||||
assert_contextless(icount >= 0)
|
||||
lhss := strings.string_from_null_terminated_ptr(([^]byte)(lhs), icount)
|
||||
rhss := strings.string_from_null_terminated_ptr(([^]byte)(rhs), icount)
|
||||
return i32(strings.compare(lhss, rhss))
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="strcmp")
|
||||
strcmp :: proc "c" (lhs: cstring, rhs: cstring) -> i32 {
|
||||
return i32(strings.compare(string(lhs), string(rhs)))
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="strstr")
|
||||
strstr :: proc "c" (str: cstring, substr: cstring) -> cstring {
|
||||
if substr == "" {
|
||||
return str
|
||||
}
|
||||
|
||||
idx := strings.index(string(str), string(substr))
|
||||
if idx < 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return cstring(([^]byte)(str)[idx:])
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build !windows
|
||||
#+build !windows
|
||||
package miniaudio
|
||||
|
||||
import "core:sys/unix"
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build windows, linux, darwin
|
||||
#+build windows, linux, darwin
|
||||
package nanovg_gl
|
||||
|
||||
import "core:log"
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build windows, linux, darwin
|
||||
#+build windows, linux, darwin
|
||||
package nanovg
|
||||
|
||||
// TODO rename structs to old nanovg style!
|
||||
|
||||
Vendored
+1
-1
@@ -861,7 +861,7 @@ NPatchLayout :: enum c.int {
|
||||
|
||||
// Callbacks to hook some internal functions
|
||||
// WARNING: This callbacks are intended for advance users
|
||||
TraceLogCallback :: #type proc "c" (logLevel: TraceLogLevel, text: cstring, args: c.va_list) // Logging: Redirect trace log messages
|
||||
TraceLogCallback :: #type proc "c" (logLevel: TraceLogLevel, text: cstring, args: ^c.va_list) // Logging: Redirect trace log messages
|
||||
LoadFileDataCallback :: #type proc "c"(fileName: cstring, dataSize: ^c.int) -> [^]u8 // FileIO: Load binary data
|
||||
SaveFileDataCallback :: #type proc "c" (fileName: cstring, data: rawptr, dataSize: c.int) -> bool // FileIO: Save binary data
|
||||
LoadFileTextCallback :: #type proc "c" (fileName: cstring) -> [^]u8 // FileIO: Load text data
|
||||
|
||||
Vendored
+1
@@ -438,6 +438,7 @@ foreign lib {
|
||||
BlitFramebuffer :: proc(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask: c.int) --- // Blit active framebuffer to main framebuffer
|
||||
|
||||
// General render state
|
||||
EnableColorBlend :: proc() --- // Enable color blending
|
||||
DisableColorBlend :: proc() --- // Disable color blending
|
||||
EnableDepthTest :: proc() --- // Enable depth test
|
||||
DisableDepthTest :: proc() --- // Disable depth test
|
||||
|
||||
Vendored
+43
-13
@@ -7,6 +7,7 @@ LIB :: (
|
||||
"../lib/stb_image.lib" when ODIN_OS == .Windows
|
||||
else "../lib/stb_image.a" when ODIN_OS == .Linux
|
||||
else "../lib/darwin/stb_image.a" when ODIN_OS == .Darwin
|
||||
else "../lib/stb_image_wasm.o" when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32
|
||||
else ""
|
||||
)
|
||||
|
||||
@@ -15,12 +16,18 @@ when LIB != "" {
|
||||
// The STB libraries are shipped with the compiler on Windows so a Windows specific message should not be needed.
|
||||
#panic("Could not find the compiled STB libraries, they can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/stb/src\"`")
|
||||
}
|
||||
}
|
||||
|
||||
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
foreign import stbi "../lib/stb_image_wasm.o"
|
||||
} else when LIB != "" {
|
||||
foreign import stbi { LIB }
|
||||
} else {
|
||||
foreign import stbi "system:stb_image"
|
||||
}
|
||||
|
||||
NO_STDIO :: ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32
|
||||
|
||||
#assert(size_of(c.int) == size_of(b32))
|
||||
#assert(size_of(b32) == size_of(c.int))
|
||||
|
||||
@@ -33,14 +40,48 @@ Io_Callbacks :: struct {
|
||||
eof: proc "c" (user: rawptr) -> c.int, // returns nonzero if we are at end of file/data
|
||||
}
|
||||
|
||||
when !NO_STDIO {
|
||||
@(default_calling_convention="c", link_prefix="stbi_")
|
||||
foreign stbi {
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 8-bits-per-channel interface
|
||||
//
|
||||
load :: proc(filename: cstring, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]byte ---
|
||||
load_from_file :: proc(f: ^c.FILE, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]byte ---
|
||||
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 16-bits-per-channel interface
|
||||
//
|
||||
load_16 :: proc(filename: cstring, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]u16 ---
|
||||
load_16_from_file :: proc(f: ^c.FILE, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]u16 ---
|
||||
|
||||
////////////////////////////////////
|
||||
//
|
||||
// float-per-channel interface
|
||||
//
|
||||
loadf :: proc(filename: cstring, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]f32 ---
|
||||
loadf_from_file :: proc(f: ^c.FILE, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]f32 ---
|
||||
|
||||
is_hdr :: proc(filename: cstring) -> c.int ---
|
||||
is_hdr_from_file :: proc(f: ^c.FILE) -> c.int ---
|
||||
|
||||
// get image dimensions & components without fully decoding
|
||||
info :: proc(filename: cstring, x, y, comp: ^c.int) -> c.int ---
|
||||
info_from_file :: proc(f: ^c.FILE, x, y, comp: ^c.int) -> c.int ---
|
||||
|
||||
is_16_bit :: proc(filename: cstring) -> b32 ---
|
||||
is_16_bit_from_file :: proc(f: ^c.FILE) -> b32 ---
|
||||
}
|
||||
}
|
||||
|
||||
@(default_calling_convention="c", link_prefix="stbi_")
|
||||
foreign stbi {
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 8-bits-per-channel interface
|
||||
//
|
||||
load :: proc(filename: cstring, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]byte ---
|
||||
load_from_file :: proc(f: ^c.FILE, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]byte ---
|
||||
load_from_memory :: proc(buffer: [^]byte, len: c.int, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]byte ---
|
||||
load_from_callbacks :: proc(clbk: ^Io_Callbacks, user: rawptr, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]byte ---
|
||||
|
||||
@@ -50,8 +91,6 @@ foreign stbi {
|
||||
//
|
||||
// 16-bits-per-channel interface
|
||||
//
|
||||
load_16 :: proc(filename: cstring, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]u16 ---
|
||||
load_16_from_file :: proc(f: ^c.FILE, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]u16 ---
|
||||
load_16_from_memory :: proc(buffer: [^]byte, len: c.int, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]u16 ---
|
||||
load_16_from_callbacks :: proc(clbk: ^Io_Callbacks, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]u16 ---
|
||||
|
||||
@@ -59,8 +98,6 @@ foreign stbi {
|
||||
//
|
||||
// float-per-channel interface
|
||||
//
|
||||
loadf :: proc(filename: cstring, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]f32 ---
|
||||
loadf_from_file :: proc(f: ^c.FILE, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]f32 ---
|
||||
loadf_from_memory :: proc(buffer: [^]byte, len: c.int, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]f32 ---
|
||||
loadf_from_callbacks :: proc(clbk: ^Io_Callbacks, user: rawptr, x, y, channels_in_file: ^c.int, desired_channels: c.int) -> [^]f32 ---
|
||||
|
||||
@@ -73,9 +110,6 @@ foreign stbi {
|
||||
is_hdr_from_callbacks :: proc(clbk: ^Io_Callbacks, user: rawptr) -> c.int ---
|
||||
is_hdr_from_memory :: proc(buffer: [^]byte, len: c.int) -> c.int ---
|
||||
|
||||
is_hdr :: proc(filename: cstring) -> c.int ---
|
||||
is_hdr_from_file :: proc(f: ^c.FILE) -> c.int ---
|
||||
|
||||
// get a VERY brief reason for failure
|
||||
// NOT THREADSAFE
|
||||
failure_reason :: proc() -> cstring ---
|
||||
@@ -84,13 +118,9 @@ foreign stbi {
|
||||
image_free :: proc(retval_from_load: rawptr) ---
|
||||
|
||||
// get image dimensions & components without fully decoding
|
||||
info :: proc(filename: cstring, x, y, comp: ^c.int) -> c.int ---
|
||||
info_from_file :: proc(f: ^c.FILE, x, y, comp: ^c.int) -> c.int ---
|
||||
info_from_memory :: proc(buffer: [^]byte, len: c.int, x, y, comp: ^c.int) -> c.int ---
|
||||
info_from_callbacks :: proc(clbk: ^Io_Callbacks, user: rawptr, x, y, comp: ^c.int) -> c.int ---
|
||||
|
||||
is_16_bit :: proc(filename: cstring) -> b32 ---
|
||||
is_16_bit_from_file :: proc(f: ^c.FILE) -> b32 ---
|
||||
is_16_bit_from_memory :: proc(buffer: [^]byte, len: c.int) -> c.int ---
|
||||
|
||||
// for image formats that explicitly notate that they have premultiplied alpha,
|
||||
|
||||
+6
-1
@@ -1,12 +1,13 @@
|
||||
package stb_image
|
||||
|
||||
import c "core:c/libc"
|
||||
import "core:c"
|
||||
|
||||
@(private)
|
||||
RESIZE_LIB :: (
|
||||
"../lib/stb_image_resize.lib" when ODIN_OS == .Windows
|
||||
else "../lib/stb_image_resize.a" when ODIN_OS == .Linux
|
||||
else "../lib/darwin/stb_image_resize.a" when ODIN_OS == .Darwin
|
||||
else "../lib/stb_image_resize_wasm.o" when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32
|
||||
else ""
|
||||
)
|
||||
|
||||
@@ -15,7 +16,11 @@ when RESIZE_LIB != "" {
|
||||
// The STB libraries are shipped with the compiler on Windows so a Windows specific message should not be needed.
|
||||
#panic("Could not find the compiled STB libraries, they can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/stb/src\"`")
|
||||
}
|
||||
}
|
||||
|
||||
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
foreign import lib "../lib/stb_image_resize_wasm.o"
|
||||
} else when RESIZE_LIB != "" {
|
||||
foreign import lib { RESIZE_LIB }
|
||||
} else {
|
||||
foreign import lib "system:stb_image_resize"
|
||||
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
#+build wasm32, wasm64p32
|
||||
package stb_image
|
||||
|
||||
@(require) import _ "vendor:libc"
|
||||
+17
-7
@@ -1,12 +1,13 @@
|
||||
package stb_image
|
||||
|
||||
import c "core:c/libc"
|
||||
import "core:c"
|
||||
|
||||
@(private)
|
||||
WRITE_LIB :: (
|
||||
"../lib/stb_image_write.lib" when ODIN_OS == .Windows
|
||||
else "../lib/stb_image_write.a" when ODIN_OS == .Linux
|
||||
else "../lib/darwin/stb_image_write.a" when ODIN_OS == .Darwin
|
||||
else "../lib/stb_image_write_wasm.o" when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32
|
||||
else ""
|
||||
)
|
||||
|
||||
@@ -15,7 +16,11 @@ when WRITE_LIB != "" {
|
||||
// The STB libraries are shipped with the compiler on Windows so a Windows specific message should not be needed.
|
||||
#panic("Could not find the compiled STB libraries, they can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/stb/src\"`")
|
||||
}
|
||||
}
|
||||
|
||||
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
foreign import stbiw "../lib/stb_image_write_wasm.o"
|
||||
} else when WRITE_LIB != "" {
|
||||
foreign import stbiw { WRITE_LIB }
|
||||
} else {
|
||||
foreign import stbiw "system:stb_image_write"
|
||||
@@ -25,12 +30,6 @@ write_func :: proc "c" (ctx: rawptr, data: rawptr, size: c.int)
|
||||
|
||||
@(default_calling_convention="c", link_prefix="stbi_")
|
||||
foreign stbiw {
|
||||
write_png :: proc(filename: cstring, w, h, comp: c.int, data: rawptr, stride_in_bytes: c.int) -> c.int ---
|
||||
write_bmp :: proc(filename: cstring, w, h, comp: c.int, data: rawptr) -> c.int ---
|
||||
write_tga :: proc(filename: cstring, w, h, comp: c.int, data: rawptr) -> c.int ---
|
||||
write_hdr :: proc(filename: cstring, w, h, comp: c.int, data: [^]f32) -> c.int ---
|
||||
write_jpg :: proc(filename: cstring, w, h, comp: c.int, data: rawptr, quality: c.int /*0..=100*/) -> c.int ---
|
||||
|
||||
write_png_to_func :: proc(func: write_func, ctx: rawptr, w, h, comp: c.int, data: rawptr, stride_in_bytes: c.int) -> c.int ---
|
||||
write_bmp_to_func :: proc(func: write_func, ctx: rawptr, w, h, comp: c.int, data: rawptr) -> c.int ---
|
||||
write_tga_to_func :: proc(func: write_func, ctx: rawptr, w, h, comp: c.int, data: rawptr) -> c.int ---
|
||||
@@ -39,3 +38,14 @@ foreign stbiw {
|
||||
|
||||
flip_vertically_on_write :: proc(flip_boolean: b32) ---
|
||||
}
|
||||
|
||||
when !NO_STDIO {
|
||||
@(default_calling_convention="c", link_prefix="stbi_")
|
||||
foreign stbiw {
|
||||
write_png :: proc(filename: cstring, w, h, comp: c.int, data: rawptr, stride_in_bytes: c.int) -> c.int ---
|
||||
write_bmp :: proc(filename: cstring, w, h, comp: c.int, data: rawptr) -> c.int ---
|
||||
write_tga :: proc(filename: cstring, w, h, comp: c.int, data: rawptr) -> c.int ---
|
||||
write_hdr :: proc(filename: cstring, w, h, comp: c.int, data: [^]f32) -> c.int ---
|
||||
write_jpg :: proc(filename: cstring, w, h, comp: c.int, data: rawptr, quality: c.int /*0..=100*/) -> c.int ---
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
+5
@@ -9,6 +9,7 @@ LIB :: (
|
||||
"../lib/stb_rect_pack.lib" when ODIN_OS == .Windows
|
||||
else "../lib/stb_rect_pack.a" when ODIN_OS == .Linux
|
||||
else "../lib/darwin/stb_rect_pack.a" when ODIN_OS == .Darwin
|
||||
else "../lib/stb_rect_pack_wasm.o" when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32
|
||||
else ""
|
||||
)
|
||||
|
||||
@@ -16,7 +17,11 @@ when LIB != "" {
|
||||
when !#exists(LIB) {
|
||||
#panic("Could not find the compiled STB libraries, they can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/stb/src\"`")
|
||||
}
|
||||
}
|
||||
|
||||
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
foreign import lib "../lib/stb_rect_pack_wasm.o"
|
||||
} else when LIB != "" {
|
||||
foreign import lib { LIB }
|
||||
} else {
|
||||
foreign import lib "system:stb_rect_pack"
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#+build wasm32, wasm64p32
|
||||
package stb_rect_pack
|
||||
|
||||
@(require) import _ "vendor:libc"
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
package stb_sprintf
|
||||
|
||||
import "core:c"
|
||||
|
||||
@(private)
|
||||
LIB :: (
|
||||
"../lib/stb_sprintf.lib" when ODIN_OS == .Windows
|
||||
else "../lib/stb_sprintf.a" when ODIN_OS == .Linux
|
||||
else "../lib/darwin/stb_sprintf.a" when ODIN_OS == .Darwin
|
||||
else "../lib/stb_sprintf_wasm.o" when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32
|
||||
else ""
|
||||
)
|
||||
|
||||
when LIB != "" {
|
||||
when !#exists(LIB) {
|
||||
#panic("Could not find the compiled STB libraries, they can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/stb/src\"`")
|
||||
}
|
||||
}
|
||||
|
||||
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
foreign import stbpf "../lib/stb_sprintf_wasm.o"
|
||||
} else when LIB != "" {
|
||||
foreign import stbpf { LIB }
|
||||
} else {
|
||||
foreign import stbpf "system:stb_sprintf"
|
||||
}
|
||||
|
||||
@(link_prefix="stbsp_", default_calling_convention="c")
|
||||
foreign stbpf {
|
||||
sprintf :: proc(buf: [^]byte, fmt: cstring, #c_vararg args: ..any) -> i32 ---
|
||||
snprintf :: proc(buf: [^]byte, count: i32, fmt: cstring, #c_vararg args: ..any) -> i32 ---
|
||||
vsprintf :: proc(buf: [^]byte, fmt: cstring, va: ^c.va_list) -> i32 ---
|
||||
vsnprintf :: proc(buf: [^]byte, count: i32, fmt: cstring, va: ^c.va_list) -> i32 ---
|
||||
vsprintfcb :: proc(callback: SPRINTFCB, user: rawptr, buf: [^]byte, fmt: cstring, va: ^c.va_list) -> i32 ---
|
||||
}
|
||||
|
||||
SPRINTFCB :: #type proc "c" (buf: [^]byte, user: rawptr, len: i32) -> cstring
|
||||
Vendored
+12
-2
@@ -8,17 +8,24 @@ endif
|
||||
|
||||
wasm:
|
||||
mkdir -p ../lib
|
||||
$(CC) -c -Os --target=wasm32 -nostdlib stb_truetype_wasm.c -o ../lib/stb_truetype_wasm.o
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc stb_image.c -o ../lib/stb_image_wasm.o -DSTBI_NO_STDIO
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc stb_image_write.c -o ../lib/stb_image_write_wasm.o -DSTBI_WRITE_NO_STDIO
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc stb_image_resize.c -o ../lib/stb_image_resize_wasm.o
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc stb_truetype.c -o ../lib/stb_truetype_wasm.o
|
||||
# $(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc stb_vorbis.c -o ../lib/stb_vorbis_wasm.o -DSTB_VORBIS_NO_STDIO
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc stb_rect_pack.c -o ../lib/stb_rect_pack_wasm.o
|
||||
$(CC) -c -Os --target=wasm32 stb_sprintf.c -o ../lib/stb_sprintf_wasm.o
|
||||
|
||||
unix:
|
||||
mkdir -p ../lib
|
||||
$(CC) -c -O2 -Os -fPIC stb_image.c stb_image_write.c stb_image_resize.c stb_truetype.c stb_rect_pack.c stb_vorbis.c
|
||||
$(CC) -c -O2 -Os -fPIC stb_image.c stb_image_write.c stb_image_resize.c stb_truetype.c stb_rect_pack.c stb_vorbis.c stb_sprintf.c
|
||||
$(AR) rcs ../lib/stb_image.a stb_image.o
|
||||
$(AR) rcs ../lib/stb_image_write.a stb_image_write.o
|
||||
$(AR) rcs ../lib/stb_image_resize.a stb_image_resize.o
|
||||
$(AR) rcs ../lib/stb_truetype.a stb_truetype.o
|
||||
$(AR) rcs ../lib/stb_rect_pack.a stb_rect_pack.o
|
||||
$(AR) rcs ../lib/stb_vorbis.a stb_vorbis.o
|
||||
$(AR) rcs ../lib/stb_sprintf.a stb_sprintf.o
|
||||
#$(CC) -fPIC -shared -Wl,-soname=stb_image.so -o ../lib/stb_image.so stb_image.o
|
||||
#$(CC) -fPIC -shared -Wl,-soname=stb_image_write.so -o ../lib/stb_image_write.so stb_image_write.o
|
||||
#$(CC) -fPIC -shared -Wl,-soname=stb_image_resize.so -o ../lib/stb_image_resize.so stb_image_resize.o
|
||||
@@ -47,4 +54,7 @@ darwin:
|
||||
$(CC) -arch x86_64 -c -O2 -Os -fPIC stb_vorbis.c -o stb_vorbis-x86_64.o -mmacosx-version-min=10.12
|
||||
$(CC) -arch arm64 -c -O2 -Os -fPIC stb_vorbis.c -o stb_vorbis-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_vorbis-x86_64.o stb_vorbis-arm64.o -output ../lib/darwin/stb_vorbis.a
|
||||
$(CC) -arch x86_64 -c -O2 -Os -fPIC stb_sprintf.c -o stb_sprintf-x86_64.o -mmacosx-version-min=10.12
|
||||
$(CC) -arch arm64 -c -O2 -Os -fPIC stb_sprintf.c -o stb_sprintf-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_sprintf-x86_64.o stb_sprintf-arm64.o -output ../lib/darwin/stb_sprintf.a
|
||||
rm *.o
|
||||
|
||||
Vendored
+2
-1
@@ -2,12 +2,13 @@
|
||||
|
||||
if not exist "..\lib" mkdir ..\lib
|
||||
|
||||
cl -nologo -MT -TC -O2 -c stb_image.c stb_image_write.c stb_image_resize.c stb_truetype.c stb_rect_pack.c stb_vorbis.c
|
||||
cl -nologo -MT -TC -O2 -c stb_image.c stb_image_write.c stb_image_resize.c stb_truetype.c stb_rect_pack.c stb_vorbis.c stb_sprintf.c
|
||||
lib -nologo stb_image.obj -out:..\lib\stb_image.lib
|
||||
lib -nologo stb_image_write.obj -out:..\lib\stb_image_write.lib
|
||||
lib -nologo stb_image_resize.obj -out:..\lib\stb_image_resize.lib
|
||||
lib -nologo stb_truetype.obj -out:..\lib\stb_truetype.lib
|
||||
lib -nologo stb_rect_pack.obj -out:..\lib\stb_rect_pack.lib
|
||||
lib -nologo stb_vorbis.obj -out:..\lib\stb_vorbis.lib
|
||||
lib -nologo stb_sprintf.obj -out:..\lib\stb_sprintf.lib
|
||||
|
||||
del *.obj
|
||||
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
#define STB_SPRINTF_IMPLEMENTATION
|
||||
#include "stb_sprintf.h"
|
||||
Vendored
+1906
File diff suppressed because it is too large
Load Diff
Vendored
-46
@@ -1,46 +0,0 @@
|
||||
#include <stddef.h>
|
||||
|
||||
void *stbtt_malloc(size_t size);
|
||||
void stbtt_free(void *ptr);
|
||||
|
||||
void stbtt_qsort(void* base, size_t num, size_t size, int (*compare)(const void*, const void*));
|
||||
|
||||
double stbtt_floor(double x);
|
||||
double stbtt_ceil(double x);
|
||||
double stbtt_sqrt(double x);
|
||||
double stbtt_pow(double x, double y);
|
||||
double stbtt_fmod(double x, double y);
|
||||
double stbtt_cos(double x);
|
||||
double stbtt_acos(double x);
|
||||
double stbtt_fabs(double x);
|
||||
|
||||
unsigned long stbtt_strlen(const char *str);
|
||||
|
||||
void *memcpy(void *dst, const void *src, size_t count);
|
||||
void *memset(void *dst, int x, size_t count);
|
||||
|
||||
#define STBRP_SORT stbtt_qsort
|
||||
#define STBRP_ASSERT(condition) ((void)0)
|
||||
|
||||
#define STBTT_malloc(x,u) ((void)(u),stbtt_malloc(x))
|
||||
#define STBTT_free(x,u) ((void)(u),stbtt_free(x))
|
||||
|
||||
#define STBTT_assert(condition) ((void)0)
|
||||
|
||||
#define STBTT_ifloor(x) ((int) stbtt_floor(x))
|
||||
#define STBTT_iceil(x) ((int) stbtt_ceil(x))
|
||||
#define STBTT_sqrt(x) stbtt_sqrt(x)
|
||||
#define STBTT_pow(x,y) stbtt_pow(x,y)
|
||||
#define STBTT_fmod(x,y) stbtt_fmod(x,y)
|
||||
#define STBTT_cos(x) stbtt_cos(x)
|
||||
#define STBTT_acos(x) stbtt_acos(x)
|
||||
#define STBTT_fabs(x) stbtt_fabs(x)
|
||||
#define STBTT_strlen(x) stbtt_strlen(x)
|
||||
#define STBTT_memcpy memcpy
|
||||
#define STBTT_memset memset
|
||||
|
||||
#define STB_RECT_PACK_IMPLEMENTATION
|
||||
#include "stb_rect_pack.h"
|
||||
|
||||
#define STB_TRUETYPE_IMPLEMENTATION
|
||||
#include "stb_truetype.h"
|
||||
+5
-2
@@ -8,6 +8,7 @@ LIB :: (
|
||||
"../lib/stb_truetype.lib" when ODIN_OS == .Windows
|
||||
else "../lib/stb_truetype.a" when ODIN_OS == .Linux
|
||||
else "../lib/darwin/stb_truetype.a" when ODIN_OS == .Darwin
|
||||
else "../lib/stb_truetype_wasm.o" when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32
|
||||
else ""
|
||||
)
|
||||
|
||||
@@ -15,10 +16,12 @@ when LIB != "" {
|
||||
when !#exists(LIB) {
|
||||
#panic("Could not find the compiled STB libraries, they can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/stb/src\"`")
|
||||
}
|
||||
}
|
||||
|
||||
foreign import stbtt { LIB }
|
||||
} else when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
foreign import stbtt "../lib/stb_truetype_wasm.o"
|
||||
} else when LIB != "" {
|
||||
foreign import stbtt { LIB }
|
||||
} else {
|
||||
foreign import stbtt "system:stb_truetype"
|
||||
}
|
||||
|
||||
+2
-80
@@ -1,82 +1,4 @@
|
||||
//+build wasm32, wasm64p32
|
||||
#+build wasm32, wasm64p32
|
||||
package stb_truetype
|
||||
|
||||
import "base:builtin"
|
||||
import "base:intrinsics"
|
||||
import "base:runtime"
|
||||
|
||||
import "core:c"
|
||||
import "core:math"
|
||||
import "core:slice"
|
||||
import "core:sort"
|
||||
|
||||
@(require, linkage="strong", link_name="stbtt_malloc")
|
||||
malloc :: proc "c" (size: uint) -> rawptr {
|
||||
context = runtime.default_context()
|
||||
ptr, _ := runtime.mem_alloc_non_zeroed(int(size))
|
||||
return raw_data(ptr)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="stbtt_free")
|
||||
free :: proc "c" (ptr: rawptr) {
|
||||
context = runtime.default_context()
|
||||
builtin.free(ptr)
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="stbtt_qsort")
|
||||
qsort :: proc "c" (base: rawptr, num: uint, size: uint, cmp: proc "c" (a, b: rawptr) -> i32) {
|
||||
context = runtime.default_context()
|
||||
|
||||
Inputs :: struct {
|
||||
base: rawptr,
|
||||
num: uint,
|
||||
size: uint,
|
||||
cmp: proc "c" (a, b: rawptr) -> i32,
|
||||
}
|
||||
|
||||
sort.sort({
|
||||
collection = &Inputs{base, num, size, cmp},
|
||||
len = proc(it: sort.Interface) -> int {
|
||||
inputs := (^Inputs)(it.collection)
|
||||
return int(inputs.num)
|
||||
},
|
||||
less = proc(it: sort.Interface, i, j: int) -> bool {
|
||||
inputs := (^Inputs)(it.collection)
|
||||
a := rawptr(uintptr(inputs.base) + (uintptr(i) * uintptr(inputs.size)))
|
||||
b := rawptr(uintptr(inputs.base) + (uintptr(j) * uintptr(inputs.size)))
|
||||
return inputs.cmp(a, b) < 0
|
||||
},
|
||||
swap = proc(it: sort.Interface, i, j: int) {
|
||||
inputs := (^Inputs)(it.collection)
|
||||
|
||||
a := rawptr(uintptr(inputs.base) + (uintptr(i) * uintptr(inputs.size)))
|
||||
b := rawptr(uintptr(inputs.base) + (uintptr(j) * uintptr(inputs.size)))
|
||||
|
||||
slice.ptr_swap_non_overlapping(a, b, int(inputs.size))
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@(require, linkage="strong", link_name="stbtt_floor")
|
||||
floor :: proc "c" (x: f64) -> f64 { return math.floor(x) }
|
||||
@(require, linkage="strong", link_name="stbtt_ceil")
|
||||
ceil :: proc "c" (x: f64) -> f64 { return math.ceil(x) }
|
||||
@(require, linkage="strong", link_name="stbtt_sqrt")
|
||||
sqrt :: proc "c" (x: f64) -> f64 { return math.sqrt(x) }
|
||||
@(require, linkage="strong", link_name="stbtt_pow")
|
||||
pow :: proc "c" (x, y: f64) -> f64 { return math.pow(x, y) }
|
||||
@(require, linkage="strong", link_name="stbtt_fmod")
|
||||
fmod :: proc "c" (x, y: f64) -> f64 { return math.mod(x, y) }
|
||||
@(require, linkage="strong", link_name="stbtt_cos")
|
||||
cos :: proc "c" (x: f64) -> f64 { return math.cos(x) }
|
||||
@(require, linkage="strong", link_name="stbtt_acos")
|
||||
acos :: proc "c" (x: f64) -> f64 { return math.acos(x) }
|
||||
@(require, linkage="strong", link_name="stbtt_fabs")
|
||||
fabs :: proc "c" (x: f64) -> f64 { return math.abs(x) }
|
||||
|
||||
@(require, linkage="strong", link_name="stbtt_strlen")
|
||||
strlen :: proc "c" (str: cstring) -> c.ulong { return c.ulong(len(str)) }
|
||||
|
||||
// NOTE: defined in runtime.
|
||||
// void *memcpy(void *dst, const void *src, size_t count);
|
||||
// void *memset(void *dst, int x, size_t count);
|
||||
@(require) import _ "vendor:libc"
|
||||
|
||||
+11
-6
@@ -17,10 +17,14 @@ file_and_urls = [
|
||||
("vulkan_ios.h", 'https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vulkan/vulkan_ios.h', False),
|
||||
("vulkan_wayland.h", 'https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vulkan/vulkan_wayland.h', False),
|
||||
# Vulkan Video
|
||||
("vulkan_video_codec_av1std.h", 'https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_av1std.h', False),
|
||||
("vulkan_video_codec_h264std.h", 'https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_h264std.h', False),
|
||||
("vulkan_video_codec_h265std.h", 'https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_h265std.h', False),
|
||||
("vulkan_video_codec_av1std_decode.h", 'https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_av1std_decode.h', False),
|
||||
("vulkan_video_codec_h264std_decode.h", 'https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_h264std_decode.h', False),
|
||||
("vulkan_video_codec_h265std_decode.h", 'https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_h265std_decode.h', False),
|
||||
("vulkan_video_codec_h264std_encode.h", 'https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_h264std_encode.h', False),
|
||||
("vulkan_video_codec_h265std_encode.h", 'https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_h265std_encode.h', False),
|
||||
]
|
||||
|
||||
for file, url, _ in file_and_urls:
|
||||
@@ -36,15 +40,15 @@ for file, _, skip in file_and_urls:
|
||||
|
||||
|
||||
def no_vk(t):
|
||||
t = t.replace('Vk', '')
|
||||
t = t.replace('PFN_vk_icd', 'Procicd')
|
||||
t = t.replace('PFN_vk', 'Proc')
|
||||
t = t.replace('PFN_', 'Proc')
|
||||
t = t.replace('PFN_', 'Proc')
|
||||
t = t.replace('VK_', '')
|
||||
|
||||
t = re.sub('(?:Vk|VK_)?(\w+)', '\\1', t)
|
||||
# Vulkan Video
|
||||
t = t.replace('STD_', '')
|
||||
t = t.replace('Std', '')
|
||||
|
||||
t = re.sub('(?:Std|STD_)?(\w+)', '\\1', t)
|
||||
return t
|
||||
|
||||
OPAQUE_STRUCTS = """
|
||||
@@ -61,6 +65,7 @@ def convert_type(t, prev_name, curr_name):
|
||||
"uint32_t": 'u32',
|
||||
"uint64_t": 'u64',
|
||||
"size_t": 'int',
|
||||
'int16_t': 'i16',
|
||||
'int32_t': 'i32',
|
||||
'int64_t': 'i64',
|
||||
'int': 'c.int',
|
||||
@@ -298,8 +303,8 @@ def parse_enums(f):
|
||||
f.write("import \"core:c\"\n\n")
|
||||
f.write("// Enums\n")
|
||||
|
||||
data = re.findall(r"typedef enum Vk(\w+) {(.+?)} \w+;", src, re.S)
|
||||
data += re.findall(r"typedef enum Std(\w+) {(.+?)} \w+;", src, re.S)
|
||||
data = re.findall(r"typedef enum (\w+) {(.+?)} \w+;", src, re.S)
|
||||
data = [(no_vk(n), f) for n, f in data]
|
||||
|
||||
data.sort(key=lambda x: x[0])
|
||||
|
||||
|
||||
Vendored
+4
-18
@@ -1,23 +1,9 @@
|
||||
//
|
||||
// File: vk_icd.h
|
||||
//
|
||||
/*
|
||||
* Copyright (c) 2015-2023 LunarG, Inc.
|
||||
* Copyright (c) 2015-2023 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2023 Valve Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2015-2023 The Khronos Group Inc.
|
||||
* Copyright 2015-2023 Valve Corporation
|
||||
* Copyright 2015-2023 LunarG, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
Vendored
+4
-18
@@ -1,23 +1,9 @@
|
||||
//
|
||||
// File: vk_layer.h
|
||||
//
|
||||
/*
|
||||
* Copyright (c) 2015-2023 LunarG, Inc.
|
||||
* Copyright (c) 2015-2023 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2023 Valve Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2015-2023 The Khronos Group Inc.
|
||||
* Copyright 2015-2023 Valve Corporation
|
||||
* Copyright 2015-2023 LunarG, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// File: vk_platform.h
|
||||
//
|
||||
/*
|
||||
** Copyright 2014-2023 The Khronos Group Inc.
|
||||
** Copyright 2014-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
Vendored
+3452
-271
File diff suppressed because it is too large
Load Diff
Vendored
+2
-1
@@ -2,7 +2,7 @@
|
||||
#define VULKAN_IOS_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -19,6 +19,7 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
// VK_MVK_ios_surface is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_MVK_ios_surface 1
|
||||
#define VK_MVK_IOS_SURFACE_SPEC_VERSION 3
|
||||
#define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface"
|
||||
|
||||
Vendored
+2
-1
@@ -2,7 +2,7 @@
|
||||
#define VULKAN_MACOS_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -19,6 +19,7 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
// VK_MVK_macos_surface is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_MVK_macos_surface 1
|
||||
#define VK_MVK_MACOS_SURFACE_SPEC_VERSION 3
|
||||
#define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface"
|
||||
|
||||
Vendored
+9
-7
@@ -2,7 +2,7 @@
|
||||
#define VULKAN_METAL_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -19,6 +19,7 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
// VK_EXT_metal_surface is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_EXT_metal_surface 1
|
||||
#ifdef __OBJC__
|
||||
@class CAMetalLayer;
|
||||
@@ -47,31 +48,32 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateMetalSurfaceEXT(
|
||||
#endif
|
||||
|
||||
|
||||
// VK_EXT_metal_objects is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_EXT_metal_objects 1
|
||||
#ifdef __OBJC__
|
||||
@protocol MTLDevice;
|
||||
typedef id<MTLDevice> MTLDevice_id;
|
||||
typedef __unsafe_unretained id<MTLDevice> MTLDevice_id;
|
||||
#else
|
||||
typedef void* MTLDevice_id;
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
@protocol MTLCommandQueue;
|
||||
typedef id<MTLCommandQueue> MTLCommandQueue_id;
|
||||
typedef __unsafe_unretained id<MTLCommandQueue> MTLCommandQueue_id;
|
||||
#else
|
||||
typedef void* MTLCommandQueue_id;
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
@protocol MTLBuffer;
|
||||
typedef id<MTLBuffer> MTLBuffer_id;
|
||||
typedef __unsafe_unretained id<MTLBuffer> MTLBuffer_id;
|
||||
#else
|
||||
typedef void* MTLBuffer_id;
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
@protocol MTLTexture;
|
||||
typedef id<MTLTexture> MTLTexture_id;
|
||||
typedef __unsafe_unretained id<MTLTexture> MTLTexture_id;
|
||||
#else
|
||||
typedef void* MTLTexture_id;
|
||||
#endif
|
||||
@@ -79,12 +81,12 @@ typedef void* MTLTexture_id;
|
||||
typedef struct __IOSurface* IOSurfaceRef;
|
||||
#ifdef __OBJC__
|
||||
@protocol MTLSharedEvent;
|
||||
typedef id<MTLSharedEvent> MTLSharedEvent_id;
|
||||
typedef __unsafe_unretained id<MTLSharedEvent> MTLSharedEvent_id;
|
||||
#else
|
||||
typedef void* MTLSharedEvent_id;
|
||||
#endif
|
||||
|
||||
#define VK_EXT_METAL_OBJECTS_SPEC_VERSION 1
|
||||
#define VK_EXT_METAL_OBJECTS_SPEC_VERSION 2
|
||||
#define VK_EXT_METAL_OBJECTS_EXTENSION_NAME "VK_EXT_metal_objects"
|
||||
|
||||
typedef enum VkExportMetalObjectTypeFlagBitsEXT {
|
||||
|
||||
+392
@@ -0,0 +1,392 @@
|
||||
#ifndef VULKAN_VIDEO_CODEC_AV1STD_H_
|
||||
#define VULKAN_VIDEO_CODEC_AV1STD_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// vulkan_video_codec_av1std is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_av1std 1
|
||||
#include "vulkan_video_codecs_common.h"
|
||||
#define STD_VIDEO_AV1_NUM_REF_FRAMES 8
|
||||
#define STD_VIDEO_AV1_REFS_PER_FRAME 7
|
||||
#define STD_VIDEO_AV1_TOTAL_REFS_PER_FRAME 8
|
||||
#define STD_VIDEO_AV1_MAX_TILE_COLS 64
|
||||
#define STD_VIDEO_AV1_MAX_TILE_ROWS 64
|
||||
#define STD_VIDEO_AV1_MAX_SEGMENTS 8
|
||||
#define STD_VIDEO_AV1_SEG_LVL_MAX 8
|
||||
#define STD_VIDEO_AV1_PRIMARY_REF_NONE 7
|
||||
#define STD_VIDEO_AV1_SELECT_INTEGER_MV 2
|
||||
#define STD_VIDEO_AV1_SELECT_SCREEN_CONTENT_TOOLS 2
|
||||
#define STD_VIDEO_AV1_SKIP_MODE_FRAMES 2
|
||||
#define STD_VIDEO_AV1_MAX_LOOP_FILTER_STRENGTHS 4
|
||||
#define STD_VIDEO_AV1_LOOP_FILTER_ADJUSTMENTS 2
|
||||
#define STD_VIDEO_AV1_MAX_CDEF_FILTER_STRENGTHS 8
|
||||
#define STD_VIDEO_AV1_MAX_NUM_PLANES 3
|
||||
#define STD_VIDEO_AV1_GLOBAL_MOTION_PARAMS 6
|
||||
#define STD_VIDEO_AV1_MAX_NUM_Y_POINTS 14
|
||||
#define STD_VIDEO_AV1_MAX_NUM_CB_POINTS 10
|
||||
#define STD_VIDEO_AV1_MAX_NUM_CR_POINTS 10
|
||||
#define STD_VIDEO_AV1_MAX_NUM_POS_LUMA 24
|
||||
#define STD_VIDEO_AV1_MAX_NUM_POS_CHROMA 25
|
||||
|
||||
typedef enum StdVideoAV1Profile {
|
||||
STD_VIDEO_AV1_PROFILE_MAIN = 0,
|
||||
STD_VIDEO_AV1_PROFILE_HIGH = 1,
|
||||
STD_VIDEO_AV1_PROFILE_PROFESSIONAL = 2,
|
||||
STD_VIDEO_AV1_PROFILE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_AV1_PROFILE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoAV1Profile;
|
||||
|
||||
typedef enum StdVideoAV1Level {
|
||||
STD_VIDEO_AV1_LEVEL_2_0 = 0,
|
||||
STD_VIDEO_AV1_LEVEL_2_1 = 1,
|
||||
STD_VIDEO_AV1_LEVEL_2_2 = 2,
|
||||
STD_VIDEO_AV1_LEVEL_2_3 = 3,
|
||||
STD_VIDEO_AV1_LEVEL_3_0 = 4,
|
||||
STD_VIDEO_AV1_LEVEL_3_1 = 5,
|
||||
STD_VIDEO_AV1_LEVEL_3_2 = 6,
|
||||
STD_VIDEO_AV1_LEVEL_3_3 = 7,
|
||||
STD_VIDEO_AV1_LEVEL_4_0 = 8,
|
||||
STD_VIDEO_AV1_LEVEL_4_1 = 9,
|
||||
STD_VIDEO_AV1_LEVEL_4_2 = 10,
|
||||
STD_VIDEO_AV1_LEVEL_4_3 = 11,
|
||||
STD_VIDEO_AV1_LEVEL_5_0 = 12,
|
||||
STD_VIDEO_AV1_LEVEL_5_1 = 13,
|
||||
STD_VIDEO_AV1_LEVEL_5_2 = 14,
|
||||
STD_VIDEO_AV1_LEVEL_5_3 = 15,
|
||||
STD_VIDEO_AV1_LEVEL_6_0 = 16,
|
||||
STD_VIDEO_AV1_LEVEL_6_1 = 17,
|
||||
STD_VIDEO_AV1_LEVEL_6_2 = 18,
|
||||
STD_VIDEO_AV1_LEVEL_6_3 = 19,
|
||||
STD_VIDEO_AV1_LEVEL_7_0 = 20,
|
||||
STD_VIDEO_AV1_LEVEL_7_1 = 21,
|
||||
STD_VIDEO_AV1_LEVEL_7_2 = 22,
|
||||
STD_VIDEO_AV1_LEVEL_7_3 = 23,
|
||||
STD_VIDEO_AV1_LEVEL_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_AV1_LEVEL_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoAV1Level;
|
||||
|
||||
typedef enum StdVideoAV1FrameType {
|
||||
STD_VIDEO_AV1_FRAME_TYPE_KEY = 0,
|
||||
STD_VIDEO_AV1_FRAME_TYPE_INTER = 1,
|
||||
STD_VIDEO_AV1_FRAME_TYPE_INTRA_ONLY = 2,
|
||||
STD_VIDEO_AV1_FRAME_TYPE_SWITCH = 3,
|
||||
STD_VIDEO_AV1_FRAME_TYPE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_AV1_FRAME_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoAV1FrameType;
|
||||
|
||||
typedef enum StdVideoAV1ReferenceName {
|
||||
STD_VIDEO_AV1_REFERENCE_NAME_INTRA_FRAME = 0,
|
||||
STD_VIDEO_AV1_REFERENCE_NAME_LAST_FRAME = 1,
|
||||
STD_VIDEO_AV1_REFERENCE_NAME_LAST2_FRAME = 2,
|
||||
STD_VIDEO_AV1_REFERENCE_NAME_LAST3_FRAME = 3,
|
||||
STD_VIDEO_AV1_REFERENCE_NAME_GOLDEN_FRAME = 4,
|
||||
STD_VIDEO_AV1_REFERENCE_NAME_BWDREF_FRAME = 5,
|
||||
STD_VIDEO_AV1_REFERENCE_NAME_ALTREF2_FRAME = 6,
|
||||
STD_VIDEO_AV1_REFERENCE_NAME_ALTREF_FRAME = 7,
|
||||
STD_VIDEO_AV1_REFERENCE_NAME_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_AV1_REFERENCE_NAME_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoAV1ReferenceName;
|
||||
|
||||
typedef enum StdVideoAV1InterpolationFilter {
|
||||
STD_VIDEO_AV1_INTERPOLATION_FILTER_EIGHTTAP = 0,
|
||||
STD_VIDEO_AV1_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH = 1,
|
||||
STD_VIDEO_AV1_INTERPOLATION_FILTER_EIGHTTAP_SHARP = 2,
|
||||
STD_VIDEO_AV1_INTERPOLATION_FILTER_BILINEAR = 3,
|
||||
STD_VIDEO_AV1_INTERPOLATION_FILTER_SWITCHABLE = 4,
|
||||
STD_VIDEO_AV1_INTERPOLATION_FILTER_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_AV1_INTERPOLATION_FILTER_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoAV1InterpolationFilter;
|
||||
|
||||
typedef enum StdVideoAV1TxMode {
|
||||
STD_VIDEO_AV1_TX_MODE_ONLY_4X4 = 0,
|
||||
STD_VIDEO_AV1_TX_MODE_LARGEST = 1,
|
||||
STD_VIDEO_AV1_TX_MODE_SELECT = 2,
|
||||
STD_VIDEO_AV1_TX_MODE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_AV1_TX_MODE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoAV1TxMode;
|
||||
|
||||
typedef enum StdVideoAV1FrameRestorationType {
|
||||
STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_NONE = 0,
|
||||
STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_WIENER = 1,
|
||||
STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_SGRPROJ = 2,
|
||||
STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_SWITCHABLE = 3,
|
||||
STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoAV1FrameRestorationType;
|
||||
|
||||
typedef enum StdVideoAV1ColorPrimaries {
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_BT_709 = 1,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_BT_UNSPECIFIED = 2,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_BT_470_M = 4,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_BT_470_B_G = 5,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_BT_601 = 6,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_SMPTE_240 = 7,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_GENERIC_FILM = 8,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_BT_2020 = 9,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_XYZ = 10,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_SMPTE_431 = 11,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_SMPTE_432 = 12,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_EBU_3213 = 22,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_AV1_COLOR_PRIMARIES_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoAV1ColorPrimaries;
|
||||
|
||||
typedef enum StdVideoAV1TransferCharacteristics {
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_RESERVED_0 = 0,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_BT_709 = 1,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_UNSPECIFIED = 2,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_RESERVED_3 = 3,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_BT_470_M = 4,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_BT_470_B_G = 5,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_BT_601 = 6,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_SMPTE_240 = 7,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_LINEAR = 8,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_LOG_100 = 9,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_LOG_100_SQRT10 = 10,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_IEC_61966 = 11,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_BT_1361 = 12,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_SRGB = 13,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_BT_2020_10_BIT = 14,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_BT_2020_12_BIT = 15,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_SMPTE_2084 = 16,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_SMPTE_428 = 17,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_HLG = 18,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_AV1_TRANSFER_CHARACTERISTICS_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoAV1TransferCharacteristics;
|
||||
|
||||
typedef enum StdVideoAV1MatrixCoefficients {
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_IDENTITY = 0,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_BT_709 = 1,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_UNSPECIFIED = 2,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_RESERVED_3 = 3,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_FCC = 4,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_BT_470_B_G = 5,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_BT_601 = 6,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_SMPTE_240 = 7,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_SMPTE_YCGCO = 8,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_BT_2020_NCL = 9,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_BT_2020_CL = 10,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_SMPTE_2085 = 11,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_CHROMAT_NCL = 12,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_CHROMAT_CL = 13,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_ICTCP = 14,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_AV1_MATRIX_COEFFICIENTS_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoAV1MatrixCoefficients;
|
||||
|
||||
typedef enum StdVideoAV1ChromaSamplePosition {
|
||||
STD_VIDEO_AV1_CHROMA_SAMPLE_POSITION_UNKNOWN = 0,
|
||||
STD_VIDEO_AV1_CHROMA_SAMPLE_POSITION_VERTICAL = 1,
|
||||
STD_VIDEO_AV1_CHROMA_SAMPLE_POSITION_COLOCATED = 2,
|
||||
STD_VIDEO_AV1_CHROMA_SAMPLE_POSITION_RESERVED = 3,
|
||||
STD_VIDEO_AV1_CHROMA_SAMPLE_POSITION_INVALID = 0x7FFFFFFF,
|
||||
STD_VIDEO_AV1_CHROMA_SAMPLE_POSITION_MAX_ENUM = 0x7FFFFFFF
|
||||
} StdVideoAV1ChromaSamplePosition;
|
||||
typedef struct StdVideoAV1ColorConfigFlags {
|
||||
uint32_t mono_chrome : 1;
|
||||
uint32_t color_range : 1;
|
||||
uint32_t separate_uv_delta_q : 1;
|
||||
uint32_t color_description_present_flag : 1;
|
||||
uint32_t reserved : 28;
|
||||
} StdVideoAV1ColorConfigFlags;
|
||||
|
||||
typedef struct StdVideoAV1ColorConfig {
|
||||
StdVideoAV1ColorConfigFlags flags;
|
||||
uint8_t BitDepth;
|
||||
uint8_t subsampling_x;
|
||||
uint8_t subsampling_y;
|
||||
uint8_t reserved1;
|
||||
StdVideoAV1ColorPrimaries color_primaries;
|
||||
StdVideoAV1TransferCharacteristics transfer_characteristics;
|
||||
StdVideoAV1MatrixCoefficients matrix_coefficients;
|
||||
StdVideoAV1ChromaSamplePosition chroma_sample_position;
|
||||
} StdVideoAV1ColorConfig;
|
||||
|
||||
typedef struct StdVideoAV1TimingInfoFlags {
|
||||
uint32_t equal_picture_interval : 1;
|
||||
uint32_t reserved : 31;
|
||||
} StdVideoAV1TimingInfoFlags;
|
||||
|
||||
typedef struct StdVideoAV1TimingInfo {
|
||||
StdVideoAV1TimingInfoFlags flags;
|
||||
uint32_t num_units_in_display_tick;
|
||||
uint32_t time_scale;
|
||||
uint32_t num_ticks_per_picture_minus_1;
|
||||
} StdVideoAV1TimingInfo;
|
||||
|
||||
typedef struct StdVideoAV1LoopFilterFlags {
|
||||
uint32_t loop_filter_delta_enabled : 1;
|
||||
uint32_t loop_filter_delta_update : 1;
|
||||
uint32_t reserved : 30;
|
||||
} StdVideoAV1LoopFilterFlags;
|
||||
|
||||
typedef struct StdVideoAV1LoopFilter {
|
||||
StdVideoAV1LoopFilterFlags flags;
|
||||
uint8_t loop_filter_level[STD_VIDEO_AV1_MAX_LOOP_FILTER_STRENGTHS];
|
||||
uint8_t loop_filter_sharpness;
|
||||
uint8_t update_ref_delta;
|
||||
int8_t loop_filter_ref_deltas[STD_VIDEO_AV1_TOTAL_REFS_PER_FRAME];
|
||||
uint8_t update_mode_delta;
|
||||
int8_t loop_filter_mode_deltas[STD_VIDEO_AV1_LOOP_FILTER_ADJUSTMENTS];
|
||||
} StdVideoAV1LoopFilter;
|
||||
|
||||
typedef struct StdVideoAV1QuantizationFlags {
|
||||
uint32_t using_qmatrix : 1;
|
||||
uint32_t diff_uv_delta : 1;
|
||||
uint32_t reserved : 30;
|
||||
} StdVideoAV1QuantizationFlags;
|
||||
|
||||
typedef struct StdVideoAV1Quantization {
|
||||
StdVideoAV1QuantizationFlags flags;
|
||||
uint8_t base_q_idx;
|
||||
int8_t DeltaQYDc;
|
||||
int8_t DeltaQUDc;
|
||||
int8_t DeltaQUAc;
|
||||
int8_t DeltaQVDc;
|
||||
int8_t DeltaQVAc;
|
||||
uint8_t qm_y;
|
||||
uint8_t qm_u;
|
||||
uint8_t qm_v;
|
||||
} StdVideoAV1Quantization;
|
||||
|
||||
typedef struct StdVideoAV1Segmentation {
|
||||
uint8_t FeatureEnabled[STD_VIDEO_AV1_MAX_SEGMENTS];
|
||||
int16_t FeatureData[STD_VIDEO_AV1_MAX_SEGMENTS][STD_VIDEO_AV1_SEG_LVL_MAX];
|
||||
} StdVideoAV1Segmentation;
|
||||
|
||||
typedef struct StdVideoAV1TileInfoFlags {
|
||||
uint32_t uniform_tile_spacing_flag : 1;
|
||||
uint32_t reserved : 31;
|
||||
} StdVideoAV1TileInfoFlags;
|
||||
|
||||
typedef struct StdVideoAV1TileInfo {
|
||||
StdVideoAV1TileInfoFlags flags;
|
||||
uint8_t TileCols;
|
||||
uint8_t TileRows;
|
||||
uint16_t context_update_tile_id;
|
||||
uint8_t tile_size_bytes_minus_1;
|
||||
uint8_t reserved1[7];
|
||||
const uint16_t* pMiColStarts;
|
||||
const uint16_t* pMiRowStarts;
|
||||
const uint16_t* pWidthInSbsMinus1;
|
||||
const uint16_t* pHeightInSbsMinus1;
|
||||
} StdVideoAV1TileInfo;
|
||||
|
||||
typedef struct StdVideoAV1CDEF {
|
||||
uint8_t cdef_damping_minus_3;
|
||||
uint8_t cdef_bits;
|
||||
uint8_t cdef_y_pri_strength[STD_VIDEO_AV1_MAX_CDEF_FILTER_STRENGTHS];
|
||||
uint8_t cdef_y_sec_strength[STD_VIDEO_AV1_MAX_CDEF_FILTER_STRENGTHS];
|
||||
uint8_t cdef_uv_pri_strength[STD_VIDEO_AV1_MAX_CDEF_FILTER_STRENGTHS];
|
||||
uint8_t cdef_uv_sec_strength[STD_VIDEO_AV1_MAX_CDEF_FILTER_STRENGTHS];
|
||||
} StdVideoAV1CDEF;
|
||||
|
||||
typedef struct StdVideoAV1LoopRestoration {
|
||||
StdVideoAV1FrameRestorationType FrameRestorationType[STD_VIDEO_AV1_MAX_NUM_PLANES];
|
||||
uint16_t LoopRestorationSize[STD_VIDEO_AV1_MAX_NUM_PLANES];
|
||||
} StdVideoAV1LoopRestoration;
|
||||
|
||||
typedef struct StdVideoAV1GlobalMotion {
|
||||
uint8_t GmType[STD_VIDEO_AV1_NUM_REF_FRAMES];
|
||||
int32_t gm_params[STD_VIDEO_AV1_NUM_REF_FRAMES][STD_VIDEO_AV1_GLOBAL_MOTION_PARAMS];
|
||||
} StdVideoAV1GlobalMotion;
|
||||
|
||||
typedef struct StdVideoAV1FilmGrainFlags {
|
||||
uint32_t chroma_scaling_from_luma : 1;
|
||||
uint32_t overlap_flag : 1;
|
||||
uint32_t clip_to_restricted_range : 1;
|
||||
uint32_t update_grain : 1;
|
||||
uint32_t reserved : 28;
|
||||
} StdVideoAV1FilmGrainFlags;
|
||||
|
||||
typedef struct StdVideoAV1FilmGrain {
|
||||
StdVideoAV1FilmGrainFlags flags;
|
||||
uint8_t grain_scaling_minus_8;
|
||||
uint8_t ar_coeff_lag;
|
||||
uint8_t ar_coeff_shift_minus_6;
|
||||
uint8_t grain_scale_shift;
|
||||
uint16_t grain_seed;
|
||||
uint8_t film_grain_params_ref_idx;
|
||||
uint8_t num_y_points;
|
||||
uint8_t point_y_value[STD_VIDEO_AV1_MAX_NUM_Y_POINTS];
|
||||
uint8_t point_y_scaling[STD_VIDEO_AV1_MAX_NUM_Y_POINTS];
|
||||
uint8_t num_cb_points;
|
||||
uint8_t point_cb_value[STD_VIDEO_AV1_MAX_NUM_CB_POINTS];
|
||||
uint8_t point_cb_scaling[STD_VIDEO_AV1_MAX_NUM_CB_POINTS];
|
||||
uint8_t num_cr_points;
|
||||
uint8_t point_cr_value[STD_VIDEO_AV1_MAX_NUM_CR_POINTS];
|
||||
uint8_t point_cr_scaling[STD_VIDEO_AV1_MAX_NUM_CR_POINTS];
|
||||
int8_t ar_coeffs_y_plus_128[STD_VIDEO_AV1_MAX_NUM_POS_LUMA];
|
||||
int8_t ar_coeffs_cb_plus_128[STD_VIDEO_AV1_MAX_NUM_POS_CHROMA];
|
||||
int8_t ar_coeffs_cr_plus_128[STD_VIDEO_AV1_MAX_NUM_POS_CHROMA];
|
||||
uint8_t cb_mult;
|
||||
uint8_t cb_luma_mult;
|
||||
uint16_t cb_offset;
|
||||
uint8_t cr_mult;
|
||||
uint8_t cr_luma_mult;
|
||||
uint16_t cr_offset;
|
||||
} StdVideoAV1FilmGrain;
|
||||
|
||||
typedef struct StdVideoAV1SequenceHeaderFlags {
|
||||
uint32_t still_picture : 1;
|
||||
uint32_t reduced_still_picture_header : 1;
|
||||
uint32_t use_128x128_superblock : 1;
|
||||
uint32_t enable_filter_intra : 1;
|
||||
uint32_t enable_intra_edge_filter : 1;
|
||||
uint32_t enable_interintra_compound : 1;
|
||||
uint32_t enable_masked_compound : 1;
|
||||
uint32_t enable_warped_motion : 1;
|
||||
uint32_t enable_dual_filter : 1;
|
||||
uint32_t enable_order_hint : 1;
|
||||
uint32_t enable_jnt_comp : 1;
|
||||
uint32_t enable_ref_frame_mvs : 1;
|
||||
uint32_t frame_id_numbers_present_flag : 1;
|
||||
uint32_t enable_superres : 1;
|
||||
uint32_t enable_cdef : 1;
|
||||
uint32_t enable_restoration : 1;
|
||||
uint32_t film_grain_params_present : 1;
|
||||
uint32_t timing_info_present_flag : 1;
|
||||
uint32_t initial_display_delay_present_flag : 1;
|
||||
uint32_t reserved : 13;
|
||||
} StdVideoAV1SequenceHeaderFlags;
|
||||
|
||||
typedef struct StdVideoAV1SequenceHeader {
|
||||
StdVideoAV1SequenceHeaderFlags flags;
|
||||
StdVideoAV1Profile seq_profile;
|
||||
uint8_t frame_width_bits_minus_1;
|
||||
uint8_t frame_height_bits_minus_1;
|
||||
uint16_t max_frame_width_minus_1;
|
||||
uint16_t max_frame_height_minus_1;
|
||||
uint8_t delta_frame_id_length_minus_2;
|
||||
uint8_t additional_frame_id_length_minus_1;
|
||||
uint8_t order_hint_bits_minus_1;
|
||||
uint8_t seq_force_integer_mv;
|
||||
uint8_t seq_force_screen_content_tools;
|
||||
uint8_t reserved1[5];
|
||||
const StdVideoAV1ColorConfig* pColorConfig;
|
||||
const StdVideoAV1TimingInfo* pTimingInfo;
|
||||
} StdVideoAV1SequenceHeader;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,109 @@
|
||||
#ifndef VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_
|
||||
#define VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// vulkan_video_codec_av1std_decode is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_av1std_decode 1
|
||||
#include "vulkan_video_codec_av1std.h"
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0)
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_API_VERSION_1_0_0
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_av1_decode"
|
||||
typedef struct StdVideoDecodeAV1PictureInfoFlags {
|
||||
uint32_t error_resilient_mode : 1;
|
||||
uint32_t disable_cdf_update : 1;
|
||||
uint32_t use_superres : 1;
|
||||
uint32_t render_and_frame_size_different : 1;
|
||||
uint32_t allow_screen_content_tools : 1;
|
||||
uint32_t is_filter_switchable : 1;
|
||||
uint32_t force_integer_mv : 1;
|
||||
uint32_t frame_size_override_flag : 1;
|
||||
uint32_t buffer_removal_time_present_flag : 1;
|
||||
uint32_t allow_intrabc : 1;
|
||||
uint32_t frame_refs_short_signaling : 1;
|
||||
uint32_t allow_high_precision_mv : 1;
|
||||
uint32_t is_motion_mode_switchable : 1;
|
||||
uint32_t use_ref_frame_mvs : 1;
|
||||
uint32_t disable_frame_end_update_cdf : 1;
|
||||
uint32_t allow_warped_motion : 1;
|
||||
uint32_t reduced_tx_set : 1;
|
||||
uint32_t reference_select : 1;
|
||||
uint32_t skip_mode_present : 1;
|
||||
uint32_t delta_q_present : 1;
|
||||
uint32_t delta_lf_present : 1;
|
||||
uint32_t delta_lf_multi : 1;
|
||||
uint32_t segmentation_enabled : 1;
|
||||
uint32_t segmentation_update_map : 1;
|
||||
uint32_t segmentation_temporal_update : 1;
|
||||
uint32_t segmentation_update_data : 1;
|
||||
uint32_t UsesLr : 1;
|
||||
uint32_t usesChromaLr : 1;
|
||||
uint32_t apply_grain : 1;
|
||||
uint32_t reserved : 3;
|
||||
} StdVideoDecodeAV1PictureInfoFlags;
|
||||
|
||||
typedef struct StdVideoDecodeAV1PictureInfo {
|
||||
StdVideoDecodeAV1PictureInfoFlags flags;
|
||||
StdVideoAV1FrameType frame_type;
|
||||
uint32_t current_frame_id;
|
||||
uint8_t OrderHint;
|
||||
uint8_t primary_ref_frame;
|
||||
uint8_t refresh_frame_flags;
|
||||
uint8_t reserved1;
|
||||
StdVideoAV1InterpolationFilter interpolation_filter;
|
||||
StdVideoAV1TxMode TxMode;
|
||||
uint8_t delta_q_res;
|
||||
uint8_t delta_lf_res;
|
||||
uint8_t SkipModeFrame[STD_VIDEO_AV1_SKIP_MODE_FRAMES];
|
||||
uint8_t coded_denom;
|
||||
uint8_t reserved2[3];
|
||||
uint8_t OrderHints[STD_VIDEO_AV1_NUM_REF_FRAMES];
|
||||
uint32_t expectedFrameId[STD_VIDEO_AV1_NUM_REF_FRAMES];
|
||||
const StdVideoAV1TileInfo* pTileInfo;
|
||||
const StdVideoAV1Quantization* pQuantization;
|
||||
const StdVideoAV1Segmentation* pSegmentation;
|
||||
const StdVideoAV1LoopFilter* pLoopFilter;
|
||||
const StdVideoAV1CDEF* pCDEF;
|
||||
const StdVideoAV1LoopRestoration* pLoopRestoration;
|
||||
const StdVideoAV1GlobalMotion* pGlobalMotion;
|
||||
const StdVideoAV1FilmGrain* pFilmGrain;
|
||||
} StdVideoDecodeAV1PictureInfo;
|
||||
|
||||
typedef struct StdVideoDecodeAV1ReferenceInfoFlags {
|
||||
uint32_t disable_frame_end_update_cdf : 1;
|
||||
uint32_t segmentation_enabled : 1;
|
||||
uint32_t reserved : 30;
|
||||
} StdVideoDecodeAV1ReferenceInfoFlags;
|
||||
|
||||
typedef struct StdVideoDecodeAV1ReferenceInfo {
|
||||
StdVideoDecodeAV1ReferenceInfoFlags flags;
|
||||
uint8_t frame_type;
|
||||
uint8_t RefFrameSignBias;
|
||||
uint8_t OrderHint;
|
||||
uint8_t SavedOrderHints[STD_VIDEO_AV1_NUM_REF_FRAMES];
|
||||
} StdVideoDecodeAV1ReferenceInfo;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+4
-2
@@ -2,7 +2,7 @@
|
||||
#define VULKAN_VIDEO_CODEC_H264STD_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -19,8 +19,9 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
// vulkan_video_codec_h264std is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_h264std 1
|
||||
#include <stdint.h>
|
||||
#include "vulkan_video_codecs_common.h"
|
||||
#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32
|
||||
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6
|
||||
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16
|
||||
@@ -28,6 +29,7 @@ extern "C" {
|
||||
#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS 64
|
||||
#define STD_VIDEO_H264_MAX_NUM_LIST_REF 32
|
||||
#define STD_VIDEO_H264_MAX_CHROMA_PLANES 2
|
||||
#define STD_VIDEO_H264_NO_REFERENCE_PICTURE 0xFF
|
||||
|
||||
typedef enum StdVideoH264ChromaFormatIdc {
|
||||
STD_VIDEO_H264_CHROMA_FORMAT_IDC_MONOCHROME = 0,
|
||||
|
||||
+4
-2
@@ -2,7 +2,7 @@
|
||||
#define VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -19,13 +19,15 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
// vulkan_video_codec_h264std_decode is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_h264std_decode 1
|
||||
#include "vulkan_video_codec_h264std.h"
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0)
|
||||
|
||||
#define STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE 2
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_decode"
|
||||
#define STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE 2
|
||||
|
||||
typedef enum StdVideoDecodeH264FieldOrderCount {
|
||||
STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_TOP = 0,
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
#ifndef VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_
|
||||
#define VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// vulkan_video_codec_h264std_encode is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_h264std_encode 1
|
||||
#include "vulkan_video_codec_h264std.h"
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0)
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_API_VERSION_1_0_0
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_encode"
|
||||
typedef struct StdVideoEncodeH264WeightTableFlags {
|
||||
uint32_t luma_weight_l0_flag;
|
||||
uint32_t chroma_weight_l0_flag;
|
||||
uint32_t luma_weight_l1_flag;
|
||||
uint32_t chroma_weight_l1_flag;
|
||||
} StdVideoEncodeH264WeightTableFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH264WeightTable {
|
||||
StdVideoEncodeH264WeightTableFlags flags;
|
||||
uint8_t luma_log2_weight_denom;
|
||||
uint8_t chroma_log2_weight_denom;
|
||||
int8_t luma_weight_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF];
|
||||
int8_t luma_offset_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF];
|
||||
int8_t chroma_weight_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
|
||||
int8_t chroma_offset_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
|
||||
int8_t luma_weight_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF];
|
||||
int8_t luma_offset_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF];
|
||||
int8_t chroma_weight_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
|
||||
int8_t chroma_offset_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
|
||||
} StdVideoEncodeH264WeightTable;
|
||||
|
||||
typedef struct StdVideoEncodeH264SliceHeaderFlags {
|
||||
uint32_t direct_spatial_mv_pred_flag : 1;
|
||||
uint32_t num_ref_idx_active_override_flag : 1;
|
||||
uint32_t reserved : 30;
|
||||
} StdVideoEncodeH264SliceHeaderFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH264PictureInfoFlags {
|
||||
uint32_t IdrPicFlag : 1;
|
||||
uint32_t is_reference : 1;
|
||||
uint32_t no_output_of_prior_pics_flag : 1;
|
||||
uint32_t long_term_reference_flag : 1;
|
||||
uint32_t adaptive_ref_pic_marking_mode_flag : 1;
|
||||
uint32_t reserved : 27;
|
||||
} StdVideoEncodeH264PictureInfoFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH264ReferenceInfoFlags {
|
||||
uint32_t used_for_long_term_reference : 1;
|
||||
uint32_t reserved : 31;
|
||||
} StdVideoEncodeH264ReferenceInfoFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH264ReferenceListsInfoFlags {
|
||||
uint32_t ref_pic_list_modification_flag_l0 : 1;
|
||||
uint32_t ref_pic_list_modification_flag_l1 : 1;
|
||||
uint32_t reserved : 30;
|
||||
} StdVideoEncodeH264ReferenceListsInfoFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH264RefListModEntry {
|
||||
StdVideoH264ModificationOfPicNumsIdc modification_of_pic_nums_idc;
|
||||
uint16_t abs_diff_pic_num_minus1;
|
||||
uint16_t long_term_pic_num;
|
||||
} StdVideoEncodeH264RefListModEntry;
|
||||
|
||||
typedef struct StdVideoEncodeH264RefPicMarkingEntry {
|
||||
StdVideoH264MemMgmtControlOp memory_management_control_operation;
|
||||
uint16_t difference_of_pic_nums_minus1;
|
||||
uint16_t long_term_pic_num;
|
||||
uint16_t long_term_frame_idx;
|
||||
uint16_t max_long_term_frame_idx_plus1;
|
||||
} StdVideoEncodeH264RefPicMarkingEntry;
|
||||
|
||||
typedef struct StdVideoEncodeH264ReferenceListsInfo {
|
||||
StdVideoEncodeH264ReferenceListsInfoFlags flags;
|
||||
uint8_t num_ref_idx_l0_active_minus1;
|
||||
uint8_t num_ref_idx_l1_active_minus1;
|
||||
uint8_t RefPicList0[STD_VIDEO_H264_MAX_NUM_LIST_REF];
|
||||
uint8_t RefPicList1[STD_VIDEO_H264_MAX_NUM_LIST_REF];
|
||||
uint8_t refList0ModOpCount;
|
||||
uint8_t refList1ModOpCount;
|
||||
uint8_t refPicMarkingOpCount;
|
||||
uint8_t reserved1[7];
|
||||
const StdVideoEncodeH264RefListModEntry* pRefList0ModOperations;
|
||||
const StdVideoEncodeH264RefListModEntry* pRefList1ModOperations;
|
||||
const StdVideoEncodeH264RefPicMarkingEntry* pRefPicMarkingOperations;
|
||||
} StdVideoEncodeH264ReferenceListsInfo;
|
||||
|
||||
typedef struct StdVideoEncodeH264PictureInfo {
|
||||
StdVideoEncodeH264PictureInfoFlags flags;
|
||||
uint8_t seq_parameter_set_id;
|
||||
uint8_t pic_parameter_set_id;
|
||||
uint16_t idr_pic_id;
|
||||
StdVideoH264PictureType primary_pic_type;
|
||||
uint32_t frame_num;
|
||||
int32_t PicOrderCnt;
|
||||
uint8_t temporal_id;
|
||||
uint8_t reserved1[3];
|
||||
const StdVideoEncodeH264ReferenceListsInfo* pRefLists;
|
||||
} StdVideoEncodeH264PictureInfo;
|
||||
|
||||
typedef struct StdVideoEncodeH264ReferenceInfo {
|
||||
StdVideoEncodeH264ReferenceInfoFlags flags;
|
||||
StdVideoH264PictureType primary_pic_type;
|
||||
uint32_t FrameNum;
|
||||
int32_t PicOrderCnt;
|
||||
uint16_t long_term_pic_num;
|
||||
uint16_t long_term_frame_idx;
|
||||
uint8_t temporal_id;
|
||||
} StdVideoEncodeH264ReferenceInfo;
|
||||
|
||||
typedef struct StdVideoEncodeH264SliceHeader {
|
||||
StdVideoEncodeH264SliceHeaderFlags flags;
|
||||
uint32_t first_mb_in_slice;
|
||||
StdVideoH264SliceType slice_type;
|
||||
int8_t slice_alpha_c0_offset_div2;
|
||||
int8_t slice_beta_offset_div2;
|
||||
int8_t slice_qp_delta;
|
||||
uint8_t reserved1;
|
||||
StdVideoH264CabacInitIdc cabac_init_idc;
|
||||
StdVideoH264DisableDeblockingFilterIdc disable_deblocking_filter_idc;
|
||||
const StdVideoEncodeH264WeightTable* pWeightTable;
|
||||
} StdVideoEncodeH264SliceHeader;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+9
-6
@@ -2,7 +2,7 @@
|
||||
#define VULKAN_VIDEO_CODEC_H265STD_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -19,9 +19,11 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
// vulkan_video_codec_h265std is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_h265std 1
|
||||
#define STD_VIDEO_H265_SUBLAYERS_LIST_SIZE 7
|
||||
#include "vulkan_video_codecs_common.h"
|
||||
#define STD_VIDEO_H265_CPB_CNT_LIST_SIZE 32
|
||||
#define STD_VIDEO_H265_SUBLAYERS_LIST_SIZE 7
|
||||
#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS 6
|
||||
#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS 16
|
||||
#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS 6
|
||||
@@ -30,18 +32,19 @@ extern "C" {
|
||||
#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS 64
|
||||
#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS 2
|
||||
#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS 64
|
||||
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE 3
|
||||
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE 128
|
||||
#define STD_VIDEO_H265_MAX_DPB_SIZE 16
|
||||
#define STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS 32
|
||||
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE 6
|
||||
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE 19
|
||||
#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE 21
|
||||
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE 3
|
||||
#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE 128
|
||||
#define STD_VIDEO_H265_MAX_NUM_LIST_REF 15
|
||||
#define STD_VIDEO_H265_MAX_CHROMA_PLANES 2
|
||||
#define STD_VIDEO_H265_MAX_SHORT_TERM_REF_PIC_SETS 64
|
||||
#define STD_VIDEO_H265_MAX_DPB_SIZE 16
|
||||
#define STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS 32
|
||||
#define STD_VIDEO_H265_MAX_LONG_TERM_PICS 16
|
||||
#define STD_VIDEO_H265_MAX_DELTA_POC 48
|
||||
#define STD_VIDEO_H265_NO_REFERENCE_PICTURE 0xFF
|
||||
|
||||
typedef enum StdVideoH265ChromaFormatIdc {
|
||||
STD_VIDEO_H265_CHROMA_FORMAT_IDC_MONOCHROME = 0,
|
||||
|
||||
+4
-2
@@ -2,7 +2,7 @@
|
||||
#define VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -19,13 +19,15 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
// vulkan_video_codec_h265std_decode is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_h265std_decode 1
|
||||
#include "vulkan_video_codec_h265std.h"
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0)
|
||||
|
||||
#define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_decode"
|
||||
#define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8
|
||||
typedef struct StdVideoDecodeH265PictureInfoFlags {
|
||||
uint32_t IrapPicFlag : 1;
|
||||
uint32_t IdrPicFlag : 1;
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
#ifndef VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_
|
||||
#define VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// vulkan_video_codec_h265std_encode is a preprocessor guard. Do not pass it to API calls.
|
||||
#define vulkan_video_codec_h265std_encode 1
|
||||
#include "vulkan_video_codec_h265std.h"
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0)
|
||||
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_API_VERSION_1_0_0
|
||||
#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_encode"
|
||||
typedef struct StdVideoEncodeH265WeightTableFlags {
|
||||
uint16_t luma_weight_l0_flag;
|
||||
uint16_t chroma_weight_l0_flag;
|
||||
uint16_t luma_weight_l1_flag;
|
||||
uint16_t chroma_weight_l1_flag;
|
||||
} StdVideoEncodeH265WeightTableFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH265WeightTable {
|
||||
StdVideoEncodeH265WeightTableFlags flags;
|
||||
uint8_t luma_log2_weight_denom;
|
||||
int8_t delta_chroma_log2_weight_denom;
|
||||
int8_t delta_luma_weight_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF];
|
||||
int8_t luma_offset_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF];
|
||||
int8_t delta_chroma_weight_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
|
||||
int8_t delta_chroma_offset_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
|
||||
int8_t delta_luma_weight_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF];
|
||||
int8_t luma_offset_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF];
|
||||
int8_t delta_chroma_weight_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
|
||||
int8_t delta_chroma_offset_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
|
||||
} StdVideoEncodeH265WeightTable;
|
||||
|
||||
typedef struct StdVideoEncodeH265SliceSegmentHeaderFlags {
|
||||
uint32_t first_slice_segment_in_pic_flag : 1;
|
||||
uint32_t dependent_slice_segment_flag : 1;
|
||||
uint32_t slice_sao_luma_flag : 1;
|
||||
uint32_t slice_sao_chroma_flag : 1;
|
||||
uint32_t num_ref_idx_active_override_flag : 1;
|
||||
uint32_t mvd_l1_zero_flag : 1;
|
||||
uint32_t cabac_init_flag : 1;
|
||||
uint32_t cu_chroma_qp_offset_enabled_flag : 1;
|
||||
uint32_t deblocking_filter_override_flag : 1;
|
||||
uint32_t slice_deblocking_filter_disabled_flag : 1;
|
||||
uint32_t collocated_from_l0_flag : 1;
|
||||
uint32_t slice_loop_filter_across_slices_enabled_flag : 1;
|
||||
uint32_t reserved : 20;
|
||||
} StdVideoEncodeH265SliceSegmentHeaderFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH265SliceSegmentHeader {
|
||||
StdVideoEncodeH265SliceSegmentHeaderFlags flags;
|
||||
StdVideoH265SliceType slice_type;
|
||||
uint32_t slice_segment_address;
|
||||
uint8_t collocated_ref_idx;
|
||||
uint8_t MaxNumMergeCand;
|
||||
int8_t slice_cb_qp_offset;
|
||||
int8_t slice_cr_qp_offset;
|
||||
int8_t slice_beta_offset_div2;
|
||||
int8_t slice_tc_offset_div2;
|
||||
int8_t slice_act_y_qp_offset;
|
||||
int8_t slice_act_cb_qp_offset;
|
||||
int8_t slice_act_cr_qp_offset;
|
||||
int8_t slice_qp_delta;
|
||||
uint16_t reserved1;
|
||||
const StdVideoEncodeH265WeightTable* pWeightTable;
|
||||
} StdVideoEncodeH265SliceSegmentHeader;
|
||||
|
||||
typedef struct StdVideoEncodeH265ReferenceListsInfoFlags {
|
||||
uint32_t ref_pic_list_modification_flag_l0 : 1;
|
||||
uint32_t ref_pic_list_modification_flag_l1 : 1;
|
||||
uint32_t reserved : 30;
|
||||
} StdVideoEncodeH265ReferenceListsInfoFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH265ReferenceListsInfo {
|
||||
StdVideoEncodeH265ReferenceListsInfoFlags flags;
|
||||
uint8_t num_ref_idx_l0_active_minus1;
|
||||
uint8_t num_ref_idx_l1_active_minus1;
|
||||
uint8_t RefPicList0[STD_VIDEO_H265_MAX_NUM_LIST_REF];
|
||||
uint8_t RefPicList1[STD_VIDEO_H265_MAX_NUM_LIST_REF];
|
||||
uint8_t list_entry_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF];
|
||||
uint8_t list_entry_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF];
|
||||
} StdVideoEncodeH265ReferenceListsInfo;
|
||||
|
||||
typedef struct StdVideoEncodeH265PictureInfoFlags {
|
||||
uint32_t is_reference : 1;
|
||||
uint32_t IrapPicFlag : 1;
|
||||
uint32_t used_for_long_term_reference : 1;
|
||||
uint32_t discardable_flag : 1;
|
||||
uint32_t cross_layer_bla_flag : 1;
|
||||
uint32_t pic_output_flag : 1;
|
||||
uint32_t no_output_of_prior_pics_flag : 1;
|
||||
uint32_t short_term_ref_pic_set_sps_flag : 1;
|
||||
uint32_t slice_temporal_mvp_enabled_flag : 1;
|
||||
uint32_t reserved : 23;
|
||||
} StdVideoEncodeH265PictureInfoFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH265LongTermRefPics {
|
||||
uint8_t num_long_term_sps;
|
||||
uint8_t num_long_term_pics;
|
||||
uint8_t lt_idx_sps[STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS];
|
||||
uint8_t poc_lsb_lt[STD_VIDEO_H265_MAX_LONG_TERM_PICS];
|
||||
uint16_t used_by_curr_pic_lt_flag;
|
||||
uint8_t delta_poc_msb_present_flag[STD_VIDEO_H265_MAX_DELTA_POC];
|
||||
uint8_t delta_poc_msb_cycle_lt[STD_VIDEO_H265_MAX_DELTA_POC];
|
||||
} StdVideoEncodeH265LongTermRefPics;
|
||||
|
||||
typedef struct StdVideoEncodeH265PictureInfo {
|
||||
StdVideoEncodeH265PictureInfoFlags flags;
|
||||
StdVideoH265PictureType pic_type;
|
||||
uint8_t sps_video_parameter_set_id;
|
||||
uint8_t pps_seq_parameter_set_id;
|
||||
uint8_t pps_pic_parameter_set_id;
|
||||
uint8_t short_term_ref_pic_set_idx;
|
||||
int32_t PicOrderCntVal;
|
||||
uint8_t TemporalId;
|
||||
uint8_t reserved1[7];
|
||||
const StdVideoEncodeH265ReferenceListsInfo* pRefLists;
|
||||
const StdVideoH265ShortTermRefPicSet* pShortTermRefPicSet;
|
||||
const StdVideoEncodeH265LongTermRefPics* pLongTermRefPics;
|
||||
} StdVideoEncodeH265PictureInfo;
|
||||
|
||||
typedef struct StdVideoEncodeH265ReferenceInfoFlags {
|
||||
uint32_t used_for_long_term_reference : 1;
|
||||
uint32_t unused_for_reference : 1;
|
||||
uint32_t reserved : 30;
|
||||
} StdVideoEncodeH265ReferenceInfoFlags;
|
||||
|
||||
typedef struct StdVideoEncodeH265ReferenceInfo {
|
||||
StdVideoEncodeH265ReferenceInfoFlags flags;
|
||||
StdVideoH265PictureType pic_type;
|
||||
int32_t PicOrderCntVal;
|
||||
uint8_t TemporalId;
|
||||
} StdVideoEncodeH265ReferenceInfo;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Vendored
+2
-1
@@ -2,7 +2,7 @@
|
||||
#define VULKAN_WAYLAND_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -19,6 +19,7 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
// VK_KHR_wayland_surface is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_KHR_wayland_surface 1
|
||||
#define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6
|
||||
#define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface"
|
||||
|
||||
Vendored
+10
-1
@@ -2,7 +2,7 @@
|
||||
#define VULKAN_WIN32_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright 2015-2023 The Khronos Group Inc.
|
||||
** Copyright 2015-2024 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -19,6 +19,7 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
// VK_KHR_win32_surface is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_KHR_win32_surface 1
|
||||
#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6
|
||||
#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface"
|
||||
@@ -47,6 +48,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(
|
||||
#endif
|
||||
|
||||
|
||||
// VK_KHR_external_memory_win32 is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_KHR_external_memory_win32 1
|
||||
#define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
|
||||
#define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32"
|
||||
@@ -96,6 +98,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR(
|
||||
#endif
|
||||
|
||||
|
||||
// VK_KHR_win32_keyed_mutex is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_KHR_win32_keyed_mutex 1
|
||||
#define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1
|
||||
#define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex"
|
||||
@@ -113,6 +116,7 @@ typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR {
|
||||
|
||||
|
||||
|
||||
// VK_KHR_external_semaphore_win32 is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_KHR_external_semaphore_win32 1
|
||||
#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1
|
||||
#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32"
|
||||
@@ -165,6 +169,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR(
|
||||
#endif
|
||||
|
||||
|
||||
// VK_KHR_external_fence_win32 is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_KHR_external_fence_win32 1
|
||||
#define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1
|
||||
#define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32"
|
||||
@@ -208,6 +213,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR(
|
||||
#endif
|
||||
|
||||
|
||||
// VK_NV_external_memory_win32 is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_NV_external_memory_win32 1
|
||||
#define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
|
||||
#define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32"
|
||||
@@ -236,6 +242,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV(
|
||||
#endif
|
||||
|
||||
|
||||
// VK_NV_win32_keyed_mutex is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_NV_win32_keyed_mutex 1
|
||||
#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 2
|
||||
#define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex"
|
||||
@@ -253,6 +260,7 @@ typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV {
|
||||
|
||||
|
||||
|
||||
// VK_EXT_full_screen_exclusive is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_EXT_full_screen_exclusive 1
|
||||
#define VK_EXT_FULL_SCREEN_EXCLUSIVE_SPEC_VERSION 4
|
||||
#define VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME "VK_EXT_full_screen_exclusive"
|
||||
@@ -309,6 +317,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModes2EXT(
|
||||
#endif
|
||||
|
||||
|
||||
// VK_NV_acquire_winrt_display is a preprocessor guard. Do not pass it to API calls.
|
||||
#define VK_NV_acquire_winrt_display 1
|
||||
#define VK_NV_ACQUIRE_WINRT_DISPLAY_SPEC_VERSION 1
|
||||
#define VK_NV_ACQUIRE_WINRT_DISPLAY_EXTENSION_NAME "VK_NV_acquire_winrt_display"
|
||||
|
||||
Vendored
+183
-15
@@ -51,11 +51,32 @@ MAX_GLOBAL_PRIORITY_SIZE_EXT :: 16
|
||||
QUEUE_FAMILY_EXTERNAL :: MAX_QUEUE_FAMILY_EXTERNAL
|
||||
|
||||
// General Constants
|
||||
HEADER_VERSION :: 250
|
||||
HEADER_VERSION :: 296
|
||||
MAX_DRIVER_NAME_SIZE :: 256
|
||||
MAX_DRIVER_INFO_SIZE :: 256
|
||||
|
||||
// Vulkan Video Constants
|
||||
VIDEO_AV1_NUM_REF_FRAMES :: 8
|
||||
VIDEO_AV1_REFS_PER_FRAME :: 7
|
||||
VIDEO_AV1_TOTAL_REFS_PER_FRAME :: 8
|
||||
VIDEO_AV1_MAX_TILE_COLS :: 64
|
||||
VIDEO_AV1_MAX_TILE_ROWS :: 64
|
||||
VIDEO_AV1_MAX_SEGMENTS :: 8
|
||||
VIDEO_AV1_SEG_LVL_MAX :: 8
|
||||
VIDEO_AV1_PRIMARY_REF_NONE :: 7
|
||||
VIDEO_AV1_SELECT_INTEGER_MV :: 2
|
||||
VIDEO_AV1_SELECT_SCREEN_CONTENT_TOOLS :: 2
|
||||
VIDEO_AV1_SKIP_MODE_FRAMES :: 2
|
||||
VIDEO_AV1_MAX_LOOP_FILTER_STRENGTHS :: 4
|
||||
VIDEO_AV1_LOOP_FILTER_ADJUSTMENTS :: 2
|
||||
VIDEO_AV1_MAX_CDEF_FILTER_STRENGTHS :: 8
|
||||
VIDEO_AV1_MAX_NUM_PLANES :: 3
|
||||
VIDEO_AV1_GLOBAL_MOTION_PARAMS :: 6
|
||||
VIDEO_AV1_MAX_NUM_Y_POINTS :: 14
|
||||
VIDEO_AV1_MAX_NUM_CB_POINTS :: 10
|
||||
VIDEO_AV1_MAX_NUM_CR_POINTS :: 10
|
||||
VIDEO_AV1_MAX_NUM_POS_LUMA :: 24
|
||||
VIDEO_AV1_MAX_NUM_POS_CHROMA :: 25
|
||||
VIDEO_H264_CPB_CNT_LIST_SIZE :: 32
|
||||
VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS :: 6
|
||||
VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS :: 16
|
||||
@@ -63,8 +84,9 @@ VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS :: 6
|
||||
VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS :: 64
|
||||
VIDEO_H264_MAX_NUM_LIST_REF :: 32
|
||||
VIDEO_H264_MAX_CHROMA_PLANES :: 2
|
||||
VIDEO_H265_SUBLAYERS_LIST_SIZE :: 7
|
||||
VIDEO_H264_NO_REFERENCE_PICTURE :: 0xFF
|
||||
VIDEO_H265_CPB_CNT_LIST_SIZE :: 32
|
||||
VIDEO_H265_SUBLAYERS_LIST_SIZE :: 7
|
||||
VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS :: 6
|
||||
VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS :: 16
|
||||
VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS :: 6
|
||||
@@ -73,18 +95,19 @@ VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS :: 6
|
||||
VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS :: 64
|
||||
VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS :: 2
|
||||
VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS :: 64
|
||||
VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE :: 3
|
||||
VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE :: 128
|
||||
VIDEO_H265_MAX_DPB_SIZE :: 16
|
||||
VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS :: 32
|
||||
VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE :: 6
|
||||
VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE :: 19
|
||||
VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE :: 21
|
||||
VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE :: 3
|
||||
VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE :: 128
|
||||
VIDEO_H265_MAX_NUM_LIST_REF :: 15
|
||||
VIDEO_H265_MAX_CHROMA_PLANES :: 2
|
||||
VIDEO_H265_MAX_SHORT_TERM_REF_PIC_SETS :: 64
|
||||
VIDEO_H265_MAX_DPB_SIZE :: 16
|
||||
VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS :: 32
|
||||
VIDEO_H265_MAX_LONG_TERM_PICS :: 16
|
||||
VIDEO_H265_MAX_DELTA_POC :: 48
|
||||
VIDEO_H265_NO_REFERENCE_PICTURE :: 0xFF
|
||||
VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE :: 2
|
||||
VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE :: 8
|
||||
|
||||
@@ -108,10 +131,16 @@ KHR_video_queue :: 1
|
||||
KHR_VIDEO_QUEUE_SPEC_VERSION :: 8
|
||||
KHR_VIDEO_QUEUE_EXTENSION_NAME :: "VK_KHR_video_queue"
|
||||
KHR_video_decode_queue :: 1
|
||||
KHR_VIDEO_DECODE_QUEUE_SPEC_VERSION :: 7
|
||||
KHR_VIDEO_DECODE_QUEUE_SPEC_VERSION :: 8
|
||||
KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME :: "VK_KHR_video_decode_queue"
|
||||
KHR_video_encode_h264 :: 1
|
||||
KHR_VIDEO_ENCODE_H264_SPEC_VERSION :: 14
|
||||
KHR_VIDEO_ENCODE_H264_EXTENSION_NAME :: "VK_KHR_video_encode_h264"
|
||||
KHR_video_encode_h265 :: 1
|
||||
KHR_VIDEO_ENCODE_H265_SPEC_VERSION :: 14
|
||||
KHR_VIDEO_ENCODE_H265_EXTENSION_NAME :: "VK_KHR_video_encode_h265"
|
||||
KHR_video_decode_h264 :: 1
|
||||
KHR_VIDEO_DECODE_H264_SPEC_VERSION :: 8
|
||||
KHR_VIDEO_DECODE_H264_SPEC_VERSION :: 9
|
||||
KHR_VIDEO_DECODE_H264_EXTENSION_NAME :: "VK_KHR_video_decode_h264"
|
||||
KHR_dynamic_rendering :: 1
|
||||
KHR_DYNAMIC_RENDERING_SPEC_VERSION :: 1
|
||||
@@ -249,7 +278,7 @@ KHR_shader_clock :: 1
|
||||
KHR_SHADER_CLOCK_SPEC_VERSION :: 1
|
||||
KHR_SHADER_CLOCK_EXTENSION_NAME :: "VK_KHR_shader_clock"
|
||||
KHR_video_decode_h265 :: 1
|
||||
KHR_VIDEO_DECODE_H265_SPEC_VERSION :: 7
|
||||
KHR_VIDEO_DECODE_H265_SPEC_VERSION :: 8
|
||||
KHR_VIDEO_DECODE_H265_EXTENSION_NAME :: "VK_KHR_video_decode_h265"
|
||||
KHR_global_priority :: 1
|
||||
MAX_GLOBAL_PRIORITY_SIZE_KHR :: 16
|
||||
@@ -281,6 +310,12 @@ KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME :: "VK_KHR_shader_term
|
||||
KHR_fragment_shading_rate :: 1
|
||||
KHR_FRAGMENT_SHADING_RATE_SPEC_VERSION :: 2
|
||||
KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME :: "VK_KHR_fragment_shading_rate"
|
||||
KHR_dynamic_rendering_local_read :: 1
|
||||
KHR_DYNAMIC_RENDERING_LOCAL_READ_SPEC_VERSION :: 1
|
||||
KHR_DYNAMIC_RENDERING_LOCAL_READ_EXTENSION_NAME :: "VK_KHR_dynamic_rendering_local_read"
|
||||
KHR_shader_quad_control :: 1
|
||||
KHR_SHADER_QUAD_CONTROL_SPEC_VERSION :: 1
|
||||
KHR_SHADER_QUAD_CONTROL_EXTENSION_NAME :: "VK_KHR_shader_quad_control"
|
||||
KHR_spirv_1_4 :: 1
|
||||
KHR_SPIRV_1_4_SPEC_VERSION :: 1
|
||||
KHR_SPIRV_1_4_EXTENSION_NAME :: "VK_KHR_spirv_1_4"
|
||||
@@ -320,6 +355,9 @@ KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME :: "VK_KHR_shader_non_
|
||||
KHR_present_id :: 1
|
||||
KHR_PRESENT_ID_SPEC_VERSION :: 1
|
||||
KHR_PRESENT_ID_EXTENSION_NAME :: "VK_KHR_present_id"
|
||||
KHR_video_encode_queue :: 1
|
||||
KHR_VIDEO_ENCODE_QUEUE_SPEC_VERSION :: 12
|
||||
KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME :: "VK_KHR_video_encode_queue"
|
||||
KHR_synchronization2 :: 1
|
||||
KHR_SYNCHRONIZATION_2_SPEC_VERSION :: 1
|
||||
KHR_SYNCHRONIZATION_2_EXTENSION_NAME :: "VK_KHR_synchronization2"
|
||||
@@ -350,9 +388,65 @@ KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME :: "VK_KHR_portability
|
||||
KHR_maintenance4 :: 1
|
||||
KHR_MAINTENANCE_4_SPEC_VERSION :: 2
|
||||
KHR_MAINTENANCE_4_EXTENSION_NAME :: "VK_KHR_maintenance4"
|
||||
KHR_shader_subgroup_rotate :: 1
|
||||
KHR_SHADER_SUBGROUP_ROTATE_SPEC_VERSION :: 2
|
||||
KHR_SHADER_SUBGROUP_ROTATE_EXTENSION_NAME :: "VK_KHR_shader_subgroup_rotate"
|
||||
KHR_shader_maximal_reconvergence :: 1
|
||||
KHR_SHADER_MAXIMAL_RECONVERGENCE_SPEC_VERSION :: 1
|
||||
KHR_SHADER_MAXIMAL_RECONVERGENCE_EXTENSION_NAME :: "VK_KHR_shader_maximal_reconvergence"
|
||||
KHR_maintenance5 :: 1
|
||||
KHR_MAINTENANCE_5_SPEC_VERSION :: 1
|
||||
KHR_MAINTENANCE_5_EXTENSION_NAME :: "VK_KHR_maintenance5"
|
||||
KHR_ray_tracing_position_fetch :: 1
|
||||
KHR_RAY_TRACING_POSITION_FETCH_SPEC_VERSION :: 1
|
||||
KHR_RAY_TRACING_POSITION_FETCH_EXTENSION_NAME :: "VK_KHR_ray_tracing_position_fetch"
|
||||
KHR_pipeline_binary :: 1
|
||||
MAX_PIPELINE_BINARY_KEY_SIZE_KHR :: 32
|
||||
KHR_PIPELINE_BINARY_SPEC_VERSION :: 1
|
||||
KHR_PIPELINE_BINARY_EXTENSION_NAME :: "VK_KHR_pipeline_binary"
|
||||
KHR_cooperative_matrix :: 1
|
||||
KHR_COOPERATIVE_MATRIX_SPEC_VERSION :: 2
|
||||
KHR_COOPERATIVE_MATRIX_EXTENSION_NAME :: "VK_KHR_cooperative_matrix"
|
||||
KHR_compute_shader_derivatives :: 1
|
||||
KHR_COMPUTE_SHADER_DERIVATIVES_SPEC_VERSION :: 1
|
||||
KHR_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME :: "VK_KHR_compute_shader_derivatives"
|
||||
KHR_video_decode_av1 :: 1
|
||||
MAX_VIDEO_AV1_REFERENCES_PER_FRAME_KHR :: 7
|
||||
KHR_VIDEO_DECODE_AV1_SPEC_VERSION :: 1
|
||||
KHR_VIDEO_DECODE_AV1_EXTENSION_NAME :: "VK_KHR_video_decode_av1"
|
||||
KHR_video_maintenance1 :: 1
|
||||
KHR_VIDEO_MAINTENANCE_1_SPEC_VERSION :: 1
|
||||
KHR_VIDEO_MAINTENANCE_1_EXTENSION_NAME :: "VK_KHR_video_maintenance1"
|
||||
KHR_vertex_attribute_divisor :: 1
|
||||
KHR_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION :: 1
|
||||
KHR_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME :: "VK_KHR_vertex_attribute_divisor"
|
||||
KHR_load_store_op_none :: 1
|
||||
KHR_LOAD_STORE_OP_NONE_SPEC_VERSION :: 1
|
||||
KHR_LOAD_STORE_OP_NONE_EXTENSION_NAME :: "VK_KHR_load_store_op_none"
|
||||
KHR_shader_float_controls2 :: 1
|
||||
KHR_SHADER_FLOAT_CONTROLS_2_SPEC_VERSION :: 1
|
||||
KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME :: "VK_KHR_shader_float_controls2"
|
||||
KHR_index_type_uint8 :: 1
|
||||
KHR_INDEX_TYPE_UINT8_SPEC_VERSION :: 1
|
||||
KHR_INDEX_TYPE_UINT8_EXTENSION_NAME :: "VK_KHR_index_type_uint8"
|
||||
KHR_line_rasterization :: 1
|
||||
KHR_LINE_RASTERIZATION_SPEC_VERSION :: 1
|
||||
KHR_LINE_RASTERIZATION_EXTENSION_NAME :: "VK_KHR_line_rasterization"
|
||||
KHR_calibrated_timestamps :: 1
|
||||
KHR_CALIBRATED_TIMESTAMPS_SPEC_VERSION :: 1
|
||||
KHR_CALIBRATED_TIMESTAMPS_EXTENSION_NAME :: "VK_KHR_calibrated_timestamps"
|
||||
KHR_shader_expect_assume :: 1
|
||||
KHR_SHADER_EXPECT_ASSUME_SPEC_VERSION :: 1
|
||||
KHR_SHADER_EXPECT_ASSUME_EXTENSION_NAME :: "VK_KHR_shader_expect_assume"
|
||||
KHR_maintenance6 :: 1
|
||||
KHR_MAINTENANCE_6_SPEC_VERSION :: 1
|
||||
KHR_MAINTENANCE_6_EXTENSION_NAME :: "VK_KHR_maintenance6"
|
||||
KHR_shader_relaxed_extended_instruction :: 1
|
||||
KHR_SHADER_RELAXED_EXTENDED_INSTRUCTION_SPEC_VERSION :: 1
|
||||
KHR_SHADER_RELAXED_EXTENDED_INSTRUCTION_EXTENSION_NAME :: "VK_KHR_shader_relaxed_extended_instruction"
|
||||
KHR_maintenance7 :: 1
|
||||
KHR_MAINTENANCE_7_SPEC_VERSION :: 1
|
||||
KHR_MAINTENANCE_7_EXTENSION_NAME :: "VK_KHR_maintenance7"
|
||||
EXT_debug_report :: 1
|
||||
EXT_DEBUG_REPORT_SPEC_VERSION :: 10
|
||||
EXT_DEBUG_REPORT_EXTENSION_NAME :: "VK_EXT_debug_report"
|
||||
@@ -420,7 +514,7 @@ NV_external_memory :: 1
|
||||
NV_EXTERNAL_MEMORY_SPEC_VERSION :: 1
|
||||
NV_EXTERNAL_MEMORY_EXTENSION_NAME :: "VK_NV_external_memory"
|
||||
EXT_validation_flags :: 1
|
||||
EXT_VALIDATION_FLAGS_SPEC_VERSION :: 2
|
||||
EXT_VALIDATION_FLAGS_SPEC_VERSION :: 3
|
||||
EXT_VALIDATION_FLAGS_EXTENSION_NAME :: "VK_EXT_validation_flags"
|
||||
EXT_shader_subgroup_ballot :: 1
|
||||
EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION :: 1
|
||||
@@ -482,10 +576,10 @@ EXT_depth_clip_enable :: 1
|
||||
EXT_DEPTH_CLIP_ENABLE_SPEC_VERSION :: 1
|
||||
EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME :: "VK_EXT_depth_clip_enable"
|
||||
EXT_swapchain_colorspace :: 1
|
||||
EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION :: 4
|
||||
EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION :: 5
|
||||
EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME :: "VK_EXT_swapchain_colorspace"
|
||||
EXT_hdr_metadata :: 1
|
||||
EXT_HDR_METADATA_SPEC_VERSION :: 2
|
||||
EXT_HDR_METADATA_SPEC_VERSION :: 3
|
||||
EXT_HDR_METADATA_EXTENSION_NAME :: "VK_EXT_hdr_metadata"
|
||||
EXT_external_memory_dma_buf :: 1
|
||||
EXT_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION :: 1
|
||||
@@ -659,7 +753,7 @@ EXT_separate_stencil_usage :: 1
|
||||
EXT_SEPARATE_STENCIL_USAGE_SPEC_VERSION :: 1
|
||||
EXT_SEPARATE_STENCIL_USAGE_EXTENSION_NAME :: "VK_EXT_separate_stencil_usage"
|
||||
EXT_validation_features :: 1
|
||||
EXT_VALIDATION_FEATURES_SPEC_VERSION :: 5
|
||||
EXT_VALIDATION_FEATURES_SPEC_VERSION :: 6
|
||||
EXT_VALIDATION_FEATURES_EXTENSION_NAME :: "VK_EXT_validation_features"
|
||||
NV_cooperative_matrix :: 1
|
||||
NV_COOPERATIVE_MATRIX_SPEC_VERSION :: 1
|
||||
@@ -694,6 +788,12 @@ EXT_INDEX_TYPE_UINT8_EXTENSION_NAME :: "VK_EXT_index_type_
|
||||
EXT_extended_dynamic_state :: 1
|
||||
EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION :: 1
|
||||
EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME :: "VK_EXT_extended_dynamic_state"
|
||||
EXT_host_image_copy :: 1
|
||||
EXT_HOST_IMAGE_COPY_SPEC_VERSION :: 1
|
||||
EXT_HOST_IMAGE_COPY_EXTENSION_NAME :: "VK_EXT_host_image_copy"
|
||||
EXT_map_memory_placed :: 1
|
||||
EXT_MAP_MEMORY_PLACED_SPEC_VERSION :: 1
|
||||
EXT_MAP_MEMORY_PLACED_EXTENSION_NAME :: "VK_EXT_map_memory_placed"
|
||||
EXT_shader_atomic_float2 :: 1
|
||||
EXT_SHADER_ATOMIC_FLOAT_2_SPEC_VERSION :: 1
|
||||
EXT_SHADER_ATOMIC_FLOAT_2_EXTENSION_NAME :: "VK_EXT_shader_atomic_float2"
|
||||
@@ -715,6 +815,9 @@ NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME :: "VK_NV_inherited_vi
|
||||
EXT_texel_buffer_alignment :: 1
|
||||
EXT_TEXEL_BUFFER_ALIGNMENT_SPEC_VERSION :: 1
|
||||
EXT_TEXEL_BUFFER_ALIGNMENT_EXTENSION_NAME :: "VK_EXT_texel_buffer_alignment"
|
||||
EXT_depth_bias_control :: 1
|
||||
EXT_DEPTH_BIAS_CONTROL_SPEC_VERSION :: 1
|
||||
EXT_DEPTH_BIAS_CONTROL_EXTENSION_NAME :: "VK_EXT_depth_bias_control"
|
||||
EXT_device_memory_report :: 1
|
||||
EXT_DEVICE_MEMORY_REPORT_SPEC_VERSION :: 2
|
||||
EXT_DEVICE_MEMORY_REPORT_EXTENSION_NAME :: "VK_EXT_device_memory_report"
|
||||
@@ -742,6 +845,9 @@ EXT_PIPELINE_CREATION_CACHE_CONTROL_EXTENSION_NAME :: "VK_EXT_pipeline_cr
|
||||
NV_device_diagnostics_config :: 1
|
||||
NV_DEVICE_DIAGNOSTICS_CONFIG_SPEC_VERSION :: 2
|
||||
NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME :: "VK_NV_device_diagnostics_config"
|
||||
NV_cuda_kernel_launch :: 1
|
||||
NV_CUDA_KERNEL_LAUNCH_SPEC_VERSION :: 2
|
||||
NV_CUDA_KERNEL_LAUNCH_EXTENSION_NAME :: "VK_NV_cuda_kernel_launch"
|
||||
NV_low_latency :: 1
|
||||
NV_LOW_LATENCY_SPEC_VERSION :: 1
|
||||
NV_LOW_LATENCY_EXTENSION_NAME :: "VK_NV_low_latency"
|
||||
@@ -805,6 +911,9 @@ NV_EXTERNAL_MEMORY_RDMA_EXTENSION_NAME :: "VK_NV_external_mem
|
||||
EXT_pipeline_properties :: 1
|
||||
EXT_PIPELINE_PROPERTIES_SPEC_VERSION :: 1
|
||||
EXT_PIPELINE_PROPERTIES_EXTENSION_NAME :: "VK_EXT_pipeline_properties"
|
||||
EXT_frame_boundary :: 1
|
||||
EXT_FRAME_BOUNDARY_SPEC_VERSION :: 1
|
||||
EXT_FRAME_BOUNDARY_EXTENSION_NAME :: "VK_EXT_frame_boundary"
|
||||
EXT_multisampled_render_to_single_sampled :: 1
|
||||
EXT_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_SPEC_VERSION :: 1
|
||||
EXT_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_EXTENSION_NAME :: "VK_EXT_multisampled_render_to_single_sampled"
|
||||
@@ -859,6 +968,9 @@ NV_COPY_MEMORY_INDIRECT_EXTENSION_NAME :: "VK_NV_copy_memory_
|
||||
NV_memory_decompression :: 1
|
||||
NV_MEMORY_DECOMPRESSION_SPEC_VERSION :: 1
|
||||
NV_MEMORY_DECOMPRESSION_EXTENSION_NAME :: "VK_NV_memory_decompression"
|
||||
NV_device_generated_commands_compute :: 1
|
||||
NV_DEVICE_GENERATED_COMMANDS_COMPUTE_SPEC_VERSION :: 2
|
||||
NV_DEVICE_GENERATED_COMMANDS_COMPUTE_EXTENSION_NAME :: "VK_NV_device_generated_commands_compute"
|
||||
NV_linear_color_attachment :: 1
|
||||
NV_LINEAR_COLOR_ATTACHMENT_SPEC_VERSION :: 1
|
||||
NV_LINEAR_COLOR_ATTACHMENT_EXTENSION_NAME :: "VK_NV_linear_color_attachment"
|
||||
@@ -868,6 +980,12 @@ GOOGLE_SURFACELESS_QUERY_EXTENSION_NAME :: "VK_GOOGLE_surfacel
|
||||
EXT_image_compression_control_swapchain :: 1
|
||||
EXT_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_SPEC_VERSION :: 1
|
||||
EXT_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_EXTENSION_NAME :: "VK_EXT_image_compression_control_swapchain"
|
||||
EXT_nested_command_buffer :: 1
|
||||
EXT_NESTED_COMMAND_BUFFER_SPEC_VERSION :: 1
|
||||
EXT_NESTED_COMMAND_BUFFER_EXTENSION_NAME :: "VK_EXT_nested_command_buffer"
|
||||
EXT_external_memory_acquire_unmodified :: 1
|
||||
EXT_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_SPEC_VERSION :: 1
|
||||
EXT_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXTENSION_NAME :: "VK_EXT_external_memory_acquire_unmodified"
|
||||
EXT_extended_dynamic_state3 :: 1
|
||||
EXT_EXTENDED_DYNAMIC_STATE_3_SPEC_VERSION :: 2
|
||||
EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME :: "VK_EXT_extended_dynamic_state3"
|
||||
@@ -884,26 +1002,71 @@ NV_optical_flow :: 1
|
||||
NV_OPTICAL_FLOW_SPEC_VERSION :: 1
|
||||
NV_OPTICAL_FLOW_EXTENSION_NAME :: "VK_NV_optical_flow"
|
||||
EXT_legacy_dithering :: 1
|
||||
EXT_LEGACY_DITHERING_SPEC_VERSION :: 1
|
||||
EXT_LEGACY_DITHERING_SPEC_VERSION :: 2
|
||||
EXT_LEGACY_DITHERING_EXTENSION_NAME :: "VK_EXT_legacy_dithering"
|
||||
EXT_pipeline_protected_access :: 1
|
||||
EXT_PIPELINE_PROTECTED_ACCESS_SPEC_VERSION :: 1
|
||||
EXT_PIPELINE_PROTECTED_ACCESS_EXTENSION_NAME :: "VK_EXT_pipeline_protected_access"
|
||||
AMD_anti_lag :: 1
|
||||
AMD_ANTI_LAG_SPEC_VERSION :: 1
|
||||
AMD_ANTI_LAG_EXTENSION_NAME :: "VK_AMD_anti_lag"
|
||||
EXT_shader_object :: 1
|
||||
EXT_SHADER_OBJECT_SPEC_VERSION :: 1
|
||||
EXT_SHADER_OBJECT_EXTENSION_NAME :: "VK_EXT_shader_object"
|
||||
NV_ray_tracing_invocation_reorder :: 1
|
||||
NV_RAY_TRACING_INVOCATION_REORDER_SPEC_VERSION :: 1
|
||||
NV_RAY_TRACING_INVOCATION_REORDER_EXTENSION_NAME :: "VK_NV_ray_tracing_invocation_reorder"
|
||||
NV_extended_sparse_address_space :: 1
|
||||
NV_EXTENDED_SPARSE_ADDRESS_SPACE_SPEC_VERSION :: 1
|
||||
NV_EXTENDED_SPARSE_ADDRESS_SPACE_EXTENSION_NAME :: "VK_NV_extended_sparse_address_space"
|
||||
EXT_mutable_descriptor_type :: 1
|
||||
EXT_MUTABLE_DESCRIPTOR_TYPE_SPEC_VERSION :: 1
|
||||
EXT_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME :: "VK_EXT_mutable_descriptor_type"
|
||||
EXT_legacy_vertex_attributes :: 1
|
||||
EXT_LEGACY_VERTEX_ATTRIBUTES_SPEC_VERSION :: 1
|
||||
EXT_LEGACY_VERTEX_ATTRIBUTES_EXTENSION_NAME :: "VK_EXT_legacy_vertex_attributes"
|
||||
EXT_layer_settings :: 1
|
||||
EXT_LAYER_SETTINGS_SPEC_VERSION :: 2
|
||||
EXT_LAYER_SETTINGS_EXTENSION_NAME :: "VK_EXT_layer_settings"
|
||||
EXT_pipeline_library_group_handles :: 1
|
||||
EXT_PIPELINE_LIBRARY_GROUP_HANDLES_SPEC_VERSION :: 1
|
||||
EXT_PIPELINE_LIBRARY_GROUP_HANDLES_EXTENSION_NAME :: "VK_EXT_pipeline_library_group_handles"
|
||||
EXT_dynamic_rendering_unused_attachments :: 1
|
||||
EXT_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_SPEC_VERSION :: 1
|
||||
EXT_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_EXTENSION_NAME :: "VK_EXT_dynamic_rendering_unused_attachments"
|
||||
NV_low_latency2 :: 1
|
||||
NV_LOW_LATENCY_2_SPEC_VERSION :: 2
|
||||
NV_LOW_LATENCY_2_EXTENSION_NAME :: "VK_NV_low_latency2"
|
||||
NV_per_stage_descriptor_set :: 1
|
||||
NV_PER_STAGE_DESCRIPTOR_SET_SPEC_VERSION :: 1
|
||||
NV_PER_STAGE_DESCRIPTOR_SET_EXTENSION_NAME :: "VK_NV_per_stage_descriptor_set"
|
||||
EXT_attachment_feedback_loop_dynamic_state :: 1
|
||||
EXT_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_SPEC_VERSION :: 1
|
||||
EXT_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_EXTENSION_NAME :: "VK_EXT_attachment_feedback_loop_dynamic_state"
|
||||
NV_descriptor_pool_overallocation :: 1
|
||||
NV_DESCRIPTOR_POOL_OVERALLOCATION_SPEC_VERSION :: 1
|
||||
NV_DESCRIPTOR_POOL_OVERALLOCATION_EXTENSION_NAME :: "VK_NV_descriptor_pool_overallocation"
|
||||
NV_raw_access_chains :: 1
|
||||
NV_RAW_ACCESS_CHAINS_SPEC_VERSION :: 1
|
||||
NV_RAW_ACCESS_CHAINS_EXTENSION_NAME :: "VK_NV_raw_access_chains"
|
||||
NV_command_buffer_inheritance :: 1
|
||||
NV_COMMAND_BUFFER_INHERITANCE_SPEC_VERSION :: 1
|
||||
NV_COMMAND_BUFFER_INHERITANCE_EXTENSION_NAME :: "VK_NV_command_buffer_inheritance"
|
||||
NV_shader_atomic_float16_vector :: 1
|
||||
NV_SHADER_ATOMIC_FLOAT16_VECTOR_SPEC_VERSION :: 1
|
||||
NV_SHADER_ATOMIC_FLOAT16_VECTOR_EXTENSION_NAME :: "VK_NV_shader_atomic_float16_vector"
|
||||
EXT_shader_replicated_composites :: 1
|
||||
EXT_SHADER_REPLICATED_COMPOSITES_SPEC_VERSION :: 1
|
||||
EXT_SHADER_REPLICATED_COMPOSITES_EXTENSION_NAME :: "VK_EXT_shader_replicated_composites"
|
||||
NV_ray_tracing_validation :: 1
|
||||
NV_RAY_TRACING_VALIDATION_SPEC_VERSION :: 1
|
||||
NV_RAY_TRACING_VALIDATION_EXTENSION_NAME :: "VK_NV_ray_tracing_validation"
|
||||
EXT_device_generated_commands :: 1
|
||||
EXT_DEVICE_GENERATED_COMMANDS_SPEC_VERSION :: 1
|
||||
EXT_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME :: "VK_EXT_device_generated_commands"
|
||||
EXT_depth_clamp_control :: 1
|
||||
EXT_DEPTH_CLAMP_CONTROL_SPEC_VERSION :: 1
|
||||
EXT_DEPTH_CLAMP_CONTROL_EXTENSION_NAME :: "VK_EXT_depth_clamp_control"
|
||||
KHR_acceleration_structure :: 1
|
||||
KHR_ACCELERATION_STRUCTURE_SPEC_VERSION :: 13
|
||||
KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME :: "VK_KHR_acceleration_structure"
|
||||
@@ -947,7 +1110,7 @@ EXT_metal_surface :: 1
|
||||
EXT_METAL_SURFACE_SPEC_VERSION :: 1
|
||||
EXT_METAL_SURFACE_EXTENSION_NAME :: "VK_EXT_metal_surface"
|
||||
EXT_metal_objects :: 1
|
||||
EXT_METAL_OBJECTS_SPEC_VERSION :: 1
|
||||
EXT_METAL_OBJECTS_SPEC_VERSION :: 2
|
||||
EXT_METAL_OBJECTS_EXTENSION_NAME :: "VK_EXT_metal_objects"
|
||||
KHR_wayland_surface :: 1
|
||||
KHR_WAYLAND_SURFACE_SPEC_VERSION :: 6
|
||||
@@ -989,6 +1152,7 @@ DisplayModeKHR :: distinct NonDispatchableHandle
|
||||
VideoSessionKHR :: distinct NonDispatchableHandle
|
||||
VideoSessionParametersKHR :: distinct NonDispatchableHandle
|
||||
DeferredOperationKHR :: distinct NonDispatchableHandle
|
||||
PipelineBinaryKHR :: distinct NonDispatchableHandle
|
||||
DebugReportCallbackEXT :: distinct NonDispatchableHandle
|
||||
CuModuleNVX :: distinct NonDispatchableHandle
|
||||
CuFunctionNVX :: distinct NonDispatchableHandle
|
||||
@@ -997,9 +1161,13 @@ ValidationCacheEXT :: distinct NonDispatchableHandle
|
||||
AccelerationStructureNV :: distinct NonDispatchableHandle
|
||||
PerformanceConfigurationINTEL :: distinct NonDispatchableHandle
|
||||
IndirectCommandsLayoutNV :: distinct NonDispatchableHandle
|
||||
CudaModuleNV :: distinct NonDispatchableHandle
|
||||
CudaFunctionNV :: distinct NonDispatchableHandle
|
||||
AccelerationStructureKHR :: distinct NonDispatchableHandle
|
||||
MicromapEXT :: distinct NonDispatchableHandle
|
||||
OpticalFlowSessionNV :: distinct NonDispatchableHandle
|
||||
ShaderEXT :: distinct NonDispatchableHandle
|
||||
IndirectExecutionSetEXT :: distinct NonDispatchableHandle
|
||||
IndirectCommandsLayoutEXT :: distinct NonDispatchableHandle
|
||||
|
||||
|
||||
|
||||
Vendored
+692
-106
File diff suppressed because it is too large
Load Diff
Vendored
+372
-3
File diff suppressed because it is too large
Load Diff
Vendored
+2035
-76
File diff suppressed because it is too large
Load Diff
Vendored
+3
-3
@@ -6,9 +6,9 @@ The `js_wasm32` target assumes that the WASM output will be ran within a web bro
|
||||
|
||||
## Example for `js_wasm32`
|
||||
|
||||
```js
|
||||
<!-- Copy `vendor:wasm/js/runtime.js` into your web server -->
|
||||
<script type="text/javascript" src="runtime.js"></script>
|
||||
```html
|
||||
<!-- Copy `core:sys/wasm/js/odin.js` into your web server -->
|
||||
<script type="text/javascript" src="odin.js"></script>
|
||||
<script type="text/javascript">
|
||||
odin.runWasm(pathToWasm, consolePreElement);
|
||||
</script>
|
||||
|
||||
Vendored
-76
@@ -1,76 +0,0 @@
|
||||
//+build js wasm32, js wasm64p32
|
||||
package wasm_js_interface
|
||||
|
||||
foreign import dom_lib "odin_dom"
|
||||
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
get_element_value_f64 :: proc(id: string) -> f64 ---
|
||||
set_element_value_f64 :: proc(id: string, value: f64) ---
|
||||
|
||||
set_element_value_string :: proc(id: string, value: string) ---
|
||||
get_element_value_string_length :: proc(id: string) -> int ---
|
||||
|
||||
device_pixel_ratio :: proc() -> f64 ---
|
||||
|
||||
window_set_scroll :: proc(x, y: f64) ---
|
||||
}
|
||||
|
||||
get_element_value_string :: proc "contextless" (id: string, buf: []byte) -> string {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="get_element_value_string")
|
||||
_get_element_value_string :: proc(id: string, buf: []byte) -> int ---
|
||||
}
|
||||
n := _get_element_value_string(id, buf)
|
||||
return string(buf[:n])
|
||||
|
||||
}
|
||||
|
||||
|
||||
get_element_min_max :: proc "contextless" (id: string) -> (min, max: f64) {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="get_element_min_max")
|
||||
_get_element_min_max :: proc(min_max: ^[2]f64, id: string) ---
|
||||
}
|
||||
min_max: [2]f64
|
||||
_get_element_min_max(&min_max, id)
|
||||
return min_max[0], min_max[1]
|
||||
}
|
||||
|
||||
|
||||
Rect :: struct {
|
||||
x, y, width, height: f64,
|
||||
}
|
||||
|
||||
get_bounding_client_rect :: proc "contextless" (id: string) -> (rect: Rect) {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="get_bounding_client_rect")
|
||||
_get_bounding_client_rect :: proc(rect: ^Rect, id: string) ---
|
||||
}
|
||||
_get_bounding_client_rect(&rect, id)
|
||||
return
|
||||
}
|
||||
|
||||
window_get_rect :: proc "contextless" () -> (rect: Rect) {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="window_get_rect")
|
||||
_window_get_rect :: proc(rect: ^Rect) ---
|
||||
}
|
||||
_window_get_rect(&rect)
|
||||
return
|
||||
}
|
||||
|
||||
window_get_scroll :: proc "contextless" () -> (x, y: f64) {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="window_get_scroll")
|
||||
_window_get_scroll :: proc(scroll: ^[2]f64) ---
|
||||
}
|
||||
scroll: [2]f64
|
||||
_window_get_scroll(&scroll)
|
||||
return scroll.x, scroll.y
|
||||
}
|
||||
Vendored
-36
@@ -1,36 +0,0 @@
|
||||
//+build !js
|
||||
package wasm_js_interface
|
||||
|
||||
import "base:runtime"
|
||||
|
||||
|
||||
get_element_value_string :: proc "contextless" (id: string, buf: []byte) -> string {
|
||||
context = runtime.default_context()
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
|
||||
get_element_min_max :: proc "contextless" (id: string) -> (min, max: f64) {
|
||||
context = runtime.default_context()
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
|
||||
Rect :: struct {
|
||||
x, y, width, height: f64,
|
||||
}
|
||||
|
||||
get_bounding_client_rect :: proc "contextless" (id: string) -> (rect: Rect) {
|
||||
context = runtime.default_context()
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
window_get_rect :: proc "contextless" () -> (rect: Rect) {
|
||||
context = runtime.default_context()
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
window_get_scroll :: proc "contextless" () -> (x, y: f64) {
|
||||
context = runtime.default_context()
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
Vendored
-361
@@ -1,361 +0,0 @@
|
||||
//+build js wasm32, js wasm64p32
|
||||
package wasm_js_interface
|
||||
|
||||
foreign import dom_lib "odin_dom"
|
||||
|
||||
Event_Kind :: enum u32 {
|
||||
Invalid,
|
||||
|
||||
Load,
|
||||
Unload,
|
||||
Error,
|
||||
Resize,
|
||||
Visibility_Change,
|
||||
Fullscreen_Change,
|
||||
Fullscreen_Error,
|
||||
|
||||
Click,
|
||||
Double_Click,
|
||||
Mouse_Move,
|
||||
Mouse_Over,
|
||||
Mouse_Out,
|
||||
Mouse_Up,
|
||||
Mouse_Down,
|
||||
|
||||
Key_Up,
|
||||
Key_Down,
|
||||
Key_Press,
|
||||
|
||||
Scroll,
|
||||
Wheel,
|
||||
|
||||
Focus,
|
||||
Submit,
|
||||
Blur,
|
||||
Change,
|
||||
HashChange,
|
||||
Select,
|
||||
|
||||
Animation_Start,
|
||||
Animation_End,
|
||||
Animation_Iteration,
|
||||
Animation_Cancel,
|
||||
|
||||
Copy,
|
||||
Cut,
|
||||
Paste,
|
||||
|
||||
// Drag,
|
||||
// Drag_Start,
|
||||
// Drag_End,
|
||||
// Drag_Enter,
|
||||
// Drag_Leave,
|
||||
// Drag_Over,
|
||||
// Drop,
|
||||
|
||||
Pointer_Cancel,
|
||||
Pointer_Down,
|
||||
Pointer_Enter,
|
||||
Pointer_Leave,
|
||||
Pointer_Move,
|
||||
Pointer_Over,
|
||||
Pointer_Up,
|
||||
Got_Pointer_Capture,
|
||||
Lost_Pointer_Capture,
|
||||
Pointer_Lock_Change,
|
||||
Pointer_Lock_Error,
|
||||
|
||||
Selection_Change,
|
||||
Selection_Start,
|
||||
|
||||
Touch_Cancel,
|
||||
Touch_End,
|
||||
Touch_Move,
|
||||
Touch_Start,
|
||||
|
||||
Transition_Start,
|
||||
Transition_End,
|
||||
Transition_Run,
|
||||
Transition_Cancel,
|
||||
|
||||
Context_Menu,
|
||||
|
||||
Custom,
|
||||
|
||||
}
|
||||
event_kind_string := [Event_Kind]string{
|
||||
.Invalid = "",
|
||||
|
||||
.Load = "load",
|
||||
.Unload = "unload",
|
||||
.Error = "error",
|
||||
.Resize = "resize",
|
||||
.Visibility_Change = "visibilitychange",
|
||||
.Fullscreen_Change = "fullscreenchange",
|
||||
.Fullscreen_Error = "fullscreenerror",
|
||||
|
||||
.Click = "click",
|
||||
.Double_Click = "dblclick",
|
||||
.Mouse_Move = "mousemove",
|
||||
.Mouse_Over = "mouseover",
|
||||
.Mouse_Out = "mouseout",
|
||||
.Mouse_Up = "mouseup",
|
||||
.Mouse_Down = "mousedown",
|
||||
|
||||
.Key_Up = "keyup",
|
||||
.Key_Down = "keydown",
|
||||
.Key_Press = "keypress",
|
||||
|
||||
.Scroll = "scroll",
|
||||
.Wheel = "wheel",
|
||||
|
||||
.Focus = "focus",
|
||||
.Submit = "submit",
|
||||
.Blur = "blur",
|
||||
.Change = "change",
|
||||
.HashChange = "hashchange",
|
||||
.Select = "select",
|
||||
|
||||
.Animation_Start = "animationstart",
|
||||
.Animation_End = "animationend",
|
||||
.Animation_Iteration = "animationiteration",
|
||||
.Animation_Cancel = "animationcancel",
|
||||
|
||||
.Copy = "copy",
|
||||
.Cut = "cut",
|
||||
.Paste = "paste",
|
||||
|
||||
// .Drag, = "drag",
|
||||
// .Drag_Start, = "dragstart",
|
||||
// .Drag_End, = "dragend",
|
||||
// .Drag_Enter, = "dragenter",
|
||||
// .Drag_Leave, = "dragleave",
|
||||
// .Drag_Over, = "dragover",
|
||||
// .Drop, = "drop",
|
||||
|
||||
.Pointer_Cancel = "pointercancel",
|
||||
.Pointer_Down = "pointerdown",
|
||||
.Pointer_Enter = "pointerenter",
|
||||
.Pointer_Leave = "pointerleave",
|
||||
.Pointer_Move = "pointermove",
|
||||
.Pointer_Over = "pointerover",
|
||||
.Pointer_Up = "pointerup",
|
||||
.Got_Pointer_Capture = "gotpointercapture",
|
||||
.Lost_Pointer_Capture = "lostpointercapture",
|
||||
.Pointer_Lock_Change = "pointerlockchange",
|
||||
.Pointer_Lock_Error = "pointerlockerror",
|
||||
|
||||
.Selection_Change = "selectionchange",
|
||||
.Selection_Start = "selectionstart",
|
||||
|
||||
.Transition_Start = "transitionstart",
|
||||
.Transition_End = "transitionend",
|
||||
.Transition_Run = "transitionrun",
|
||||
.Transition_Cancel = "transitioncancel",
|
||||
|
||||
.Touch_Cancel = "touchcancel",
|
||||
.Touch_End = "touchend",
|
||||
.Touch_Move = "touchmove",
|
||||
.Touch_Start = "touchstart",
|
||||
|
||||
.Context_Menu = "contextmenu",
|
||||
|
||||
.Custom = "?custom?",
|
||||
}
|
||||
|
||||
Delta_Mode :: enum u32 {
|
||||
Pixel = 0,
|
||||
Line = 1,
|
||||
Page = 2,
|
||||
}
|
||||
|
||||
Key_Location :: enum u8 {
|
||||
Standard = 0,
|
||||
Left = 1,
|
||||
Right = 2,
|
||||
Numpad = 3,
|
||||
}
|
||||
|
||||
KEYBOARD_MAX_KEY_SIZE :: 16
|
||||
KEYBOARD_MAX_CODE_SIZE :: 16
|
||||
|
||||
Event_Target_Kind :: enum u32 {
|
||||
Element = 0,
|
||||
Document = 1,
|
||||
Window = 2,
|
||||
}
|
||||
|
||||
Event_Phase :: enum u8 {
|
||||
None = 0,
|
||||
Capturing_Phase = 1,
|
||||
At_Target = 2,
|
||||
Bubbling_Phase = 3,
|
||||
}
|
||||
|
||||
Event_Option :: enum u8 {
|
||||
Bubbles = 0,
|
||||
Cancelable = 1,
|
||||
Composed = 2,
|
||||
}
|
||||
Event_Options :: distinct bit_set[Event_Option; u8]
|
||||
|
||||
Event :: struct {
|
||||
kind: Event_Kind,
|
||||
target_kind: Event_Target_Kind,
|
||||
current_target_kind: Event_Target_Kind,
|
||||
id: string,
|
||||
timestamp: f64,
|
||||
|
||||
phase: Event_Phase,
|
||||
options: Event_Options,
|
||||
is_composing: bool,
|
||||
is_trusted: bool,
|
||||
|
||||
using data: struct #raw_union #align(8) {
|
||||
scroll: struct {
|
||||
delta: [2]f64,
|
||||
},
|
||||
visibility_change: struct {
|
||||
is_visible: bool,
|
||||
},
|
||||
wheel: struct {
|
||||
delta: [3]f64,
|
||||
delta_mode: Delta_Mode,
|
||||
},
|
||||
|
||||
key: struct {
|
||||
key: string,
|
||||
code: string,
|
||||
location: Key_Location,
|
||||
|
||||
ctrl: bool,
|
||||
shift: bool,
|
||||
alt: bool,
|
||||
meta: bool,
|
||||
|
||||
repeat: bool,
|
||||
|
||||
_key_len: int,
|
||||
_code_len: int,
|
||||
_key_buf: [KEYBOARD_MAX_KEY_SIZE]byte,
|
||||
_code_buf: [KEYBOARD_MAX_KEY_SIZE]byte,
|
||||
},
|
||||
|
||||
mouse: struct {
|
||||
screen: [2]i64,
|
||||
client: [2]i64,
|
||||
offset: [2]i64,
|
||||
page: [2]i64,
|
||||
movement: [2]i64,
|
||||
|
||||
ctrl: bool,
|
||||
shift: bool,
|
||||
alt: bool,
|
||||
meta: bool,
|
||||
|
||||
button: i16,
|
||||
buttons: bit_set[0..<16; u16],
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
user_data: rawptr,
|
||||
callback: proc(e: Event),
|
||||
}
|
||||
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
event_stop_propagation :: proc() ---
|
||||
event_stop_immediate_propagation :: proc() ---
|
||||
event_prevent_default :: proc() ---
|
||||
dispatch_custom_event :: proc(id: string, name: string, options := Event_Options{}) -> bool ---
|
||||
}
|
||||
|
||||
add_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="add_event_listener")
|
||||
_add_event_listener :: proc(id: string, name: string, name_code: Event_Kind, user_data: rawptr, callback: proc "odin" (Event), use_capture: bool) -> bool ---
|
||||
}
|
||||
// TODO: Pointer_Lock_Change etc related stuff for all different browsers
|
||||
return _add_event_listener(id, event_kind_string[kind], kind, user_data, callback, use_capture)
|
||||
}
|
||||
|
||||
remove_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event)) -> bool {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="remove_event_listener")
|
||||
_remove_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc "odin" (Event)) -> bool ---
|
||||
}
|
||||
return _remove_event_listener(id, event_kind_string[kind], user_data, callback)
|
||||
}
|
||||
|
||||
add_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="add_window_event_listener")
|
||||
_add_window_event_listener :: proc(name: string, name_code: Event_Kind, user_data: rawptr, callback: proc "odin" (Event), use_capture: bool) -> bool ---
|
||||
}
|
||||
return _add_window_event_listener(event_kind_string[kind], kind, user_data, callback, use_capture)
|
||||
}
|
||||
|
||||
remove_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event)) -> bool {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="remove_window_event_listener")
|
||||
_remove_window_event_listener :: proc(name: string, user_data: rawptr, callback: proc "odin" (Event)) -> bool ---
|
||||
}
|
||||
return _remove_window_event_listener(event_kind_string[kind], user_data, callback)
|
||||
}
|
||||
|
||||
remove_event_listener_from_event :: proc(e: Event) -> bool {
|
||||
if e.id == "" {
|
||||
return remove_window_event_listener(e.kind, e.user_data, e.callback)
|
||||
}
|
||||
return remove_event_listener(e.id, e.kind, e.user_data, e.callback)
|
||||
}
|
||||
|
||||
add_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="add_event_listener")
|
||||
_add_event_listener :: proc(id: string, name: string, name_code: Event_Kind, user_data: rawptr, callback: proc "odin" (Event), use_capture: bool) -> bool ---
|
||||
}
|
||||
return _add_event_listener(id, name, .Custom, user_data, callback, use_capture)
|
||||
}
|
||||
remove_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event)) -> bool {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
@(link_name="remove_event_listener")
|
||||
_remove_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc "odin" (Event)) -> bool ---
|
||||
}
|
||||
return _remove_event_listener(id, name, user_data, callback)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@(export, link_name="odin_dom_do_event_callback")
|
||||
do_event_callback :: proc(user_data: rawptr, callback: proc(e: Event)) {
|
||||
@(default_calling_convention="contextless")
|
||||
foreign dom_lib {
|
||||
init_event_raw :: proc(e: ^Event) ---
|
||||
}
|
||||
|
||||
if callback != nil {
|
||||
event := Event{
|
||||
user_data = user_data,
|
||||
callback = callback,
|
||||
}
|
||||
|
||||
|
||||
init_event_raw(&event)
|
||||
|
||||
if event.kind == .Key_Up || event.kind == .Key_Down || event.kind == .Key_Press {
|
||||
event.key.key = string(event.key._key_buf[:event.key._key_len])
|
||||
event.key.code = string(event.key._code_buf[:event.key._code_len])
|
||||
}
|
||||
|
||||
callback(event)
|
||||
}
|
||||
}
|
||||
-288
@@ -1,288 +0,0 @@
|
||||
//+build !js
|
||||
package wasm_js_interface
|
||||
|
||||
|
||||
Event_Kind :: enum u32 {
|
||||
Invalid,
|
||||
|
||||
Load,
|
||||
Unload,
|
||||
Error,
|
||||
Resize,
|
||||
Visibility_Change,
|
||||
Fullscreen_Change,
|
||||
Fullscreen_Error,
|
||||
|
||||
Click,
|
||||
Double_Click,
|
||||
Mouse_Move,
|
||||
Mouse_Over,
|
||||
Mouse_Out,
|
||||
Mouse_Up,
|
||||
Mouse_Down,
|
||||
|
||||
Key_Up,
|
||||
Key_Down,
|
||||
Key_Press,
|
||||
|
||||
Scroll,
|
||||
Wheel,
|
||||
|
||||
Focus,
|
||||
Submit,
|
||||
Blur,
|
||||
Change,
|
||||
Select,
|
||||
|
||||
Animation_Start,
|
||||
Animation_End,
|
||||
Animation_Iteration,
|
||||
Animation_Cancel,
|
||||
|
||||
Copy,
|
||||
Cut,
|
||||
Paste,
|
||||
|
||||
// Drag,
|
||||
// Drag_Start,
|
||||
// Drag_End,
|
||||
// Drag_Enter,
|
||||
// Drag_Leave,
|
||||
// Drag_Over,
|
||||
// Drop,
|
||||
|
||||
Pointer_Cancel,
|
||||
Pointer_Down,
|
||||
Pointer_Enter,
|
||||
Pointer_Leave,
|
||||
Pointer_Move,
|
||||
Pointer_Over,
|
||||
Pointer_Up,
|
||||
Got_Pointer_Capture,
|
||||
Lost_Pointer_Capture,
|
||||
Pointer_Lock_Change,
|
||||
Pointer_Lock_Error,
|
||||
|
||||
Selection_Change,
|
||||
Selection_Start,
|
||||
|
||||
Touch_Cancel,
|
||||
Touch_End,
|
||||
Touch_Move,
|
||||
Touch_Start,
|
||||
|
||||
Transition_Start,
|
||||
Transition_End,
|
||||
Transition_Run,
|
||||
Transition_Cancel,
|
||||
|
||||
Context_Menu,
|
||||
|
||||
Custom,
|
||||
|
||||
}
|
||||
event_kind_string := [Event_Kind]string{
|
||||
.Invalid = "",
|
||||
|
||||
.Load = "load",
|
||||
.Unload = "unload",
|
||||
.Error = "error",
|
||||
.Resize = "resize",
|
||||
.Visibility_Change = "visibilitychange",
|
||||
.Fullscreen_Change = "fullscreenchange",
|
||||
.Fullscreen_Error = "fullscreenerror",
|
||||
|
||||
.Click = "click",
|
||||
.Double_Click = "dblclick",
|
||||
.Mouse_Move = "mousemove",
|
||||
.Mouse_Over = "mouseover",
|
||||
.Mouse_Out = "mouseout",
|
||||
.Mouse_Up = "mouseup",
|
||||
.Mouse_Down = "mousedown",
|
||||
|
||||
.Key_Up = "keyup",
|
||||
.Key_Down = "keydown",
|
||||
.Key_Press = "keypress",
|
||||
|
||||
.Scroll = "scroll",
|
||||
.Wheel = "wheel",
|
||||
|
||||
.Focus = "focus",
|
||||
.Submit = "submit",
|
||||
.Blur = "blur",
|
||||
.Change = "change",
|
||||
.Select = "select",
|
||||
|
||||
.Animation_Start = "animationstart",
|
||||
.Animation_End = "animationend",
|
||||
.Animation_Iteration = "animationiteration",
|
||||
.Animation_Cancel = "animationcancel",
|
||||
|
||||
.Copy = "copy",
|
||||
.Cut = "cut",
|
||||
.Paste = "paste",
|
||||
|
||||
// .Drag, = "drag",
|
||||
// .Drag_Start, = "dragstart",
|
||||
// .Drag_End, = "dragend",
|
||||
// .Drag_Enter, = "dragenter",
|
||||
// .Drag_Leave, = "dragleave",
|
||||
// .Drag_Over, = "dragover",
|
||||
// .Drop, = "drop",
|
||||
|
||||
.Pointer_Cancel = "pointercancel",
|
||||
.Pointer_Down = "pointerdown",
|
||||
.Pointer_Enter = "pointerenter",
|
||||
.Pointer_Leave = "pointerleave",
|
||||
.Pointer_Move = "pointermove",
|
||||
.Pointer_Over = "pointerover",
|
||||
.Pointer_Up = "pointerup",
|
||||
.Got_Pointer_Capture = "gotpointercapture",
|
||||
.Lost_Pointer_Capture = "lostpointercapture",
|
||||
.Pointer_Lock_Change = "pointerlockchange",
|
||||
.Pointer_Lock_Error = "pointerlockerror",
|
||||
|
||||
.Selection_Change = "selectionchange",
|
||||
.Selection_Start = "selectionstart",
|
||||
|
||||
.Transition_Start = "transitionstart",
|
||||
.Transition_End = "transitionend",
|
||||
.Transition_Run = "transitionrun",
|
||||
.Transition_Cancel = "transitioncancel",
|
||||
|
||||
.Touch_Cancel = "touchcancel",
|
||||
.Touch_End = "touchend",
|
||||
.Touch_Move = "touchmove",
|
||||
.Touch_Start = "touchstart",
|
||||
|
||||
.Context_Menu = "contextmenu",
|
||||
|
||||
.Custom = "?custom?",
|
||||
}
|
||||
|
||||
Delta_Mode :: enum u32 {
|
||||
Pixel = 0,
|
||||
Line = 1,
|
||||
Page = 2,
|
||||
}
|
||||
|
||||
Key_Location :: enum u8 {
|
||||
Standard = 0,
|
||||
Left = 1,
|
||||
Right = 2,
|
||||
Numpad = 3,
|
||||
}
|
||||
|
||||
KEYBOARD_MAX_KEY_SIZE :: 16
|
||||
KEYBOARD_MAX_CODE_SIZE :: 16
|
||||
|
||||
Event_Target_Kind :: enum u32 {
|
||||
Element = 0,
|
||||
Document = 1,
|
||||
Window = 2,
|
||||
}
|
||||
|
||||
Event_Phase :: enum u8 {
|
||||
None = 0,
|
||||
Capturing_Phase = 1,
|
||||
At_Target = 2,
|
||||
Bubbling_Phase = 3,
|
||||
}
|
||||
|
||||
Event_Option :: enum u8 {
|
||||
Bubbles = 0,
|
||||
Cancelable = 1,
|
||||
Composed = 2,
|
||||
}
|
||||
Event_Options :: distinct bit_set[Event_Option; u8]
|
||||
|
||||
Event :: struct {
|
||||
kind: Event_Kind,
|
||||
target_kind: Event_Target_Kind,
|
||||
current_target_kind: Event_Target_Kind,
|
||||
id: string,
|
||||
timestamp: f64,
|
||||
|
||||
phase: Event_Phase,
|
||||
options: Event_Options,
|
||||
is_composing: bool,
|
||||
is_trusted: bool,
|
||||
|
||||
using data: struct #raw_union #align(8) {
|
||||
scroll: struct {
|
||||
delta: [2]f64,
|
||||
},
|
||||
visibility_change: struct {
|
||||
is_visible: bool,
|
||||
},
|
||||
wheel: struct {
|
||||
delta: [3]f64,
|
||||
delta_mode: Delta_Mode,
|
||||
},
|
||||
|
||||
key: struct {
|
||||
key: string,
|
||||
code: string,
|
||||
location: Key_Location,
|
||||
|
||||
ctrl: bool,
|
||||
shift: bool,
|
||||
alt: bool,
|
||||
meta: bool,
|
||||
|
||||
repeat: bool,
|
||||
|
||||
_key_buf: [KEYBOARD_MAX_KEY_SIZE]byte,
|
||||
_code_buf: [KEYBOARD_MAX_KEY_SIZE]byte,
|
||||
},
|
||||
|
||||
mouse: struct {
|
||||
screen: [2]i64,
|
||||
client: [2]i64,
|
||||
offset: [2]i64,
|
||||
page: [2]i64,
|
||||
movement: [2]i64,
|
||||
|
||||
ctrl: bool,
|
||||
shift: bool,
|
||||
alt: bool,
|
||||
meta: bool,
|
||||
|
||||
button: i16,
|
||||
buttons: bit_set[0..<16; u16],
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
user_data: rawptr,
|
||||
callback: proc(e: Event),
|
||||
}
|
||||
|
||||
|
||||
add_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
remove_event_listener :: proc(id: string, kind: Event_Kind, user_data: rawptr, callback: proc(e: Event)) -> bool {
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
add_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
remove_window_event_listener :: proc(kind: Event_Kind, user_data: rawptr, callback: proc(e: Event)) -> bool {
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
remove_event_listener_from_event :: proc(e: Event) -> bool {
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
add_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event), use_capture := false) -> bool {
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
remove_custom_event_listener :: proc(id: string, name: string, user_data: rawptr, callback: proc(e: Event)) -> bool {
|
||||
panic("vendor:wasm/js not supported on non JS targets")
|
||||
}
|
||||
|
||||
Vendored
-12
@@ -1,12 +0,0 @@
|
||||
//+build js wasm32, js wasm64p32
|
||||
package wasm_js_interface
|
||||
|
||||
foreign import "odin_env"
|
||||
|
||||
@(default_calling_convention="contextless")
|
||||
foreign odin_env {
|
||||
trap :: proc() -> ! ---
|
||||
abort :: proc() -> ! ---
|
||||
alert :: proc(msg: string) ---
|
||||
evaluate :: proc(str: string) ---
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
//+build !js
|
||||
package wasm_js_interface
|
||||
|
||||
import "core:mem"
|
||||
|
||||
PAGE_SIZE :: 64 * 1024
|
||||
page_alloc :: proc(page_count: int) -> (data: []byte, err: mem.Allocator_Error) {
|
||||
panic("vendor:wasm/js not supported on non-js targets")
|
||||
}
|
||||
|
||||
page_allocator :: proc() -> mem.Allocator {
|
||||
panic("vendor:wasm/js not supported on non-js targets")
|
||||
}
|
||||
|
||||
Vendored
-44
@@ -1,44 +0,0 @@
|
||||
//+build js wasm32, js wasm64p32
|
||||
package wasm_js_interface
|
||||
|
||||
import "core:mem"
|
||||
import "base:intrinsics"
|
||||
|
||||
PAGE_SIZE :: 64 * 1024
|
||||
page_alloc :: proc(page_count: int) -> (data: []byte, err: mem.Allocator_Error) {
|
||||
prev_page_count := intrinsics.wasm_memory_grow(0, uintptr(page_count))
|
||||
if prev_page_count < 0 {
|
||||
return nil, .Out_Of_Memory
|
||||
}
|
||||
|
||||
ptr := ([^]u8)(uintptr(prev_page_count) * PAGE_SIZE)
|
||||
return ptr[:page_count * PAGE_SIZE], nil
|
||||
}
|
||||
|
||||
page_allocator :: proc() -> mem.Allocator {
|
||||
procedure :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode,
|
||||
size, alignment: int,
|
||||
old_memory: rawptr, old_size: int,
|
||||
location := #caller_location) -> ([]byte, mem.Allocator_Error) {
|
||||
switch mode {
|
||||
case .Alloc, .Alloc_Non_Zeroed:
|
||||
assert(size % PAGE_SIZE == 0)
|
||||
return page_alloc(size/PAGE_SIZE)
|
||||
case .Resize, .Free, .Free_All, .Query_Info, .Resize_Non_Zeroed:
|
||||
return nil, .Mode_Not_Implemented
|
||||
case .Query_Features:
|
||||
set := (^mem.Allocator_Mode_Set)(old_memory)
|
||||
if set != nil {
|
||||
set^ = {.Alloc, .Query_Features}
|
||||
}
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return {
|
||||
procedure = procedure,
|
||||
data = nil,
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
-1818
File diff suppressed because it is too large
Load Diff
Vendored
+2
-2
@@ -8,10 +8,10 @@ PAGE_SIZE := 65536
|
||||
INITIAL_MEMORY_BYTES := $(shell expr $(INITIAL_MEMORY_PAGES) \* $(PAGE_SIZE))
|
||||
MAX_MEMORY_BYTES := $(shell expr $(MAX_MEMORY_PAGES) \* $(PAGE_SIZE))
|
||||
|
||||
web/triangle.wasm: $(FILES) ../../wgpu.js ../../../wasm/js/runtime.js
|
||||
web/triangle.wasm: $(FILES) ../../wgpu.js ../../../../core/sys/wasm/js/odin.js
|
||||
odin build . \
|
||||
-target:js_wasm32 -out:web/triangle.wasm -o:size \
|
||||
-extra-linker-flags:"--export-table --import-memory --initial-memory=$(INITIAL_MEMORY_BYTES) --max-memory=$(MAX_MEMORY_BYTES)"
|
||||
|
||||
cp ../../wgpu.js web/wgpu.js
|
||||
cp ../../../wasm/js/runtime.js web/runtime.js
|
||||
cp ../../../../core/sys/wasm/js/odin.js web/odin.js
|
||||
|
||||
Vendored
+1
-1
@@ -9,4 +9,4 @@ set /a MAX_MEMORY_BYTES=%MAX_MEMORY_PAGES% * %PAGE_SIZE%
|
||||
call odin.exe build . -target:js_wasm32 -out:web/triangle.wasm -o:size -extra-linker-flags:"--export-table --import-memory --initial-memory=%INITIAL_MEMORY_BYTES% --max-memory=%MAX_MEMORY_BYTES%"
|
||||
|
||||
copy "..\..\wgpu.js" "web\wgpu.js"
|
||||
copy "..\..\..\wasm\js\runtime.js" "web\runtime.js"
|
||||
copy "..\..\..\..\core\sys\wasm\js\odin.js" "web\odin.js"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
//+build !js
|
||||
#+build !js
|
||||
package vendor_wgpu_example_triangle
|
||||
|
||||
import "core:time"
|
||||
|
||||
Vendored
+2
-1
@@ -1,7 +1,8 @@
|
||||
package vendor_wgpu_example_triangle
|
||||
|
||||
import "core:sys/wasm/js"
|
||||
|
||||
import "vendor:wgpu"
|
||||
import "vendor:wasm/js"
|
||||
|
||||
OS :: struct {
|
||||
initialized: bool,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user