microsoft/nir_to_dxil: Avoid emitting SampleCmpLevel prior to SM 6.7 if possible
I started this patch to address the following:
There are no variants of SPIR-V functions like
OpImageSampleProjDrefExplicitLod
that assume LOD 0. So, when going from SPIR-V to NIR, anir_texop_txl
is emitted in those cases. The problem is that such NIR function naturally maps toSampleCmpLevel
, which is not available prior to Shader Model 6.7.
However, I found chances to make it a bit more comprehensive, so the long commit description reads as the following:
This revises the logic to decide which DXIL sampling function to emit. The decision no longer depends on the shader stage.
This patch
alsoavoids emitting SM 6.7'ssampleCmpLevel()
when targeting a lower SM and the LOD being constant zero (sampleCmpLevelZero()
is emitted instead).
UPDATE: Simplified to solely address the SM < 6.7 compatbility issue.
CC @jenatali