forked from BSVino/docs.gl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
glGetShaderPrecisionFormat.xhtml
142 lines (136 loc) · 8.14 KB
/
glGetShaderPrecisionFormat.xhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<div class="refentry"><a id="glGetShaderPrecisionFormat"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glGetShaderPrecisionFormat — return the range and precision for different shader numeric formats</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table class="funcprototype-table" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <strong class="fsfunc">glGetShaderPrecisionFormat</strong>(</code></td><td>GLenum <var class="pdparam">shaderType</var>, </td></tr><tr><td> </td><td>GLenum <var class="pdparam">precisionType</var>, </td></tr><tr><td> </td><td>GLint *<var class="pdparam">range</var>, </td></tr><tr><td> </td><td>GLint *<var class="pdparam">precision</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>shaderType</code></em></span></dt><dd><p>Specifies the type of shader to query.
Must be either <code class="constant">GL_VERTEX_SHADER</code>
or <code class="constant">GL_FRAGMENT_SHADER</code>.</p></dd><dt><span class="term"><em class="parameter"><code>precisionType</code></em></span></dt><dd><p>Specifies the numeric format to query, corresponding to a shader precision qualifier and variable type.
Must be one of <code class="constant">GL_LOW_FLOAT</code>, <code class="constant">GL_MEDIUM_FLOAT</code>,
<code class="constant">GL_HIGH_FLOAT</code>, <code class="constant">GL_LOW_INT</code>,
<code class="constant">GL_MEDIUM_INT</code>, or <code class="constant">GL_HIGH_INT</code>.</p></dd><dt><span class="term"><em class="parameter"><code>range</code></em></span></dt><dd><p>Specifies a pointer to the two-element array in which the
<math overflow="scroll">
<mrow>
<msub><mi mathvariant="italic">log</mi>
<mn>2</mn>
</msub>
</mrow>
</math>
of the minimum and maximum representable magnitudes of the format
are returned.</p></dd><dt><span class="term"><em class="parameter"><code>precision</code></em></span></dt><dd><p>Specifies a pointer to the location in which the
<math overflow="scroll">
<mrow>
<msub><mi mathvariant="italic">log</mi>
<mn>2</mn>
</msub>
</mrow>
</math>
of the precision of the format is returned.</p></dd></dl></div></div><div class="refsect1"><a id="description"></a><h2>Description</h2><p><code class="function">glGetShaderPrecisionFormat</code>
returns range and precision limits for floating-point and integer shader variable formats with low,
medium, and high precision qualifiers.
When <math overflow="scroll"><mi mathvariant="italic">minRep</mi></math>
and <math overflow="scroll"><mi mathvariant="italic">maxRep</mi></math>
are the minimum and maximum representable values of the format,
<math overflow="scroll">
<mrow>
<mi mathvariant="italic">floor</mi>
<mo></mo>
<mfenced open="(" close=")">
<mrow>
<msub><mi mathvariant="italic">log</mi>
<mn>2</mn>
</msub>
<mo></mo>
<mfenced open="(" close=")">
<mrow>
<mfenced open="|" close="|">
<mrow>
<mi mathvariant="italic">minRep</mi>
</mrow>
</mfenced>
</mrow>
</mfenced>
</mrow>
</mfenced>
</mrow>
</math>
and
<math overflow="scroll">
<mrow>
<mi mathvariant="italic">floor</mi>
<mo></mo>
<mfenced open="(" close=")">
<mrow>
<msub><mi mathvariant="italic">log</mi>
<mn>2</mn>
</msub>
<mo></mo>
<mfenced open="(" close=")">
<mrow>
<mfenced open="|" close="|">
<mrow>
<mi mathvariant="italic">maxRep</mi>
</mrow>
</mfenced>
</mrow>
</mfenced>
</mrow>
</mfenced>
</mrow>
</math>
are returned in
<em class="parameter"><code>range</code></em> as the first and second elements, respectively.</p><p>If the smallest representable value greater than 1 is
<math overflow="scroll">
<mfenced open="(" close=")">
<mrow>
<mn>1</mn>
<mo>+</mo>
<mn>∊</mn>
</mrow>
</mfenced>
</math>
then
<math overflow="scroll">
<mrow>
<mi mathvariant="italic">floor</mi>
<mo></mo>
<mfenced open="(" close=")">
<mrow>
<mo>-</mo>
<msub><mi mathvariant="italic">log</mi>
<mn>2</mn>
</msub>
<mo></mo>
<mfenced open="(" close=")">
<mrow>
<mn>∊</mn>
</mrow>
</mfenced>
</mrow>
</mfenced>
</mrow>
</math>
is returned in <em class="parameter"><code>precision</code></em>.
An integer format will have an ∊ of 1, and thus will return 0.
Floating-point formats will return values greater than 0.</p></div><div class="refsect1"><a id="notes"></a><h2>Notes</h2><p>The minimum range and precision required for different formats is
described in the <span class="emphasis"><em>OpenGL ES Shading Language Specification.</em></span></p><p>If a high precision floating-point format is not supported for fragment shaders,
calling <code class="function">glGetShaderPrecisionFormat</code> with arguments <code class="constant">GL_FRAGMENT_SHADER</code>
and <code class="constant">GL_HIGH_FLOAT</code> will return 0 for both <em class="parameter"><code>range</code></em> and
<em class="parameter"><code>precision</code></em>. Support for a high precision floating-point format is mandatory for
vertex shaders.</p><p>Shader compiler support is optional, and thus must be queried
before use by calling <a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a>
with argument <code class="constant">GL_SHADER_COMPILER</code>. <a class="citerefentry" href="glShaderSource"><span class="citerefentry"><span class="refentrytitle">glShaderSource</span></span></a>,
<a class="citerefentry" href="glCompileShader"><span class="citerefentry"><span class="refentrytitle">glCompileShader</span></span></a>, <code class="function">glGetShaderPrecisionFormat</code>, and
<a class="citerefentry" href="glReleaseShaderCompiler"><span class="citerefentry"><span class="refentrytitle">glReleaseShaderCompiler</span></span></a> will
each generate <code class="constant">GL_INVALID_OPERATION</code> on implementations
that do not support a shader compiler. Such implementations instead offer the
<a class="citerefentry" href="glShaderBinary"><span class="citerefentry"><span class="refentrytitle">glShaderBinary</span></span></a>
alternative for supplying a pre-compiled shader binary.</p><p>If an error is generated, no change is made to the
contents of <em class="parameter"><code>range</code></em> or <em class="parameter"><code>precision</code></em>.</p></div><div class="refsect1"><a id="errors"></a><h2>Errors</h2><p><code class="constant">GL_INVALID_OPERATION</code> is generated if
a shader compiler is not supported.</p><p><code class="constant">GL_INVALID_ENUM</code> is generated if
<em class="parameter"><code>shaderType</code></em> or <em class="parameter"><code>precisionType</code></em> is not
an accepted value.</p></div><div class="refsect1"><a id="associatedgets"></a><h2>Associated Gets</h2><p><a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a>
with argument <code class="constant">GL_SHADER_COMPILER</code></p></div>
{$pipelinestall}{$examples}
<div class="refsect1"><a id="seealso"></a><h2>See Also</h2><p><a class="citerefentry" href="glCompileShader"><span class="citerefentry"><span class="refentrytitle">glCompileShader</span></span></a>,
<a class="citerefentry" href="glShaderSource"><span class="citerefentry"><span class="refentrytitle">glShaderSource</span></span></a></p></div><div class="refsect1"><div id="Copyright"><h2>Copyright</h2><p>
Copyright © 2008 Khronos Group.
This material may be distributed subject to the terms and conditions set forth in
the Open Publication License, v 1.0, 8 June 1999.
<a class="ulink" href="https://opencontent.org/openpub/" target="_top">https://opencontent.org/openpub/</a>.
</p></div></div></div>