Skip to content

[BUG] plane for TextureView not implemeneted for WebGPU #316

Description

@jcyuan

Cocos Creator version

3.8.8

System information

Win10

Issue description

on WebGPU i need to use plane argument to read stencil, but for now there is no way to do so.

Relevant error log output

No response

Steps to reproduce

In the BasicRenderPassBuilder base class, addTexture is already declared as:

/**
* @en Add texture for sampling
* The texture must have registered in pipeline.
* @zh 添加采样用的贴图,贴图必须已注册。
* @param name @en name of the texture @zh 贴图的注册名
* @param slotName @en name of descriptor in the shader @zh 着色器中描述符的名字
* @param sampler @en the sampler to use @zh 采样器名字
* @param plane @en the image plane ID to sample (color|depth|stencil|video) @zh 需要采样的贴图平面(颜色|深度|模板|视频)
*/
addTexture (
name: string,
slotName: string,
sampler?: Sampler,
plane?: number): void;

However, the WebRenderPassBuilder
addTexture (name: string, slotName: string, sampler: Sampler | null = null): void {
this._addComputeResource(name, AccessType.READ, slotName);
if (sampler) {
const descriptorID = this._lg.attributeIndex.get(slotName)!;
this._data.samplers.set(descriptorID, sampler);
}
}

drops the plane parameter, likely under the assumption that the web doesn't need it... but WebGPU does support this parameter!

Simply modifying _addComputeResource

private _addComputeResource (name: string, accessType: AccessType, slotName: string): void {
const view = renderGraphPool.createComputeView(slotName);
view.accessType = accessType;
if (this._pass.computeViews.has(name)) {
this._pass.computeViews.get(name)?.push(view);
} else {
this._pass.computeViews.set(name, [view]);
}
}

to add a plane: number = 0 argument in that class to pass plane through to view.plane is still insufficient, because when the executor actually binds the prepared texture, it doesn't bind the corresponding textureView based on the provided plane.

P.S.: The native side works correctly.

Minimal reproduction project

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions