DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

unpack intrinsic name/return type;

Open kevin4QC opened this issue 3 years ago • 1 comments

Hi I saw the SM6.6 pack/unpack spec says that the unpacked intrinsic name and return type are: " %vec4.i16 = type { i16, i16, i16, i16 } .. // unpack x0 %x0 = call %vec4.i16 @dx.unpack_u8s16(i32 , i32 %read1) %x0.0 = i16 extractelement %vec4.i16 %x0, 0 .."

Compiling a simple shader below using dxc-artifacts" struct VertexIN { int8_t4_packed src : POSITION; }; struct VertexOUT { int16_t4 unpacked : UNPACKED; }; VertexOUT main(VertexIN IN) { VertexOUT output; output.unpacked = unpack_s8s16(IN.src); return output; }

gives me :" %dx.types.fouri16 = type { i16, i16, i16, i16 } define void @main() { %1 = call i32 @dx.op.loadInput.i32(i32 4, i32 0, i32 0, i8 0, i32 undef) ; %2 = call %dx.types.fouri16 @dx.op.unpack4x8.i16(i32 219, i8 1, i32 %1) ; Unpack4x8(unpackMode,pk) " notice the return type is struct vs vector, also the intrinsic name seems inconsistent.. any idea?

best

kevin4QC avatar Jul 15 '22 22:07 kevin4QC

@tex3d - can you investigate and help out @kevin4QC if you can. If this is a spec issue then we'll need to triage fixing that.

damyanp avatar Apr 29 '24 17:04 damyanp

This is a minor spec issue in the DXIL Backend Example. DXIL already had a struct for representing four i16 values, so that would be the one it uses. I updated the spec with the correct name.

tex3d avatar Oct 14 '24 20:10 tex3d