Tint/transform: make AddBlockAttribute always do wrapping if possible

This CL make transform AddBlockAttribute always try to wrap types used
by buffer variables into a struct, in order to generate valid GLSL code
for assigning one buffer struct variable to another buffer struct
variable.

Fixed: tint:1735
Change-Id: I009d8a9ca7ecea1dc0ad6164275c964a18acb33f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108023
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
This commit is contained in:
Zhaoming Jiang
2022-11-02 02:25:38 +00:00
committed by Dawn LUCI CQ
parent 2bea9055f4
commit 6ab5d3c151
465 changed files with 15681 additions and 12853 deletions

View File

@@ -1,15 +1,19 @@
#version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo {
struct Uniforms {
uint i;
uint j;
uint pad;
uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms;
void tint_symbol() {
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
m1[uniforms.i][0] = 1.0f;
m1[uniforms.inner.i][0] = 1.0f;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,19 +1,22 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 24
; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms"
OpName %main "main"
OpName %m1 "m1"
OpDecorate %Uniforms Block
OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable
@@ -21,27 +24,28 @@
OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
%uniforms_block = OpTypeStruct %Uniforms
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%void = OpTypeVoid
%5 = OpTypeFunction %void
%6 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float
%14 = OpConstantNull %mat2v4float
%15 = OpConstantNull %mat2v4float
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%int = OpTypeInt 32 1
%20 = OpConstantNull %int
%21 = OpConstantNull %int
%_ptr_Function_float = OpTypePointer Function %float
%float_1 = OpConstant %float 1
%main = OpFunction %void None %5
%8 = OpLabel
%m1 = OpVariable %_ptr_Function_mat2v4float Function %14
%17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%18 = OpLoad %uint %17
%22 = OpAccessChain %_ptr_Function_float %m1 %18 %20
OpStore %22 %float_1
%main = OpFunction %void None %6
%9 = OpLabel
%m1 = OpVariable %_ptr_Function_mat2v4float Function %15
%18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%19 = OpLoad %uint %18
%23 = OpAccessChain %_ptr_Function_float %m1 %19 %21
OpStore %23 %float_1
OpReturn
OpFunctionEnd

View File

@@ -1,15 +1,19 @@
#version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo {
struct Uniforms {
uint i;
uint j;
uint pad;
uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms;
void tint_symbol() {
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
m1[uniforms.i][uniforms.j] = 1.0f;
m1[uniforms.inner.i][uniforms.inner.j] = 1.0f;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,19 +1,22 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Bound: 26
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms"
OpName %main "main"
OpName %m1 "m1"
OpDecorate %Uniforms Block
OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable
@@ -21,28 +24,29 @@
OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
%uniforms_block = OpTypeStruct %Uniforms
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%void = OpTypeVoid
%5 = OpTypeFunction %void
%6 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float
%14 = OpConstantNull %mat2v4float
%15 = OpConstantNull %mat2v4float
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%float_1 = OpConstant %float 1
%main = OpFunction %void None %5
%8 = OpLabel
%m1 = OpVariable %_ptr_Function_mat2v4float Function %14
%17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%18 = OpLoad %uint %17
%20 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%21 = OpLoad %uint %20
%23 = OpAccessChain %_ptr_Function_float %m1 %18 %21
OpStore %23 %float_1
%main = OpFunction %void None %6
%9 = OpLabel
%m1 = OpVariable %_ptr_Function_mat2v4float Function %15
%18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%19 = OpLoad %uint %18
%21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%22 = OpLoad %uint %21
%24 = OpAccessChain %_ptr_Function_float %m1 %19 %22
OpStore %24 %float_1
OpReturn
OpFunctionEnd

View File

@@ -1,15 +1,19 @@
#version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo {
struct Uniforms {
uint i;
uint j;
uint pad;
uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms;
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
void tint_symbol() {
m1[0][uniforms.j] = 1.0f;
m1[0][uniforms.inner.j] = 1.0f;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,19 +1,22 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 24
; Bound: 26
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms"
OpName %m1 "m1"
OpName %main "main"
OpDecorate %Uniforms Block
OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable
@@ -21,27 +24,29 @@
OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
%uniforms_block = OpTypeStruct %Uniforms
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%10 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %10
%11 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %11
%void = OpTypeVoid
%11 = OpTypeFunction %void
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%16 = OpConstantNull %int
%17 = OpConstantNull %int
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%_ptr_Private_float = OpTypePointer Private %float
%float_1 = OpConstant %float 1
%main = OpFunction %void None %11
%14 = OpLabel
%19 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%20 = OpLoad %uint %19
%22 = OpAccessChain %_ptr_Private_float %m1 %16 %20
OpStore %22 %float_1
%main = OpFunction %void None %12
%15 = OpLabel
%21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%22 = OpLoad %uint %21
%24 = OpAccessChain %_ptr_Private_float %m1 %17 %22
OpStore %24 %float_1
OpReturn
OpFunctionEnd

View File

@@ -1,15 +1,19 @@
#version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo {
struct Uniforms {
uint i;
uint j;
uint pad;
uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms;
void tint_symbol() {
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
m1[uniforms.i] = vec4(1.0f);
m1[uniforms.inner.i] = vec4(1.0f);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,19 +1,22 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 23
; Bound: 24
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms"
OpName %main "main"
OpName %m1 "m1"
OpDecorate %Uniforms Block
OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable
@@ -21,26 +24,27 @@
OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
%uniforms_block = OpTypeStruct %Uniforms
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%void = OpTypeVoid
%5 = OpTypeFunction %void
%6 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float
%14 = OpConstantNull %mat2v4float
%15 = OpConstantNull %mat2v4float
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%_ptr_Function_v4float = OpTypePointer Function %v4float
%float_1 = OpConstant %float 1
%22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%main = OpFunction %void None %5
%8 = OpLabel
%m1 = OpVariable %_ptr_Function_mat2v4float Function %14
%17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%18 = OpLoad %uint %17
%20 = OpAccessChain %_ptr_Function_v4float %m1 %18
OpStore %20 %22
%23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%main = OpFunction %void None %6
%9 = OpLabel
%m1 = OpVariable %_ptr_Function_mat2v4float Function %15
%18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%19 = OpLoad %uint %18
%21 = OpAccessChain %_ptr_Function_v4float %m1 %19
OpStore %21 %23
OpReturn
OpFunctionEnd

View File

@@ -1,15 +1,19 @@
#version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo {
struct Uniforms {
uint i;
uint j;
uint pad;
uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms;
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
void tint_symbol() {
m1[uniforms.i][0] = 1.0f;
m1[uniforms.inner.i][0] = 1.0f;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,19 +1,22 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 24
; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms"
OpName %m1 "m1"
OpName %main "main"
OpDecorate %Uniforms Block
OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable
@@ -21,27 +24,28 @@
OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
%uniforms_block = OpTypeStruct %Uniforms
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%10 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %10
%11 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %11
%void = OpTypeVoid
%11 = OpTypeFunction %void
%12 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%int = OpTypeInt 32 1
%20 = OpConstantNull %int
%21 = OpConstantNull %int
%_ptr_Private_float = OpTypePointer Private %float
%float_1 = OpConstant %float 1
%main = OpFunction %void None %11
%14 = OpLabel
%17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%18 = OpLoad %uint %17
%22 = OpAccessChain %_ptr_Private_float %m1 %18 %20
OpStore %22 %float_1
%main = OpFunction %void None %12
%15 = OpLabel
%18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%19 = OpLoad %uint %18
%23 = OpAccessChain %_ptr_Private_float %m1 %19 %21
OpStore %23 %float_1
OpReturn
OpFunctionEnd

View File

@@ -1,15 +1,19 @@
#version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo {
struct Uniforms {
uint i;
uint j;
uint pad;
uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms;
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
void tint_symbol() {
m1[uniforms.i][uniforms.j] = 1.0f;
m1[uniforms.inner.i][uniforms.inner.j] = 1.0f;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,19 +1,22 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Bound: 26
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms"
OpName %m1 "m1"
OpName %main "main"
OpDecorate %Uniforms Block
OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable
@@ -21,28 +24,29 @@
OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
%uniforms_block = OpTypeStruct %Uniforms
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%10 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %10
%11 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %11
%void = OpTypeVoid
%11 = OpTypeFunction %void
%12 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%uint_1 = OpConstant %uint 1
%_ptr_Private_float = OpTypePointer Private %float
%float_1 = OpConstant %float 1
%main = OpFunction %void None %11
%14 = OpLabel
%17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%18 = OpLoad %uint %17
%20 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%21 = OpLoad %uint %20
%23 = OpAccessChain %_ptr_Private_float %m1 %18 %21
OpStore %23 %float_1
%main = OpFunction %void None %12
%15 = OpLabel
%18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%19 = OpLoad %uint %18
%21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%22 = OpLoad %uint %21
%24 = OpAccessChain %_ptr_Private_float %m1 %19 %22
OpStore %24 %float_1
OpReturn
OpFunctionEnd

View File

@@ -1,15 +1,19 @@
#version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo {
struct Uniforms {
uint i;
uint j;
uint pad;
uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms;
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
void tint_symbol() {
m1[0][uniforms.j] = 1.0f;
m1[0][uniforms.inner.j] = 1.0f;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,19 +1,22 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 24
; Bound: 26
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms"
OpName %m1 "m1"
OpName %main "main"
OpDecorate %Uniforms Block
OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable
@@ -21,27 +24,29 @@
OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
%uniforms_block = OpTypeStruct %Uniforms
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%10 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %10
%11 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %11
%void = OpTypeVoid
%11 = OpTypeFunction %void
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%16 = OpConstantNull %int
%17 = OpConstantNull %int
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%_ptr_Private_float = OpTypePointer Private %float
%float_1 = OpConstant %float 1
%main = OpFunction %void None %11
%14 = OpLabel
%19 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%20 = OpLoad %uint %19
%22 = OpAccessChain %_ptr_Private_float %m1 %16 %20
OpStore %22 %float_1
%main = OpFunction %void None %12
%15 = OpLabel
%21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%22 = OpLoad %uint %21
%24 = OpAccessChain %_ptr_Private_float %m1 %17 %22
OpStore %24 %float_1
OpReturn
OpFunctionEnd

View File

@@ -1,15 +1,19 @@
#version 310 es
layout(binding = 4, std140) uniform Uniforms_ubo {
struct Uniforms {
uint i;
uint j;
uint pad;
uint pad_1;
};
layout(binding = 4, std140) uniform uniforms_block_ubo {
Uniforms inner;
} uniforms;
mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
void tint_symbol() {
m1[uniforms.i] = vec4(1.0f);
m1[uniforms.inner.i] = vec4(1.0f);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,19 +1,22 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 23
; Bound: 24
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %uniforms_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "i"
OpMemberName %Uniforms 1 "j"
OpName %uniforms "uniforms"
OpName %m1 "m1"
OpName %main "main"
OpDecorate %Uniforms Block
OpDecorate %uniforms_block Block
OpMemberDecorate %uniforms_block 0 Offset 0
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4
OpDecorate %uniforms NonWritable
@@ -21,26 +24,27 @@
OpDecorate %uniforms Binding 4
%uint = OpTypeInt 32 0
%Uniforms = OpTypeStruct %uint %uint
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
%uniforms_block = OpTypeStruct %Uniforms
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%10 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %10
%11 = OpConstantNull %mat2v4float
%m1 = OpVariable %_ptr_Private_mat2v4float Private %11
%void = OpTypeVoid
%11 = OpTypeFunction %void
%12 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%_ptr_Private_v4float = OpTypePointer Private %v4float
%float_1 = OpConstant %float 1
%22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%main = OpFunction %void None %11
%14 = OpLabel
%17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%18 = OpLoad %uint %17
%20 = OpAccessChain %_ptr_Private_v4float %m1 %18
OpStore %20 %22
%23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%main = OpFunction %void None %12
%15 = OpLabel
%18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%19 = OpLoad %uint %18
%21 = OpAccessChain %_ptr_Private_v4float %m1 %19
OpStore %21 %23
OpReturn
OpFunctionEnd