Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPU support for ClipDistances feature #7134

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/platform/graphics/graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,14 @@ class GraphicsDevice extends EventHandler {
*/
supportsUniformBuffers = false;

/**
* True if the device supports clip distances (WebGPU only). Clip distances allow you to restrict
* primitives' clip volume with user-defined half-spaces in the output of vertex stage.
*
* @type {boolean}
*/
supportsClipDistances = false;

/**
* True if 32-bit floating-point textures can be used as a frame buffer.
*
Expand Down
2 changes: 1 addition & 1 deletion src/platform/graphics/webgpu/webgpu-graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ class WebgpuGraphicsDevice extends GraphicsDevice {
*/
this.gpuAdapter = await window.navigator.gpu.requestAdapter(adapterOptions);


// request optional features
const requiredFeatures = [];
const requireFeature = (feature) => {
Expand All @@ -231,6 +230,7 @@ class WebgpuGraphicsDevice extends GraphicsDevice {
this.supportsShaderF16 = requireFeature('shader-f16');
this.supportsStorageRGBA8 = requireFeature('bgra8unorm-storage');
this.textureRG11B10Renderable = requireFeature('rg11b10ufloat-renderable');
this.supportsClipDistances = requireFeature('clip-distances');
Debug.log(`WEBGPU features: ${requiredFeatures.join(', ')}`);

// copy all adapter limits to the requiredLimits object - to created a device with the best feature sets available
Expand Down