-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
WebGPURenderer: Add Storage3DTexture
and StorageArrayTexture
#31175
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
Open
Spiri0
wants to merge
24
commits into
mrdoob:dev
Choose a base branch
from
Spiri0:add_support_for_texture_storage_2d_array
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
a167227
Add support for texture_storage_2d_array
a62fcf8
additional extensions
da2caad
additional extensions
540c1d1
update
6f7c308
update
21f8d30
update
1d18ef1
update
f471b4d
update
44ab9fa
changed isTextureArray to isArrayTexture and the conditions
a295334
changed isTextureArray to isArrayTexture and the conditions
efe63ff
changed isTextureArray to isArrayTexture and the conditions
f32ec26
changed isTextureArray to isArrayTexture and the conditions
6478e35
with new classes for storageArrayTexture and storage3DTexture
bb35de5
with new classes for storageArrayTexture and storage3DTexture
8395fb2
with new classes for storageArrayTexture and storage3DTexture
5ad8c2e
with new classes for storageArrayTexture and storage3DTexture
912b3c3
with new classes for storageArrayTexture and storage3DTexture
c26fab3
with new classes for storageArrayTexture and storage3DTexture
dafe742
with new classes for storageArrayTexture and storage3DTexture
e5643c4
[200~
a1e9f0b
isSampledTexture3D replaced by is3DTexture, since it does not matter …
6db99f1
isSampledTexture3D replaced by is3DTexture, since it does not matter …
2d97903
isSampledTexture3D replaced by is3DTexture, since it does not matter …
177c903
isSampledTexture3D replaced by is3DTexture, since it does not matter …
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { Texture } from '../../textures/Texture.js'; | ||
import { LinearFilter, ClampToEdgeWrapping } from '../../constants.js'; | ||
|
||
/** | ||
* This special type of texture is intended for compute shaders. | ||
* It can be used to compute the data of a texture with a compute shader. | ||
* | ||
* Note: This type of texture can only be used with `WebGPURenderer` | ||
* and a WebGPU backend. | ||
* | ||
* @augments Texture | ||
*/ | ||
class Storage3DTexture extends Texture { | ||
|
||
/** | ||
* Constructs a new storage texture. | ||
* | ||
* @param {number} [width=1] - The storage texture's width. | ||
* @param {number} [height=1] - The storage texture's height. | ||
* @param {number} [depth=1] - The storage texture's depth. | ||
*/ | ||
constructor( width = 1, height = 1, depth = 1 ) { | ||
|
||
super(); | ||
|
||
//inherited from texture. Must be false for 3DTexture | ||
this.isArrayTexture = false; | ||
|
||
/** | ||
* The image object which just represents the texture's dimension. | ||
* | ||
* @type {{width: number, height: number, depth: number}} | ||
*/ | ||
this.image = { width, height, depth }; | ||
|
||
/** | ||
* The default `magFilter` for storage textures is `THREE.LinearFilter`. | ||
* | ||
* @type {number} | ||
*/ | ||
this.magFilter = LinearFilter; | ||
|
||
/** | ||
* The default `minFilter` for storage textures is `THREE.LinearFilter`. | ||
* | ||
* @type {number} | ||
*/ | ||
this.minFilter = LinearFilter; | ||
|
||
/** | ||
* This defines how the texture is wrapped in the depth direction and corresponds to | ||
* *W* in UVW mapping. | ||
* | ||
* @type {number} | ||
*/ | ||
this.wrapR = ClampToEdgeWrapping; | ||
|
||
/** | ||
* This flag can be used for type testing. | ||
* | ||
* @type {boolean} | ||
* @readonly | ||
* @default true | ||
*/ | ||
this.isStorageTexture = true; | ||
|
||
/** | ||
* Indicates whether this texture is a 3D texture. | ||
* | ||
* @type {boolean} | ||
* | ||
*/ | ||
this.is3DTexture = true; | ||
|
||
} | ||
|
||
} | ||
|
||
export default Storage3DTexture; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Texture } from '../../textures/Texture.js'; | ||
import { LinearFilter } from '../../constants.js'; | ||
|
||
/** | ||
* This special type of texture is intended for compute shaders. | ||
* It can be used to compute the data of a texture with a compute shader. | ||
* | ||
* Note: This type of texture can only be used with `WebGPURenderer` | ||
* and a WebGPU backend. | ||
* | ||
* @augments Texture | ||
*/ | ||
class StorageArrayTexture extends Texture { | ||
|
||
/** | ||
* Constructs a new storage texture. | ||
* | ||
* @param {number} [width=1] - The storage texture's width. | ||
* @param {number} [height=1] - The storage texture's height. | ||
* @param {number} [depth=1] - The storage texture's depth. | ||
*/ | ||
constructor( width = 1, height = 1, depth = 1 ) { | ||
|
||
super(); | ||
|
||
//inherited from texture | ||
this.isArrayTexture = true; | ||
|
||
/** | ||
* The image object which just represents the texture's dimension. | ||
* | ||
* @type {{width: number, height: number, depth: number}} | ||
*/ | ||
this.image = { width, height, depth }; | ||
|
||
/** | ||
* The default `magFilter` for storage textures is `THREE.LinearFilter`. | ||
* | ||
* @type {number} | ||
*/ | ||
this.magFilter = LinearFilter; | ||
|
||
/** | ||
* The default `minFilter` for storage textures is `THREE.LinearFilter`. | ||
* | ||
* @type {number} | ||
*/ | ||
this.minFilter = LinearFilter; | ||
|
||
/** | ||
* This flag can be used for type testing. | ||
* | ||
* @type {boolean} | ||
* @readonly | ||
* @default true | ||
*/ | ||
this.isStorageTexture = true; | ||
|
||
} | ||
|
||
} | ||
|
||
export default StorageArrayTexture; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These TSL functions were declared in some point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, a valid point. For WebGPU, only the export from src/Three.WebGPU.js is necessary.
I can remove the export from src/Three.TSL.js or, what seems more appealing to me, add it for Three.TSL.js, because it should be available there too. But I have to look where.