Skip to content

Commit 4ee6c2a

Browse files
committed
Improve checking for implicit derivatives sampling requirement
slang-capabilities.def: - Add capability implicit_derivatives_sampling. This is currently added only for documentation purposes. hlsl.meta.slang: - Add "static_assert(__targetHasImplicitDerivatives()" always before __requireComputeDerivative(), except for fragmentprocessing functions where the capabilities imply implicit derivatives. - Note that implicit_derivatives_sampling is not added as a requirement for two reasons: - GLSL has functions where the behavior changes depending on whether implicit derivatives are available or not (e.g., texture()). However, the transitive requirements do not allow conditionally invoking _Texture.Sample() (would require implicit_derivatives_sampling) or _Texture.SampleLevelZero() (no requirement) without using complex __target_switch/__stage_switch constructs per call site. With regular if constructs, the GLSL texture() functions would inherit the requirement for implicit_derivatives_sampling, which is not desirable. - _Texture.CalculateLevelOfDetail() cannot be added with the implicit_derivatives_sampling requirement at this time, since it would result in unsatisfyable target requirements for capability GL_NV_compute_shader_derivatives in compute stage. This is possibly a bug in the capability set processing in Slang. To be determined later. Update a handful of tests. Either: - Add the missing capability that enables implicit derivatives in compute stage. - Switch the test to use the fragment stage instead of the compute stage. Particularly, metal does not support compute derivatives. Issue #8683
1 parent 01fdbb8 commit 4ee6c2a

17 files changed

+108
-55
lines changed

docs/user-guide/a3-02-reference-capability-atoms.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,20 @@ Compound Capabilities
11241124
`image_size`
11251125
> Capabilities required to query image (RWTexture) size info
11261126
1127+
`implicit_derivatives_sampling`
1128+
> Capabilities required for implicit derivatives sampling.
1129+
>
1130+
> This capability is required by texture sampling functions such as `_Texture.Sample()`
1131+
> where the level of detail is determined by implicit derivatives.
1132+
>
1133+
> @remark In GLSL, implicit level-of-detail `texture()` functions use the base texture when
1134+
> the implicit derivatives are unavailable. When this capability is not present, invocations of
1135+
> these functions are translated to invocations of `_Texture.SampleLevelZero()`.
1136+
>
1137+
> @remark Implicit derivatives for the compute stage can be enabled by declaring capability `GL_NV_compute_shader_derivatives` (GLSL),
1138+
> `SPV_KHR_compute_shader_derivatives` (SPIR-V), or profile `cs_6_6` (HLSL).
1139+
>
1140+
11271141
`memorybarrier`
11281142
> Capabilities required to use sm_5_0 style memory barriers
11291143

source/slang/hlsl.meta.slang

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ struct _Texture<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let is
700700
//@hidden:
701701

