-
Notifications
You must be signed in to change notification settings - Fork 148
Add Ocean OpenCL-OpenGL interop demo #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
|
||
static const char* IGetErrorString(int clErrorCode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems generally useful. Could we move this to a shared location? Or, could we use the cl_util_print_error
function already in the SDK utils lib?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
int main(int argc, char* argv[]) | ||
{ | ||
OceanApplication app; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because app
is instantiated before parsing command line options, it is ignoring any passed-in command line options to select the platform or device index. Could we instead parse the command line options first and pass the chosen platform index, device index, and device type when we construct app
? See the nbody sample as an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still didn't work for me, at least for the platform and device arguments (specified with "-p"), and it looks like the sample is exclusively running on platform zero. With my current config, this just so happens to be a CPU platform, so the sample isn't working. I'd really like to be able to select the platform to run with. Alternatively, we could try to find the right platform based on the OpenGL context with CL-GL sharing is enabled, but this isn't a viable solution when CL-GL sharing is disabled.
Hi @starcatter, thanks again for your contribution. Do you think you will have a chance to address the review comments above? Thanks! |
@bashbaug Hello, sorry if I was a bit unresponsive! Those are good suggestions, I'll try to get them implemented this week. |
Yes, the intent was to use the same kernels in both samples. Only the shaders have subtle differences. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple other things will need to be fixed before we can merge:
- Can you please check that the CLA is all squared away? It's possible some of the latest commits were made with the wrong GitHub ID.
- Can you please take a look at the CI build errors? I didn't see them on my system, but we'll need to fix them one way or the other before merging.
VERSION 300 | ||
SOURCES main.cpp ocean.cpp ocean.hpp ocean_util.hpp | ||
KERNELS twiddle.cl time_spectrum.cl inversion.cl normals.cl fft_kernel.cl init_spectrum.cl | ||
SHADERS ocean.vert.glsl ocean.frag.glsl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to build on my system without adding a glm
dependency also:
SHADERS ocean.vert.glsl ocean.frag.glsl) | |
SHADERS ocean.vert.glsl ocean.frag.glsl | |
LIBS glm::glm) |
For comparison purposes with #110
The sample follows general steps (with multiple optimizations) described in the publication: Realtime GPGPU FFT ocean water simulation
Main focus of the sample is to demonstrate how to share compute/render resources between OpenCL and OpenGL to simulate an ocean surface.