Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
An object representing a GL shader program.
Synopsis
- newtype GLShader = GLShader (ManagedPtr GLShader)
- class (GObject o, IsDescendantOf GLShader o) => IsGLShader o
- toGLShader :: (MonadIO m, IsGLShader o) => o -> m GLShader
- gLShaderCompile :: (HasCallStack, MonadIO m, IsGLShader a, IsRenderer b) => a -> b -> m ()
- gLShaderFindUniformByName :: (HasCallStack, MonadIO m, IsGLShader a) => a -> Text -> m Int32
- gLShaderGetArgBool :: (HasCallStack, MonadIO m, IsGLShader a) => a -> Bytes -> Int32 -> m Bool
- gLShaderGetArgFloat :: (HasCallStack, MonadIO m, IsGLShader a) => a -> Bytes -> Int32 -> m Float
- gLShaderGetArgInt :: (HasCallStack, MonadIO m, IsGLShader a) => a -> Bytes -> Int32 -> m Int32
- gLShaderGetArgUint :: (HasCallStack, MonadIO m, IsGLShader a) => a -> Bytes -> Int32 -> m Word32
- gLShaderGetArgVec2 :: (HasCallStack, MonadIO m, IsGLShader a) => a -> Bytes -> Int32 -> Vec2 -> m ()
- gLShaderGetArgVec3 :: (HasCallStack, MonadIO m, IsGLShader a) => a -> Bytes -> Int32 -> Vec3 -> m ()
- gLShaderGetArgVec4 :: (HasCallStack, MonadIO m, IsGLShader a) => a -> Bytes -> Int32 -> Vec4 -> m ()
- gLShaderGetArgsSize :: (HasCallStack, MonadIO m, IsGLShader a) => a -> m Word64
- gLShaderGetNTextures :: (HasCallStack, MonadIO m, IsGLShader a) => a -> m Int32
- gLShaderGetNUniforms :: (HasCallStack, MonadIO m, IsGLShader a) => a -> m Int32
- gLShaderGetResource :: (HasCallStack, MonadIO m, IsGLShader a) => a -> m Text
- gLShaderGetSource :: (HasCallStack, MonadIO m, IsGLShader a) => a -> m Bytes
- gLShaderGetUniformName :: (HasCallStack, MonadIO m, IsGLShader a) => a -> Int32 -> m Text
- gLShaderGetUniformOffset :: (HasCallStack, MonadIO m, IsGLShader a) => a -> Int32 -> m Int32
- gLShaderGetUniformType :: (HasCallStack, MonadIO m, IsGLShader a) => a -> Int32 -> m GLUniformType
- gLShaderNewFromBytes :: (HasCallStack, MonadIO m) => Bytes -> m GLShader
- gLShaderNewFromResource :: (HasCallStack, MonadIO m) => Text -> m GLShader
- constructGLShaderResource :: (IsGLShader o, MonadIO m) => Text -> m (GValueConstruct o)
- getGLShaderResource :: (MonadIO m, IsGLShader o) => o -> m Text
- constructGLShaderSource :: (IsGLShader o, MonadIO m) => Bytes -> m (GValueConstruct o)
- getGLShaderSource :: (MonadIO m, IsGLShader o) => o -> m Bytes
Exported types
Memory-managed wrapper type.
Instances
Eq GLShader Source # | |
GObject GLShader Source # | |
Defined in GI.Gsk.Objects.GLShader | |
ManagedPtrNewtype GLShader Source # | |
Defined in GI.Gsk.Objects.GLShader toManagedPtr :: GLShader -> ManagedPtr GLShader | |
TypedObject GLShader Source # | |
Defined in GI.Gsk.Objects.GLShader | |
HasParentTypes GLShader Source # | |
Defined in GI.Gsk.Objects.GLShader | |
IsGValue (Maybe GLShader) Source # | Convert |
Defined in GI.Gsk.Objects.GLShader gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe GLShader -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe GLShader) | |
type ParentTypes GLShader Source # | |
Defined in GI.Gsk.Objects.GLShader |
class (GObject o, IsDescendantOf GLShader o) => IsGLShader o Source #
Type class for types which can be safely cast to GLShader
, for instance with toGLShader
.
Instances
(GObject o, IsDescendantOf GLShader o) => IsGLShader o Source # | |
Defined in GI.Gsk.Objects.GLShader |
toGLShader :: (MonadIO m, IsGLShader o) => o -> m GLShader Source #
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, compile, findUniformByName, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getArgBool, getArgFloat, getArgInt, getArgUint, getArgVec2, getArgVec3, getArgVec4, getArgsSize, getData, getNTextures, getNUniforms, getProperty, getQdata, getResource, getSource, getUniformName, getUniformOffset, getUniformType.
Setters
compile
:: (HasCallStack, MonadIO m, IsGLShader a, IsRenderer b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Tries to compile the shader
for the given renderer
, and reports
False
with an error if there is a problem. You should use this
function before relying on the shader for rendering and use a
fallback with a simpler shader or without shaders if it fails.
Note that this will modify the rendering state (for example change the current GL context) and requires the renderer to be set up. This means that the widget has to be realized. Commonly you want to call this from the realize signal of a widget, or during widget snapshot.
findUniformByName
gLShaderFindUniformByName Source #
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> Text |
|
-> m Int32 | Returns: The index of the uniform, or -1 |
Looks for a uniform by the name name
, and returns the index
of the uniform, or -1 if it was not found.
getArgBool
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> Bytes |
|
-> Int32 |
|
-> m Bool | Returns: The value |
Gets the value of the uniform idx
in the args
block.
The uniform must be of bool type.
getArgFloat
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> Bytes |
|
-> Int32 |
|
-> m Float | Returns: The value |
Gets the value of the uniform idx
in the args
block.
The uniform must be of float type.
getArgInt
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> Bytes |
|
-> Int32 |
|
-> m Int32 | Returns: The value |
Gets the value of the uniform idx
in the args
block.
The uniform must be of int type.
getArgUint
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> Bytes |
|
-> Int32 |
|
-> m Word32 | Returns: The value |
Gets the value of the uniform idx
in the args
block.
The uniform must be of uint type.
getArgVec2
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> Bytes |
|
-> Int32 |
|
-> Vec2 |
|
-> m () |
Gets the value of the uniform idx
in the args
block.
The uniform must be of vec2 type.
getArgVec3
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> Bytes |
|
-> Int32 |
|
-> Vec3 |
|
-> m () |
Gets the value of the uniform idx
in the args
block.
The uniform must be of vec3 type.
getArgVec4
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> Bytes |
|
-> Int32 |
|
-> Vec4 |
|
-> m () |
Gets the value of the uniform idx
in the args
block.
The uniform must be of vec4 type.
getArgsSize
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> m Word64 | Returns: The size of the data block |
Get the size of the data block used to specify arguments for this shader.
getNTextures
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> m Int32 | Returns: The number of texture inputs required by |
Returns the number of textures that the shader requires.
This can be used to check that the a passed shader works in your usecase. It is determined by looking at the highest u_textureN value that the shader defines.
getNUniforms
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> m Int32 | Returns: The number of declared uniforms |
Get the number of declared uniforms for this shader.
getResource
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> m Text | Returns: The resource path for the shader,
or |
Gets the resource path for the GLSL sourcecode being used to render this shader.
getSource
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> m Bytes | Returns: The source code for the shader |
Gets the GLSL sourcecode being used to render this shader.
getUniformName
gLShaderGetUniformName Source #
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> Int32 |
|
-> m Text | Returns: The name of the declared uniform |
Get the name of the declared uniform for this shader at index idx
.
getUniformOffset
gLShaderGetUniformOffset Source #
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> Int32 |
|
-> m Int32 | Returns: The data offset |
Get the offset into the data block where data for this uniforms is stored.
getUniformType
gLShaderGetUniformType Source #
:: (HasCallStack, MonadIO m, IsGLShader a) | |
=> a |
|
-> Int32 |
|
-> m GLUniformType | Returns: The type of the declared uniform |
Get the type of the declared uniform for this shader at index idx
.
newFromBytes
:: (HasCallStack, MonadIO m) | |
=> Bytes |
|
-> m GLShader | Returns: A new |
Creates a GLShader
that will render pixels using the specified code.
newFromResource
gLShaderNewFromResource Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m GLShader | Returns: A new |
Creates a GLShader
that will render pixels using the specified code.
Properties
resource
Resource containing the source code for the shader.
If the shader source is not coming from a resource, this
will be Nothing
.
constructGLShaderResource :: (IsGLShader o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “resource
” property. This is rarely needed directly, but it is used by new
.
getGLShaderResource :: (MonadIO m, IsGLShader o) => o -> m Text Source #
Get the value of the “resource
” property.
When overloading is enabled, this is equivalent to
get
gLShader #resource
source
No description available in the introspection data.
constructGLShaderSource :: (IsGLShader o, MonadIO m) => Bytes -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “source
” property. This is rarely needed directly, but it is used by new
.
getGLShaderSource :: (MonadIO m, IsGLShader o) => o -> m Bytes Source #
Get the value of the “source
” property.
When overloading is enabled, this is equivalent to
get
gLShader #source