| ; SPIR-V |
| ; Version: 1.0 |
| ; Generator: Khronos Glslang Reference Front End; 7 |
| ; Bound: 76 |
| ; Schema: 0 |
| OpCapability Shader |
| OpCapability Int16 |
| OpCapability StorageBuffer16BitAccess |
| OpExtension "SPV_KHR_16bit_storage" |
| %1 = OpExtInstImport "GLSL.std.450" |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint GLCompute %main "main" |
| OpExecutionMode %main LocalSize 1 1 1 |
| OpSource GLSL 450 |
| OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types_int16" |
| OpName %main "main" |
| OpName %SSBO "SSBO" |
| OpMemberName %SSBO 0 "s32" |
| OpMemberName %SSBO 1 "u32" |
| OpMemberName %SSBO 2 "s16" |
| OpMemberName %SSBO 3 "u16" |
| OpMemberName %SSBO 4 "f32" |
| OpName %_ "" |
| OpMemberDecorate %SSBO 0 Offset 0 |
| OpMemberDecorate %SSBO 1 Offset 4 |
| OpMemberDecorate %SSBO 2 Offset 8 |
| OpMemberDecorate %SSBO 3 Offset 10 |
| OpMemberDecorate %SSBO 4 Offset 12 |
| OpDecorate %SSBO BufferBlock |
| OpDecorate %_ DescriptorSet 0 |
| OpDecorate %_ Binding 0 |
| %void = OpTypeVoid |
| %3 = OpTypeFunction %void |
| %int = OpTypeInt 32 1 |
| %uint = OpTypeInt 32 0 |
| %short = OpTypeInt 16 1 |
| %ushort = OpTypeInt 16 0 |
| %float = OpTypeFloat 32 |
| %SSBO = OpTypeStruct %int %uint %short %ushort %float |
| %_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO |
| %_ = OpVariable %_ptr_Uniform_SSBO Uniform |
| %int_2 = OpConstant %int 2 |
| %int_0 = OpConstant %int 0 |
| %_ptr_Uniform_int = OpTypePointer Uniform %int |
| %_ptr_Uniform_short = OpTypePointer Uniform %short |
| %int_1 = OpConstant %int 1 |
| %_ptr_Uniform_uint = OpTypePointer Uniform %uint |
| %int_3 = OpConstant %int 3 |
| %_ptr_Uniform_ushort = OpTypePointer Uniform %ushort |
| %int_4 = OpConstant %int 4 |
| %_ptr_Uniform_float = OpTypePointer Uniform %float |
| %main = OpFunction %void None %3 |
| %5 = OpLabel |
| %ptr_s32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 |
| %ptr_u32 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 |
| %ptr_s16 = OpAccessChain %_ptr_Uniform_short %_ %int_2 |
| %ptr_u16 = OpAccessChain %_ptr_Uniform_ushort %_ %int_3 |
| %ptr_f32 = OpAccessChain %_ptr_Uniform_float %_ %int_4 |
| %s32 = OpLoad %int %ptr_s32 |
| %u32 = OpLoad %uint %ptr_u32 |
| %s16 = OpLoad %short %ptr_s16 |
| %u16 = OpLoad %ushort %ptr_u16 |
| %f32 = OpLoad %float %ptr_f32 |
| |
| ; Sign-extend |
| %s16_to_s32_signed = OpSConvert %int %s16 |
| OpStore %ptr_s32 %s16_to_s32_signed |
| %s16_to_u32_signed = OpSConvert %uint %s16 |
| OpStore %ptr_u32 %s16_to_u32_signed |
| |
| %u16_to_s32_signed = OpSConvert %int %u16 |
| OpStore %ptr_s32 %u16_to_s32_signed |
| %u16_to_u32_signed = OpSConvert %uint %u16 |
| OpStore %ptr_u32 %u16_to_u32_signed |
| |
| ; Zero-extend |
| ; Result must be unsigned for OpUConvert. |
| ;%s16_to_s32_unsigned = OpUConvert %int %s16 |
| ;OpStore %ptr_s32 %s16_to_s32_unsigned |
| %s16_to_u32_unsigned = OpUConvert %uint %s16 |
| OpStore %ptr_u32 %s16_to_u32_unsigned |
| |
| ;%u16_to_s32_unsigned = OpUConvert %int %u16 |
| ;OpStore %ptr_s32 %u16_to_s32_unsigned |
| %u16_to_u32_unsigned = OpUConvert %uint %u16 |
| OpStore %ptr_u32 %u16_to_u32_unsigned |
| |
| ; Truncate (SConvert == UConvert) |
| %s32_to_s16_signed = OpSConvert %short %s32 |
| OpStore %ptr_s16 %s32_to_s16_signed |
| %s32_to_u16_signed = OpSConvert %ushort %s32 |
| OpStore %ptr_u16 %s32_to_u16_signed |
| |
| %u32_to_s16_signed = OpSConvert %short %u32 |
| OpStore %ptr_s16 %u32_to_s16_signed |
| %u32_to_u16_signed = OpSConvert %ushort %u32 |
| OpStore %ptr_u16 %u32_to_u16_signed |
| |
| ;%s32_to_s16_unsigned = OpUConvert %short %s32 |
| ;OpStore %ptr_s16 %s32_to_s16_unsigned |
| %s32_to_u16_unsigned = OpUConvert %ushort %s32 |
| OpStore %ptr_u16 %s32_to_u16_unsigned |
| |
| ;%u32_to_s16_unsigned = OpUConvert %short %u32 |
| ;OpStore %ptr_s16 %u32_to_s16_unsigned |
| %u32_to_u16_unsigned = OpUConvert %ushort %u32 |
| OpStore %ptr_u16 %u32_to_u16_unsigned |
| |
| ; SToF |
| %s16_to_f32_signed = OpConvertSToF %float %s16 |
| OpStore %ptr_f32 %s16_to_f32_signed |
| %u16_to_f32_signed = OpConvertSToF %float %u16 |
| OpStore %ptr_f32 %u16_to_f32_signed |
| %s16_to_f32_unsigned = OpConvertUToF %float %s16 |
| OpStore %ptr_f32 %s16_to_f32_unsigned |
| %u16_to_f32_unsigned = OpConvertUToF %float %u16 |
| OpStore %ptr_f32 %u16_to_f32_unsigned |
| |
| ; FToS |
| %f32_to_s16_signed = OpConvertFToS %short %f32 |
| OpStore %ptr_s16 %f32_to_s16_signed |
| %f32_to_u16_signed = OpConvertFToS %ushort %f32 |
| OpStore %ptr_u16 %f32_to_u16_signed |
| |
| ; FToU |
| %f32_to_u16_unsigned = OpConvertFToU %ushort %f32 |
| OpStore %ptr_u16 %f32_to_u16_unsigned |
| ; Result must be unsigned for FToU, so don't bother testing that. |
| |
| OpReturn |
| OpFunctionEnd |