702702
// Returns true when the stage supports implicit derivatives on the
703-
// target. This must match with compound capability `fragmentprocessing`.
703+
// target. This must match with capability `implicit_derivatives_sampling`.
704704
//
705705
[__readNone]
706706
[ForceInline]
@@ -982,6 +982,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
982982
[require(glsl_hlsl_metal_spirv, texture_querylod)]
983983
float CalculateLevelOfDetail(TextureCoord location)
984984
{
985+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
985986
__requireComputeDerivative();
986987
__target_switch
987988
{
@@ -1008,6 +1009,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
10081009
[require(glsl_hlsl_metal_spirv, texture_querylod)]
10091010
float CalculateLevelOfDetailUnclamped(TextureCoord location)
10101011
{
1012+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
10111013
__requireComputeDerivative();
10121014
__target_switch
10131015
{
@@ -1068,6 +1070,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
10681070
[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, texture_sm_4_0_fragment)]
10691071
T Sample(vector<float, Shape.dimensions+isArray> location)
10701072
{
1073+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
10711074
__requireComputeDerivative();
10721075
__target_switch
10731076
{
@@ -1126,6 +1129,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
11261129
[require(cpp_glsl_hlsl_metal_spirv_wgsl, texture_sm_4_0_fragment)]
11271130
T Sample(vector<float, Shape.dimensions+isArray> location, constexpr vector<int, Shape.planeDimensions> offset)
11281131
{
1132+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
11291133
__requireComputeDerivative();
11301134
__target_switch
11311135
{
@@ -1157,6 +1161,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
11571161
[require(cpp_glsl_hlsl_metal_spirv, texture_sm_4_1_clamp_fragment)]
11581162
T Sample(vector<float, Shape.dimensions+isArray> location, constexpr vector<int, Shape.planeDimensions> offset, float clamp)
11591163
{
1164+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
11601165
__requireComputeDerivative();
11611166
__target_switch
11621167
{
@@ -1184,6 +1189,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
11841189
[ForceInline]
11851190
T Sample(vector<float, Shape.dimensions+isArray> location, constexpr vector<int, Shape.planeDimensions> offset, float clamp, out uint status)
11861191
{
1192+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
11871193
__requireComputeDerivative();
11881194
__target_switch
11891195
{
@@ -1217,6 +1223,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
12171223
[require(cpp_glsl_hlsl_metal_spirv_wgsl, texture_sm_4_0_fragment)]
12181224
T SampleBias(vector<float, Shape.dimensions+isArray> location, float bias)
12191225
{
1226+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
12201227
__requireComputeDerivative();
12211228
__target_switch
12221229
{
@@ -1247,6 +1254,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
12471254
[require(cpp_glsl_hlsl_metal_spirv_wgsl, texture_sm_4_0_fragment)]
12481255
T SampleBias(vector<float, Shape.dimensions+isArray> location, float bias, constexpr vector<int, Shape.planeDimensions> offset)
12491256
{
1257+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
12501258
__requireComputeDerivative();
12511259
__target_switch
12521260
{
@@ -1276,6 +1284,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
12761284
[require(hlsl_spirv, sm_5_0)]
12771285
T SampleBias(vector<float, Shape.dimensions+isArray> location, float bias, constexpr vector<int, Shape.planeDimensions> offset, float clamp, out uint status)
12781286
{
1287+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
12791288
__requireComputeDerivative();
12801289
__target_switch
12811290
{
@@ -1305,6 +1314,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
13051314
[require(glsl_hlsl_metal_spirv_wgsl, texture_shadowlod)]
13061315
float SampleCmp(vector<float, Shape.dimensions+isArray> location, float compareValue)
13071316
{
1317+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
13081318
__requireComputeDerivative();
13091319
__target_switch
13101320
{
@@ -1383,6 +1393,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
13831393
[require(glsl_hlsl_metal_spirv_wgsl, texture_shadowlod)]
13841394
float SampleCmp(vector<float, Shape.dimensions+isArray> location, float compareValue, constexpr vector<int, Shape.planeDimensions> offset)
13851395
{
1396+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
13861397
__requireComputeDerivative();
13871398
__target_switch
13881399
{
@@ -1418,6 +1429,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
14181429
[require(hlsl_spirv, sm_5_0)]
14191430
float SampleCmp(vector<float, Shape.dimensions+isArray> location, float compareValue, constexpr vector<int, Shape.planeDimensions> offset, float clamp, out uint status)
14201431
{
1432+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
14211433
__requireComputeDerivative();
14221434
__target_switch
14231435
{
@@ -1889,6 +1901,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,access,isShadow,0,format>
18891901
[require(glsl_hlsl_metal_spirv, texture_querylod)]
18901902
float CalculateLevelOfDetail(SamplerState s, TextureCoord location)
18911903
{
1904+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
18921905
__requireComputeDerivative();
18931906
__target_switch
18941907
{
@@ -1912,6 +1925,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,access,isShadow,0,format>
19121925
[require(glsl_hlsl_metal_spirv, texture_querylod)]
19131926
float CalculateLevelOfDetailUnclamped(SamplerState s, TextureCoord location)
19141927
{
1928+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
19151929
__requireComputeDerivative();
19161930
__target_switch
19171931
{
@@ -1935,6 +1949,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,access,isShadow,0,format>
19351949
[require(glsl_hlsl_metal_spirv, texture_querylod)]
19361950
float CalculateLevelOfDetail(SamplerComparisonState s, TextureCoord location)
19371951
{
1952+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
19381953
__requireComputeDerivative();
19391954
__target_switch
19401955
{
@@ -1958,6 +1973,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,access,isShadow,0,format>
19581973
[require(glsl_hlsl_metal_spirv, texture_querylod)]
19591974
float CalculateLevelOfDetailUnclamped(SamplerComparisonState s, TextureCoord location)
19601975
{
1976+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
19611977
__requireComputeDerivative();
19621978
__target_switch
19631979
{
@@ -2080,6 +2096,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,0,format>
20802096
[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, texture_sm_4_0_fragment)]
20812097
T Sample(SamplerState s, vector<float, Shape.dimensions+isArray> location)
20822098
{
2099+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
20832100
__requireComputeDerivative();
20842101
__target_switch
20852102
{
@@ -2183,6 +2200,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,0,format>
21832200
[require(cpp_glsl_hlsl_metal_spirv_wgsl, texture_sm_4_0_fragment)]
21842201
T Sample(SamplerState s, vector<float, Shape.dimensions+isArray> location, constexpr vector<int, Shape.planeDimensions> offset)
21852202
{
2203+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
21862204
__requireComputeDerivative();
21872205
__target_switch
21882206
{
@@ -2246,6 +2264,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,0,format>
22462264
[require(cpp_glsl_hlsl_metal_spirv, texture_sm_4_0_fragment)]
22472265
T Sample(SamplerState s, vector<float, Shape.dimensions+isArray> location, constexpr vector<int, Shape.planeDimensions> offset, float clamp)
22482266
{
2267+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
22492268
__requireComputeDerivative();
22502269
__target_switch
22512270
{
@@ -2293,6 +2312,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,0,format>
22932312
[ForceInline]
22942313
T Sample(SamplerState s, vector<float, Shape.dimensions+isArray> location, constexpr vector<int, Shape.planeDimensions> offset, float clamp, out uint status)
22952314
{
2315+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
22962316
__requireComputeDerivative();
22972317
__target_switch
22982318
{
@@ -2327,6 +2347,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,0,format>
23272347
[require(cpp_glsl_hlsl_metal_spirv_wgsl, texture_sm_4_0_fragment)]
23282348
T SampleBias(SamplerState s, vector<float, Shape.dimensions+isArray> location, float bias)
23292349
{
2350+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
23302351
__requireComputeDerivative();
23312352
__target_switch
23322353
{
@@ -2393,6 +2414,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,0,format>
23932414
[require(cpp_glsl_hlsl_metal_spirv_wgsl, texture_sm_4_0_fragment)]
23942415
T SampleBias(SamplerState s, vector<float, Shape.dimensions+isArray> location, float bias, constexpr vector<int, Shape.planeDimensions> offset)
23952416
{
2417+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
23962418
__requireComputeDerivative();
23972419
__target_switch
23982420
{
@@ -2454,6 +2476,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,0,format>
24542476
[require(hlsl_spirv, sm_5_0)]
24552477
T SampleBias(SamplerState s, vector<float, Shape.dimensions+isArray> location, float bias, constexpr vector<int, Shape.planeDimensions> offset, float clamp, out uint status)
24562478
{
2479+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
24572480
__requireComputeDerivative();
24582481
__target_switch
24592482
{
@@ -2485,6 +2508,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,0,format>
24852508
[require(glsl_hlsl_metal_spirv_wgsl, texture_shadowlod)]
24862509
float SampleCmp(SamplerComparisonState s, vector<float, Shape.dimensions+isArray> location, float compareValue)
24872510
{
2511+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
24882512
__requireComputeDerivative();
24892513
__target_switch
24902514
{
@@ -2571,6 +2595,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,0,format>
25712595
[require(glsl_hlsl_metal_spirv_wgsl, texture_shadowlod)]
25722596
float SampleCmp(SamplerComparisonState s, vector<float, Shape.dimensions+isArray> location, float compareValue, constexpr vector<int, Shape.planeDimensions> offset)
25732597
{
2598+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
25742599
__requireComputeDerivative();
25752600
__target_switch
25762601
{
@@ -2618,6 +2643,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,0,format>
26182643
[require(hlsl_spirv, sm_5_0)]
26192644
float SampleCmp(SamplerComparisonState s, vector<float, Shape.dimensions+isArray> location, float compareValue, constexpr vector<int, Shape.planeDimensions> offset, float clamp, out uint status)
26202645
{
2646+
static_assert(__targetHasImplicitDerivatives(), "This function requires capability 'implicit_derivatives_sampling'");
26212647
__requireComputeDerivative();
26222648
__target_switch
26232649
{

source/slang/slang-capabilities.capdef

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,6 +2033,23 @@ alias structuredbuffer = sm_4_0_version;
20332033
/// [Compound]
20342034
alias structuredbuffer_rw = sm_4_0_version;
20352035

2036+
/// Capabilities required for implicit derivatives sampling.
2037+
///
2038+
/// This capability is required by texture sampling functions such as `_Texture.Sample()`
2039+
/// where the level of detail is determined by implicit derivatives.
2040+
///
2041+
/// @remark In GLSL, implicit level-of-detail `texture()` functions use the base texture when
2042+
/// the implicit derivatives are unavailable. When this capability is not present, invocations of
2043+
/// these functions are translated to invocations of `_Texture.SampleLevelZero()`.
2044+
///
2045+
/// @remark Implicit derivatives for the compute stage can be enabled by declaring capability `GL_NV_compute_shader_derivatives` (GLSL),
2046+
/// `SPV_KHR_compute_shader_derivatives` (SPIR-V), or profile `cs_6_6` (HLSL).
2047+
///
2048+
/// [compound]
2049+
alias implicit_derivatives_sampling = fragment
2050+
| raytracingstages_compute_amplification_mesh + GL_NV_compute_shader_derivatives
2051+
;
2052+
20362053
/// Capabilities required to use fragment derivative operations (without GLSL derivativecontrol)
20372054
/// [Compound]
20382055
alias fragmentprocessing = fragment + _sm_5_0

tests/bindings/hlsl-to-cpp-combined.slang

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ RWStructuredBuffer<float4> outputBuffer;
1212
[numthreads(4, 1, 1)]
1313
void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
1414
{
15-
//CHK:[[VAR:[A-Za-z_][A-Za-z_0-9]*]].[[TEX]].Sample([[VAR]].[[SMP]]
16-
outputBuffer[0] = s2D.Sample(float2(0.5f, 0.5f));
15+
//CHK:[[VAR:[A-Za-z_][A-Za-z_0-9]*]].[[TEX]].SampleLevel({{.*}}[[VAR]]{{.*}}[[SMP]]
16+
outputBuffer[0] = s2D.SampleLevelZero(float2(0.5f, 0.5f));
1717
}

tests/bugs/gh-4305.slang

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target glsl -allow-glsl -DQUAD -DMODIFIER
2-
//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target glsl -allow-glsl -DMODIFIER
3-
//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target glsl -allow-glsl -DQUAD
4-
//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target glsl -allow-glsl
5-
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -output-using-type -emit-spirv-via-glsl -allow-glsl -xslang -DQUAD
6-
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -output-using-type -emit-spirv-via-glsl -allow-glsl
1+
//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target glsl -allow-glsl -capability GL_NV_compute_shader_derivatives -DQUAD -DMODIFIER
2+
//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target glsl -allow-glsl -capability GL_NV_compute_shader_derivatives -DMODIFIER
3+
//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target glsl -allow-glsl -capability GL_NV_compute_shader_derivatives -DQUAD
4+
//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target glsl -allow-glsl -capability GL_NV_compute_shader_derivatives
5+
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -output-using-type -emit-spirv-via-glsl -allow-glsl -capability GL_NV_compute_shader_derivatives -xslang -DQUAD
6+
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -output-using-type -emit-spirv-via-glsl -allow-glsl -capability GL_NV_compute_shader_derivatives
77

88
//TEST_INPUT: ubuffer(data=[0], stride=4):out,name outputBuffer
99
RWStructuredBuffer<float> outputBuffer;

tests/compute/derivative-group-quad-validation.slang

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//TEST:SIMPLE(filecheck=CHECK): -target spirv-asm
1+
//TEST:SIMPLE(filecheck=CHECK): -target spirv-asm -capability SPV_KHR_compute_shader_derivatives
22
//TEST_INPUT:ubuffer(data=[0], stride=4):out
33

44
// Test that DerivativeGroupQuadsKHR execution mode validates workgroup size
@@ -23,4 +23,4 @@ void main() {
2323
g_ssbo[0] = texture_color;
2424
}
2525

26-
// CHECK: error 31210: compute derivative group quad requires thread dispatch count of X and Y to each be at a multiple of 2
26+
// CHECK: error 31210: compute derivative group quad requires thread dispatch count of X and Y to each be at a multiple of 2

tests/cross-compile/cpp-resource.slang

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ void computeMain(
3939
float2 loc = dispatchThreadID.xy * 0.5f;
4040

4141
float v = tex.Load(int3(tid, tid, 0));
42-
float s = tex.Sample(sampler, loc);
42+
float s = tex.SampleLevel(sampler, loc, 0.0f);
4343

4444
// This should promote the 0.0 into a float2,
45-
float l = tex.Sample(sampler, 0.0);
45+
float l = tex.SampleLevel(sampler, 0.0, 0.0f);
4646

4747
float3 m = float(3).xxx;
4848

4949
float3 arr[2] = { float3(3), float3(4) };
5050
doSomething(int(tid), arr);
5151

5252
outputBuffer[tid] = int(tid * tid) + thing.a + thing3.a + int(v + s) + value + fromScalar.y + int(another.y) + int(m.x) + int(l) + int(arr[0].y); // + thing.a;
53-
}
53+
}

tests/cuda/cuda-texture.slang

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
1818
float v = 1.0f - u;
1919
float2 uv = float2(u, v);
2020

21-
outputBuffer[tid] = texture.Sample(sampler, uv);
21+
outputBuffer[tid] = texture.SampleLevel(sampler, uv, 0.0f);
2222
}

0 commit comments

Comments
 (0)