shader: emit float min/max as host instructions on AMD GPUs #1761

Manually merged
github merged 6 commits from gh-pr/1761/head into gh-pr/1761/base 2026-11-26 10:05:03 +00:00
Owner

@⁠Arda501 on GitHub · 2026-10-20 13:42 UTC · original
Arda501:pr/native-float-minmax → main · +141 −23 · 11 files · 6 commits · merged 2026-10-21 19:36 UTC

Game and problem

SAROS (PPSA07631, v01.00), Linux (CachyOS), RX 9070 XT, Mesa RADV. The game is GPU-bound in compute shaders; the two heaviest (0x0c9a138927bbc375, about 3.1 ms per frame, and 0x0a5a927c752c1ed7, about 2.2 ms) spend much of their time in float min/max emulation.

Cause

V_MIN_F32, V_MAX_F32, V_MIN3_F32 and V_MAX3_F32 are emitted as a classify-and-select sequence (NaN and zero tests on both operands, an ordered compare and several selects, about a dozen instructions per operation) so that every host returns the guest's results: a NaN operand yields the other operand, and -0 orders below +0. In the RADV ISA of the first shader, v_cndmask_b32 is the most frequent instruction.

AMD GPUs execute GLSL.std.450 NMin/NMax (v_min_f32/v_max_f32 under ACO) with those same rules.

Change

  • Spirv::SetNativeFloatMinMax selects host NMin/NMax for EmitMinMaxF32Value, which covers MIN, MAX, MIN3 and MAX3. MED3 keeps its exact emulation.
  • GLSL.std.450 only guarantees NaN, infinity and signed-zero results for extended instructions with SPV_KHR_float_controls2; SignedZeroInfNanPreserve does not apply to them. The native instructions are therefore decorated FPFastMathMode None, and the module declares SPV_KHR_float_controls2 / FloatControls2.
  • CreateVulkan enables VK_KHR_shader_float_controls2 when available, and uses the native path only when the device vendor is AMD (0x1002) and shaderFloatControls2 is supported. KYTY_EMULATED_FLOAT_MIN_MAX=1 keeps the emulation. Other devices are unchanged.

Testing

  • New VectorMinMaxF32RuntimeEdges (wave 32 and 64): MIN/MAX/MIN3/MAX3 on operands loaded from a buffer, so nothing is constant-folded. Cases: quiet and signaling NaN in either operand, NaN with signed zeros, +/-0 in both orders, +/-infinity. Expected values follow the emulated rules.
  • New --float-min-max-only mode (also registered as the shader_recompiler_float_min_max CTest) runs that case and the existing VectorMinMaxF32NanAndSignedZeroEdges with the emulation and, on AMD with float controls 2, with host instructions; the native runs also check that the module declares FloatControls2. The test harness enables VK_KHR_shader_float_controls2 when available. All pass on RX 9070 XT / RADV (which exposes shaderFloatControls2).
  • Denormal operands are not covered: my reference model and the existing emulation disagreed on them, and I have no hardware results to settle which is right.
  • The full shader_recompiler_compute_tests run stops at IndirectBufferStore on Linux/RADV, on main 1a053f9e as well, so it does not show this change either way.
  • GPU timings (timestamp queries per dispatch, on my local performance branch, same shaders): 0x0c9a138927bbc375 3.14 ms -> 1.97 ms, 0x0a5a927c752c1ed7 2.21 ms -> 0.91 ms; compute time per frame 23.1 ms -> 18.7 ms. Screenshots with and without the change look the same.
  • SAROS on this branch (rebased onto main f492027b) plus #1760, which SAROS needs to reach gameplay on Linux: reaches gameplay and renders the same scene as main. Not built or tested on Windows.

AI use

Claude Code profiled the shaders and wrote the change, i ran the tests and the game runs above. Runs stable at about 16fps on my 9070Xt 7800x3D linux machine with some graphical glitches such as missing textures and shader bugs but it is technicaly playable as far as i have played (about 1h into the game)

🤖 Generated with Claude Code

**@⁠Arda501** on GitHub · 2026-10-20 13:42 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1761) `Arda501:pr/native-float-minmax` → `main` · +141 −23 · 11 files · 6 commits · merged 2026-10-21 19:36 UTC ## Game and problem SAROS (PPSA07631, v01.00), Linux (CachyOS), RX 9070 XT, Mesa RADV. The game is GPU-bound in compute shaders; the two heaviest (`0x0c9a138927bbc375`, about 3.1 ms per frame, and `0x0a5a927c752c1ed7`, about 2.2 ms) spend much of their time in float min/max emulation. ## Cause `V_MIN_F32`, `V_MAX_F32`, `V_MIN3_F32` and `V_MAX3_F32` are emitted as a classify-and-select sequence (NaN and zero tests on both operands, an ordered compare and several selects, about a dozen instructions per operation) so that every host returns the guest's results: a NaN operand yields the other operand, and -0 orders below +0. In the RADV ISA of the first shader, `v_cndmask_b32` is the most frequent instruction. AMD GPUs execute `GLSL.std.450 NMin`/`NMax` (`v_min_f32`/`v_max_f32` under ACO) with those same rules. ## Change - `Spirv::SetNativeFloatMinMax` selects host `NMin`/`NMax` for `EmitMinMaxF32Value`, which covers MIN, MAX, MIN3 and MAX3. MED3 keeps its exact emulation. - `GLSL.std.450` only guarantees NaN, infinity and signed-zero results for extended instructions with `SPV_KHR_float_controls2`; `SignedZeroInfNanPreserve` does not apply to them. The native instructions are therefore decorated `FPFastMathMode None`, and the module declares `SPV_KHR_float_controls2` / `FloatControls2`. - `CreateVulkan` enables `VK_KHR_shader_float_controls2` when available, and uses the native path only when the device vendor is AMD (0x1002) and `shaderFloatControls2` is supported. `KYTY_EMULATED_FLOAT_MIN_MAX=1` keeps the emulation. Other devices are unchanged. ## Testing - New `VectorMinMaxF32RuntimeEdges` (wave 32 and 64): MIN/MAX/MIN3/MAX3 on operands loaded from a buffer, so nothing is constant-folded. Cases: quiet and signaling NaN in either operand, NaN with signed zeros, +/-0 in both orders, +/-infinity. Expected values follow the emulated rules. - New `--float-min-max-only` mode (also registered as the `shader_recompiler_float_min_max` CTest) runs that case and the existing `VectorMinMaxF32NanAndSignedZeroEdges` with the emulation and, on AMD with float controls 2, with host instructions; the native runs also check that the module declares `FloatControls2`. The test harness enables `VK_KHR_shader_float_controls2` when available. All pass on RX 9070 XT / RADV (which exposes `shaderFloatControls2`). - Denormal operands are not covered: my reference model and the existing emulation disagreed on them, and I have no hardware results to settle which is right. - The full `shader_recompiler_compute_tests` run stops at `IndirectBufferStore` on Linux/RADV, on `main` 1a053f9e as well, so it does not show this change either way. - GPU timings (timestamp queries per dispatch, on my local performance branch, same shaders): `0x0c9a138927bbc375` 3.14 ms -> 1.97 ms, `0x0a5a927c752c1ed7` 2.21 ms -> 0.91 ms; compute time per frame 23.1 ms -> 18.7 ms. Screenshots with and without the change look the same. - SAROS on this branch (rebased onto `main` f492027b) plus #1760, which SAROS needs to reach gameplay on Linux: reaches gameplay and renders the same scene as `main`. Not built or tested on Windows. ## AI use Claude Code profiled the shaders and wrote the change, i ran the tests and the game runs above. Runs stable at about 16fps on my 9070Xt 7800x3D linux machine with some graphical glitches such as missing textures and shader bugs but it is technicaly playable as far as i have played (about 1h into the game) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
V_MIN_F32, V_MAX_F32, V_MIN3_F32 and V_MAX3_F32 were emulated with a
classify-and-select sequence of about a dozen instructions each, to give
the guest's NaN and signed-zero results on any host. AMD GPUs execute
GLSL.std.450 NMin/NMax with those same rules, so emit them directly when
the device is AMD and supports VK_KHR_shader_float_controls2. Each
instruction is decorated FPFastMathMode None, since
SignedZeroInfNanPreserve does not cover extended instructions. MED3 keeps
its exact emulation. KYTY_EMULATED_FLOAT_MIN_MAX=1 keeps the emulation.

In SAROS the two heaviest compute shaders get 37% and 59% faster on an
RX 9070 XT (RADV), about 4 ms of GPU time per frame.

Adds VectorMinMaxF32RuntimeEdges (runtime operands, so nothing is folded)
and a --float-min-max-only mode that runs it and
VectorMinMaxF32NanAndSignedZeroEdges with the emulation and, where
supported, with host instructions.

Developed with AI assistance (Claude Code).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:05:02 +00:00
github manually merged commit 64a7f7ae60 into gh-pr/1761/base 2026-11-26 10:05:03 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-20 13:50 UTC · original · edited 2026-10-21 19:34 UTC

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

  • Last reviewed commit: 1aa2f4734be489384937a778b551f6d3017b2580
  • Latest commit, not reviewed: 64a7f7ae60

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

The SPIR-V recompiler now uses a capability profile for maintenance-8 and native float min/max support. Vulkan initialization stores the physical-device driver ID, and ProgramCache enables native min/max for Mesa RADV. The emitter uses NMin and NMax when enabled and retains the existing fallback. Compute tests cover runtime edge cases for wave sizes 32 and 64. CTest registers the targeted test mode.

Suggested reviewers: nmzik

Priority: ⚪ Pending latest changes

Change: Feature

Merge Risk: 🟡 Moderate · up to 1aa2f

