all: add #cgo optimization directives

Closes #3196
This commit is contained in:
Hajime Hoshi
2025-09-22 03:38:25 +09:00
parent 5afdb9588f
commit 74835fb5bd
18 changed files with 348 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ package audio
// //
// #import <UIKit/UIKit.h> // #import <UIKit/UIKit.h>
// //
// #cgo noescape applicationState
// #cgo nocallback applicationState
// static UIApplicationState applicationState() { // static UIApplicationState applicationState() {
// if ([NSThread isMainThread]) { // if ([NSThread isMainThread]) {
// return [[UIApplication sharedApplication] applicationState]; // return [[UIApplication sharedApplication] applicationState];

View File

@@ -293,6 +293,8 @@ package gamepad
// return hat; // return hat;
// } // }
// //
// #cgo noescape getControllerState
// #cgo nocallback getControllerState
// static void getControllerState(uintptr_t controller_ptr, struct ControllerState* controllerState, // static void getControllerState(uintptr_t controller_ptr, struct ControllerState* controllerState,
// uint16_t buttonMask, uint8_t nHats, // uint16_t buttonMask, uint8_t nHats,
// bool hasDualshockTouchpad, bool hasXboxPaddles, bool hasXboxShareButton) { // bool hasDualshockTouchpad, bool hasXboxPaddles, bool hasXboxShareButton) {
@@ -365,6 +367,7 @@ package gamepad
// } // }
// } // }
// //
// #cgo noescape initializeGamepads
// static void initializeGamepads(void) { // static void initializeGamepads(void) {
// @autoreleasepool { // @autoreleasepool {
// for (GCController* controller in [GCController controllers]) { // for (GCController* controller in [GCController controllers]) {

View File

@@ -6,8 +6,6 @@
package glfw package glfw
import "C"
// #cgo pkg-config: x11 xau xcb xdmcp // #cgo pkg-config: x11 xau xcb xdmcp
// #cgo CFLAGS: -D_GLFW_HAS_DLOPEN -D_GLFW_X11 -D_GLFW_HAS_GLXGETPROCADDRESSARB // #cgo CFLAGS: -D_GLFW_HAS_DLOPEN -D_GLFW_X11 -D_GLFW_HAS_GLXGETPROCADDRESSARB
// #cgo LDFLAGS: -lm // #cgo LDFLAGS: -lm

View File

@@ -11,6 +11,7 @@ package glfw
// //
// void goErrorCB(int code, char* desc); // void goErrorCB(int code, char* desc);
// //
// #cgo noescape glfwSetErrorCallbackCB
// static void glfwSetErrorCallbackCB() { // static void glfwSetErrorCallbackCB() {
// glfwSetErrorCallback((GLFWerrorfun)goErrorCB); // glfwSetErrorCallback((GLFWerrorfun)goErrorCB);
// } // }

View File

@@ -19,34 +19,42 @@ package glfw
// void goScrollCB(void* window, double xoff, double yoff); // void goScrollCB(void* window, double xoff, double yoff);
// void goDropCB(void* window, int count, char** names); // void goDropCB(void* window, int count, char** names);
// //
// #cgo noescape glfwSetKeyCallbackCB
// static void glfwSetKeyCallbackCB(GLFWwindow *window) { // static void glfwSetKeyCallbackCB(GLFWwindow *window) {
// glfwSetKeyCallback(window, (GLFWkeyfun)goKeyCB); // glfwSetKeyCallback(window, (GLFWkeyfun)goKeyCB);
// } // }
// //
// #cgo noescape glfwSetCharCallbackCB
// static void glfwSetCharCallbackCB(GLFWwindow *window) { // static void glfwSetCharCallbackCB(GLFWwindow *window) {
// glfwSetCharCallback(window, (GLFWcharfun)goCharCB); // glfwSetCharCallback(window, (GLFWcharfun)goCharCB);
// } // }
// //
// #cgo noescape glfwSetCharModsCallbackCB
// static void glfwSetCharModsCallbackCB(GLFWwindow *window) { // static void glfwSetCharModsCallbackCB(GLFWwindow *window) {
// glfwSetCharModsCallback(window, (GLFWcharmodsfun)goCharModsCB); // glfwSetCharModsCallback(window, (GLFWcharmodsfun)goCharModsCB);
// } // }
// //
// #cgo noescape glfwSetMouseButtonCallbackCB
// static void glfwSetMouseButtonCallbackCB(GLFWwindow *window) { // static void glfwSetMouseButtonCallbackCB(GLFWwindow *window) {
// glfwSetMouseButtonCallback(window, (GLFWmousebuttonfun)goMouseButtonCB); // glfwSetMouseButtonCallback(window, (GLFWmousebuttonfun)goMouseButtonCB);
// } // }
// //
// #cgo noescape glfwSetCursorPosCallbackCB
// static void glfwSetCursorPosCallbackCB(GLFWwindow *window) { // static void glfwSetCursorPosCallbackCB(GLFWwindow *window) {
// glfwSetCursorPosCallback(window, (GLFWcursorposfun)goCursorPosCB); // glfwSetCursorPosCallback(window, (GLFWcursorposfun)goCursorPosCB);
// } // }
// //
// #cgo noescape glfwSetCursorEnterCallbackCB
// static void glfwSetCursorEnterCallbackCB(GLFWwindow *window) { // static void glfwSetCursorEnterCallbackCB(GLFWwindow *window) {
// glfwSetCursorEnterCallback(window, (GLFWcursorenterfun)goCursorEnterCB); // glfwSetCursorEnterCallback(window, (GLFWcursorenterfun)goCursorEnterCB);
// } // }
// //
// #cgo noescape glfwSetScrollCallbackCB
// static void glfwSetScrollCallbackCB(GLFWwindow *window) { // static void glfwSetScrollCallbackCB(GLFWwindow *window) {
// glfwSetScrollCallback(window, (GLFWscrollfun)goScrollCB); // glfwSetScrollCallback(window, (GLFWscrollfun)goScrollCB);
// } // }
// //
// #cgo noescape glfwSetDropCallbackCB
// static void glfwSetDropCallbackCB(GLFWwindow *window) { // static void glfwSetDropCallbackCB(GLFWwindow *window) {
// glfwSetDropCallback(window, (GLFWdropfun)goDropCB); // glfwSetDropCallback(window, (GLFWdropfun)goDropCB);
// } // }

View File

@@ -11,22 +11,31 @@ package glfw
// //
// void goMonitorCB(void* monitor, int event); // void goMonitorCB(void* monitor, int event);
// //
// #cgo noescape GetMonitorAtIndex
// #cgo nocallback GetMonitorAtIndex
// static GLFWmonitor *GetMonitorAtIndex(GLFWmonitor **monitors, int index) { // static GLFWmonitor *GetMonitorAtIndex(GLFWmonitor **monitors, int index) {
// return monitors[index]; // return monitors[index];
// } // }
// //
// #cgo noescape GetVidmodeAtIndex
// #cgo nocallback GetVidmodeAtIndex
// static GLFWvidmode GetVidmodeAtIndex(GLFWvidmode *vidmodes, int index) { // static GLFWvidmode GetVidmodeAtIndex(GLFWvidmode *vidmodes, int index) {
// return vidmodes[index]; // return vidmodes[index];
// } // }
// //
// #cgo noescape glfwSetMonitorCallbackCB
// static void glfwSetMonitorCallbackCB() { // static void glfwSetMonitorCallbackCB() {
// glfwSetMonitorCallback((GLFWmonitorfun)goMonitorCB); // glfwSetMonitorCallback((GLFWmonitorfun)goMonitorCB);
// } // }
// //
// #cgo noescape GetGammaAtIndex
// #cgo nocallback GetGammaAtIndex
// static unsigned int GetGammaAtIndex(unsigned short *color, int i) { // static unsigned int GetGammaAtIndex(unsigned short *color, int i) {
// return color[i]; // return color[i];
// } // }
// //
// #cgo noescape SetGammaAtIndex
// #cgo nocallback SetGammaAtIndex
// static void SetGammaAtIndex(unsigned short *color, int i, unsigned short value) { // static void SetGammaAtIndex(unsigned short *color, int i, unsigned short value) {
// color[i] = value; // color[i] = value;
// } // }

View File

