{-# OPTIONS_HADDOCK hide #-}
module Graphics.Rendering.OpenGL.GL.Shaders.Program (
Program(..),
GetProgramPName(..), marshalGetProgramPName,
programVar1, programVar3
) where
import Control.Monad.IO.Class
import Data.ObjectName
import Data.StateVar
import Foreign.Marshal.Utils ( with )
import Foreign.Ptr ( Ptr )
import Graphics.Rendering.OpenGL.GL.DebugOutput
import Graphics.Rendering.OpenGL.GL.GLboolean
import Graphics.Rendering.OpenGL.GL.PeekPoke
import Graphics.Rendering.OpenGL.GL.QueryUtils
import Graphics.GL
newtype Program = Program { Program -> GLuint
programID :: GLuint }
deriving ( Program -> Program -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Program -> Program -> Bool
$c/= :: Program -> Program -> Bool
== :: Program -> Program -> Bool
$c== :: Program -> Program -> Bool
Eq, Eq Program
Program -> Program -> Bool
Program -> Program -> Ordering
Program -> Program -> Program
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
min :: Program -> Program -> Program
$cmin :: Program -> Program -> Program
max :: Program -> Program -> Program
$cmax :: Program -> Program -> Program
>= :: Program -> Program -> Bool
$c>= :: Program -> Program -> Bool
> :: Program -> Program -> Bool
$c> :: Program -> Program -> Bool
<= :: Program -> Program -> Bool
$c<= :: Program -> Program -> Bool
< :: Program -> Program -> Bool
$c< :: Program -> Program -> Bool
compare :: Program -> Program -> Ordering
$ccompare :: Program -> Program -> Ordering
Ord, Int -> Program -> ShowS
[Program] -> ShowS
Program -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Program] -> ShowS
$cshowList :: [Program] -> ShowS
show :: Program -> String
$cshow :: Program -> String
showsPrec :: Int -> Program -> ShowS
$cshowsPrec :: Int -> Program -> ShowS
Show )
instance ObjectName Program where
isObjectName :: forall (m :: * -> *). MonadIO m => Program -> m Bool
isObjectName = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. (Eq a, Num a) => a -> Bool
unmarshalGLboolean forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *). MonadIO m => GLuint -> m GLboolean
glIsProgram forall b c a. (b -> c) -> (a -> b) -> a -> c
. Program -> GLuint
programID
deleteObjectName :: forall (m :: * -> *). MonadIO m => Program -> m ()
deleteObjectName = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *). MonadIO m => GLuint -> m ()
glDeleteProgram forall b c a. (b -> c) -> (a -> b) -> a -> c
. Program -> GLuint
programID
instance CanBeLabeled Program where
objectLabel :: Program -> StateVar (Maybe String)
objectLabel = GLuint -> GLuint -> StateVar (Maybe String)
objectNameLabel GLuint
GL_PROGRAM forall b c a. (b -> c) -> (a -> b) -> a -> c
. Program -> GLuint
programID
data GetProgramPName =
ProgramDeleteStatus
| LinkStatus
| ValidateStatus
| ProgramInfoLogLength
| AttachedShaders
| ActiveAttributes
| ActiveAttributeMaxLength
| ActiveUniforms
| ActiveUniformMaxLength
| TransformFeedbackBufferMode
| TransformFeedbackVaryings
| TransformFeedbackVaryingMaxLength
| ActiveUniformBlocks
| ActiveUniformBlockMaxNameLength
| GeometryVerticesOut
| GeometryInputType
| GeometryOutputType
| GeometryShaderInvocations
| TessControlOutputVertices
| TessGenMode
| TessGenSpacing
| TessGenVertexOrder
| TessGenPointMode
| ComputeWorkGroupSize
| ProgramSeparable
| ProgramBinaryRetrievableHint
| ActiveAtomicCounterBuffers
| ProgramBinaryLength
marshalGetProgramPName :: GetProgramPName -> GLenum
marshalGetProgramPName :: GetProgramPName -> GLuint
marshalGetProgramPName GetProgramPName
x = case GetProgramPName
x of
GetProgramPName
ProgramDeleteStatus -> GLuint
GL_DELETE_STATUS
GetProgramPName
LinkStatus -> GLuint
GL_LINK_STATUS
GetProgramPName
ValidateStatus -> GLuint
GL_VALIDATE_STATUS
GetProgramPName
ProgramInfoLogLength -> GLuint
GL_INFO_LOG_LENGTH
GetProgramPName
AttachedShaders -> GLuint
GL_ATTACHED_SHADERS
GetProgramPName
ActiveAttributes -> GLuint
GL_ACTIVE_ATTRIBUTES
GetProgramPName
ActiveAttributeMaxLength -> GLuint
GL_ACTIVE_ATTRIBUTE_MAX_LENGTH
GetProgramPName
ActiveUniforms -> GLuint
GL_ACTIVE_UNIFORMS
GetProgramPName
ActiveUniformMaxLength -> GLuint
GL_ACTIVE_UNIFORM_MAX_LENGTH
GetProgramPName
TransformFeedbackBufferMode -> GLuint
GL_TRANSFORM_FEEDBACK_BUFFER_MODE
GetProgramPName
TransformFeedbackVaryings -> GLuint
GL_TRANSFORM_FEEDBACK_VARYINGS
GetProgramPName
TransformFeedbackVaryingMaxLength -> GLuint
GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH
GetProgramPName
ActiveUniformBlocks -> GLuint
GL_ACTIVE_UNIFORM_BLOCKS
GetProgramPName
ActiveUniformBlockMaxNameLength -> GLuint
GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH
GetProgramPName
GeometryVerticesOut -> GLuint
GL_GEOMETRY_VERTICES_OUT
GetProgramPName
GeometryInputType -> GLuint
GL_GEOMETRY_INPUT_TYPE
GetProgramPName
GeometryOutputType -> GLuint
GL_GEOMETRY_OUTPUT_TYPE
GetProgramPName
GeometryShaderInvocations -> GLuint
GL_GEOMETRY_SHADER_INVOCATIONS
GetProgramPName
TessControlOutputVertices -> GLuint
GL_TESS_CONTROL_OUTPUT_VERTICES
GetProgramPName
TessGenMode -> GLuint
GL_TESS_GEN_MODE
GetProgramPName
TessGenSpacing -> GLuint
GL_TESS_GEN_SPACING
GetProgramPName
TessGenVertexOrder -> GLuint
GL_TESS_GEN_VERTEX_ORDER
GetProgramPName
TessGenPointMode -> GLuint
GL_TESS_GEN_POINT_MODE
GetProgramPName
ComputeWorkGroupSize -> GLuint
GL_COMPUTE_WORK_GROUP_SIZE
GetProgramPName
ProgramSeparable -> GLuint
GL_PROGRAM_SEPARABLE
GetProgramPName
ProgramBinaryRetrievableHint -> GLuint
GL_PROGRAM_BINARY_RETRIEVABLE_HINT
GetProgramPName
ActiveAtomicCounterBuffers -> GLuint
GL_ACTIVE_ATOMIC_COUNTER_BUFFERS
GetProgramPName
ProgramBinaryLength -> GLuint
GL_PROGRAM_BINARY_LENGTH
programVar1 :: (GLint -> a) -> GetProgramPName -> Program -> GettableStateVar a
programVar1 :: forall a.
(GLint -> a) -> GetProgramPName -> Program -> GettableStateVar a
programVar1 = forall a. (Ptr GLint -> IO a) -> GetProgramPName -> Program -> IO a
programVarN forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. Storable a => (a -> b) -> Ptr a -> IO b
peek1
programVar3 :: (GLint -> GLint -> GLint -> a) -> GetProgramPName -> Program -> GettableStateVar a
programVar3 :: forall a.
(GLint -> GLint -> GLint -> a)
-> GetProgramPName -> Program -> GettableStateVar a
programVar3 = forall a. (Ptr GLint -> IO a) -> GetProgramPName -> Program -> IO a
programVarN forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. Storable a => (a -> a -> a -> b) -> Ptr a -> IO b
peek3
programVarN :: (Ptr GLint -> IO a) -> GetProgramPName -> Program -> GettableStateVar a
programVarN :: forall a. (Ptr GLint -> IO a) -> GetProgramPName -> Program -> IO a
programVarN Ptr GLint -> IO a
f GetProgramPName
p Program
program =
forall a. IO a -> IO a
makeGettableStateVar forall a b. (a -> b) -> a -> b
$
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with GLint
0 forall a b. (a -> b) -> a -> b
$ \Ptr GLint
buf -> do
forall (m :: * -> *).
MonadIO m =>
GLuint -> GLuint -> Ptr GLint -> m ()
glGetProgramiv (Program -> GLuint
programID Program
program) (GetProgramPName -> GLuint
marshalGetProgramPName GetProgramPName
p) Ptr GLint
buf
Ptr GLint -> IO a
f Ptr GLint
buf