-
Notifications
You must be signed in to change notification settings - Fork 482
gpu: Add Vulkan unit test framework #2243
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?
gpu: Add Vulkan unit test framework #2243
Conversation
5e91fdf to
82f8ca6
Compare
|
@pmady , thank you, it is really exciting to see progress on this. Being able to test the Vulkan shaders would be a great benefit to the project! Taking a very quick look at the PR, it looks like this won't actually run the GPU tests yet due to the TODO to add the GLSL to SPIR-V compilation. What are your plans on that? It would be great to be able to run the tests to confirm that the framework you've added here is actually working. |
|
Hi @doug-walker, Thank you for the feedback! You're absolutely right that the GLSL to SPIR-V compilation is the critical missing piece. Current StatusThe framework is in place with:
However, the Plan for SPIR-V CompilationI have two options to complete this: Option 1: Use shaderc (Recommended)Add shaderc library for runtime GLSL to SPIR-V compilation. This is what most Vulkan projects use. Option 2: Use glslang libraryMore complex but gives finer control over the compilation process. Option 3: Runtime compilation via system callsCall Next StepsWould you prefer I:
I'm leaning towards Option 1 (shaderc) as it's the most robust solution. I can update the CMakeLists.txt to find and link shaderc, then implement the compilation function. Let me know your preference and I'll proceed accordingly! |
|
I'm not knowledgeable enough to have a strong opinion about which approach is best. However, I would prefer to be able to test what you've done so far before merging this, so that rules out option 2. It looks like shaderc is built on top of glslangValidator, so that is probably a requirement for either 1 or 3. We do strive to minimize dependencies, but as long as the added dependencies are only needed for running the Vulkan unit tests, it should be fine. This would be similar to the way our OSL unit tests work. So no objections to option 1, since that's your preference. |
|
Hi @doug-walker, Thanks for the guidance! I've implemented Option 1 using glslang (which shaderc is built on top of). Changes MadeCMakeLists.txt:
vulkanapp.cpp:
The glslang dependency is only required when building with The implementation should now allow the Vulkan GPU tests to actually run. Please let me know if you'd like any adjustments! |
Add initial Vulkan support for GPU unit testing in OpenColorIO. This commit introduces: - vulkanapp.h/cpp: Headless Vulkan rendering framework for GPU tests - CMakeLists.txt updates: Conditional Vulkan build support with OCIO_VULKAN_ENABLED - GPUUnitTest.cpp: --vulkan flag to run tests with Vulkan renderer The Vulkan implementation uses compute shaders for color processing, similar to the existing OpenGL and Metal implementations. It supports headless rendering suitable for CI environments. Note: GLSL to SPIR-V compilation requires linking against glslang or shaderc library (marked as TODO in the implementation). Issue Number: close AcademySoftwareFoundation#2209 Signed-off-by: pmady <[email protected]>
Add glslang library dependency for runtime GLSL to SPIR-V compilation in the Vulkan unit test framework. This enables the Vulkan GPU tests to actually run by compiling OCIO-generated GLSL shaders to SPIR-V. Changes: - CMakeLists.txt: Add find_package(glslang) and link glslang libraries - vulkanapp.cpp: Implement compileGLSLToSPIRV() using glslang API The implementation: - Initializes glslang process (thread-safe, one-time init) - Configures Vulkan 1.2 / SPIR-V 1.5 target environment - Parses GLSL compute shader source - Links shader program - Generates optimized SPIR-V bytecode Signed-off-by: pmady <[email protected]>
a63b811 to
c3037be
Compare
|
Hi @pmady , I'm trying to test your branch but am struggling with getting Vulkan and shaderc installed. If you could explain how you installed the necessary components on your system, it would help get me started. Thanks in advance for your help. |
Description
This PR adds initial Vulkan support for GPU unit testing in OpenColorIO, addressing issue #2209.
Changes
New files:
vulkanapp.handvulkanapp.cppoglappandmetalappCMakeLists.txt updates
OCIO_VULKAN_ENABLEDflagGPUUnitTest.cpp updates
--vulkancommand line flag to run tests with Vulkan rendererGPU_LANGUAGE_GLSL_VK_4_6shading language for VulkanUsage
TODO / Known Limitations
glslangorshaderclibrary (placeholder implementation)Testing
OCIO_VULKAN_ENABLED=ON--vulkanflagIssue Number: close #2209
Checklist