Skip to content

Commit 70728c7

Browse files
committed
spirv-builder: update ShaderPanicStrategy::DebugPrintfThenExit docs with newer information.
1 parent 24f42f2 commit 70728c7

File tree

1 file changed

+34
-9
lines changed
  • crates/spirv-builder/src

1 file changed

+34
-9
lines changed

crates/spirv-builder/src/lib.rs

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,40 @@ pub enum ShaderPanicStrategy {
193193
/// If you have multiple entry-points, you *may* need to also enable the
194194
/// `multimodule` node (see <https://github.com/KhronosGroup/SPIRV-Tools/issues/4892>).
195195
///
196-
/// **Note**: actually obtaining the `debugPrintf` output requires enabling:
197-
/// * `VK_KHR_shader_non_semantic_info` Vulkan *Device* extension
198-
/// * Vulkan Validation Layers (which contain the `debugPrintf` implementation)
199-
/// * `VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT` in Validation Layers,
200-
/// either by using `VkValidationFeaturesEXT` during instance creating,
201-
/// setting the `VK_LAYER_ENABLES` environment variable to that value,
202-
/// or adding it to `khronos_validation.enables` in `vk_layer_settings.txt`
203-
///
204-
/// See also: <https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/main/docs/debug_printf.md>.
196+
/// **Note**: actually obtaining the `debugPrintf` output requires:
197+
/// * Vulkan Validation Layers (from e.g. the Vulkan SDK)
198+
/// * (they contain the `debugPrintf` implementation, a SPIR-V -> SPIR-V translation)
199+
/// * **set the `VK_LOADER_LAYERS_ENABLE=VK_LAYER_KHRONOS_validation`
200+
/// environment variable** to easily enable them without any code changes
201+
/// * alternatively, `"VK_LAYER_KHRONOS_validation"` can be passed during
202+
/// instance creation, to enable them programmatically
203+
/// * Validation Layers' `debugPrintf` support:
204+
/// * **set the `VK_LAYER_ENABLES=VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT`
205+
/// environment variable** to easily enable the `debugPrintf` support
206+
/// * alternatively, `VkValidationFeaturesEXT` during instance creation,
207+
/// or the `khronos_validation.enables` field in `vk_layer_settings.txt`,
208+
/// can be used to enable `VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT`
209+
/// (see also <https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/main/docs/debug_printf.md>)
210+
/// * for outputting the `debugPrintf` messages sent back from the GPU:
211+
/// * **set the `DEBUG_PRINTF_TO_STDOUT=1` environment variable** if you don't
212+
/// plan on customizing the reporting (see below for alternatives)
213+
/// * for `wgpu`:
214+
/// * **required**: `wgpu::Features::SPIRV_SHADER_PASSTHROUGH` (Naga lacks `debugPrintf`)
215+
/// * *optional*: building in debug mode (and/or with debug-assertions enabled),
216+
/// to enable `wgpu` logging/debug support
217+
/// * (the debug assertions requirement may be lifted in future `wgpu` versions)
218+
/// * this uses `VK_EXT_debug_utils` internally, and is a better-integrated
219+
/// alternative to just setting `DEBUG_PRINTF_TO_STDOUT=1`
220+
/// * `RUST_LOG=wgpu_hal::vulkan=info` (or equivalent) will enable said
221+
/// output (as `debugPrintf` messages have the "info" level)
222+
/// * `RUST_LOG` controls `env_logger`, which isn't itself required,
223+
/// but *some* `log`/`tracing` subscriber is needed to get any output
224+
/// * for Vulkan (e.g. via `ash`):
225+
/// * **required**: enabling the `VK_KHR_shader_non_semantic_info` Vulkan *Device* extension
226+
/// * *optional*: as described above, enabling the Validation Layers and
227+
/// their `debugPrintf` support can be done during instance creation
228+
/// * *optional*: integrating [`VK_EXT_debug_utils`](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_debug_utils.html)
229+
/// allows more reporting flexibility than `DEBUG_PRINTF_TO_STDOUT=1`)
205230
DebugPrintfThenExit {
206231
/// Whether to also print the entry-point inputs (excluding buffers/resources),
207232
/// which should uniquely identify the panicking shader invocation.

0 commit comments

Comments
 (0)