• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    AMD_program_binary_Z400
4
5Name Strings
6
7    GL_AMD_program_binary_Z400
8
9Contributors
10
11    Joey Blankenship
12
13Contact
14
15    Benj Lipchak, AMD (benj.lipchak 'at' amd.com)
16
17Status
18
19    Complete.
20
21Version
22
23    Last Modified Date: April 9, 2008
24    Revision: #6
25
26Number
27
28    48
29
30Dependencies
31
32    OpenGL ES 2.0 is required.
33
34    OES_get_program_binary is required.
35
36    Written based on the wording of the OpenGL ES 2.0 specification.
37
38Overview
39
40    AMD provides an offline shader compiler as part of its suite of SDK tools
41    for AMD's Z400 family of embedded graphics accelerator IP.  This extension
42    makes available a program binary format, Z400_BINARY_AMD.
43
44    The offline shader compiler accepts a pair of OpenGL Shading Language
45    (GLSL) source shaders: one vertex shader and one fragment shader.  It
46    outputs a compiled, optimized, and pre-linked program binary which can then
47    be loaded into a program objects via the ProgramBinaryOES command.
48
49    Applications are recommended to use the OES_get_program_binary extension's
50    program binary retrieval mechanism for install-time shader compilation where
51    applicable.  That cross-vendor extension provides the performance benefits
52    of loading pre-compiled program binaries, while providing the portability of
53    deploying GLSL source shaders with the application rather than vendor-
54    specific binaries.  The details of this extension are obviated by the use
55    of that extension.
56
57New Procedures and Functions
58
59    None.
60
61New Tokens
62
63    Accepted by the <binaryFormat> parameter of ProgramBinaryOES:
64
65        Z400_BINARY_AMD                            0x8740
66
67Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL Operation)
68
69    Add the following paragraph to the end of section 2.15.4:
70
71    "Z400_BINARY_AMD, returned in the list of PROGRAM_BINARY_FORMATS_OES, is a
72    format that may be loaded into a program object via ProgramBinaryOES."
73
74    An implementation may reject a Z400_BINARY_AMD program binary by setting the
75    LINK_STATUS to FALSE and updating the program object's info log if it
76    determines the binary was produced by an incompatible or outdated version of
77    the shader compiler."
78
79GLX Protocol
80
81    None.
82
83Errors
84
85    None.
86
87New State
88
89    None.
90
91Sample Usage
92
93    void loadPrecompiledZ400ProgramBinary(const char* myZ400BinaryFileName,
94                                          GLuint progObj)
95    {
96        GLint   binaryLength;
97        GLvoid* binary;
98        GLint   success;
99        FILE*   infile;
100
101        //
102        //  Read the program binary
103        //
104        infile = fopen(myZ400BinaryFileName, "rb");
105        fseek(infile, 0, SEEK_END);
106        binaryLength = (GLint)ftell(infile);
107        binary = (GLvoid*)malloc(binaryLength);
108        fseek(infile, 0, SEEK_SET);
109        fread(binary, binaryLength, 1, infile);
110        fclose(infile);
111
112        //
113        //  Load the binary into the program object -- no need to link!
114        //
115        glProgramBinaryOES(progObj, GL_Z400_BINARY_AMD, binary, binaryLength);
116        free(binary);
117
118        glGetProgramiv(progObj, GL_LINK_STATUS, &success);
119
120        if (!success)
121        {
122            //
123            // Fallback to source shaders or gracefully exit.
124            //
125        }
126    }
127
128Revision History
129
130    #06    04/09/2008    Benj Lipchak    Remove INVALID_OPERATION error in favor
131                                         of just LINK_STATUS and info log.
132                                         Also improve sample code.
133    #05    03/12/2008    Benj Lipchak    Reformulate as program binary.
134    #04    01/02/2008    Benj Lipchak    Split GetProgramBinary into its own
135                                         multi-vendor extension proposal.
136    #03    11/26/2007    Benj Lipchak    Add sample usage and define tokens.
137    #02    10/22/2007    Benj Lipchak    Add error conditions.
138    #01    10/14/2007    Benj Lipchak    First draft.
139