Original Post
Hi;
I am working on a project with DirectX 9. I am rendering a huge terrain and implemented a special shadowing algorithm for this structure. The algorithm is similar to a classical ray-tracing application, so it can benefit highly from parallelization, since each ray can be processed independently. I already wrote the single threaded version of the algorithm, which runs in 500-600 ms. My goal is to optimize the algorithm such that it can be executed in real time; meaning shadows can be recalculated if the sun's direction changes constantly in every frame, with an acceptable speed loss. Parallelization of the code was the first way which came to my mind. I especially want to use GPU for this purpose.
I don't want to use CUDA since I cannot limit my project to NVidia cards. I am using DirectX 9 and therefore DirectCompute is out of question. So the most reasonable method seems to be using OpenCL. I did not use OpenCL before and I am going to learn it from scratch for this project. But I am not sure whether OpenCL and DirectX 9 can be used in the same time: This is an actual 3D graphics project and it constantly uses Graphics hardware via the Direct3D 9 runtime. OpenCL will also make use of the graphics hardware. In every frame, before rendering the scene with Direct3D, I want to run my shadow algorithm using OpenCL. My question is; are they compatible with each other? For example, will running OpenCL in a Direct3D project mess up any data structure associated with Direct3D, like vertex buffers, textures, etc.? Are these two able to communicate with each other or do they have the means to safely run together? It seems that there aren't any meaningful documents in the internet on this specific issue, so I am asking for help here.
Thanks in advance.
I am working on a project with DirectX 9. I am rendering a huge terrain and implemented a special shadowing algorithm for this structure. The algorithm is similar to a classical ray-tracing application, so it can benefit highly from parallelization, since each ray can be processed independently. I already wrote the single threaded version of the algorithm, which runs in 500-600 ms. My goal is to optimize the algorithm such that it can be executed in real time; meaning shadows can be recalculated if the sun's direction changes constantly in every frame, with an acceptable speed loss. Parallelization of the code was the first way which came to my mind. I especially want to use GPU for this purpose.
I don't want to use CUDA since I cannot limit my project to NVidia cards. I am using DirectX 9 and therefore DirectCompute is out of question. So the most reasonable method seems to be using OpenCL. I did not use OpenCL before and I am going to learn it from scratch for this project. But I am not sure whether OpenCL and DirectX 9 can be used in the same time: This is an actual 3D graphics project and it constantly uses Graphics hardware via the Direct3D 9 runtime. OpenCL will also make use of the graphics hardware. In every frame, before rendering the scene with Direct3D, I want to run my shadow algorithm using OpenCL. My question is; are they compatible with each other? For example, will running OpenCL in a Direct3D project mess up any data structure associated with Direct3D, like vertex buffers, textures, etc.? Are these two able to communicate with each other or do they have the means to safely run together? It seems that there aren't any meaningful documents in the internet on this specific issue, so I am asking for help here.
Thanks in advance.