    {-# OPTIONS_HADDOCK hide #-}
    --------------------------------------------------------------------------------
    -- |
    -- Module      :  Graphics.Rendering.OpenGL.GL.Shaders.Shader
    -- Copyright   :  (c) Sven Panne 2019
    -- License     :  BSD3
    --
    -- Maintainer  :  Sven Panne <svenpanne@gmail.com>
    -- Stability   :  stable
    -- Portability :  portable
    --
    -- This is a purely internal module for handling shader objects.
    --
    --------------------------------------------------------------------------------

    module Graphics.Rendering.OpenGL.GL.Shaders.Shader (
       Shader(..)
    ) where

    import Control.Monad.IO.Class
    import Data.ObjectName
    import Graphics.Rendering.OpenGL.GL.DebugOutput
    import Graphics.Rendering.OpenGL.GL.GLboolean
    import Graphics.Rendering.OpenGL.GL.QueryUtils
    import Graphics.GL

    --------------------------------------------------------------------------------

    newtype Shader = Shader { Shader -> GLuint
    shaderID :: GLuint }
       deriving ( Shader -> Shader -> Bool
    (Shader -> Shader -> Bool)
    -> (Shader -> Shader -> Bool) -> Eq Shader
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Shader -> Shader -> Bool
    == :: Shader -> Shader -> Bool
    $c/= :: Shader -> Shader -> Bool
    /= :: Shader -> Shader -> Bool
    Eq, Eq Shader
    Eq Shader =>
    (Shader -> Shader -> Ordering)
    -> (Shader -> Shader -> Bool)
    -> (Shader -> Shader -> Bool)
    -> (Shader -> Shader -> Bool)
    -> (Shader -> Shader -> Bool)
    -> (Shader -> Shader -> Shader)
    -> (Shader -> Shader -> Shader)
    -> Ord Shader
    Shader -> Shader -> Bool
    Shader -> Shader -> Ordering
    Shader -> Shader -> Shader
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Shader -> Shader -> Ordering
    compare :: Shader -> Shader -> Ordering
    $c< :: Shader -> Shader -> Bool
    < :: Shader -> Shader -> Bool
    $c<= :: Shader -> Shader -> Bool
    <= :: Shader -> Shader -> Bool
    $c> :: Shader -> Shader -> Bool
    > :: Shader -> Shader -> Bool
    $c>= :: Shader -> Shader -> Bool
    >= :: Shader -> Shader -> Bool
    $cmax :: Shader -> Shader -> Shader
    max :: Shader -> Shader -> Shader
    $cmin :: Shader -> Shader -> Shader
    min :: Shader -> Shader -> Shader
    Ord, Int -> Shader -> ShowS
    [Shader] -> ShowS
    Shader -> String
    (Int -> Shader -> ShowS)
    -> (Shader -> String) -> ([Shader] -> ShowS) -> Show Shader
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Shader -> ShowS
    showsPrec :: Int -> Shader -> ShowS
    $cshow :: Shader -> String
    show :: Shader -> String
    $cshowList :: [Shader] -> ShowS
    showList :: [Shader] -> ShowS
    Show )

    instance ObjectName Shader where
       isObjectName :: forall (m :: * -> *). MonadIO m => Shader -> m Bool
    isObjectName = IO Bool -> m Bool
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Bool -> m Bool) -> (Shader -> IO Bool) -> Shader -> m Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (GLboolean -> Bool) -> IO GLboolean -> IO Bool
    forall a b. (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap GLboolean -> Bool
    forall a. (Eq a, Num a) => a -> Bool
    unmarshalGLboolean (IO GLboolean -> IO Bool)
    -> (Shader -> IO GLboolean) -> Shader -> IO Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . GLuint -> IO GLboolean
    forall (m :: * -> *). MonadIO m => GLuint -> m GLboolean
    glIsShader (GLuint -> IO GLboolean)
    -> (Shader -> GLuint) -> Shader -> IO GLboolean
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Shader -> GLuint
    shaderID
       deleteObjectName :: forall (m :: * -> *). MonadIO m => Shader -> m ()
    deleteObjectName = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> (Shader -> IO ()) -> Shader -> m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . GLuint -> IO ()
    forall (m :: * -> *). MonadIO m => GLuint -> m ()
    glDeleteShader (GLuint -> IO ()) -> (Shader -> GLuint) -> Shader -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Shader -> GLuint
    shaderID

    instance CanBeLabeled Shader where
       objectLabel :: Shader -> StateVar (Maybe String)
    objectLabel = GLuint -> GLuint -> StateVar (Maybe String)
    objectNameLabel GLuint
    GL_SHADER (GLuint -> StateVar (Maybe String))
    -> (Shader -> GLuint) -> Shader -> StateVar (Maybe String)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Shader -> GLuint
    shaderID