Native float min/max is now the default on AMD RADV, but nothing guarantees it handles NaN and signed zero like the previous implementation. This could cause subtle rendering differences. Gate native emission on the proper float-controls support, or keep emulation, before merging.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 10 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: using host float min/max instructions on AMD GPUs.
Description check Passed The description directly explains the AMD float min/max optimization, Vulkan capability requirements, testing, performance results, and known limitations.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 10 files. (2 skipped: 2 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-20 13:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1761#issuecomment-6292437353) · edited 2026-10-21 19:34 UTC <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1761?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- This is an auto-generated comment: review paused by coderabbit.ai --> > [!NOTE] > ## Reviews paused > > It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the `reviews.auto_review.auto_pause_after_reviewed_commits` setting. > > - Last reviewed commit: 1aa2f4734be489384937a778b551f6d3017b2580 > - Latest commit, not reviewed: 64a7f7ae60248484c70fa5f7e38992f3cec7de16 > > Use the following commands to manage reviews: > - `@coderabbitai resume` to resume automatic reviews. > - `@coderabbitai review` to trigger a single review. > > Use the checkboxes below for quick actions: > - [ ] <!-- {"checkboxId":"7f6cc2e2-2e4e-497a-8c31-c9e4573e93d1"} --> ▶️ Resume reviews > - [ ] <!-- {"checkboxId":"e9bb8d72-00e8-4f67-9cb2-caf3b22574fe"} --> 🔍 Trigger review <!-- end of auto-generated comment: review paused by coderabbit.ai --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> The SPIR-V recompiler now uses a capability profile for maintenance-8 and native float min/max support. Vulkan initialization stores the physical-device driver ID, and `ProgramCache` enables native min/max for Mesa RADV. The emitter uses `NMin` and `NMax` when enabled and retains the existing fallback. Compute tests cover runtime edge cases for wave sizes 32 and 64. CTest registers the targeted test mode. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⚪ Pending latest changes <!-- change_assessment_commit:"1aa2f4734be489384937a778b551f6d3017b2580" --> **Change:** Feature <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>🟡 Moderate</strong> · up to <code>1aa2f</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🟡 Moderate** · up to `1aa2f` --> <!-- final_review_risk_coverage:{"sourceCommitId":"1aa2f4734be489384937a778b551f6d3017b2580","coveredCommitId":"1aa2f4734be489384937a778b551f6d3017b2580","kind":"reviewed"} --> Native float min/max is now the default on AMD RADV, but nothing guarantees it handles NaN and signed zero like the previous implementation. This could cause subtle rendering differences. Gate native emission on the proper float-controls support, or keep emulation, before merging. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-inconclusive-14-v2.svg" width="14" height="14" align="middle" alt="Inconclusive" title="Inconclusive"></picture></sup> 1</strong></summary> <dl> <dd> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 inconclusive</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :--------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Inconclusive](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-inconclusive.svg) | Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 10 files. (2 skipped:… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks: 4 passed</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly summarizes the main change: using host float min/max instructions on AMD GPUs. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains the AMD float min/max optimization, Vulkan capability requirements, testing, performance results, and known limitations. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 10 files. (2 skipped: 2 too large.) **Resolution** Write docstrings for the functions missing them to satisfy the coverage threshold. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1761)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -116,0 +116,4 @@
if (state.profile.native_float_min_max) {
const auto result = state.builder.AllocateId();
state.builder.AddFunction(spv::OpExtInst, TypeF32(state), result, GlslStd450(state),
max_value ? GLSLstd450NMax : GLSLstd450NMin, lhs, rhs);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-20 13:50 UTC · original

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Inspect module generation and device checks for float-controls guarantees.
rg -n -C 4 'SPV_KHR_float_controls2|FloatControls2|SignedZeroInfNanPreserve|SetNativeFloatMinMax|EmitProgram\s*\(' src/graphics

Repository: KytyPS5/KytyPS5

Length of output: 12985


🏁 Script executed:

#!/bin/bash
set -o pipefail

printf '%s\n' '--- module setup ---'
sed -n '710,845p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp

printf '%s\n' '--- Vulkan feature setup and native selection ---'
sed -n '560,640p' src/graphics/presentation/window/vulkanWindow.cpp
sed -n '980,1030p' src/graphics/presentation/window/vulkanWindow.cpp

printf '%s\n' '--- native/emulated min-max implementation ---'
sed -n '1,180p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp

printf '%s\n' '--- base-to-head diff for relevant files ---'
git diff --no-ext-diff --unified=30 1a053f9e13405bf34171a47aae9f2b9a6e7afd7d 7306c56e27e1021954d54c61febda8c6f58db6c0 -- \
  src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp \
  src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h \
  src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp \
  src/graphics/presentation/window/vulkanWindow.cpp

Repository: KytyPS5/KytyPS5

Length of output: 36270


🏁 Script executed:

#!/bin/bash
set -o pipefail
printf '%s\n' '--- float-controls declarations and feature queries ---'
rg -n -C 8 --glob '*.{cpp,h,hpp}' -e 'float_controls' -e 'shaderSignedZeroInfNanPreserveFloat32' -e 'SignedZeroInfNanPreserve' -e 'RequiredVulkan12Features' -e 'VulkanFindPhysicalDevice' src/graphics

printf '%s\n' '--- relevant Vulkan setup before device creation ---'
sed -n '1,180p' src/graphics/presentation/window/vulkanWindow.cpp
rg -n -C 12 'vk::PhysicalDeviceFloatControlsProperties|PhysicalDeviceVulkan12Features|floatControls|float_controls' src/graphics

Repository: KytyPS5/KytyPS5

Length of output: 41590


🌐 Web query:

official Khronos GLSL.std.450 NMin NMax SignedZeroInfNanPreserve SPV_KHR_float_controls2 semantics

💡 Result:

<source_evidence>
<source kind="find_in_page">
<title>SPIR-V Extended Instructions for GLSL</title>
<location>https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html</location>
<excerpt>citeturn2view1 [wordlim: 200] Crawled: today; Content type: text/html; Source: find({&quot;ref_id&quot;:&quot;turn1view0&quot;,&quot;pattern&quot;:&quot;NMax&quot;}); Total lines: 548
L395: Value
L397: Signed-integer most-significant bit, with Value interpreted as a signed integer. For positive numbers, the result is the bit number of the most significant 1-bit. For negative numbers, the result is the bit number of the most significant 0-bit. For a Value of 0 or -1, the result has all bits set (e.g., -1 if interpreted as signed). Result Type and the type of Value must both be integer scalar or integer vector types.
L398: Result Type and operand types must have the same number of components with the same component width. Results are computed per component. This instruction is currently limited to 32-bit width components.
L399: 74  | &lt;id&gt;
L400: Value
L401: FindUMsb
L402: Unsigned-integer most-significant bit. Results in the bit number of the most-significant 1-bit in the binary representation of Value. If Value is 0, the result has all bits set (e.g., -1 if interpreted as signed). Result Type and the type of Value must both be integer scalar or integer vector types. Result Type and operand types must have the same number of components with the same component width. Results are computed per component. This instruction is currently limited to 32-bit width components.
L403: 75  | &lt;id&gt;
L404: Value
L405: InterpolateAtCentroid
L406: Result is the value of the input interpolant sampled at a location inside both the fragment and the primitive being processed. The value obtained would be the same value assigned to the input variable if it were decorated as Centroid. The operand interpolant must be a pointer to the Input Storage Class. The operand interpolant must be a pointer to a scalar or vector whose component type is 32-bit floating-point. This instruction is only valid in the Fragment execution model.
L407: Result Type and the type that interpolant points to must be the same type. Use of this instruction requires declaration of the InterpolationFunction capability.
L408: 76  | &lt;id&gt;
L409: interpolant
L410: InterpolateAtSample
L411: Result is the value of the input interpolant variable at the location of sample number sample. If sample sample does not exist, the position used to interpolate the input variable is poison. The operand interpolant must be a pointer to the Input Storage Class. The operand interpolant must be a pointer to a scalar or vector whose component type is 32-bit floating-point. This instruction is only valid in the Fragment execution model. The sample operand must be a scalar 32-bit integer.
L412: Result Type and the type that interpolant points to must be the same type. Use of this instruction requires declaration of the InterpolationFunction capability.
L413: 77  | &lt;id&gt;
L414: interpolant  | &lt;id&gt;
L415: sample
L416: InterpolateAtOffset
L417: Result is the value of the input interpolant variable sampled at an offset from the center of the fragment specified by offset. The two floating-point components of offset, give the offset in pixels in the x and y directions, respectively. An offset of (0, 0) identifies the center of the fragment. The range and granularity of offsets supported are implementation-dependent. The operand interpolant must be a pointer to the Input Storage Class.
L418: The operand interpolant must be a pointer to a scalar or vector whose component type is 32-bit floating-point. This instruction is only valid in the Fragment execution model. The offset operand must be a vector of 2 components of 32-bit floating-point type. Result Type and the type that interpolant points to must be the same type. Use of this instruction requires declaration of the InterpolationFunction capability.
L419: 78  | &lt;id&gt;
L420: interpolant  | &lt;id&gt;
L421: offset
L422: NMin
L423: Result is y if y &lt; x, otherwise x. -0 compares less than +0. If one operand is a NaN, the …[truncated]</excerpt>
</source>
<source kind="open_page">
<title>SPIR-V Extended Instructions for GLSL</title>
<location>https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html</location>
<excerpt>citeturn1view0 [wordlim: 200] Crawled: today; Content type: text/html; Source: open({&quot;ref_id&quot;:&quot;turn0search0&quot;,&quot;lineno&quot;:null}); Total lines: 548
L35: Parties desiring to implement the Specification and make use of Khronos trademarks in relation to that implementation, and receive reciprocal patent license protection under the Khronos Intellectual Property Rights Policy must become Adopters and confirm the implementation as conformant under the process defined by Khronos for this Specification; see 【23†https://www.khronos.org/adopters†www.khronos.org】.
L36: This Specification contains substantially unmodified functionality from, and is a successor to, Khronos specifications including all versions of “The SPIR Specification”, “The OpenGL Shading Language”, and “The OpenGL ES Shading Language”, as well as all Khronos OpenCL API and OpenCL programming language specifications.
L37: 
L38: The Khronos Intellectual Property Rights Policy defines the terms &#39;Scope&#39;, &#39;Compliant Portion&#39;, and &#39;Necessary Patent Claims&#39;.
L39: Where this Specification uses technical terminology, defined in the Glossary or otherwise, that refer to enabling technologies that are not expressly set forth in this Specification, those enabling technologies are EXCLUDED from the Scope of this Specification. For clarity, enabling technologies not disclosed with particularity in this Specification (e.g.
L40: semiconductor manufacturing technology, hardware architecture, processor architecture or microarchitecture, memory architecture, compiler technology, object oriented technology, basic operating system technology, compression technology, algorithms, and so on) are NOT to be considered expressly set forth; only those application program interfaces and data structures disclosed with particularity are included in the Scope of this Specification.
L41: For purposes of the Khronos Intellectual Property Rights Policy as it relates to the definition of Necessary Patent Claims, all recommended or optional features, behaviors and functionality set forth in this Specification, if implemented, are considered to be included as Compliant Portions.
L42: Where this Specification identifies specific sections of external references, only those specifically identified sections define normative functionality. The Khronos Intellectual Property Rights Policy excludes external references to materials and associated enabling technology not created by Khronos from the Scope of this Specification, and any licenses that may be required to implement such referenced materials and associated technologies must be obtained separately and may involve royalty payments.
L43: Khronos and Vulkan are registered trademarks, and SPIR, SPIR-V, and SYCL are trademarks of The Khronos Group Inc. OpenCL is a trademark of Apple Inc., used under license by Khronos. OpenGL is a registered trademark and the OpenGL ES logo is a trademark of Hewlett Packard Enterprise, used under license by Khronos. All other product names, trademarks, and/or company names are used solely for identification and belong to their respective owners.
L44: ## 1. Introduction
L45: 
L46: This specifies the GLSL.std.450 extended instruction set. It provides instructions for the GLSL built-in functions that do not directly map to native SPIR-V instructions.
L47: 
L48: Import this extended instruction set using an OpExtInstImport &quot;GLSL.std.450&quot; instruction.
L49: 
L50: Where requirements are written in the form f(±x) = ±y, this means that f(x) = y and f(-x) = -y.
L51: 
L52: In this specification, a floating-point type is any OpTypeFloat using the IEEE 754 encoding.
L53: Note  | These instructions may specify their behavior for special floating-point values such as -0.0, Infinities or NaN. Such values can only be reliably observed when SPV_KHR_float_controls2 is used because the SignedZeroInfNaNPreserve execution mode does not apply to these instructions and by defaul…[truncated]</excerpt>
</source>
<source kind="open_page">
<title>SPV_KHR_float_controls2</title>
<location>https://github.khronos.org/SPIRV-Registry/extensions/KHR/SPV_KHR_float_controls2.html</location>
<excerpt>citeturn1view1 [wordlim: 200] Crawled: today; Content type: text/html; Source: open({&quot;ref_id&quot;:&quot;turn0search2&quot;,&quot;lineno&quot;:null}); Total lines: 179
L0: # SPV_KHR_float_controls2
L1: 
L2: Table of Contents
L3: 
L4:   * 【0†Name Strings】
L5:   * 【1†Contact】
L6:   * 【2†Contributors】
L7:   * 【3†Notice】
L8:   * 【4†Status】
L9:   * 【5†Version】
L10:   * 【6†Dependencies】
L11:   * 【7†Overview】
L12:   * 【8†Extension Name】
L13:   * 【9†Modifications to the SPIR-V Specification, Version 1.6】
L14:   * 【10†Modifications to the GLSL.std.450 Extended Instruction Set】
L15:   * 【11†Deprecation】
L16:   * 【12†Issues】
L17:   * 【13†Revision History】
L18: 
L19: ## Name Strings
L20: 
L21: SPV_KHR_float_controls2
L22: ## Contact
L23: 
L24: To report problems with this extension, please open a new issue at:
L25: 
L26: 【14†https://github.com/KhronosGroup/SPIRV-Registry†github.com】
L27: 
L28: ## Contributors
L29: 
L30:   * Graeme Leese, Broadcom
L31: 
L32:   * Ben Ashbaugh, Intel
L33: 
L34:   * Alan Baker, Google
L35: 
L36:   * David Neto, Google
L37: 
L38:   * Ruihao Zhang, Qualcomm
L39: 
L40: ## Notice
L41: 
L42: Copyright (c) 2021 The Khronos Group Inc. Copyright terms at 【15†http://www.khronos.org/registry/speccopyright.html†www.khronos.org】
L43: ## Status
L44: 
L45:   * Approved by the SPIR-V Working Group: 2023-12-06
L46: 
L47:   * Approved by the Khronos Board of Promoters: 2024-01-19
L48: 
L49: ## Version
L50: 
L51: Last Modified Date  | 2024-04-03
L52: Revision  | 10
L53: 
L54: ## Dependencies
L55: 
L56: This extension is written against the SPIR-V Specification, Version 1.6 Revision 1, Unified
L57: 
L58: This extension requires SPIR-V 1.2.
L59: 
L60: This extension interacts trivially with SPV_KHR_float_controls (which became core in SPIR-V 1.4).
L61: 
L62: This extension supersedes SPV_INTEL_fp_fast_math_mode.
L63: ## Overview
L64: 
L65: This extension provides a single mechanism for specifying the floating-point environment which can be used on whole modules and individual instructions. It is designed to supersede the various existing ways of specifying different modifications to the floating-point semantics.
L66: 
L67: ## Extension Name
L68: 
L69: To use this extension within a SPIR-V module, the following OpExtension must be present in the module:
L70: 
L71:     OpExtension &quot;SPV_KHR_float_controls2&quot;
L72: ## Modifications to the SPIR-V Specification, Version 1.6
L73: ### Universal Validation Rules
L74: 
L75: In section 2.16.1 &quot;Universal Validation Rules&quot; add the rules:
L76: 
L77:   * It is not valid for an entry point using the FPFastMathDefault execution mode to:
L78: 
L79:     * Use the execution modes ContractionOff or SignedZeroInfNanPreserve.
L80: 
L81:     * Contain any instructions decorated with NoContraction.
L82: 
L83:     * Contain any FP Fast Math Mode bitmask containing Fast.
L84: 
L85:   * It is not valid for any instruction to be decorated with both NoContraction and FPFastMathMode.
L86:   * Any FP Fast Math Mode bitmask that includes the AllowTransform bit must also include the AllowContract and AllowReassoc bits.
L87: ### Execution Mode
L88: 
L89: In section 3.6 &quot;Execution Mode&quot; add the following row to the Execution Mode table:
L90: Execution Mode  | Extra Operands  | 【16†Enabling Capabilities】
L91: --- | --- | ---
L92: 6028  | FPFastMathDefault
L93: Set the default fast math flags for instructions not themselves decorated with FPFastMathMode. This only affects instructions operating on or resulting in a type that is Target Type or an OpTypeMatrix or OpTypeVector derived from it. Target Type must be a scalar, floating-point type. Fast-Math Mode must be the &lt;id&gt; of a 【17†constant instruction】 of 32-bit integer type containing a valid 【18†FP Fast Math Mode】 bitmask. Fast-Math Mode must not be a specialization-constant instruction.
L94: May be applied at most once per Target Type to any execution mode.  | &lt;id&gt;
L95: Target Type  | &lt;id&gt;
L96: Fas…[truncated]</excerpt>
</source>
<source kind="search">
<title>SPIR-V Extended Instructions for GLSL</title>
<location>https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html</location>
<excerpt>citeturn0search0 [wordlim: 200] Crawled: last month; Import this extended instruction set using an OpExtInstImport &quot;GLSL.std.450&quot; instruction. ... Such values can only be reliably observed when SPV_KHR_float_controls2 is used because the SignedZeroInfNaNPreserve execution mode does not apply to these instructions and by default these special values may be ignored.
# SPIR-V Extended Instructions for GLSL

John Kessenich, Google
version 1.00, Revision 17


## 1. Introduction

This specifies the GLSL.std.450 extended instruction set. It provides instructions for the GLSL built-in functions that do not directly map to native SPIR-V instructions.

Import this extended instruction set using an OpExtInstImport &quot;GLSL.std.450&quot; instruction.

Where requirements are written in the form f(±x) = ±y, this means that f(x) = y and f(-x) = -y.

In this specification, a floating-point type is any OpTypeFloat using the IEEE 754 encoding.

Note  | These instructions may specify their behavior for special floating-point values such as -0.0, Infinities or NaN. Such values can only be reliably observed when SPV_KHR_float_controls2 is used because the SignedZeroInfNaNPreserve execution mode does not apply to these instructions and by default these special values may be ignored. In some cases, client APIs may allow an error bound for results which may include values other than the reference value given.
</excerpt>
</source>
<source kind="search">
<title>SPV_KHR_float_controls2</title>
<location>https://github.khronos.org/SPIRV-Registry/extensions/KHR/SPV_KHR_float_controls2.html</location>
<excerpt>citeturn0search2 [wordlim: 200] Crawled: 2 weeks ago; ## Modifications to the GLSL.std.450 Extended Instruction Set ... Use fmin, fmax with NInf and NNaN instead. ... 1  | 2021-09-15  | Graeme Leese  | Initial KHR extension.
## Modifications to the GLSL.std.450 Extended Instruction Set

### Introduction

Following the introduction, add &quot;For environments that allow use of FPFastMathMode decorations on OpExtInst instructions, FPFastMathMode decorations may be applied to any instruction which uses any floating-point type for either operands or result&quot;.

## Deprecation

This extension deprecates the following features:

  * The execution modes ContractionOff and SignedZeroInfNanPreserve. Use FPFastMathDefault with the appropriate flags instead.

  * The decoration NoContraction. Use the FPFastMathMode decoration instead.

  * The FPFastMathMode mode bit Fast. Set all the other FPFastMathMode bits instead.

  * Enabling the FPFastMathMode decoration using the Kernel capability. All uses should declare the FloatControls2 capability.

  * The OpenCL.std instructions fmin_common, fmax_common. Use fmin, fmax with NInf and NNaN instead.

## Issues

  1. How does this interact with SPV_INTEL_fp_fast_math_mode?

RESOLVED: It supersedes it. This extension contains a superset of the functionality and is expected to be supported on a wider range of implementations, but applications targeting only Intel platforms can continue to use the older extension.
</excerpt>
</source>
<omitted_sources count="36">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>

Citations:

- 1: https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html
- 2: https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html
- 3: https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html
- 4: https://github.khronos.org/SPIRV-Registry/extensions/KHR/SPV_KHR_float_controls2.html
- 5: https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html

Gate native NMin and NMax on SPV_KHR_float_controls2 support.

GLSL.std.450 states that SignedZeroInfNanPreserve does not apply to its extended instructions. Special values may be ignored unless SPV_KHR_float_controls2 is used. This module emits only SPV_KHR_float_controls and enables native min/max for every AMD vendor-ID match. NaN and signed-zero results can therefore differ from the emulation path. Gate native min/max on the required float-controls2 support, or retain emulation when that support is unavailable.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-20 13:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1761#discussion_r4325733919) **🎯 Functional Correctness** | **🟠 Major** | **🏗️ Heavy lift** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash # Inspect module generation and device checks for float-controls guarantees. rg -n -C 4 'SPV_KHR_float_controls2|FloatControls2|SignedZeroInfNanPreserve|SetNativeFloatMinMax|EmitProgram\s*\(' src/graphics ``` Repository: KytyPS5/KytyPS5 Length of output: 12985 --- 🏁 Script executed: ```bash #!/bin/bash set -o pipefail printf '%s\n' '--- module setup ---' sed -n '710,845p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp printf '%s\n' '--- Vulkan feature setup and native selection ---' sed -n '560,640p' src/graphics/presentation/window/vulkanWindow.cpp sed -n '980,1030p' src/graphics/presentation/window/vulkanWindow.cpp printf '%s\n' '--- native/emulated min-max implementation ---' sed -n '1,180p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp printf '%s\n' '--- base-to-head diff for relevant files ---' git diff --no-ext-diff --unified=30 1a053f9e13405bf34171a47aae9f2b9a6e7afd7d 7306c56e27e1021954d54c61febda8c6f58db6c0 -- \ src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp \ src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h \ src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp \ src/graphics/presentation/window/vulkanWindow.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 36270 --- 🏁 Script executed: ```bash #!/bin/bash set -o pipefail printf '%s\n' '--- float-controls declarations and feature queries ---' rg -n -C 8 --glob '*.{cpp,h,hpp}' -e 'float_controls' -e 'shaderSignedZeroInfNanPreserveFloat32' -e 'SignedZeroInfNanPreserve' -e 'RequiredVulkan12Features' -e 'VulkanFindPhysicalDevice' src/graphics printf '%s\n' '--- relevant Vulkan setup before device creation ---' sed -n '1,180p' src/graphics/presentation/window/vulkanWindow.cpp rg -n -C 12 'vk::PhysicalDeviceFloatControlsProperties|PhysicalDeviceVulkan12Features|floatControls|float_controls' src/graphics ``` Repository: KytyPS5/KytyPS5 Length of output: 41590 --- 🌐 Web query: `official Khronos GLSL.std.450 NMin NMax SignedZeroInfNanPreserve SPV_KHR_float_controls2 semantics` 💡 Result: ``` <source_evidence> <source kind="find_in_page"> <title>SPIR-V Extended Instructions for GLSL</title> <location>https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html</location> <excerpt>citeturn2view1 [wordlim: 200] Crawled: today; Content type: text/html; Source: find({&quot;ref_id&quot;:&quot;turn1view0&quot;,&quot;pattern&quot;:&quot;NMax&quot;}); Total lines: 548 L395: Value L397: Signed-integer most-significant bit, with Value interpreted as a signed integer. For positive numbers, the result is the bit number of the most significant 1-bit. For negative numbers, the result is the bit number of the most significant 0-bit. For a Value of 0 or -1, the result has all bits set (e.g., -1 if interpreted as signed). Result Type and the type of Value must both be integer scalar or integer vector types. L398: Result Type and operand types must have the same number of components with the same component width. Results are computed per component. This instruction is currently limited to 32-bit width components. L399: 74 | &lt;id&gt; L400: Value L401: FindUMsb L402: Unsigned-integer most-significant bit. Results in the bit number of the most-significant 1-bit in the binary representation of Value. If Value is 0, the result has all bits set (e.g., -1 if interpreted as signed). Result Type and the type of Value must both be integer scalar or integer vector types. Result Type and operand types must have the same number of components with the same component width. Results are computed per component. This instruction is currently limited to 32-bit width components. L403: 75 | &lt;id&gt; L404: Value L405: InterpolateAtCentroid L406: Result is the value of the input interpolant sampled at a location inside both the fragment and the primitive being processed. The value obtained would be the same value assigned to the input variable if it were decorated as Centroid. The operand interpolant must be a pointer to the Input Storage Class. The operand interpolant must be a pointer to a scalar or vector whose component type is 32-bit floating-point. This instruction is only valid in the Fragment execution model. L407: Result Type and the type that interpolant points to must be the same type. Use of this instruction requires declaration of the InterpolationFunction capability. L408: 76 | &lt;id&gt; L409: interpolant L410: InterpolateAtSample L411: Result is the value of the input interpolant variable at the location of sample number sample. If sample sample does not exist, the position used to interpolate the input variable is poison. The operand interpolant must be a pointer to the Input Storage Class. The operand interpolant must be a pointer to a scalar or vector whose component type is 32-bit floating-point. This instruction is only valid in the Fragment execution model. The sample operand must be a scalar 32-bit integer. L412: Result Type and the type that interpolant points to must be the same type. Use of this instruction requires declaration of the InterpolationFunction capability. L413: 77 | &lt;id&gt; L414: interpolant | &lt;id&gt; L415: sample L416: InterpolateAtOffset L417: Result is the value of the input interpolant variable sampled at an offset from the center of the fragment specified by offset. The two floating-point components of offset, give the offset in pixels in the x and y directions, respectively. An offset of (0, 0) identifies the center of the fragment. The range and granularity of offsets supported are implementation-dependent. The operand interpolant must be a pointer to the Input Storage Class. L418: The operand interpolant must be a pointer to a scalar or vector whose component type is 32-bit floating-point. This instruction is only valid in the Fragment execution model. The offset operand must be a vector of 2 components of 32-bit floating-point type. Result Type and the type that interpolant points to must be the same type. Use of this instruction requires declaration of the InterpolationFunction capability. L419: 78 | &lt;id&gt; L420: interpolant | &lt;id&gt; L421: offset L422: NMin L423: Result is y if y &lt; x, otherwise x. -0 compares less than +0. If one operand is a NaN, the …[truncated]</excerpt> </source> <source kind="open_page"> <title>SPIR-V Extended Instructions for GLSL</title> <location>https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html</location> <excerpt>citeturn1view0 [wordlim: 200] Crawled: today; Content type: text/html; Source: open({&quot;ref_id&quot;:&quot;turn0search0&quot;,&quot;lineno&quot;:null}); Total lines: 548 L35: Parties desiring to implement the Specification and make use of Khronos trademarks in relation to that implementation, and receive reciprocal patent license protection under the Khronos Intellectual Property Rights Policy must become Adopters and confirm the implementation as conformant under the process defined by Khronos for this Specification; see 【23†https://www.khronos.org/adopters†www.khronos.org】. L36: This Specification contains substantially unmodified functionality from, and is a successor to, Khronos specifications including all versions of “The SPIR Specification”, “The OpenGL Shading Language”, and “The OpenGL ES Shading Language”, as well as all Khronos OpenCL API and OpenCL programming language specifications. L37: L38: The Khronos Intellectual Property Rights Policy defines the terms &#39;Scope&#39;, &#39;Compliant Portion&#39;, and &#39;Necessary Patent Claims&#39;. L39: Where this Specification uses technical terminology, defined in the Glossary or otherwise, that refer to enabling technologies that are not expressly set forth in this Specification, those enabling technologies are EXCLUDED from the Scope of this Specification. For clarity, enabling technologies not disclosed with particularity in this Specification (e.g. L40: semiconductor manufacturing technology, hardware architecture, processor architecture or microarchitecture, memory architecture, compiler technology, object oriented technology, basic operating system technology, compression technology, algorithms, and so on) are NOT to be considered expressly set forth; only those application program interfaces and data structures disclosed with particularity are included in the Scope of this Specification. L41: For purposes of the Khronos Intellectual Property Rights Policy as it relates to the definition of Necessary Patent Claims, all recommended or optional features, behaviors and functionality set forth in this Specification, if implemented, are considered to be included as Compliant Portions. L42: Where this Specification identifies specific sections of external references, only those specifically identified sections define normative functionality. The Khronos Intellectual Property Rights Policy excludes external references to materials and associated enabling technology not created by Khronos from the Scope of this Specification, and any licenses that may be required to implement such referenced materials and associated technologies must be obtained separately and may involve royalty payments. L43: Khronos and Vulkan are registered trademarks, and SPIR, SPIR-V, and SYCL are trademarks of The Khronos Group Inc. OpenCL is a trademark of Apple Inc., used under license by Khronos. OpenGL is a registered trademark and the OpenGL ES logo is a trademark of Hewlett Packard Enterprise, used under license by Khronos. All other product names, trademarks, and/or company names are used solely for identification and belong to their respective owners. L44: ## 1. Introduction L45: L46: This specifies the GLSL.std.450 extended instruction set. It provides instructions for the GLSL built-in functions that do not directly map to native SPIR-V instructions. L47: L48: Import this extended instruction set using an OpExtInstImport &quot;GLSL.std.450&quot; instruction. L49: L50: Where requirements are written in the form f(±x) = ±y, this means that f(x) = y and f(-x) = -y. L51: L52: In this specification, a floating-point type is any OpTypeFloat using the IEEE 754 encoding. L53: Note | These instructions may specify their behavior for special floating-point values such as -0.0, Infinities or NaN. Such values can only be reliably observed when SPV_KHR_float_controls2 is used because the SignedZeroInfNaNPreserve execution mode does not apply to these instructions and by defaul…[truncated]</excerpt> </source> <source kind="open_page"> <title>SPV_KHR_float_controls2</title> <location>https://github.khronos.org/SPIRV-Registry/extensions/KHR/SPV_KHR_float_controls2.html</location> <excerpt>citeturn1view1 [wordlim: 200] Crawled: today; Content type: text/html; Source: open({&quot;ref_id&quot;:&quot;turn0search2&quot;,&quot;lineno&quot;:null}); Total lines: 179 L0: # SPV_KHR_float_controls2 L1: L2: Table of Contents L3: L4: * 【0†Name Strings】 L5: * 【1†Contact】 L6: * 【2†Contributors】 L7: * 【3†Notice】 L8: * 【4†Status】 L9: * 【5†Version】 L10: * 【6†Dependencies】 L11: * 【7†Overview】 L12: * 【8†Extension Name】 L13: * 【9†Modifications to the SPIR-V Specification, Version 1.6】 L14: * 【10†Modifications to the GLSL.std.450 Extended Instruction Set】 L15: * 【11†Deprecation】 L16: * 【12†Issues】 L17: * 【13†Revision History】 L18: L19: ## Name Strings L20: L21: SPV_KHR_float_controls2 L22: ## Contact L23: L24: To report problems with this extension, please open a new issue at: L25: L26: 【14†https://github.com/KhronosGroup/SPIRV-Registry†github.com】 L27: L28: ## Contributors L29: L30: * Graeme Leese, Broadcom L31: L32: * Ben Ashbaugh, Intel L33: L34: * Alan Baker, Google L35: L36: * David Neto, Google L37: L38: * Ruihao Zhang, Qualcomm L39: L40: ## Notice L41: L42: Copyright (c) 2021 The Khronos Group Inc. Copyright terms at 【15†http://www.khronos.org/registry/speccopyright.html†www.khronos.org】 L43: ## Status L44: L45: * Approved by the SPIR-V Working Group: 2023-12-06 L46: L47: * Approved by the Khronos Board of Promoters: 2024-01-19 L48: L49: ## Version L50: L51: Last Modified Date | 2024-04-03 L52: Revision | 10 L53: L54: ## Dependencies L55: L56: This extension is written against the SPIR-V Specification, Version 1.6 Revision 1, Unified L57: L58: This extension requires SPIR-V 1.2. L59: L60: This extension interacts trivially with SPV_KHR_float_controls (which became core in SPIR-V 1.4). L61: L62: This extension supersedes SPV_INTEL_fp_fast_math_mode. L63: ## Overview L64: L65: This extension provides a single mechanism for specifying the floating-point environment which can be used on whole modules and individual instructions. It is designed to supersede the various existing ways of specifying different modifications to the floating-point semantics. L66: L67: ## Extension Name L68: L69: To use this extension within a SPIR-V module, the following OpExtension must be present in the module: L70: L71: OpExtension &quot;SPV_KHR_float_controls2&quot; L72: ## Modifications to the SPIR-V Specification, Version 1.6 L73: ### Universal Validation Rules L74: L75: In section 2.16.1 &quot;Universal Validation Rules&quot; add the rules: L76: L77: * It is not valid for an entry point using the FPFastMathDefault execution mode to: L78: L79: * Use the execution modes ContractionOff or SignedZeroInfNanPreserve. L80: L81: * Contain any instructions decorated with NoContraction. L82: L83: * Contain any FP Fast Math Mode bitmask containing Fast. L84: L85: * It is not valid for any instruction to be decorated with both NoContraction and FPFastMathMode. L86: * Any FP Fast Math Mode bitmask that includes the AllowTransform bit must also include the AllowContract and AllowReassoc bits. L87: ### Execution Mode L88: L89: In section 3.6 &quot;Execution Mode&quot; add the following row to the Execution Mode table: L90: Execution Mode | Extra Operands | 【16†Enabling Capabilities】 L91: --- | --- | --- L92: 6028 | FPFastMathDefault L93: Set the default fast math flags for instructions not themselves decorated with FPFastMathMode. This only affects instructions operating on or resulting in a type that is Target Type or an OpTypeMatrix or OpTypeVector derived from it. Target Type must be a scalar, floating-point type. Fast-Math Mode must be the &lt;id&gt; of a 【17†constant instruction】 of 32-bit integer type containing a valid 【18†FP Fast Math Mode】 bitmask. Fast-Math Mode must not be a specialization-constant instruction. L94: May be applied at most once per Target Type to any execution mode. | &lt;id&gt; L95: Target Type | &lt;id&gt; L96: Fas…[truncated]</excerpt> </source> <source kind="search"> <title>SPIR-V Extended Instructions for GLSL</title> <location>https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html</location> <excerpt>citeturn0search0 [wordlim: 200] Crawled: last month; Import this extended instruction set using an OpExtInstImport &quot;GLSL.std.450&quot; instruction. ... Such values can only be reliably observed when SPV_KHR_float_controls2 is used because the SignedZeroInfNaNPreserve execution mode does not apply to these instructions and by default these special values may be ignored. # SPIR-V Extended Instructions for GLSL John Kessenich, Google version 1.00, Revision 17 ## 1. Introduction This specifies the GLSL.std.450 extended instruction set. It provides instructions for the GLSL built-in functions that do not directly map to native SPIR-V instructions. Import this extended instruction set using an OpExtInstImport &quot;GLSL.std.450&quot; instruction. Where requirements are written in the form f(±x) = ±y, this means that f(x) = y and f(-x) = -y. In this specification, a floating-point type is any OpTypeFloat using the IEEE 754 encoding. Note | These instructions may specify their behavior for special floating-point values such as -0.0, Infinities or NaN. Such values can only be reliably observed when SPV_KHR_float_controls2 is used because the SignedZeroInfNaNPreserve execution mode does not apply to these instructions and by default these special values may be ignored. In some cases, client APIs may allow an error bound for results which may include values other than the reference value given. </excerpt> </source> <source kind="search"> <title>SPV_KHR_float_controls2</title> <location>https://github.khronos.org/SPIRV-Registry/extensions/KHR/SPV_KHR_float_controls2.html</location> <excerpt>citeturn0search2 [wordlim: 200] Crawled: 2 weeks ago; ## Modifications to the GLSL.std.450 Extended Instruction Set ... Use fmin, fmax with NInf and NNaN instead. ... 1 | 2021-09-15 | Graeme Leese | Initial KHR extension. ## Modifications to the GLSL.std.450 Extended Instruction Set ### Introduction Following the introduction, add &quot;For environments that allow use of FPFastMathMode decorations on OpExtInst instructions, FPFastMathMode decorations may be applied to any instruction which uses any floating-point type for either operands or result&quot;. ## Deprecation This extension deprecates the following features: * The execution modes ContractionOff and SignedZeroInfNanPreserve. Use FPFastMathDefault with the appropriate flags instead. * The decoration NoContraction. Use the FPFastMathMode decoration instead. * The FPFastMathMode mode bit Fast. Set all the other FPFastMathMode bits instead. * Enabling the FPFastMathMode decoration using the Kernel capability. All uses should declare the FloatControls2 capability. * The OpenCL.std instructions fmin_common, fmax_common. Use fmin, fmax with NInf and NNaN instead. ## Issues 1. How does this interact with SPV_INTEL_fp_fast_math_mode? RESOLVED: It supersedes it. This extension contains a superset of the functionality and is expected to be supported on a wider range of implementations, but applications targeting only Intel platforms can continue to use the older extension. </excerpt> </source> <omitted_sources count="36">Additional source records were omitted from this bounded result.</omitted_sources> </source_evidence> Citations: - 1: https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html - 2: https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html - 3: https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html - 4: https://github.khronos.org/SPIRV-Registry/extensions/KHR/SPV_KHR_float_controls2.html - 5: https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html ``` --- </details> **Gate native `NMin` and `NMax` on `SPV_KHR_float_controls2` support.** `GLSL.std.450` states that `SignedZeroInfNanPreserve` does not apply to its extended instructions. Special values may be ignored unless `SPV_KHR_float_controls2` is used. This module emits only `SPV_KHR_float_controls` and enables native min/max for every AMD vendor-ID match. NaN and signed-zero results can therefore differ from the emulation path. Gate native min/max on the required float-controls2 support, or retain emulation when that support is unavailable. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:bb12e164edd1a9f604021f1d --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-20 13:50 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 89caa7b4-853e-4475-b518-aa7d6ea3a4d1
📥 Commits

Reviewing files that changed from the base of the PR and between f492027be2 and 7306c56e27e1021954d54c61febda8c6f58db6c0.

📒 Files selected for processing: 5
  • CMakeLists.txt
  • src/graphics/presentation/window/vulkanWindow.cpp
  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp
  • tests/ShaderRecompilerComputeTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-20 13:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1761#pullrequestreview-5585983900) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `89caa7b4-853e-4475-b518-aa7d6ea3a4d1` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between f492027be26db4222eb7cf19eea5536dab2e5f9d and 7306c56e27e1021954d54c61febda8c6f58db6c0. </details> <details> <summary>📒 Files selected for processing: 5</summary> * `CMakeLists.txt` * `src/graphics/presentation/window/vulkanWindow.cpp` * `src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp` * `tests/ShaderRecompilerComputeTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=0a3e3523-fac0-4985-a404-0aa777e477b2 attempt=5cc68015-ce2d-4f21-ba70-8b7b9d6f44f5 batch=1/1 -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 19:03 UTC · original · edited 2026-10-21 19:25 UTC
On src/graphics/presentation/window/vulkanWindow.cpp line 1038 (outdated):

@@ -1005,14 +1020,22 @@ void WindowContext::CreateVulkan() {
 		EXIT("Could not find suitable device:%s", rejected_devices.c_str());
 	}
 
+	vk::PhysicalDeviceDriverProperties         driver_properties {};
 	vk::PhysicalDevicePushDescriptorProperties push_descriptor_properties {};
 	vk::PhysicalDeviceProperties2              physical_device_properties {};
+	push_descriptor_properties.pNext = &driver_properties;
 	physical_device_properties.pNext = &push_descriptor_properties;
 	graphic_ctx.physical_device.getProperties2(&physical_device_properties);
 	graphic_ctx.physical_device_properties = physical_device_properties.properties;
 	graphic_ctx.max_push_descriptors       = push_descriptor_properties.maxPushDescriptors;
 	graphic_ctx.physical_device.getMemoryProperties(&graphic_ctx.physical_device_memory_properties);
 	const auto& device_properties = graphic_ctx.GetPhysicalDeviceProperties();
+	// GLSL.std.450 does not order -0 below +0 in NMin/NMax; RADV runs them as v_min/v_max with
+	// IEEE mode off, which gives the guest's NaN and signed-zero results.
+	Libs::Graphics::ShaderRecompiler::Spirv::SetNativeFloatMinMax(
+	    driver_properties.driverID == vk::DriverId::eMesaRadv &&
+	    graphic_ctx.float_controls2_enabled &&
+	    std::getenv("KYTY_EMULATED_FLOAT_MIN_MAX") == nullptr);

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Select native min/max after device feature detection.

graphic_ctx.float_controls2_enabled is still false here. VulkanCreateDevice sets the flag later, at lines 584–585, but CreateVulkan does not call that function until line 1089. The condition therefore always disables native min/max, including on supported RADV devices. Move SetNativeFloatMinMax after successful device creation so it reads the detected feature value.

✅ Addressed in commit 1aa2f47

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 19:03 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1761#discussion_r4340801580) · edited 2026-10-21 19:25 UTC On `src/graphics/presentation/window/vulkanWindow.cpp` line 1038 (outdated): ```diff @@ -1005,14 +1020,22 @@ void WindowContext::CreateVulkan() { EXIT("Could not find suitable device:%s", rejected_devices.c_str()); } + vk::PhysicalDeviceDriverProperties driver_properties {}; vk::PhysicalDevicePushDescriptorProperties push_descriptor_properties {}; vk::PhysicalDeviceProperties2 physical_device_properties {}; + push_descriptor_properties.pNext = &driver_properties; physical_device_properties.pNext = &push_descriptor_properties; graphic_ctx.physical_device.getProperties2(&physical_device_properties); graphic_ctx.physical_device_properties = physical_device_properties.properties; graphic_ctx.max_push_descriptors = push_descriptor_properties.maxPushDescriptors; graphic_ctx.physical_device.getMemoryProperties(&graphic_ctx.physical_device_memory_properties); const auto& device_properties = graphic_ctx.GetPhysicalDeviceProperties(); + // GLSL.std.450 does not order -0 below +0 in NMin/NMax; RADV runs them as v_min/v_max with + // IEEE mode off, which gives the guest's NaN and signed-zero results. + Libs::Graphics::ShaderRecompiler::Spirv::SetNativeFloatMinMax( + driver_properties.driverID == vk::DriverId::eMesaRadv && + graphic_ctx.float_controls2_enabled && + std::getenv("KYTY_EMULATED_FLOAT_MIN_MAX") == nullptr); ``` <!-- coderabbit-ai-generated:v1 --> **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** **Select native min/max after device feature detection.** `graphic_ctx.float_controls2_enabled` is still `false` here. `VulkanCreateDevice` sets the flag later, at lines 584–585, but `CreateVulkan` does not call that function until line 1089. The condition therefore always disables native min/max, including on supported RADV devices. Move `SetNativeFloatMinMax` after successful device creation so it reads the detected feature value. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:34e86217c317a6ef9c833f12 --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 1aa2f47
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 19:03 UTC · original · edited 2026-10-21 19:11 UTC
On tests/ShaderRecompilerComputeTests.cpp line 20723 (outdated):

@@ -20699,6 +20708,19 @@ class VulkanHarness {
     robustness2.nullDescriptor = true;
     robustness2.pNext = &maintenance8;
     device_info.pNext = &robustness2;
+    // Optional: host float min/max needs float controls 2.
+    for (const auto &extension :
+         m_physical_device.enumerateDeviceExtensionProperties().value) {
+      if (std::strcmp(extension.extensionName,
+                      VK_KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME) == 0)
+        m_float_controls2 = true;
+    }
+    vk::PhysicalDeviceShaderFloatControls2FeaturesKHR float_controls2{};
+    float_controls2.shaderFloatControls2 = true;
+    if (m_float_controls2) {
+      float_controls2.pNext = &robustness2;
+      device_info.pNext = &float_controls2;
+    }

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1995,2017p' tests/ShaderRecompilerComputeTests.cpp
sed -n '20670,20755p' tests/ShaderRecompilerComputeTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 5411


🏁 Script executed:

set -u
printf '%s\n' '--- VulkanHarness references and initialization ---'
rg -n -F --glob 'tests/ShaderRecompilerComputeTests.cpp' -e 'm_float_controls2' -e 'SupportsNativeFloatMinMax' -e 'getFeatures2' -e 'getFeatures' -e 'createDevice' -e 'device.create' -e 'shaderFloatControls2' -e 'float-min-max-only' tests/ShaderRecompilerComputeTests.cpp || test "$?" -eq 1
printf '%s\n' '--- device setup and creation ---'
sed -n '20530,20880p' tests/ShaderRecompilerComputeTests.cpp
printf '%s\n' '--- native support call sites ---'
sed -n '21200,21480p' tests/ShaderRecompilerComputeTests.cpp
printf '%s\n' '--- changed diff for this file ---'
git diff f492027be26db4222eb7cf19eea5536dab2e5f9d..970ebecc7207611e589dcaa1fdb6f1a1e26116e6 -- tests/ShaderRecompilerComputeTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 37444


🌐 Web query:

Vulkan VK_KHR_shader_float_controls2 extension feature shaderFloatControls2 advertised extension feature support official specification

💡 Result:

<source_evidence>
<source kind="search">
<title>VK_KHR_shader_float_controls2(3) :: Vulkan Documentation Project</title>
<location>https://docs.vulkan.org/refpages/latest/refpages/source/VK_KHR_shader_float_controls2.html</location>
<excerpt>citeturn0search2 [wordlim: 200] Published: 3.4 years ago; Crawled: last month; VK_KHR_shader_float_controls2 - device extension ...     * VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT_CONTROLS_2_FEATURES_KHR

# VK_KHR_shader_float_controls2(3)

## Name

VK_KHR_shader_float_controls2 - device extension

## VK_KHR_shader_float_controls2

Name String
    

`VK_KHR_shader_float_controls2`

Extension Type
    

Device extension

Registered Extension Number
    

529

Revision
    

1

Ratification Status
    

Ratified

Extension and Version Dependencies
    

Vulkan Version 1.1
and
VK_KHR_shader_float_controls

SPIR-V Dependencies
    

  * SPV_KHR_float_controls2

Deprecation State
    

  * Promoted to Vulkan 1.4

Contact
    

  * Graeme Leese gnl21

Extension Proposal
    

VK_KHR_shader_float_controls2

### Other Extension Metadata

Last Modified Date
    

2023-05-16

Interactions and External Dependencies
    

  * This extension requires `SPV_KHR_float_controls2`.

Contributors
    

  * Graeme Leese, Broadcom

### Description

This extension enables use of the more expressive fast floating-point math flags in the SPV_KHR_float_controls2 extension. These flags give finer- grained control over which optimizations compilers may apply, potentially speeding up execution while retaining correct results.

The extension also adds control over the fast-math modes to the GLSL extended instruction set, making these operations more consistent with SPIR-V and allowing their use in situations where floating-point conformance is important.

### New Structures

  * Extending VkPhysicalDeviceFeatures2, VkDeviceCreateInfo:

    * VkPhysicalDeviceShaderFloatControls2FeaturesKHR

### New Enum Constants

  * `VK_KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME`

  * `VK_KHR_SHADER_FLOAT_CONTROLS_2_SPEC_VERSION`

  * Extending VkStructureType:

    * VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT_CONTROLS_2_FEATURES_KHR

### New SPIR-V Capabilities

  * FloatControls2

### Promotion to Vulkan 1.4

Functionality in this extension is included in core Vulkan 1.4 with the KHR suffix omitted. The original type, enum, and command names are still available as aliases of the core functionality.

### Version History

  * Revision 1, 2023-05-16 (Graeme Leese)

    * Initial draft

### Document Notes

For more information, see the Vulkan Specification.

This page is a generated document. Fixes and changes should be made to the generator scripts, not directly.</excerpt>
</source>
<source kind="search">
<title>VkPhysicalDeviceShaderFloatControls2Features(3) :: Vulkan Documentation Project</title>
<location>https://docs.vulkan.org/refpages/latest/refpages/source/VkPhysicalDeviceShaderFloatControls2Features.html</location>
<excerpt>citeturn1search0 [wordlim: 200] Crawled: last month; VkPhysicalDeviceShaderFloatControls2Features - Structure describing shader float controls 2 features that can be supported by an implementation ... If the `VkPhysicalDeviceShaderFloatControls2Features` structure is included in the `pNext` chain of the VkPhysicalDeviceFeatures2 structure passed to vkGetPhysicalDeviceFeatures2, it is filled in to indicate whether each corresponding feature is supported. ... ## Document Notes

# VkPhysicalDeviceShaderFloatControls2Features(3)

## Name

VkPhysicalDeviceShaderFloatControls2Features - Structure describing shader float controls 2 features that can be supported by an implementation

## C Specification

The `VkPhysicalDeviceShaderFloatControls2Features` structure is defined as:
    
    `// Provided by VK_VERSION_1_4
    typedef struct VkPhysicalDeviceShaderFloatControls2Features {
        VkStructureType    sType;
        void*              pNext;
        VkBool32           shaderFloatControls2;
    } VkPhysicalDeviceShaderFloatControls2Features;`
    
    `// Provided by VK_KHR_shader_float_controls2
    // Equivalent to VkPhysicalDeviceShaderFloatControls2Features
    typedef VkPhysicalDeviceShaderFloatControls2Features VkPhysicalDeviceShaderFloatControls2FeaturesKHR;`

## Members

This structure describes the following feature:

  * `sType` is a VkStructureType value identifying this structure.

  * `pNext` is `NULL` or a pointer to a structure extending this structure.

## Description

  * `shaderFloatControls2` specifies whether shader modules can declare the `FloatControls2` capability.

If the `VkPhysicalDeviceShaderFloatControls2Features` structure is included in the `pNext` chain of the VkPhysicalDeviceFeatures2 structure passed to vkGetPhysicalDeviceFeatures2, it is filled in to indicate whether each corresponding feature is supported. If the application wishes to use a VkDevice with any features described by `VkPhysicalDeviceShaderFloatControls2Features`, it must add an instance of the structure, with the desired feature members set to VK_TRUE, to the `pNext` chain of VkDeviceCreateInfo when creating the VkDevice.

Valid Usage (Implicit)

  * VUID-VkPhysicalDeviceShaderFloatControls2Features-sType-sType
`sType` must be VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT_CONTROLS_2_FEATURES

Structure Chaining

Extends the structures
    

  * VkDeviceCreateInfo

  * VkPhysicalDeviceFeatures2

## See Also

VK_KHR_shader_float_controls2, VK_VERSION_1_4, `VkBool32`, VkStructureType

## Document Notes

For more information, see the Vulkan Specification.

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.</excerpt>
</source>
<source kind="search">
<title>VK_KHR_shader_float_controls2(3) :: Vulkan Documentation Project</title>
<location>https://docs.vulkan.org/refpages/latest/refpages/source/VK_KHR_shader_float_controls2.html</location>
<excerpt>citeturn1search1 [wordlim: 200] Published: 3.4 years ago; Crawled: last month; Vulkan Version 1.1 ...     * VkPhysicalDeviceShaderFloatControls2FeaturesKHR ...     * VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT_CONTROLS_2_FEATURES_KHR ... This page is a generated document.

# VK_KHR_shader_float_controls2(3)

## Name

VK_KHR_shader_float_controls2 - device extension

## VK_KHR_shader_float_controls2

Name String
    

`VK_KHR_shader_float_controls2`

Extension Type
    

Device extension

Registered Extension Number
    

529

Revision
    

1

Ratification Status
    

Ratified

Extension and Version Dependencies
    

Vulkan Version 1.1
and
VK_KHR_shader_float_controls

SPIR-V Dependencies
    

  * SPV_KHR_float_controls2

Deprecation State
    

  * Promoted to Vulkan 1.4

Contact
    

  * Graeme Leese gnl21

Extension Proposal
    

VK_KHR_shader_float_controls2

### Other Extension Metadata

Last Modified Date
    

2023-05-16

Interactions and External Dependencies
    

  * This extension requires `SPV_KHR_float_controls2`.

Contributors
    

  * Graeme Leese, Broadcom

### Description

This extension enables use of the more expressive fast floating-point math flags in the SPV_KHR_float_controls2 extension. These flags give finer- grained control over which optimizations compilers may apply, potentially speeding up execution while retaining correct results.

The extension also adds control over the fast-math modes to the GLSL extended instruction set, making these operations more consistent with SPIR-V and allowing their use in situations where floating-point conformance is important.

### New Structures

  * Extending VkPhysicalDeviceFeatures2, VkDeviceCreateInfo:

    * VkPhysicalDeviceShaderFloatControls2FeaturesKHR

### New Enum Constants

  * `VK_KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME`

  * `VK_KHR_SHADER_FLOAT_CONTROLS_2_SPEC_VERSION`

  * Extending VkStructureType:

    * VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT_CONTROLS_2_FEATURES_KHR

### New SPIR-V Capabilities

  * FloatControls2

### Promotion to Vulkan 1.4

Functionality in this extension is included in core Vulkan 1.4 with the KHR suffix omitted. The original type, enum, and command names are still available as aliases of the core functionality.

### Version History

  * Revision 1, 2023-05-16 (Graeme Leese)

    * Initial draft

### Document Notes

For more information, see the Vulkan Specification.

This page is a generated document. Fixes and changes should be made to the generator scripts, not directly.</excerpt>
</source>
<source kind="search">
<title>Vulkan-Docs/appendices/VK_KHR_shader_float_controls.adoc at main · KhronosGroup/Vulkan-Docs · GitHub</title>
<location>https://github.com/KhronosGroup/Vulkan-Docs/blob/main/appendices/VK_KHR_shader_float_controls.adoc</location>
<excerpt>citeturn0search0 [wordlim: 200] Crawled: last week; The `VK_KHR_shader_float_controls` extension enables efficient use of floating-point computations through the ability to query and override the implementation’s default behavior for rounding modes, denormals, signed zero, and infinity. ... All functionality in this extension is included in core Vulkan 1.2, with the KHR suffix omitted.

# VK_KHR_shader_float_controls.adoc

132 lines (100 loc) · 4.81 KB

### Other Extension Metadata

Last Modified Date
    

2018-09-11

IP Status
    

No known IP claims.

Contributors
    

  * Alexander Galazin, Arm

  * Jan-Harald Fredriksen, Arm

  * Jeff Bolz, NVIDIA

  * Graeme Leese, Broadcom

  * Daniel Rakos, AMD

### Description

The `VK_KHR_shader_float_controls` extension enables efficient use of floating-point computations through the ability to query and override the implementation’s default behavior for rounding modes, denormals, signed zero, and infinity.

### Promotion to Vulkan 1.2

All functionality in this extension is included in core Vulkan 1.2, with the KHR suffix omitted. The original type, enum, and command names are still available as aliases of the core functionality.

### New SPIR-V Capabilities

  * code:DenormPreserve

  * code:DenormFlushToZero

  * code:SignedZeroInfNanPreserve

  * code:RoundingModeRTE

  * code:RoundingModeRTZ

### Issues

1) Which instructions must flush denorms?

RESOLVED: Only floating-point conversion, floating-point arithmetic, floating-point relational (except code:OpIsNaN, code:OpIsInf), and floating-point GLSL.std.450 extended instructions must flush denormals.

2) What is the denorm behavior for intermediate results?

RESOLVED: When a SPIR-V instruction is implemented as a sequence of other instructions:

  * in the code:DenormFlushToZero execution mode, the intermediate instructions may flush denormals, the final result of the sequence must: not be denormal.

  * in the code:DenormPreserve execution mode, denormals must be preserved throughout the whole sequence.

3) Do denorm and rounding mode controls apply to code:OpSpecConstantOp?

