├── .gitmodules ├── Cubes.hs ├── Hello.hs ├── LICENSE ├── README.org ├── Setup.hs ├── bgfx.cabal ├── cbits └── sdl-bgfx.c ├── default.nix ├── fs_cubes.bin ├── shell.nix ├── src └── BGFX.hsc └── vs_cubes.bin /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "bgfx-upstream"] 2 | path = bgfx-upstream 3 | url = git@github.com:bkaradzic/bgfx.git 4 | [submodule "bx-upstream"] 5 | path = bx-upstream 6 | url = git@github.com:bkaradzic/bx.git 7 | -------------------------------------------------------------------------------- /Cubes.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ForeignFunctionInterface #-} 2 | {-# LANGUAGE ImplicitParams #-} 3 | {-# LANGUAGE OverloadedStrings #-} 4 | 5 | module Main where 6 | 7 | import BGFX 8 | import Control.Lens ((&), (.~)) 9 | import Data.Bits 10 | import Data.Distributive 11 | import Data.Foldable (for_) 12 | import Data.Word 13 | import Foreign 14 | import Foreign.Ptr 15 | import GHC.Stack 16 | import Linear 17 | import System.Clock 18 | import Unsafe.Coerce 19 | import qualified Data.ByteString as BS 20 | import qualified SDL 21 | 22 | foreign import ccall unsafe 23 | "bgfx_sdl_set_window" bgfxSdlSetWindow :: Ptr a -> IO () 24 | 25 | main :: IO () 26 | main = 27 | do let width = 1280 28 | let height = 720 29 | let debug = BGFX_DEBUG_TEXT 30 | let reset = BGFX_RESET_VSYNC 31 | SDL.initializeAll 32 | w <- 33 | SDL.createWindow 34 | "bgfx with SDL2" 35 | SDL.defaultWindow {SDL.windowInitialSize = 36 | fromIntegral <$> V2 width height} 37 | bgfxSdlSetWindow (unsafeCoerce w :: Ptr ()) 38 | bgfxRenderFrame 39 | bgfxInit BGFX_RENDERER_TYPE_COUNT BGFX_PCI_ID_NONE 0 nullPtr nullPtr 40 | bgfxReset width height reset 41 | bgfxSetDebug debug 42 | bgfxSetViewClear 0 43 | (BGFX_CLEAR_COLOR .|. BGFX_CLEAR_DEPTH) 44 | 808464639 45 | 1.0 46 | 0 47 | posColorVertexDecl <- declarePosColorVertex 48 | vbh <- 49 | do ref <- 50 | withArrayLen 51 | cubeVertices 52 | (\len ptr -> 53 | bgfxCopy ptr (fromIntegral (len * sizeOf (head cubeVertices)))) 54 | bgfxCreateVertexBuffer ref posColorVertexDecl BGFX_BUFFER_NONE 55 | ibh <- 56 | do ptr <- newArray cubeIndices 57 | ref <- 58 | bgfxMakeRef 59 | ptr 60 | (fromIntegral (length cubeIndices * sizeOf (head cubeIndices))) 61 | bgfxCreateIndexBuffer ref BGFX_BUFFER_NONE 62 | program <- loadProgram "vs_cubes.bin" "fs_cubes.bin" 63 | timeOffset <- getTime Monotonic 64 | let loop = 65 | do _ <- SDL.pollEvents 66 | done <- return False 67 | if done 68 | then return () 69 | else do tick 70 | loop 71 | tick = 72 | do now <- getTime Monotonic 73 | let time = 74 | fromIntegral (timeSpecAsNanoSecs (diffTimeSpec now timeOffset)) * 75 | 1.0e-9 76 | with (distribute 77 | (lookAt (V3 0 0 (-35)) 78 | 0 79 | (V3 0 1 0) :: M44 Float)) 80 | (\viewPtr -> 81 | with (distribute 82 | (perspective 83 | 1.047 84 | (fromIntegral width / fromIntegral height :: Float) 85 | 0.1 86 | 100)) 87 | (\projPtr -> bgfxSetViewTransform 0 viewPtr projPtr)) 88 | bgfxSetViewRect 0 89 | 0 90 | 0 91 | (fromIntegral width) 92 | (fromIntegral height) 93 | bgfxTouch 0 94 | for_ [0 .. 11] $ 95 | \yy -> 96 | do for_ [0 .. 11] $ 97 | \xx -> 98 | do with (distribute 99 | (((m33_to_m44 . fromQuaternion) 100 | (axisAngle (V3 1 0 0) 101 | (time + 102 | fromIntegral xx * 0.21) * 103 | axisAngle (V3 0 1 0) 104 | (time + 105 | fromIntegral yy * 0.37)) :: M44 Float) & 106 | translation .~ 107 | V3 (-15 + fromIntegral xx * 3) 108 | (-15 + fromIntegral yy * 3) 109 | 0)) 110 | (flip bgfxSetTransform 1) 111 | bgfxSetVertexBuffer vbh 0 maxBound 112 | bgfxSetIndexBuffer ibh 0 maxBound 113 | bgfxSetState BGFX_STATE_DEFAULT 0 114 | bgfxSubmit 0 program 0 115 | bgfxFrame 116 | loop 117 | bgfxShutdown 118 | 119 | loadProgram 120 | :: FilePath -> FilePath -> IO BgfxProgramHandle 121 | loadProgram vsName fsName = 122 | do vs <- loadShader vsName 123 | fs <- loadShader fsName 124 | bgfxCreateProgram vs fs True 125 | where loadShader path = 126 | do bytes <- BS.readFile path 127 | mem <- 128 | BS.useAsCStringLen (BS.snoc bytes 0) $ 129 | \(ptr,len) -> bgfxCopy ptr (fromIntegral len) 130 | bgfxCreateShader mem 131 | 132 | declarePosColorVertex :: IO (Ptr BgfxVertexDecl) 133 | declarePosColorVertex = 134 | do vertexDecl <- malloc 135 | bgfxVertexDeclBegin vertexDecl BGFX_RENDERER_TYPE_NULL 136 | bgfxVertexDeclAdd vertexDecl BGFX_ATTRIB_POSITION 3 BGFX_ATTRIB_TYPE_FLOAT False False 137 | bgfxVertexDeclAdd vertexDecl BGFX_ATTRIB_COLOR0 4 BGFX_ATTRIB_TYPE_UINT8 True False 138 | bgfxVertexDeclEnd vertexDecl 139 | return vertexDecl 140 | 141 | data PosColorVertex = 142 | PosColorVertex (V3 Float) 143 | Word32 144 | 145 | instance Storable PosColorVertex where 146 | sizeOf ~(PosColorVertex a b) = sizeOf a + sizeOf b 147 | peek ptr = 148 | do PosColorVertex <$> peek (castPtr ptr) <*> 149 | peek (castPtr (ptr `plusPtr` 150 | fromIntegral (sizeOf (undefined :: V3 Float)))) 151 | poke ptr (PosColorVertex a b) = 152 | do poke (castPtr ptr) a 153 | poke (castPtr (ptr `plusPtr` 154 | fromIntegral (sizeOf (undefined :: V3 Float)))) 155 | b 156 | alignment _ = 0 157 | 158 | cubeVertices :: [PosColorVertex] 159 | cubeVertices = 160 | [PosColorVertex 161 | (V3 (-1.0) 162 | (1.0) 163 | (1.0)) 164 | 4278190080 165 | ,PosColorVertex 166 | (V3 (1.0) 167 | (1.0) 168 | (1.0)) 169 | 4278190335 170 | ,PosColorVertex 171 | (V3 (-1.0) 172 | (-1.0) 173 | (1.0)) 174 | 4278255360 175 | ,PosColorVertex 176 | (V3 (1.0) 177 | (-1.0) 178 | (1.0)) 179 | 4278255615 180 | ,PosColorVertex 181 | (V3 (-1.0) 182 | (1.0) 183 | (-1.0)) 184 | 4294901760 185 | ,PosColorVertex 186 | (V3 (1.0) 187 | (1.0) 188 | (-1.0)) 189 | 4294902015 190 | ,PosColorVertex 191 | (V3 (-1.0) 192 | (-1.0) 193 | (-1.0)) 194 | 4294967040 195 | ,PosColorVertex 196 | (V3 (1.0) 197 | (-1.0) 198 | (-1.0)) 199 | 4294967295] 200 | 201 | cubeIndices :: [Word16] 202 | cubeIndices = 203 | [0,1,2,1,3,2,4,6,5,5,6,7,0,2,4,4,2,6,1,5,3,5,7,3,0,4,1,4,5,1,2,3,6,6,3,7] 204 | -------------------------------------------------------------------------------- /Hello.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ForeignFunctionInterface #-} 2 | {-# LANGUAGE OverloadedStrings #-} 3 | 4 | module Main where 5 | 6 | import BGFX 7 | import Data.Bits 8 | import Foreign.Ptr 9 | import qualified SDL 10 | import Unsafe.Coerce 11 | 12 | foreign import ccall unsafe 13 | "bgfx_sdl_set_window" bgfxSdlSetWindow :: Ptr a -> IO () 14 | 15 | main :: IO () 16 | main = do 17 | let width = 1280 18 | let height = 720 19 | let debug = BGFX_DEBUG_TEXT 20 | let reset = BGFX_RESET_VSYNC 21 | SDL.initializeAll 22 | w <- SDL.createWindow "bgfx with SDL2" SDL.defaultWindow 23 | bgfxSdlSetWindow (unsafeCoerce w :: Ptr ()) 24 | bgfxRenderFrame 25 | bgfxInit BGFX_RENDERER_TYPE_COUNT BGFX_PCI_ID_NONE 0 nullPtr nullPtr 26 | putStrLn "A" 27 | bgfxReset width height reset 28 | bgfxSetDebug debug 29 | bgfxSetViewClear 0 (BGFX_CLEAR_COLOR .|. BGFX_CLEAR_DEPTH) 0x303030ff 1.0 0 30 | let loop = do 31 | --done <- _processEvents width height debug reset 32 | done <- return False 33 | if done then return () else do { tick ; loop } 34 | tick = do 35 | bgfxSetViewRect 0 0 0 (fromIntegral width) (fromIntegral height) 36 | bgfxTouch 0 37 | -- bgfxDbgTextClear 38 | -- bgfx::dbgTextImage(bx::uint16_max(width/2/8, 20)-20 39 | -- , bx::uint16_max(height/2/16, 6)-6 40 | -- , 40 41 | -- , 12 42 | -- , s_logo 43 | -- , 160 44 | -- ); 45 | -- bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/00-helloworld"); 46 | -- bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Initialization and debug text."); 47 | bgfxFrame 48 | loop 49 | bgfxShutdown 50 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Ollie Charles 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | * Neither the name of Ollie Charles nor the names of other 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | #+TITLE: =bgfx= - Haskell bindings to the [[https://github.com/bkaradzic/bgfx][bgfx]] project 2 | 3 | Currently low-level Haskell bindings to the [[https://github.com/bkaradzic/bgfx][bgfx]] project, exposing a very C-like 4 | interface. In the future we hope to abstract over this to provide Haskell-like 5 | bindings too. Currently supports most of =bgfx=, the =cubes= example has been 6 | ported. 7 | -------------------------------------------------------------------------------- /Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /bgfx.cabal: -------------------------------------------------------------------------------- 1 | name: bgfx 2 | version: 0.1.0.0 3 | synopsis: Haskell bindings to bgfx 4 | homepage: https://github.com/haskell-game/bgfx 5 | license: BSD3 6 | license-file: LICENSE 7 | author: Ollie Charles 8 | maintainer: ollie@ocharles.org.uk 9 | category: Graphics 10 | build-type: Simple 11 | cabal-version: >=1.10 12 | 13 | library 14 | exposed-modules: BGFX 15 | other-extensions: ForeignFunctionInterface 16 | build-depends: base >=4.8 && <4.9, transformers 17 | hs-source-dirs: src 18 | default-language: Haskell2010 19 | pkgconfig-depends: gl, x11 20 | include-dirs: 21 | bgfx-upstream/3rdparty/khronos 22 | bgfx-upstream/include 23 | bx-upstream/include 24 | extra-libraries: stdc++ 25 | c-sources: bgfx-upstream/src/amalgamated.cpp 26 | default-language: Haskell2010 27 | 28 | executable hello 29 | build-depends: base, bgfx, sdl2 30 | main-is: Hello.hs 31 | default-language: Haskell2010 32 | c-sources: 33 | cbits/sdl-bgfx.c 34 | 35 | executable cubes 36 | build-depends: base, bgfx, sdl2, linear, bytestring, lens, distributive, clock 37 | main-is: Cubes.hs 38 | default-language: Haskell2010 39 | c-sources: 40 | cbits/sdl-bgfx.c -------------------------------------------------------------------------------- /cbits/sdl-bgfx.c: -------------------------------------------------------------------------------- 1 | #include "SDL.h" 2 | #include "SDL2/SDL_syswm.h" 3 | 4 | #include "bgfx/c99/bgfx.h" 5 | 6 | void bgfx_sdl_set_window(SDL_Window* _window) 7 | { 8 | SDL_SysWMinfo wmi; 9 | SDL_VERSION(&wmi.version); 10 | if (!SDL_GetWindowWMInfo(_window, &wmi) ) 11 | { 12 | return; 13 | } 14 | 15 | bgfx_platform_data_t pd; 16 | pd.ndt = wmi.info.x11.display; 17 | pd.nwh = (void*)(uintptr_t)wmi.info.x11.window; 18 | pd.context = NULL; 19 | pd.backBuffer = NULL; 20 | pd.backBufferDS = NULL; 21 | bgfx_set_platform_data(&pd); 22 | 23 | return; 24 | } 25 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | { mkDerivation, base, bytestring, clock, distributive, lens 2 | , linear, mesa, sdl2, stdenv, x11 3 | }: 4 | mkDerivation { 5 | pname = "bgfx"; 6 | version = "0.1.0.0"; 7 | src = ./.; 8 | isLibrary = true; 9 | isExecutable = true; 10 | libraryHaskellDepends = [ base ]; 11 | libraryPkgconfigDepends = [ mesa x11 ]; 12 | executableHaskellDepends = [ 13 | base bytestring clock distributive lens linear sdl2 14 | ]; 15 | homepage = "https://github.com/haskell-game/bgfx"; 16 | description = "Haskell bindings to bgfx"; 17 | license = stdenv.lib.licenses.bsd3; 18 | } 19 | -------------------------------------------------------------------------------- /fs_cubes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haskell-game/bgfx/e54dfbbb1eedda0aa6b23583cc8f105422ce5d84/fs_cubes.bin -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | { nixpkgs ? import {}, compiler ? "default" }: 2 | 3 | let 4 | 5 | inherit (nixpkgs) pkgs; 6 | 7 | f = { mkDerivation, base, bytestring, clock, distributive 8 | , lens, linear, mesa, sdl2, stdenv, x11 9 | }: 10 | mkDerivation { 11 | pname = "bgfx"; 12 | version = "0.1.0.0"; 13 | src = ./.; 14 | isLibrary = true; 15 | isExecutable = true; 16 | libraryHaskellDepends = [ base ]; 17 | libraryPkgconfigDepends = [ mesa x11 ]; 18 | executableHaskellDepends = [ 19 | base bytestring clock distributive lens linear sdl2 20 | ]; 21 | homepage = "https://github.com/haskell-game/bgfx"; 22 | description = "Haskell bindings to bgfx"; 23 | license = stdenv.lib.licenses.bsd3; 24 | }; 25 | 26 | haskellPackages = if compiler == "default" 27 | then pkgs.haskellPackages 28 | else pkgs.haskell.packages.${compiler}; 29 | 30 | drv = haskellPackages.callPackage f {}; 31 | 32 | in 33 | 34 | if pkgs.lib.inNixShell then drv.env else drv 35 | -------------------------------------------------------------------------------- /src/BGFX.hsc: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ForeignFunctionInterface #-} 2 | {-# LANGUAGE PatternSynonyms #-} 3 | {-# LANGUAGE ScopedTypeVariables #-} 4 | 5 | module BGFX where 6 | 7 | import Control.Monad.IO.Class (MonadIO, liftIO) 8 | import Data.Int 9 | import Data.Word 10 | import Foreign.C 11 | import Foreign.C.Types 12 | import Foreign.Ptr 13 | import Foreign.Storable 14 | 15 | #include "bgfx/c99/bgfx.h" 16 | 17 | pattern BGFX_PCI_ID_NONE = (#const BGFX_PCI_ID_NONE) 18 | pattern BGFX_PCI_ID_AMD = (#const BGFX_PCI_ID_AMD) 19 | pattern BGFX_PCI_ID_INTEL = (#const BGFX_PCI_ID_INTEL) 20 | pattern BGFX_PCI_ID_NVIDIA = (#const BGFX_PCI_ID_NVIDIA) 21 | 22 | data BgfxCallback 23 | 24 | pattern BGFX_RESET_NONE = (#const BGFX_RESET_NONE) 25 | pattern BGFX_RESET_FULLSCREEN = (#const BGFX_RESET_FULLSCREEN) 26 | pattern BGFX_RESET_FULLSCREEN_SHIFT = (#const BGFX_RESET_FULLSCREEN_SHIFT) 27 | pattern BGFX_RESET_FULLSCREEN_MASK = (#const BGFX_RESET_FULLSCREEN_MASK) 28 | pattern BGFX_RESET_MSAA_X2 = (#const BGFX_RESET_MSAA_X2) 29 | pattern BGFX_RESET_MSAA_X4 = (#const BGFX_RESET_MSAA_X4) 30 | pattern BGFX_RESET_MSAA_X8 = (#const BGFX_RESET_MSAA_X8) 31 | pattern BGFX_RESET_MSAA_X16 = (#const BGFX_RESET_MSAA_X16) 32 | pattern BGFX_RESET_MSAA_SHIFT = (#const BGFX_RESET_MSAA_SHIFT) 33 | pattern BGFX_RESET_MSAA_MASK = (#const BGFX_RESET_MSAA_MASK) 34 | pattern BGFX_RESET_VSYNC = (#const BGFX_RESET_VSYNC) 35 | pattern BGFX_RESET_MAXANISOTROPY = (#const BGFX_RESET_MAXANISOTROPY) 36 | pattern BGFX_RESET_CAPTURE = (#const BGFX_RESET_CAPTURE) 37 | pattern BGFX_RESET_HMD = (#const BGFX_RESET_HMD) 38 | pattern BGFX_RESET_HMD_DEBUG = (#const BGFX_RESET_HMD_DEBUG) 39 | pattern BGFX_RESET_HMD_RECENTER = (#const BGFX_RESET_HMD_RECENTER) 40 | pattern BGFX_RESET_FLUSH_AFTER_RENDER = (#const BGFX_RESET_FLUSH_AFTER_RENDER) 41 | pattern BGFX_RESET_FLIP_AFTER_RENDER = (#const BGFX_RESET_FLIP_AFTER_RENDER) 42 | pattern BGFX_RESET_SRGB_BACKBUFFER = (#const BGFX_RESET_SRGB_BACKBUFFER) 43 | pattern BGFX_RESET_HIDPI = (#const BGFX_RESET_HIDPI) 44 | pattern BGFX_RESET_DEPTH_CLAMP = (#const BGFX_RESET_DEPTH_CLAMP) 45 | 46 | pattern BGFX_DEBUG_NONE = (#const BGFX_DEBUG_NONE) 47 | pattern BGFX_DEBUG_WIREFRAME = (#const BGFX_DEBUG_WIREFRAME) 48 | pattern BGFX_DEBUG_IFH = (#const BGFX_DEBUG_IFH) 49 | pattern BGFX_DEBUG_STATS = (#const BGFX_DEBUG_STATS) 50 | pattern BGFX_DEBUG_TEXT = (#const BGFX_DEBUG_TEXT) 51 | 52 | type BgfxRendererType = (#type bgfx_renderer_type_t) 53 | 54 | pattern BGFX_RENDERER_TYPE_NULL = (#const BGFX_RENDERER_TYPE_NULL) 55 | pattern BGFX_RENDERER_TYPE_DIRECT3D9 = (#const BGFX_RENDERER_TYPE_DIRECT3D9) 56 | pattern BGFX_RENDERER_TYPE_DIRECT3D11 = (#const BGFX_RENDERER_TYPE_DIRECT3D11) 57 | pattern BGFX_RENDERER_TYPE_DIRECT3D12 = (#const BGFX_RENDERER_TYPE_DIRECT3D12) 58 | pattern BGFX_RENDERER_TYPE_METAL = (#const BGFX_RENDERER_TYPE_METAL) 59 | pattern BGFX_RENDERER_TYPE_OPENGLES = (#const BGFX_RENDERER_TYPE_OPENGLES) 60 | pattern BGFX_RENDERER_TYPE_OPENGL = (#const BGFX_RENDERER_TYPE_OPENGL) 61 | pattern BGFX_RENDERER_TYPE_VULKAN = (#const BGFX_RENDERER_TYPE_VULKAN) 62 | pattern BGFX_RENDERER_TYPE_COUNT = (#const BGFX_RENDERER_TYPE_COUNT) 63 | 64 | data BgfxCaps 65 | 66 | data BgfxStats 67 | 68 | data BgfxHMD 69 | 70 | type BgfxBackbufferRatio = (#type bgfx_backbuffer_ratio_t) 71 | 72 | pattern BGFX_BACKBUFFER_RATIO_EQUAL = (#const BGFX_BACKBUFFER_RATIO_EQUAL) 73 | pattern BGFX_BACKBUFFER_RATIO_HALF = (#const BGFX_BACKBUFFER_RATIO_HALF) 74 | pattern BGFX_BACKBUFFER_RATIO_QUARTER = (#const BGFX_BACKBUFFER_RATIO_QUARTER) 75 | pattern BGFX_BACKBUFFER_RATIO_EIGHTH = (#const BGFX_BACKBUFFER_RATIO_EIGHTH) 76 | pattern BGFX_BACKBUFFER_RATIO_SIXTEENTH = (#const BGFX_BACKBUFFER_RATIO_SIXTEENTH) 77 | pattern BGFX_BACKBUFFER_RATIO_DOUBLE = (#const BGFX_BACKBUFFER_RATIO_DOUBLE) 78 | 79 | type BgfxFrameBufferHandle = Word16 80 | 81 | data BgfxAllocator 82 | 83 | pattern BGFX_STATE_RGB_WRITE = (#const BGFX_STATE_RGB_WRITE) 84 | pattern BGFX_STATE_ALPHA_WRITE = (#const BGFX_STATE_ALPHA_WRITE) 85 | pattern BGFX_STATE_DEPTH_WRITE = (#const BGFX_STATE_DEPTH_WRITE) 86 | 87 | pattern BGFX_STATE_DEPTH_TEST_LESS = (#const BGFX_STATE_DEPTH_TEST_LESS) 88 | pattern BGFX_STATE_DEPTH_TEST_LEQUAL = (#const BGFX_STATE_DEPTH_TEST_LEQUAL) 89 | pattern BGFX_STATE_DEPTH_TEST_EQUAL = (#const BGFX_STATE_DEPTH_TEST_EQUAL) 90 | pattern BGFX_STATE_DEPTH_TEST_GEQUAL = (#const BGFX_STATE_DEPTH_TEST_GEQUAL) 91 | pattern BGFX_STATE_DEPTH_TEST_GREATER = (#const BGFX_STATE_DEPTH_TEST_GREATER) 92 | pattern BGFX_STATE_DEPTH_TEST_NOTEQUAL = (#const BGFX_STATE_DEPTH_TEST_NOTEQUAL) 93 | pattern BGFX_STATE_DEPTH_TEST_NEVER = (#const BGFX_STATE_DEPTH_TEST_NEVER) 94 | pattern BGFX_STATE_DEPTH_TEST_ALWAYS = (#const BGFX_STATE_DEPTH_TEST_ALWAYS) 95 | pattern BGFX_STATE_DEPTH_TEST_SHIFT = (#const BGFX_STATE_DEPTH_TEST_SHIFT) 96 | pattern BGFX_STATE_DEPTH_TEST_MASK = (#const BGFX_STATE_DEPTH_TEST_MASK) 97 | 98 | pattern BGFX_STATE_BLEND_ZERO = (#const BGFX_STATE_BLEND_ZERO) 99 | pattern BGFX_STATE_BLEND_ONE = (#const BGFX_STATE_BLEND_ONE) 100 | pattern BGFX_STATE_BLEND_SRC_COLOR = (#const BGFX_STATE_BLEND_SRC_COLOR) 101 | pattern BGFX_STATE_BLEND_INV_SRC_COLOR = (#const BGFX_STATE_BLEND_INV_SRC_COLOR) 102 | pattern BGFX_STATE_BLEND_SRC_ALPHA = (#const BGFX_STATE_BLEND_SRC_ALPHA) 103 | pattern BGFX_STATE_BLEND_INV_SRC_ALPHA = (#const BGFX_STATE_BLEND_INV_SRC_ALPHA) 104 | pattern BGFX_STATE_BLEND_DST_ALPHA = (#const BGFX_STATE_BLEND_DST_ALPHA) 105 | pattern BGFX_STATE_BLEND_INV_DST_ALPHA = (#const BGFX_STATE_BLEND_INV_DST_ALPHA) 106 | pattern BGFX_STATE_BLEND_DST_COLOR = (#const BGFX_STATE_BLEND_DST_COLOR) 107 | pattern BGFX_STATE_BLEND_INV_DST_COLOR = (#const BGFX_STATE_BLEND_INV_DST_COLOR) 108 | pattern BGFX_STATE_BLEND_SRC_ALPHA_SAT = (#const BGFX_STATE_BLEND_SRC_ALPHA_SAT) 109 | pattern BGFX_STATE_BLEND_FACTOR = (#const BGFX_STATE_BLEND_FACTOR) 110 | pattern BGFX_STATE_BLEND_INV_FACTOR = (#const BGFX_STATE_BLEND_INV_FACTOR) 111 | pattern BGFX_STATE_BLEND_SHIFT = (#const BGFX_STATE_BLEND_SHIFT) 112 | pattern BGFX_STATE_BLEND_MASK = (#const BGFX_STATE_BLEND_MASK) 113 | 114 | pattern BGFX_STATE_BLEND_EQUATION_ADD = (#const BGFX_STATE_BLEND_EQUATION_ADD) 115 | pattern BGFX_STATE_BLEND_EQUATION_SUB = (#const BGFX_STATE_BLEND_EQUATION_SUB) 116 | pattern BGFX_STATE_BLEND_EQUATION_REVSUB = (#const BGFX_STATE_BLEND_EQUATION_REVSUB) 117 | pattern BGFX_STATE_BLEND_EQUATION_MIN = (#const BGFX_STATE_BLEND_EQUATION_MIN) 118 | pattern BGFX_STATE_BLEND_EQUATION_MAX = (#const BGFX_STATE_BLEND_EQUATION_MAX) 119 | pattern BGFX_STATE_BLEND_EQUATION_SHIFT = (#const BGFX_STATE_BLEND_EQUATION_SHIFT) 120 | pattern BGFX_STATE_BLEND_EQUATION_MASK = (#const BGFX_STATE_BLEND_EQUATION_MASK) 121 | 122 | pattern BGFX_STATE_BLEND_INDEPENDENT = (#const BGFX_STATE_BLEND_INDEPENDENT) 123 | 124 | pattern BGFX_STATE_CULL_CW = (#const BGFX_STATE_CULL_CW) 125 | pattern BGFX_STATE_CULL_CCW = (#const BGFX_STATE_CULL_CCW) 126 | pattern BGFX_STATE_CULL_SHIFT = (#const BGFX_STATE_CULL_SHIFT) 127 | pattern BGFX_STATE_CULL_MASK = (#const BGFX_STATE_CULL_MASK) 128 | 129 | pattern BGFX_STATE_ALPHA_REF_SHIFT = (#const BGFX_STATE_ALPHA_REF_SHIFT) 130 | pattern BGFX_STATE_ALPHA_REF_MASK = (#const BGFX_STATE_ALPHA_REF_MASK) 131 | 132 | pattern BGFX_STATE_PT_TRISTRIP = (#const BGFX_STATE_PT_TRISTRIP) 133 | pattern BGFX_STATE_PT_LINES = (#const BGFX_STATE_PT_LINES) 134 | pattern BGFX_STATE_PT_LINESTRIP = (#const BGFX_STATE_PT_LINESTRIP) 135 | pattern BGFX_STATE_PT_POINTS = (#const BGFX_STATE_PT_POINTS) 136 | pattern BGFX_STATE_PT_SHIFT = (#const BGFX_STATE_PT_SHIFT) 137 | pattern BGFX_STATE_PT_MASK = (#const BGFX_STATE_PT_MASK) 138 | 139 | pattern BGFX_STATE_POINT_SIZE_SHIFT = (#const BGFX_STATE_POINT_SIZE_SHIFT) 140 | pattern BGFX_STATE_POINT_SIZE_MASK = (#const BGFX_STATE_POINT_SIZE_MASK) 141 | 142 | pattern BGFX_STATE_MSAA = (#const BGFX_STATE_MSAA) 143 | 144 | pattern BGFX_STATE_DEFAULT = (#const BGFX_STATE_DEFAULT) 145 | 146 | pattern BGFX_STENCIL_NONE = (#const BGFX_STENCIL_NONE) 147 | pattern BGFX_STENCIL_MASK = (#const BGFX_STENCIL_MASK) 148 | pattern BGFX_STENCIL_DEFAULT = (#const BGFX_STENCIL_DEFAULT) 149 | 150 | pattern BGFX_STENCIL_TEST_LESS = (#const BGFX_STENCIL_TEST_LESS) 151 | pattern BGFX_STENCIL_TEST_LEQUAL = (#const BGFX_STENCIL_TEST_LEQUAL) 152 | pattern BGFX_STENCIL_TEST_EQUAL = (#const BGFX_STENCIL_TEST_EQUAL) 153 | pattern BGFX_STENCIL_TEST_GEQUAL = (#const BGFX_STENCIL_TEST_GEQUAL) 154 | pattern BGFX_STENCIL_TEST_GREATER = (#const BGFX_STENCIL_TEST_GREATER) 155 | pattern BGFX_STENCIL_TEST_NOTEQUAL = (#const BGFX_STENCIL_TEST_NOTEQUAL) 156 | pattern BGFX_STENCIL_TEST_NEVER = (#const BGFX_STENCIL_TEST_NEVER) 157 | pattern BGFX_STENCIL_TEST_ALWAYS = (#const BGFX_STENCIL_TEST_ALWAYS) 158 | pattern BGFX_STENCIL_TEST_SHIFT = (#const BGFX_STENCIL_TEST_SHIFT) 159 | pattern BGFX_STENCIL_TEST_MASK = (#const BGFX_STENCIL_TEST_MASK) 160 | 161 | type BgfxOcclusionQueryHandle = Word16 162 | 163 | type BgfxIndexBufferHandle = Word16 164 | 165 | data BgfxIndexBuffer 166 | 167 | type BgfxVertexBufferHandle = Word16 168 | 169 | type BgfxDynamicVertexBufferHandle = Word16 170 | 171 | data BgfxVertexBuffer 172 | 173 | type BgfxInstanceDataBufferHandle = Word16 174 | 175 | data BgfxInstanceDataBuffer 176 | 177 | type BgfxUniformHandle = Word16 178 | 179 | type BgfxTextureHandle = Word16 180 | 181 | type BgfxProgramHandle = Word16 182 | 183 | type BgfxIndirectBufferHandle = Word16 184 | 185 | pattern BGFX_ACCESS_READ = (#const BGFX_ACCESS_READ) 186 | pattern BGFX_ACCESS_WRITE = (#const BGFX_ACCESS_WRITE) 187 | pattern BGFX_ACCESS_READWRITE = (#const BGFX_ACCESS_READWRITE) 188 | pattern BGFX_ACCESS_COUNT = (#const BGFX_ACCESS_COUNT) 189 | 190 | type BgfxAccess = (#type bgfx_access_t) 191 | 192 | type BgfxDynamicIndexBufferHandle = Word16 193 | 194 | type BgfxTextureFormat = (#type bgfx_texture_format_t) 195 | 196 | pattern BGFX_TEXTURE_FORMAT_BC1 = (#const BGFX_TEXTURE_FORMAT_BC1) 197 | pattern BGFX_TEXTURE_FORMAT_BC2 = (#const BGFX_TEXTURE_FORMAT_BC2) 198 | pattern BGFX_TEXTURE_FORMAT_BC3 = (#const BGFX_TEXTURE_FORMAT_BC3) 199 | pattern BGFX_TEXTURE_FORMAT_BC4 = (#const BGFX_TEXTURE_FORMAT_BC4) 200 | pattern BGFX_TEXTURE_FORMAT_BC5 = (#const BGFX_TEXTURE_FORMAT_BC5) 201 | pattern BGFX_TEXTURE_FORMAT_BC6H = (#const BGFX_TEXTURE_FORMAT_BC6H) 202 | pattern BGFX_TEXTURE_FORMAT_BC7 = (#const BGFX_TEXTURE_FORMAT_BC7) 203 | pattern BGFX_TEXTURE_FORMAT_ETC1 = (#const BGFX_TEXTURE_FORMAT_ETC1) 204 | pattern BGFX_TEXTURE_FORMAT_ETC2 = (#const BGFX_TEXTURE_FORMAT_ETC2) 205 | pattern BGFX_TEXTURE_FORMAT_ETC2A = (#const BGFX_TEXTURE_FORMAT_ETC2A) 206 | pattern BGFX_TEXTURE_FORMAT_ETC2A1 = (#const BGFX_TEXTURE_FORMAT_ETC2A1) 207 | pattern BGFX_TEXTURE_FORMAT_PTC12 = (#const BGFX_TEXTURE_FORMAT_PTC12) 208 | pattern BGFX_TEXTURE_FORMAT_PTC14 = (#const BGFX_TEXTURE_FORMAT_PTC14) 209 | pattern BGFX_TEXTURE_FORMAT_PTC12A = (#const BGFX_TEXTURE_FORMAT_PTC12A) 210 | pattern BGFX_TEXTURE_FORMAT_PTC14A = (#const BGFX_TEXTURE_FORMAT_PTC14A) 211 | pattern BGFX_TEXTURE_FORMAT_PTC22 = (#const BGFX_TEXTURE_FORMAT_PTC22) 212 | pattern BGFX_TEXTURE_FORMAT_PTC24 = (#const BGFX_TEXTURE_FORMAT_PTC24) 213 | pattern BGFX_TEXTURE_FORMAT_UNKNOWN = (#const BGFX_TEXTURE_FORMAT_UNKNOWN) 214 | pattern BGFX_TEXTURE_FORMAT_R1 = (#const BGFX_TEXTURE_FORMAT_R1) 215 | pattern BGFX_TEXTURE_FORMAT_A8 = (#const BGFX_TEXTURE_FORMAT_A8) 216 | pattern BGFX_TEXTURE_FORMAT_R8 = (#const BGFX_TEXTURE_FORMAT_R8) 217 | pattern BGFX_TEXTURE_FORMAT_R8I = (#const BGFX_TEXTURE_FORMAT_R8I) 218 | pattern BGFX_TEXTURE_FORMAT_R8U = (#const BGFX_TEXTURE_FORMAT_R8U) 219 | pattern BGFX_TEXTURE_FORMAT_R8S = (#const BGFX_TEXTURE_FORMAT_R8S) 220 | pattern BGFX_TEXTURE_FORMAT_R16 = (#const BGFX_TEXTURE_FORMAT_R16) 221 | pattern BGFX_TEXTURE_FORMAT_R16I = (#const BGFX_TEXTURE_FORMAT_R16I) 222 | pattern BGFX_TEXTURE_FORMAT_R16U = (#const BGFX_TEXTURE_FORMAT_R16U) 223 | pattern BGFX_TEXTURE_FORMAT_R16F = (#const BGFX_TEXTURE_FORMAT_R16F) 224 | pattern BGFX_TEXTURE_FORMAT_R16S = (#const BGFX_TEXTURE_FORMAT_R16S) 225 | pattern BGFX_TEXTURE_FORMAT_R32I = (#const BGFX_TEXTURE_FORMAT_R32I) 226 | pattern BGFX_TEXTURE_FORMAT_R32U = (#const BGFX_TEXTURE_FORMAT_R32U) 227 | pattern BGFX_TEXTURE_FORMAT_R32F = (#const BGFX_TEXTURE_FORMAT_R32F) 228 | pattern BGFX_TEXTURE_FORMAT_RG8 = (#const BGFX_TEXTURE_FORMAT_RG8) 229 | pattern BGFX_TEXTURE_FORMAT_RG8I = (#const BGFX_TEXTURE_FORMAT_RG8I) 230 | pattern BGFX_TEXTURE_FORMAT_RG8U = (#const BGFX_TEXTURE_FORMAT_RG8U) 231 | pattern BGFX_TEXTURE_FORMAT_RG8S = (#const BGFX_TEXTURE_FORMAT_RG8S) 232 | pattern BGFX_TEXTURE_FORMAT_RG16 = (#const BGFX_TEXTURE_FORMAT_RG16) 233 | pattern BGFX_TEXTURE_FORMAT_RG16I = (#const BGFX_TEXTURE_FORMAT_RG16I) 234 | pattern BGFX_TEXTURE_FORMAT_RG16U = (#const BGFX_TEXTURE_FORMAT_RG16U) 235 | pattern BGFX_TEXTURE_FORMAT_RG16F = (#const BGFX_TEXTURE_FORMAT_RG16F) 236 | pattern BGFX_TEXTURE_FORMAT_RG16S = (#const BGFX_TEXTURE_FORMAT_RG16S) 237 | pattern BGFX_TEXTURE_FORMAT_RG32I = (#const BGFX_TEXTURE_FORMAT_RG32I) 238 | pattern BGFX_TEXTURE_FORMAT_RG32U = (#const BGFX_TEXTURE_FORMAT_RG32U) 239 | pattern BGFX_TEXTURE_FORMAT_RG32F = (#const BGFX_TEXTURE_FORMAT_RG32F) 240 | pattern BGFX_TEXTURE_FORMAT_RGB9E5F = (#const BGFX_TEXTURE_FORMAT_RGB9E5F) 241 | pattern BGFX_TEXTURE_FORMAT_BGRA8 = (#const BGFX_TEXTURE_FORMAT_BGRA8) 242 | pattern BGFX_TEXTURE_FORMAT_RGBA8 = (#const BGFX_TEXTURE_FORMAT_RGBA8) 243 | pattern BGFX_TEXTURE_FORMAT_RGBA8I = (#const BGFX_TEXTURE_FORMAT_RGBA8I) 244 | pattern BGFX_TEXTURE_FORMAT_RGBA8U = (#const BGFX_TEXTURE_FORMAT_RGBA8U) 245 | pattern BGFX_TEXTURE_FORMAT_RGBA8S = (#const BGFX_TEXTURE_FORMAT_RGBA8S) 246 | pattern BGFX_TEXTURE_FORMAT_RGBA16 = (#const BGFX_TEXTURE_FORMAT_RGBA16) 247 | pattern BGFX_TEXTURE_FORMAT_RGBA16I = (#const BGFX_TEXTURE_FORMAT_RGBA16I) 248 | pattern BGFX_TEXTURE_FORMAT_RGBA16U = (#const BGFX_TEXTURE_FORMAT_RGBA16U) 249 | pattern BGFX_TEXTURE_FORMAT_RGBA16F = (#const BGFX_TEXTURE_FORMAT_RGBA16F) 250 | pattern BGFX_TEXTURE_FORMAT_RGBA16S = (#const BGFX_TEXTURE_FORMAT_RGBA16S) 251 | pattern BGFX_TEXTURE_FORMAT_RGBA32I = (#const BGFX_TEXTURE_FORMAT_RGBA32I) 252 | pattern BGFX_TEXTURE_FORMAT_RGBA32U = (#const BGFX_TEXTURE_FORMAT_RGBA32U) 253 | pattern BGFX_TEXTURE_FORMAT_RGBA32F = (#const BGFX_TEXTURE_FORMAT_RGBA32F) 254 | pattern BGFX_TEXTURE_FORMAT_R5G6B5 = (#const BGFX_TEXTURE_FORMAT_R5G6B5) 255 | pattern BGFX_TEXTURE_FORMAT_RGBA4 = (#const BGFX_TEXTURE_FORMAT_RGBA4) 256 | pattern BGFX_TEXTURE_FORMAT_RGB5A1 = (#const BGFX_TEXTURE_FORMAT_RGB5A1) 257 | pattern BGFX_TEXTURE_FORMAT_RGB10A2 = (#const BGFX_TEXTURE_FORMAT_RGB10A2) 258 | pattern BGFX_TEXTURE_FORMAT_R11G11B10F = (#const BGFX_TEXTURE_FORMAT_R11G11B10F) 259 | pattern BGFX_TEXTURE_FORMAT_UNKNOWN_DEPTH = (#const BGFX_TEXTURE_FORMAT_UNKNOWN_DEPTH) 260 | pattern BGFX_TEXTURE_FORMAT_D16 = (#const BGFX_TEXTURE_FORMAT_D16) 261 | pattern BGFX_TEXTURE_FORMAT_D24 = (#const BGFX_TEXTURE_FORMAT_D24) 262 | pattern BGFX_TEXTURE_FORMAT_D24S8 = (#const BGFX_TEXTURE_FORMAT_D24S8) 263 | pattern BGFX_TEXTURE_FORMAT_D32 = (#const BGFX_TEXTURE_FORMAT_D32) 264 | pattern BGFX_TEXTURE_FORMAT_D16F = (#const BGFX_TEXTURE_FORMAT_D16F) 265 | pattern BGFX_TEXTURE_FORMAT_D24F = (#const BGFX_TEXTURE_FORMAT_D24F) 266 | pattern BGFX_TEXTURE_FORMAT_D32F = (#const BGFX_TEXTURE_FORMAT_D32F) 267 | pattern BGFX_TEXTURE_FORMAT_D0S8 = (#const BGFX_TEXTURE_FORMAT_D0S8) 268 | pattern BGFX_TEXTURE_FORMAT_COUN = (#const BGFX_TEXTURE_FORMAT_COUNT) 269 | 270 | data BgfxMemory 271 | 272 | type BgfxAttrib = (#type bgfx_attrib_t) 273 | 274 | type BgfxAttribType = (#type bgfx_attrib_type_t) 275 | 276 | pattern BGFX_ATTRIB_POSITION = (#const BGFX_ATTRIB_POSITION) 277 | pattern BGFX_ATTRIB_NORMAL = (#const BGFX_ATTRIB_NORMAL) 278 | pattern BGFX_ATTRIB_TANGENT = (#const BGFX_ATTRIB_TANGENT) 279 | pattern BGFX_ATTRIB_BITANGENT = (#const BGFX_ATTRIB_BITANGENT) 280 | pattern BGFX_ATTRIB_COLOR0 = (#const BGFX_ATTRIB_COLOR0) 281 | pattern BGFX_ATTRIB_COLOR1 = (#const BGFX_ATTRIB_COLOR1) 282 | pattern BGFX_ATTRIB_INDICES = (#const BGFX_ATTRIB_INDICES) 283 | pattern BGFX_ATTRIB_WEIGHT = (#const BGFX_ATTRIB_WEIGHT) 284 | pattern BGFX_ATTRIB_TEXCOORD0 = (#const BGFX_ATTRIB_TEXCOORD0) 285 | pattern BGFX_ATTRIB_TEXCOORD1 = (#const BGFX_ATTRIB_TEXCOORD1) 286 | pattern BGFX_ATTRIB_TEXCOORD2 = (#const BGFX_ATTRIB_TEXCOORD2) 287 | pattern BGFX_ATTRIB_TEXCOORD3 = (#const BGFX_ATTRIB_TEXCOORD3) 288 | pattern BGFX_ATTRIB_TEXCOORD4 = (#const BGFX_ATTRIB_TEXCOORD4) 289 | pattern BGFX_ATTRIB_TEXCOORD5 = (#const BGFX_ATTRIB_TEXCOORD5) 290 | pattern BGFX_ATTRIB_TEXCOORD6 = (#const BGFX_ATTRIB_TEXCOORD6) 291 | pattern BGFX_ATTRIB_TEXCOORD7 = (#const BGFX_ATTRIB_TEXCOORD7) 292 | pattern BGFX_ATTRIB_COUNT = (#const BGFX_ATTRIB_COUNT) 293 | pattern BGFX_ATTRIB_TYPE_UINT8 = (#const BGFX_ATTRIB_TYPE_UINT8) 294 | pattern BGFX_ATTRIB_TYPE_UINT10 = (#const BGFX_ATTRIB_TYPE_UINT10) 295 | pattern BGFX_ATTRIB_TYPE_INT16 = (#const BGFX_ATTRIB_TYPE_INT16) 296 | pattern BGFX_ATTRIB_TYPE_HALF = (#const BGFX_ATTRIB_TYPE_HALF) 297 | pattern BGFX_ATTRIB_TYPE_FLOAT = (#const BGFX_ATTRIB_TYPE_FLOAT) 298 | pattern BGFX_ATTRIB_TYPE_COUNT = (#const BGFX_ATTRIB_TYPE_COUNT) 299 | 300 | data BgfxVertexDecl = BgfxVertexDecl Word32 Word16 (Ptr Word16) (Ptr Word16) 301 | 302 | instance Storable BgfxVertexDecl where 303 | sizeOf ~(BgfxVertexDecl a b c d) = sizeOf a + sizeOf b + sizeOf c + sizeOf d 304 | peek ptr = 305 | do BgfxVertexDecl <$> peek (castPtr ptr) <*> 306 | peek (castPtr (ptr `plusPtr` 307 | fromIntegral (sizeOf (undefined :: Word32)))) <*> 308 | peek (castPtr (ptr `plusPtr` 309 | fromIntegral 310 | (sizeOf (undefined :: Word32) + 311 | sizeOf (undefined :: Word16)))) <*> 312 | peek (castPtr (ptr `plusPtr` 313 | fromIntegral 314 | (sizeOf (undefined :: Word32) + 315 | sizeOf (undefined :: Word16) + 316 | sizeOf (undefined :: Ptr Word16)))) 317 | poke ptr (BgfxVertexDecl a b c d) = 318 | do poke (castPtr ptr) a 319 | poke (castPtr (ptr `plusPtr` fromIntegral (sizeOf (undefined :: Word32)))) b 320 | poke (castPtr (ptr `plusPtr` 321 | fromIntegral 322 | (sizeOf (undefined :: Word32) + 323 | sizeOf (undefined :: Word16)))) 324 | c 325 | poke (castPtr (ptr `plusPtr` 326 | fromIntegral 327 | (sizeOf (undefined :: Word32) + 328 | sizeOf (undefined :: Word16) + 329 | sizeOf (undefined :: Ptr Word16)))) 330 | d 331 | alignment _ = 0 332 | 333 | pattern BGFX_BUFFER_NONE = (#const BGFX_BUFFER_NONE) 334 | pattern BGFX_BUFFER_COMPUTE_FORMAT_8x1 = (#const BGFX_BUFFER_COMPUTE_FORMAT_8x1) 335 | pattern BGFX_BUFFER_COMPUTE_FORMAT_8x2 = (#const BGFX_BUFFER_COMPUTE_FORMAT_8x2) 336 | pattern BGFX_BUFFER_COMPUTE_FORMAT_8x4 = (#const BGFX_BUFFER_COMPUTE_FORMAT_8x4) 337 | pattern BGFX_BUFFER_COMPUTE_FORMAT_16x1 = (#const BGFX_BUFFER_COMPUTE_FORMAT_16x1) 338 | pattern BGFX_BUFFER_COMPUTE_FORMAT_16x2 = (#const BGFX_BUFFER_COMPUTE_FORMAT_16x2) 339 | pattern BGFX_BUFFER_COMPUTE_FORMAT_16x4 = (#const BGFX_BUFFER_COMPUTE_FORMAT_16x4) 340 | pattern BGFX_BUFFER_COMPUTE_FORMAT_32x1 = (#const BGFX_BUFFER_COMPUTE_FORMAT_32x1) 341 | pattern BGFX_BUFFER_COMPUTE_FORMAT_32x2 = (#const BGFX_BUFFER_COMPUTE_FORMAT_32x2) 342 | pattern BGFX_BUFFER_COMPUTE_FORMAT_32x4 = (#const BGFX_BUFFER_COMPUTE_FORMAT_32x4) 343 | pattern BGFX_BUFFER_COMPUTE_FORMAT_SHIFT = (#const BGFX_BUFFER_COMPUTE_FORMAT_SHIFT) 344 | pattern BGFX_BUFFER_COMPUTE_FORMAT_MASK = (#const BGFX_BUFFER_COMPUTE_FORMAT_MASK) 345 | pattern BGFX_BUFFER_COMPUTE_TYPE_UINT = (#const BGFX_BUFFER_COMPUTE_TYPE_UINT) 346 | pattern BGFX_BUFFER_COMPUTE_TYPE_INT = (#const BGFX_BUFFER_COMPUTE_TYPE_INT) 347 | pattern BGFX_BUFFER_COMPUTE_TYPE_FLOAT = (#const BGFX_BUFFER_COMPUTE_TYPE_FLOAT) 348 | pattern BGFX_BUFFER_COMPUTE_TYPE_SHIFT = (#const BGFX_BUFFER_COMPUTE_TYPE_SHIFT) 349 | pattern BGFX_BUFFER_COMPUTE_TYPE_MASK = (#const BGFX_BUFFER_COMPUTE_TYPE_MASK) 350 | pattern BGFX_BUFFER_COMPUTE_READ = (#const BGFX_BUFFER_COMPUTE_READ) 351 | pattern BGFX_BUFFER_COMPUTE_WRITE = (#const BGFX_BUFFER_COMPUTE_WRITE) 352 | pattern BGFX_BUFFER_DRAW_INDIRECT = (#const BGFX_BUFFER_DRAW_INDIRECT) 353 | pattern BGFX_BUFFER_ALLOW_RESIZE = (#const BGFX_BUFFER_ALLOW_RESIZE) 354 | pattern BGFX_BUFFER_INDEX32 = (#const BGFX_BUFFER_INDEX32) 355 | 356 | -- foreign import ccall unsafe 357 | -- BGFX_C_API const bgfx_memory_t* bgfx_make_ref_release(const void* _data, uint32_t _size, bgfx_release_fn_t _releaseFn, void* _userData); 358 | 359 | type BgfxShaderHandle = Word16 360 | 361 | type BgfxUniformType = (#type bgfx_uniform_type_t) 362 | 363 | pattern BGFX_UNIFORM_TYPE_INT1 = (#const BGFX_UNIFORM_TYPE_INT1) 364 | pattern BGFX_UNIFORM_TYPE_END = (#const BGFX_UNIFORM_TYPE_END) 365 | pattern BGFX_UNIFORM_TYPE_VEC4 = (#const BGFX_UNIFORM_TYPE_VEC4) 366 | pattern BGFX_UNIFORM_TYPE_MAT3 = (#const BGFX_UNIFORM_TYPE_MAT3) 367 | pattern BGFX_UNIFORM_TYPE_MAT4 = (#const BGFX_UNIFORM_TYPE_MAT4) 368 | pattern BGFX_UNIFORM_TYPE_COUNT = (#const BGFX_UNIFORM_TYPE_COUNT) 369 | 370 | pattern BGFX_CLEAR_NONE = (#const BGFX_CLEAR_NONE) 371 | pattern BGFX_CLEAR_COLOR = (#const BGFX_CLEAR_COLOR) 372 | pattern BGFX_CLEAR_DEPTH = (#const BGFX_CLEAR_DEPTH) 373 | pattern BGFX_CLEAR_STENCIL = (#const BGFX_CLEAR_STENCIL) 374 | pattern BGFX_CLEAR_DISCARD_COLOR_0 = (#const BGFX_CLEAR_DISCARD_COLOR_0) 375 | pattern BGFX_CLEAR_DISCARD_COLOR_1 = (#const BGFX_CLEAR_DISCARD_COLOR_1) 376 | pattern BGFX_CLEAR_DISCARD_COLOR_2 = (#const BGFX_CLEAR_DISCARD_COLOR_2) 377 | pattern BGFX_CLEAR_DISCARD_COLOR_3 = (#const BGFX_CLEAR_DISCARD_COLOR_3) 378 | pattern BGFX_CLEAR_DISCARD_COLOR_4 = (#const BGFX_CLEAR_DISCARD_COLOR_4) 379 | pattern BGFX_CLEAR_DISCARD_COLOR_5 = (#const BGFX_CLEAR_DISCARD_COLOR_5) 380 | pattern BGFX_CLEAR_DISCARD_COLOR_6 = (#const BGFX_CLEAR_DISCARD_COLOR_6) 381 | pattern BGFX_CLEAR_DISCARD_COLOR_7 = (#const BGFX_CLEAR_DISCARD_COLOR_7) 382 | pattern BGFX_CLEAR_DISCARD_DEPTH = (#const BGFX_CLEAR_DISCARD_DEPTH) 383 | pattern BGFX_CLEAR_DISCARD_STENCIL = (#const BGFX_CLEAR_DISCARD_STENCIL) 384 | 385 | data BgfxTextureInfo 386 | 387 | data BgfxTransientVertexBuffer 388 | 389 | data BgfxTransientIndexBuffer 390 | 391 | pattern BGFX_OCCLUSION_QUERY_RESULT_INVISIBLE = (#const BGFX_OCCLUSION_QUERY_RESULT_INVISIBLE) 392 | pattern BGFX_OCCLUSION_QUERY_RESULT_VISIBLE = (#const BGFX_OCCLUSION_QUERY_RESULT_VISIBLE) 393 | pattern BGFX_OCCLUSION_QUERY_RESULT_NORESULT = (#const BGFX_OCCLUSION_QUERY_RESULT_NORESULT) 394 | pattern BGFX_OCCLUSION_QUERY_RESULT_COUNT = (#const BGFX_OCCLUSION_QUERY_RESULT_COUNT ) 395 | 396 | type BgfxOcclusionQueryResult = (#type bgfx_occlusion_query_result_t) 397 | 398 | foreign import ccall unsafe "bgfx_init" bgfxInitFFI :: BgfxRendererType -> Word16 -> Word16 -> Ptr BgfxCallback -> Ptr BgfxAllocator -> IO Bool 399 | foreign import ccall unsafe "bgfx_shutdown" bgfxShutdownFFI :: IO () 400 | foreign import ccall unsafe "bgfx_reset" bgfxResetFFI :: Word32 -> Word32 -> Word32 -> IO () 401 | foreign import ccall unsafe "bgfx_frame" bgfxFrameFFI :: IO Word32 402 | foreign import ccall unsafe "bgfx_set_debug" bgfxSetDebugFFI :: Word32 -> IO () 403 | foreign import ccall unsafe "bgfx_dbg_text_clear" bgfxDbgTextClearFFI :: Word8 -> Bool -> IO () 404 | foreign import ccall unsafe "bgfx_get_renderer_type" bgfxGetRendererTypeFFI :: IO BgfxRendererType 405 | foreign import ccall unsafe "bgfx_get_caps" bgfxGetCapsFFI :: IO (Ptr BgfxCaps) 406 | foreign import ccall unsafe "bgfx_get_stats" bgfxGetStatsFFI :: IO (Ptr BgfxStats) 407 | foreign import ccall unsafe "bgfx_get_hmd" bgfxGetHMDFFI :: IO (Ptr BgfxHMD) 408 | foreign import ccall unsafe "bgfx_render_frame" bgfxRenderFrameFFI :: IO () 409 | foreign import ccall unsafe "bgfx_discard" bgfxDiscardFFI :: IO () 410 | foreign import ccall unsafe "bgfx_touch" bgfxTouchFFI :: Word8 -> IO Word32 411 | foreign import ccall unsafe "bgfx_set_palette_color" bgxSetPaletteColorFFI :: Word8 -> Ptr CFloat -> IO () 412 | foreign import ccall unsafe "bgfx_save_screen_shot" bgfxSaveScreenshotFFI :: CString -> IO () 413 | foreign import ccall unsafe "bgfx_set_view_name" bgfxSetViewNameFFI :: Word8 -> CString -> IO () 414 | foreign import ccall unsafe "bgfx_set_view_rect" bgfxSetViewRectFFI :: Word8 -> Word16 -> Word16 -> Word16 -> Word16 -> IO () 415 | foreign import ccall unsafe "bgfx_set_view_rect_auto" bgfxSetViewRectAutoFFI :: Word8 -> Word16 -> Word16 -> BgfxBackbufferRatio -> IO () 416 | foreign import ccall unsafe "bgfx_set_view_scissor" bgfxSetViewScissorFFI :: Word8 -> Word16 -> Word16 -> Word16 -> Word16 -> IO () 417 | foreign import ccall unsafe "bgfx_set_view_clear" bgfxSetViewClearFFI :: Word8 -> Word16 -> Word32 -> CFloat -> Word8 -> IO () 418 | foreign import ccall unsafe "bgfx_set_view_clear_mrt" bgfxSetViewClearMrtFFI :: Word8 -> Word16 -> CFloat -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> IO () 419 | foreign import ccall unsafe "bgfx_set_view_seq" bgfxSetViewSeqFFI :: Word8 -> Bool -> IO () 420 | foreign import ccall unsafe "bgfx_set_view_transform" bgfxSetViewTransformFFI :: Word8 -> Ptr a -> Ptr b -> IO () 421 | foreign import ccall unsafe "bgfx_set_view_transform_stereo" bgfxSetViewTransformStereoFFI :: Word8 -> Ptr a -> Ptr b -> Word8 -> Ptr () -> IO () 422 | foreign import ccall unsafe "bgfx_set_view_remap" bgfxSetVieRemapFFI :: Word8 -> Word8 -> Ptr a -> IO () 423 | foreign import ccall unsafe "bgfx_set_view_frame_buffer" bgfxSetViewframeBufferFFI :: Word8 -> BgfxFrameBufferHandle -> IO () 424 | foreign import ccall unsafe "bgfx_set_marker" bgfxSetMarkerFFI :: CString -> IO () 425 | foreign import ccall unsafe "bgfx_set_state" bgfxSetStateFFI :: Word64 -> Word32 -> IO () 426 | foreign import ccall unsafe "bgfx_set_stencil" bgfxSetStencilFFI :: Word32 -> Word32 -> IO () 427 | foreign import ccall unsafe "bgfx_set_scissor" bgfxSetScissorFFI :: Word16 -> Word16 -> Word16 -> Word16 -> IO Word16 428 | foreign import ccall unsafe "bgfx_set_scissor_cached" bgfxSetScissorCachedFFI :: Word16 -> IO () 429 | foreign import ccall unsafe "bgfx_set_transform" bgfxSetTransformFFI :: Ptr a -> Word16 -> IO Word32 430 | foreign import ccall unsafe "bgfx_set_condition" bgfxSetConditionFFI :: BgfxOcclusionQueryHandle -> Bool -> IO () 431 | foreign import ccall unsafe "bgfx_set_index_buffer" bgfxSetIndexBufferFFI :: BgfxIndexBufferHandle -> Word32 -> Word32 -> IO () 432 | foreign import ccall unsafe "bgfx_set_dynamic_index_buffer" bgfxSetDynamicIndexBufferFFI :: BgfxIndexBufferHandle -> Word32 -> Word32 -> IO () 433 | foreign import ccall unsafe "bgfx_set_transient_index_buffer" bgfxSetTransientIndexBufferFFI :: Ptr BgfxIndexBuffer -> Word32 -> Word32 -> IO () 434 | foreign import ccall unsafe "bgfx_set_vertex_buffer" bgfxSetVertexBufferFFI :: BgfxVertexBufferHandle -> Word32 -> Word32 -> IO () 435 | foreign import ccall unsafe "bgfx_set_dynamic_vertex_buffer" bgfxSetDynamicVertexBufferFFI :: BgfxVertexBufferHandle -> Word32 -> IO () 436 | foreign import ccall unsafe "bgfx_set_transient_vertex_buffer" bgfxSetTransientVertexBufferFFI :: Ptr BgfxVertexBuffer -> Word32 -> Word32 -> IO () 437 | foreign import ccall unsafe "bgfx_set_instance_data_buffer" bgfxSetInstanceDataBufferFFI :: Ptr BgfxInstanceDataBuffer -> Word32 -> IO () 438 | foreign import ccall unsafe "bgfx_set_instance_data_from_vertex_buffer" bgfxSetInstanceDataBufferFromVertexBufferFFI :: BgfxVertexBufferHandle -> Word32 -> Word32 -> IO () 439 | foreign import ccall unsafe "bgfx_set_instance_data_from_dynamic_vertex_buffer" bgfxSetInstanceDataBufferFromDynamicVertexBufferFFI :: BgfxDynamicVertexBufferHandle -> Word32 -> Word32 -> IO () 440 | foreign import ccall unsafe "bgfx_set_texture" bgfxSetTextureFFI :: Word8 -> BgfxUniformHandle -> BgfxTextureHandle -> Word32 -> IO () 441 | foreign import ccall unsafe "bgfx_set_texture_from_frame_buffer" bgfxSetTextureFromFrameBufferFFI :: Word8 -> BgfxUniformHandle -> BgfxFrameBufferHandle -> Word8 -> Word32 -> IO () 442 | foreign import ccall unsafe "bgfx_submit" bgfxSubmitFFI :: Word8 -> BgfxProgramHandle -> Int32 -> IO Word32 443 | foreign import ccall unsafe "bgfx_submit_occlusion_query" bgfxSubmitOcclusionQueryFFI :: Word8 -> BgfxProgramHandle -> BgfxOcclusionQueryHandle -> Int32 -> IO Word32 444 | foreign import ccall unsafe "bgfx_submit_indirect" bgfxSubmitIndirectFFI :: Word8 -> BgfxProgramHandle -> BgfxIndirectBufferHandle -> Word16 -> Word16 -> Int32 -> IO Word32 445 | foreign import ccall unsafe "bgfx_set_compute_index_buffer" bgfxSetComputeIndexBufferFFI :: Word8 -> BgfxIndexBufferHandle -> BgfxAccess -> IO () 446 | foreign import ccall unsafe "bgfx_set_compute_vertex_buffer" bgfxSetComputeVertexBufferFFI :: Word8 -> BgfxVertexBufferHandle -> BgfxAccess -> IO () 447 | foreign import ccall unsafe "bgfx_set_compute_dynamic_index_buffer" bgxSetComputeDynamicIndexBufferFFI :: Word8 -> BgfxDynamicIndexBufferHandle -> BgfxAccess -> IO () 448 | foreign import ccall unsafe "bgfx_set_compute_dynamic_vertex_buffer" bgfxSetComputeDynamicVertexBufferFFI :: Word8 -> BgfxDynamicVertexBufferHandle -> BgfxAccess -> IO () 449 | foreign import ccall unsafe "bgfx_set_compute_indirect_buffer" bgfxSetComputeIndirectBufferFFI :: Word8 -> BgfxIndirectBufferHandle -> BgfxAccess -> IO () 450 | foreign import ccall unsafe "bgfx_set_image" bgfxSetImageFFI :: Word8 -> BgfxUniformHandle -> BgfxTextureHandle -> Word8 -> BgfxAccess -> BgfxTextureFormat -> IO () 451 | foreign import ccall unsafe "bgfx_set_image_from_frame_buffer" bgfxSetImageFromFrameBufferFFI :: Word8 -> BgfxUniformHandle -> BgfxFrameBufferHandle -> Word8 -> BgfxAccess -> BgfxTextureFormat -> IO () 452 | foreign import ccall unsafe "bgfx_dispatch" bgfxDispatchFFI :: Word8 -> BgfxProgramHandle -> Word16 -> Word16 -> Word16 -> Word8 -> IO Word32 453 | foreign import ccall unsafe "bgfx_dispatch_indirect" bgfxDispatchIndirectFFI :: Word8 -> BgfxProgramHandle -> BgfxIndirectBufferHandle -> Word16 -> Word16 -> Word16 -> Word8 -> IO Word32 454 | foreign import ccall unsafe "bgfx_blit" bgfxBlitFFI :: Word8 -> BgfxTextureHandle -> Word8 -> Word16 -> Word16 -> Word16 -> BgfxTextureHandle -> Word8 -> Word16 -> Word16 -> Word16 -> Word16-> Word16 -> Word16 -> IO () 455 | foreign import ccall unsafe "bgfx_blit_frame_buffer" bgfxBlitFrameBufferFFI :: Word8 -> BgfxTextureHandle -> Word8 -> Word16 -> Word16 -> Word16 -> BgfxFrameBufferHandle -> Word8 -> Word8 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> IO () 456 | foreign import ccall unsafe "bgfx_alloc" bgfxAllocFFI :: Word32 -> IO (Ptr BgfxMemory) 457 | foreign import ccall unsafe "bgfx_copy" bgfxCopyFFI :: Ptr a -> Word32 -> IO (Ptr BgfxMemory) 458 | foreign import ccall unsafe "bgfx_make_ref" bgfxMakeRefFFI :: Ptr a -> Word32 -> IO (Ptr BgfxMemory) 459 | foreign import ccall unsafe "bgfx_create_vertex_buffer" bgfxCreateVertexBufferFFI :: Ptr BgfxMemory -> Ptr BgfxVertexDecl -> Word16 -> IO BgfxVertexBufferHandle 460 | foreign import ccall unsafe "bgfx_vertex_decl_begin" bgfxVertexDeclBeginFFI :: Ptr BgfxVertexDecl -> BgfxRendererType -> IO () 461 | foreign import ccall unsafe "bgfx_vertex_decl_add" bgfxVertexDeclAddFFI :: Ptr BgfxVertexDecl -> BgfxAttrib -> Word8 -> BgfxAttribType -> Bool -> Bool -> IO () 462 | foreign import ccall unsafe "bgfx_vertex_decl_end" bgfxVertexDeclEndFFI :: Ptr BgfxVertexDecl -> IO () 463 | foreign import ccall unsafe "bgfx_create_index_buffer" bgfxCreateIndexBufferFFI :: Ptr BgfxMemory -> Word16 -> IO BgfxIndexBufferHandle 464 | foreign import ccall unsafe "bgfx_create_shader" bgfxCreateShaderFFI :: Ptr BgfxMemory -> IO BgfxShaderHandle 465 | foreign import ccall unsafe "bgfx_get_shader_uniforms" bgfxGetShaderUniformsFFI :: BgfxShaderHandle -> Ptr BgfxUniformHandle -> Word16 -> IO Word16 466 | foreign import ccall unsafe "bgfx_destroy_shader" bgfxDestroyShaderFFI :: BgfxShaderHandle -> IO () 467 | foreign import ccall unsafe "bgfx_create_program" bgfxCreateProgramFFI :: BgfxShaderHandle -> BgfxShaderHandle -> Bool -> IO BgfxProgramHandle 468 | foreign import ccall unsafe "bgfx_create_compute_program" bgfxCreateComputeProgramFFI :: BgfxShaderHandle -> Bool -> IO BgfxProgramHandle 469 | foreign import ccall unsafe "bgfx_destroy_program" bgfxDestroyProgramFFI :: BgfxProgramHandle -> IO () 470 | foreign import ccall unsafe "bgfx_create_uniform" bgfxCreateUniformFFI :: CString -> BgfxUniformType -> Word16 -> IO BgfxUniformHandle 471 | foreign import ccall unsafe "bgfx_destroy_uniform" bgfxDestroyUniformFFI :: BgfxUniformHandle -> IO () 472 | foreign import ccall unsafe "bgfx_calc_texture_size" bgfxCalcTextureSizeFFI :: Ptr BgfxTextureInfo -> Word16 -> Word16 -> Word16 -> Bool -> Word8 -> BgfxTextureFormat -> IO () 473 | foreign import ccall unsafe "bgfx_create_texture" bgfxCreateTextureFFI :: Ptr BgfxMemory -> Word32 -> Word8 -> Ptr BgfxTextureInfo -> IO BgfxTextureHandle 474 | foreign import ccall unsafe "bgfx_create_texture_2d" bgfxCreateTexture2DFFI :: Word16 -> Word16 -> Word8 -> BgfxTextureFormat -> Word32 -> Ptr BgfxMemory -> IO BgfxTextureHandle 475 | foreign import ccall unsafe "bgfx_create_texture_2d_scaled" bgfxCreateTexture2DScaledFFI :: BgfxBackbufferRatio -> Word8 -> BgfxTextureFormat -> Word32 -> IO BgfxTextureHandle 476 | foreign import ccall unsafe "bgfx_create_texture_3d" bgfxCreateTexture3DFFI :: Word16 -> Word16 -> Word16 -> Word8 -> BgfxTextureFormat -> Word32 -> Ptr BgfxMemory -> IO BgfxTextureHandle 477 | foreign import ccall unsafe "bgfx_create_texture_cube" bgfxCreateTextureCubeFFI :: Word16 -> Word8 -> BgfxTextureFormat -> Word32 -> Ptr BgfxMemory -> IO BgfxTextureHandle 478 | foreign import ccall unsafe "bgfx_update_texture_2d" bgfxUpdateTexture2DFFI :: BgfxTextureHandle -> Word8 -> Word16 -> Word16 -> Word16 -> Word16 -> Ptr BgfxMemory -> Word16 -> IO () 479 | foreign import ccall unsafe "bgfx_update_texture_3d" bgfxUpdateTexture3DFFI :: BgfxTextureHandle -> Word8 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Word16 -> Ptr BgfxMemory -> IO () 480 | foreign import ccall unsafe "bgfx_update_texture_cube" bgfxUpdateTextureCubeFFI :: BgfxTextureHandle -> Word8 -> Word8 -> Word16 -> Word16 -> Word16 -> Word16 -> Ptr BgfxMemory -> Word16 -> IO () 481 | foreign import ccall unsafe "bgfx_read_texture" bgfxReadTextureFFI :: BgfxTextureHandle -> Ptr a -> IO () 482 | foreign import ccall unsafe "bgfx_read_frame_buffer" bgfxReadFrameBufferFFI :: BgfxFrameBufferHandle -> Word8 -> Ptr a -> IO () 483 | foreign import ccall unsafe "bgfx_destroy_texture" bgfxDestroyTextureFFI :: BgfxTextureHandle -> IO () 484 | foreign import ccall unsafe "bgfx_create_frame_buffer" bgfxCreateFrameBufferFFI :: Word16 -> Word16 -> BgfxTextureFormat -> Word32 -> IO BgfxFrameBufferHandle 485 | foreign import ccall unsafe "bgfx_create_frame_buffer_scaled" bgfxCreateFrameBufferScaledFFI :: BgfxBackbufferRatio -> BgfxTextureFormat -> Word32 -> IO BgfxFrameBufferHandle 486 | foreign import ccall unsafe "bgfx_create_frame_buffer_from_handles" bgfxCreateFrameBufferFromHandlesFFI :: Word8 -> Ptr BgfxTextureHandle -> Bool -> IO BgfxFrameBufferHandle 487 | foreign import ccall unsafe "bgfx_create_frame_buffer_from_nwh" bgfxCreateFrameBufferFromNWHFFI :: Ptr a -> Word16 -> Word16 -> BgfxTextureFormat -> IO BgfxFrameBufferHandle 488 | foreign import ccall unsafe "bgfx_destroy_frame_buffer" bgfxDestroyFrameBufferFFI :: BgfxFrameBufferHandle -> IO () 489 | foreign import ccall unsafe "bgfx_check_avail_transient_index_buffer" bgfxCheckAvailTransientIndexBufferFFI :: Word32 -> IO Bool 490 | foreign import ccall unsafe "bgfx_check_avail_transient_vertex_buffer" bgfxCheckAvailTransientVertexBufferFFI :: Word32 -> Ptr BgfxVertexDecl -> IO Bool 491 | foreign import ccall unsafe "bgfx_check_avail_instance_data_buffer" bgfxCheckAvailInstanceDataBufferFFI :: Word32 -> Word16 -> IO Bool 492 | foreign import ccall unsafe "bgfx_check_avail_transient_buffers" bgfxCheckAvailTransientBuffersFFI :: Word32 -> Ptr BgfxVertexDecl -> Word32 -> IO Bool 493 | foreign import ccall unsafe "bgfx_alloc_transient_index_buffer" bgfxAllocTransientIndexBufferFFI :: Ptr BgfxTransientIndexBuffer -> Word32 -> IO () 494 | foreign import ccall unsafe "bgfx_alloc_transient_vertex_buffer" bgfxAllocTransientVertexBufferFFI :: Ptr BgfxTransientVertexBuffer -> Word32 -> Ptr BgfxVertexDecl -> IO () 495 | foreign import ccall unsafe "bgfx_alloc_transient_buffers" bgfxAllocTransientBuffersFFI :: Ptr BgfxTransientVertexBuffer -> Ptr BgfxVertexDecl -> Word32 -> Ptr BgfxTransientIndexBuffer -> Word32 -> IO () 496 | foreign import ccall unsafe "bgfx_alloc_instance_data_buffer" bgfxAllocInstanceDataBufferFFI :: Word32 -> Word16 -> IO (Ptr BgfxInstanceDataBuffer) 497 | foreign import ccall unsafe "bgfx_create_indirect_buffer" bgfxCreateIndirectBufferFFI :: Word32 -> IO BgfxIndirectBufferHandle 498 | foreign import ccall unsafe "bgfx_destroy_indirect_buffer" bgfxDestroyIndirectBufferFFI :: BgfxIndirectBufferHandle -> IO () 499 | foreign import ccall unsafe "bgfx_create_occlusion_query" bgfxCreateOcclusionQueryFFI :: IO BgfxOcclusionQueryHandle 500 | foreign import ccall unsafe "bgfx_get_result" bgfxGetResultFFI :: BgfxOcclusionQueryHandle -> IO BgfxOcclusionQueryResult 501 | foreign import ccall unsafe "bgfx_destroy_occlusion_query" bgfxDestroyOcclusionQueryFFI :: BgfxOcclusionQueryHandle -> IO () 502 | 503 | bgfxInit :: MonadIO m 504 | => BgfxRendererType 505 | -> Word16 506 | -> Word16 507 | -> Ptr BgfxCallback 508 | -> Ptr BgfxAllocator 509 | -> m Bool 510 | bgfxInit a b c d e = liftIO (bgfxInitFFI a b c d e) 511 | 512 | {-# INLINE bgfxInit #-} 513 | 514 | bgfxShutdown :: MonadIO m 515 | => m () 516 | bgfxShutdown = liftIO bgfxShutdownFFI 517 | 518 | {-# INLINE bgfxShutdown #-} 519 | 520 | bgfxReset :: MonadIO m 521 | => Word32 -> Word32 -> Word32 -> m () 522 | bgfxReset a b c = liftIO (bgfxResetFFI a b c) 523 | 524 | {-# INLINE bgfxReset #-} 525 | 526 | bgfxFrame :: MonadIO m 527 | => m Word32 528 | bgfxFrame = liftIO bgfxFrameFFI 529 | 530 | {-# INLINE bgfxFrame #-} 531 | 532 | bgfxSetDebug :: MonadIO m 533 | => Word32 -> m () 534 | bgfxSetDebug a = liftIO (bgfxSetDebugFFI a) 535 | 536 | {-# INLINE bgfxSetDebug #-} 537 | 538 | bgfxDbgTextClear :: MonadIO m 539 | => Word8 -> Bool -> m () 540 | bgfxDbgTextClear a b = liftIO (bgfxDbgTextClearFFI a b) 541 | 542 | {-# INLINE bgfxDbgTextClear #-} 543 | 544 | bgfxGetRendererType :: MonadIO m 545 | => m BgfxRendererType 546 | bgfxGetRendererType = liftIO (bgfxGetRendererTypeFFI) 547 | 548 | {-# INLINE bgfxGetRendererType #-} 549 | 550 | bgfxGetCaps :: MonadIO m 551 | => m (Ptr BgfxCaps) 552 | bgfxGetCaps = liftIO (bgfxGetCapsFFI) 553 | 554 | {-# INLINE bgfxGetCaps #-} 555 | 556 | bgfxGetStats :: MonadIO m 557 | => m (Ptr BgfxStats) 558 | bgfxGetStats = liftIO (bgfxGetStatsFFI) 559 | 560 | {-# INLINE bgfxGetStats #-} 561 | 562 | bgfxGetHMD :: MonadIO m 563 | => m (Ptr BgfxHMD) 564 | bgfxGetHMD = liftIO (bgfxGetHMDFFI) 565 | 566 | {-# INLINE bgfxGetHMD #-} 567 | 568 | bgfxRenderFrame :: MonadIO m 569 | => m () 570 | bgfxRenderFrame = liftIO (bgfxRenderFrameFFI) 571 | 572 | {-# INLINE bgfxRenderFrame #-} 573 | 574 | bgfxDiscard :: MonadIO m 575 | => m () 576 | bgfxDiscard = liftIO (bgfxDiscardFFI) 577 | 578 | {-# INLINE bgfxDiscard #-} 579 | 580 | bgfxTouch :: MonadIO m 581 | => Word8 -> m Word32 582 | bgfxTouch a = liftIO (bgfxTouchFFI a) 583 | 584 | {-# INLINE bgfxTouch #-} 585 | 586 | bgxSetPaletteColor :: MonadIO m 587 | => Word8 -> Ptr CFloat -> m () 588 | bgxSetPaletteColor a b = liftIO (bgxSetPaletteColorFFI a b) 589 | 590 | {-# INLINE bgxSetPaletteColor #-} 591 | 592 | bgfxSaveScreenshot :: MonadIO m 593 | => CString -> m () 594 | bgfxSaveScreenshot a = liftIO (bgfxSaveScreenshotFFI a) 595 | 596 | {-# INLINE bgfxSaveScreenshot #-} 597 | 598 | bgfxSetViewName :: MonadIO m 599 | => Word8 -> CString -> m () 600 | bgfxSetViewName a b = liftIO (bgfxSetViewNameFFI a b) 601 | 602 | {-# INLINE bgfxSetViewName #-} 603 | 604 | bgfxSetViewRect 605 | :: MonadIO m 606 | => Word8 -> Word16 -> Word16 -> Word16 -> Word16 -> m () 607 | bgfxSetViewRect a b c d e = liftIO (bgfxSetViewRectFFI a b c d e) 608 | 609 | {-# INLINE bgfxSetViewRect #-} 610 | 611 | bgfxSetViewRectAuto 612 | :: MonadIO m 613 | => Word8 -> Word16 -> Word16 -> BgfxBackbufferRatio -> m () 614 | bgfxSetViewRectAuto a b c d = liftIO (bgfxSetViewRectAutoFFI a b c d) 615 | 616 | {-# INLINE bgfxSetViewRectAuto #-} 617 | 618 | bgfxSetViewScissor 619 | :: MonadIO m 620 | => Word8 -> Word16 -> Word16 -> Word16 -> Word16 -> m () 621 | bgfxSetViewScissor a b c d e = liftIO (bgfxSetViewScissorFFI a b c d e) 622 | 623 | {-# INLINE bgfxSetViewScissor #-} 624 | 625 | bgfxSetViewClear 626 | :: MonadIO m 627 | => Word8 -> Word16 -> Word32 -> CFloat -> Word8 -> m () 628 | bgfxSetViewClear a b c d e = liftIO (bgfxSetViewClearFFI a b c d e) 629 | 630 | {-# INLINE bgfxSetViewClear #-} 631 | 632 | bgfxSetViewClearMrt :: MonadIO m 633 | => Word8 634 | -> Word16 635 | -> CFloat 636 | -> Word8 637 | -> Word8 638 | -> Word8 639 | -> Word8 640 | -> Word8 641 | -> Word8 642 | -> Word8 643 | -> Word8 644 | -> Word8 645 | -> m () 646 | bgfxSetViewClearMrt a b c d e f g h i j k m = 647 | liftIO (bgfxSetViewClearMrtFFI a b c d e f g h i j k m) 648 | 649 | {-# INLINE bgfxSetViewClearMrt #-} 650 | 651 | bgfxSetViewSeq :: MonadIO m 652 | => Word8 -> Bool -> m () 653 | bgfxSetViewSeq a b = liftIO (bgfxSetViewSeqFFI a b) 654 | 655 | {-# INLINE bgfxSetViewSeq #-} 656 | 657 | bgfxSetViewTransform 658 | :: MonadIO m 659 | => Word8 -> Ptr a -> Ptr b -> m () 660 | bgfxSetViewTransform a b c = liftIO (bgfxSetViewTransformFFI a b c) 661 | 662 | {-# INLINE bgfxSetViewTransform #-} 663 | 664 | bgfxSetViewTransformStereo :: MonadIO m 665 | => Word8 666 | -> Ptr a 667 | -> Ptr b 668 | -> Word8 669 | -> Ptr () 670 | -> m () 671 | bgfxSetViewTransformStereo a b c d e = 672 | liftIO (bgfxSetViewTransformStereoFFI a b c d e) 673 | 674 | {-# INLINE bgfxSetViewTransformStereo #-} 675 | 676 | bgfxSetVieRemap 677 | :: MonadIO m 678 | => Word8 -> Word8 -> Ptr a -> m () 679 | bgfxSetVieRemap a b c = liftIO (bgfxSetVieRemapFFI a b c) 680 | 681 | {-# INLINE bgfxSetVieRemap #-} 682 | 683 | bgfxSetViewframeBuffer 684 | :: MonadIO m 685 | => Word8 -> BgfxFrameBufferHandle -> m () 686 | bgfxSetViewframeBuffer a b = liftIO (bgfxSetViewframeBufferFFI a b) 687 | 688 | {-# INLINE bgfxSetViewframeBuffer #-} 689 | 690 | bgfxSetMarker :: MonadIO m 691 | => CString -> m () 692 | bgfxSetMarker a = liftIO (bgfxSetMarkerFFI a) 693 | 694 | {-# INLINE bgfxSetMarker #-} 695 | 696 | bgfxSetState :: MonadIO m 697 | => Word64 -> Word32 -> m () 698 | bgfxSetState a b = liftIO (bgfxSetStateFFI a b) 699 | 700 | {-# INLINE bgfxSetState #-} 701 | 702 | bgfxSetStencil :: MonadIO m 703 | => Word32 -> Word32 -> m () 704 | bgfxSetStencil a b = liftIO (bgfxSetStencilFFI a b) 705 | 706 | {-# INLINE bgfxSetStencil #-} 707 | 708 | bgfxSetScissor 709 | :: MonadIO m 710 | => Word16 -> Word16 -> Word16 -> Word16 -> m Word16 711 | bgfxSetScissor a b c d = liftIO (bgfxSetScissorFFI a b c d) 712 | 713 | {-# INLINE bgfxSetScissor #-} 714 | 715 | bgfxSetScissorCached :: MonadIO m 716 | => Word16 -> m () 717 | bgfxSetScissorCached a = liftIO (bgfxSetScissorCachedFFI a) 718 | 719 | {-# INLINE bgfxSetScissorCached #-} 720 | 721 | bgfxSetTransform :: MonadIO m 722 | => Ptr a -> Word16 -> m Word32 723 | bgfxSetTransform a b = liftIO (bgfxSetTransformFFI a b) 724 | 725 | {-# INLINE bgfxSetTransform #-} 726 | 727 | bgfxSetCondition 728 | :: MonadIO m 729 | => BgfxOcclusionQueryHandle -> Bool -> m () 730 | bgfxSetCondition a b = liftIO (bgfxSetConditionFFI a b) 731 | 732 | {-# INLINE bgfxSetCondition #-} 733 | 734 | bgfxSetIndexBuffer 735 | :: MonadIO m 736 | => BgfxIndexBufferHandle -> Word32 -> Word32 -> m () 737 | bgfxSetIndexBuffer a b c = liftIO (bgfxSetIndexBufferFFI a b c) 738 | 739 | {-# INLINE bgfxSetIndexBuffer #-} 740 | 741 | bgfxSetDynamicIndexBuffer 742 | :: MonadIO m 743 | => BgfxIndexBufferHandle -> Word32 -> Word32 -> m () 744 | bgfxSetDynamicIndexBuffer a b c = liftIO (bgfxSetDynamicIndexBufferFFI a b c) 745 | 746 | {-# INLINE bgfxSetDynamicIndexBuffer #-} 747 | 748 | bgfxSetTransientIndexBuffer 749 | :: MonadIO m 750 | => Ptr BgfxIndexBuffer -> Word32 -> Word32 -> m () 751 | bgfxSetTransientIndexBuffer a b c = 752 | liftIO (bgfxSetTransientIndexBufferFFI a b c) 753 | 754 | {-# INLINE bgfxSetTransientIndexBuffer #-} 755 | 756 | bgfxSetVertexBuffer 757 | :: MonadIO m 758 | => BgfxVertexBufferHandle -> Word32 -> Word32 -> m () 759 | bgfxSetVertexBuffer a b c = liftIO (bgfxSetVertexBufferFFI a b c) 760 | 761 | {-# INLINE bgfxSetVertexBuffer #-} 762 | 763 | bgfxSetDynamicVertexBuffer 764 | :: MonadIO m 765 | => BgfxVertexBufferHandle -> Word32 -> m () 766 | bgfxSetDynamicVertexBuffer a b = liftIO (bgfxSetDynamicVertexBufferFFI a b) 767 | 768 | {-# INLINE bgfxSetDynamicVertexBuffer #-} 769 | 770 | bgfxSetTransientVertexBuffer :: MonadIO m 771 | => Ptr BgfxVertexBuffer 772 | -> Word32 773 | -> Word32 774 | -> m () 775 | bgfxSetTransientVertexBuffer a b c = 776 | liftIO (bgfxSetTransientVertexBufferFFI a b c) 777 | 778 | {-# INLINE bgfxSetTransientVertexBuffer #-} 779 | 780 | bgfxSetInstanceDataBuffer 781 | :: MonadIO m 782 | => Ptr BgfxInstanceDataBuffer -> Word32 -> m () 783 | bgfxSetInstanceDataBuffer a b = liftIO (bgfxSetInstanceDataBufferFFI a b) 784 | 785 | {-# INLINE bgfxSetInstanceDataBuffer #-} 786 | 787 | bgfxSetInstanceDataBufferFromVertexBuffer :: MonadIO m 788 | => BgfxVertexBufferHandle 789 | -> Word32 790 | -> Word32 791 | -> m () 792 | bgfxSetInstanceDataBufferFromVertexBuffer a b c = 793 | liftIO (bgfxSetInstanceDataBufferFromVertexBufferFFI a b c) 794 | 795 | {-# INLINE bgfxSetInstanceDataBufferFromVertexBuffer #-} 796 | 797 | bgfxSetInstanceDataBufferFromDynamicVertexBuffer 798 | :: MonadIO m 799 | => BgfxDynamicVertexBufferHandle -> Word32 -> Word32 -> m () 800 | bgfxSetInstanceDataBufferFromDynamicVertexBuffer a b c = 801 | liftIO (bgfxSetInstanceDataBufferFromDynamicVertexBufferFFI a b c) 802 | 803 | {-# INLINE bgfxSetInstanceDataBufferFromDynamicVertexBuffer #-} 804 | 805 | bgfxSetTexture :: MonadIO m 806 | => Word8 807 | -> BgfxUniformHandle 808 | -> BgfxTextureHandle 809 | -> Word32 810 | -> m () 811 | bgfxSetTexture a b c d = liftIO (bgfxSetTextureFFI a b c d) 812 | 813 | {-# INLINE bgfxSetTexture #-} 814 | 815 | bgfxSetTextureFromFrameBuffer :: MonadIO m 816 | => Word8 817 | -> BgfxUniformHandle 818 | -> BgfxFrameBufferHandle 819 | -> Word8 820 | -> Word32 821 | -> m () 822 | bgfxSetTextureFromFrameBuffer a b c d e = 823 | liftIO (bgfxSetTextureFromFrameBufferFFI a b c d e) 824 | 825 | {-# INLINE bgfxSetTextureFromFrameBuffer #-} 826 | 827 | bgfxSubmit 828 | :: MonadIO m 829 | => Word8 -> BgfxProgramHandle -> Int32 -> m Word32 830 | bgfxSubmit a b c = liftIO (bgfxSubmitFFI a b c) 831 | 832 | {-# INLINE bgfxSubmit #-} 833 | 834 | bgfxSubmitOcclusionQuery :: MonadIO m 835 | => Word8 836 | -> BgfxProgramHandle 837 | -> BgfxOcclusionQueryHandle 838 | -> Int32 839 | -> m Word32 840 | bgfxSubmitOcclusionQuery a b c d = liftIO (bgfxSubmitOcclusionQueryFFI a b c d) 841 | 842 | {-# INLINE bgfxSubmitOcclusionQuery #-} 843 | 844 | bgfxSubmitIndirect :: MonadIO m 845 | => Word8 846 | -> BgfxProgramHandle 847 | -> BgfxIndirectBufferHandle 848 | -> Word16 849 | -> Word16 850 | -> Int32 851 | -> m Word32 852 | bgfxSubmitIndirect a b c d e f = liftIO (bgfxSubmitIndirectFFI a b c d e f) 853 | 854 | {-# INLINE bgfxSubmitIndirect #-} 855 | 856 | bgfxSetComputeIndexBuffer :: MonadIO m 857 | => Word8 858 | -> BgfxIndexBufferHandle 859 | -> BgfxAccess 860 | -> m () 861 | bgfxSetComputeIndexBuffer a b c = liftIO (bgfxSetComputeIndexBufferFFI a b c) 862 | 863 | {-# INLINE bgfxSetComputeIndexBuffer #-} 864 | 865 | bgfxSetComputeVertexBuffer :: MonadIO m 866 | => Word8 867 | -> BgfxVertexBufferHandle 868 | -> BgfxAccess 869 | -> m () 870 | bgfxSetComputeVertexBuffer a b c = liftIO (bgfxSetComputeVertexBufferFFI a b c) 871 | 872 | {-# INLINE bgfxSetComputeVertexBuffer #-} 873 | 874 | bgxSetComputeDynamicIndexBuffer :: MonadIO m 875 | => Word8 876 | -> BgfxDynamicIndexBufferHandle 877 | -> BgfxAccess 878 | -> m () 879 | bgxSetComputeDynamicIndexBuffer a b c = 880 | liftIO (bgxSetComputeDynamicIndexBufferFFI a b c) 881 | 882 | {-# INLINE bgxSetComputeDynamicIndexBuffer #-} 883 | 884 | bgfxSetComputeDynamicVertexBuffer :: MonadIO m 885 | => Word8 886 | -> BgfxDynamicVertexBufferHandle 887 | -> BgfxAccess 888 | -> m () 889 | bgfxSetComputeDynamicVertexBuffer a b c = 890 | liftIO (bgfxSetComputeDynamicVertexBufferFFI a b c) 891 | 892 | {-# INLINE bgfxSetComputeDynamicVertexBuffer #-} 893 | 894 | bgfxSetComputeIndirectBuffer :: MonadIO m 895 | => Word8 896 | -> BgfxIndirectBufferHandle 897 | -> BgfxAccess 898 | -> m () 899 | bgfxSetComputeIndirectBuffer a b c = 900 | liftIO (bgfxSetComputeIndirectBufferFFI a b c) 901 | 902 | {-# INLINE bgfxSetComputeIndirectBuffer #-} 903 | 904 | bgfxSetImage :: MonadIO m 905 | => Word8 906 | -> BgfxUniformHandle 907 | -> BgfxTextureHandle 908 | -> Word8 909 | -> BgfxAccess 910 | -> BgfxTextureFormat 911 | -> m () 912 | bgfxSetImage a b c d e f = liftIO (bgfxSetImageFFI a b c d e f) 913 | 914 | {-# INLINE bgfxSetImage #-} 915 | 916 | bgfxSetImageFromFrameBuffer :: MonadIO m 917 | => Word8 918 | -> BgfxUniformHandle 919 | -> BgfxFrameBufferHandle 920 | -> Word8 921 | -> BgfxAccess 922 | -> BgfxTextureFormat 923 | -> m () 924 | bgfxSetImageFromFrameBuffer a b c d e f = 925 | liftIO (bgfxSetImageFromFrameBufferFFI a b c d e f) 926 | 927 | {-# INLINE bgfxSetImageFromFrameBuffer #-} 928 | 929 | bgfxDispatch :: MonadIO m 930 | => Word8 931 | -> BgfxProgramHandle 932 | -> Word16 933 | -> Word16 934 | -> Word16 935 | -> Word8 936 | -> m Word32 937 | bgfxDispatch a b c d e f = liftIO (bgfxDispatchFFI a b c d e f) 938 | 939 | {-# INLINE bgfxDispatch #-} 940 | 941 | bgfxDispatchIndirect :: MonadIO m 942 | => Word8 943 | -> BgfxProgramHandle 944 | -> BgfxIndirectBufferHandle 945 | -> Word16 946 | -> Word16 947 | -> Word16 948 | -> Word8 949 | -> m Word32 950 | bgfxDispatchIndirect a b c d e f g = 951 | liftIO (bgfxDispatchIndirectFFI a b c d e f g) 952 | 953 | {-# INLINE bgfxDispatchIndirect #-} 954 | 955 | bgfxBlit :: MonadIO m 956 | => Word8 957 | -> BgfxTextureHandle 958 | -> Word8 959 | -> Word16 960 | -> Word16 961 | -> Word16 962 | -> BgfxTextureHandle 963 | -> Word8 964 | -> Word16 965 | -> Word16 966 | -> Word16 967 | -> Word16 968 | -> Word16 969 | -> Word16 970 | -> m () 971 | bgfxBlit a b c d e f g h i j k l m n = 972 | liftIO (bgfxBlitFFI a b c d e f g h i j k l m n) 973 | 974 | {-# INLINE bgfxBlit #-} 975 | 976 | bgfxBlitFrameBuffer :: MonadIO m 977 | => Word8 978 | -> BgfxTextureHandle 979 | -> Word8 980 | -> Word16 981 | -> Word16 982 | -> Word16 983 | -> BgfxFrameBufferHandle 984 | -> Word8 985 | -> Word8 986 | -> Word16 987 | -> Word16 988 | -> Word16 989 | -> Word16 990 | -> Word16 991 | -> Word16 992 | -> m () 993 | bgfxBlitFrameBuffer a b c d e f g h i j k l m n o = 994 | liftIO (bgfxBlitFrameBufferFFI a b c d e f g h i j k l m n o) 995 | 996 | {-# INLINE bgfxBlitFrameBuffer #-} 997 | 998 | bgfxAlloc :: MonadIO m 999 | => Word32 -> m (Ptr BgfxMemory) 1000 | bgfxAlloc a = liftIO (bgfxAllocFFI a) 1001 | 1002 | {-# INLINE bgfxAlloc #-} 1003 | 1004 | bgfxCopy :: MonadIO m 1005 | => Ptr a -> Word32 -> m (Ptr BgfxMemory) 1006 | bgfxCopy a b = liftIO (bgfxCopyFFI a b) 1007 | 1008 | {-# INLINE bgfxCopy #-} 1009 | 1010 | bgfxMakeRef 1011 | :: MonadIO m 1012 | => Ptr a -> Word32 -> m (Ptr BgfxMemory) 1013 | bgfxMakeRef a b = liftIO (bgfxMakeRefFFI a b) 1014 | 1015 | {-# INLINE bgfxMakeRef #-} 1016 | 1017 | bgfxCreateVertexBuffer 1018 | :: MonadIO m 1019 | => Ptr BgfxMemory -> Ptr BgfxVertexDecl -> Word16 -> m BgfxVertexBufferHandle 1020 | bgfxCreateVertexBuffer a b c = liftIO (bgfxCreateVertexBufferFFI a b c) 1021 | 1022 | {-# INLINE bgfxCreateVertexBuffer #-} 1023 | 1024 | bgfxVertexDeclBegin 1025 | :: MonadIO m 1026 | => Ptr BgfxVertexDecl -> BgfxRendererType -> m () 1027 | bgfxVertexDeclBegin a b = liftIO (bgfxVertexDeclBeginFFI a b) 1028 | 1029 | {-# INLINE bgfxVertexDeclBegin #-} 1030 | 1031 | bgfxVertexDeclAdd :: MonadIO m 1032 | => Ptr BgfxVertexDecl 1033 | -> BgfxAttrib 1034 | -> Word8 1035 | -> BgfxAttribType 1036 | -> Bool 1037 | -> Bool 1038 | -> m () 1039 | bgfxVertexDeclAdd a b c d e f = liftIO (bgfxVertexDeclAddFFI a b c d e f) 1040 | 1041 | {-# INLINE bgfxVertexDeclAdd #-} 1042 | 1043 | bgfxVertexDeclEnd :: MonadIO m 1044 | => Ptr BgfxVertexDecl -> m () 1045 | bgfxVertexDeclEnd a = liftIO (bgfxVertexDeclEndFFI a) 1046 | 1047 | {-# INLINE bgfxVertexDeclEnd #-} 1048 | 1049 | bgfxCreateIndexBuffer 1050 | :: MonadIO m 1051 | => Ptr BgfxMemory -> Word16 -> m BgfxIndexBufferHandle 1052 | bgfxCreateIndexBuffer a b = liftIO (bgfxCreateIndexBufferFFI a b) 1053 | 1054 | {-# INLINE bgfxCreateIndexBuffer #-} 1055 | 1056 | bgfxCreateShader 1057 | :: MonadIO m 1058 | => Ptr BgfxMemory -> m BgfxShaderHandle 1059 | bgfxCreateShader a = liftIO (bgfxCreateShaderFFI a) 1060 | 1061 | {-# INLINE bgfxCreateShader #-} 1062 | 1063 | bgfxGetShaderUniforms :: MonadIO m 1064 | => BgfxShaderHandle 1065 | -> Ptr BgfxUniformHandle 1066 | -> Word16 1067 | -> m Word16 1068 | bgfxGetShaderUniforms a b c = liftIO (bgfxGetShaderUniformsFFI a b c) 1069 | 1070 | {-# INLINE bgfxGetShaderUniforms #-} 1071 | 1072 | bgfxDestroyShader :: MonadIO m 1073 | => BgfxShaderHandle -> m () 1074 | bgfxDestroyShader a = liftIO (bgfxDestroyShaderFFI a) 1075 | 1076 | {-# INLINE bgfxDestroyShader #-} 1077 | 1078 | bgfxCreateProgram :: MonadIO m 1079 | => BgfxShaderHandle 1080 | -> BgfxShaderHandle 1081 | -> Bool 1082 | -> m BgfxProgramHandle 1083 | bgfxCreateProgram a b c = liftIO (bgfxCreateProgramFFI a b c) 1084 | 1085 | {-# INLINE bgfxCreateProgram #-} 1086 | 1087 | bgfxCreateComputeProgram 1088 | :: MonadIO m 1089 | => BgfxShaderHandle -> Bool -> m BgfxProgramHandle 1090 | bgfxCreateComputeProgram a b = liftIO (bgfxCreateComputeProgramFFI a b) 1091 | 1092 | {-# INLINE bgfxCreateComputeProgram #-} 1093 | 1094 | bgfxDestroyProgram :: MonadIO m 1095 | => BgfxProgramHandle -> m () 1096 | bgfxDestroyProgram a = liftIO (bgfxDestroyProgramFFI a) 1097 | 1098 | {-# INLINE bgfxDestroyProgram #-} 1099 | 1100 | bgfxCreateUniform :: MonadIO m 1101 | => CString 1102 | -> BgfxUniformType 1103 | -> Word16 1104 | -> m BgfxUniformHandle 1105 | bgfxCreateUniform a b c = liftIO (bgfxCreateUniformFFI a b c) 1106 | 1107 | {-# INLINE bgfxCreateUniform #-} 1108 | 1109 | bgfxDestroyUniform :: MonadIO m 1110 | => BgfxUniformHandle -> m () 1111 | bgfxDestroyUniform a = liftIO (bgfxDestroyUniformFFI a) 1112 | 1113 | {-# INLINE bgfxDestroyUniform #-} 1114 | 1115 | bgfxCalcTextureSize :: MonadIO m 1116 | => Ptr BgfxTextureInfo 1117 | -> Word16 1118 | -> Word16 1119 | -> Word16 1120 | -> Bool 1121 | -> Word8 1122 | -> BgfxTextureFormat 1123 | -> m () 1124 | bgfxCalcTextureSize a b c d e f g = 1125 | liftIO (bgfxCalcTextureSizeFFI a b c d e f g) 1126 | 1127 | {-# INLINE bgfxCalcTextureSize #-} 1128 | 1129 | bgfxCreateTexture :: MonadIO m 1130 | => Ptr BgfxMemory 1131 | -> Word32 1132 | -> Word8 1133 | -> Ptr BgfxTextureInfo 1134 | -> m BgfxTextureHandle 1135 | bgfxCreateTexture a b c d = liftIO (bgfxCreateTextureFFI a b c d) 1136 | 1137 | {-# INLINE bgfxCreateTexture #-} 1138 | 1139 | bgfxCreateTexture2D :: MonadIO m 1140 | => Word16 1141 | -> Word16 1142 | -> Word8 1143 | -> BgfxTextureFormat 1144 | -> Word32 1145 | -> Ptr BgfxMemory 1146 | -> m BgfxTextureHandle 1147 | bgfxCreateTexture2D a b c d e f = liftIO (bgfxCreateTexture2DFFI a b c d e f) 1148 | 1149 | {-# INLINE bgfxCreateTexture2D #-} 1150 | 1151 | bgfxCreateTexture2DScaled :: MonadIO m 1152 | => BgfxBackbufferRatio 1153 | -> Word8 1154 | -> BgfxTextureFormat 1155 | -> Word32 1156 | -> m BgfxTextureHandle 1157 | bgfxCreateTexture2DScaled a b c d = 1158 | liftIO (bgfxCreateTexture2DScaledFFI a b c d) 1159 | 1160 | {-# INLINE bgfxCreateTexture2DScaled #-} 1161 | 1162 | bgfxCreateTexture3D :: MonadIO m 1163 | => Word16 1164 | -> Word16 1165 | -> Word16 1166 | -> Word8 1167 | -> BgfxTextureFormat 1168 | -> Word32 1169 | -> Ptr BgfxMemory 1170 | -> m BgfxTextureHandle 1171 | bgfxCreateTexture3D a b c d e f g = 1172 | liftIO (bgfxCreateTexture3DFFI a b c d e f g) 1173 | 1174 | {-# INLINE bgfxCreateTexture3D #-} 1175 | 1176 | bgfxCreateTextureCube :: MonadIO m 1177 | => Word16 1178 | -> Word8 1179 | -> BgfxTextureFormat 1180 | -> Word32 1181 | -> Ptr BgfxMemory 1182 | -> m BgfxTextureHandle 1183 | bgfxCreateTextureCube a b c d e = liftIO (bgfxCreateTextureCubeFFI a b c d e) 1184 | 1185 | {-# INLINE bgfxCreateTextureCube #-} 1186 | 1187 | bgfxUpdateTexture2D :: MonadIO m 1188 | => BgfxTextureHandle 1189 | -> Word8 1190 | -> Word16 1191 | -> Word16 1192 | -> Word16 1193 | -> Word16 1194 | -> Ptr BgfxMemory 1195 | -> Word16 1196 | -> m () 1197 | bgfxUpdateTexture2D a b c d e f g h = 1198 | liftIO (bgfxUpdateTexture2DFFI a b c d e f g h) 1199 | 1200 | {-# INLINE bgfxUpdateTexture2D #-} 1201 | 1202 | bgfxUpdateTexture3D :: MonadIO m 1203 | => BgfxTextureHandle 1204 | -> Word8 1205 | -> Word16 1206 | -> Word16 1207 | -> Word16 1208 | -> Word16 1209 | -> Word16 1210 | -> Word16 1211 | -> Ptr BgfxMemory 1212 | -> m () 1213 | bgfxUpdateTexture3D a b c d e f g h i = 1214 | liftIO (bgfxUpdateTexture3DFFI a b c d e f g h i) 1215 | 1216 | {-# INLINE bgfxUpdateTexture3D #-} 1217 | 1218 | bgfxUpdateTextureCube :: MonadIO m 1219 | => BgfxTextureHandle 1220 | -> Word8 1221 | -> Word8 1222 | -> Word16 1223 | -> Word16 1224 | -> Word16 1225 | -> Word16 1226 | -> Ptr BgfxMemory 1227 | -> Word16 1228 | -> m () 1229 | bgfxUpdateTextureCube a b c d e f g h i = 1230 | liftIO (bgfxUpdateTextureCubeFFI a b c d e f g h i) 1231 | 1232 | {-# INLINE bgfxUpdateTextureCube #-} 1233 | 1234 | bgfxReadTexture 1235 | :: MonadIO m 1236 | => BgfxTextureHandle -> Ptr a -> m () 1237 | bgfxReadTexture a b = liftIO (bgfxReadTextureFFI a b) 1238 | 1239 | {-# INLINE bgfxReadTexture #-} 1240 | 1241 | bgfxReadFrameBuffer 1242 | :: MonadIO m 1243 | => BgfxFrameBufferHandle -> Word8 -> Ptr a -> m () 1244 | bgfxReadFrameBuffer a b c = liftIO (bgfxReadFrameBufferFFI a b c) 1245 | 1246 | {-# INLINE bgfxReadFrameBuffer #-} 1247 | 1248 | bgfxDestroyTexture :: MonadIO m 1249 | => BgfxTextureHandle -> m () 1250 | bgfxDestroyTexture a = liftIO (bgfxDestroyTextureFFI a) 1251 | 1252 | {-# INLINE bgfxDestroyTexture #-} 1253 | 1254 | bgfxCreateFrameBuffer :: MonadIO m 1255 | => Word16 1256 | -> Word16 1257 | -> BgfxTextureFormat 1258 | -> Word32 1259 | -> m BgfxFrameBufferHandle 1260 | bgfxCreateFrameBuffer a b c d = liftIO (bgfxCreateFrameBufferFFI a b c d) 1261 | 1262 | {-# INLINE bgfxCreateFrameBuffer #-} 1263 | 1264 | bgfxCreateFrameBufferScaled 1265 | :: MonadIO m 1266 | => BgfxBackbufferRatio 1267 | -> BgfxTextureFormat 1268 | -> Word32 1269 | -> m BgfxFrameBufferHandle 1270 | bgfxCreateFrameBufferScaled a b c = 1271 | liftIO (bgfxCreateFrameBufferScaledFFI a b c) 1272 | 1273 | {-# INLINE bgfxCreateFrameBufferScaled #-} 1274 | 1275 | bgfxCreateFrameBufferFromHandles 1276 | :: MonadIO m 1277 | => Word8 -> Ptr BgfxTextureHandle -> Bool -> m BgfxFrameBufferHandle 1278 | bgfxCreateFrameBufferFromHandles a b c = 1279 | liftIO (bgfxCreateFrameBufferFromHandlesFFI a b c) 1280 | 1281 | {-# INLINE bgfxCreateFrameBufferFromHandles #-} 1282 | 1283 | bgfxCreateFrameBufferFromNWH 1284 | :: MonadIO m 1285 | => Ptr a -> Word16 -> Word16 -> BgfxTextureFormat -> m BgfxFrameBufferHandle 1286 | bgfxCreateFrameBufferFromNWH a b c d = 1287 | liftIO (bgfxCreateFrameBufferFromNWHFFI a b c d) 1288 | 1289 | {-# INLINE bgfxCreateFrameBufferFromNWH #-} 1290 | 1291 | bgfxDestroyFrameBuffer 1292 | :: MonadIO m 1293 | => BgfxFrameBufferHandle -> m () 1294 | bgfxDestroyFrameBuffer a = liftIO (bgfxDestroyFrameBufferFFI a) 1295 | 1296 | {-# INLINE bgfxDestroyFrameBuffer #-} 1297 | 1298 | bgfxCheckAvailTransientIndexBuffer 1299 | :: MonadIO m 1300 | => Word32 -> m Bool 1301 | bgfxCheckAvailTransientIndexBuffer a = 1302 | liftIO (bgfxCheckAvailTransientIndexBufferFFI a) 1303 | 1304 | {-# INLINE bgfxCheckAvailTransientIndexBuffer #-} 1305 | 1306 | bgfxCheckAvailTransientVertexBuffer 1307 | :: MonadIO m 1308 | => Word32 -> Ptr BgfxVertexDecl -> m Bool 1309 | bgfxCheckAvailTransientVertexBuffer a b = 1310 | liftIO (bgfxCheckAvailTransientVertexBufferFFI a b) 1311 | 1312 | {-# INLINE bgfxCheckAvailTransientVertexBuffer #-} 1313 | 1314 | bgfxCheckAvailInstanceDataBuffer 1315 | :: MonadIO m 1316 | => Word32 -> Word16 -> m Bool 1317 | bgfxCheckAvailInstanceDataBuffer a b = 1318 | liftIO (bgfxCheckAvailInstanceDataBufferFFI a b) 1319 | 1320 | {-# INLINE bgfxCheckAvailInstanceDataBuffer #-} 1321 | 1322 | bgfxCheckAvailTransientBuffers :: MonadIO m 1323 | => Word32 1324 | -> Ptr BgfxVertexDecl 1325 | -> Word32 1326 | -> m Bool 1327 | bgfxCheckAvailTransientBuffers a b c = 1328 | liftIO (bgfxCheckAvailTransientBuffersFFI a b c) 1329 | 1330 | {-# INLINE bgfxCheckAvailTransientBuffers #-} 1331 | 1332 | bgfxAllocTransientIndexBuffer 1333 | :: MonadIO m 1334 | => Ptr BgfxTransientIndexBuffer -> Word32 -> m () 1335 | bgfxAllocTransientIndexBuffer a b = 1336 | liftIO (bgfxAllocTransientIndexBufferFFI a b) 1337 | 1338 | {-# INLINE bgfxAllocTransientIndexBuffer #-} 1339 | 1340 | bgfxAllocTransientVertexBuffer :: MonadIO m 1341 | => Ptr BgfxTransientVertexBuffer 1342 | -> Word32 1343 | -> Ptr BgfxVertexDecl 1344 | -> m () 1345 | bgfxAllocTransientVertexBuffer a b c = 1346 | liftIO (bgfxAllocTransientVertexBufferFFI a b c) 1347 | 1348 | {-# INLINE bgfxAllocTransientVertexBuffer #-} 1349 | 1350 | bgfxAllocTransientBuffers :: MonadIO m 1351 | => Ptr BgfxTransientVertexBuffer 1352 | -> Ptr BgfxVertexDecl 1353 | -> Word32 1354 | -> Ptr BgfxTransientIndexBuffer 1355 | -> Word32 1356 | -> m () 1357 | bgfxAllocTransientBuffers a b c d e = 1358 | liftIO (bgfxAllocTransientBuffersFFI a b c d e) 1359 | 1360 | {-# INLINE bgfxAllocTransientBuffers #-} 1361 | 1362 | bgfxAllocInstanceDataBuffer 1363 | :: MonadIO m 1364 | => Word32 -> Word16 -> m (Ptr BgfxInstanceDataBuffer) 1365 | bgfxAllocInstanceDataBuffer a b = liftIO (bgfxAllocInstanceDataBufferFFI a b) 1366 | 1367 | {-# INLINE bgfxAllocInstanceDataBuffer #-} 1368 | 1369 | bgfxCreateIndirectBuffer 1370 | :: MonadIO m 1371 | => Word32 -> m BgfxIndirectBufferHandle 1372 | bgfxCreateIndirectBuffer a = liftIO (bgfxCreateIndirectBufferFFI a) 1373 | 1374 | {-# INLINE bgfxCreateIndirectBuffer #-} 1375 | 1376 | bgfxDestroyIndirectBuffer 1377 | :: MonadIO m 1378 | => BgfxIndirectBufferHandle -> m () 1379 | bgfxDestroyIndirectBuffer a = liftIO (bgfxDestroyIndirectBufferFFI a) 1380 | 1381 | {-# INLINE bgfxDestroyIndirectBuffer #-} 1382 | 1383 | bgfxCreateOcclusionQuery 1384 | :: MonadIO m 1385 | => m BgfxOcclusionQueryHandle 1386 | bgfxCreateOcclusionQuery = liftIO (bgfxCreateOcclusionQueryFFI) 1387 | 1388 | {-# INLINE bgfxCreateOcclusionQuery #-} 1389 | 1390 | bgfxGetResult 1391 | :: MonadIO m 1392 | => BgfxOcclusionQueryHandle -> m BgfxOcclusionQueryResult 1393 | bgfxGetResult a = liftIO (bgfxGetResultFFI a) 1394 | 1395 | {-# INLINE bgfxGetResult #-} 1396 | 1397 | bgfxDestroyOcclusionQuery 1398 | :: MonadIO m 1399 | => BgfxOcclusionQueryHandle -> m () 1400 | bgfxDestroyOcclusionQuery a = liftIO (bgfxDestroyOcclusionQueryFFI a) 1401 | 1402 | {-# INLINE bgfxDestroyOcclusionQuery #-} 1403 | -------------------------------------------------------------------------------- /vs_cubes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haskell-game/bgfx/e54dfbbb1eedda0aa6b23583cc8f105422ce5d84/vs_cubes.bin --------------------------------------------------------------------------------