sultim-t / prboom-plus-rt

823 stars 49 forks source link

AMD Gpu support? #8

Closed ColinSalem closed 2 years ago

ColinSalem commented 2 years ago

Are there any plans for adding support for AMD Gpus? Would love to play this.

sultim-t commented 2 years ago

If there are some other people with graphics programming skills and AMD GPUs... then yes. It would be really nice to have AMD GPU support

TimoMF commented 2 years ago

I also have an AMD. An RX 6700 XT. It would be nice if AMD Raytracing would also be supported.

Greetings Timo

ColonelPhantom commented 2 years ago

What is stopping support on AMD? I do not own any RDNA2 GPU, so I cannot test, but from what I read here VK_KHR_raytracing_pipeline is used, which is supported on AMD cards.

On Linux, it can even work with older cards thanks to the RADV driver being able to emulate raytracing. (If the game works on Linux, I can also test there, since I have a Polaris GPU.)

PMunkes commented 2 years ago

I don't have access to my RX 6700XT at the moment, so I can't test anything, but I think I may have found a possible culprit. https://github.com/sultim-t/RayTracedGL1/blob/a48aa5d69b103efaab9842eabe5ae639bd034463/Source/RayTracingPipeline.cpp#L196 IIRC RDNA2 currently only supports a maxRayRecursionDepth of 1, which is the minimum required by the Vulkan Specification. It is also the maximum recursion depth for RT pipelines. Since the requested pipeline would require a larger depth than supported, the RDNA2 card would not be able to provide the requested pipeline.

VUID-VkRayTracingPipelineCreateInfoKHR-maxPipelineRayRecursionDepth-03589
maxPipelineRayRecursionDepth must be less than or equal to [VkPhysicalDeviceRayTracingPipelinePropertiesKHR](https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VkPhysicalDeviceRayTracingPipelinePropertiesKHR.html)::maxRayRecursionDepth
ColonelPhantom commented 2 years ago

This actually seems to be an AMD driver limitation, since RADV seems to expose 31: see this list of GPUs that report 31. It includes all RADV entries, from Tahiti (i.e. HD 79xx) to Sienna Cichild (i.e. RX 6800-6900XT). RADV emulates it on the former but is also capable of using hardware acceleration on the latter. (Although I do think the performance is not that good compared to AMD's proprietary Windows driver).

ColinSalem commented 2 years ago

I don't have access to my RX 6700XT at the moment, so I can't test anything, but I think I may have found a possible culprit. https://github.com/sultim-t/RayTracedGL1/blob/a48aa5d69b103efaab9842eabe5ae639bd034463/Source/RayTracingPipeline.cpp#L196 IIRC RDNA2 currently only supports a maxRayRecursionDepth of 1, which is the minimum required by the Vulkan Specification. It is also the maximum recursion depth for RT pipelines. Since the requested pipeline would require a larger depth than supported, the RDNA2 card would not be able to provide the requested pipeline.

I'm rather new to this so I'm not sure if this is how you would fix it, but I downloaded the repo for RayTracedGL1, changed pipelineInfo.maxPipelineRayRecursionDepth = 2 to pipelineInfo.maxPipelineRayRecursionDepth = 1, and built the dll and it didn't fix the issue, so assuming I'm doing this right that's either not the problem or is only part of the problem.

kd-11 commented 2 years ago

I happen to own a 6700XT as well. I'll take a quick look. I just got it to build and it errors out really early, so it should be an easy fix hopefully.

kd-11 commented 2 years ago

image Well, that was easy. I'll submit a PR to get the fix mainlined.

kd-11 commented 2 years ago

PR opened: https://github.com/sultim-t/RayTracedGL1/pull/10

ColinSalem commented 2 years ago

image Well, that was easy. I'll submit a PR to get the fix mainlined.

Nice man! I'll consider this issue closed now, can't wait to be able to play this :)