@onerjs/core 8.43.9 → 8.44.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Engines/AbstractEngine/abstractEngine.query.d.ts +7 -0
- package/Engines/AbstractEngine/abstractEngine.query.js +16 -1
- package/Engines/AbstractEngine/abstractEngine.query.js.map +1 -1
- package/Engines/Extensions/engine.readTexture.js +4 -1
- package/Engines/Extensions/engine.readTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +12 -8
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +0 -6
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Materials/Textures/baseTexture.js +1 -1
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +1 -1
- package/Meshes/abstractMesh.js +1 -1
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg2.js +1 -1
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/mesh.js +5 -2
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/transformNode.js +5 -20
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/textureTools.js +3 -0
- package/Misc/textureTools.js.map +1 -1
- package/Misc/tools.js +1 -1
- package/Misc/tools.js.map +1 -1
- package/package.json +1 -1
|
@@ -17,6 +17,8 @@ export declare class _OcclusionDataStorage {
|
|
|
17
17
|
occlusionQueryAlgorithmType: number;
|
|
18
18
|
/** @internal */
|
|
19
19
|
forceRenderingWhenOccluded: boolean;
|
|
20
|
+
/** @internal */
|
|
21
|
+
occlusionForRenderPassId: number;
|
|
20
22
|
}
|
|
21
23
|
declare module "../../Engines/abstractEngine.js" {
|
|
22
24
|
interface AbstractEngine {
|
|
@@ -107,5 +109,10 @@ declare module "../../Meshes/abstractMesh.js" {
|
|
|
107
109
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries
|
|
108
110
|
*/
|
|
109
111
|
forceRenderingWhenOccluded: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* This number indicates the render pass id used to run the occlusion query. The default value is -1, which means run the occlusion query in all render passes.
|
|
114
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries
|
|
115
|
+
*/
|
|
116
|
+
occlusionForRenderPassId: number;
|
|
110
117
|
}
|
|
111
118
|
}
|
|
@@ -18,6 +18,8 @@ export class _OcclusionDataStorage {
|
|
|
18
18
|
this.occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
|
|
19
19
|
/** @internal */
|
|
20
20
|
this.forceRenderingWhenOccluded = false;
|
|
21
|
+
/** @internal */
|
|
22
|
+
this.occlusionForRenderPassId = -1;
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
AbstractEngine.prototype.createQuery = function () {
|
|
@@ -113,8 +115,18 @@ Object.defineProperty(AbstractMesh.prototype, "forceRenderingWhenOccluded", {
|
|
|
113
115
|
enumerable: true,
|
|
114
116
|
configurable: true,
|
|
115
117
|
});
|
|
118
|
+
Object.defineProperty(AbstractMesh.prototype, "occlusionForRenderPassId", {
|
|
119
|
+
get: function () {
|
|
120
|
+
return this._occlusionDataStorage.occlusionForRenderPassId;
|
|
121
|
+
},
|
|
122
|
+
set: function (value) {
|
|
123
|
+
this._occlusionDataStorage.occlusionForRenderPassId = value;
|
|
124
|
+
},
|
|
125
|
+
enumerable: true,
|
|
126
|
+
configurable: true,
|
|
127
|
+
});
|
|
116
128
|
// We also need to update AbstractMesh as there is a portion of the code there
|
|
117
|
-
AbstractMesh.prototype._checkOcclusionQuery = function () {
|
|
129
|
+
AbstractMesh.prototype._checkOcclusionQuery = function (checkOnly) {
|
|
118
130
|
const dataStorage = this._occlusionDataStorage;
|
|
119
131
|
if (dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
|
|
120
132
|
dataStorage.isOccluded = false;
|
|
@@ -152,6 +164,9 @@ AbstractMesh.prototype._checkOcclusionQuery = function () {
|
|
|
152
164
|
}
|
|
153
165
|
}
|
|
154
166
|
}
|
|
167
|
+
if (checkOnly) {
|
|
168
|
+
return dataStorage.isOccluded;
|
|
169
|
+
}
|
|
155
170
|
const scene = this.getScene();
|
|
156
171
|
if (scene.getBoundingBoxRenderer) {
|
|
157
172
|
const occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractEngine.query.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/AbstractEngine/abstractEngine.query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qCAAiC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKnD,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,OAAO,qBAAqB;IAAlC;QACI,gBAAgB;QACT,kCAA6B,GAAG,CAAC,CAAC;QAEzC,gBAAgB;QACT,+BAA0B,GAAG,KAAK,CAAC;QAE1C,gBAAgB;QACT,eAAU,GAAG,KAAK,CAAC;QAE1B,gBAAgB;QACT,wBAAmB,GAAG,CAAC,CAAC,CAAC;QAEhC,gBAAgB;QACT,kBAAa,GAAG,YAAY,CAAC,mBAAmB,CAAC;QAExD,gBAAgB;QACT,gCAA2B,GAAG,YAAY,CAAC,qCAAqC,CAAC;QAExF,gBAAgB;QACT,+BAA0B,GAAG,KAAK,CAAC;IAC9C,CAAC;CAAA;AA6CD,cAAc,CAAC,SAAS,CAAC,WAAW,GAAG;IACnC,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,cAAc,CAAC,SAAS,CAAC,WAAW,GAAG,UAAU,KAAqB;IAClE,mDAAmD;IACnD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,cAAc,CAAC,SAAS,CAAC,sBAAsB,GAAG,UAAU,KAAqB;IAC7E,m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AC,0BAA0B,GAAG,IAAI,CAAC;QACjE,CAAC;IACL,CAAC;IAED,OAAO,WAAW,CAAC,UAAU,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { AbstractEngine } from \"../abstractEngine\";\r\n\r\n/** @internal */\r\nexport type OcclusionQuery = WebGLQuery | number;\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _OcclusionDataStorage {\r\n /** @internal */\r\n public occlusionInternalRetryCounter = 0;\r\n\r\n /** @internal */\r\n public isOcclusionQueryInProgress = false;\r\n\r\n /** @internal */\r\n public isOccluded = false;\r\n\r\n /** @internal */\r\n public occlusionRetryCount = -1;\r\n\r\n /** @internal */\r\n public occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;\r\n\r\n /** @internal */\r\n public occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;\r\n\r\n /** @internal */\r\n public forceRenderingWhenOccluded = false;\r\n}\r\n\r\ndeclare module \"../../Engines/abstractEngine\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface AbstractEngine {\r\n /**\r\n * Create a new webGL query (you must be sure that queries are supported by checking getCaps() function)\r\n * @returns the new query\r\n */\r\n createQuery(): Nullable<OcclusionQuery>;\r\n /**\r\n * Delete and release a webGL query\r\n * @param query defines the query to delete\r\n * @returns the current engine\r\n */\r\n deleteQuery(query: OcclusionQuery): AbstractEngine /**\r\n * Check if a given query has resolved and got its value\r\n * @param query defines the query to check\r\n * @returns true if the query got its value\r\n */;\r\n isQueryResultAvailable(query: OcclusionQuery): boolean;\r\n /**\r\n * Gets the value of a given query\r\n * @param query defines the query to check\r\n * @returns the value of the query\r\n */\r\n getQueryResult(query: OcclusionQuery): number;\r\n /**\r\n * Initiates an occlusion query\r\n * @param algorithmType defines the algorithm to use\r\n * @param query defines the query to use\r\n * @returns the current engine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n beginOcclusionQuery(algorithmType: number, query: OcclusionQuery): boolean;\r\n /**\r\n * Ends an occlusion query\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n * @param algorithmType defines the algorithm to use\r\n * @returns the current engine\r\n */\r\n endOcclusionQuery(algorithmType: number): AbstractEngine;\r\n }\r\n}\r\n\r\nAbstractEngine.prototype.createQuery = function (): Nullable<OcclusionQuery> {\r\n return null;\r\n};\r\n\r\nAbstractEngine.prototype.deleteQuery = function (query: OcclusionQuery): AbstractEngine {\r\n // Do nothing. Must be implemented by child classes\r\n return this;\r\n};\r\n\r\nAbstractEngine.prototype.isQueryResultAvailable = function (query: OcclusionQuery): boolean {\r\n // Do nothing. Must be implemented by child classes\r\n return false;\r\n};\r\n\r\nAbstractEngine.prototype.getQueryResult = function (query: OcclusionQuery): number {\r\n // Do nothing. Must be implemented by child classes\r\n return 0;\r\n};\r\n\r\nAbstractEngine.prototype.beginOcclusionQuery = function (algorithmType: number, query: OcclusionQuery): boolean {\r\n // Do nothing. Must be implemented by child classes\r\n return false;\r\n};\r\n\r\nAbstractEngine.prototype.endOcclusionQuery = function (algorithmType: number): AbstractEngine {\r\n // Do nothing. Must be implemented by child classes\r\n return this;\r\n};\r\n\r\ndeclare module \"../../Meshes/abstractMesh\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface AbstractMesh {\r\n /**\r\n * Backing filed\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n __occlusionDataStorage: _OcclusionDataStorage;\r\n\r\n /**\r\n * Access property\r\n * @internal\r\n */\r\n _occlusionDataStorage: _OcclusionDataStorage;\r\n\r\n /**\r\n * This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retrieved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decides to show or hide the object.\r\n * The default value is -1 which means don't break the query and wait till the result\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n occlusionRetryCount: number;\r\n\r\n /**\r\n * This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:\r\n * * OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query within the Mesh.\r\n * * OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.\r\n * * OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n occlusionType: number;\r\n\r\n /**\r\n * This property determines the type of occlusion query algorithm to run in WebGl, you can use:\r\n * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.\r\n * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n occlusionQueryAlgorithmType: number;\r\n\r\n /**\r\n * Gets or sets whether the mesh is occluded or not, it is used also to set the initial state of the mesh to be occluded or not\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n isOccluded: boolean;\r\n\r\n /**\r\n * Flag to check the progress status of the query\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n isOcclusionQueryInProgress: boolean;\r\n\r\n /**\r\n * Flag to force rendering the mesh even if occluded\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n forceRenderingWhenOccluded: boolean;\r\n }\r\n}\r\nObject.defineProperty(AbstractMesh.prototype, \"isOcclusionQueryInProgress\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.isOcclusionQueryInProgress;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = value;\r\n },\r\n enumerable: false,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"_occlusionDataStorage\", {\r\n get: function (this: AbstractMesh) {\r\n if (!this.__occlusionDataStorage) {\r\n this.__occlusionDataStorage = new _OcclusionDataStorage();\r\n }\r\n return this.__occlusionDataStorage;\r\n },\r\n enumerable: false,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"isOccluded\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.isOccluded;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.isOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionQueryAlgorithmType\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionQueryAlgorithmType;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionQueryAlgorithmType = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionType\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionType;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionType = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionRetryCount\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionRetryCount;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionRetryCount = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"forceRenderingWhenOccluded\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.forceRenderingWhenOccluded;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.forceRenderingWhenOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n// We also need to update AbstractMesh as there is a portion of the code there\r\nAbstractMesh.prototype._checkOcclusionQuery = function () {\r\n const dataStorage = this._occlusionDataStorage;\r\n\r\n if (dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n const engine = this.getEngine();\r\n\r\n if (!engine.getCaps().supportOcclusionQuery) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n if (!engine.isQueryResultAvailable) {\r\n // Occlusion query where not referenced\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n if (this.isOcclusionQueryInProgress && this._occlusionQuery !== null && this._occlusionQuery !== undefined) {\r\n const isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);\r\n if (isOcclusionQueryAvailable) {\r\n const occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);\r\n\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n dataStorage.isOccluded = occlusionQueryResult > 0 ? false : true;\r\n } else {\r\n dataStorage.occlusionInternalRetryCounter++;\r\n\r\n if (dataStorage.occlusionRetryCount !== -1 && dataStorage.occlusionInternalRetryCounter > dataStorage.occlusionRetryCount) {\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n\r\n // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)\r\n // if strict continue the last state of the object.\r\n dataStorage.isOccluded = dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n } else {\r\n return dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n }\r\n }\r\n }\r\n\r\n const scene = this.getScene();\r\n if (scene.getBoundingBoxRenderer) {\r\n const occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();\r\n\r\n if (this._occlusionQuery === null) {\r\n this._occlusionQuery = engine.createQuery();\r\n }\r\n\r\n if (this._occlusionQuery && engine.beginOcclusionQuery(dataStorage.occlusionQueryAlgorithmType, this._occlusionQuery)) {\r\n occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);\r\n engine.endOcclusionQuery(dataStorage.occlusionQueryAlgorithmType);\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = true;\r\n }\r\n }\r\n\r\n return dataStorage.isOccluded;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"abstractEngine.query.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/AbstractEngine/abstractEngine.query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qCAAiC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKnD,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,OAAO,qBAAqB;IAAlC;QACI,gBAAgB;QACT,kCAA6B,GAAG,CAAC,CAAC;QAEzC,gBAAgB;QACT,+BAA0B,GAAG,KAAK,CAAC;QAE1C,gBAAgB;QACT,eAAU,GAAG,KAAK,CAAC;QAE1B,gBAAgB;QACT,wBAAmB,GAAG,CAAC,CAAC,CAAC;QAEhC,gBAAgB;QACT,kBAAa,GAAG,YAAY,CAAC,mBAAmB,CAAC;QAExD,gBAAgB;QACT,gCAA2B,GAAG,YAAY,CAAC,qCAAqC,CAAC;QAExF,gBAAgB;QACT,+BAA0B,GAAG,KAAK,CAAC;QAE1C,gBAAgB;QACT,6BAAwB,GAAG,CAAC,CAAC,CAAC;IACzC,C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UAAU,CAAC;YACjH,CAAC;QACL,CAAC;IACL,CAAC;IAED,IAAI,SAAS,EAAE,CAAC;QACZ,OAAO,WAAW,CAAC,UAAU,CAAC;IAClC,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC9B,IAAI,KAAK,CAAC,sBAAsB,EAAE,CAAC;QAC/B,MAAM,4BAA4B,GAAG,KAAK,CAAC,sBAAsB,EAAE,CAAC;QAEpE,IAAI,IAAI,CAAC,eAAe,KAAK,IAAI,EAAE,CAAC;YAChC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QAChD,CAAC;QAED,IAAI,IAAI,CAAC,eAAe,IAAI,MAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,2BAA2B,EAAE,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YACpH,4BAA4B,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC;YAC9D,MAAM,CAAC,iBAAiB,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;YAClE,IAAI,CAAC,qBAAqB,CAAC,0BAA0B,GAAG,IAAI,CAAC;QACjE,CAAC;IACL,CAAC;IAED,OAAO,WAAW,CAAC,UAAU,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { AbstractEngine } from \"../abstractEngine\";\r\n\r\n/** @internal */\r\nexport type OcclusionQuery = WebGLQuery | number;\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _OcclusionDataStorage {\r\n /** @internal */\r\n public occlusionInternalRetryCounter = 0;\r\n\r\n /** @internal */\r\n public isOcclusionQueryInProgress = false;\r\n\r\n /** @internal */\r\n public isOccluded = false;\r\n\r\n /** @internal */\r\n public occlusionRetryCount = -1;\r\n\r\n /** @internal */\r\n public occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;\r\n\r\n /** @internal */\r\n public occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;\r\n\r\n /** @internal */\r\n public forceRenderingWhenOccluded = false;\r\n\r\n /** @internal */\r\n public occlusionForRenderPassId = -1;\r\n}\r\n\r\ndeclare module \"../../Engines/abstractEngine\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface AbstractEngine {\r\n /**\r\n * Create a new webGL query (you must be sure that queries are supported by checking getCaps() function)\r\n * @returns the new query\r\n */\r\n createQuery(): Nullable<OcclusionQuery>;\r\n /**\r\n * Delete and release a webGL query\r\n * @param query defines the query to delete\r\n * @returns the current engine\r\n */\r\n deleteQuery(query: OcclusionQuery): AbstractEngine /**\r\n * Check if a given query has resolved and got its value\r\n * @param query defines the query to check\r\n * @returns true if the query got its value\r\n */;\r\n isQueryResultAvailable(query: OcclusionQuery): boolean;\r\n /**\r\n * Gets the value of a given query\r\n * @param query defines the query to check\r\n * @returns the value of the query\r\n */\r\n getQueryResult(query: OcclusionQuery): number;\r\n /**\r\n * Initiates an occlusion query\r\n * @param algorithmType defines the algorithm to use\r\n * @param query defines the query to use\r\n * @returns the current engine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n beginOcclusionQuery(algorithmType: number, query: OcclusionQuery): boolean;\r\n /**\r\n * Ends an occlusion query\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n * @param algorithmType defines the algorithm to use\r\n * @returns the current engine\r\n */\r\n endOcclusionQuery(algorithmType: number): AbstractEngine;\r\n }\r\n}\r\n\r\nAbstractEngine.prototype.createQuery = function (): Nullable<OcclusionQuery> {\r\n return null;\r\n};\r\n\r\nAbstractEngine.prototype.deleteQuery = function (query: OcclusionQuery): AbstractEngine {\r\n // Do nothing. Must be implemented by child classes\r\n return this;\r\n};\r\n\r\nAbstractEngine.prototype.isQueryResultAvailable = function (query: OcclusionQuery): boolean {\r\n // Do nothing. Must be implemented by child classes\r\n return false;\r\n};\r\n\r\nAbstractEngine.prototype.getQueryResult = function (query: OcclusionQuery): number {\r\n // Do nothing. Must be implemented by child classes\r\n return 0;\r\n};\r\n\r\nAbstractEngine.prototype.beginOcclusionQuery = function (algorithmType: number, query: OcclusionQuery): boolean {\r\n // Do nothing. Must be implemented by child classes\r\n return false;\r\n};\r\n\r\nAbstractEngine.prototype.endOcclusionQuery = function (algorithmType: number): AbstractEngine {\r\n // Do nothing. Must be implemented by child classes\r\n return this;\r\n};\r\n\r\ndeclare module \"../../Meshes/abstractMesh\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface AbstractMesh {\r\n /**\r\n * Backing filed\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n __occlusionDataStorage: _OcclusionDataStorage;\r\n\r\n /**\r\n * Access property\r\n * @internal\r\n */\r\n _occlusionDataStorage: _OcclusionDataStorage;\r\n\r\n /**\r\n * This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retrieved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decides to show or hide the object.\r\n * The default value is -1 which means don't break the query and wait till the result\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n occlusionRetryCount: number;\r\n\r\n /**\r\n * This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:\r\n * * OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query within the Mesh.\r\n * * OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.\r\n * * OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n occlusionType: number;\r\n\r\n /**\r\n * This property determines the type of occlusion query algorithm to run in WebGl, you can use:\r\n * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.\r\n * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n occlusionQueryAlgorithmType: number;\r\n\r\n /**\r\n * Gets or sets whether the mesh is occluded or not, it is used also to set the initial state of the mesh to be occluded or not\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n isOccluded: boolean;\r\n\r\n /**\r\n * Flag to check the progress status of the query\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n isOcclusionQueryInProgress: boolean;\r\n\r\n /**\r\n * Flag to force rendering the mesh even if occluded\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n forceRenderingWhenOccluded: boolean;\r\n\r\n /**\r\n * This number indicates the render pass id used to run the occlusion query. The default value is -1, which means run the occlusion query in all render passes.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/occlusionQueries\r\n */\r\n occlusionForRenderPassId: number;\r\n }\r\n}\r\nObject.defineProperty(AbstractMesh.prototype, \"isOcclusionQueryInProgress\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.isOcclusionQueryInProgress;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = value;\r\n },\r\n enumerable: false,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"_occlusionDataStorage\", {\r\n get: function (this: AbstractMesh) {\r\n if (!this.__occlusionDataStorage) {\r\n this.__occlusionDataStorage = new _OcclusionDataStorage();\r\n }\r\n return this.__occlusionDataStorage;\r\n },\r\n enumerable: false,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"isOccluded\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.isOccluded;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.isOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionQueryAlgorithmType\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionQueryAlgorithmType;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionQueryAlgorithmType = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionType\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionType;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionType = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionRetryCount\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionRetryCount;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionRetryCount = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"forceRenderingWhenOccluded\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.forceRenderingWhenOccluded;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.forceRenderingWhenOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionForRenderPassId\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionForRenderPassId;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionForRenderPassId = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n// We also need to update AbstractMesh as there is a portion of the code there\r\nAbstractMesh.prototype._checkOcclusionQuery = function (checkOnly: boolean) {\r\n const dataStorage = this._occlusionDataStorage;\r\n\r\n if (dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n const engine = this.getEngine();\r\n\r\n if (!engine.getCaps().supportOcclusionQuery) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n if (!engine.isQueryResultAvailable) {\r\n // Occlusion query where not referenced\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n if (this.isOcclusionQueryInProgress && this._occlusionQuery !== null && this._occlusionQuery !== undefined) {\r\n const isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);\r\n if (isOcclusionQueryAvailable) {\r\n const occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);\r\n\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n dataStorage.isOccluded = occlusionQueryResult > 0 ? false : true;\r\n } else {\r\n dataStorage.occlusionInternalRetryCounter++;\r\n\r\n if (dataStorage.occlusionRetryCount !== -1 && dataStorage.occlusionInternalRetryCounter > dataStorage.occlusionRetryCount) {\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n\r\n // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)\r\n // if strict continue the last state of the object.\r\n dataStorage.isOccluded = dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n } else {\r\n return dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n }\r\n }\r\n }\r\n\r\n if (checkOnly) {\r\n return dataStorage.isOccluded;\r\n }\r\n\r\n const scene = this.getScene();\r\n if (scene.getBoundingBoxRenderer) {\r\n const occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();\r\n\r\n if (this._occlusionQuery === null) {\r\n this._occlusionQuery = engine.createQuery();\r\n }\r\n\r\n if (this._occlusionQuery && engine.beginOcclusionQuery(dataStorage.occlusionQueryAlgorithmType, this._occlusionQuery)) {\r\n occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);\r\n engine.endOcclusionQuery(dataStorage.occlusionQueryAlgorithmType);\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = true;\r\n }\r\n }\r\n\r\n return dataStorage.isOccluded;\r\n};\r\n"]}
|
|
@@ -15,7 +15,10 @@ ThinEngine.prototype._readTexturePixelsSync = function (texture, width, height,
|
|
|
15
15
|
this._dummyFramebuffer = dummy;
|
|
16
16
|
}
|
|
17
17
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._dummyFramebuffer);
|
|
18
|
-
if (faceIndex > -1) {
|
|
18
|
+
if (faceIndex > -1 && (texture.is2DArray || texture.is3D)) {
|
|
19
|
+
gl.framebufferTextureLayer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, texture._hardwareTexture?.underlyingResource, level, faceIndex);
|
|
20
|
+
}
|
|
21
|
+
else if (faceIndex > -1) {
|
|
19
22
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._hardwareTexture?.underlyingResource, level);
|
|
20
23
|
}
|
|
21
24
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.readTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Extensions/engine.readTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAqCtD,cAAc;AACd,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC,UAAU,CAAC,SAAS,CAAC,sBAAsB,GAAG,UAC1C,OAAwB,EACxB,KAAa,EACb,MAAc,EACd,SAAS,GAAG,CAAC,CAAC,EACd,KAAK,GAAG,CAAC,EACT,SAAoC,IAAI,EACxC,aAAa,GAAG,IAAI,EACpB,gBAAgB,GAAG,KAAK,EACxB,CAAC,GAAG,CAAC,EACL,CAAC,GAAG,CAAC;IAEL,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;IACpB,IAAI,CAAC,EAAE,EAAE,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,EAAE,CAAC,iBAAiB,EAAE,CAAC;QAErC,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;IACnC,CAAC;IACD,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAE3D,IAAI,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"engine.readTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Extensions/engine.readTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAqCtD,cAAc;AACd,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC,UAAU,CAAC,SAAS,CAAC,sBAAsB,GAAG,UAC1C,OAAwB,EACxB,KAAa,EACb,MAAc,EACd,SAAS,GAAG,CAAC,CA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MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,qEAAqE;AACrE,UAAU,CAAC,SAAS,CAAC,kBAAkB,GAAG,UACtC,OAAwB,EACxB,KAAa,EACb,MAAc,EACd,SAAS,GAAG,CAAC,CAAC,EACd,KAAK,GAAG,CAAC,EACT,SAAoC,IAAI,EACxC,aAAa,GAAG,IAAI,EACpB,gBAAgB,GAAG,KAAK,EACxB,CAAC,GAAG,CAAC,EACL,CAAC,GAAG,CAAC;IAEL,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACjJ,CAAC,CAAC","sourcesContent":["import { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../types\";\r\n\r\ndeclare module \"../../Engines/abstractEngine\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface AbstractEngine {\r\n /** @internal */\r\n _readTexturePixels(\r\n texture: InternalTexture,\r\n width: number,\r\n height: number,\r\n faceIndex?: number,\r\n level?: number,\r\n buffer?: Nullable<ArrayBufferView>,\r\n flushRenderer?: boolean,\r\n noDataConversion?: boolean,\r\n x?: number,\r\n y?: number\r\n ): Promise<ArrayBufferView>;\r\n\r\n /** @internal */\r\n _readTexturePixelsSync(\r\n texture: InternalTexture,\r\n width: number,\r\n height: number,\r\n faceIndex?: number,\r\n level?: number,\r\n buffer?: Nullable<ArrayBufferView>,\r\n flushRenderer?: boolean,\r\n noDataConversion?: boolean,\r\n x?: number,\r\n y?: number\r\n ): ArrayBufferView;\r\n }\r\n}\r\n\r\n// back-compat\r\nimport { allocateAndCopyTypedBuffer } from \"../../Engines/abstractEngine.functions\";\r\nexport { allocateAndCopyTypedBuffer };\r\n\r\nThinEngine.prototype._readTexturePixelsSync = function (\r\n texture: InternalTexture,\r\n width: number,\r\n height: number,\r\n faceIndex = -1,\r\n level = 0,\r\n buffer: Nullable<ArrayBufferView> = null,\r\n flushRenderer = true,\r\n noDataConversion = false,\r\n x = 0,\r\n y = 0\r\n): ArrayBufferView {\r\n const gl = this._gl;\r\n if (!gl) {\r\n throw new Error(\"Engine does not have gl rendering context.\");\r\n }\r\n if (!this._dummyFramebuffer) {\r\n const dummy = gl.createFramebuffer();\r\n\r\n if (!dummy) {\r\n throw new Error(\"Unable to create dummy framebuffer\");\r\n }\r\n\r\n this._dummyFramebuffer = dummy;\r\n }\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, this._dummyFramebuffer);\r\n\r\n if (faceIndex > -1 && (texture.is2DArray || texture.is3D)) {\r\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, texture._hardwareTexture?.underlyingResource, level, faceIndex);\r\n } else if (faceIndex > -1) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._hardwareTexture?.underlyingResource, level);\r\n } else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._hardwareTexture?.underlyingResource, level);\r\n }\r\n\r\n let readType = texture.type !== undefined ? this._getWebGLTextureType(texture.type) : gl.UNSIGNED_BYTE;\r\n\r\n if (!noDataConversion) {\r\n switch (readType) {\r\n case gl.UNSIGNED_BYTE:\r\n if (!buffer) {\r\n buffer = new Uint8Array(4 * width * height);\r\n }\r\n readType = gl.UNSIGNED_BYTE;\r\n break;\r\n default:\r\n if (!buffer) {\r\n buffer = new Float32Array(4 * width * height);\r\n }\r\n readType = gl.FLOAT;\r\n break;\r\n }\r\n } else if (!buffer) {\r\n buffer = allocateAndCopyTypedBuffer(texture.type, 4 * width * height);\r\n }\r\n\r\n if (flushRenderer) {\r\n this.flushFramebuffer();\r\n }\r\n\r\n gl.readPixels(x, y, width, height, gl.RGBA, readType, <DataView>buffer);\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, this._currentFramebuffer);\r\n\r\n return buffer;\r\n};\r\n\r\n// eslint-disable-next-line @typescript-eslint/promise-function-async\r\nThinEngine.prototype._readTexturePixels = function (\r\n texture: InternalTexture,\r\n width: number,\r\n height: number,\r\n faceIndex = -1,\r\n level = 0,\r\n buffer: Nullable<ArrayBufferView> = null,\r\n flushRenderer = true,\r\n noDataConversion = false,\r\n x = 0,\r\n y = 0\r\n): Promise<ArrayBufferView> {\r\n return Promise.resolve(this._readTexturePixelsSync(texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion, x, y));\r\n};\r\n"]}
|
|
@@ -68,6 +68,7 @@ const colorStates = [0, 0, 0, 0];
|
|
|
68
68
|
/** @internal */
|
|
69
69
|
export class WebGPUCacheRenderPipeline {
|
|
70
70
|
constructor(device, emptyVertexBuffer) {
|
|
71
|
+
this._depthBiasClamp = 0;
|
|
71
72
|
this.mrtTextureCount = 0;
|
|
72
73
|
this._device = device;
|
|
73
74
|
this._useTextureStage = true; // we force usage because we must handle depth textures with "float" filtering, which can't be fixed by a caps (like "textureFloatLinearFiltering" can for float textures)
|
|
@@ -875,6 +876,14 @@ export class WebGPUCacheRenderPipeline {
|
|
|
875
876
|
stripIndexFormat = !this.indexBuffer || this.indexBuffer.is32Bits ? "uint32" /* WebGPUConstants.IndexFormat.Uint32 */ : "uint16" /* WebGPUConstants.IndexFormat.Uint16 */;
|
|
876
877
|
}
|
|
877
878
|
const depthStencilFormatHasStencil = this._webgpuDepthStencilFormat ? WebGPUTextureHelper.HasStencilAspect(this._webgpuDepthStencilFormat) : false;
|
|
879
|
+
const primitiveState = {
|
|
880
|
+
topology,
|
|
881
|
+
frontFace: this._frontFace === 1 ? "ccw" /* WebGPUConstants.FrontFace.CCW */ : "cw" /* WebGPUConstants.FrontFace.CW */,
|
|
882
|
+
cullMode: !this._cullEnabled ? "none" /* WebGPUConstants.CullMode.None */ : this._cullFace === 2 ? "front" /* WebGPUConstants.CullMode.Front */ : "back" /* WebGPUConstants.CullMode.Back */,
|
|
883
|
+
};
|
|
884
|
+
if (stripIndexFormat) {
|
|
885
|
+
primitiveState.stripIndexFormat = stripIndexFormat;
|
|
886
|
+
}
|
|
878
887
|
return this._device.createRenderPipeline({
|
|
879
888
|
label: `RenderPipeline_${colorStates[0]?.format ?? "nooutput"}_${this._webgpuDepthStencilFormat ?? "nodepth"}_samples${sampleCount}_textureState${this._textureState}`,
|
|
880
889
|
layout: pipelineLayout,
|
|
@@ -883,12 +892,7 @@ export class WebGPUCacheRenderPipeline {
|
|
|
883
892
|
entryPoint: webgpuPipelineContext.stages.vertexStage.entryPoint,
|
|
884
893
|
buffers: inputStateDescriptor,
|
|
885
894
|
},
|
|
886
|
-
primitive:
|
|
887
|
-
topology,
|
|
888
|
-
stripIndexFormat,
|
|
889
|
-
frontFace: this._frontFace === 1 ? "ccw" /* WebGPUConstants.FrontFace.CCW */ : "cw" /* WebGPUConstants.FrontFace.CW */,
|
|
890
|
-
cullMode: !this._cullEnabled ? "none" /* WebGPUConstants.CullMode.None */ : this._cullFace === 2 ? "front" /* WebGPUConstants.CullMode.Front */ : "back" /* WebGPUConstants.CullMode.Back */,
|
|
891
|
-
},
|
|
895
|
+
primitive: primitiveState,
|
|
892
896
|
fragment: !webgpuPipelineContext.stages.fragmentStage
|
|
893
897
|
? undefined
|
|
894
898
|
: {
|
|
@@ -909,8 +913,8 @@ export class WebGPUCacheRenderPipeline {
|
|
|
909
913
|
format: this._webgpuDepthStencilFormat,
|
|
910
914
|
stencilFront: this._stencilEnabled && depthStencilFormatHasStencil ? stencilFront : undefined,
|
|
911
915
|
stencilBack: this._stencilEnabled && depthStencilFormatHasStencil ? stencilBack : undefined,
|
|
912
|
-
stencilReadMask: this._stencilEnabled && depthStencilFormatHasStencil ? this._stencilReadMask :
|
|
913
|
-
stencilWriteMask: this._stencilEnabled && depthStencilFormatHasStencil ? this._stencilWriteMask :
|
|
916
|
+
stencilReadMask: this._stencilEnabled && depthStencilFormatHasStencil ? this._stencilReadMask : 0xffffffff,
|
|
917
|
+
stencilWriteMask: this._stencilEnabled && depthStencilFormatHasStencil ? this._stencilWriteMask : 0xffffffff,
|
|
914
918
|
depthBias: this._depthBias,
|
|
915
919
|
depthBiasClamp: topologyIsTriangle ? this._depthBiasClamp : 0,
|
|
916
920
|
depthBiasSlopeScale: topologyIsTriangle ? this._depthBiasSlopeScale : 0,
|