demons-souls: improve Vulkan graphics pipeline, indirect descriptors,… #477

Closed
github-bot wants to merge 1 commit from gh-pr/477/head into gh-pr/477/base
Owner

@⁠LordixDemon on GitHub · 2026-09-03 19:18 UTC · original
LordixDemon:demons-souls → main · +4128 −3878 · 97 files · 1 commits · closed without merging

Summary

This PR introduces critical fixes to the Vulkan graphics pipeline, implements 1-level indirect image descriptor table materialization, fixes texture tiler bounds assertions, and implements essential Ngs2 audio stubs.

With these changes, Demon's Souls (PPSA01341) now successfully boots past the intro screens, main menu, and loading sequences, reaching actual gameplay. While the current in-game framerate is very modest, reaching gameplay without fatal pipeline errors or crashes lays a solid foundation for subsequent performance and rendering optimizations.


Game Status

  • Status: Boots into gameplay (intro -> menus -> character creation / loading -> in-game)
  • Performance: Very modest FPS in-game at present, but execution is stable with shaders compiling continuously without validation errors or GPU crashes.
  • Test Suites: 100% passed (36/36 tests passing via ctest).

Technical Details

1. Vulkan Pipeline & Device Initialization

  • Device Feature Validation (vulkanWindow.cpp): Relaxed the overly strict Vulkan 1.2 shaderBufferInt64Atomics = VK_TRUE requirement during physical device enumeration, preventing modern desktop GPUs from being incorrectly skipped (skip_device = true) or failing device creation.
  • Resilient Depth/Stencil Pipeline (depthRenderTarget.cpp): Replaced fatal aborts (DepthFatal) triggered by non-standard register states with graceful fallbacks (defaulting to standard host formats D32_SFLOAT / D32_SFLOAT_S8_UINT, fallback pitch-based tile dimension calculations, and skipping inactive depth passes instead of terminating the process).
  • Color Target Masking (colorRenderTarget.cpp, renderDraw.cpp): Switched attachment write validation to render_target_write_mask, taking BlendControl and component write masks into account rather than relying solely on raw target slot masks.
  • Vertex Input Assembly (shaders.cpp): Restored dynamic vertex input layout generation (VkVertexInputBindingDescription, VkVertexInputAttributeDescription), correctly deriving strides, attribute formats, used component counts, and guest out-of-bounds behavior.

2. Shader Recompiler & Indirect Descriptors

  • Direct 1-Level Indirect Image Tables (ResourceMaterialization.cpp, ResourceTracking.cpp): Added support for 1-level direct indirect image descriptor tables (material_source == UINT32_MAX) loaded dynamically via s_buffer_load_dwordx8, matching the dynamic texture indexing scheme used by Demon's Souls.
  • Candidate Descriptor Harmonization: Ensured indirect descriptor candidates are harmonized to match exemplar dimensions and format types.
  • Specialization Memory Fallback (pipelineCache.cpp): Added TryReadBacking memory fallback when reading guest memory during pipeline cache specialization.
  • Shader Flow Adjustments (spirvEmitterFlow.cpp): Preserved albedo unpacking and alpha channel clamping for specific shadow passes.

3. Texture Tiling & Cache

  • Accurate Capacity Calculations (tiler.cpp): Integrated row pitch and linear slice strides into buffer capacity calculation for both Detile and TileImage.
  • Assertion Relaxations (TileManager::Prepare): Removed overzealous block-rounded tiled capacity assertions that triggered false-positive aborts on valid non-standard texture footprints.
  • Texture Overlaps (textureCache.cpp): Enhanced overlap detection and resolution for layered views and non-depth uploads.

4. Audio Subsystem (audio.cpp)

  • Implemented foundational stubs for the Sony Ngs2 audio subsystem (Ngs2SystemCreateWithAllocator, Ngs2RackCreateWithAllocator, Ngs2SystemRender, and RIFF waveform parsing), preventing game audio threads from stalling or terminating early.
    image_2026-09-03_21-58-27
    image_2026-09-03_21-58-43
    image_2026-09-03_21-59-08
    image_2026-09-03_21-59-22
    image_2026-09-03_21-59-40
    image_2026-09-03_21-43-32
