diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2024-05-14 15:42:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-14 15:42:12 -0700 |
| commit | d76bed6c1b03e5d7ef19c947fdd5fcaf33b595f7 (patch) | |
| tree | a5709a08298ead8f5fe2fb51f1b0f30c61505a3d /source/slang/slang-stdlib-textures.h | |
| parent | 5ceb8569b1ac7898c437b0c47ad29a5d8a9f7d90 (diff) | |
Implement texture functions for Metal target (#4158)
* Impl texture APIs for Metal target
This commit is to implement texture functions for Metal target.
The following functions are implemented and tested.
- GetDimensions()
- CalculateLevelOfDetail()
- CalculateLevelOfDetailUnclamped()
- Sample()
- SampleBias()
- SampleLevel()
- SampleCmp()
- SampleCmpLevelZero()
- Gather()
- SampleGrad()
- Load()
Metal has limited support for the texture functions compared to HLSL.
- LOD is not supported for 1D texture,
- Depth textures are limited to 2D, 2DArray, Cube and CubeArray
textures.
- "Offset" variants are limited to 2D, 2DArray, 2D-Depth,
2DArray-Depth and 3D textures.
The functions that cannot be implemented for Metal should properly
be handled by the capability system later.
* Fix the failing test, multi-file.hlsl
I am not sure why this change is needed.
* Fix compile errors on macOS 2nd try
* Remove a typo character to fix the compile error
* Trivial clean up
* Remove `as_type` where it was intended as static_cast
* Use a simpler sytax for __intrinsic_asm
* Trivial clean up
* Remove TEST_AFTER_FIXING_CAPABILITY_PROBLEM after fixing normalize
* Fix the failing test properly
* Fix an incorrect setup of Depth-cube texture
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-stdlib-textures.h')
| -rw-r--r-- | source/slang/slang-stdlib-textures.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/slang/slang-stdlib-textures.h b/source/slang/slang-stdlib-textures.h index 6c07b1a46..a6166cc2d 100644 --- a/source/slang/slang-stdlib-textures.h +++ b/source/slang/slang-stdlib-textures.h @@ -68,8 +68,9 @@ public: const String& cuda, const String& spirvDefault, const String& spirvRWDefault, - const String& spirvCombined - ); + const String& spirvCombined, + const String& metal + ); void writeFuncWithSig( const char* funcName, const String& sig, @@ -78,6 +79,7 @@ public: const String& spirvRWDefault = String{}, const String& spirvCombined = String{}, const String& cuda = String{}, + const String& metal = String{}, const ReadNoneMode readNoneMode = ReadNoneMode::Never ); void writeFunc( @@ -89,6 +91,7 @@ public: const String& spirvRWDefault = String{}, const String& spirvCombined = String{}, const String& cuda = String{}, + const String& metal = String{}, const ReadNoneMode readNoneMode = ReadNoneMode::Never ); |
