Просмотр исходного кода

Add the support3DTextures feature

Popov72 4 лет назад
Родитель
Сommit
cf01dd7e36

+ 3 - 0
src/Engines/engineFeatures.ts

@@ -29,6 +29,9 @@ export interface EngineFeatures {
     /** Indicates that the textures transcoded by the basis transcoder must have power of 2 width and height */
     basisNeedsPOT: boolean;
 
+    /** Indicates that the engine supports 3D textures */
+    support3DTextures: boolean;
+
     /** @hidden */
     _collectUbosUpdatedInFrame: boolean;
 }

+ 3 - 1
src/Engines/thinEngine.ts

@@ -185,6 +185,7 @@ export class ThinEngine {
         trackUbosInFrame: false,
         supportCSM: false,
         basisNeedsPOT: false,
+        support3DTextures: false,
         _collectUbosUpdatedInFrame: false,
     };
 
@@ -735,7 +736,8 @@ export class ThinEngine {
         ThinEngine.Features.supportShadowSamplers = this._webGLVersion !== 1;
         ThinEngine.Features.allowTexturePrefiltering = this._webGLVersion !== 1;
         ThinEngine.Features.supportCSM = this._webGLVersion !== 1;
-        ThinEngine.Features.basisNeedsPOT = this._webGLVersion < 2;
+        ThinEngine.Features.basisNeedsPOT = this._webGLVersion === 1;
+        ThinEngine.Features.support3DTextures = this._webGLVersion !== 1;
 
         // Ensures a consistent color space unpacking of textures cross browser.
         this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);

+ 1 - 0
src/Engines/webgpuEngine.ts

@@ -247,6 +247,7 @@ export class WebGPUEngine extends Engine {
         ThinEngine.Features.trackUbosInFrame = true;
         ThinEngine.Features.supportCSM = true;
         ThinEngine.Features.basisNeedsPOT = false;
+        ThinEngine.Features.support3DTextures = false; // TODO WEBGPU change to true when Chrome supports 3D textures
         ThinEngine.Features._collectUbosUpdatedInFrame = true;
 
         options.deviceDescriptor = options.deviceDescriptor || { };

+ 2 - 2
src/Materials/Textures/colorGradingTexture.ts

@@ -94,7 +94,7 @@ export class ColorGradingTexture extends BaseTexture {
     private load3dlTexture() {
         var engine = this._getEngine()!;
         var texture: InternalTexture;
-        if (engine.webGLVersion === 1) {
+        if (!ThinEngine.Features.support3DTextures) {
             texture = engine.createRawTexture(null, 1, 1, Constants.TEXTUREFORMAT_RGBA, false, false, Constants.TEXTURE_BILINEAR_SAMPLINGMODE, null, Constants.TEXTURETYPE_UNSIGNED_INT);
         }
         else {
@@ -105,7 +105,7 @@ export class ColorGradingTexture extends BaseTexture {
         this._texture.isReady = false;
 
         this.isCube = false;
-        this.is3D = engine.webGLVersion > 1;
+        this.is3D = ThinEngine.Features.support3DTextures;
         this.wrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;
         this.wrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;
         this.wrapR = Constants.TEXTURE_CLAMP_ADDRESSMODE;