**@⁠LordixDemon** on GitHub · 2026-09-03 19:18 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/477) `LordixDemon:demons-souls` → `main` · +4128 −3878 · 97 files · 1 commits · closed without merging ## Summary This PR introduces critical fixes to the Vulkan graphics pipeline, implements 1-level indirect image descriptor table materialization, fixes texture tiler bounds assertions, and implements essential Ngs2 audio stubs. With these changes, **Demon's Souls (*PPSA01341*) now successfully boots past the intro screens, main menu, and loading sequences, reaching actual gameplay.** While the current in-game framerate is very modest, reaching gameplay without fatal pipeline errors or crashes lays a solid foundation for subsequent performance and rendering optimizations. --- ## Game Status * **Status:** Boots into gameplay (intro -> menus -> character creation / loading -> in-game) * **Performance:** Very modest FPS in-game at present, but execution is stable with shaders compiling continuously without validation errors or GPU crashes. * **Test Suites:** 100% passed (36/36 tests passing via `ctest`). --- ## Technical Details ### 1. Vulkan Pipeline & Device Initialization * **Device Feature Validation (`vulkanWindow.cpp`)**: Relaxed the overly strict Vulkan 1.2 `shaderBufferInt64Atomics = VK_TRUE` requirement during physical device enumeration, preventing modern desktop GPUs from being incorrectly skipped (`skip_device = true`) or failing device creation. * **Resilient Depth/Stencil Pipeline (`depthRenderTarget.cpp`)**: Replaced fatal aborts (`DepthFatal`) triggered by non-standard register states with graceful fallbacks (defaulting to standard host formats `D32_SFLOAT` / `D32_SFLOAT_S8_UINT`, fallback pitch-based tile dimension calculations, and skipping inactive depth passes instead of terminating the process). * **Color Target Masking (`colorRenderTarget.cpp`, `renderDraw.cpp`)**: Switched attachment write validation to `render_target_write_mask`, taking `BlendControl` and component write masks into account rather than relying solely on raw target slot masks. * **Vertex Input Assembly (`shaders.cpp`)**: Restored dynamic vertex input layout generation (`VkVertexInputBindingDescription`, `VkVertexInputAttributeDescription`), correctly deriving strides, attribute formats, used component counts, and guest out-of-bounds behavior. ### 2. Shader Recompiler & Indirect Descriptors * **Direct 1-Level Indirect Image Tables (`ResourceMaterialization.cpp`, `ResourceTracking.cpp`)**: Added support for 1-level direct indirect image descriptor tables (`material_source == UINT32_MAX`) loaded dynamically via `s_buffer_load_dwordx8`, matching the dynamic texture indexing scheme used by Demon's Souls. * **Candidate Descriptor Harmonization**: Ensured indirect descriptor candidates are harmonized to match exemplar dimensions and format types. * **Specialization Memory Fallback (`pipelineCache.cpp`)**: Added `TryReadBacking` memory fallback when reading guest memory during pipeline cache specialization. * **Shader Flow Adjustments (`spirvEmitterFlow.cpp`)**: Preserved albedo unpacking and alpha channel clamping for specific shadow passes. ### 3. Texture Tiling & Cache * **Accurate Capacity Calculations (`tiler.cpp`)**: Integrated row pitch and linear slice strides into buffer capacity calculation for both `Detile` and `TileImage`. * **Assertion Relaxations (`TileManager::Prepare`)**: Removed overzealous block-rounded tiled capacity assertions that triggered false-positive aborts on valid non-standard texture footprints. * **Texture Overlaps (`textureCache.cpp`)**: Enhanced overlap detection and resolution for layered views and non-depth uploads. ### 4. Audio Subsystem (`audio.cpp`) * Implemented foundational stubs for the Sony Ngs2 audio subsystem (`Ngs2SystemCreateWithAllocator`, `Ngs2RackCreateWithAllocator`, `Ngs2SystemRender`, and RIFF waveform parsing), preventing game audio threads from stalling or terminating early. <img width="962" height="566" alt="image_2026-09-03_21-58-27" src="https://github.com/user-attachments/assets/68a6eab7-e015-4d4a-bf53-8cba95ab17b9" /> <img width="962" height="565" alt="image_2026-09-03_21-58-43" src="https://github.com/user-attachments/assets/282b0ec1-820e-4ece-9ddc-604dc80d5e9a" /> <img width="962" height="565" alt="image_2026-09-03_21-59-08" src="https://github.com/user-attachments/assets/94a07afb-5e4e-47a0-9d5c-65d71f5e903e" /> <img width="962" height="564" alt="image_2026-09-03_21-59-22" src="https://github.com/user-attachments/assets/08c137d0-01ad-4c0c-ad35-08113bdd5de2" /> <img width="962" height="566" alt="image_2026-09-03_21-59-40" src="https://github.com/user-attachments/assets/d224094b-b487-47bf-a08a-d6072d992de4" /> <img width="961" height="566" alt="image_2026-09-03_21-43-32" src="https://github.com/user-attachments/assets/3d9da687-e8fe-4149-99df-7ace6eaf6475" />
- Vulkan & Render Targets:
  - Relax overly strict Vulkan 1.2 feature check (shaderBufferInt64Atomics) during device selection in vulkanWindow.cpp.
  - Replace fatal aborts in depthRenderTarget.cpp with graceful fallbacks (defaulting to D32Sfloat/D32SfloatS8Uint, robust tile size calculations, ignoring inactive depth buffers).
  - Use render_target_write_mask instead of raw mask in colorRenderTarget.cpp and renderDraw.cpp to respect blend control and write masks.
  - Restore vertex input descriptor bindings, attribute stride, format deduction, and component tracking in shaders.cpp.