@@ -12,9 +12,14 @@ package glfw
// workaround wrappers needed due to a cgo and/or LLVM bug. // workaround wrappers needed due to a cgo and/or LLVM bug.
// See: https://github.com/go-gl/glfw/issues/136 // See: https://github.com/go-gl/glfw/issues/136
#cgo noescape workaround_glfwGetCocoaWindow
#cgo nocallback workaround_glfwGetCocoaWindow
static void *workaround_glfwGetCocoaWindow(GLFWwindow *w) { static void *workaround_glfwGetCocoaWindow(GLFWwindow *w) {
return (void *)glfwGetCocoaWindow(w); return (void *)glfwGetCocoaWindow(w);
} }
#cgo noescape workaround_glfwGetNSGLContext
#cgo nocallback workaround_glfwGetNSGLContext
static void *workaround_glfwGetNSGLContext(GLFWwindow *w) { static void *workaround_glfwGetNSGLContext(GLFWwindow *w) {
return (void *)glfwGetNSGLContext(w); return (void *)glfwGetNSGLContext(w);
} }

View File

@@ -20,38 +20,47 @@ package glfw
// void goWindowMaximizeCB(void* window, int maximized); // void goWindowMaximizeCB(void* window, int maximized);
// void goWindowContentScaleCB(void* window, float x, float y); // void goWindowContentScaleCB(void* window, float x, float y);
// //
// #cgo noescape glfwSetWindowPosCallbackCB
// static void glfwSetWindowPosCallbackCB(GLFWwindow *window) { // static void glfwSetWindowPosCallbackCB(GLFWwindow *window) {
// glfwSetWindowPosCallback(window, (GLFWwindowposfun)goWindowPosCB); // glfwSetWindowPosCallback(window, (GLFWwindowposfun)goWindowPosCB);
// } // }
// //
// #cgo noescape glfwSetWindowSizeCallbackCB
// static void glfwSetWindowSizeCallbackCB(GLFWwindow *window) { // static void glfwSetWindowSizeCallbackCB(GLFWwindow *window) {
// glfwSetWindowSizeCallback(window, (GLFWwindowsizefun)goWindowSizeCB); // glfwSetWindowSizeCallback(window, (GLFWwindowsizefun)goWindowSizeCB);
// } // }
// //
// #cgo noescape glfwSetWindowCloseCallbackCB
// static void glfwSetWindowCloseCallbackCB(GLFWwindow *window) { // static void glfwSetWindowCloseCallbackCB(GLFWwindow *window) {
// glfwSetWindowCloseCallback(window, (GLFWwindowclosefun)goWindowCloseCB); // glfwSetWindowCloseCallback(window, (GLFWwindowclosefun)goWindowCloseCB);
// } // }
// //
// #cgo noescape glfwSetWindowRefreshCallbackCB
// static void glfwSetWindowRefreshCallbackCB(GLFWwindow *window) { // static void glfwSetWindowRefreshCallbackCB(GLFWwindow *window) {
// glfwSetWindowRefreshCallback(window, (GLFWwindowrefreshfun)goWindowRefreshCB); // glfwSetWindowRefreshCallback(window, (GLFWwindowrefreshfun)goWindowRefreshCB);
// } // }
// //
// #cgo noescape glfwSetWindowFocusCallbackCB
// static void glfwSetWindowFocusCallbackCB(GLFWwindow *window) { // static void glfwSetWindowFocusCallbackCB(GLFWwindow *window) {
// glfwSetWindowFocusCallback(window, (GLFWwindowfocusfun)goWindowFocusCB); // glfwSetWindowFocusCallback(window, (GLFWwindowfocusfun)goWindowFocusCB);
// } // }
// //
// #cgo noescape glfwSetWindowIconifyCallbackCB
// static void glfwSetWindowIconifyCallbackCB(GLFWwindow *window) { // static void glfwSetWindowIconifyCallbackCB(GLFWwindow *window) {
// glfwSetWindowIconifyCallback(window, (GLFWwindowiconifyfun)goWindowIconifyCB); // glfwSetWindowIconifyCallback(window, (GLFWwindowiconifyfun)goWindowIconifyCB);
// } // }
// //
// #cgo noescape glfwSetFramebufferSizeCallbackCB
// static void glfwSetFramebufferSizeCallbackCB(GLFWwindow *window) { // static void glfwSetFramebufferSizeCallbackCB(GLFWwindow *window) {
// glfwSetFramebufferSizeCallback(window, (GLFWframebuffersizefun)goFramebufferSizeCB); // glfwSetFramebufferSizeCallback(window, (GLFWframebuffersizefun)goFramebufferSizeCB);
// } // }
// //
// #cgo noescape glfwSetWindowMaximizeCallbackCB
// static void glfwSetWindowMaximizeCallbackCB(GLFWwindow *window) { // static void glfwSetWindowMaximizeCallbackCB(GLFWwindow *window) {
// glfwSetWindowMaximizeCallback(window, (GLFWwindowmaximizefun)goWindowMaximizeCB); // glfwSetWindowMaximizeCallback(window, (GLFWwindowmaximizefun)goWindowMaximizeCB);
// } // }
// //
// #cgo noescape glfwSetWindowContentScaleCallbackCB
// static void glfwSetWindowContentScaleCallbackCB(GLFWwindow *window) { // static void glfwSetWindowContentScaleCallbackCB(GLFWwindow *window) {
// glfwSetWindowContentScaleCallback(window, (GLFWwindowcontentscalefun)goWindowContentScaleCB); // glfwSetWindowContentScaleCallback(window, (GLFWwindowcontentscalefun)goWindowContentScaleCB);
// } // }

View File

