1; SPIR-V 2; Version: 1.0 3; Generator: Khronos Glslang Reference Front End; 7 4; Bound: 76 5; Schema: 0 6 OpCapability Shader 7 OpCapability Int16 8 OpCapability StorageBuffer16BitAccess 9 OpExtension "SPV_KHR_16bit_storage" 10 %1 = OpExtInstImport "GLSL.std.450" 11 OpMemoryModel Logical GLSL450 12 OpEntryPoint GLCompute %main "main" 13 OpExecutionMode %main LocalSize 1 1 1 14 OpSource GLSL 450 15 OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types_int16" 16 OpName %main "main" 17 OpName %SSBO "SSBO" 18 OpMemberName %SSBO 0 "s32" 19 OpMemberName %SSBO 1 "u32" 20 OpMemberName %SSBO 2 "s16" 21 OpMemberName %SSBO 3 "u16" 22 OpMemberName %SSBO 4 "f32" 23 OpName %_ "" 24 OpMemberDecorate %SSBO 0 Offset 0 25 OpMemberDecorate %SSBO 1 Offset 4 26 OpMemberDecorate %SSBO 2 Offset 8 27 OpMemberDecorate %SSBO 3 Offset 10 28 OpMemberDecorate %SSBO 4 Offset 12 29 OpDecorate %SSBO BufferBlock 30 OpDecorate %_ DescriptorSet 0 31 OpDecorate %_ Binding 0 32 %void = OpTypeVoid 33 %3 = OpTypeFunction %void 34 %int = OpTypeInt 32 1 35 %uint = OpTypeInt 32 0 36 %short = OpTypeInt 16 1 37 %ushort = OpTypeInt 16 0 38 %float = OpTypeFloat 32 39 %SSBO = OpTypeStruct %int %uint %short %ushort %float 40%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO 41 %_ = OpVariable %_ptr_Uniform_SSBO Uniform 42 %int_2 = OpConstant %int 2 43 %int_0 = OpConstant %int 0 44%_ptr_Uniform_int = OpTypePointer Uniform %int 45%_ptr_Uniform_short = OpTypePointer Uniform %short 46 %int_1 = OpConstant %int 1 47%_ptr_Uniform_uint = OpTypePointer Uniform %uint 48 %int_3 = OpConstant %int 3 49%_ptr_Uniform_ushort = OpTypePointer Uniform %ushort 50 %int_4 = OpConstant %int 4 51%_ptr_Uniform_float = OpTypePointer Uniform %float 52 %main = OpFunction %void None %3 53 %5 = OpLabel 54 %ptr_s32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 55 %ptr_u32 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 56 %ptr_s16 = OpAccessChain %_ptr_Uniform_short %_ %int_2 57 %ptr_u16 = OpAccessChain %_ptr_Uniform_ushort %_ %int_3 58 %ptr_f32 = OpAccessChain %_ptr_Uniform_float %_ %int_4 59 %s32 = OpLoad %int %ptr_s32 60 %u32 = OpLoad %uint %ptr_u32 61 %s16 = OpLoad %short %ptr_s16 62 %u16 = OpLoad %ushort %ptr_u16 63 %f32 = OpLoad %float %ptr_f32 64 65 ; Sign-extend 66 %s16_to_s32_signed = OpSConvert %int %s16 67 OpStore %ptr_s32 %s16_to_s32_signed 68 %s16_to_u32_signed = OpSConvert %uint %s16 69 OpStore %ptr_u32 %s16_to_u32_signed 70 71 %u16_to_s32_signed = OpSConvert %int %u16 72 OpStore %ptr_s32 %u16_to_s32_signed 73 %u16_to_u32_signed = OpSConvert %uint %u16 74 OpStore %ptr_u32 %u16_to_u32_signed 75 76 ; Zero-extend 77 ; Result must be unsigned for OpUConvert. 78 ;%s16_to_s32_unsigned = OpUConvert %int %s16 79 ;OpStore %ptr_s32 %s16_to_s32_unsigned 80 %s16_to_u32_unsigned = OpUConvert %uint %s16 81 OpStore %ptr_u32 %s16_to_u32_unsigned 82 83 ;%u16_to_s32_unsigned = OpUConvert %int %u16 84 ;OpStore %ptr_s32 %u16_to_s32_unsigned 85 %u16_to_u32_unsigned = OpUConvert %uint %u16 86 OpStore %ptr_u32 %u16_to_u32_unsigned 87 88 ; Truncate (SConvert == UConvert) 89 %s32_to_s16_signed = OpSConvert %short %s32 90 OpStore %ptr_s16 %s32_to_s16_signed 91 %s32_to_u16_signed = OpSConvert %ushort %s32 92 OpStore %ptr_u16 %s32_to_u16_signed 93 94 %u32_to_s16_signed = OpSConvert %short %u32 95 OpStore %ptr_s16 %u32_to_s16_signed 96 %u32_to_u16_signed = OpSConvert %ushort %u32 97 OpStore %ptr_u16 %u32_to_u16_signed 98 99 ;%s32_to_s16_unsigned = OpUConvert %short %s32 100 ;OpStore %ptr_s16 %s32_to_s16_unsigned 101 %s32_to_u16_unsigned = OpUConvert %ushort %s32 102 OpStore %ptr_u16 %s32_to_u16_unsigned 103 104 ;%u32_to_s16_unsigned = OpUConvert %short %u32 105 ;OpStore %ptr_s16 %u32_to_s16_unsigned 106 %u32_to_u16_unsigned = OpUConvert %ushort %u32 107 OpStore %ptr_u16 %u32_to_u16_unsigned 108 109 ; SToF 110 %s16_to_f32_signed = OpConvertSToF %float %s16 111 OpStore %ptr_f32 %s16_to_f32_signed 112 %u16_to_f32_signed = OpConvertSToF %float %u16 113 OpStore %ptr_f32 %u16_to_f32_signed 114 115 %s32_to_f32_signed = OpConvertSToF %float %s32 116 OpStore %ptr_f32 %s32_to_f32_signed 117 %u32_to_f32_signed = OpConvertSToF %float %u32 118 OpStore %ptr_f32 %u32_to_f32_signed 119 120 ; UToF 121 %s16_to_f32_unsigned = OpConvertUToF %float %s16 122 OpStore %ptr_f32 %s16_to_f32_unsigned 123 %u16_to_f32_unsigned = OpConvertUToF %float %u16 124 OpStore %ptr_f32 %u16_to_f32_unsigned 125 126 %s32_to_f32_unsigned = OpConvertUToF %float %s32 127 OpStore %ptr_f32 %s32_to_f32_unsigned 128 %u32_to_f32_unsigned = OpConvertUToF %float %u32 129 OpStore %ptr_f32 %u32_to_f32_unsigned 130 131 ; FToS 132 %f32_to_s16_signed = OpConvertFToS %short %f32 133 OpStore %ptr_s16 %f32_to_s16_signed 134 %f32_to_u16_signed = OpConvertFToS %ushort %f32 135 OpStore %ptr_u16 %f32_to_u16_signed 136 137 ; FToU 138 %f32_to_u16_unsigned = OpConvertFToU %ushort %f32 139 OpStore %ptr_u16 %f32_to_u16_unsigned 140 ; Result must be unsigned for FToU, so don't bother testing that. 141 142 OpReturn 143 OpFunctionEnd 144