summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/slang/hlsl.meta.slang74
1 files changed, 49 insertions, 25 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index 70b1f2151..9716a3e9e 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -2,6 +2,10 @@
typedef uint UINT;
+// Access float2/float3 as a float3
+[ForceInline] float3 __asFloat3(float2 v) { return float3(v, 0); }
+[ForceInline] float3 __asFloat3(float3 v) { return v; }
+
__generic<T>
__magic_type(HLSLAppendStructuredBufferType)
__intrinsic_type($(kIROp_HLSLAppendStructuredBufferType))
@@ -7103,6 +7107,7 @@ func saturated_cooperation_using<A, B, C>(
}
}
+
${{{{
//
// Texture Footprint Queries
@@ -7299,7 +7304,7 @@ ${
Coords coords,
int granularity,
bool useCoarseLevel,
- out __FootprintData footprint);
+ out __FootprintData footprint);
[__NoSideEffect]
__glsl_version(450)
@@ -7311,7 +7316,7 @@ ${
Coords coords,
int granularity,
bool useCoarseLevel,
- out __FootprintData footprint,
+ out __FootprintData footprint,
float bias);
[__NoSideEffect]
@@ -7326,7 +7331,7 @@ ${
float lodClamp,
int granularity,
bool useCoarseLevel,
- out __FootprintData footprint);
+ out __FootprintData footprint);
[__NoSideEffect]
__glsl_version(450)
@@ -7340,7 +7345,7 @@ ${
float lodClamp,
int granularity,
bool useCoarseLevel,
- out __FootprintData footprint,
+ out __FootprintData footprint,
float bias);
[__NoSideEffect]
@@ -7355,7 +7360,7 @@ ${
float lod,
int granularity,
bool useCoarseLevel,
- out __FootprintData footprint);
+ out __FootprintData footprint);
${{{
@@ -7375,7 +7380,7 @@ ${{{
Coords dy,
int granularity,
bool useCoarseLevel,
- out __FootprintData footprint);
+ out __FootprintData footprint);
[__NoSideEffect]
__glsl_version(450)
@@ -7391,7 +7396,7 @@ ${{{
float lodClamp,
int granularity,
bool useCoarseLevel,
- out __FootprintData footprint);
+ out __FootprintData footprint);
${{{
}
}}}
@@ -7440,8 +7445,9 @@ for(auto levelChoice : kLevelChoices)
uint textureIndex,
uint samplerSpace,
uint samplerIndex,
- Coords coords,
- FootprintGranularity granularity);
+ float3 coords,
+ FootprintGranularity granularity,
+ out uint isSingleLod);
[__NoSideEffect]
[__requiresNVAPI]
@@ -7452,9 +7458,10 @@ for(auto levelChoice : kLevelChoices)
uint textureIndex,
uint samplerSpace,
uint samplerIndex,
- Coords coords,
+ float3 coords,
FootprintGranularity granularity,
- float lodBias);
+ float lodBias,
+ out uint isSingleLod);
[__NoSideEffect]
[__requiresNVAPI]
@@ -7465,9 +7472,10 @@ for(auto levelChoice : kLevelChoices)
uint textureIndex,
uint samplerSpace,
uint samplerIndex,
- Coords coords,
+ float3 coords,
FootprintGranularity granularity,
- float lod);
+ float lod,
+ out uint isSingleLod);
${{{
// Texture sampling with gradient is only available for 2D textures.
@@ -7482,10 +7490,11 @@ ${{{
uint textureIndex,
uint samplerSpace,
uint samplerIndex,
- Coords coords,
+ float3 coords,
FootprintGranularity granularity,
- Coords dx,
- Coords dy);
+ float3 dx,
+ float3 dy,
+ out uint isSingleLod);
${{{
}
}}}
@@ -7534,10 +7543,13 @@ ${
SamplerState sampler,
Coords coords)
{
- return { __queryFootprint$(CoarseOrFine)NVAPI(
+ uint isSingleLod = 0;
+ Footprint footprint = {__queryFootprint$(CoarseOrFine)NVAPI(
__getRegisterSpace(this), __getRegisterIndex(this),
__getRegisterSpace(sampler), __getRegisterIndex(sampler),
- coords, granularity), false };
+ __asFloat3(coords), granularity, /* out */isSingleLod), false};
+ footprint._isSingleLevel = (isSingleLod != 0);
+ return footprint;
}
/// Query the footprint that would be accessed by a texture sampling operation.
@@ -7575,10 +7587,14 @@ ${
Coords coords,
float lodBias)
{
- return { __queryFootprint$(CoarseOrFine)BiasNVAPI(
+ uint isSingleLod = 0;
+ Footprint footprint = {__queryFootprint$(CoarseOrFine)BiasNVAPI(
__getRegisterSpace(this), __getRegisterIndex(this),
__getRegisterSpace(sampler), __getRegisterIndex(sampler),
- coords, granularity, lodBias), false };
+ __asFloat3(coords), granularity, lodBias, /* out */isSingleLod), false};
+
+ footprint._isSingleLevel = (isSingleLod != 0);
+ return footprint;
}
/// Query the footprint that would be accessed by a texture sampling operation.
@@ -7657,10 +7673,14 @@ ${
Coords coords,
float lod)
{
- return { __queryFootprint$(CoarseOrFine)LevelNVAPI(
+ uint isSingleLod = 0;
+ Footprint footprint = {__queryFootprint$(CoarseOrFine)LevelNVAPI(
__getRegisterSpace(this), __getRegisterIndex(this),
__getRegisterSpace(sampler), __getRegisterIndex(sampler),
- coords, granularity, lod), false };
+ __asFloat3(coords), granularity, lod, /* out */isSingleLod), false};
+
+ footprint._isSingleLevel = (isSingleLod != 0);
+ return footprint;
}
@@ -7706,10 +7726,14 @@ ${{{
Coords dx,
Coords dy)
{
- return { __queryFootprint$(CoarseOrFine)GradNVAPI(
+ uint isSingleLod = 0;
+ Footprint footprint = {__queryFootprint$(CoarseOrFine)GradNVAPI(
__getRegisterSpace(this), __getRegisterIndex(this),
__getRegisterSpace(sampler), __getRegisterIndex(sampler),
- coords, granularity, dx, dy), false };
+ __asFloat3(coords), granularity, __asFloat3(dx), __asFloat3(dy), /* out */isSingleLod), false};
+
+ footprint._isSingleLevel = (isSingleLod != 0);
+ return footprint;
}
/// Query the footprint that would be accessed by a texture sampling operation.
@@ -7746,4 +7770,4 @@ ${{{{
${{{{
}
-}}}}
+}}}} \ No newline at end of file