@@ -140,33 +140,108 @@ void Ebitengine_ID3D12GraphicsCommandList_SetPipelineState(void* i, void* pPipel
// #include <stdint.h> // #include <stdint.h>
// //
// #cgo noescape D3D12_RESOURCE_STATE_PRESENT
// #cgo nocallback D3D12_RESOURCE_STATE_PRESENT
// int32_t Ebitengine_D3D12_RESOURCE_STATE_PRESENT(); // int32_t Ebitengine_D3D12_RESOURCE_STATE_PRESENT();
// //
// #cgo noescape ID3D12CommandQueue_ExecuteCommandLists
// #cgo nocallback ID3D12CommandQueue_ExecuteCommandLists
// void Ebitengine_ID3D12CommandQueue_ExecuteCommandLists(void* i, uint32_t numCommandLists, void* ppCommandLists); // void Ebitengine_ID3D12CommandQueue_ExecuteCommandLists(void* i, uint32_t numCommandLists, void* ppCommandLists);
//
// #cgo noescape ID3D12CommandQueue_PresentX
// #cgo nocallback ID3D12CommandQueue_PresentX
// uintptr_t Ebitengine_ID3D12CommandQueue_PresentX(void* i, uint32_t planeCount, void* pPlaneParameters, void* pPresentParameters); // uintptr_t Ebitengine_ID3D12CommandQueue_PresentX(void* i, uint32_t planeCount, void* pPlaneParameters, void* pPresentParameters);
//
// #cgo noescape ID3D12CommandQueue_Release
// #cgo nocallback ID3D12CommandQueue_Release
// uint32_t Ebitengine_ID3D12CommandQueue_Release(void* i); // uint32_t Ebitengine_ID3D12CommandQueue_Release(void* i);
//
// #cgo noescape ID3D12CommandQueue_ResumeX
// #cgo nocallback ID3D12CommandQueue_ResumeX
// uintptr_t Ebitengine_ID3D12CommandQueue_ResumeX(void* i); // uintptr_t Ebitengine_ID3D12CommandQueue_ResumeX(void* i);
//
// #cgo noescape ID3D12CommandQueue_Signal
// #cgo nocallback ID3D12CommandQueue_Signal
// uintptr_t Ebitengine_ID3D12CommandQueue_Signal(void* i, void* pFence, uint64_t value); // uintptr_t Ebitengine_ID3D12CommandQueue_Signal(void* i, void* pFence, uint64_t value);
//
// #cgo noescape ID3D12CommandQueue_SuspendX
// #cgo nocallback ID3D12CommandQueue_SuspendX
// uintptr_t Ebitengine_ID3D12CommandQueue_SuspendX(void* i, uint32_t flags); // uintptr_t Ebitengine_ID3D12CommandQueue_SuspendX(void* i, uint32_t flags);
// //
// #cgo noescape ID3D12GraphicsCommandList_ClearDepthStencilView
// #cgo nocallback ID3D12GraphicsCommandList_ClearDepthStencilView
// void Ebitengine_ID3D12GraphicsCommandList_ClearDepthStencilView(void* i, uintptr_t depthStencilView, int32_t clearFlags, float depth, uint8_t stencil, uint32_t numRects, void* pRects); // void Ebitengine_ID3D12GraphicsCommandList_ClearDepthStencilView(void* i, uintptr_t depthStencilView, int32_t clearFlags, float depth, uint8_t stencil, uint32_t numRects, void* pRects);
//
// #cgo noescape ID3D12GraphicsCommandList_ClearRenderTargetView
// #cgo nocallback ID3D12GraphicsCommandList_ClearRenderTargetView
// void Ebitengine_ID3D12GraphicsCommandList_ClearRenderTargetView(void* i, uintptr_t pRenderTargetView, void* colorRGBA, uint32_t numRects, void* pRects); // void Ebitengine_ID3D12GraphicsCommandList_ClearRenderTargetView(void* i, uintptr_t pRenderTargetView, void* colorRGBA, uint32_t numRects, void* pRects);
//
// #cgo noescape ID3D12GraphicsCommandList_Close
// #cgo nocallback ID3D12GraphicsCommandList_Close
// uintptr_t Ebitengine_ID3D12GraphicsCommandList_Close(void* i); // uintptr_t Ebitengine_ID3D12GraphicsCommandList_Close(void* i);
//
// #cgo noescape ID3D12GraphicsCommandList_CopyTextureRegion
// #cgo nocallback ID3D12GraphicsCommandList_CopyTextureRegion
// void Ebitengine_ID3D12GraphicsCommandList_CopyTextureRegion(void* i, void* pDst, uint32_t dstX, uint32_t dstY, uint32_t dstZ, void* pSrc, void* pSrcBox); // void Ebitengine_ID3D12GraphicsCommandList_CopyTextureRegion(void* i, void* pDst, uint32_t dstX, uint32_t dstY, uint32_t dstZ, void* pSrc, void* pSrcBox);
//
// #cgo noescape ID3D12GraphicsCommandList_DrawIndexedInstanced
// #cgo nocallback ID3D12GraphicsCommandList_DrawIndexedInstanced
// void Ebitengine_ID3D12GraphicsCommandList_DrawIndexedInstanced(void* i, uint32_t indexCountPerInstance, uint32_t instanceCount, uint32_t startIndexLocation, int32_t baseVertexLocation, uint32_t startInstanceLocation); // void Ebitengine_ID3D12GraphicsCommandList_DrawIndexedInstanced(void* i, uint32_t indexCountPerInstance, uint32_t instanceCount, uint32_t startIndexLocation, int32_t baseVertexLocation, uint32_t startInstanceLocation);
//
// #cgo noescape ID3D12GraphicsCommandList_IASetIndexBuffer
// #cgo nocallback ID3D12GraphicsCommandList_IASetIndexBuffer
// void Ebitengine_ID3D12GraphicsCommandList_IASetIndexBuffer(void* i, void* pView); // void Ebitengine_ID3D12GraphicsCommandList_IASetIndexBuffer(void* i, void* pView);
//
// #cgo noescape ID3D12GraphicsCommandList_IASetPrimitiveTopology
// #cgo nocallback ID3D12GraphicsCommandList_IASetPrimitiveTopology
// void Ebitengine_ID3D12GraphicsCommandList_IASetPrimitiveTopology(void* i, int32_t primitiveTopology); // void Ebitengine_ID3D12GraphicsCommandList_IASetPrimitiveTopology(void* i, int32_t primitiveTopology);
//
// #cgo noescape ID3D12GraphicsCommandList_IASetVertexBuffers
// #cgo nocallback ID3D12GraphicsCommandList_IASetVertexBuffers
// void Ebitengine_ID3D12GraphicsCommandList_IASetVertexBuffers(void* i, uint32_t startSlot, uint32_t numViews, void* pViews); // void Ebitengine_ID3D12GraphicsCommandList_IASetVertexBuffers(void* i, uint32_t startSlot, uint32_t numViews, void* pViews);
//
// #cgo noescape ID3D12GraphicsCommandList_OMSetRenderTargets
// #cgo nocallback ID3D12GraphicsCommandList_OMSetRenderTargets
// void Ebitengine_ID3D12GraphicsCommandList_OMSetRenderTargets(void* i, uint32_t numRenderTargetDescriptors, void* pRenderTargetDescriptors, int rtsSingleHandleToDescriptorRange, void* pDepthStencilDescriptor); // void Ebitengine_ID3D12GraphicsCommandList_OMSetRenderTargets(void* i, uint32_t numRenderTargetDescriptors, void* pRenderTargetDescriptors, int rtsSingleHandleToDescriptorRange, void* pDepthStencilDescriptor);
//
// #cgo noescape ID3D12GraphicsCommandList_OMSetStencilRef
// #cgo nocallback ID3D12GraphicsCommandList_OMSetStencilRef
// void Ebitengine_ID3D12GraphicsCommandList_OMSetStencilRef(void* i, uint32_t stencilRef); // void Ebitengine_ID3D12GraphicsCommandList_OMSetStencilRef(void* i, uint32_t stencilRef);
//
// #cgo noescape ID3D12GraphicsCommandList_Release
// #cgo nocallback ID3D12GraphicsCommandList_Release
// uint32_t Ebitengine_ID3D12GraphicsCommandList_Release(void* i); // uint32_t Ebitengine_ID3D12GraphicsCommandList_Release(void* i);
//
// #cgo noescape ID3D12GraphicsCommandList_Reset
// #cgo nocallback ID3D12GraphicsCommandList_Reset
// uintptr_t Ebitengine_ID3D12GraphicsCommandList_Reset(void* i, void* pAllocator, void* pInitialState); // uintptr_t Ebitengine_ID3D12GraphicsCommandList_Reset(void* i, void* pAllocator, void* pInitialState);
//
// #cgo noescape ID3D12GraphicsCommandList_ResourceBarrier
// #cgo nocallback ID3D12GraphicsCommandList_ResourceBarrier
// void Ebitengine_ID3D12GraphicsCommandList_ResourceBarrier(void* i, uint32_t numBarriers, void* pBarriers); // void Ebitengine_ID3D12GraphicsCommandList_ResourceBarrier(void* i, uint32_t numBarriers, void* pBarriers);
//
// #cgo noescape ID3D12GraphicsCommandList_RSSetViewports
// #cgo nocallback ID3D12GraphicsCommandList_RSSetViewports
// void Ebitengine_ID3D12GraphicsCommandList_RSSetViewports(void* i, uint32_t numViewports, void* pViewports); // void Ebitengine_ID3D12GraphicsCommandList_RSSetViewports(void* i, uint32_t numViewports, void* pViewports);
//
// #cgo noescape ID3D12GraphicsCommandList_RSSetScissorRects
// #cgo nocallback ID3D12GraphicsCommandList_RSSetScissorRects
// void Ebitengine_ID3D12GraphicsCommandList_RSSetScissorRects(void* i, uint32_t numRects, void* pRects); // void Ebitengine_ID3D12GraphicsCommandList_RSSetScissorRects(void* i, uint32_t numRects, void* pRects);
//
// #cgo noescape ID3D12GraphicsCommandList_SetDescriptorHeaps
// #cgo nocallback ID3D12GraphicsCommandList_SetDescriptorHeaps
// void Ebitengine_ID3D12GraphicsCommandList_SetDescriptorHeaps(void* i, uint32_t numDescriptorHeaps, void* ppDescriptorHeaps); // void Ebitengine_ID3D12GraphicsCommandList_SetDescriptorHeaps(void* i, uint32_t numDescriptorHeaps, void* ppDescriptorHeaps);
//
// #cgo noescape ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable
// #cgo nocallback ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable
// void Ebitengine_ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(void* i, uint32_t rootParameterIndex, uint64_t baseDescriptorPtr); // void Ebitengine_ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(void* i, uint32_t rootParameterIndex, uint64_t baseDescriptorPtr);
//
// #cgo noescape ID3D12GraphicsCommandList_SetGraphicsRootSignature
// #cgo nocallback ID3D12GraphicsCommandList_SetGraphicsRootSignature
// void Ebitengine_ID3D12GraphicsCommandList_SetGraphicsRootSignature(void* i, void* pRootSignature); // void Ebitengine_ID3D12GraphicsCommandList_SetGraphicsRootSignature(void* i, void* pRootSignature);
//
// #cgo noescape ID3D12GraphicsCommandList_SetPipelineState
// #cgo nocallback ID3D12GraphicsCommandList_SetPipelineState
// void Ebitengine_ID3D12GraphicsCommandList_SetPipelineState(void* i, void* pPipelineState); // void Ebitengine_ID3D12GraphicsCommandList_SetPipelineState(void* i, void* pPipelineState);
import "C" import "C"

View File

@@ -24,6 +24,8 @@ package metal
// #include <QuartzCore/CAMetalLayer.h> // #include <QuartzCore/CAMetalLayer.h>
// #endif // #endif
// //
// #cgo noescape isCAMetalDisplayLinkAvailable
// #cgo nocallback isCAMetalDisplayLinkAvailable
// static bool isCAMetalDisplayLinkAvailable() { // static bool isCAMetalDisplayLinkAvailable() {
// // TODO: Use PureGo if returning a struct is supported (ebitengine/purego#225). // // TODO: Use PureGo if returning a struct is supported (ebitengine/purego#225).
// // As operatingSystemVersion returns a struct, this cannot be written with PureGo. // // As operatingSystemVersion returns a struct, this cannot be written with PureGo.

View File

@@ -22,11 +22,15 @@ package metal
// //
// #import <UIKit/UIKit.h> // #import <UIKit/UIKit.h>
// //
// #cgo noescape addSublayer
// #cgo nocallback addSublayer
// static void addSublayer(void* view, void* sublayer) { // static void addSublayer(void* view, void* sublayer) {
// CALayer* layer = ((UIView*)view).layer; // CALayer* layer = ((UIView*)view).layer;
// [layer addSublayer:(CALayer*)sublayer]; // [layer addSublayer:(CALayer*)sublayer];
// } // }
// //
// #cgo noescape setFrame
// #cgo nocallback setFrame
// static void setFrame(void* cametal, void* uiview) { // static void setFrame(void* cametal, void* uiview) {
// __block CGSize size; // __block CGSize size;
// dispatch_sync(dispatch_get_main_queue(), ^{ // dispatch_sync(dispatch_get_main_queue(), ^{

View File

@@ -20,290 +20,505 @@ package gl
// typedef ptrdiff_t GLintptr; // typedef ptrdiff_t GLintptr;
// typedef ptrdiff_t GLsizeiptr; // typedef ptrdiff_t GLsizeiptr;
// //
// #cgo noescape glowActiveTexture
// #cgo nocallback glowActiveTexture
// static void glowActiveTexture(uintptr_t fnptr, GLenum texture) { // static void glowActiveTexture(uintptr_t fnptr, GLenum texture) {
// typedef void (*fn)(GLenum texture); // typedef void (*fn)(GLenum texture);
// ((fn)(fnptr))(texture); // ((fn)(fnptr))(texture);
// } // }
//
// #cgo noescape glowAttachShader
// #cgo nocallback glowAttachShader
// static void glowAttachShader(uintptr_t fnptr, GLuint program, GLuint shader) { // static void glowAttachShader(uintptr_t fnptr, GLuint program, GLuint shader) {
// typedef void (*fn)(GLuint program, GLuint shader); // typedef void (*fn)(GLuint program, GLuint shader);
// ((fn)(fnptr))(program, shader); // ((fn)(fnptr))(program, shader);
// } // }
//
// #cgo noescape glowBindAttribLocation
// #cgo nocallback glowBindAttribLocation
// static void glowBindAttribLocation(uintptr_t fnptr, GLuint program, GLuint index, const GLchar* name) { // static void glowBindAttribLocation(uintptr_t fnptr, GLuint program, GLuint index, const GLchar* name) {
// typedef void (*fn)(GLuint program, GLuint index, const GLchar* name); // typedef void (*fn)(GLuint program, GLuint index, const GLchar* name);
// ((fn)(fnptr))(program, index, name); // ((fn)(fnptr))(program, index, name);
// } // }
//
// #cgo noescape glowBindBuffer
// #cgo nocallback glowBindBuffer
// static void glowBindBuffer(uintptr_t fnptr, GLenum target, GLuint buffer) { // static void glowBindBuffer(uintptr_t fnptr, GLenum target, GLuint buffer) {
// typedef void (*fn)(GLenum target, GLuint buffer); // typedef void (*fn)(GLenum target, GLuint buffer);
// ((fn)(fnptr))(target, buffer); // ((fn)(fnptr))(target, buffer);
// } // }
//
// #cgo noescape glowBindFramebuffer
// #cgo nocallback glowBindFramebuffer
// static void glowBindFramebuffer(uintptr_t fnptr, GLenum target, GLuint framebuffer) { // static void glowBindFramebuffer(uintptr_t fnptr, GLenum target, GLuint framebuffer) {
// typedef void (*fn)(GLenum target, GLuint framebuffer); // typedef void (*fn)(GLenum target, GLuint framebuffer);
// ((fn)(fnptr))(target, framebuffer); // ((fn)(fnptr))(target, framebuffer);
// } // }
//
// #cgo noescape glowBindRenderbuffer
// #cgo nocallback glowBindRenderbuffer
// static void glowBindRenderbuffer(uintptr_t fnptr, GLenum target, GLuint renderbuffer) { // static void glowBindRenderbuffer(uintptr_t fnptr, GLenum target, GLuint renderbuffer) {
// typedef void (*fn)(GLenum target, GLuint renderbuffer); // typedef void (*fn)(GLenum target, GLuint renderbuffer);
// ((fn)(fnptr))(target, renderbuffer); // ((fn)(fnptr))(target, renderbuffer);
// } // }
//
// #cgo noescape glowBindTexture
// #cgo nocallback glowBindTexture
// static void glowBindTexture(uintptr_t fnptr, GLenum target, GLuint texture) { // static void glowBindTexture(uintptr_t fnptr, GLenum target, GLuint texture) {
// typedef void (*fn)(GLenum target, GLuint texture); // typedef void (*fn)(GLenum target, GLuint texture);
// ((fn)(fnptr))(target, texture); // ((fn)(fnptr))(target, texture);
// } // }
//
// #cgo noescape glowBindVertexArray
// #cgo nocallback glowBindVertexArray
// static void glowBindVertexArray(uintptr_t fnptr, GLuint array) { // static void glowBindVertexArray(uintptr_t fnptr, GLuint array) {
// typedef void (*fn)(GLuint array); // typedef void (*fn)(GLuint array);
// ((fn)(fnptr))(array); // ((fn)(fnptr))(array);
// } // }
//
// #cgo noescape glowBlendEquationSeparate
// #cgo nocallback glowBlendEquationSeparate
// static void glowBlendEquationSeparate(uintptr_t fnptr, GLenum modeRGB, GLenum modeAlpha) { // static void glowBlendEquationSeparate(uintptr_t fnptr, GLenum modeRGB, GLenum modeAlpha) {
// typedef void (*fn)(GLenum modeRGB, GLenum modeAlpha); // typedef void (*fn)(GLenum modeRGB, GLenum modeAlpha);
// ((fn)(fnptr))(modeRGB, modeAlpha); // ((fn)(fnptr))(modeRGB, modeAlpha);
// } // }
//
// #cgo noescape glowBlendFuncSeparate
// #cgo nocallback glowBlendFuncSeparate
// static void glowBlendFuncSeparate(uintptr_t fnptr, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { // static void glowBlendFuncSeparate(uintptr_t fnptr, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
// typedef void (*fn)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); // typedef void (*fn)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
// ((fn)(fnptr))(srcRGB, dstRGB, srcAlpha, dstAlpha); // ((fn)(fnptr))(srcRGB, dstRGB, srcAlpha, dstAlpha);
// } // }
//
// #cgo noescape glowBufferData
// #cgo nocallback glowBufferData
// static void glowBufferData(uintptr_t fnptr, GLenum target, GLsizeiptr size, const void* data, GLenum usage) { // static void glowBufferData(uintptr_t fnptr, GLenum target, GLsizeiptr size, const void* data, GLenum usage) {
// typedef void (*fn)(GLenum target, GLsizeiptr size, const void* data, GLenum usage); // typedef void (*fn)(GLenum target, GLsizeiptr size, const void* data, GLenum usage);
// ((fn)(fnptr))(target, size, data, usage); // ((fn)(fnptr))(target, size, data, usage);
// } // }
//
// #cgo noescape glowBufferSubData
// #cgo nocallback glowBufferSubData
// static void glowBufferSubData(uintptr_t fnptr, GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { // static void glowBufferSubData(uintptr_t fnptr, GLenum target, GLintptr offset, GLsizeiptr size, const void* data) {
// typedef void (*fn)(GLenum target, GLintptr offset, GLsizeiptr size, const void* data); // typedef void (*fn)(GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
// ((fn)(fnptr))(target, offset, size, data); // ((fn)(fnptr))(target, offset, size, data);
// } // }
//
// #cgo noescape glowCheckFramebufferStatus
// #cgo nocallback glowCheckFramebufferStatus
// static GLenum glowCheckFramebufferStatus(uintptr_t fnptr, GLenum target) { // static GLenum glowCheckFramebufferStatus(uintptr_t fnptr, GLenum target) {
// typedef GLenum (*fn)(GLenum target); // typedef GLenum (*fn)(GLenum target);
// return ((fn)(fnptr))(target); // return ((fn)(fnptr))(target);
// } // }
//
// #cgo noescape glowClear
// #cgo nocallback glowClear
// static void glowClear(uintptr_t fnptr, GLbitfield mask) { // static void glowClear(uintptr_t fnptr, GLbitfield mask) {
// typedef void (*fn)(GLbitfield mask); // typedef void (*fn)(GLbitfield mask);
// ((fn)(fnptr))(mask); // ((fn)(fnptr))(mask);
// } // }
//
// #cgo noescape glowColorMask
// #cgo nocallback glowColorMask
// static void glowColorMask(uintptr_t fnptr, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { // static void glowColorMask(uintptr_t fnptr, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
// typedef void (*fn)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); // typedef void (*fn)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
// ((fn)(fnptr))(red, green, blue, alpha); // ((fn)(fnptr))(red, green, blue, alpha);
// } // }
//
// #cgo noescape glowCompileShader
// #cgo nocallback glowCompileShader
// static void glowCompileShader(uintptr_t fnptr, GLuint shader) { // static void glowCompileShader(uintptr_t fnptr, GLuint shader) {
// typedef void (*fn)(GLuint shader); // typedef void (*fn)(GLuint shader);
// ((fn)(fnptr))(shader); // ((fn)(fnptr))(shader);
// } // }
//
// #cgo noescape glowCreateProgram
// #cgo nocallback glowCreateProgram
// static GLuint glowCreateProgram(uintptr_t fnptr) { // static GLuint glowCreateProgram(uintptr_t fnptr) {
// typedef GLuint (*fn)(); // typedef GLuint (*fn)();
// return ((fn)(fnptr))(); // return ((fn)(fnptr))();
// } // }
//
// #cgo noescape glowCreateShader
// #cgo nocallback glowCreateShader
// static GLuint glowCreateShader(uintptr_t fnptr, GLenum type) { // static GLuint glowCreateShader(uintptr_t fnptr, GLenum type) {
// typedef GLuint (*fn)(GLenum type); // typedef GLuint (*fn)(GLenum type);
// return ((fn)(fnptr))(type); // return ((fn)(fnptr))(type);
// } // }
//
// #cgo noescape glowDeleteBuffers
// #cgo nocallback glowDeleteBuffers
// static void glowDeleteBuffers(uintptr_t fnptr, GLsizei n, const GLuint* buffers) { // static void glowDeleteBuffers(uintptr_t fnptr, GLsizei n, const GLuint* buffers) {
// typedef void (*fn)(GLsizei n, const GLuint* buffers); // typedef void (*fn)(GLsizei n, const GLuint* buffers);
// ((fn)(fnptr))(n, buffers); // ((fn)(fnptr))(n, buffers);
// } // }
//
// #cgo noescape glowDeleteFramebuffers
// #cgo nocallback glowDeleteFramebuffers
// static void glowDeleteFramebuffers(uintptr_t fnptr, GLsizei n, const GLuint* framebuffers) { // static void glowDeleteFramebuffers(uintptr_t fnptr, GLsizei n, const GLuint* framebuffers) {
// typedef void (*fn)(GLsizei n, const GLuint* framebuffers); // typedef void (*fn)(GLsizei n, const GLuint* framebuffers);
// ((fn)(fnptr))(n, framebuffers); // ((fn)(fnptr))(n, framebuffers);
// } // }
//
// #cgo noescape glowDeleteProgram
// #cgo nocallback glowDeleteProgram
// static void glowDeleteProgram(uintptr_t fnptr, GLuint program) { // static void glowDeleteProgram(uintptr_t fnptr, GLuint program) {
// typedef void (*fn)(GLuint program); // typedef void (*fn)(GLuint program);
// ((fn)(fnptr))(program); // ((fn)(fnptr))(program);
// } // }
//
// #cgo noescape glowDeleteRenderbuffers
// #cgo nocallback glowDeleteRenderbuffers
// static void glowDeleteRenderbuffers(uintptr_t fnptr, GLsizei n, const GLuint* renderbuffers) { // static void glowDeleteRenderbuffers(uintptr_t fnptr, GLsizei n, const GLuint* renderbuffers) {
// typedef void (*fn)(GLsizei n, const GLuint* renderbuffers); // typedef void (*fn)(GLsizei n, const GLuint* renderbuffers);
// ((fn)(fnptr))(n, renderbuffers); // ((fn)(fnptr))(n, renderbuffers);
// } // }
//
// #cgo noescape glowDeleteShader
// #cgo nocallback glowDeleteShader
// static void glowDeleteShader(uintptr_t fnptr, GLuint shader) { // static void glowDeleteShader(uintptr_t fnptr, GLuint shader) {
// typedef void (*fn)(GLuint shader); // typedef void (*fn)(GLuint shader);
// ((fn)(fnptr))(shader); // ((fn)(fnptr))(shader);
// } // }
//
// #cgo noescape glowDeleteTextures
// #cgo nocallback glowDeleteTextures
// static void glowDeleteTextures(uintptr_t fnptr, GLsizei n, const GLuint* textures) { // static void glowDeleteTextures(uintptr_t fnptr, GLsizei n, const GLuint* textures) {
// typedef void (*fn)(GLsizei n, const GLuint* textures); // typedef void (*fn)(GLsizei n, const GLuint* textures);
// ((fn)(fnptr))(n, textures); // ((fn)(fnptr))(n, textures);
// } // }
//
// #cgo noescape glowDeleteVertexArrays
// #cgo nocallback glowDeleteVertexArrays
// static void glowDeleteVertexArrays(uintptr_t fnptr, GLsizei n, const GLuint* arrays) { // static void glowDeleteVertexArrays(uintptr_t fnptr, GLsizei n, const GLuint* arrays) {
// typedef void (*fn)(GLsizei n, const GLuint* arrays); // typedef void (*fn)(GLsizei n, const GLuint* arrays);
// ((fn)(fnptr))(n, arrays); // ((fn)(fnptr))(n, arrays);
// } // }
//
// #cgo noescape glowDisable
// #cgo nocallback glowDisable
// static void glowDisable(uintptr_t fnptr, GLenum cap) { // static void glowDisable(uintptr_t fnptr, GLenum cap) {
// typedef void (*fn)(GLenum cap); // typedef void (*fn)(GLenum cap);
// ((fn)(fnptr))(cap); // ((fn)(fnptr))(cap);
// } // }
//
// #cgo noescape glowDisableVertexAttribArray
// #cgo nocallback glowDisableVertexAttribArray
// static void glowDisableVertexAttribArray(uintptr_t fnptr, GLuint index) { // static void glowDisableVertexAttribArray(uintptr_t fnptr, GLuint index) {
// typedef void (*fn)(GLuint index); // typedef void (*fn)(GLuint index);
// ((fn)(fnptr))(index); // ((fn)(fnptr))(index);
// } // }
//
// #cgo noescape glowDrawElements
// #cgo nocallback glowDrawElements
// static void glowDrawElements(uintptr_t fnptr, GLenum mode, GLsizei count, GLenum type, const uintptr_t indices) { // static void glowDrawElements(uintptr_t fnptr, GLenum mode, GLsizei count, GLenum type, const uintptr_t indices) {
// typedef void (*fn)(GLenum mode, GLsizei count, GLenum type, const uintptr_t indices); // typedef void (*fn)(GLenum mode, GLsizei count, GLenum type, const uintptr_t indices);
// ((fn)(fnptr))(mode, count, type, indices); // ((fn)(fnptr))(mode, count, type, indices);
// } // }
//
// #cgo noescape glowEnable
// #cgo nocallback glowEnable
// static void glowEnable(uintptr_t fnptr, GLenum cap) { // static void glowEnable(uintptr_t fnptr, GLenum cap) {
// typedef void (*fn)(GLenum cap); // typedef void (*fn)(GLenum cap);
// ((fn)(fnptr))(cap); // ((fn)(fnptr))(cap);
// } // }
//
// #cgo noescape glowEnableVertexAttribArray
// #cgo nocallback glowEnableVertexAttribArray
// static void glowEnableVertexAttribArray(uintptr_t fnptr, GLuint index) { // static void glowEnableVertexAttribArray(uintptr_t fnptr, GLuint index) {
// typedef void (*fn)(GLuint index); // typedef void (*fn)(GLuint index);
// ((fn)(fnptr))(index); // ((fn)(fnptr))(index);
// } // }
//
// #cgo noescape glowFlush
// #cgo nocallback glowFlush
// static void glowFlush(uintptr_t fnptr) { // static void glowFlush(uintptr_t fnptr) {
// typedef void (*fn)(); // typedef void (*fn)();
// ((fn)(fnptr))(); // ((fn)(fnptr))();
// } // }
//
// #cgo noescape glowFramebufferRenderbuffer
// #cgo nocallback glowFramebufferRenderbuffer
// static void glowFramebufferRenderbuffer(uintptr_t fnptr, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { // static void glowFramebufferRenderbuffer(uintptr_t fnptr, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
// typedef void (*fn)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); // typedef void (*fn)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
// ((fn)(fnptr))(target, attachment, renderbuffertarget, renderbuffer); // ((fn)(fnptr))(target, attachment, renderbuffertarget, renderbuffer);
// } // }
//
// #cgo noescape glowFramebufferTexture2D
// #cgo nocallback glowFramebufferTexture2D
// static void glowFramebufferTexture2D(uintptr_t fnptr, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { // static void glowFramebufferTexture2D(uintptr_t fnptr, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
// typedef void (*fn)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); // typedef void (*fn)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
// ((fn)(fnptr))(target, attachment, textarget, texture, level); // ((fn)(fnptr))(target, attachment, textarget, texture, level);
// } // }
//
// #cgo noescape glowGenBuffers
// #cgo nocallback glowGenBuffers
// static void glowGenBuffers(uintptr_t fnptr, GLsizei n, GLuint* buffers) { // static void glowGenBuffers(uintptr_t fnptr, GLsizei n, GLuint* buffers) {
// typedef void (*fn)(GLsizei n, GLuint* buffers); // typedef void (*fn)(GLsizei n, GLuint* buffers);
// ((fn)(fnptr))(n, buffers); // ((fn)(fnptr))(n, buffers);
// } // }
//
// #cgo noescape glowGenFramebuffers
// #cgo nocallback glowGenFramebuffers
// static void glowGenFramebuffers(uintptr_t fnptr, GLsizei n, GLuint* framebuffers) { // static void glowGenFramebuffers(uintptr_t fnptr, GLsizei n, GLuint* framebuffers) {
// typedef void (*fn)(GLsizei n, GLuint* framebuffers); // typedef void (*fn)(GLsizei n, GLuint* framebuffers);
// ((fn)(fnptr))(n, framebuffers); // ((fn)(fnptr))(n, framebuffers);
// } // }
//
// #cgo noescape glowGenRenderbuffers
// #cgo nocallback glowGenRenderbuffers
// static void glowGenRenderbuffers(uintptr_t fnptr, GLsizei n, GLuint* renderbuffers) { // static void glowGenRenderbuffers(uintptr_t fnptr, GLsizei n, GLuint* renderbuffers) {
// typedef void (*fn)(GLsizei n, GLuint* renderbuffers); // typedef void (*fn)(GLsizei n, GLuint* renderbuffers);
// ((fn)(fnptr))(n, renderbuffers); // ((fn)(fnptr))(n, renderbuffers);
// } // }
//
// #cgo noescape glowGenTextures
// #cgo nocallback glowGenTextures
// static void glowGenTextures(uintptr_t fnptr, GLsizei n, GLuint* textures) { // static void glowGenTextures(uintptr_t fnptr, GLsizei n, GLuint* textures) {
// typedef void (*fn)(GLsizei n, GLuint* textures); // typedef void (*fn)(GLsizei n, GLuint* textures);
// ((fn)(fnptr))(n, textures); // ((fn)(fnptr))(n, textures);
// } // }
//
// #cgo noescape glowGenVertexArrays
// #cgo nocallback glowGenVertexArrays
// static void glowGenVertexArrays(uintptr_t fnptr, GLsizei n, GLuint* arrays) { // static void glowGenVertexArrays(uintptr_t fnptr, GLsizei n, GLuint* arrays) {
// typedef void (*fn)(GLsizei n, GLuint* arrays); // typedef void (*fn)(GLsizei n, GLuint* arrays);
// ((fn)(fnptr))(n, arrays); // ((fn)(fnptr))(n, arrays);
// } // }
//
// #cgo noescape glowGetError
// #cgo nocallback glowGetError
// static GLenum glowGetError(uintptr_t fnptr) { // static GLenum glowGetError(uintptr_t fnptr) {
// typedef GLenum (*fn)(); // typedef GLenum (*fn)();
// return ((fn)(fnptr))(); // return ((fn)(fnptr))();
// } // }
//
// #cgo noescape glowGetIntegerv
// #cgo nocallback glowGetIntegerv
// static void glowGetIntegerv(uintptr_t fnptr, GLenum pname, GLint* data) { // static void glowGetIntegerv(uintptr_t fnptr, GLenum pname, GLint* data) {
// typedef void (*fn)(GLenum pname, GLint* data); // typedef void (*fn)(GLenum pname, GLint* data);
// ((fn)(fnptr))(pname, data); // ((fn)(fnptr))(pname, data);
// } // }
//
// #cgo noescape glowGetProgramInfoLog
// #cgo nocallback glowGetProgramInfoLog
// static void glowGetProgramInfoLog(uintptr_t fnptr, GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog) { // static void glowGetProgramInfoLog(uintptr_t fnptr, GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog) {
// typedef void (*fn)(GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog); // typedef void (*fn)(GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog);
// ((fn)(fnptr))(program, bufSize, length, infoLog); // ((fn)(fnptr))(program, bufSize, length, infoLog);
// } // }
//
// #cgo noescape glowGetProgramiv
// #cgo nocallback glowGetProgramiv
// static void glowGetProgramiv(uintptr_t fnptr, GLuint program, GLenum pname, GLint* params) { // static void glowGetProgramiv(uintptr_t fnptr, GLuint program, GLenum pname, GLint* params) {
// typedef void (*fn)(GLuint program, GLenum pname, GLint* params); // typedef void (*fn)(GLuint program, GLenum pname, GLint* params);
// ((fn)(fnptr))(program, pname, params); // ((fn)(fnptr))(program, pname, params);
// } // }
//
// #cgo noescape glowGetShaderInfoLog
// #cgo nocallback glowGetShaderInfoLog
// static void glowGetShaderInfoLog(uintptr_t fnptr, GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog) { // static void glowGetShaderInfoLog(uintptr_t fnptr, GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog) {
// typedef void (*fn)(GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog); // typedef void (*fn)(GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog);
// ((fn)(fnptr))(shader, bufSize, length, infoLog); // ((fn)(fnptr))(shader, bufSize, length, infoLog);
// } // }
//
// #cgo noescape glowGetShaderiv
// #cgo nocallback glowGetShaderiv
// static void glowGetShaderiv(uintptr_t fnptr, GLuint shader, GLenum pname, GLint* params) { // static void glowGetShaderiv(uintptr_t fnptr, GLuint shader, GLenum pname, GLint* params) {
// typedef void (*fn)(GLuint shader, GLenum pname, GLint* params); // typedef void (*fn)(GLuint shader, GLenum pname, GLint* params);
// ((fn)(fnptr))(shader, pname, params); // ((fn)(fnptr))(shader, pname, params);
// } // }
//
// #cgo noescape glowGetUniformLocation
// #cgo nocallback glowGetUniformLocation
// static GLint glowGetUniformLocation(uintptr_t fnptr, GLuint program, const GLchar* name) { // static GLint glowGetUniformLocation(uintptr_t fnptr, GLuint program, const GLchar* name) {
// typedef GLint (*fn)(GLuint program, const GLchar* name); // typedef GLint (*fn)(GLuint program, const GLchar* name);
// return ((fn)(fnptr))(program, name); // return ((fn)(fnptr))(program, name);
// } // }
//
// #cgo noescape glowIsProgram
// #cgo nocallback glowIsProgram
// static GLboolean glowIsProgram(uintptr_t fnptr, GLuint program) { // static GLboolean glowIsProgram(uintptr_t fnptr, GLuint program) {
// typedef GLboolean (*fn)(GLuint program); // typedef GLboolean (*fn)(GLuint program);
// return ((fn)(fnptr))(program); // return ((fn)(fnptr))(program);
// } // }
//
// #cgo noescape glowLinkProgram
// #cgo nocallback glowLinkProgram
// static void glowLinkProgram(uintptr_t fnptr, GLuint program) { // static void glowLinkProgram(uintptr_t fnptr, GLuint program) {
// typedef void (*fn)(GLuint program); // typedef void (*fn)(GLuint program);
// ((fn)(fnptr))(program); // ((fn)(fnptr))(program);
// } // }
//
// #cgo noescape glowPixelStorei
// #cgo nocallback glowPixelStorei
// static void glowPixelStorei(uintptr_t fnptr, GLenum pname, GLint param) { // static void glowPixelStorei(uintptr_t fnptr, GLenum pname, GLint param) {
// typedef void (*fn)(GLenum pname, GLint param); // typedef void (*fn)(GLenum pname, GLint param);
// ((fn)(fnptr))(pname, param); // ((fn)(fnptr))(pname, param);
// } // }
//
// #cgo noescape glowReadPixels
// #cgo nocallback glowReadPixels
// static void glowReadPixels(uintptr_t fnptr, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { // static void glowReadPixels(uintptr_t fnptr, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) {
// typedef void (*fn)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels); // typedef void (*fn)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels);
// ((fn)(fnptr))(x, y, width, height, format, type, pixels); // ((fn)(fnptr))(x, y, width, height, format, type, pixels);
// } // }
//
// #cgo noescape glowRenderbufferStorage
// #cgo nocallback glowRenderbufferStorage
// static void glowRenderbufferStorage(uintptr_t fnptr, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { // static void glowRenderbufferStorage(uintptr_t fnptr, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
// typedef void (*fn)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); // typedef void (*fn)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
// ((fn)(fnptr))(target, internalformat, width, height); // ((fn)(fnptr))(target, internalformat, width, height);
// } // }
//
// #cgo noescape glowScissor
// #cgo nocallback glowScissor
// static void glowScissor(uintptr_t fnptr, GLint x, GLint y, GLsizei width, GLsizei height) { // static void glowScissor(uintptr_t fnptr, GLint x, GLint y, GLsizei width, GLsizei height) {
// typedef void (*fn)(GLint x, GLint y, GLsizei width, GLsizei height); // typedef void (*fn)(GLint x, GLint y, GLsizei width, GLsizei height);
// ((fn)(fnptr))(x, y, width, height); // ((fn)(fnptr))(x, y, width, height);
// } // }
//
// #cgo noescape glowShaderSource
// #cgo nocallback glowShaderSource
// static void glowShaderSource(uintptr_t fnptr, GLuint shader, GLsizei count, const GLchar*const* string, const GLint* length) { // static void glowShaderSource(uintptr_t fnptr, GLuint shader, GLsizei count, const GLchar*const* string, const GLint* length) {
// typedef void (*fn)(GLuint shader, GLsizei count, const GLchar*const* string, const GLint* length); // typedef void (*fn)(GLuint shader, GLsizei count, const GLchar*const* string, const GLint* length);
// ((fn)(fnptr))(shader, count, string, length); // ((fn)(fnptr))(shader, count, string, length);
// } // }
//
// #cgo noescape glowStencilFunc
// #cgo nocallback glowStencilFunc
// static void glowStencilFunc(uintptr_t fnptr, GLenum func, GLint ref, GLuint mask) { // static void glowStencilFunc(uintptr_t fnptr, GLenum func, GLint ref, GLuint mask) {
// typedef void (*fn)(GLenum func, GLint ref, GLuint mask); // typedef void (*fn)(GLenum func, GLint ref, GLuint mask);
// ((fn)(fnptr))(func, ref, mask); // ((fn)(fnptr))(func, ref, mask);
// } // }
//
// #cgo noescape glowStencilOpSeparate
// #cgo nocallback glowStencilOpSeparate
// static void glowStencilOpSeparate(uintptr_t fnptr, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { // static void glowStencilOpSeparate(uintptr_t fnptr, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) {
// typedef void (*fn)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); // typedef void (*fn)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
// ((fn)(fnptr))(face, fail, zfail, zpass); // ((fn)(fnptr))(face, fail, zfail, zpass);
// } // }
//
// #cgo noescape glowTexImage2D
// #cgo nocallback glowTexImage2D
// static void glowTexImage2D(uintptr_t fnptr, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { // static void glowTexImage2D(uintptr_t fnptr, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) {
// typedef void (*fn)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels); // typedef void (*fn)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels);
// ((fn)(fnptr))(target, level, internalformat, width, height, border, format, type, pixels); // ((fn)(fnptr))(target, level, internalformat, width, height, border, format, type, pixels);
// } // }
//
// #cgo noescape glowTexParameteri
// #cgo nocallback glowTexParameteri
// static void glowTexParameteri(uintptr_t fnptr, GLenum target, GLenum pname, GLint param) { // static void glowTexParameteri(uintptr_t fnptr, GLenum target, GLenum pname, GLint param) {
// typedef void (*fn)(GLenum target, GLenum pname, GLint param); // typedef void (*fn)(GLenum target, GLenum pname, GLint param);
// ((fn)(fnptr))(target, pname, param); // ((fn)(fnptr))(target, pname, param);
// } // }
//
// #cgo noescape glowTexSubImage2D
// #cgo nocallback glowTexSubImage2D
// static void glowTexSubImage2D(uintptr_t fnptr, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { // static void glowTexSubImage2D(uintptr_t fnptr, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) {
// typedef void (*fn)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels); // typedef void (*fn)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);
// ((fn)(fnptr))(target, level, xoffset, yoffset, width, height, format, type, pixels); // ((fn)(fnptr))(target, level, xoffset, yoffset, width, height, format, type, pixels);
// } // }
//
// #cgo noescape glowUniform1fv
// #cgo nocallback glowUniform1fv
// static void glowUniform1fv(uintptr_t fnptr, GLint location, GLsizei count, const GLfloat* value) { // static void glowUniform1fv(uintptr_t fnptr, GLint location, GLsizei count, const GLfloat* value) {
// typedef void (*fn)(GLint location, GLsizei count, const GLfloat* value); // typedef void (*fn)(GLint location, GLsizei count, const GLfloat* value);
// ((fn)(fnptr))(location, count, value); // ((fn)(fnptr))(location, count, value);
// } // }
//
// #cgo noescape glowUniform1i
// #cgo nocallback glowUniform1i
// static void glowUniform1i(uintptr_t fnptr, GLint location, GLint v0) { // static void glowUniform1i(uintptr_t fnptr, GLint location, GLint v0) {
// typedef void (*fn)(GLint location, GLint v0); // typedef void (*fn)(GLint location, GLint v0);
// ((fn)(fnptr))(location, v0); // ((fn)(fnptr))(location, v0);
// } // }
//
// #cgo noescape glowUniform1iv
// #cgo nocallback glowUniform1iv
// static void glowUniform1iv(uintptr_t fnptr, GLint location, GLsizei count, const GLint* value) { // static void glowUniform1iv(uintptr_t fnptr, GLint location, GLsizei count, const GLint* value) {
// typedef void (*fn)(GLint location, GLsizei count, const GLint* value); // typedef void (*fn)(GLint location, GLsizei count, const GLint* value);
// ((fn)(fnptr))(location, count, value); // ((fn)(fnptr))(location, count, value);
// } // }
//
// #cgo noescape glowUniform2fv
// #cgo nocallback glowUniform2fv
// static void glowUniform2fv(uintptr_t fnptr, GLint location, GLsizei count, const GLfloat* value) { // static void glowUniform2fv(uintptr_t fnptr, GLint location, GLsizei count, const GLfloat* value) {
// typedef void (*fn)(GLint location, GLsizei count, const GLfloat* value); // typedef void (*fn)(GLint location, GLsizei count, const GLfloat* value);
// ((fn)(fnptr))(location, count, value); // ((fn)(fnptr))(location, count, value);
// } // }
//
// #cgo noescape glowUniform2iv
// #cgo nocallback glowUniform2iv
// static void glowUniform2iv(uintptr_t fnptr, GLint location, GLsizei count, const GLint* value) { // static void glowUniform2iv(uintptr_t fnptr, GLint location, GLsizei count, const GLint* value) {
// typedef void (*fn)(GLint location, GLsizei count, const GLint* value); // typedef void (*fn)(GLint location, GLsizei count, const GLint* value);
// ((fn)(fnptr))(location, count, value); // ((fn)(fnptr))(location, count, value);
// } // }
//
// #cgo noescape glowUniform3fv
// #cgo nocallback glowUniform3fv
// static void glowUniform3fv(uintptr_t fnptr, GLint location, GLsizei count, const GLfloat* value) { // static void glowUniform3fv(uintptr_t fnptr, GLint location, GLsizei count, const GLfloat* value) {
// typedef void (*fn)(GLint location, GLsizei count, const GLfloat* value); // typedef void (*fn)(GLint location, GLsizei count, const GLfloat* value);
// ((fn)(fnptr))(location, count, value); // ((fn)(fnptr))(location, count, value);
// } // }
//
// #cgo noescape glowUniform3iv
// #cgo nocallback glowUniform3iv
// static void glowUniform3iv(uintptr_t fnptr, GLint location, GLsizei count, const GLint* value) { // static void glowUniform3iv(uintptr_t fnptr, GLint location, GLsizei count, const GLint* value) {
// typedef void (*fn)(GLint location, GLsizei count, const GLint* value); // typedef void (*fn)(GLint location, GLsizei count, const GLint* value);
// ((fn)(fnptr))(location, count, value); // ((fn)(fnptr))(location, count, value);
// } // }
//
// #cgo noescape glowUniform4fv
// #cgo nocallback glowUniform4fv
// static void glowUniform4fv(uintptr_t fnptr, GLint location, GLsizei count, const GLfloat* value) { // static void glowUniform4fv(uintptr_t fnptr, GLint location, GLsizei count, const GLfloat* value) {
// typedef void (*fn)(GLint location, GLsizei count, const GLfloat* value); // typedef void (*fn)(GLint location, GLsizei count, const GLfloat* value);
// ((fn)(fnptr))(location, count, value); // ((fn)(fnptr))(location, count, value);
// } // }
//
// #cgo noescape glowUniform4iv
// #cgo nocallback glowUniform4iv
// static void glowUniform4iv(uintptr_t fnptr, GLint location, GLsizei count, const GLint* value) { // static void glowUniform4iv(uintptr_t fnptr, GLint location, GLsizei count, const GLint* value) {
// typedef void (*fn)(GLint location, GLsizei count, const GLint* value); // typedef void (*fn)(GLint location, GLsizei count, const GLint* value);
// ((fn)(fnptr))(location, count, value); // ((fn)(fnptr))(location, count, value);
// } // }
//
// #cgo noescape glowUniformMatrix2fv
// #cgo nocallback glowUniformMatrix2fv
// static void glowUniformMatrix2fv(uintptr_t fnptr, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { // static void glowUniformMatrix2fv(uintptr_t fnptr, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
// typedef void (*fn)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); // typedef void (*fn)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
// ((fn)(fnptr))(location, count, transpose, value); // ((fn)(fnptr))(location, count, transpose, value);
// } // }
//
// #cgo noescape glowUniformMatrix3fv
// #cgo nocallback glowUniformMatrix3fv
// static void glowUniformMatrix3fv(uintptr_t fnptr, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { // static void glowUniformMatrix3fv(uintptr_t fnptr, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
// typedef void (*fn)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); // typedef void (*fn)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
// ((fn)(fnptr))(location, count, transpose, value); // ((fn)(fnptr))(location, count, transpose, value);
// } // }
//
// #cgo noescape glowUniformMatrix4fv
// #cgo nocallback glowUniformMatrix4fv
// static void glowUniformMatrix4fv(uintptr_t fnptr, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { // static void glowUniformMatrix4fv(uintptr_t fnptr, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
// typedef void (*fn)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); // typedef void (*fn)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
// ((fn)(fnptr))(location, count, transpose, value); // ((fn)(fnptr))(location, count, transpose, value);
// } // }
//
// #cgo noescape glowUseProgram
// #cgo nocallback glowUseProgram
// static void glowUseProgram(uintptr_t fnptr, GLuint program) { // static void glowUseProgram(uintptr_t fnptr, GLuint program) {
// typedef void (*fn)(GLuint program); // typedef void (*fn)(GLuint program);
// ((fn)(fnptr))(program); // ((fn)(fnptr))(program);
// } // }
//
// #cgo noescape glowVertexAttribPointer
// #cgo nocallback glowVertexAttribPointer
// static void glowVertexAttribPointer(uintptr_t fnptr, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const uintptr_t pointer) { // static void glowVertexAttribPointer(uintptr_t fnptr, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const uintptr_t pointer) {
// typedef void (*fn)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const uintptr_t pointer); // typedef void (*fn)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const uintptr_t pointer);
// ((fn)(fnptr))(index, size, type, normalized, stride, pointer); // ((fn)(fnptr))(index, size, type, normalized, stride, pointer);
// } // }
//
// #cgo noescape glowViewport
// #cgo nocallback glowViewport
// static void glowViewport(uintptr_t fnptr, GLint x, GLint y, GLsizei width, GLsizei height) { // static void glowViewport(uintptr_t fnptr, GLint x, GLint y, GLsizei width, GLsizei height) {
// typedef void (*fn)(GLint x, GLint y, GLsizei width, GLsizei height); // typedef void (*fn)(GLint x, GLint y, GLsizei width, GLsizei height);
// ((fn)(fnptr))(x, y, width, height); // ((fn)(fnptr))(x, y, width, height);

View File

@@ -21,6 +21,8 @@ package gl
// #include <stdlib.h> // #include <stdlib.h>
// #include <EGL/egl.h> // #include <EGL/egl.h>
// //
// #cgo noescape getProcAddress
// #cgo nocallback getProcAddress
// static void* getProcAddress(const char* name) { // static void* getProcAddress(const char* name) {
// return eglGetProcAddress(name); // return eglGetProcAddress(name);
// } // }

View File

@@ -21,7 +21,12 @@ package microsoftgdk
// #include <stdint.h> // #include <stdint.h>
// //
// #cgo noescape XGameRuntimeInitialize
// #cgo nocallback XGameRuntimeInitialize
// uint32_t XGameRuntimeInitialize(void); // uint32_t XGameRuntimeInitialize(void);
//
// #cgo noescape XSystemGetDeviceType
// #cgo nocallback XSystemGetDeviceType
// uint32_t XSystemGetDeviceType(void); // uint32_t XSystemGetDeviceType(void);
import "C" import "C"

View File

@@ -26,6 +26,8 @@ package ui
// display.getRealMetrics(displayMetrics); // display.getRealMetrics(displayMetrics);
// return displayMetrics.widthPixels, displayMetrics.heightPixels, displayMetrics.density; // return displayMetrics.widthPixels, displayMetrics.heightPixels, displayMetrics.density;
// //
#cgo noescape displayInfo
#cgo nocallback displayInfo
static void displayInfo(int* width, int* height, float* scale, uintptr_t java_vm, uintptr_t jni_env, uintptr_t ctx) { static void displayInfo(int* width, int* height, float* scale, uintptr_t java_vm, uintptr_t jni_env, uintptr_t ctx) {
*width = 0; *width = 0;
*height = 0; *height = 0;

View File

@@ -37,6 +37,8 @@ package ui
// *scale = scene.screen.nativeScale; // *scale = scene.screen.nativeScale;
// } // }
// //
// #cgo noescape displayInfo
// #cgo nocallback displayInfo
// static void displayInfo(float* width, float* height, float* scale, uintptr_t viewPtr) { // static void displayInfo(float* width, float* height, float* scale, uintptr_t viewPtr) {
// *width = 0; // *width = 0;
// *height = 0; // *height = 0;

View File

@@ -56,6 +56,8 @@ import (
// //
// <uses-permission android:name="android.permission.VIBRATE"/> // <uses-permission android:name="android.permission.VIBRATE"/>
// //
#cgo noescape vibrateOneShot
#cgo nocallback vibrateOneShot
static void vibrateOneShot(uintptr_t java_vm, uintptr_t jni_env, uintptr_t ctx, int64_t milliseconds, double magnitude) { static void vibrateOneShot(uintptr_t java_vm, uintptr_t jni_env, uintptr_t ctx, int64_t milliseconds, double magnitude) {
JavaVM* vm = (JavaVM*)java_vm; JavaVM* vm = (JavaVM*)java_vm;
JNIEnv* env = (JNIEnv*)jni_env; JNIEnv* env = (JNIEnv*)jni_env;

View File

@@ -100,6 +100,8 @@ package vibrate
// } // }
// } // }
// //
// #cgo noescape vibrate
// #cgo nocallback vibrate
// static void vibrate(double duration, double intensity) { // static void vibrate(double duration, double intensity) {
// dispatch_async(dispatch_get_main_queue(), ^{ // dispatch_async(dispatch_get_main_queue(), ^{
// vibrateOnMainThread(duration, intensity); // vibrateOnMainThread(duration, intensity);