--- title: WebGLShaderPrecisionFormat slug: Web/API/WebGLShaderPrecisionFormat translation_of: Web/API/WebGLShaderPrecisionFormat --- <div><strong>WebGLShaderPrecisionFormat</strong> 接口是<a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a> 的一部分,它表示通过调用{{domxref("WebGLRenderingContext.getShaderPrecisionFormat()")}}返回信息的信息。</div> <h2 id="属性">属性</h2> <dl> <dt>{{domxref("WebGLShaderPrecisionFormat.rangeMin")}}</dt> <dd>以2为底的最小值的绝对值的对数。</dd> <dt>{{domxref("WebGLShaderPrecisionFormat.rangeMax")}}</dt> <dd>可以表示的最大值的绝对值的底数为2的对数。</dd> <dt>{{domxref("WebGLShaderPrecisionFormat.precision")}}</dt> <dd>可以表示的精度位的数目。对于整数类型,这个值总是0。</dd> </dl> <h2 id="示例">示例</h2> <p><code>WebGLShaderPrecisionFormat</code> 对象通过{{domxref("WebGLRenderingContext.getShaderPrecisionFormat()")}} 方法来返回。</p> <pre class="brush: js">var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT); // WebGLShaderPrecisionFormat { rangeMin: 127, rangeMax: 127, precision: 23 } </pre> <h2 id="规格">规格</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">规格</th> <th scope="col">状态</th> <th scope="col">注释</th> </tr> <tr> <td>{{SpecName('WebGL', "#5.12", "WebGLShaderPrecisionFormat")}}</td> <td>{{Spec2('WebGL')}}</td> <td>Initial definition.</td> </tr> </tbody> </table> <h2 id="浏览器兼容性">浏览器兼容性</h2> <p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> <p>{{Compat("api.WebGLShaderPrecisionFormat")}}</p> <h2 id="另请参阅">另请参阅</h2> <ul> <li>{{domxref("WebGLRenderingContext.getShaderPrecisionFormat()")}}</li> </ul>