Add another test for unpacking without load forwarding.

This commit is contained in:
Hans-Kristian Arntzen 2019-07-23 17:14:59 +02:00
parent 1ece67a050
commit 8ba0507a6d
2 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct SSBOScalar
{
float4 a[16];
float4 b[16];
float4 c[16];
};
kernel void main0(device SSBOScalar& _4 [[buffer(0)]])
{
float2 _27 = _4.b[10].xy;
float _29 = _4.c[10].x;
_4.b[10].xy = float2(10.0, 11.0);
_4.a[10].xy = _27 * _29;
}

View File

@ -0,0 +1,61 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 29
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpSource GLSL 450
OpSourceExtension "GL_EXT_scalar_block_layout"
OpName %main "main"
OpName %SSBOScalar "SSBOScalar"
OpMemberName %SSBOScalar 0 "a"
OpMemberName %SSBOScalar 1 "b"
OpMemberName %SSBOScalar 2 "c"
OpName %_ ""
OpDecorate %_arr_v2float_uint_16 ArrayStride 16
OpDecorate %_arr_v2float_uint_16_0 ArrayStride 16
OpDecorate %_arr_float_uint_16 ArrayStride 16
OpMemberDecorate %SSBOScalar 0 Offset 0
OpMemberDecorate %SSBOScalar 1 Offset 256
OpMemberDecorate %SSBOScalar 2 Offset 512
OpDecorate %SSBOScalar BufferBlock
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%uint = OpTypeInt 32 0
%uint_16 = OpConstant %uint 16
%_arr_v2float_uint_16 = OpTypeArray %v2float %uint_16
%_arr_v2float_uint_16_0 = OpTypeArray %v2float %uint_16
%_arr_float_uint_16 = OpTypeArray %float %uint_16
%SSBOScalar = OpTypeStruct %_arr_v2float_uint_16 %_arr_v2float_uint_16_0 %_arr_float_uint_16
%_ptr_Uniform_SSBOScalar = OpTypePointer Uniform %SSBOScalar
%_ = OpVariable %_ptr_Uniform_SSBOScalar Uniform
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%int_10 = OpConstant %int 10
%int_1 = OpConstant %int 1
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%int_2 = OpConstant %int 2
%float_10 = OpConstant %float 10.0
%float_11 = OpConstant %float 11.0
%float_const = OpConstantComposite %v2float %float_10 %float_11
%_ptr_Uniform_float = OpTypePointer Uniform %float
%main = OpFunction %void None %3
%5 = OpLabel
%21 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 %int_10
%22 = OpLoad %v2float %21
%25 = OpAccessChain %_ptr_Uniform_float %_ %int_2 %int_10
%26 = OpLoad %float %25
OpStore %21 %float_const
%27 = OpVectorTimesScalar %v2float %22 %26
%28 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 %int_10
OpStore %28 %27
OpReturn
OpFunctionEnd