cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

kos
Journeyman III

This may become a bug repport

HLSL compiler bug (imho)

HLSL : struct VS_OUTPUT 
{
  float4 Pos: POSITION;
  float2 texCoord: TEXCOORD0;
};

float4 main(VS_OUTPUT coord) : SV_TARGET0
{
 float4 ret = 0;
 ret.x = coord.Pos.x;
 return ret;
}
IL: il_ps_2_0
dcl_input_generic_interp(linear) v0.x___
dcl_output_generic o0
mov o0.x___, v0.x
; l0 = (0.000000f 0.000000f 0.000000f 0.000000f)
dcl_literal l0, 0x00000000, 0x00000000, 0x00000000, 0x00000000
mov o0._yzw, l0
ret_dyn
end

0 Likes
3 Replies
kos
Journeyman III

So I think that's wring code, right will be il_ps_2_0
dcl_input_generic_interp(linear) v0.x___
dcl_output_generic o0.x___
mov o0.x___, v0.x
ret_dyn
end

0 Likes
kos
Journeyman III

///

0 Likes

The reason why this is done the way you have implemented it is that you set ret to 0, modify the x component, and then return the value. This might not be what you want to do, but it is correctly generating code for this situation.
0 Likes