Skip to content

fix: accept integrated GPUs in physical device selection#9

Open
DasPauluteli wants to merge 1 commit into
Minecraft-Radiance:mainfrom
DasPauluteli:fix/apu-integrated-gpu-device-selection
Open

fix: accept integrated GPUs in physical device selection#9
DasPauluteli wants to merge 1 commit into
Minecraft-Radiance:mainfrom
DasPauluteli:fix/apu-integrated-gpu-device-selection

Conversation

@DasPauluteli

Copy link
Copy Markdown

Problem

findPhysicalDevice() in src/core/vulkan/physical_device.cpp has a hard-coded filter that rejects any device that is not VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU:

if (properties.deviceType != VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) continue;

This silently discards APUs and integrated GPUs that fully satisfy every actual capability requirement, causing an immediate crash on startup:

[PhysicalDevice] No suitable physical device found!

This affects at least:

Fix

Remove the device-type filter. isDeviceSuitable() already checks every capability that actually matters:

  • VK_KHR_swapchain
  • VK_KHR_ray_tracing_pipeline
  • accelerationStructure
  • synchronization2
  • bufferDeviceAddress

Selection is now purely capability-based.

Tested on

Field Value
GPU AMD Radeon 8060S Graphics (RADV STRIX_HALO)
GPU type VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
Vulkan API 1.4.348
Driver RADV 26.1.0
Vendor AMD (0x1002)
OS CachyOS (Arch-based), KDE Plasma 6 / Wayland
CPU AMD Ryzen AI Max+ 395 (RDNA4 APU, gfx1151, STRIX_HALO)
Radiance 0.1.5-alpha, Fabric 1.21.4

All RT extensions confirmed present: VK_KHR_acceleration_structure, VK_KHR_ray_tracing_pipeline, VK_KHR_ray_query.

Diff

-            if (properties.deviceType != VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) continue;
-
             physicalDevice_ = device;

The suitability check in findPhysicalDevice() already validates all
required capabilities (VK_KHR_ray_tracing_pipeline + acceleration
structure + synchronization2 + bufferDeviceAddress). The additional
hard-coded filter for VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU silently
rejects APUs and integrated GPUs that fully support ray tracing,
producing the "[PhysicalDevice] No suitable physical device found!"
crash at startup.

Remove the device-type filter so that selection is capability-based.

Fixes Radiance#214, Radiance#240. Also likely fixes Radiance#87
(Intel Arc 140T reports as INTEGRATED_GPU and crashes the same way).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Interstellarss

Copy link
Copy Markdown
Collaborator

I think there is a selection mechanism in the dev branch for version 0.1.3-alpha, but at the time it is not really working on a intel integrated GPU that has ray tracing unit. If it is working on a amd integrated gpu, could you also share the performance on this device?

@Interstellarss Interstellarss self-assigned this May 17, 2026
PEQHUB referenced this pull request in PEQHUB/MCVR Jun 9, 2026
The final sprint of the day. Brings up real ray tracing against real
chunk geometry: per-chunk BLAS builds, full TLAS rebuild from BLAS
instances, an MVP shader trio, and a RayTracingAdapter::execute that
actually calls vkCmdTraceRaysKHR.

Acceleration structure services:
  * blas_service: per-chunk bottom-level AS via
    vkCmdBuildAccelerationStructuresKHR. Shared 32 MB scratch buffer
    (no per-chunk allocation thrash). Post-build barrier
    AS_BUILD_WRITE -> RT_SHADER_READ. Old BLAS released synchronously
    on chunk re-upload (deferred-delete is risk #1 for follow-up).
    No compaction yet (risk #3); ALLOW_COMPACTION_BIT not set.
  * tlas_service: full-rebuild TLAS from BLAS instance list. Builds two
    parallel BDA SSBOs alongside the TLAS so the closest-hit shader can
    fetch vertex/index buffers via gl_InstanceCustomIndexEXT. Chunk-origin
    SSBO is currently zero-filled - TODO at tlas_service.cpp:73 to thread
    GpuChunkData.origin through BlasData (risk #4).

Ray tracing adapter execute side:
  * raytracing_adapter.cpp: full implementation.
    - init: loads v2_world.{rgen,rmiss,rchit}, builds RT pipeline via
      vk2::RtPipeline + ShaderBindingTable.
    - registerPass: declares output (RT_HDR_OUTPUT, rgba16f), no inputs.
    - execute (per frame):
        1. Allocate 4 descriptor sets via vk2::DescriptorAllocator
        2. Write set 0 (TLAS), set 1 (vertex/index BDA SSBOs from TLAS),
           set 2 (WorldUBO + SkyUBO from SceneResourceService),
           set 3 (output storage image)
        3. vkCmdBindPipeline + vkCmdBindDescriptorSets x4
        4. vkCmdTraceRaysKHR(cmd, rgen, miss, hit, callable, w, h, 1)
    - Per-frame full descriptor allocation costs scale with bindless slot
      count - risk #9 for the 4096-texture case.

MVP shader trio (v2_min/):
  * v2_world.rgen (94 lines): reads camera from WorldUBO, generates primary
    rays through pixel center, calls traceRayEXT, writes rgba16f.
  * v2_world.rmiss (31 lines): sky gradient from SkyUBO.horizonColor ->
    SkyUBO.baseColor + simple sun-disc dot-product against SkyUBO.sunDir.
  * v2_world.rchit (86 lines): gl_InstanceCustomIndexEXT -> per-instance
    BDA SSBO -> uvec3 indices -> 3 PBRTriangle vertices -> barycentric
    interpolation -> face normal -> Lambertian shading against sun
    direction. No PBR/shadows/GI yet - those come with PR39+.

Closes PR33 (BLAS), PR34 (TLAS), PR35 (RT pipeline init), PR36 (first rays).

This is the buildable checkpoint - core.dll @ MCVR/bin/core.dll built
cleanly at 23:53:49 on 2026-04-06 from the working tree at this commit.

Remaining tactical work (per FUTURE-INSPECT.md follow-ups):
  PR37 - denoiser (SVGF / TAA)
  PR39 - real material shading (replaces v2_min Lambertian)
  PR40 - DLSS-RR upscaler integration
  PR41 - NRD denoiser integration
  PR42 - Frame Gen integration
  PR43 - V2 config snapshot wiring
  PR44 - legacy renderer removal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants