HLSL min16float 编译失败

HLSL min16float fails to compile

我有一个着色器:

float4 Test_PixelShader(float2 inTex:TEXCOORD,
                uniform int    mode          ):COLOR
{
   if(mode) // half
   {
      min16float2 t=(min16float2)inTex;
      min16float2 r=1;
      for(int i=0; i<256; i++)
      {
         r+=t*r;
      }
      return float4(r.x, r.y, mode, 1);
   }else
   {
      float2 t=inTex;
      float2 r=1;
      for(int i=0; i<256; i++)
      {
         r+=t*r;
      }
      return float4(r.x, r.y, mode, 1);
   }
}
#define TECHNIQUE5(name, vs, ps)   technique11 name{pass p0{SetVertexShader(CompileShader(vs_5_0, vs)); SetPixelShader(CompileShader(ps_5_0, ps));}}
TECHNIQUE5(Test , Draw_VertexShader(), Test_PixelShader(0));
TECHNIQUE5(Test1, Draw_VertexShader(), Test_PixelShader(1));

我正在编译使用:

#define FLAGS_DX11    (D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY|D3DCOMPILE_OPTIMIZATION_LEVEL3|D3DCOMPILE_NO_PRESHADER)
D3DCompile(data.data(), data.elms(), null, d3d_macros.data(), &Include11(src), null, "fx_5_0", FLAGS_DX11, 0, &buffer, &error);

编译失败,我得到的唯一错误信息是:

warning X4717: Effects deprecated for D3DCompiler_47

没有错误,只是警告,但着色器 blob 为空。

但是,如果我将所有 min16float2 替换为 float2,则编译工作正常。

如何让 min16float 工作?

我已经阅读了 https://gpuopen.com/first-steps-implementing-fp16/ 文章,其中提到它应该可以正常工作。

我是否需要使用 https://github.com/microsoft/DirectXShaderCompiler 而不是 Win10SDK 中的 D3DCompile

我有 Windows 10,使用最新的 Windows SDK

看起来它失败了,因为 Microsoft 放弃了 "fx_*" 个目标,必须改用 "vs/ps" 个目标。