-----------------------------------------------------------------------------
-- |
-- Module      :  Graphics.Rendering.OpenGL.GL.Shaders.Limits
-- Copyright   :  (c) Sven Panne 2006-2019
-- License     :  BSD3
--
-- Maintainer  :  Sven Panne <svenpanne@gmail.com>
-- Stability   :  stable
-- Portability :  portable
--
-- This module contains functions related to shader limits.
--
-----------------------------------------------------------------------------

module Graphics.Rendering.OpenGL.GL.Shaders.Limits (
   maxVertexTextureImageUnits, maxTextureImageUnits,
   maxCombinedTextureImageUnits, maxTextureCoords, maxVertexUniformComponents,
   maxFragmentUniformComponents, maxVertexAttribs, maxVaryingFloats
) where

import Data.StateVar
import Graphics.Rendering.OpenGL.GL.QueryUtils
import Graphics.GL

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

-- | Contains the number of hardware units that can be used to access texture
-- maps from the vertex processor. The minimum legal value is 0.

maxVertexTextureImageUnits :: GettableStateVar GLsizei
maxVertexTextureImageUnits :: GettableStateVar GLsizei
maxVertexTextureImageUnits = PName1I -> GettableStateVar GLsizei
getLimit PName1I
GetMaxVertexTextureImageUnits

-- | Contains the total number of hardware units that can be used to access
-- texture maps from the fragment processor. The minimum legal value is 2.

maxTextureImageUnits :: GettableStateVar GLsizei
maxTextureImageUnits :: GettableStateVar GLsizei
maxTextureImageUnits = PName1I -> GettableStateVar GLsizei
getLimit PName1I
GetMaxTextureImageUnits

-- | Contains the total number of hardware units that can be used to access
-- texture maps from the vertex processor and the fragment processor combined.
-- Note: If the vertex shader and the fragment processing stage access the same
-- texture image unit, then that counts as using two texture image units. The
-- minimum legal value is 2.

maxCombinedTextureImageUnits :: GettableStateVar GLsizei
maxCombinedTextureImageUnits :: GettableStateVar GLsizei
maxCombinedTextureImageUnits = PName1I -> GettableStateVar GLsizei
getLimit PName1I
GetMaxCombinedTextureImageUnits

-- | Contains the number of texture coordinate sets that are available. The
-- minimum legal value is 2.

maxTextureCoords :: GettableStateVar GLsizei
maxTextureCoords :: GettableStateVar GLsizei
maxTextureCoords = PName1I -> GettableStateVar GLsizei
getLimit PName1I
GetMaxTextureCoords

-- | Contains the number of individual components (i.e., floating-point, integer
-- or boolean values) that are available for vertex shader uniform variables.
-- The minimum legal value is 512.
maxVertexUniformComponents :: GettableStateVar GLsizei
maxVertexUniformComponents :: GettableStateVar GLsizei
maxVertexUniformComponents = PName1I -> GettableStateVar GLsizei
getLimit PName1I
GetMaxVertexUniformComponents

-- | Contains the number of individual components (i.e., floating-point, integer
-- or boolean values) that are available for fragment shader uniform variables.
-- The minimum legal value is 64.

maxFragmentUniformComponents :: GettableStateVar GLsizei
maxFragmentUniformComponents :: GettableStateVar GLsizei
maxFragmentUniformComponents = PName1I -> GettableStateVar GLsizei
getLimit PName1I
GetMaxFragmentUniformComponents

-- | Contains the number of active vertex attributes that are available. The
-- minimum legal value is 16.

maxVertexAttribs :: GettableStateVar GLsizei
maxVertexAttribs :: GettableStateVar GLsizei
maxVertexAttribs = PName1I -> GettableStateVar GLsizei
getLimit PName1I
GetMaxVertexAttribs

-- | Contains the number of individual floating-point values available for
-- varying variables. The minimum legal value is 32.

maxVaryingFloats :: GettableStateVar GLsizei
maxVaryingFloats :: GettableStateVar GLsizei
maxVaryingFloats = PName1I -> GettableStateVar GLsizei
getLimit PName1I
GetMaxVaryingFloats

getLimit :: PName1I -> GettableStateVar GLsizei
getLimit :: PName1I -> GettableStateVar GLsizei
getLimit = forall a. IO a -> IO a
makeGettableStateVar forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall p a. GetPName1I p => (GLsizei -> a) -> p -> IO a
getSizei1 forall a. a -> a
id