I have a shader:
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));
Which I'm compiling using:
#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);
Compilation fails, and the only error message I get is:
warning X4717: Effects deprecated for D3DCompiler_47
No errors, just a warning, yet the shader blob is null.
However if I replace all min16float2
with float2
, then compilation works OK.
How to get min16float
working?
I've read the https://gpuopen.com/first-steps-implementing-fp16/ article, and it mentions it should work OK.
Do I need to use https://github.com/microsoft/DirectXShaderCompiler instead of D3DCompile
from Win10SDK?
I have Windows 10, using latest Windows SDK
Looks like it fails because Microsoft abandoned "fx_*" targets, and have to use "vs/ps" targets instead.