|
@@ -1,4 +1,6 @@
|
|
|
-function WebGLCapabilities( gl, extensions, parameters ) {
|
|
|
+import { FloatType, HalfFloatType, RGBAFormat, UnsignedByteType } from '../../constants.js';
|
|
|
+
|
|
|
+function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
|
|
|
let maxAnisotropy;
|
|
|
|
|
@@ -22,6 +24,33 @@ function WebGLCapabilities( gl, extensions, parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ function textureFormatReadable( textureFormat ) {
|
|
|
+
|
|
|
+ if ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {
|
|
|
+
|
|
|
+ return false;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ function textureTypeReadable( textureType ) {
|
|
|
+
|
|
|
+ const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );
|
|
|
+
|
|
|
+ if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== gl.getParameter( gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)
|
|
|
+ textureType !== FloatType && ! halfFloatSupportedByExt ) {
|
|
|
+
|
|
|
+ return false;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
function getMaxPrecision( precision ) {
|
|
|
|
|
|
if ( precision === 'highp' ) {
|
|
@@ -85,6 +114,9 @@ function WebGLCapabilities( gl, extensions, parameters ) {
|
|
|
getMaxAnisotropy: getMaxAnisotropy,
|
|
|
getMaxPrecision: getMaxPrecision,
|
|
|
|
|
|
+ textureFormatReadable: textureFormatReadable,
|
|
|
+ textureTypeReadable: textureTypeReadable,
|
|
|
+
|
|
|
precision: precision,
|
|
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
|
|