Skip to content
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

Port from main to RB-2.1 - Adds Metal Support to ociodisplay and enables running GPU tests with Metal backend (#1538) #1559

Merged
merged 2 commits into from
Dec 14, 2021

Conversation

hodoulp
Copy link
Member

@hodoulp hodoulp commented Dec 14, 2021

    • 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

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

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

Morteeza and others added 2 commits December 13, 2021 20:57
…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>
Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>
@hodoulp hodoulp merged commit 86a2aac into RB-2.1 Dec 14, 2021
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.

None yet

3 participants