RESOLVED: Yes, except when the opcode is code:OpQuantizeToF16.

4) The SPIR-V specification says that code:OpConvertFToU and code:OpConvertFToS unconditionally round towards zero. Do the rounding mode controls specified through the execution modes apply to them?

RESOLVED: No, these instructions unconditionally round towards zero.

5) Do any of the “Pack” GLSL.std.450 instructions count as conversion instructions and have the rounding mode applied?

RESOLVED: No, only instructions listed in “section 3.32.11. Conversion Instructions” of the SPIR-V specification count as conversion instructions.

6) When using inf/nan-ignore mode, what is expected of code:OpIsNan and code:OpIsInf?

RESOLVED: These instructions must always accurately detect inf/nan if it is passed to them.

### Version 4 API Incompatibility

The original versions of `VK_KHR_shader_float_controls` shipped with booleans named “separateDenormSettings” and “separateRoundingModeSettings”, which at first glance could have indicated “they can all be set independently, or not”. However the spec language as written indicated that the 32-bit value could always be set independently, and only the 16- and 64-bit controls needed to be the same if these values were ename:VK_FALSE.

As a result of this slight disparity, and lack of test coverage for this facet of the extension, we ended up with two different behaviors in the wild, where some implementations worked as written, and others worked based on the naming. As these are hard limits in hardware with reasons for exposure as written, it was not possible to standardize on a single way to make this work within the existing API.

