glShaderBinary

来源:互联网 发布:java中int几个字节 编辑:程序博客网 时间:2024/05/22 00:34

Name

glShaderBinary — load a precompiled shader binary

C Specification

void glShaderBinary(GLsizei n,  const GLuint *shaders,  GLenum binaryformat,  const void *binary,  GLsizei length);

Parameters

n  Specifies the number of shader object handles present in shaders.

shaders  Specifies a pointer to an array of shader object handles into which the shader binary will be loaded.

binaryformat  Specifies the shader binary format.

binary  Specifies a pointer to the shader binary data in client memory.

length  Specifies the length of the shader binary data in bytes.DescriptionFor implementations that support them,

    glShaderBinary loads precompiled shader binaries.
    shaders contains a list of n
    shader object handles. Each handle refers to a unique shader type (vertex shader or
    fragment shader). binary points to precompiled binary
    shader code in client memory, and binaryformat denotes
    the format of the pre-compiled code.The binary image is decoded according to the extension
    specification defining the specified binaryformat.
    OpenGL ES defines no specific binary formats, but does provide a mechanism
    to obtain symbolic constants for such formats provided by extensions. The
    number of shader binary formats supported can be obtained by querying the
    value of GL_NUM_SHADER_BINARY_FORMATS. The list of
    specific binary formats supported can be obtained by querying the value of
    GL_SHADER_BINARY_FORMATS.Depending on the types of the shader objects in shaders,
    glShaderBinary will individually load binary vertex or
    fragment shaders, or load an executable binary that contains an optimized
    pair of vertex and fragment shaders stored in the same binary.If glShaderBinary fails, the old state of shader
    objects for which the binary was being loaded will not be restored.NotesShader binary support is optional and thus must be queried
    before use by calling glGet
    with arguments GL_NUM_SHADER_BINARY_FORMATS and
    GL_SHADER_BINARY_FORMATS. glShaderBinary
    generates GL_INVALID_OPERATION on implementations
    that do not support any shader binary formats. Such implementations instead
        offer the glShaderSource
    alternative for supplying OpenGL ES Shading Language shader source for compilation.If shader binary formats are supported, then an implementation may
    require that an optimized pair of vertex and fragment shader
    binaries that were compiled together to be specified to
    glLinkProgram.
    Not specifying an optimized pair my cause
    glLinkProgram
    to fail. Such a restriction, if it exists, will be documented in
    the extension specification defining binaryformat.OpenGL copies the shader binary data when
    glShaderBinary is called, so an application
    may free its copy of the data immediately after
    the function returns.ErrorsGL_INVALID_ENUM is generated if
    binaryformat is not a supported format returned in
    GL_SHADER_BINARY_FORMATS.GL_INVALID_VALUE is generated if any value in
    shaders is not a vlue generated by OpenGL.GL_INVALID_VALUE is generated if the format of the
        data pointed to by binary does not match
        binaryformat.GL_INVALID_VALUE is generated if n
        or length is negative.GL_INVALID_OPERATION is generated if any value in
    shaders is not a shader object, or if there
    is more than one vertex shader object handle or more than one fragment shader

    object handle in shaders.



NAME

       glShaderBinary - load pre-compiled shader binaries

C SPECIFICATION

       void glShaderBinary(GLsizei count, const GLuint *shaders,                           GLenum binaryFormat, const void *binary,                           GLsizei length);

PARAMETERS

       count           Specifies the number of shader object handles contained in shaders.       shaders           Specifies the address of an array of shader handles into which to           load pre-compiled shader binaries.       binaryFormat           Specifies the format of the shader binaries contained in binary.       binary           Specifies the address of an array of bytes containing pre-compiled           binary shader code.       length           Specifies the length of the array whose address is given in binary.

DESCRIPTION

       glShaderBinary loads pre-compiled shader binary code into the count       shader objects whose handles are given in shaders.  binary points to       length bytes of binary shader code stored in client memory.       binaryFormat specifies the format of the pre-compiled code.       The binary image contained in binary will be decoded according to the       extension specification defining the specified binaryFormat token.       OpenGL does not define any specific binary formats, but it does provide       a mechanism to obtain token vaues for such formats provided by such       extensions.       Depending on the types of the shader objects in shaders, glShaderBinary       will individually load binary vertex or fragment shaders, or load an       executable binary that contains an optimized pair of vertex and       fragment shaders stored in the same binary.

ERRORS

       GL_INVALID_OPERATION is generated if more than one of the handles in       shaders refers to the same shader object.       GL_INVALID_ENUM is generated if binaryFormat is not an accepted value.       GL_INVALID_VALUE is generated if the data pointed to by binary does not       match the format specified by binaryFormat.

原创粉丝点击