mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
docs: add warning about stack size for WGSL compilation
This commit is contained in:
parent
b21a3265de
commit
fb305b85f6
@ -155,7 +155,7 @@ Bottom level categories:
|
|||||||
- In spv-in, remove unnecessary "gl_PerVertex" name check so unused builtins will always be skipped. By @Imberflur in [#5227](https://github.com/gfx-rs/wgpu/pull/5227).
|
- In spv-in, remove unnecessary "gl_PerVertex" name check so unused builtins will always be skipped. By @Imberflur in [#5227](https://github.com/gfx-rs/wgpu/pull/5227).
|
||||||
- GLSL 410 does not support layout(binding = ...), enable only for GLSL 420. By @bes in [#5357](https://github.com/gfx-rs/wgpu/pull/5357)
|
- GLSL 410 does not support layout(binding = ...), enable only for GLSL 420. By @bes in [#5357](https://github.com/gfx-rs/wgpu/pull/5357)
|
||||||
- In spv-out, check for acceleration and ray-query types when enabling ray-query extension to prevent validation error. By @Vecvec in [#5463](https://github.com/gfx-rs/wgpu/pull/5463)
|
- In spv-out, check for acceleration and ray-query types when enabling ray-query extension to prevent validation error. By @Vecvec in [#5463](https://github.com/gfx-rs/wgpu/pull/5463)
|
||||||
- Add a limit for curly brace nesting in WGSL parsing. By @ErichDonGubler in [#5447](https://github.com/gfx-rs/wgpu/pull/5447).
|
- Add a limit for curly brace nesting in WGSL parsing, plus a note about stack size requirements. By @ErichDonGubler in [#5447](https://github.com/gfx-rs/wgpu/pull/5447).
|
||||||
|
|
||||||
#### Tests
|
#### Tests
|
||||||
|
|
||||||
|
@ -44,6 +44,17 @@ impl Frontend {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <div class="warning">
|
||||||
|
// NOTE: Keep this in sync with `wgpu::Device::create_shader_module`!
|
||||||
|
// NOTE: Keep this in sync with `wgpu_core::Global::device_create_shader_module`!
|
||||||
|
///
|
||||||
|
/// This function may consume a lot of stack space. Compiler-enforced limits for parsing recursion
|
||||||
|
/// exist; if shader compilation runs into them, it will return an error gracefully. However, on
|
||||||
|
/// some build profiles and platforms, the default stack size for a thread may be exceeded before
|
||||||
|
/// this limit is reached during parsing. Callers should ensure that there is enough stack space
|
||||||
|
/// for this, particularly if calls to this method are exposed to user input.
|
||||||
|
///
|
||||||
|
/// </div>
|
||||||
pub fn parse_str(source: &str) -> Result<crate::Module, ParseError> {
|
pub fn parse_str(source: &str) -> Result<crate::Module, ParseError> {
|
||||||
Frontend::new().parse(source)
|
Frontend::new().parse(source)
|
||||||
}
|
}
|
||||||
|
@ -1170,6 +1170,20 @@ impl Global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a shader module with the given `source`.
|
||||||
|
///
|
||||||
|
/// <div class="warning">
|
||||||
|
// NOTE: Keep this in sync with `naga::front::wgsl::parse_str`!
|
||||||
|
// NOTE: Keep this in sync with `wgpu::Device::create_shader_module`!
|
||||||
|
///
|
||||||
|
/// This function may consume a lot of stack space. Compiler-enforced limits for parsing
|
||||||
|
/// recursion exist; if shader compilation runs into them, it will return an error gracefully.
|
||||||
|
/// However, on some build profiles and platforms, the default stack size for a thread may be
|
||||||
|
/// exceeded before this limit is reached during parsing. Callers should ensure that there is
|
||||||
|
/// enough stack space for this, particularly if calls to this method are exposed to user
|
||||||
|
/// input.
|
||||||
|
///
|
||||||
|
/// </div>
|
||||||
pub fn device_create_shader_module<A: HalApi>(
|
pub fn device_create_shader_module<A: HalApi>(
|
||||||
&self,
|
&self,
|
||||||
device_id: DeviceId,
|
device_id: DeviceId,
|
||||||
|
@ -2296,6 +2296,19 @@ impl Device {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a shader module from either SPIR-V or WGSL source code.
|
/// Creates a shader module from either SPIR-V or WGSL source code.
|
||||||
|
///
|
||||||
|
/// <div class="warning">
|
||||||
|
// NOTE: Keep this in sync with `naga::front::wgsl::parse_str`!
|
||||||
|
// NOTE: Keep this in sync with `wgpu_core::Global::device_create_shader_module`!
|
||||||
|
///
|
||||||
|
/// This function may consume a lot of stack space. Compiler-enforced limits for parsing
|
||||||
|
/// recursion exist; if shader compilation runs into them, it will return an error gracefully.
|
||||||
|
/// However, on some build profiles and platforms, the default stack size for a thread may be
|
||||||
|
/// exceeded before this limit is reached during parsing. Callers should ensure that there is
|
||||||
|
/// enough stack space for this, particularly if calls to this method are exposed to user
|
||||||
|
/// input.
|
||||||
|
///
|
||||||
|
/// </div>
|
||||||
pub fn create_shader_module(&self, desc: ShaderModuleDescriptor<'_>) -> ShaderModule {
|
pub fn create_shader_module(&self, desc: ShaderModuleDescriptor<'_>) -> ShaderModule {
|
||||||
let (id, data) = DynContext::device_create_shader_module(
|
let (id, data) = DynContext::device_create_shader_module(
|
||||||
&*self.context,
|
&*self.context,
|
||||||
|
Loading…
Reference in New Issue
Block a user