Add test for split access chain into row-major matrix.

This commit is contained in:
Hans-Kristian Arntzen 2019-07-22 16:28:05 +02:00
parent 2172b19be2
commit d7a5303cf2
2 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,16 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct SSBORow
{
float v;
float4x4 row_major0;
};
kernel void main0(device SSBORow& _4 [[buffer(0)]])
{
_4.v = _4.row_major0[2u][1];
}

View File

@ -0,0 +1,48 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 21
; 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
OpName %main "main"
OpName %SSBORow "SSBORow"
OpMemberName %SSBORow 0 "v"
OpMemberName %SSBORow 1 "row_major0"
OpName %_ ""
OpMemberDecorate %SSBORow 0 Offset 0
OpMemberDecorate %SSBORow 1 RowMajor
OpMemberDecorate %SSBORow 1 Offset 16
OpMemberDecorate %SSBORow 1 MatrixStride 16
OpDecorate %SSBORow BufferBlock
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
%SSBORow = OpTypeStruct %float %mat4v4float
%_ptr_Uniform_SSBORow = OpTypePointer Uniform %SSBORow
%_ = OpVariable %_ptr_Uniform_SSBORow Uniform
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%int_1 = OpConstant %int 1
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%_ptr_Uniform_float = OpTypePointer Uniform %float
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%main = OpFunction %void None %3
%5 = OpLabel
%row_ptr = OpAccessChain %_ptr_Uniform_v4float %_ %int_1 %int_1
%float_ptr = OpAccessChain %_ptr_Uniform_float %row_ptr %uint_2
%19 = OpLoad %float %float_ptr
%20 = OpAccessChain %_ptr_Uniform_float %_ %int_0
OpStore %20 %19
OpReturn
OpFunctionEnd