Skip to content

Commit

Permalink
WebGPU support for ClipDistances feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Valigursky committed Nov 22, 2024
1 parent a4b9c1c commit 1c2edd3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit 1c2edd3

Please sign in to comment.