No known users of this part of the extension exist in the wild, and as such the Vulkan WG took the unusual step of retroactively changing the once boolean value into a tri-state enum, breaking source compatibility…[truncated]</excerpt>
</source>
<source kind="search">
<title>Vulkan-Docs/proposals/VK_KHR_shader_float_controls2.adoc at main · KhronosGroup/Vulkan-Docs · GitHub</title>
<location>https://github.com/KhronosGroup/Vulkan-Docs/blob/main/proposals/VK_KHR_shader_float_controls2.adoc</location>
<excerpt>citeturn0search1 [wordlim: 200] Crawled: last month; # VK_KHR_shader_float_controls2 ... Vulkan currently only allows somewhat restricted control over how floating-point operations should be performed by the implementation.

# VK_KHR_shader_float_controls2

Table of Contents

  * 1. Problem Statement
  * 2. Proposal
  * 3. Issues
    * 3.1. Should support for all combinations of float controls be required?
    * 3.2. Which extended instructions should support float controls?

## 1. Problem Statement

Vulkan currently only allows somewhat restricted control over how floating-point operations should be performed by the implementation. This causes missed opportunities for optimization in certain types of shader, which are forced to disable more relaxations than are really required.

The controls in VK_KHR_shader_float_controls must be applied entry point wide, which makes it impossible to mix functions that require strict conformance with other functions that can benefit from the optimizations that result from assuming that this is not true.

Many instructions currently are not affected by the controls from VK_KHR_shader_float_controls, meaning that they cannot be used at all in shaders that require strict floating-point support.

The NoContraction decoration, which is used to control IEEE conformance in floating-point expression evaluation, only supports two states, one of which is full strictness and the other is less strict than is typically allowed by -ffast-math in CPU compilers. This means that any code for which this relaxed state is not sufficient must enable the strictest mode and pay the cost associated with that.

Additionally, SPIR-V already contains decorations to give finer-grained control over floating-point operations which are used by other APIs. Using different control mechanisms gives an unnecessary incompatibility between SPIR-V modules for different APIs and adds an associated cost to tooling.

This proposal aims to provide more flexible and wider ranging control over floating-point evaluation.

## 2. Proposal

Allow use of SPV_KHR_float_controls2 in Vulkan. The SPIR-V extension adopts and extends the floating-point controls that are used for Kernel SPIR-V. This eliminates the difference in how these controls are specified between APIs, simplifying SPIR-V and, in the long-term, reducing tooling costs.

The floating-point controls are specified per-instruction, so code requiring varying strictness can be freely mixed and the appropriate optimizations applied to all of it.

The controls are finer-grained so that code that requires stricter evaluation than the Vulkan default is not forced to disable larger classes of optimization than may be required.

Float controls may be added to a much wider class of instructions, allowing the use of more builtin functions more often.

## 3. Issues

### 3.1. Should support for all combinations of float controls be required?

This proposal is aimed at increasing the flexibility of float controls, not raising the minimum support. In order that this can be implemented everywhere, if the existing features are not supported then the related fine-grained controls must not be set.