- Shader Recompiler & Indirect Descriptors:
  - Support direct 1-level indirect image tables (material_source == UINT32_MAX) in ResourceMaterialization and ResourceTracking.
  - Add TryReadBacking fallback for guest memory specialization in pipelineCache.
  - Harmonize indirect image descriptor candidates to exemplar formats.
  - Preserve pixel output overrides and shadow pass alpha clamping in spirvEmitterFlow.

- Texture Tiler & Memory:
  - Enhance linear capacity calculations in tiler.cpp with row pitch and slice strides for Detile/TileImage.
  - Remove overzealous block-rounded tiled capacity assertion in TileManager::Prepare.
  - Fix non-depth image uploads and overlap resolution in textureCache.cpp.

- Audio & Cleanliness:
  - Implement Ngs2 audio lifecycle stubs, voice control, and waveform parsing in audio.cpp.
  - Clean up all temporary diagnostic logging, probe counters, and timeline dumps.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:23:02 +00:00
github-bot closed this pull request 2026-11-26 09:23:02 +00:00
Author
Owner

@⁠LordixDemon on GitHub · 2026-09-03 21:13 UTC · original

@⁠Nmzik pls check before u merge a lot of PR's

**@⁠LordixDemon** on GitHub · 2026-09-03 21:13 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/477#issuecomment-5532212073) @⁠Nmzik pls check before u merge a lot of PR's
Author
Owner

@⁠Nmzik on GitHub · 2026-09-03 21:16 UTC · original

@⁠LordixDemon I will cherry pick your fixes. Your PR is based on old code

**@⁠Nmzik** on GitHub · 2026-09-03 21:16 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/477#issuecomment-5532246980) @⁠LordixDemon I will cherry pick your fixes. Your PR is based on old code
Author
Owner

@⁠LordixDemon on GitHub · 2026-09-03 21:24 UTC · original

@⁠Nmzik Sounds good, thank you! I have a few ideas to improve performance and compatibility across different GPU architectures. Is there an official Telegram or Discord where it's possible to discuss the most needed changes?

**@⁠LordixDemon** on GitHub · 2026-09-03 21:24 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/477#issuecomment-5532335044) @⁠Nmzik Sounds good, thank you! I have a few ideas to improve performance and compatibility across different GPU architectures. Is there an official Telegram or Discord where it's possible to discuss the most needed changes?
Author
Owner

@⁠Nmzik on GitHub · 2026-09-24 07:09 UTC · original

closed in favor #500

**@⁠Nmzik** on GitHub · 2026-09-24 07:09 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/477#issuecomment-5809489879) closed in favor #500

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.