chore(v2): vendor dependencies for offline/China builds
go mod vendor pins onnxruntime_go v1.12.1, Gio and the rest into v2/vendor so go run/build work without hitting proxy.golang.org (blocked/slow in China). Verified: CGO_ENABLED=1 go build -mod=vendor ./internal/spike and GOOS=windows go build -mod=vendor ./internal/ui both pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+2145
File diff suppressed because it is too large
Load Diff
+46
@@ -0,0 +1,46 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
//go:build !nowayland
|
||||
// +build !nowayland
|
||||
|
||||
package vk
|
||||
|
||||
/*
|
||||
#define VK_USE_PLATFORM_ANDROID_KHR
|
||||
#define VK_NO_PROTOTYPES 1
|
||||
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
|
||||
#include <android/native_window.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
static VkResult vkCreateAndroidSurfaceKHR(PFN_vkCreateAndroidSurfaceKHR f, VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {
|
||||
return f(instance, pCreateInfo, pAllocator, pSurface);
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var wlFuncs struct {
|
||||
vkCreateAndroidSurfaceKHR C.PFN_vkCreateAndroidSurfaceKHR
|
||||
}
|
||||
|
||||
func init() {
|
||||
loadFuncs = append(loadFuncs, func(dlopen func(name string) *[0]byte) {
|
||||
wlFuncs.vkCreateAndroidSurfaceKHR = dlopen("vkCreateAndroidSurfaceKHR")
|
||||
})
|
||||
}
|
||||
|
||||
func CreateAndroidSurface(inst Instance, window unsafe.Pointer) (Surface, error) {
|
||||
inf := C.VkAndroidSurfaceCreateInfoKHR{
|
||||
sType: C.VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR,
|
||||
window: (*C.ANativeWindow)(window),
|
||||
}
|
||||
var surf Surface
|
||||
if err := vkErr(C.vkCreateAndroidSurfaceKHR(wlFuncs.vkCreateAndroidSurfaceKHR, inst, &inf, nil, &surf)); err != nil {
|
||||
return 0, fmt.Errorf("vulkan: vkCreateAndroidSurfaceKHR: %w", err)
|
||||
}
|
||||
return surf, nil
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
//go:build ((linux && !android) || freebsd) && !nowayland
|
||||
// +build linux,!android freebsd
|
||||
// +build !nowayland
|
||||
|
||||
package vk
|
||||
|
||||
/*
|
||||
#cgo linux pkg-config: wayland-client
|
||||
|
||||
#define VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#define VK_NO_PROTOTYPES 1
|
||||
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
static VkResult vkCreateWaylandSurfaceKHR(PFN_vkCreateWaylandSurfaceKHR f, VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {
|
||||
return f(instance, pCreateInfo, pAllocator, pSurface);
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var wlFuncs struct {
|
||||
vkCreateWaylandSurfaceKHR C.PFN_vkCreateWaylandSurfaceKHR
|
||||
}
|
||||
|
||||
func init() {
|
||||
loadFuncs = append(loadFuncs, func(dlopen func(name string) *[0]byte) {
|
||||
wlFuncs.vkCreateWaylandSurfaceKHR = dlopen("vkCreateWaylandSurfaceKHR")
|
||||
})
|
||||
}
|
||||
|
||||
func CreateWaylandSurface(inst Instance, disp unsafe.Pointer, wlSurf unsafe.Pointer) (Surface, error) {
|
||||
inf := C.VkWaylandSurfaceCreateInfoKHR{
|
||||
sType: C.VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR,
|
||||
display: (*C.struct_wl_display)(disp),
|
||||
surface: (*C.struct_wl_surface)(wlSurf),
|
||||
}
|
||||
var surf Surface
|
||||
if err := vkErr(C.vkCreateWaylandSurfaceKHR(wlFuncs.vkCreateWaylandSurfaceKHR, inst, &inf, nil, &surf)); err != nil {
|
||||
return 0, fmt.Errorf("vulkan: vkCreateWaylandSurfaceKHR: %w", err)
|
||||
}
|
||||
return surf, nil
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
//go:build ((linux && !android) || freebsd) && !nox11
|
||||
// +build linux,!android freebsd
|
||||
// +build !nox11
|
||||
|
||||
package vk
|
||||
|
||||
/*
|
||||
#define VK_USE_PLATFORM_XLIB_KHR
|
||||
#define VK_NO_PROTOTYPES 1
|
||||
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
static VkResult vkCreateXlibSurfaceKHR(PFN_vkCreateXlibSurfaceKHR f, VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {
|
||||
return f(instance, pCreateInfo, pAllocator, pSurface);
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var x11Funcs struct {
|
||||
vkCreateXlibSurfaceKHR C.PFN_vkCreateXlibSurfaceKHR
|
||||
}
|
||||
|
||||
func init() {
|
||||
loadFuncs = append(loadFuncs, func(dlopen func(name string) *[0]byte) {
|
||||
x11Funcs.vkCreateXlibSurfaceKHR = dlopen("vkCreateXlibSurfaceKHR")
|
||||
})
|
||||
}
|
||||
|
||||
func CreateXlibSurface(inst Instance, dpy unsafe.Pointer, window uintptr) (Surface, error) {
|
||||
inf := C.VkXlibSurfaceCreateInfoKHR{
|
||||
sType: C.VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
|
||||
dpy: (*C.Display)(dpy),
|
||||
window: (C.Window)(window),
|
||||
}
|
||||
var surf Surface
|
||||
if err := vkErr(C.vkCreateXlibSurfaceKHR(x11Funcs.vkCreateXlibSurfaceKHR, inst, &inf, nil, &surf)); err != nil {
|
||||
return 0, fmt.Errorf("vulkan: vkCreateXlibSurfaceKHR: %w", err)
|
||||
}
|
||||
return surf, nil
|
||||
}
|
||||
Reference in New Issue
Block a user