### 3.2. Which extended instructions should support float controls?

The simplest answer and the one that provides the best solution to the problem of these instructions not being usable in shaders that require high precision is to support the controls on all of them. That is what is proposed here, although this does add an implementation requirement to support infinities and NaNs in these instructions.

Since the utility of this extension is greatly decreased if developers have to support both the existing and the new way of specifying float controls, getting wide adoption is an important part of solving all the problems. Therefore, if the increased implementation requirement blocks or delays adoption, it should be dropped. This could be done by requiring that apps not change the executio…[truncated]</excerpt>
</source>
<omitted_sources count="26">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>

Citations:

- 1: https://docs.vulkan.org/refpages/latest/refpages/source/VkPhysicalDeviceShaderFloatControls2Features.html?utm_source=openai
- 2: https://docs.vulkan.org/refpages/latest/refpages/source/VK_KHR_shader_float_controls2.html?utm_source=openai

🏁 Script executed:

set -u
printf '%s\n' '--- feature query chain and error handling ---'
nl -ba tests/ShaderRecompilerComputeTests.cpp | sed -n '20395,20435p;20500,20595p;20705,20770p;48980,49020p'
printf '%s\n' '--- RequireVk declaration/definition ---'
rg -n -F --glob '*.cpp' --glob '*.h' -e 'RequireVk' -e 'RequireVulkanSuccess' tests include source || test "$?" -eq 1

Repository: KytyPS5/KytyPS5

Length of output: 19030


🌐 Web query:

site:docs.vulkan.org Vulkan vkCreateDevice VK_ERROR_FEATURE_NOT_PRESENT enabled feature not supported extension advertised feature query

💡 Result:

<source_evidence>
<source kind="search">
<title>Devices and Queues :: Vulkan Documentation Project</title>
<location>https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html</location>
<excerpt>citeturn0search1 [wordlim: 200] Crawled: 2 weeks ago; If any requested feature is not supported, `vkCreateDevice` must return VK_ERROR_FEATURE_NOT_PRESENT.

`vkCreateDevice` verifies that extensions and features requested in the `ppEnabledExtensionNames` and `pEnabledFeatures` members of `pCreateInfo`, respectively, are supported by the implementation. If any requested extension is not supported, `vkCreateDevice` must return VK_ERROR_EXTENSION_NOT_PRESENT. If any requested feature is not supported, `vkCreateDevice` must return VK_ERROR_FEATURE_NOT_PRESENT. Support for extensions can be checked before creating a device by querying vkEnumerateDeviceExtensionProperties. Support for features can similarly be checked by querying vkGetPhysicalDeviceFeatures.

After verifying and enabling the extensions the `VkDevice` object is created and returned to the application.

Multiple logical devices can be created from the same physical device. Logical device creation may fail due to lack of device-specific resources (in addition to other errors). If that occurs, `vkCreateDevice` will return VK_ERROR_TOO_MANY_OBJECTS.

Valid Usage

  * VUID-vkCreateDevice-ppEnabledExtensionNames-01387
All required device extensions for each extension in the VkDeviceCreateInfo::`ppEnabledExtensionNames` list must also be present in that list

Valid Usage (Implicit)

  * VUID-vkCreateDevice-physicalDevice-parameter
`physicalDevice` must be a valid VkPhysicalDevice handle

  * VUID-vkCreateDevice-pCreateInfo-parameter
`pCreateInfo` must be a valid pointer to a valid VkDeviceCreateInfo structure

  * VUID-vkCreateDevice-pAllocator-parameter
If `pAllocator` is not `NULL`, `pAllocator` must be a valid pointer to a valid VkAllocationCallbacks structure

  * VUID-vkCreateDevice-pDevice-parameter
`pDevice` must be a valid pointer to a VkDevice handle

Return Codes

Success
    

  * VK_SUCCESS

Failure
    

  * VK_ERROR_DEVICE_LOST

  * VK_ERROR_EXTENSION_NOT_PRESENT

  * VK_ERROR_FEATURE_NOT_PRESENT

  * VK_ERROR_INITIALIZATION_FAILED
</excerpt>
</source>
<source kind="search">
<title>Features :: Vulkan Documentation Project</title>
<location>https://docs.vulkan.org/spec/latest/chapters/features.html</location>
<excerpt>citeturn0search0 [wordlim: 200] Crawled: 2 weeks ago; When a promoted extension is available, any corresponding feature aliases must be supported. ... If a feature is enabled that the physical device does not support, `VkDevice` creation will fail and return VK_ERROR_FEATURE_NOT_PRESENT.The fine-grained features are enabled by passing a pointer to the `VkPhysicalDeviceFeatures` structure via the `pEnabledFeatures` member of the VkDeviceCreateInfo structure that is passed into the `vkCreateDevice` call. ...   * `performanceCounterMultipleQueryPools` indicates whether the implementation supports using multiple performance query pools in a primary command buffer and secondary command buffers executed within it.

# Features

Features advertise additional functionality which can be enabled in the API. If a feature is supported by a physical device, it must be enabled when creating a VkDevice in order to use its associated functionality with that VkDevice. If a feature is unsupported, that functionality cannot be used with that VkDevice.

 | Features are reported via the extensible structure `VkPhysicalDeviceFeatures2`, which was added in the `VK_KHR_get_physical_device_properties2` extension and included in Vulkan 1.1. When new features are added in future Vulkan versions or extensions, each extension should introduce one new feature structure, if needed. This structure can be added to the `pNext` chain of the `VkPhysicalDeviceFeatures2` structure.

For convenience, new core versions of Vulkan may introduce new unified feature structures for features promoted from extensions. At the same time, the extension’s original feature structure (if any) is also promoted to the core API, and is an alias of the extension’s structure. `physicalDevice` must be a valid VkPhysicalDevice handle

  * VUID-vkGetPhysicalDeviceFeatures-pFeatures-parameter
`pFeatures` must be a valid pointer to a VkPhysicalDeviceFeatures structure

Fine-grained features used by a logical device must be enabled at `VkDevice` creation time. If a feature is enabled that the physical device does not support, `VkDevice` creation will fail and return VK_ERROR_FEATURE_NOT_PRESENT.

The fine-grained features are enabled by passing a pointer to the `VkPhysicalDeviceFeatures` structure via the `pEnabledFeatures` member of the VkDeviceCreateInfo structure that is passed into the `vkCreateDevice` call. If a member of `pEnabledFeatures` is VK_TRUE or VK_FALSE, then the device will be created with the indicated feature enabled or disabled, respectively. Features can also be enabled by using the VkPhysicalDeviceFeatures2 structure.

If an application wishes to enable all features supported by a device, it can simply pass in the `VkPhysicalDeviceFeatures` structure that was previously returned by `vkGetPhysicalDeviceFeatures`. To disable an individual feature, the application can set the desired member to VK_FALSE in the same structure. Setting `pEnabledFeatures` to `NULL` and not including a VkPhysicalDeviceFeatures2 in the `pNext` chain of VkDeviceCreateInfo is equivalent to setting all members of the structure to VK_FALSE.

</excerpt>
</source>
<source kind="search">
<title>vkCreateDevice(3) :: Vulkan Documentation Project</title>
<location>https://docs.vulkan.org/refpages/latest/refpages/source/vkCreateDevice.html</location>
<excerpt>citeturn0search2 [wordlim: 200] Crawled: 2 weeks ago; If any requested extension is not supported, `vkCreateDevice` must return VK_ERROR_EXTENSION_NOT_PRESENT.If any requested feature is not supported, `vkCreateDevice` must return VK_ERROR_FEATURE_NOT_PRESENT. ... This page is extracted from the Vulkan Specification.

  * `pDevice` is a pointer to a handle in which the created VkDevice is returned.

## Description

`vkCreateDevice` verifies that extensions and features requested in the `ppEnabledExtensionNames` and `pEnabledFeatures` members of `pCreateInfo`, respectively, are supported by the implementation. If any requested extension is not supported, `vkCreateDevice` must return VK_ERROR_EXTENSION_NOT_PRESENT. If any requested feature is not supported, `vkCreateDevice` must return VK_ERROR_FEATURE_NOT_PRESENT. Support for extensions can be checked before creating a device by querying vkEnumerateDeviceExtensionProperties. Support for features can similarly be checked by querying vkGetPhysicalDeviceFeatures.

After verifying and enabling the extensions the `VkDevice` object is created and returned to the application.

Multiple logical devices can be created from the same physical device. Logical device creation may fail due to lack of device-specific resources (in addition to other errors). If that occurs, `vkCreateDevice` will return VK_ERROR_TOO_MANY_OBJECTS.

Valid Usage

  * VUID-vkCreateDevice-ppEnabledExtensionNames-01387
All required device extensions for each extension in the VkDeviceCreateInfo::`ppEnabledExtensionNames` list must also be present in that list

Valid Usage (Implicit)

  * VUID-vkCreateDevice-physicalDevice-parameter
`physicalDevice` must be a valid VkPhysicalDevice handle

  * VUID-vkCreateDevice-pCreateInfo-parameter
`pCreateInfo` must be a valid pointer to a valid VkDeviceCreateInfo structure

  * VUID-vkCreateDevice-pAllocator-parameter
If `pAllocator` is not `NULL`, `pAllocator` must be a valid pointer to a valid VkAllocationCallbacks structure

  * VUID-vkCreateDevice-pDevice-parameter
`pDevice` must be a valid pointer to a VkDevice handle

Return Codes

Success
    

  * VK_SUCCESS

Failure
    

  * VK_ERROR_DEVICE_LOST

  * VK_ERROR_EXTENSION_NOT_PRESENT

  * VK_ERROR_FEATURE_NOT_PRESENT

  * VK_ERROR_INITIALIZATION_FAILED

  * VK_ERROR_OUT_OF_DEVICE_MEMORY

  * VK_ERROR_OUT_OF_HOST_MEMORY

  * VK_ERROR_TOO_MANY_OBJECTS

  * VK_ERROR_UNKNOWN

  * VK_ERROR_VALIDATION_FAILED

## See Also

VK_VERSION_1_0, VkAllocationCallbacks, VkDevice, VkDeviceCreateInfo, VkPhysicalDevice

## Document Notes

For more information, see the Vulkan Specification.

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.</excerpt>
</source>
<source kind="search">
<title>Querying Properties, Extensions, Features, Limits, and Formats :: Vulkan Documentation Project</title>
<location>https://docs.vulkan.org/guide/latest/querying_extensions_features.html</location>
<excerpt>citeturn0search3 [wordlim: 200] Crawled: 2 weeks ago; While all of these extended items are found by default in the Vulkan Headers, it is undefined behavior to use extended Vulkan if the extensions are not enabled. ... Features describe functionality which is not supported on all implementations. ... A common technique is for an extension to expose a new struct that can be passed through `pNext` that adds more features to be queried. ... Vulkan provides many `VkFormat` that have multiple `VkFormatFeatureFlags` each holding various VkFormatFeatureFlagBits bitmasks that can be queried. ... The Vulkan Hardware Capability Viewer app developed by Sascha Willems, is an Android app to display all details for devices that support Vulkan.
While all of these extended items are found by default in the Vulkan Headers, it is undefined behavior to use extended Vulkan if the extensions are not enabled.

## Features

 | Check out the Enabling Features chapter for more information.

Features describe functionality which is not supported on all implementations. Features can be queried and then enabled when creating the `VkDevice`. Besides the list of all features, some features are mandatory due to newer Vulkan versions or use of extensions.

A common technique is for an extension to expose a new struct that can be passed through `pNext` that adds more features to be queried.

## Limits

Limits are implementation-dependent minimums, maximums, and other device characteristics that an application may need to be aware of. Besides the list of all limits, some limits also have minimum/maximum required values guaranteed from a Vulkan implementation.

## Formats

Vulkan provides many `VkFormat` that have multiple `VkFormatFeatureFlags` each holding various VkFormatFeatureFlagBits bitmasks that can be queried.

Check out the Format chapter for more information.

## Tools

There are a few tools to help with getting all the information in a quick and in a human readable format.

`vulkaninfo` is a command line utility for Windows, Linux, and macOS that enables you to see all the available items listed above about your GPU. Refer to the Vulkaninfo documentation in the Vulkan SDK.

The Vulkan Hardware Capability Viewer app developed by Sascha Willems, is an Android app to display all details for devices that support Vulkan.</excerpt>
</source>
<source kind="search">
<title>Enabling Extensions :: Vulkan Documentation Project</title>
<location>https://docs.vulkan.org/guide/latest/enabling_extensions.html</location>
<excerpt>citeturn0search4 [wordlim: 200] Crawled: 2 weeks ago; An application can query the physical device first to check if the extension is supported with `vkEnumerateInstanceExtensionProperties` or `vkEnumerateDeviceExtensionProperties`. ... Even if the extension is supported by the implementation, it is undefined behavior to use the functionality of the extension unless it is enabled at `VkInstance` or `VkDevice` creation time. ...     vkCreateDevice(physicalDevice, &amp;device_create_info, nullptr, &amp;myDevice);` ...   * If `VK_KHR_8bit_storage` is not found in `vkEnumerateDeviceExtensionProperties` then the `storageBuffer8BitAccess` feature might be supported and can be checked by querying `VkPhysicalDeviceVulkan12Features::storageBuffer8BitAccess`.
    instance_create_info.ppEnabledExtensionNames = instance_extensions.data();
    vkCreateInstance(&amp;instance_create_info, nullptr, &amp;myInstance);
    
    // ...
    
    std::vector&lt;const char*&gt; device_extensions;
    device_extensions.push_back(VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME);
    
    VkDeviceCreateInfo device_create_info      = {};
    device_create_info.enabledExtensionCount   = static_cast&lt;uint32_t&gt;(device_extensions.size());
    device_create_info.ppEnabledExtensionNames = device_extensions.data();
    vkCreateDevice(physicalDevice, &amp;device_create_info, nullptr, &amp;myDevice);`

## Check for feature bits

It is important to remember that extensions add the existence of functionality to the Vulkan spec, but this doesn’t mean that all features of an extension are available if the extension is supported. An example is an extension such as `VK_KHR_8bit_storage`, which has 3 features it exposes in `VkPhysicalDevice8BitStorageFeatures`.

Image: enabling_extensions_8bit.png

This means after enabling the extension, an application will still need to query and enable the features needed from an extension.
</excerpt>
</source>
<omitted_sources count="8">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>

Citations:

- 1: https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html?utm_source=openai
- 2: https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html?utm_source=openai

🏁 Script executed:

nl -ba tests/ShaderRecompilerComputeTests.cpp | sed -n '985,1025p'

Repository: KytyPS5/KytyPS5

Length of output: 1771


Query shaderFloatControls2 before enabling it.

The extension does not guarantee that its feature bit is supported. If the extension is advertised but shaderFloatControls2 is false, vkCreateDevice returns VK_ERROR_FEATURE_NOT_PRESENT, and RequireVk reports the failure before the float min/max tests run.

Set m_float_controls2 only when both the extension and feature bit are supported.

