sebavan 5 gadi atpakaļ
vecāks
revīzija
936c544abf

+ 4 - 8
src/Engines/WebGPU/webgpuShaderProcessors.ts

@@ -43,13 +43,6 @@ const _gpuTextureViewDimensionByWebGPUTextureType: { [key: string]: GPUTextureVi
 /** @hidden */
 export class WebGPUShaderProcessor implements IShaderProcessor {
 
-    public preProcessor(code: string, defines: string[], isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>): string {
-        let sci = new ShaderCodeInliner(code);
-        // sci.debug = true;
-        sci.processCode();
-        return sci.code;
-    }
-
     public varyingProcessor(varying: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) {
         const webgpuProcessingContext = processingContext! as WebGPUShaderProcessingContext;
 
@@ -243,7 +236,10 @@ export class WebGPUShaderProcessor implements IShaderProcessor {
             code += "gl_Position.y *= -1.; }";
         }
 
-        return code;
+        let sci = new ShaderCodeInliner(code);
+        // sci.debug = true;
+        sci.processCode();
+        return sci.code;
     }
 
     public finalizeShaders(vertexCode: string, fragmentCode: string, processingContext: Nullable<ShaderProcessingContext>): { vertexCode: string, fragmentCode: string } {

+ 3 - 8
src/Engines/webgpuEngine.ts

@@ -359,9 +359,8 @@ export class WebGPUEngine extends Engine {
         };
 
         if (this._options.antialiasing) {
-            const mainTextureDescriptor = {
+            const mainTextureDescriptor: GPUTextureDescriptor = {
                 size: this._mainTextureExtends,
-                arrayLayerCount: 1,
                 mipLevelCount: 1,
                 sampleCount: this._mainPassSampleCount,
                 dimension: WebGPUConstants.GPUTextureDimension_2d,
@@ -387,9 +386,8 @@ export class WebGPUEngine extends Engine {
             }];
         }
 
-        const depthTextureDescriptor = {
+        const depthTextureDescriptor: GPUTextureDescriptor = {
             size: this._mainTextureExtends,
-            arrayLayerCount: 1,
             mipLevelCount: 1,
             sampleCount: this._mainPassSampleCount,
             dimension: WebGPUConstants.GPUTextureDimension_2d,
@@ -1214,7 +1212,6 @@ export class WebGPUEngine extends Engine {
             const textureDescriptor: GPUTextureDescriptor = {
                 dimension: WebGPUConstants.GPUTextureDimension_2d,
                 format: WebGPUConstants.GPUTextureFormat_rgba8unorm,
-                arrayLayerCount: 1,
                 mipLevelCount: noMipmap ? 1 : mipMaps + 1,
                 sampleCount: 1,
                 size: textureExtent,
@@ -1288,12 +1285,11 @@ export class WebGPUEngine extends Engine {
             const textureExtent = {
                 width,
                 height,
-                depth,
+                depth: depth * 6,
             };
             const textureDescriptor: GPUTextureDescriptor = {
                 dimension: WebGPUConstants.GPUTextureDimension_2d,
                 format: WebGPUConstants.GPUTextureFormat_rgba8unorm,
-                arrayLayerCount: 6,
                 mipLevelCount: noMipmap ? 1 : mipMaps + 1,
                 sampleCount: 1,
                 size: textureExtent,
@@ -1313,7 +1309,6 @@ export class WebGPUEngine extends Engine {
                 }
             }
             texture._webGPUTextureView = gpuTexture.createView({
-                arrayLayerCount: 6,
                 dimension: WebGPUConstants.GPUTextureViewDimension_cube,
                 format: WebGPUConstants.GPUTextureFormat_rgba8unorm,
                 mipLevelCount: noMipmap ? 1 : mipMaps + 1,

+ 0 - 1
src/LibDeclarations/webgpu.d.ts

@@ -459,7 +459,6 @@ interface GPUSwapChainDescriptor extends GPUObjectDescriptorBase {
 
 interface GPUTextureDescriptor extends GPUObjectDescriptorBase {
   size: GPUExtent3D;
-  arrayLayerCount?: number;
   mipLevelCount?: number;
   sampleCount?: number;
   dimension?: GPUTextureDimension;