From c542e1b4bed84968d094f35ef68c5d0311433fcb Mon Sep 17 00:00:00 2001 From: ShuangLiu Date: Tue, 24 Sep 2024 21:53:42 +0800 Subject: [PATCH] chore: add securecontext warning --- package.json | 2 +- pnpm-lock.yaml | 14 +++++++------- src/Engine3D.ts | 16 ++-------------- src/gfx/graphics/webGpu/Context3D.ts | 2 +- 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 50bdb07e..48041474 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s" }, "devDependencies": { - "@webgpu/types": "^0.1.40", + "@webgpu/types": "^0.1.45", "conventional-changelog-cli": "^2.2.2", "electron": "^31.1.0", "typedoc": "^0.25.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4aa5caf5..58f27039 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,8 +2,8 @@ lockfileVersion: '6.0' devDependencies: '@webgpu/types': - specifier: ^0.1.40 - version: 0.1.40 + specifier: ^0.1.45 + version: 0.1.45 conventional-changelog-cli: specifier: ^2.2.2 version: 2.2.2 @@ -469,8 +469,8 @@ packages: dev: true optional: true - /@webgpu/types@0.1.40: - resolution: {integrity: sha512-/BBkHLS6/eQjyWhY2H7Dx5DHcVrS2ICj9owvSRdgtQT6KcafLZA86tPze0xAOsd4FbsYKCUBUQyNi87q7gV7kw==} + /@webgpu/types@0.1.45: + resolution: {integrity: sha512-0TBBF/mhakJoK0qUWCZugBnh23x+VwmYA5RLmtNQwvZt1pQ4P2fzIvQUiSe6jxzkBi4GF8R4BejJjro0ZSoSXQ==} dev: true /JSONStream@1.3.5: @@ -1130,7 +1130,7 @@ packages: source-map: 0.6.1 wordwrap: 1.0.0 optionalDependencies: - uglify-js: 3.17.4 + uglify-js: 3.19.3 dev: true /hard-rejection@2.1.0: @@ -2005,8 +2005,8 @@ packages: hasBin: true dev: true - /uglify-js@3.17.4: - resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==} + /uglify-js@3.19.3: + resolution: {integrity: sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==} engines: {node: '>=0.8.0'} hasBin: true requiresBuild: true diff --git a/src/Engine3D.ts b/src/Engine3D.ts index e69ca851..1cf5962f 100644 --- a/src/Engine3D.ts +++ b/src/Engine3D.ts @@ -47,11 +47,6 @@ export class Engine3D { */ public static inputSystem: InputSystem; - /** - * input system in engine3d - */ - public static divB: HTMLDivElement; - /** * more view in engine3d */ @@ -324,15 +319,8 @@ export class Engine3D { */ public static async init(descriptor: { canvasConfig?: CanvasConfig; beforeRender?: Function; renderLoop?: Function; lateRender?: Function, engineSetting?: EngineSetting } = {}) { console.log('Engine Version', version); - - // for dev debug - if (import.meta.env.DEV) { - this.divB = document.createElement("div"); - this.divB.style.position = 'absolute' - this.divB.style.zIndex = '999' - this.divB.style.color = '#FFFFFF' - this.divB.style.top = '150px' - document.body.appendChild(this.divB); + if (!window.isSecureContext){ + console.warn('WebGPU is only supported in secure contexts (HTTPS or localhost)') } this.setting = { ...this.setting, ...descriptor.engineSetting } diff --git a/src/gfx/graphics/webGpu/Context3D.ts b/src/gfx/graphics/webGpu/Context3D.ts index d7757266..48e679df 100644 --- a/src/gfx/graphics/webGpu/Context3D.ts +++ b/src/gfx/graphics/webGpu/Context3D.ts @@ -116,7 +116,7 @@ export class Context3D extends CEventDispatcher { format: this.presentationFormat, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT, alphaMode: 'premultiplied', - colorSpace: `srgb`, + colorSpace: `srgb` }); this._resizeEvent = new CResizeEvent(CResizeEvent.RESIZE, { width: this.windowWidth, height: this.windowHeight })