Skip to content
Snippets Groups Projects
Commit a8752273 authored by Jens Nolte's avatar Jens Nolte
Browse files

Move EglException code to debug module

parent 4a8cba58
No related branches found
No related tags found
No related merge requests found
......@@ -49,15 +49,6 @@ data Egl = Egl {
context :: EGLContext
}
data EglException = EglException EGLint
deriving (Eq, Exception)
instance Show EglException where
show (EglException value) = toErrorMessage value
eglGetError :: IO EglException
eglGetError = EglException <$> [CU.exp| EGLint { eglGetError() } |]
initializeEgl :: IO Egl
initializeEgl = do
clientExtensionsString <-
......
......@@ -3,7 +3,10 @@
module Glest.Egl.Debug (
initializeEglDebugHandler,
toErrorMessage
toErrorMessage,
EglException,
eglGetError,
) where
import Data.List (intersperse, singleton)
......@@ -32,6 +35,16 @@ data EglDebugMsgType
| EglDebugMsgInfo -- ^ EGL_DEBUG_MSG_INFO_KHR
deriving stock Show
data EglException = EglException EGLint
deriving (Eq, Exception)
instance Show EglException where
show (EglException value) = toErrorMessage value
eglGetError :: IO EglException
eglGetError = EglException <$> [CU.exp| EGLint { eglGetError() } |]
toDebugMessageType :: EGLint -> IO EglDebugMsgType
toDebugMessageType 0x33B9 = pure EglDebugMsgCritical
toDebugMessageType 0x33BA = pure EglDebugMsgError
......@@ -58,6 +71,7 @@ toErrorMessage 0x300d = "EGL_BAD_SURFACE"
toErrorMessage 0x300e = "EGL_CONTEXT_LOST"
toErrorMessage value = mconcat ["Invalid EGL error enum value (", show value, ")"]
initializeEglDebugHandler :: IO ()
initializeEglDebugHandler = do
-- Requires EGL_KHR_debug
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment