diff options
| author | Yong He <yonghe@outlook.com> | 2023-12-12 16:29:51 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-12 16:29:51 -0800 |
| commit | 6cbe215e58eeb8edc53d71e8f315e2fb55c0eeee (patch) | |
| tree | ce82de695b51ba7882253dec74fc675dcaf07a9e /source/slang/hlsl.meta.slang | |
| parent | 92f21de580e16a37600f082c0968913111f5ef91 (diff) | |
Define `Texture::Sample` for float element types only. (#3403)
* Define `Texture::Sample` for float element types only.
* Fixes #490.
* Fix checking of groupshared.
* Add test.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/hlsl.meta.slang')
| -rw-r--r-- | source/slang/hlsl.meta.slang | 69 |
1 files changed, 39 insertions, 30 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang index 5bb5ce038..477e0cfaf 100644 --- a/source/slang/hlsl.meta.slang +++ b/source/slang/hlsl.meta.slang @@ -214,7 +214,26 @@ extension __TextureImpl<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format> }).y; } } + + __target_intrinsic(glsl, "texture($0, $1)") + float __glsl_texture(vector<float, Shape.dimensions+isArray+1> value); + __glsl_extension(GL_EXT_texture_shadow_lod) + __target_intrinsic(glsl, "textureOffset($0, $1, $2)") + float __glsl_texture_offset(vector<float, Shape.dimensions+isArray+1> value, constexpr vector<int, Shape.planeDimensions> offset); + + __glsl_extension(GL_EXT_texture_shadow_lod) + __target_intrinsic(glsl, "textureLod($0, $1, 0)") + float __glsl_texture_level_zero(vector<float, Shape.dimensions+isArray+1> value); + + __glsl_extension(GL_EXT_texture_shadow_lod) + __target_intrinsic(glsl, "textureLodOffset($0, $1, 0, $2)") + float __glsl_texture_offset_level_zero(vector<float, Shape.dimensions+isArray+1> value, constexpr vector<int, Shape.planeDimensions> offset); +} + +__generic<T:IFloat, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let isShadow:int, let format:int> +extension __TextureImpl<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format> +{ [__readNone] T Sample(vector<float, Shape.dimensions+isArray> location) { @@ -329,21 +348,6 @@ extension __TextureImpl<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format> } } - __target_intrinsic(glsl, "texture($0, $1)") - float __glsl_texture(vector<float, Shape.dimensions+isArray+1> value); - - __glsl_extension(GL_EXT_texture_shadow_lod) - __target_intrinsic(glsl, "textureOffset($0, $1, $2)") - float __glsl_texture_offset(vector<float, Shape.dimensions+isArray+1> value, constexpr vector<int, Shape.planeDimensions> offset); - - __glsl_extension(GL_EXT_texture_shadow_lod) - __target_intrinsic(glsl, "textureLod($0, $1, 0)") - float __glsl_texture_level_zero(vector<float, Shape.dimensions+isArray+1> value); - - __glsl_extension(GL_EXT_texture_shadow_lod) - __target_intrinsic(glsl, "textureLodOffset($0, $1, 0, $2)") - float __glsl_texture_offset_level_zero(vector<float, Shape.dimensions+isArray+1> value, constexpr vector<int, Shape.planeDimensions> offset); - [__readNone] [ForceInline] float SampleCmp(vector<float, Shape.dimensions+isArray> location, float compareValue) @@ -586,7 +590,27 @@ extension __TextureImpl<T,Shape,isArray,isMS,sampleCount,access,isShadow,0,forma }).y; } } + + __target_intrinsic(glsl, "texture($p, $2)") + float __glsl_texture(SamplerComparisonState s, vector<float, Shape.dimensions+isArray+1> value); + + __glsl_extension(GL_EXT_texture_shadow_lod) + __target_intrinsic(glsl, "textureOffset($p, $2, $3)") + float __glsl_texture_offset(SamplerComparisonState s, vector<float, Shape.dimensions+isArray+1> value, constexpr vector<int, Shape.planeDimensions> offset); + + __glsl_extension(GL_EXT_texture_shadow_lod) + __target_intrinsic(glsl, "textureLod($p, $2, 0)") + float __glsl_texture_level_zero(SamplerComparisonState s, vector<float, Shape.dimensions+isArray+1> value); + + __glsl_extension(GL_EXT_texture_shadow_lod) + __target_intrinsic(glsl, "textureLodOffset($p, $2, 0, $3)") + float __glsl_texture_offset_level_zero(SamplerComparisonState s, vector<float, Shape.dimensions+isArray+1> value, constexpr vector<int, Shape.planeDimensions> offset); + +} +__generic<T:IFloat, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let isShadow:int, let format:int> +extension __TextureImpl<T,Shape,isArray,isMS,sampleCount,0,isShadow,0,format> +{ [__readNone] T Sample(SamplerState s, vector<float, Shape.dimensions+isArray> location) { @@ -726,21 +750,6 @@ extension __TextureImpl<T,Shape,isArray,isMS,sampleCount,access,isShadow,0,forma } } - __target_intrinsic(glsl, "texture($p, $2)") - float __glsl_texture(SamplerComparisonState s, vector<float, Shape.dimensions+isArray+1> value); - - __glsl_extension(GL_EXT_texture_shadow_lod) - __target_intrinsic(glsl, "textureOffset($p, $2, $3)") - float __glsl_texture_offset(SamplerComparisonState s, vector<float, Shape.dimensions+isArray+1> value, constexpr vector<int, Shape.planeDimensions> offset); - - __glsl_extension(GL_EXT_texture_shadow_lod) - __target_intrinsic(glsl, "textureLod($p, $2, 0)") - float __glsl_texture_level_zero(SamplerComparisonState s, vector<float, Shape.dimensions+isArray+1> value); - - __glsl_extension(GL_EXT_texture_shadow_lod) - __target_intrinsic(glsl, "textureLodOffset($p, $2, 0, $3)") - float __glsl_texture_offset_level_zero(SamplerComparisonState s, vector<float, Shape.dimensions+isArray+1> value, constexpr vector<int, Shape.planeDimensions> offset); - [__readNone] [ForceInline] float SampleCmp(SamplerComparisonState s, vector<float, Shape.dimensions+isArray> location, float compareValue) { |