Suggested fix
+    bool float_controls2_extension = false;
     for (const auto &extension :
          m_physical_device.enumerateDeviceExtensionProperties().value) {
       if (std::strcmp(extension.extensionName,
-                      VK_KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME) == 0)
-        m_float_controls2 = true;
+                      VK_KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME) == 0) {
+        float_controls2_extension = true;
+        break;
+      }
+    }
+    if (float_controls2_extension) {
+      vk::PhysicalDeviceShaderFloatControls2FeaturesKHR available_float_controls2{};
+      vk::PhysicalDeviceFeatures2 float_controls2_features{};
+      float_controls2_features.sType = vk::StructureType::ePhysicalDeviceFeatures2;
+      float_controls2_features.pNext = &available_float_controls2;
+      m_physical_device.getFeatures2(&float_controls2_features);
+      m_float_controls2 = available_float_controls2.shaderFloatControls2;
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    // Optional: host float min/max needs float controls 2.
    bool float_controls2_extension = false;
    for (const auto &extension :
         m_physical_device.enumerateDeviceExtensionProperties().value) {
      if (std::strcmp(extension.extensionName,
                      VK_KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME) == 0) {
        float_controls2_extension = true;
        break;
      }
    }
    if (float_controls2_extension) {
      vk::PhysicalDeviceShaderFloatControls2FeaturesKHR available_float_controls2{};
      vk::PhysicalDeviceFeatures2 float_controls2_features{};
      float_controls2_features.sType = vk::StructureType::ePhysicalDeviceFeatures2;
      float_controls2_features.pNext = &available_float_controls2;
      m_physical_device.getFeatures2(&float_controls2_features);
      m_float_controls2 = available_float_controls2.shaderFloatControls2;
    }
    vk::PhysicalDeviceShaderFloatControls2FeaturesKHR float_controls2{};
    float_controls2.shaderFloatControls2 = true;
    if (m_float_controls2) {
      float_controls2.pNext = &robustness2;
      device_info.pNext = &float_controls2;
    }

✅ Addressed in commit 20bb9c6

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 19:03 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1761#discussion_r4340801596) · edited 2026-10-21 19:11 UTC On `tests/ShaderRecompilerComputeTests.cpp` line 20723 (outdated): ```diff @@ -20699,6 +20708,19 @@ class VulkanHarness { robustness2.nullDescriptor = true; robustness2.pNext = &maintenance8; device_info.pNext = &robustness2; + // Optional: host float min/max needs float controls 2. + for (const auto &extension : + m_physical_device.enumerateDeviceExtensionProperties().value) { + if (std::strcmp(extension.extensionName, + VK_KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME) == 0) + m_float_controls2 = true; + } + vk::PhysicalDeviceShaderFloatControls2FeaturesKHR float_controls2{}; + float_controls2.shaderFloatControls2 = true; + if (m_float_controls2) { + float_controls2.pNext = &robustness2; + device_info.pNext = &float_controls2; + } ``` <!-- coderabbit-ai-generated:v1 --> **🩺 Stability & Availability** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '1995,2017p' tests/ShaderRecompilerComputeTests.cpp sed -n '20670,20755p' tests/ShaderRecompilerComputeTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 5411 --- 🏁 Script executed: ```bash set -u printf '%s\n' '--- VulkanHarness references and initialization ---' rg -n -F --glob 'tests/ShaderRecompilerComputeTests.cpp' -e 'm_float_controls2' -e 'SupportsNativeFloatMinMax' -e 'getFeatures2' -e 'getFeatures' -e 'createDevice' -e 'device.create' -e 'shaderFloatControls2' -e 'float-min-max-only' tests/ShaderRecompilerComputeTests.cpp || test "$?" -eq 1 printf '%s\n' '--- device setup and creation ---' sed -n '20530,20880p' tests/ShaderRecompilerComputeTests.cpp printf '%s\n' '--- native support call sites ---' sed -n '21200,21480p' tests/ShaderRecompilerComputeTests.cpp printf '%s\n' '--- changed diff for this file ---' git diff f492027be26db4222eb7cf19eea5536dab2e5f9d..970ebecc7207611e589dcaa1fdb6f1a1e26116e6 -- tests/ShaderRecompilerComputeTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 37444 --- 🌐 Web query: `Vulkan VK_KHR_shader_float_controls2 extension feature shaderFloatControls2 advertised extension feature support official specification` 💡 Result: ``` <source_evidence> <source kind="search"> <title>VK_KHR_shader_float_controls2(3) :: Vulkan Documentation Project</title> <location>https://docs.vulkan.org/refpages/latest/refpages/source/VK_KHR_shader_float_controls2.html</location> <excerpt>citeturn0search2 [wordlim: 200] Published: 3.4 years ago; Crawled: last month; VK_KHR_shader_float_controls2 - device extension ... * VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT_CONTROLS_2_FEATURES_KHR # VK_KHR_shader_float_controls2(3) ## Name VK_KHR_shader_float_controls2 - device extension ## VK_KHR_shader_float_controls2 Name String `VK_KHR_shader_float_controls2` Extension Type Device extension Registered Extension Number 529 Revision 1 Ratification Status Ratified Extension and Version Dependencies Vulkan Version 1.1 and VK_KHR_shader_float_controls SPIR-V Dependencies * SPV_KHR_float_controls2 Deprecation State * Promoted to Vulkan 1.4 Contact * Graeme Leese gnl21 Extension Proposal VK_KHR_shader_float_controls2 ### Other Extension Metadata Last Modified Date 2023-05-16 Interactions and External Dependencies * This extension requires `SPV_KHR_float_controls2`. Contributors * Graeme Leese, Broadcom ### Description This extension enables use of the more expressive fast floating-point math flags in the SPV_KHR_float_controls2 extension. These flags give finer- grained control over which optimizations compilers may apply, potentially speeding up execution while retaining correct results. The extension also adds control over the fast-math modes to the GLSL extended instruction set, making these operations more consistent with SPIR-V and allowing their use in situations where floating-point conformance is important. ### New Structures * Extending VkPhysicalDeviceFeatures2, VkDeviceCreateInfo: * VkPhysicalDeviceShaderFloatControls2FeaturesKHR ### New Enum Constants * `VK_KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME` * `VK_KHR_SHADER_FLOAT_CONTROLS_2_SPEC_VERSION` * Extending VkStructureType: * VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT_CONTROLS_2_FEATURES_KHR ### New SPIR-V Capabilities * FloatControls2 ### Promotion to Vulkan 1.4 Functionality in this extension is included in core Vulkan 1.4 with the KHR suffix omitted. The original type, enum, and command names are still available as aliases of the core functionality. ### Version History * Revision 1, 2023-05-16 (Graeme Leese) * Initial draft ### Document Notes For more information, see the Vulkan Specification. This page is a generated document. Fixes and changes should be made to the generator scripts, not directly.</excerpt> </source> <source kind="search"> <title>VkPhysicalDeviceShaderFloatControls2Features(3) :: Vulkan Documentation Project</title> <location>https://docs.vulkan.org/refpages/latest/refpages/source/VkPhysicalDeviceShaderFloatControls2Features.html</location> <excerpt>citeturn1search0 [wordlim: 200] Crawled: last month; VkPhysicalDeviceShaderFloatControls2Features - Structure describing shader float controls 2 features that can be supported by an implementation ... If the `VkPhysicalDeviceShaderFloatControls2Features` structure is included in the `pNext` chain of the VkPhysicalDeviceFeatures2 structure passed to vkGetPhysicalDeviceFeatures2, it is filled in to indicate whether each corresponding feature is supported. ... ## Document Notes # VkPhysicalDeviceShaderFloatControls2Features(3) ## Name VkPhysicalDeviceShaderFloatControls2Features - Structure describing shader float controls 2 features that can be supported by an implementation ## C Specification The `VkPhysicalDeviceShaderFloatControls2Features` structure is defined as: `// Provided by VK_VERSION_1_4 typedef struct VkPhysicalDeviceShaderFloatControls2Features { VkStructureType sType; void* pNext; VkBool32 shaderFloatControls2; } VkPhysicalDeviceShaderFloatControls2Features;` `// Provided by VK_KHR_shader_float_controls2 // Equivalent to VkPhysicalDeviceShaderFloatControls2Features typedef VkPhysicalDeviceShaderFloatControls2Features VkPhysicalDeviceShaderFloatControls2FeaturesKHR;` ## Members This structure describes the following feature: * `sType` is a VkStructureType value identifying this structure. * `pNext` is `NULL` or a pointer to a structure extending this structure. ## Description * `shaderFloatControls2` specifies whether shader modules can declare the `FloatControls2` capability. If the `VkPhysicalDeviceShaderFloatControls2Features` structure is included in the `pNext` chain of the VkPhysicalDeviceFeatures2 structure passed to vkGetPhysicalDeviceFeatures2, it is filled in to indicate whether each corresponding feature is supported. If the application wishes to use a VkDevice with any features described by `VkPhysicalDeviceShaderFloatControls2Features`, it must add an instance of the structure, with the desired feature members set to VK_TRUE, to the `pNext` chain of VkDeviceCreateInfo when creating the VkDevice. Valid Usage (Implicit) * VUID-VkPhysicalDeviceShaderFloatControls2Features-sType-sType `sType` must be VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT_CONTROLS_2_FEATURES Structure Chaining Extends the structures * VkDeviceCreateInfo * VkPhysicalDeviceFeatures2 ## See Also VK_KHR_shader_float_controls2, VK_VERSION_1_4, `VkBool32`, VkStructureType ## Document Notes For more information, see the Vulkan Specification. This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.</excerpt> </source> <source kind="search"> <title>VK_KHR_shader_float_controls2(3) :: Vulkan Documentation Project</title> <location>https://docs.vulkan.org/refpages/latest/refpages/source/VK_KHR_shader_float_controls2.html</location> <excerpt>citeturn1search1 [wordlim: 200] Published: 3.4 years ago; Crawled: last month; Vulkan Version 1.1 ... * VkPhysicalDeviceShaderFloatControls2FeaturesKHR ... * VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT_CONTROLS_2_FEATURES_KHR ... This page is a generated document. # VK_KHR_shader_float_controls2(3) ## Name VK_KHR_shader_float_controls2 - device extension ## VK_KHR_shader_float_controls2 Name String `VK_KHR_shader_float_controls2` Extension Type Device extension Registered Extension Number 529 Revision 1 Ratification Status Ratified Extension and Version Dependencies Vulkan Version 1.1 and VK_KHR_shader_float_controls SPIR-V Dependencies * SPV_KHR_float_controls2 Deprecation State * Promoted to Vulkan 1.4 Contact * Graeme Leese gnl21 Extension Proposal VK_KHR_shader_float_controls2 ### Other Extension Metadata Last Modified Date 2023-05-16 Interactions and External Dependencies * This extension requires `SPV_KHR_float_controls2`. Contributors * Graeme Leese, Broadcom ### Description This extension enables use of the more expressive fast floating-point math flags in the SPV_KHR_float_controls2 extension. These flags give finer- grained control over which optimizations compilers may apply, potentially speeding up execution while retaining correct results. The extension also adds control over the fast-math modes to the GLSL extended instruction set, making these operations more consistent with SPIR-V and allowing their use in situations where floating-point conformance is important. ### New Structures * Extending VkPhysicalDeviceFeatures2, VkDeviceCreateInfo: * VkPhysicalDeviceShaderFloatControls2FeaturesKHR ### New Enum Constants * `VK_KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME` * `VK_KHR_SHADER_FLOAT_CONTROLS_2_SPEC_VERSION` * Extending VkStructureType: * VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT_CONTROLS_2_FEATURES_KHR ### New SPIR-V Capabilities * FloatControls2 ### Promotion to Vulkan 1.4 Functionality in this extension is included in core Vulkan 1.4 with the KHR suffix omitted. The original type, enum, and command names are still available as aliases of the core functionality. ### Version History * Revision 1, 2023-05-16 (Graeme Leese) * Initial draft ### Document Notes For more information, see the Vulkan Specification. This page is a generated document. Fixes and changes should be made to the generator scripts, not directly.</excerpt> </source> <source kind="search"> <title>Vulkan-Docs/appendices/VK_KHR_shader_float_controls.adoc at main · KhronosGroup/Vulkan-Docs · GitHub</title> <location>https://github.com/KhronosGroup/Vulkan-Docs/blob/main/appendices/VK_KHR_shader_float_controls.adoc</location> <excerpt>citeturn0search0 [wordlim: 200] Crawled: last week; The `VK_KHR_shader_float_controls` extension enables efficient use of floating-point computations through the ability to query and override the implementation’s default behavior for rounding modes, denormals, signed zero, and infinity. ... All functionality in this extension is included in core Vulkan 1.2, with the KHR suffix omitted. # VK_KHR_shader_float_controls.adoc 132 lines (100 loc) · 4.81 KB ### Other Extension Metadata Last Modified Date 2018-09-11 IP Status No known IP claims. Contributors * Alexander Galazin, Arm * Jan-Harald Fredriksen, Arm * Jeff Bolz, NVIDIA * Graeme Leese, Broadcom * Daniel Rakos, AMD ### Description The `VK_KHR_shader_float_controls` extension enables efficient use of floating-point computations through the ability to query and override the implementation’s default behavior for rounding modes, denormals, signed zero, and infinity. ### Promotion to Vulkan 1.2 All functionality in this extension is included in core Vulkan 1.2, with the KHR suffix omitted. The original type, enum, and command names are still available as aliases of the core functionality. ### New SPIR-V Capabilities * code:DenormPreserve * code:DenormFlushToZero * code:SignedZeroInfNanPreserve * code:RoundingModeRTE * code:RoundingModeRTZ ### Issues 1) Which instructions must flush denorms? RESOLVED: Only floating-point conversion, floating-point arithmetic, floating-point relational (except code:OpIsNaN, code:OpIsInf), and floating-point GLSL.std.450 extended instructions must flush denormals. 2) What is the denorm behavior for intermediate results? RESOLVED: When a SPIR-V instruction is implemented as a sequence of other instructions: * in the code:DenormFlushToZero execution mode, the intermediate instructions may flush denormals, the final result of the sequence must: not be denormal. * in the code:DenormPreserve execution mode, denormals must be preserved throughout the whole sequence. 3) Do denorm and rounding mode controls apply to code:OpSpecConstantOp? RESOLVED: Yes, except when the opcode is code:OpQuantizeToF16. 4) The SPIR-V specification says that code:OpConvertFToU and code:OpConvertFToS unconditionally round towards zero. Do the rounding mode controls specified through the execution modes apply to them? RESOLVED: No, these instructions unconditionally round towards zero. 5) Do any of the “Pack” GLSL.std.450 instructions count as conversion instructions and have the rounding mode applied? RESOLVED: No, only instructions listed in “section 3.32.11. Conversion Instructions” of the SPIR-V specification count as conversion instructions. 6) When using inf/nan-ignore mode, what is expected of code:OpIsNan and code:OpIsInf? RESOLVED: These instructions must always accurately detect inf/nan if it is passed to them. ### Version 4 API Incompatibility The original versions of `VK_KHR_shader_float_controls` shipped with booleans named “separateDenormSettings” and “separateRoundingModeSettings”, which at first glance could have indicated “they can all be set independently, or not”. However the spec language as written indicated that the 32-bit value could always be set independently, and only the 16- and 64-bit controls needed to be the same if these values were ename:VK_FALSE. As a result of this slight disparity, and lack of test coverage for this facet of the extension, we ended up with two different behaviors in the wild, where some implementations worked as written, and others worked based on the naming. As these are hard limits in hardware with reasons for exposure as written, it was not possible to standardize on a single way to make this work within the existing API. No known users of this part of the extension exist in the wild, and as such the Vulkan WG took the unusual step of retroactively changing the once boolean value into a tri-state enum, breaking source compatibility…[truncated]</excerpt> </source> <source kind="search"> <title>Vulkan-Docs/proposals/VK_KHR_shader_float_controls2.adoc at main · KhronosGroup/Vulkan-Docs · GitHub</title> <location>https://github.com/KhronosGroup/Vulkan-Docs/blob/main/proposals/VK_KHR_shader_float_controls2.adoc</location> <excerpt>citeturn0search1 [wordlim: 200] Crawled: last month; # VK_KHR_shader_float_controls2 ... Vulkan currently only allows somewhat restricted control over how floating-point operations should be performed by the implementation. # VK_KHR_shader_float_controls2 Table of Contents * 1. Problem Statement * 2. Proposal * 3. Issues * 3.1. Should support for all combinations of float controls be required? * 3.2. Which extended instructions should support float controls? ## 1. Problem Statement Vulkan currently only allows somewhat restricted control over how floating-point operations should be performed by the implementation. This causes missed opportunities for optimization in certain types of shader, which are forced to disable more relaxations than are really required. The controls in VK_KHR_shader_float_controls must be applied entry point wide, which makes it impossible to mix functions that require strict conformance with other functions that can benefit from the optimizations that result from assuming that this is not true. Many instructions currently are not affected by the controls from VK_KHR_shader_float_controls, meaning that they cannot be used at all in shaders that require strict floating-point support. The NoContraction decoration, which is used to control IEEE conformance in floating-point expression evaluation, only supports two states, one of which is full strictness and the other is less strict than is typically allowed by -ffast-math in CPU compilers. This means that any code for which this relaxed state is not sufficient must enable the strictest mode and pay the cost associated with that. Additionally, SPIR-V already contains decorations to give finer-grained control over floating-point operations which are used by other APIs. Using different control mechanisms gives an unnecessary incompatibility between SPIR-V modules for different APIs and adds an associated cost to tooling. This proposal aims to provide more flexible and wider ranging control over floating-point evaluation. ## 2. Proposal Allow use of SPV_KHR_float_controls2 in Vulkan. The SPIR-V extension adopts and extends the floating-point controls that are used for Kernel SPIR-V. This eliminates the difference in how these controls are specified between APIs, simplifying SPIR-V and, in the long-term, reducing tooling costs. The floating-point controls are specified per-instruction, so code requiring varying strictness can be freely mixed and the appropriate optimizations applied to all of it. The controls are finer-grained so that code that requires stricter evaluation than the Vulkan default is not forced to disable larger classes of optimization than may be required. Float controls may be added to a much wider class of instructions, allowing the use of more builtin functions more often. ## 3. Issues ### 3.1. Should support for all combinations of float controls be required? This proposal is aimed at increasing the flexibility of float controls, not raising the minimum support. In order that this can be implemented everywhere, if the existing features are not supported then the related fine-grained controls must not be set. ### 3.2. Which extended instructions should support float controls? The simplest answer and the one that provides the best solution to the problem of these instructions not being usable in shaders that require high precision is to support the controls on all of them. That is what is proposed here, although this does add an implementation requirement to support infinities and NaNs in these instructions. Since the utility of this extension is greatly decreased if developers have to support both the existing and the new way of specifying float controls, getting wide adoption is an important part of solving all the problems. Therefore, if the increased implementation requirement blocks or delays adoption, it should be dropped. This could be done by requiring that apps not change the executio…[truncated]</excerpt> </source> <omitted_sources count="26">Additional source records were omitted from this bounded result.</omitted_sources> </source_evidence> Citations: - 1: https://docs.vulkan.org/refpages/latest/refpages/source/VkPhysicalDeviceShaderFloatControls2Features.html?utm_source=openai - 2: https://docs.vulkan.org/refpages/latest/refpages/source/VK_KHR_shader_float_controls2.html?utm_source=openai ``` --- 🏁 Script executed: ```bash set -u printf '%s\n' '--- feature query chain and error handling ---' nl -ba tests/ShaderRecompilerComputeTests.cpp | sed -n '20395,20435p;20500,20595p;20705,20770p;48980,49020p' printf '%s\n' '--- RequireVk declaration/definition ---' rg -n -F --glob '*.cpp' --glob '*.h' -e 'RequireVk' -e 'RequireVulkanSuccess' tests include source || test "$?" -eq 1 ``` Repository: KytyPS5/KytyPS5 Length of output: 19030 --- 🌐 Web query: `site:docs.vulkan.org Vulkan vkCreateDevice VK_ERROR_FEATURE_NOT_PRESENT enabled feature not supported extension advertised feature query` 💡 Result: ``` <source_evidence> <source kind="search"> <title>Devices and Queues :: Vulkan Documentation Project</title> <location>https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html</location> <excerpt>citeturn0search1 [wordlim: 200] Crawled: 2 weeks ago; If any requested feature is not supported, `vkCreateDevice` must return VK_ERROR_FEATURE_NOT_PRESENT. `vkCreateDevice` verifies that extensions and features requested in the `ppEnabledExtensionNames` and `pEnabledFeatures` members of `pCreateInfo`, respectively, are supported by the implementation. If any requested extension is not supported, `vkCreateDevice` must return VK_ERROR_EXTENSION_NOT_PRESENT. If any requested feature is not supported, `vkCreateDevice` must return VK_ERROR_FEATURE_NOT_PRESENT. Support for extensions can be checked before creating a device by querying vkEnumerateDeviceExtensionProperties. Support for features can similarly be checked by querying vkGetPhysicalDeviceFeatures. After verifying and enabling the extensions the `VkDevice` object is created and returned to the application. Multiple logical devices can be created from the same physical device. Logical device creation may fail due to lack of device-specific resources (in addition to other errors). If that occurs, `vkCreateDevice` will return VK_ERROR_TOO_MANY_OBJECTS. Valid Usage * VUID-vkCreateDevice-ppEnabledExtensionNames-01387 All required device extensions for each extension in the VkDeviceCreateInfo::`ppEnabledExtensionNames` list must also be present in that list Valid Usage (Implicit) * VUID-vkCreateDevice-physicalDevice-parameter `physicalDevice` must be a valid VkPhysicalDevice handle * VUID-vkCreateDevice-pCreateInfo-parameter `pCreateInfo` must be a valid pointer to a valid VkDeviceCreateInfo structure * VUID-vkCreateDevice-pAllocator-parameter If `pAllocator` is not `NULL`, `pAllocator` must be a valid pointer to a valid VkAllocationCallbacks structure * VUID-vkCreateDevice-pDevice-parameter `pDevice` must be a valid pointer to a VkDevice handle Return Codes Success * VK_SUCCESS Failure * VK_ERROR_DEVICE_LOST * VK_ERROR_EXTENSION_NOT_PRESENT * VK_ERROR_FEATURE_NOT_PRESENT * VK_ERROR_INITIALIZATION_FAILED </excerpt> </source> <source kind="search"> <title>Features :: Vulkan Documentation Project</title> <location>https://docs.vulkan.org/spec/latest/chapters/features.html</location> <excerpt>citeturn0search0 [wordlim: 200] Crawled: 2 weeks ago; When a promoted extension is available, any corresponding feature aliases must be supported. ... If a feature is enabled that the physical device does not support, `VkDevice` creation will fail and return VK_ERROR_FEATURE_NOT_PRESENT.The fine-grained features are enabled by passing a pointer to the `VkPhysicalDeviceFeatures` structure via the `pEnabledFeatures` member of the VkDeviceCreateInfo structure that is passed into the `vkCreateDevice` call. ... * `performanceCounterMultipleQueryPools` indicates whether the implementation supports using multiple performance query pools in a primary command buffer and secondary command buffers executed within it. # Features Features advertise additional functionality which can be enabled in the API. If a feature is supported by a physical device, it must be enabled when creating a VkDevice in order to use its associated functionality with that VkDevice. If a feature is unsupported, that functionality cannot be used with that VkDevice. | Features are reported via the extensible structure `VkPhysicalDeviceFeatures2`, which was added in the `VK_KHR_get_physical_device_properties2` extension and included in Vulkan 1.1. When new features are added in future Vulkan versions or extensions, each extension should introduce one new feature structure, if needed. This structure can be added to the `pNext` chain of the `VkPhysicalDeviceFeatures2` structure. For convenience, new core versions of Vulkan may introduce new unified feature structures for features promoted from extensions. At the same time, the extension’s original feature structure (if any) is also promoted to the core API, and is an alias of the extension’s structure. `physicalDevice` must be a valid VkPhysicalDevice handle * VUID-vkGetPhysicalDeviceFeatures-pFeatures-parameter `pFeatures` must be a valid pointer to a VkPhysicalDeviceFeatures structure Fine-grained features used by a logical device must be enabled at `VkDevice` creation time. If a feature is enabled that the physical device does not support, `VkDevice` creation will fail and return VK_ERROR_FEATURE_NOT_PRESENT. The fine-grained features are enabled by passing a pointer to the `VkPhysicalDeviceFeatures` structure via the `pEnabledFeatures` member of the VkDeviceCreateInfo structure that is passed into the `vkCreateDevice` call. If a member of `pEnabledFeatures` is VK_TRUE or VK_FALSE, then the device will be created with the indicated feature enabled or disabled, respectively. Features can also be enabled by using the VkPhysicalDeviceFeatures2 structure. If an application wishes to enable all features supported by a device, it can simply pass in the `VkPhysicalDeviceFeatures` structure that was previously returned by `vkGetPhysicalDeviceFeatures`. To disable an individual feature, the application can set the desired member to VK_FALSE in the same structure. Setting `pEnabledFeatures` to `NULL` and not including a VkPhysicalDeviceFeatures2 in the `pNext` chain of VkDeviceCreateInfo is equivalent to setting all members of the structure to VK_FALSE. </excerpt> </source> <source kind="search"> <title>vkCreateDevice(3) :: Vulkan Documentation Project</title> <location>https://docs.vulkan.org/refpages/latest/refpages/source/vkCreateDevice.html</location> <excerpt>citeturn0search2 [wordlim: 200] Crawled: 2 weeks ago; If any requested extension is not supported, `vkCreateDevice` must return VK_ERROR_EXTENSION_NOT_PRESENT.If any requested feature is not supported, `vkCreateDevice` must return VK_ERROR_FEATURE_NOT_PRESENT. ... This page is extracted from the Vulkan Specification. * `pDevice` is a pointer to a handle in which the created VkDevice is returned. ## Description `vkCreateDevice` verifies that extensions and features requested in the `ppEnabledExtensionNames` and `pEnabledFeatures` members of `pCreateInfo`, respectively, are supported by the implementation. If any requested extension is not supported, `vkCreateDevice` must return VK_ERROR_EXTENSION_NOT_PRESENT. If any requested feature is not supported, `vkCreateDevice` must return VK_ERROR_FEATURE_NOT_PRESENT. Support for extensions can be checked before creating a device by querying vkEnumerateDeviceExtensionProperties. Support for features can similarly be checked by querying vkGetPhysicalDeviceFeatures. After verifying and enabling the extensions the `VkDevice` object is created and returned to the application. Multiple logical devices can be created from the same physical device. Logical device creation may fail due to lack of device-specific resources (in addition to other errors). If that occurs, `vkCreateDevice` will return VK_ERROR_TOO_MANY_OBJECTS. Valid Usage * VUID-vkCreateDevice-ppEnabledExtensionNames-01387 All required device extensions for each extension in the VkDeviceCreateInfo::`ppEnabledExtensionNames` list must also be present in that list Valid Usage (Implicit) * VUID-vkCreateDevice-physicalDevice-parameter `physicalDevice` must be a valid VkPhysicalDevice handle * VUID-vkCreateDevice-pCreateInfo-parameter `pCreateInfo` must be a valid pointer to a valid VkDeviceCreateInfo structure * VUID-vkCreateDevice-pAllocator-parameter If `pAllocator` is not `NULL`, `pAllocator` must be a valid pointer to a valid VkAllocationCallbacks structure * VUID-vkCreateDevice-pDevice-parameter `pDevice` must be a valid pointer to a VkDevice handle Return Codes Success * VK_SUCCESS Failure * VK_ERROR_DEVICE_LOST * VK_ERROR_EXTENSION_NOT_PRESENT * VK_ERROR_FEATURE_NOT_PRESENT * VK_ERROR_INITIALIZATION_FAILED * VK_ERROR_OUT_OF_DEVICE_MEMORY * VK_ERROR_OUT_OF_HOST_MEMORY * VK_ERROR_TOO_MANY_OBJECTS * VK_ERROR_UNKNOWN * VK_ERROR_VALIDATION_FAILED ## See Also VK_VERSION_1_0, VkAllocationCallbacks, VkDevice, VkDeviceCreateInfo, VkPhysicalDevice ## Document Notes For more information, see the Vulkan Specification. This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.</excerpt> </source> <source kind="search"> <title>Querying Properties, Extensions, Features, Limits, and Formats :: Vulkan Documentation Project</title> <location>https://docs.vulkan.org/guide/latest/querying_extensions_features.html</location> <excerpt>citeturn0search3 [wordlim: 200] Crawled: 2 weeks ago; While all of these extended items are found by default in the Vulkan Headers, it is undefined behavior to use extended Vulkan if the extensions are not enabled. ... Features describe functionality which is not supported on all implementations. ... A common technique is for an extension to expose a new struct that can be passed through `pNext` that adds more features to be queried. ... Vulkan provides many `VkFormat` that have multiple `VkFormatFeatureFlags` each holding various VkFormatFeatureFlagBits bitmasks that can be queried. ... The Vulkan Hardware Capability Viewer app developed by Sascha Willems, is an Android app to display all details for devices that support Vulkan. While all of these extended items are found by default in the Vulkan Headers, it is undefined behavior to use extended Vulkan if the extensions are not enabled. ## Features | Check out the Enabling Features chapter for more information. Features describe functionality which is not supported on all implementations. Features can be queried and then enabled when creating the `VkDevice`. Besides the list of all features, some features are mandatory due to newer Vulkan versions or use of extensions. A common technique is for an extension to expose a new struct that can be passed through `pNext` that adds more features to be queried. ## Limits Limits are implementation-dependent minimums, maximums, and other device characteristics that an application may need to be aware of. Besides the list of all limits, some limits also have minimum/maximum required values guaranteed from a Vulkan implementation. ## Formats Vulkan provides many `VkFormat` that have multiple `VkFormatFeatureFlags` each holding various VkFormatFeatureFlagBits bitmasks that can be queried. Check out the Format chapter for more information. ## Tools There are a few tools to help with getting all the information in a quick and in a human readable format. `vulkaninfo` is a command line utility for Windows, Linux, and macOS that enables you to see all the available items listed above about your GPU. Refer to the Vulkaninfo documentation in the Vulkan SDK. The Vulkan Hardware Capability Viewer app developed by Sascha Willems, is an Android app to display all details for devices that support Vulkan.</excerpt> </source> <source kind="search"> <title>Enabling Extensions :: Vulkan Documentation Project</title> <location>https://docs.vulkan.org/guide/latest/enabling_extensions.html</location> <excerpt>citeturn0search4 [wordlim: 200] Crawled: 2 weeks ago; An application can query the physical device first to check if the extension is supported with `vkEnumerateInstanceExtensionProperties` or `vkEnumerateDeviceExtensionProperties`. ... Even if the extension is supported by the implementation, it is undefined behavior to use the functionality of the extension unless it is enabled at `VkInstance` or `VkDevice` creation time. ... vkCreateDevice(physicalDevice, &amp;device_create_info, nullptr, &amp;myDevice);` ... * If `VK_KHR_8bit_storage` is not found in `vkEnumerateDeviceExtensionProperties` then the `storageBuffer8BitAccess` feature might be supported and can be checked by querying `VkPhysicalDeviceVulkan12Features::storageBuffer8BitAccess`. instance_create_info.ppEnabledExtensionNames = instance_extensions.data(); vkCreateInstance(&amp;instance_create_info, nullptr, &amp;myInstance); // ... std::vector&lt;const char*&gt; device_extensions; device_extensions.push_back(VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME); VkDeviceCreateInfo device_create_info = {}; device_create_info.enabledExtensionCount = static_cast&lt;uint32_t&gt;(device_extensions.size()); device_create_info.ppEnabledExtensionNames = device_extensions.data(); vkCreateDevice(physicalDevice, &amp;device_create_info, nullptr, &amp;myDevice);` ## Check for feature bits It is important to remember that extensions add the existence of functionality to the Vulkan spec, but this doesn’t mean that all features of an extension are available if the extension is supported. An example is an extension such as `VK_KHR_8bit_storage`, which has 3 features it exposes in `VkPhysicalDevice8BitStorageFeatures`. Image: enabling_extensions_8bit.png This means after enabling the extension, an application will still need to query and enable the features needed from an extension. </excerpt> </source> <omitted_sources count="8">Additional source records were omitted from this bounded result.</omitted_sources> </source_evidence> Citations: - 1: https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html?utm_source=openai - 2: https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html?utm_source=openai ``` --- 🏁 Script executed: ```bash nl -ba tests/ShaderRecompilerComputeTests.cpp | sed -n '985,1025p' ``` Repository: KytyPS5/KytyPS5 Length of output: 1771 --- </details> **Query `shaderFloatControls2` before enabling it.** The extension does not guarantee that its feature bit is supported. If the extension is advertised but `shaderFloatControls2` is false, `vkCreateDevice` returns `VK_ERROR_FEATURE_NOT_PRESENT`, and `RequireVk` reports the failure before the float min/max tests run. Set `m_float_controls2` only when both the extension and feature bit are supported. <details> <summary>Suggested fix</summary> ```diff + bool float_controls2_extension = false; for (const auto &extension : m_physical_device.enumerateDeviceExtensionProperties().value) { if (std::strcmp(extension.extensionName, - VK_KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME) == 0) - m_float_controls2 = true; + VK_KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME) == 0) { + float_controls2_extension = true; + break; + } + } + if (float_controls2_extension) { + vk::PhysicalDeviceShaderFloatControls2FeaturesKHR available_float_controls2{}; + vk::PhysicalDeviceFeatures2 float_controls2_features{}; + float_controls2_features.sType = vk::StructureType::ePhysicalDeviceFeatures2; + float_controls2_features.pNext = &available_float_controls2; + m_physical_device.getFeatures2(&float_controls2_features); + m_float_controls2 = available_float_controls2.shaderFloatControls2; } ``` </details> <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. ```suggestion // Optional: host float min/max needs float controls 2. bool float_controls2_extension = false; for (const auto &extension : m_physical_device.enumerateDeviceExtensionProperties().value) { if (std::strcmp(extension.extensionName, VK_KHR_SHADER_FLOAT_CONTROLS_2_EXTENSION_NAME) == 0) { float_controls2_extension = true; break; } } if (float_controls2_extension) { vk::PhysicalDeviceShaderFloatControls2FeaturesKHR available_float_controls2{}; vk::PhysicalDeviceFeatures2 float_controls2_features{}; float_controls2_features.sType = vk::StructureType::ePhysicalDeviceFeatures2; float_controls2_features.pNext = &available_float_controls2; m_physical_device.getFeatures2(&float_controls2_features); m_float_controls2 = available_float_controls2.shaderFloatControls2; } vk::PhysicalDeviceShaderFloatControls2FeaturesKHR float_controls2{}; float_controls2.shaderFloatControls2 = true; if (m_float_controls2) { float_controls2.pNext = &robustness2; device_info.pNext = &float_controls2; } ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:medusa:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:b3504c7c85ec321c5f40b086 --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 20bb9c6
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 19:03 UTC · original · reviewed

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 22288c15-2be7-4b35-bfd2-d3cc0c50f55b
📥 Commits

Reviewing files that changed from the base of the PR and between 7306c56e27e1021954d54c61febda8c6f58db6c0 and 970ebecc7207611e589dcaa1fdb6f1a1e26116e6.

📒 Files selected for processing: 6
  • CMakeLists.txt
  • src/graphics/host_gpu/graphicContext.h
  • src/graphics/presentation/window/vulkanWindow.cpp
  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp
  • tests/ShaderRecompilerComputeTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 19:03 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1761#pullrequestreview-5604787148) · **reviewed** <!-- coderabbit-ai-generated:v1 --> **Actionable comments posted: 2** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `22288c15-2be7-4b35-bfd2-d3cc0c50f55b` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 7306c56e27e1021954d54c61febda8c6f58db6c0 and 970ebecc7207611e589dcaa1fdb6f1a1e26116e6. </details> <details> <summary>📒 Files selected for processing: 6</summary> * `CMakeLists.txt` * `src/graphics/host_gpu/graphicContext.h` * `src/graphics/presentation/window/vulkanWindow.cpp` * `src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp` * `tests/ShaderRecompilerComputeTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=021ed9b8-5dfc-40af-afa5-5e690f4b321f attempt=72cf9066-4a46-4e27-811f-b4693192bf5c batch=1/1 -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 19:17 UTC · original
On tests/ShaderRecompilerComputeTests.cpp line 2010 (outdated):

@@ -2001,6 +2001,14 @@ class VulkanHarness {
 public:
   VulkanHarness() { Init(); }
   ~VulkanHarness() { Destroy(); }
+  // Host float min/max is used on RADV, as in Kyty.
+  [[nodiscard]] bool SupportsNativeFloatMinMax() const {
+    vk::PhysicalDeviceDriverProperties driver{};
+    vk::PhysicalDeviceProperties2 properties{};
+    properties.pNext = &driver;
+    m_physical_device.getProperties2(&properties);
+    return driver.driverID == vk::DriverId::eMesaRadv;

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

rg -n -C 8 'SupportsNativeFloatMinMax|float-min-max-only|SetNativeFloatMinMax|shaderFloatControls2|PhysicalDeviceShaderFloatControls2|VulkanCreateDevice|CreateVulkan|FloatControls2|NMin|NMax' tests/ShaderRecompilerComputeTests.cpp src/graphics/presentation/window/vulkanWindow.cpp src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h

Repository: KytyPS5/KytyPS5

Length of output: 16778


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- harness declarations/init and feature chain ---'
sed -n '2000,2145p' tests/ShaderRecompilerComputeTests.cpp
sed -n '20590,20740p' tests/ShaderRecompilerComputeTests.cpp
printf '%s\n' '--- RunCase ---'
sed -n '21080,21170p' tests/ShaderRecompilerComputeTests.cpp
printf '%s\n' '--- production VulkanCreateDevice and CreateVulkan ordering ---'
sed -n '423,515p' src/graphics/presentation/window/vulkanWindow.cpp
sed -n '980,1080p' src/graphics/presentation/window/vulkanWindow.cpp
printf '%s\n' '--- emitter FloatControls2/module declarations ---'
rg -n -C 8 -F -- 'FloatControls2' src tests

Repository: KytyPS5/KytyPS5

Length of output: 28404


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- all relevant feature/module references ---'
rg -n -C 5 -F -- 'shaderFloatControls2' . || test "$?" -eq 1
rg -n -C 5 -F -- 'FloatControls2' . || test "$?" -eq 1
rg -n -C 5 -F -- 'SPV_KHR_float_controls2' . || test "$?" -eq 1
printf '%s\n' '--- harness Init declaration and feature querying ---'
rg -n -C 12 -F -- 'void Init()' tests/ShaderRecompilerComputeTests.cpp
sed -n '20480,20710p' tests/ShaderRecompilerComputeTests.cpp
printf '%s\n' '--- production device feature query continuation ---'
sed -n '480,650p' src/graphics/presentation/window/vulkanWindow.cpp

Repository: KytyPS5/KytyPS5

Length of output: 23624


Gate native execution on the enabled shaderFloatControls2 feature.

SupportsNativeFloatMinMax() accepts every RADV device, but VulkanHarness::Init neither queries nor enables shaderFloatControls2. The selector therefore runs native cases on RADV instead of making them compile-only. Query and enable the feature during device creation, store the enabled state, and require that state in SupportsNativeFloatMinMax().

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 19:17 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1761#discussion_r4340947540) On `tests/ShaderRecompilerComputeTests.cpp` line 2010 (outdated): ```diff @@ -2001,6 +2001,14 @@ class VulkanHarness { public: VulkanHarness() { Init(); } ~VulkanHarness() { Destroy(); } + // Host float min/max is used on RADV, as in Kyty. + [[nodiscard]] bool SupportsNativeFloatMinMax() const { + vk::PhysicalDeviceDriverProperties driver{}; + vk::PhysicalDeviceProperties2 properties{}; + properties.pNext = &driver; + m_physical_device.getProperties2(&properties); + return driver.driverID == vk::DriverId::eMesaRadv; ``` <!-- coderabbit-ai-generated:v1 --> **🩺 Stability & Availability** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash rg -n -C 8 'SupportsNativeFloatMinMax|float-min-max-only|SetNativeFloatMinMax|shaderFloatControls2|PhysicalDeviceShaderFloatControls2|VulkanCreateDevice|CreateVulkan|FloatControls2|NMin|NMax' tests/ShaderRecompilerComputeTests.cpp src/graphics/presentation/window/vulkanWindow.cpp src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h ``` Repository: KytyPS5/KytyPS5 Length of output: 16778 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- harness declarations/init and feature chain ---' sed -n '2000,2145p' tests/ShaderRecompilerComputeTests.cpp sed -n '20590,20740p' tests/ShaderRecompilerComputeTests.cpp printf '%s\n' '--- RunCase ---' sed -n '21080,21170p' tests/ShaderRecompilerComputeTests.cpp printf '%s\n' '--- production VulkanCreateDevice and CreateVulkan ordering ---' sed -n '423,515p' src/graphics/presentation/window/vulkanWindow.cpp sed -n '980,1080p' src/graphics/presentation/window/vulkanWindow.cpp printf '%s\n' '--- emitter FloatControls2/module declarations ---' rg -n -C 8 -F -- 'FloatControls2' src tests ``` Repository: KytyPS5/KytyPS5 Length of output: 28404 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- all relevant feature/module references ---' rg -n -C 5 -F -- 'shaderFloatControls2' . || test "$?" -eq 1 rg -n -C 5 -F -- 'FloatControls2' . || test "$?" -eq 1 rg -n -C 5 -F -- 'SPV_KHR_float_controls2' . || test "$?" -eq 1 printf '%s\n' '--- harness Init declaration and feature querying ---' rg -n -C 12 -F -- 'void Init()' tests/ShaderRecompilerComputeTests.cpp sed -n '20480,20710p' tests/ShaderRecompilerComputeTests.cpp printf '%s\n' '--- production device feature query continuation ---' sed -n '480,650p' src/graphics/presentation/window/vulkanWindow.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 23624 --- </details> **Gate native execution on the enabled `shaderFloatControls2` feature.** `SupportsNativeFloatMinMax()` accepts every RADV device, but `VulkanHarness::Init` neither queries nor enables `shaderFloatControls2`. The selector therefore runs native cases on RADV instead of making them compile-only. Query and enable the feature during device creation, store the enabled state, and require that state in `SupportsNativeFloatMinMax()`. <!-- fingerprinting:phantom:medusa:caracal --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:914e4843001881b43619f109 --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 19:17 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c4265c84-1ffd-438a-a100-d6bbffbb4736
📥 Commits

Reviewing files that changed from the base of the PR and between 970ebecc7207611e589dcaa1fdb6f1a1e26116e6 and 20bb9c6a4f461a6fd70490229937b9970e56d19a.

📒 Files selected for processing: 4
  • src/graphics/presentation/window/vulkanWindow.cpp
  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp
  • tests/ShaderRecompilerComputeTests.cpp
💤 Files with no reviewable changes: 2
  • src/graphics/presentation/window/vulkanWindow.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp
🚧 Files skipped from review as they are similar to previous changes: 1
  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 19:17 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1761#pullrequestreview-5604971451) · **reviewed** <!-- coderabbit-ai-generated:v1 --> **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `c4265c84-1ffd-438a-a100-d6bbffbb4736` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 970ebecc7207611e589dcaa1fdb6f1a1e26116e6 and 20bb9c6a4f461a6fd70490229937b9970e56d19a. </details> <details> <summary>📒 Files selected for processing: 4</summary> * `src/graphics/presentation/window/vulkanWindow.cpp` * `src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp` * `tests/ShaderRecompilerComputeTests.cpp` </details> <details> <summary>💤 Files with no reviewable changes: 2</summary> * src/graphics/presentation/window/vulkanWindow.cpp * src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes: 1</summary> * src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=f59ac5f9-c52c-4454-bccd-75e16f6e2e82 attempt=dc117939-9fb3-4c04-b561-7dad481a96b4 batch=1/1 -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 19:34 UTC · original
On src/graphics/presentation/window/vulkanWindow.cpp line 1016 (outdated):

@@ -1005,12 +1005,15 @@ void WindowContext::CreateVulkan() {
 		EXIT("Could not find suitable device:%s", rejected_devices.c_str());
 	}
 
+	vk::PhysicalDeviceDriverProperties         driver_properties {};
 	vk::PhysicalDevicePushDescriptorProperties push_descriptor_properties {};
 	vk::PhysicalDeviceProperties2              physical_device_properties {};
+	push_descriptor_properties.pNext = &driver_properties;
 	physical_device_properties.pNext = &push_descriptor_properties;
 	graphic_ctx.physical_device.getProperties2(&physical_device_properties);
 	graphic_ctx.physical_device_properties = physical_device_properties.properties;
 	graphic_ctx.max_push_descriptors       = push_descriptor_properties.maxPushDescriptors;
+	graphic_ctx.driver_id                  = driver_properties.driverID;

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

rg -n -i 'float_controls2|FloatControls2|FloatControls|FPFastMathMode|driver_id|native_float_min_max|NMin|NMax' src/graphics tests/ShaderRecompilerComputeTests.cpp | head -80

Repository: KytyPS5/KytyPS5

Length of output: 8215


🏁 Script executed:

sed -n 470,510p src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp; sed -n 1000,1025p src/graphics/presentation/window/vulkanWindow.cpp

Repository: KytyPS5/KytyPS5

Length of output: 3598


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- float-controls symbols and native profile ---'
rg -n -i -F -e 'VK_KHR_shader_float_controls2' -e 'shaderFloatControls2' -e 'SPV_KHR_float_controls2' -e 'FloatControls2' -e 'FPFastMathMode' -e 'native_float_min_max' -e 'NMin' -e 'NMax' src/graphics tests/ShaderRecompilerComputeTests.cpp || test "$?" -eq 1
printf '%s\n' '--- device creation feature/extension context ---'
rg -n -F -e 'device_extensions' -e 'PhysicalDeviceFeatures2' -e 'PhysicalDeviceVulkan' -e 'FloatControls' -e 'createDevice' src/graphics/presentation/window/vulkanWindow.cpp
sed -n '500,570p' src/graphics/presentation/window/vulkanWindow.cpp
sed -n '850,940p' src/graphics/presentation/window/vulkanWindow.cpp
sed -n '980,1030p' src/graphics/presentation/window/vulkanWindow.cpp
printf '%s\n' '--- emitter native min/max implementation ---'
sed -n '1,170p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp
sed -n '1,80p' src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h
rg -n -F -e 'OpCapability' -e 'OpExtension' -e 'OpDecorate' -e 'FPFastMathMode' src/graphics/shader/recompiler/backend/spirv
printf '%s\n' '--- reviewed-head diff for relevant files ---'
git diff --no-ext-diff --unified=30 f492027be26db4222eb7cf19eea5536dab2e5f9d 1aa2f4734be489384937a778b551f6d3017b2580 -- src/graphics/presentation/window/vulkanWindow.cpp src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp src/graphics/shader/recompiler/backend/spirv

Repository: KytyPS5/KytyPS5

Length of output: 41829


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- required features and device creation ---'
nl -ba src/graphics/presentation/window/vulkanWindow.cpp | sed -n '40,85p;190,235p;640,690p'
printf '%s\n' '--- device extension list and creation call ---'
nl -ba src/graphics/presentation/window/vulkanWindow.cpp | sed -n '970,1070p'
printf '%s\n' '--- SPIR-V module declaration path ---'
rg -n -F -e 'DefineModule' -e 'AddCapability' -e 'AddExtension' -e 'AddDecoration' src/graphics/shader/recompiler/backend/spirv
nl -ba src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp | sed -n '1,120p'

Repository: KytyPS5/KytyPS5

Length of output: 19356


🏁 Script executed:

set -o pipefail
nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp | sed -n '680,770p'
rg -n -F -e 'Capability' -e 'Extension' -e 'Decorate' src/graphics/shader/recompiler/backend/spirv/SpirvBuilder.* src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp

Repository: KytyPS5/KytyPS5

Length of output: 16731


Make native NMin/NMax conditional on FloatControls2.

ProgramCache selects native emission for every Mesa RADV device based only on driver_id. The device path does not enable VK_KHR_shader_float_controls2 or shaderFloatControls2. The SPIR-V emitter requires SPV_KHR_float_controls, but it does not declare FloatControls2 or apply FPFastMathMode to NMin/NMax.

Native special-value behavior is therefore unspecified. Enable the Vulkan feature and emit the required SPIR-V controls before selecting native emission. Otherwise, retain emulation.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 19:34 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1761#discussion_r4341107916) On `src/graphics/presentation/window/vulkanWindow.cpp` line 1016 (outdated): ```diff @@ -1005,12 +1005,15 @@ void WindowContext::CreateVulkan() { EXIT("Could not find suitable device:%s", rejected_devices.c_str()); } + vk::PhysicalDeviceDriverProperties driver_properties {}; vk::PhysicalDevicePushDescriptorProperties push_descriptor_properties {}; vk::PhysicalDeviceProperties2 physical_device_properties {}; + push_descriptor_properties.pNext = &driver_properties; physical_device_properties.pNext = &push_descriptor_properties; graphic_ctx.physical_device.getProperties2(&physical_device_properties); graphic_ctx.physical_device_properties = physical_device_properties.properties; graphic_ctx.max_push_descriptors = push_descriptor_properties.maxPushDescriptors; + graphic_ctx.driver_id = driver_properties.driverID; ``` <!-- coderabbit-ai-generated:v1 --> **🎯 Functional Correctness** | **🟠 Major** | **🏗️ Heavy lift** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash rg -n -i 'float_controls2|FloatControls2|FloatControls|FPFastMathMode|driver_id|native_float_min_max|NMin|NMax' src/graphics tests/ShaderRecompilerComputeTests.cpp | head -80 ``` Repository: KytyPS5/KytyPS5 Length of output: 8215 --- 🏁 Script executed: ```bash sed -n 470,510p src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp; sed -n 1000,1025p src/graphics/presentation/window/vulkanWindow.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 3598 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- float-controls symbols and native profile ---' rg -n -i -F -e 'VK_KHR_shader_float_controls2' -e 'shaderFloatControls2' -e 'SPV_KHR_float_controls2' -e 'FloatControls2' -e 'FPFastMathMode' -e 'native_float_min_max' -e 'NMin' -e 'NMax' src/graphics tests/ShaderRecompilerComputeTests.cpp || test "$?" -eq 1 printf '%s\n' '--- device creation feature/extension context ---' rg -n -F -e 'device_extensions' -e 'PhysicalDeviceFeatures2' -e 'PhysicalDeviceVulkan' -e 'FloatControls' -e 'createDevice' src/graphics/presentation/window/vulkanWindow.cpp sed -n '500,570p' src/graphics/presentation/window/vulkanWindow.cpp sed -n '850,940p' src/graphics/presentation/window/vulkanWindow.cpp sed -n '980,1030p' src/graphics/presentation/window/vulkanWindow.cpp printf '%s\n' '--- emitter native min/max implementation ---' sed -n '1,170p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp sed -n '1,80p' src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h rg -n -F -e 'OpCapability' -e 'OpExtension' -e 'OpDecorate' -e 'FPFastMathMode' src/graphics/shader/recompiler/backend/spirv printf '%s\n' '--- reviewed-head diff for relevant files ---' git diff --no-ext-diff --unified=30 f492027be26db4222eb7cf19eea5536dab2e5f9d 1aa2f4734be489384937a778b551f6d3017b2580 -- src/graphics/presentation/window/vulkanWindow.cpp src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp src/graphics/shader/recompiler/backend/spirv ``` Repository: KytyPS5/KytyPS5 Length of output: 41829 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- required features and device creation ---' nl -ba src/graphics/presentation/window/vulkanWindow.cpp | sed -n '40,85p;190,235p;640,690p' printf '%s\n' '--- device extension list and creation call ---' nl -ba src/graphics/presentation/window/vulkanWindow.cpp | sed -n '970,1070p' printf '%s\n' '--- SPIR-V module declaration path ---' rg -n -F -e 'DefineModule' -e 'AddCapability' -e 'AddExtension' -e 'AddDecoration' src/graphics/shader/recompiler/backend/spirv nl -ba src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp | sed -n '1,120p' ``` Repository: KytyPS5/KytyPS5 Length of output: 19356 --- 🏁 Script executed: ```bash set -o pipefail nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp | sed -n '680,770p' rg -n -F -e 'Capability' -e 'Extension' -e 'Decorate' src/graphics/shader/recompiler/backend/spirv/SpirvBuilder.* src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 16731 --- </details> **Make native `NMin`/`NMax` conditional on FloatControls2.** `ProgramCache` selects native emission for every Mesa RADV device based only on `driver_id`. The device path does not enable `VK_KHR_shader_float_controls2` or `shaderFloatControls2`. The SPIR-V emitter requires `SPV_KHR_float_controls`, but it does not declare `FloatControls2` or apply `FPFastMathMode` to `NMin`/`NMax`. Native special-value behavior is therefore unspecified. Enable the Vulkan feature and emit the required SPIR-V controls before selecting native emission. Otherwise, retain emulation. <!-- fingerprinting:phantom:medusa:beignet55 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:bdd04acca5f9aca0c61f0877 --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-21 19:34 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 414e728f-a8d2-474f-9830-66adb18dcfdf
📥 Commits

Reviewing files that changed from the base of the PR and between 72c3f97ecdd6e7fada96d7a14f718ff7b5dc398a and 1aa2f4734be489384937a778b551f6d3017b2580.

📒 Files selected for processing: 12
  • src/graphics/host_gpu/graphicContext.h
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
  • src/graphics/presentation/window/vulkanWindow.cpp
  • src/graphics/shader/recompiler/ShaderRecompiler.cpp
  • src/graphics/shader/recompiler/ShaderRecompiler.h
  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp
  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h
  • tests/ShaderRecompilerComputeTests.cpp
  • tests/shaderCfgTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-21 19:34 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1761#pullrequestreview-5605172202) · **reviewed** <!-- coderabbit-ai-generated:v1 --> **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `414e728f-a8d2-474f-9830-66adb18dcfdf` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 72c3f97ecdd6e7fada96d7a14f718ff7b5dc398a and 1aa2f4734be489384937a778b551f6d3017b2580. </details> <details> <summary>📒 Files selected for processing: 12</summary> * `src/graphics/host_gpu/graphicContext.h` * `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` * `src/graphics/presentation/window/vulkanWindow.cpp` * `src/graphics/shader/recompiler/ShaderRecompiler.cpp` * `src/graphics/shader/recompiler/ShaderRecompiler.h` * `src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp` * `src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h` * `tests/ShaderRecompilerComputeTests.cpp` * `tests/shaderCfgTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=ea002423-03e1-499b-bf25-a5df5d693beb attempt=2c625ba2-cfc7-4692-bd40-001517d64856 batch=1/1 -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.