Skip to content

Adds Metal Support to ociodisplay and enables running GPU tests with Metal backend#1538

Merged
hodoulp merged 64 commits intoAcademySoftwareFoundation:mainfrom
Morteeza:master
Dec 13, 2021
Merged

Adds Metal Support to ociodisplay and enables running GPU tests with Metal backend#1538
hodoulp merged 64 commits intoAcademySoftwareFoundation:mainfrom
Morteeza:master

Conversation

@Morteeza
Copy link
Copy Markdown
Contributor

No description provided.

Morteeza and others added 30 commits October 21, 2021 12:58
Signed-off-by: Morteza Mostajabodaveh <smostajabodaveh@apple.com>

Co-authored-by: Ingthor Hjalmarsson <ihjalmarsson@apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
Signed-off-by: Morteza Mostajabodaveh <smostajabodaveh@apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
- vector of const objects causing compiler errors on windows.
- Wrong string was used for Metal language python binding.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
…e it to implementation

* Adding more tests for metal code path
* Proper generated Metal code indentation
* Fixes a few coding style inconsistencies and unneeded include files

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
…before the metal change.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
…e since it is not in the opencolorio interface anymore.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
…metal related code in implementation, and hide them from OCIO interface.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
…metal code.

* Adds two new tests for uniforms and helper functions.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
… problematic when it comes to multiple platform support and may not be safe

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
…long.clf. Due to decimal number outputting difference between different platforms, some tests were failing.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
* remove unnecessary functions and data types
* code clean up and quality improvement

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
* Removing getTextureKeyword() and getTextureDeclaration() as they are not needed.
* code clean up and quality improvement

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
…String` function.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
…ise it

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
…mething else.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
…ect project.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
…metal shading language code generation case.

operator= for GpuShaderClassWrapper

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
Comment thread src/libutils/oglapphelpers/msl.mm
Comment thread src/libutils/oglapphelpers/mtltexture.h Outdated
@hodoulp
Copy link
Copy Markdown
Member

hodoulp commented Dec 8, 2021

[Question] Input and Output images are using MtlTexture but LUTs are using MTLTexture. The names are confusing.

Comment thread src/libutils/oglapphelpers/metalapp.mm Outdated
Comment thread src/libutils/oglapphelpers/msl.mm Outdated
Comment thread src/libutils/oglapphelpers/metalapp.mm
Comment thread src/libutils/oglapphelpers/metalapp.h Outdated
Comment thread src/libutils/oglapphelpers/metalapp.mm
Morteeza and others added 4 commits December 9, 2021 18:50
…sform change.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>
@Morteeza Morteeza requested a review from hodoulp December 9, 2021 23:30
…ilures and precision errors

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>
Comment thread tests/gpu/GPUUnitTest.cpp Outdated
Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>
@Morteeza Morteeza requested a review from hodoulp December 10, 2021 21:51
Copy link
Copy Markdown
Member

@hodoulp hodoulp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @Morteeza

Copy link
Copy Markdown
Collaborator

@remia remia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Morteeza,

Sorry for the late review, great work! Here is some minor points on the code.

I tried it locally on macOS 12.0.1 and it appears to work fine. I just noticed the following message while running GPU Metal unit tests: Context leak detected, CoreAnalytics returned false, it happen for matrix_inverse, lin2log, style_log_midtones_rev but do not affect the result (tests successful). Do you see the same thing?

Edit: Noticed the Context leak issue was reported earlier but doesn't appear to be resolved, could that be an issue?

Comment thread src/libutils/oglapphelpers/metalapp.mm Outdated
Comment thread src/libutils/oglapphelpers/metalapp.mm
Comment thread src/libutils/oglapphelpers/metalapp.mm Outdated
Comment thread src/libutils/oglapphelpers/msl.mm Outdated
Comment thread src/libutils/oglapphelpers/msl.mm Outdated
Comment thread src/libutils/oglapphelpers/msl.mm
Comment thread src/libutils/oglapphelpers/msl.mm Outdated
Comment thread src/libutils/oglapphelpers/msl.mm
Copy link
Copy Markdown
Collaborator

@michdolan michdolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @Morteeza !

Comment thread src/libutils/oglapphelpers/oglapp.h Outdated
Morteeza and others added 2 commits December 13, 2021 21:07
Fixing possible texture mem leaks

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>
@remia
Copy link
Copy Markdown
Collaborator

remia commented Dec 13, 2021

Thanks for the quick fixes @Morteeza! The Context leak warning can be addressed later if problematic.

@Morteeza
Copy link
Copy Markdown
Contributor Author

Thanks for the quick fixes @Morteeza! The Context leak warning can be addressed later if problematic.

Thanks for your comments. I will investigate that more. Unfortunately, I can't reproduce it on my machine. I have to see why.

@hodoulp hodoulp merged commit 00b5362 into AcademySoftwareFoundation:main Dec 13, 2021
hodoulp added a commit that referenced this pull request Dec 13, 2021
…Metal backend (#1538)

* * Adds Metal Shading Language (MSL) Generation support

Signed-off-by: Morteza Mostajabodaveh <smostajabodaveh@apple.com>

Co-authored-by: Ingthor Hjalmarsson <ihjalmarsson@apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Fixes warnings triggered due to unused variables.

Signed-off-by: Morteza Mostajabodaveh <smostajabodaveh@apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Fixes compilation error on Mac and Windows:
- vector of const objects causing compiler errors on windows.
- Wrong string was used for Metal language python binding.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Removes class wrapping interface from OpenColorIO interface and move it to implementation
* Adding more tests for metal code path
* Proper generated Metal code indentation
* Fixes a few coding style inconsistencies and unneeded include files

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Remove the unneeded empty line to reset OpenColorIO.h to what it was before the metal change.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * switching from c-like getFunctionParameters function to c++-like one since it is not in the opencolorio interface anymore.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Missing include causing compiler errors on windows

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Fixes and improvements follow up to change that was trying to move metal related code in implementation, and hide them from OCIO interface.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* - remove unused variables.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Adds support for uniform parameters and proper handling of them in metal code.
* Adds two new tests for uniforms and helper functions.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * making declaration parsing more C++-like. Functions like sscanf are problematic when it comes to multiple platform support and may not be safe

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Switching from clf/lut1d_half_domain_raw_half_set.clf  to clf/lut1d_long.clf. Due to decimal number outputting difference between different platforms, some tests were failing.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Moving Metal only functionalities to MetalClassWrappingInterface
* remove unnecessary functions and data types
* code clean up and quality improvement

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Adds support for uniforms that are array
* Removing getTextureKeyword() and getTextureDeclaration() as they are not needed.
* code clean up and quality improvement

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Remove unnecessary changes to GpuShaderUtils_tests.cpp

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Removed unnecessary included files

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Removing unnecessary include

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Apply style improvement suggestions

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * changed from msl_metal to msl_2 so it matches with `GpuLanguageFromString` function.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Move MetalShaderClassWrappingInterface to a separate file and generalise it

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* header files inlcudes clean up

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Still the else path is needed in case we set language from MSL2 to something else.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* [minor] Showing the GpuShaderClassWrapper.h also in the vc15 aftereffect project.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Run ClassWrapper function for all backends. It only produces code in metal shading language code generation case.
operator= for GpuShaderClassWrapper

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* use factory pattern instead of updateClassWrappingInterface

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Replace assignment operator with clone function that is more explicit.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* use Assignment operator instead of setting members in clone member function

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* add include guards.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* make output of MetalShaderClassWrapper::operator= non-const

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Update default branch name (#1532)

Signed-off-by: Michael Dolan <michdolan@gmail.com>

Co-authored-by: Patrick Hodoul <patrick.hodoul@autodesk.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Adsk Contrib - Default to C++14 and remove OIIO from ocioperf (#1516)

* Adsk Contrib - Default to C++14 and remove OIIO from ocioperf

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Fix cmake breaks

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Fix bit-depths

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Fix Linux build break

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Improve the image generation

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Improve the image generation

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Add metal rendering support to ociodisplay

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Adds support for metal only input texture

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Returning correct value for maximum texture width

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Add GPU rendering tests for metal renderer
Fixes incorrect shader generation code for arrays in uniform buffer
Adds support for vector comparison in Metal

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Fixes failing test_cpu_exec test
Fixes compilation error on Linux, older clang compiler
Makes the app working on x64 Macs

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Add support for test that apply color correction multiple times with different setups
replaces asserts with exception
Disables fast math to get more accurate results

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Matching the uniform buffer size elements for array of ints and float to fix two gpu tests

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* enables -gpuinfo to print shader

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Revert "Matching the uniform buffer size elements for array of ints and float to fix two gpu tests"

This reverts commit c1695e2.

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Enables uniform data binding for metal without touching OCIO interface

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* set dummy buffers for the vectors that are empty.

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Update metal test to reflect latest changes in metal shader generator

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Improving coding style
Adds metal gpu unit tests to the one executing

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Updating the test so it reflects latest code changes.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* sets the opengl state even when no valid ocio config is loaded.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Handles metal resources lifecycles correctly. Fixes the crash on transform change.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Applying improvements to code and minor fixes

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Disable testing NaN and Infinity on Apple Silicon that causes test failures and precision errors

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* make the condition for disabling NaN and INFs more accurate.

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Improving code quality
Fixing possible texture mem leaks

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

Co-authored-by: Ingthor Hjalmarsson <ihjalmarsson@apple.com>
Co-authored-by: Patrick Hodoul <patrick.hodoul@autodesk.com>
Co-authored-by: Michael Dolan <michdolan@gmail.com>
Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>
hodoulp added a commit that referenced this pull request Dec 14, 2021
…Metal backend (#1538)

* * Adds Metal Shading Language (MSL) Generation support

Signed-off-by: Morteza Mostajabodaveh <smostajabodaveh@apple.com>

Co-authored-by: Ingthor Hjalmarsson <ihjalmarsson@apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Fixes warnings triggered due to unused variables.

Signed-off-by: Morteza Mostajabodaveh <smostajabodaveh@apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Fixes compilation error on Mac and Windows:
- vector of const objects causing compiler errors on windows.
- Wrong string was used for Metal language python binding.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Removes class wrapping interface from OpenColorIO interface and move it to implementation
* Adding more tests for metal code path
* Proper generated Metal code indentation
* Fixes a few coding style inconsistencies and unneeded include files

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Remove the unneeded empty line to reset OpenColorIO.h to what it was before the metal change.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * switching from c-like getFunctionParameters function to c++-like one since it is not in the opencolorio interface anymore.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Missing include causing compiler errors on windows

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Fixes and improvements follow up to change that was trying to move metal related code in implementation, and hide them from OCIO interface.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* - remove unused variables.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Adds support for uniform parameters and proper handling of them in metal code.
* Adds two new tests for uniforms and helper functions.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * making declaration parsing more C++-like. Functions like sscanf are problematic when it comes to multiple platform support and may not be safe

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Switching from clf/lut1d_half_domain_raw_half_set.clf  to clf/lut1d_long.clf. Due to decimal number outputting difference between different platforms, some tests were failing.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Moving Metal only functionalities to MetalClassWrappingInterface
* remove unnecessary functions and data types
* code clean up and quality improvement

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Adds support for uniforms that are array
* Removing getTextureKeyword() and getTextureDeclaration() as they are not needed.
* code clean up and quality improvement

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Remove unnecessary changes to GpuShaderUtils_tests.cpp

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Removed unnecessary included files

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Removing unnecessary include

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Apply style improvement suggestions

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * changed from msl_metal to msl_2 so it matches with `GpuLanguageFromString` function.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Move MetalShaderClassWrappingInterface to a separate file and generalise it

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* header files inlcudes clean up

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Still the else path is needed in case we set language from MSL2 to something else.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* [minor] Showing the GpuShaderClassWrapper.h also in the vc15 aftereffect project.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Run ClassWrapper function for all backends. It only produces code in metal shading language code generation case.
operator= for GpuShaderClassWrapper

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* use factory pattern instead of updateClassWrappingInterface

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Replace assignment operator with clone function that is more explicit.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* use Assignment operator instead of setting members in clone member function

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* add include guards.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* make output of MetalShaderClassWrapper::operator= non-const

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Update default branch name (#1532)

Signed-off-by: Michael Dolan <michdolan@gmail.com>

Co-authored-by: Patrick Hodoul <patrick.hodoul@autodesk.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Adsk Contrib - Default to C++14 and remove OIIO from ocioperf (#1516)

* Adsk Contrib - Default to C++14 and remove OIIO from ocioperf

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Fix cmake breaks

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Fix bit-depths

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Fix Linux build break

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Improve the image generation

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Improve the image generation

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Add metal rendering support to ociodisplay

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Adds support for metal only input texture

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Returning correct value for maximum texture width

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Add GPU rendering tests for metal renderer
Fixes incorrect shader generation code for arrays in uniform buffer
Adds support for vector comparison in Metal

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Fixes failing test_cpu_exec test
Fixes compilation error on Linux, older clang compiler
Makes the app working on x64 Macs

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Add support for test that apply color correction multiple times with different setups
replaces asserts with exception
Disables fast math to get more accurate results

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Matching the uniform buffer size elements for array of ints and float to fix two gpu tests

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* enables -gpuinfo to print shader

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Revert "Matching the uniform buffer size elements for array of ints and float to fix two gpu tests"

This reverts commit c1695e2.

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Enables uniform data binding for metal without touching OCIO interface

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* set dummy buffers for the vectors that are empty.

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Update metal test to reflect latest changes in metal shader generator

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Improving coding style
Adds metal gpu unit tests to the one executing

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Updating the test so it reflects latest code changes.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* sets the opengl state even when no valid ocio config is loaded.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Handles metal resources lifecycles correctly. Fixes the crash on transform change.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Applying improvements to code and minor fixes

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Disable testing NaN and Infinity on Apple Silicon that causes test failures and precision errors

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* make the condition for disabling NaN and INFs more accurate.

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Improving code quality
Fixing possible texture mem leaks

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

Co-authored-by: Ingthor Hjalmarsson <ihjalmarsson@apple.com>
Co-authored-by: Patrick Hodoul <patrick.hodoul@autodesk.com>
Co-authored-by: Michael Dolan <michdolan@gmail.com>
Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>
hodoulp added a commit that referenced this pull request Dec 14, 2021
…les running GPU tests with Metal backend (#1538) (#1559)

* Adds Metal Support to ociodisplay and enables running GPU tests with Metal backend (#1538)

* * Adds Metal Shading Language (MSL) Generation support

Signed-off-by: Morteza Mostajabodaveh <smostajabodaveh@apple.com>

Co-authored-by: Ingthor Hjalmarsson <ihjalmarsson@apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Fixes warnings triggered due to unused variables.

Signed-off-by: Morteza Mostajabodaveh <smostajabodaveh@apple.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Fixes compilation error on Mac and Windows:
- vector of const objects causing compiler errors on windows.
- Wrong string was used for Metal language python binding.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Removes class wrapping interface from OpenColorIO interface and move it to implementation
* Adding more tests for metal code path
* Proper generated Metal code indentation
* Fixes a few coding style inconsistencies and unneeded include files

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Remove the unneeded empty line to reset OpenColorIO.h to what it was before the metal change.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * switching from c-like getFunctionParameters function to c++-like one since it is not in the opencolorio interface anymore.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Missing include causing compiler errors on windows

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Fixes and improvements follow up to change that was trying to move metal related code in implementation, and hide them from OCIO interface.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* - remove unused variables.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Adds support for uniform parameters and proper handling of them in metal code.
* Adds two new tests for uniforms and helper functions.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * making declaration parsing more C++-like. Functions like sscanf are problematic when it comes to multiple platform support and may not be safe

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Switching from clf/lut1d_half_domain_raw_half_set.clf  to clf/lut1d_long.clf. Due to decimal number outputting difference between different platforms, some tests were failing.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Moving Metal only functionalities to MetalClassWrappingInterface
* remove unnecessary functions and data types
* code clean up and quality improvement

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Adds support for uniforms that are array
* Removing getTextureKeyword() and getTextureDeclaration() as they are not needed.
* code clean up and quality improvement

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Remove unnecessary changes to GpuShaderUtils_tests.cpp

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Removed unnecessary included files

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Removing unnecessary include

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * Apply style improvement suggestions

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* * changed from msl_metal to msl_2 so it matches with `GpuLanguageFromString` function.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Move MetalShaderClassWrappingInterface to a separate file and generalise it

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* header files inlcudes clean up

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Still the else path is needed in case we set language from MSL2 to something else.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* [minor] Showing the GpuShaderClassWrapper.h also in the vc15 aftereffect project.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Run ClassWrapper function for all backends. It only produces code in metal shading language code generation case.
operator= for GpuShaderClassWrapper

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* use factory pattern instead of updateClassWrappingInterface

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Replace assignment operator with clone function that is more explicit.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* use Assignment operator instead of setting members in clone member function

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* add include guards.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* make output of MetalShaderClassWrapper::operator= non-const

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Update default branch name (#1532)

Signed-off-by: Michael Dolan <michdolan@gmail.com>

Co-authored-by: Patrick Hodoul <patrick.hodoul@autodesk.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Adsk Contrib - Default to C++14 and remove OIIO from ocioperf (#1516)

* Adsk Contrib - Default to C++14 and remove OIIO from ocioperf

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Fix cmake breaks

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Fix bit-depths

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Fix Linux build break

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Improve the image generation

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Improve the image generation

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>
Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Add metal rendering support to ociodisplay

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Adds support for metal only input texture

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Returning correct value for maximum texture width

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Add GPU rendering tests for metal renderer
Fixes incorrect shader generation code for arrays in uniform buffer
Adds support for vector comparison in Metal

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Fixes failing test_cpu_exec test
Fixes compilation error on Linux, older clang compiler
Makes the app working on x64 Macs

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Add support for test that apply color correction multiple times with different setups
replaces asserts with exception
Disables fast math to get more accurate results

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Matching the uniform buffer size elements for array of ints and float to fix two gpu tests

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* enables -gpuinfo to print shader

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Revert "Matching the uniform buffer size elements for array of ints and float to fix two gpu tests"

This reverts commit c1695e2.

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Enables uniform data binding for metal without touching OCIO interface

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* set dummy buffers for the vectors that are empty.

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Update metal test to reflect latest changes in metal shader generator

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Improving coding style
Adds metal gpu unit tests to the one executing

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Updating the test so it reflects latest code changes.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* sets the opengl state even when no valid ocio config is loaded.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Handles metal resources lifecycles correctly. Fixes the crash on transform change.

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Applying improvements to code and minor fixes

Signed-off-by: Morteza Mostajab <smostajabodaveh@Apple.com>

* Disable testing NaN and Infinity on Apple Silicon that causes test failures and precision errors

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* make the condition for disabling NaN and INFs more accurate.

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

* Improving code quality
Fixing possible texture mem leaks

Signed-off-by: Morteza Mostajab <smostajabodaveh@apple.com>

Co-authored-by: Ingthor Hjalmarsson <ihjalmarsson@apple.com>
Co-authored-by: Patrick Hodoul <patrick.hodoul@autodesk.com>
Co-authored-by: Michael Dolan <michdolan@gmail.com>
Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

* Fix Linux warning

Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>

Co-authored-by: Morteza Mostajab <92918486+Morteeza@users.noreply.github.com>
Co-authored-by: Ingthor Hjalmarsson <ihjalmarsson@apple.com>
Co-authored-by: Michael Dolan <michdolan@gmail.com>
@doug-walker doug-walker mentioned this pull request Apr 6, 2022
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.

4 participants