[hlsl] handle matCx2<f16> in the uniform address space properly

This commit is contained in:
teoxoy authored and Andy Leiserson committed 2026-06-01 12:13:51 -07:00
1 parent b4823876e6
commit a2c9a1c6a1
10 files changed
+2351 -70

No files matched your search

+27 -15
View File
@@ -78,6 +78,7 @@ pub(super) struct WrappedStructMatrixAccess {
#[derive(Clone, Copy, Debug, Hash, Eq, Ord, PartialEq, PartialOrd)]
pub(super) struct WrappedMatCx2 {
pub(super) columns: crate::VectorSize,
pub(super) width: u8,
}
#[derive(Clone, Copy, Debug, Hash, Eq, Ord, PartialEq, PartialOrd)]
@@ -838,13 +839,17 @@ impl<W: Write> super::Writer<'_, W> {
if let Some(super::writer::MatrixType {
columns,
rows: crate::VectorSize::Bi,
width: 4,
width,
}) = super::writer::get_inner_matrix_data(module, member.ty)
{
write!(
self.out,
"{}{}.{} = (__mat{}x2",
INDENT, RETURN_VARIABLE_NAME, field_name, columns as u8
"{}{}.{} = (__mat{}x2_f{}",
INDENT,
RETURN_VARIABLE_NAME,
field_name,
columns as u8,
width * 8
)?;
if let crate::TypeInner::Array { base, size, .. } = *other {
self.write_array_size(module, base, size)?;
@@ -2141,35 +2146,42 @@ impl<W: Write> super::Writer<'_, W> {
pub(super) fn write_mat_cx2_typedef_and_functions(
&mut self,
WrappedMatCx2 { columns }: WrappedMatCx2,
WrappedMatCx2 { columns, width }: WrappedMatCx2,
) -> BackendResult {
use crate::back::INDENT;
let bit_width = width * 8;
let type_name = crate::Scalar {
kind: ScalarKind::Float,
width,
}
.to_hlsl_str()?;
// typedef
write!(self.out, "typedef struct {{ ")?;
for i in 0..columns as u8 {
write!(self.out, "float2 _{i}; ")?;
write!(self.out, "{type_name}2 _{i}; ")?;
}
writeln!(self.out, "}} __mat{}x2;", columns as u8)?;
writeln!(self.out, "}} __mat{}x2_f{bit_width};", columns as u8)?;
// __get_col_of_mat
writeln!(
self.out,
"float2 __get_col_of_mat{}x2(__mat{}x2 mat, uint idx) {{",
"{type_name}2 __get_col_of_mat{}x2_f{bit_width}(__mat{}x2_f{bit_width} mat, uint idx) {{",
columns as u8, columns as u8
)?;
writeln!(self.out, "{INDENT}switch(idx) {{")?;
for i in 0..columns as u8 {
writeln!(self.out, "{INDENT}case {i}: {{ return mat._{i}; }}")?;
}
writeln!(self.out, "{INDENT}default: {{ return (float2)0; }}")?;
writeln!(self.out, "{INDENT}default: {{ return ({type_name}2)0; }}")?;
writeln!(self.out, "{INDENT}}}")?;
writeln!(self.out, "}}")?;
// __set_col_of_mat
writeln!(
self.out,
"void __set_col_of_mat{}x2(__mat{}x2 mat, uint idx, float2 value) {{",
"void __set_col_of_mat{}x2_f{bit_width}(__mat{}x2_f{bit_width} mat, uint idx, {type_name}2 value) {{",
columns as u8, columns as u8
)?;
writeln!(self.out, "{INDENT}switch(idx) {{")?;
@@ -2182,7 +2194,7 @@ impl<W: Write> super::Writer<'_, W> {
// __set_el_of_mat
writeln!(
self.out,
"void __set_el_of_mat{}x2(__mat{}x2 mat, uint idx, uint vec_idx, float value) {{",
"void __set_el_of_mat{}x2_f{bit_width}(__mat{}x2_f{bit_width} mat, uint idx, uint vec_idx, {type_name} value) {{",
columns as u8, columns as u8
)?;
writeln!(self.out, "{INDENT}switch(idx) {{")?;
@@ -2211,10 +2223,10 @@ impl<W: Write> super::Writer<'_, W> {
if let Some(super::writer::MatrixType {
columns,
rows: crate::VectorSize::Bi,
width: 4,
width,
}) = super::writer::get_inner_matrix_data(module, global.ty)
{
let entry = WrappedMatCx2 { columns };
let entry = WrappedMatCx2 { columns, width };
if self.wrapped.insert(WrappedType::MatCx2(entry)) {
self.write_mat_cx2_typedef_and_functions(entry)?;
}
@@ -2229,10 +2241,10 @@ impl<W: Write> super::Writer<'_, W> {
if let Some(super::writer::MatrixType {
columns,
rows: crate::VectorSize::Bi,
width: 4,
width,
}) = super::writer::get_inner_matrix_data(module, member.ty)
{
let entry = WrappedMatCx2 { columns };
let entry = WrappedMatCx2 { columns, width };
if self.wrapped.insert(WrappedType::MatCx2(entry)) {
self.write_mat_cx2_typedef_and_functions(entry)?;
}
@@ -2267,7 +2279,7 @@ impl<W: Write> super::Writer<'_, W> {
///
/// ```text
/// tests\out\hlsl\access.hlsl:183:41: error: cannot compile this l-value expression yet
/// t_1.am = (__mat4x2[2])((float4x2[2])0);
/// t_1.am = (__mat4x2_f32[2])((float4x2[2])0);
/// ^
/// ```
fn write_wrapped_zero_value_function(
+31 -12
View File
@@ -1519,10 +1519,10 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
if let Some(MatrixType {
columns,
rows: crate::VectorSize::Bi,
width: 4,
width,
}) = matrix_data
{
write!(self.out, "__mat{}x2", columns as u8)?;
write!(self.out, "__mat{}x2_f{}", columns as u8, width * 8)?;
} else {
// Even though Naga IR matrices are column-major, we must describe
// matrices passed from the CPU as being in row-major order.
@@ -2380,6 +2380,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
},
Struct {
columns: crate::VectorSize,
width: u8,
base: Handle<crate::Expression>,
},
}
@@ -2422,7 +2423,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
if let Some(MatrixType {
columns,
rows: crate::VectorSize::Bi,
width: 4,
width,
}) = get_inner_matrix_of_struct_array_member(
module,
matrix_expr,
@@ -2432,6 +2433,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
Some((
MatrixAccess::Struct {
columns,
width,
base: matrix_expr,
},
vector,
@@ -2507,7 +2509,11 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
}
}
Some((
MatrixAccess::Struct { columns, base },
MatrixAccess::Struct {
columns,
width,
base,
},
Some(Index::Expression(vec_index)),
scalar,
)) => {
@@ -2515,9 +2521,19 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
// the previously injected functions __set_col_of_matCx2 / __set_el_of_matCx2.
if scalar.is_some() {
write!(self.out, "__set_el_of_mat{}x2", columns as u8)?;
write!(
self.out,
"__set_el_of_mat{}x2_f{}",
columns as u8,
width * 8
)?;
} else {
write!(self.out, "__set_col_of_mat{}x2", columns as u8)?;
write!(
self.out,
"__set_col_of_mat{}x2_f{}",
columns as u8,
width * 8
)?;
}
write!(self.out, "(")?;
self.write_expr(module, base, func_ctx)?;
@@ -2547,7 +2563,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
if let Some(MatrixType {
columns,
rows: crate::VectorSize::Bi,
width: 4,
width,
}) = get_inner_matrix_of_struct_array_member(
module, pointer, func_ctx, false,
) {
@@ -2556,7 +2572,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
resolved = &module.types[base].inner;
}
write!(self.out, "(__mat{}x2", columns as u8)?;
write!(self.out, "(__mat{}x2_f{}", columns as u8, width * 8)?;
if let TypeInner::Array { base, size, .. } = *resolved {
self.write_array_size(module, base, size)?;
}
@@ -3336,13 +3352,18 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
if let Some(MatrixType {
columns,
rows: crate::VectorSize::Bi,
width: 4,
width,
}) = get_inner_matrix_of_struct_array_member(module, base, func_ctx, true)
.or_else(|| {
get_inner_matrix_of_global_uniform(module, base, func_ctx, true)
})
{
write!(self.out, "__get_col_of_mat{}x2(", columns as u8)?;
write!(
self.out,
"__get_col_of_mat{}x2_f{}(",
columns as u8,
width * 8
)?;
self.write_expr(module, base, func_ctx)?;
write!(self.out, ", ")?;
self.write_expr(module, index, func_ctx)?;
@@ -3461,7 +3482,6 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
// __matCx2 struct.
if let Some(MatrixType {
rows: crate::VectorSize::Bi,
width: 4,
..
}) = get_inner_matrix_of_struct_array_member(module, base, func_ctx, true)
.or_else(|| {
@@ -3810,7 +3830,6 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
// - a (possibly nested) array of __matCx2's
if let Some(MatrixType {
rows: crate::VectorSize::Bi,
width: 4,
..
}) = get_inner_matrix_of_struct_array_member(
module, pointer, func_ctx, false,
+8
View File
@@ -0,0 +1,8 @@
capabilities = "SHADER_FLOAT16"
targets = "HLSL | SPIRV"
[hlsl]
shader_model = "V6_2"
[spv]
debug = true
+242
View File
@@ -0,0 +1,242 @@
// Test handling of N-by-2 matrices.
// See the doc comments on `naga::back::hlsl` and `naga::back::spv` for details.
//
// There are additional tests in `access.wgsl`.
//
// Tests that we don't apply this handling to other sizes are in mat_cx3.wgsl.
// Access type (3rd item in variable names)
// S = Struct
// M = Matrix
// C = Column
// E = Element
// Index type (4th item in variable names)
// C = Constant
// V = Variable
enable f16;
alias Mat = mat4x2<f16>;
@group(0) @binding(0)
var<storage, read_write> s_m: Mat;
@group(0) @binding(1)
var<uniform> u_m: Mat;
fn access_m() {
var idx = 1;
idx--;
// loads from storage
let l_s_m = s_m;
let l_s_c_c = s_m[0];
let l_s_c_v = s_m[idx];
let l_s_e_cc = s_m[0][0];
let l_s_e_cv = s_m[0][idx];
let l_s_e_vc = s_m[idx][0];
let l_s_e_vv = s_m[idx][idx];
// loads from uniform
let l_u_m = u_m;
let l_u_c_c = u_m[0];
let l_u_c_v = u_m[idx];
let l_u_e_cc = u_m[0][0];
let l_u_e_cv = u_m[0][idx];
let l_u_e_vc = u_m[idx][0];
let l_u_e_vv = u_m[idx][idx];
// stores to storage
s_m = l_u_m;
s_m[0] = l_u_c_c;
s_m[idx] = l_u_c_v;
s_m[0][0] = l_u_e_cc;
s_m[0][idx] = l_u_e_cv;
s_m[idx][0] = l_u_e_vc;
s_m[idx][idx] = l_u_e_vv;
}
struct StructWithMat {
m: Mat,
}
@group(1) @binding(0)
var<storage, read_write> s_sm: StructWithMat;
@group(1) @binding(1)
var<uniform> u_sm: StructWithMat;
fn access_sm() {
var idx = 1;
idx--;
// loads from storage
let l_s_s = s_sm;
let l_s_m = s_sm.m;
let l_s_c_c = s_sm.m[0];
let l_s_c_v = s_sm.m[idx];
let l_s_e_cc = s_sm.m[0][0];
let l_s_e_cv = s_sm.m[0][idx];
let l_s_e_vc = s_sm.m[idx][0];
let l_s_e_vv = s_sm.m[idx][idx];
// loads from uniform
let l_u_s = u_sm;
let l_u_m = u_sm.m;
let l_u_c_c = u_sm.m[0];
let l_u_c_v = u_sm.m[idx];
let l_u_e_cc = u_sm.m[0][0];
let l_u_e_cv = u_sm.m[0][idx];
let l_u_e_vc = u_sm.m[idx][0];
let l_u_e_vv = u_sm.m[idx][idx];
// stores to storage
s_sm = l_u_s;
s_sm.m = l_u_m;
s_sm.m[0] = l_u_c_c;
s_sm.m[idx] = l_u_c_v;
s_sm.m[0][0] = l_u_e_cc;
s_sm.m[0][idx] = l_u_e_cv;
s_sm.m[idx][0] = l_u_e_vc;
s_sm.m[idx][idx] = l_u_e_vv;
}
@group(2) @binding(0)
var<storage, read_write> s_am: array<Mat, 4>;
@group(2) @binding(1)
var<uniform> u_am: array<Mat, 4>;
fn access_am() {
var idx = 1;
idx--;
// loads from storage
let l_s_a = s_am;
let l_s_m_c = s_am[0];
let l_s_m_v = s_am[idx];
let l_s_c_cc = s_am[0][0];
let l_s_c_cv = s_am[0][idx];
let l_s_c_vc = s_am[idx][0];
let l_s_c_vv = s_am[idx][idx];
let l_s_e_ccc = s_am[0][0][0];
let l_s_e_ccv = s_am[0][0][idx];
let l_s_e_cvc = s_am[0][idx][0];
let l_s_e_cvv = s_am[0][idx][idx];
let l_s_e_vcc = s_am[idx][0][0];
let l_s_e_vcv = s_am[idx][0][idx];
let l_s_e_vvc = s_am[idx][idx][0];
let l_s_e_vvv = s_am[idx][idx][idx];
// loads from uniform
let l_u_a = u_am;
let l_u_m_c = u_am[0];
let l_u_m_v = u_am[idx];
let l_u_c_cc = u_am[0][0];
let l_u_c_cv = u_am[0][idx];
let l_u_c_vc = u_am[idx][0];
let l_u_c_vv = u_am[idx][idx];
let l_u_e_ccc = u_am[0][0][0];
let l_u_e_ccv = u_am[0][0][idx];
let l_u_e_cvc = u_am[0][idx][0];
let l_u_e_cvv = u_am[0][idx][idx];
let l_u_e_vcc = u_am[idx][0][0];
let l_u_e_vcv = u_am[idx][0][idx];
let l_u_e_vvc = u_am[idx][idx][0];
let l_u_e_vvv = u_am[idx][idx][idx];
// stores to storage
s_am = l_u_a;
s_am[0] = l_u_m_c;
s_am[idx] = l_u_m_v;
s_am[0][0] = l_u_c_cc;
s_am[0][idx] = l_u_c_cv;
s_am[idx][0] = l_u_c_vc;
s_am[idx][idx] = l_u_c_vv;
s_am[0][0][0] = l_u_e_ccc;
s_am[0][0][idx] = l_u_e_ccv;
s_am[0][idx][0] = l_u_e_cvc;
s_am[0][idx][idx] = l_u_e_cvv;
s_am[idx][0][0] = l_u_e_vcc;
s_am[idx][0][idx] = l_u_e_vcv;
s_am[idx][idx][0] = l_u_e_vvc;
s_am[idx][idx][idx] = l_u_e_vvv;
}
struct StructWithArrayOfStructOfMat {
a: array<StructWithMat, 4>,
}
@group(3) @binding(0)
var<storage, read_write> s_sasm: StructWithArrayOfStructOfMat;
@group(3) @binding(1)
var<uniform> u_sasm: StructWithArrayOfStructOfMat;
fn access_sasm() {
var idx = 1;
idx--;
// loads from storage
let l_s_s = s_sasm;
let l_s_a = s_sasm.a;
let l_s_m_c = s_sasm.a[0].m;
let l_s_m_v = s_sasm.a[idx].m;
let l_s_c_cc = s_sasm.a[0].m[0];
let l_s_c_cv = s_sasm.a[0].m[idx];
let l_s_c_vc = s_sasm.a[idx].m[0];
let l_s_c_vv = s_sasm.a[idx].m[idx];
let l_s_e_ccc = s_sasm.a[0].m[0][0];
let l_s_e_ccv = s_sasm.a[0].m[0][idx];
let l_s_e_cvc = s_sasm.a[0].m[idx][0];
let l_s_e_cvv = s_sasm.a[0].m[idx][idx];
let l_s_e_vcc = s_sasm.a[idx].m[0][0];
let l_s_e_vcv = s_sasm.a[idx].m[0][idx];
let l_s_e_vvc = s_sasm.a[idx].m[idx][0];
let l_s_e_vvv = s_sasm.a[idx].m[idx][idx];
// loads from uniform
let l_u_s = u_sasm;
let l_u_a = u_sasm.a;
let l_u_m_c = u_sasm.a[0].m;
let l_u_m_v = u_sasm.a[idx].m;
let l_u_c_cc = u_sasm.a[0].m[0];
let l_u_c_cv = u_sasm.a[0].m[idx];
let l_u_c_vc = u_sasm.a[idx].m[0];
let l_u_c_vv = u_sasm.a[idx].m[idx];
let l_u_e_ccc = u_sasm.a[0].m[0][0];
let l_u_e_ccv = u_sasm.a[0].m[0][idx];
let l_u_e_cvc = u_sasm.a[0].m[idx][0];
let l_u_e_cvv = u_sasm.a[0].m[idx][idx];
let l_u_e_vcc = u_sasm.a[idx].m[0][0];
let l_u_e_vcv = u_sasm.a[idx].m[0][idx];
let l_u_e_vvc = u_sasm.a[idx].m[idx][0];
let l_u_e_vvv = u_sasm.a[idx].m[idx][idx];
// stores to storage
s_sasm = l_u_s;
s_sasm.a = l_u_a;
s_sasm.a[0].m = l_u_m_c;
s_sasm.a[idx].m = l_u_m_v;
s_sasm.a[0].m[0] = l_u_c_cc;
s_sasm.a[0].m[idx] = l_u_c_cv;
s_sasm.a[idx].m[0] = l_u_c_vc;
s_sasm.a[idx].m[idx] = l_u_c_vv;
s_sasm.a[0].m[0][0] = l_u_e_ccc;
s_sasm.a[0].m[0][idx] = l_u_e_ccv;
s_sasm.a[0].m[idx][0] = l_u_e_cvc;
s_sasm.a[0].m[idx][idx] = l_u_e_cvv;
s_sasm.a[idx].m[0][0] = l_u_e_vcc;
s_sasm.a[idx].m[0][idx] = l_u_e_vcv;
s_sasm.a[idx].m[idx][0] = l_u_e_vvc;
s_sasm.a[idx].m[idx][idx] = l_u_e_vvv;
}
@compute @workgroup_size(1)
fn main() {
access_m();
access_sm();
access_am();
access_sasm();
}
+18 -18
View File
@@ -1,26 +1,26 @@
typedef struct { float2 _0; float2 _1; } __mat2x2;
float2 __get_col_of_mat2x2(__mat2x2 mat, uint idx) {
typedef struct { float2 _0; float2 _1; } __mat2x2_f32;
float2 __get_col_of_mat2x2_f32(__mat2x2_f32 mat, uint idx) {
switch(idx) {
case 0: { return mat._0; }
case 1: { return mat._1; }
default: { return (float2)0; }
}
}
void __set_col_of_mat2x2(__mat2x2 mat, uint idx, float2 value) {
void __set_col_of_mat2x2_f32(__mat2x2_f32 mat, uint idx, float2 value) {
switch(idx) {
case 0: { mat._0 = value; break; }
case 1: { mat._1 = value; break; }
}
}
void __set_el_of_mat2x2(__mat2x2 mat, uint idx, uint vec_idx, float value) {
void __set_el_of_mat2x2_f32(__mat2x2_f32 mat, uint idx, uint vec_idx, float value) {
switch(idx) {
case 0: { mat._0[vec_idx] = value; break; }
case 1: { mat._1[vec_idx] = value; break; }
}
}
typedef struct { float2 _0; float2 _1; float2 _2; float2 _3; } __mat4x2;
float2 __get_col_of_mat4x2(__mat4x2 mat, uint idx) {
typedef struct { float2 _0; float2 _1; float2 _2; float2 _3; } __mat4x2_f32;
float2 __get_col_of_mat4x2_f32(__mat4x2_f32 mat, uint idx) {
switch(idx) {
case 0: { return mat._0; }
case 1: { return mat._1; }
@@ -29,7 +29,7 @@ float2 __get_col_of_mat4x2(__mat4x2 mat, uint idx) {
default: { return (float2)0; }
}
}
void __set_col_of_mat4x2(__mat4x2 mat, uint idx, float2 value) {
void __set_col_of_mat4x2_f32(__mat4x2_f32 mat, uint idx, float2 value) {
switch(idx) {
case 0: { mat._0 = value; break; }
case 1: { mat._1 = value; break; }
@@ -37,7 +37,7 @@ void __set_col_of_mat4x2(__mat4x2 mat, uint idx, float2 value) {
case 3: { mat._3 = value; break; }
}
}
void __set_el_of_mat4x2(__mat4x2 mat, uint idx, uint vec_idx, float value) {
void __set_el_of_mat4x2_f32(__mat4x2_f32 mat, uint idx, uint vec_idx, float value) {
switch(idx) {
case 0: { mat._0[vec_idx] = value; break; }
case 1: { mat._1[vec_idx] = value; break; }
@@ -65,7 +65,7 @@ struct Baz {
};
struct MatCx2InArray {
__mat4x2 am[2];
__mat4x2_f32 am[2];
};
struct AssignToMember {
@@ -171,7 +171,7 @@ void test_matrix_within_struct_accesses()
MatCx2InArray ConstructMatCx2InArray(float4x2 arg0[2]) {
MatCx2InArray ret = (MatCx2InArray)0;
ret.am = (__mat4x2[2])arg0;
ret.am = (__mat4x2_f32[2])arg0;
return ret;
}
@@ -191,30 +191,30 @@ void test_matrix_within_array_within_struct_accesses()
float4x2 l1_1 = ((float4x2)nested_mat_cx2_.am[0]);
float2 l2_1 = nested_mat_cx2_.am[0]._0;
int _e20 = idx_1;
float2 l3_1 = __get_col_of_mat4x2(nested_mat_cx2_.am[0], _e20);
float2 l3_1 = __get_col_of_mat4x2_f32(nested_mat_cx2_.am[0], _e20);
float l4_1 = nested_mat_cx2_.am[0]._0.y;
int _e33 = idx_1;
float l5_1 = nested_mat_cx2_.am[0]._0[_e33];
int _e39 = idx_1;
float l6_1 = __get_col_of_mat4x2(nested_mat_cx2_.am[0], _e39).y;
float l6_1 = __get_col_of_mat4x2_f32(nested_mat_cx2_.am[0], _e39).y;
int _e46 = idx_1;
int _e48 = idx_1;
float l7_ = __get_col_of_mat4x2(nested_mat_cx2_.am[0], _e46)[_e48];
float l7_ = __get_col_of_mat4x2_f32(nested_mat_cx2_.am[0], _e46)[_e48];
int _e55 = idx_1;
idx_1 = asint(asuint(_e55) + asuint(int(1)));
t_1.am = (__mat4x2[2])ZeroValuearray2_float4x2_();
t_1.am[0] = (__mat4x2)float4x2((8.0).xx, (7.0).xx, (6.0).xx, (5.0).xx);
t_1.am = (__mat4x2_f32[2])ZeroValuearray2_float4x2_();
t_1.am[0] = (__mat4x2_f32)float4x2((8.0).xx, (7.0).xx, (6.0).xx, (5.0).xx);
t_1.am[0]._0 = (9.0).xx;
int _e77 = idx_1;
__set_col_of_mat4x2(t_1.am[0], _e77, (90.0).xx);
__set_col_of_mat4x2_f32(t_1.am[0], _e77, (90.0).xx);
t_1.am[0]._0.y = 10.0;
int _e89 = idx_1;
t_1.am[0]._0[min(uint(_e89), 1u)] = 20.0;
int _e94 = idx_1;
__set_el_of_mat4x2(t_1.am[0], _e94, 1, 30.0);
__set_el_of_mat4x2_f32(t_1.am[0], _e94, 1, 30.0);
int _e100 = idx_1;
int _e102 = idx_1;
__set_el_of_mat4x2(t_1.am[0], _e100, _e102, 40.0);
__set_el_of_mat4x2_f32(t_1.am[0], _e100, _e102, 40.0);
return;
}
+10 -10
View File
@@ -1,5 +1,5 @@
typedef struct { float2 _0; float2 _1; float2 _2; } __mat3x2;
float2 __get_col_of_mat3x2(__mat3x2 mat, uint idx) {
typedef struct { float2 _0; float2 _1; float2 _2; } __mat3x2_f32;
float2 __get_col_of_mat3x2_f32(__mat3x2_f32 mat, uint idx) {
switch(idx) {
case 0: { return mat._0; }
case 1: { return mat._1; }
@@ -7,14 +7,14 @@ float2 __get_col_of_mat3x2(__mat3x2 mat, uint idx) {
default: { return (float2)0; }
}
}
void __set_col_of_mat3x2(__mat3x2 mat, uint idx, float2 value) {
void __set_col_of_mat3x2_f32(__mat3x2_f32 mat, uint idx, float2 value) {
switch(idx) {
case 0: { mat._0 = value; break; }
case 1: { mat._1 = value; break; }
case 2: { mat._2 = value; break; }
}
}
void __set_el_of_mat3x2(__mat3x2 mat, uint idx, uint vec_idx, float value) {
void __set_el_of_mat3x2_f32(__mat3x2_f32 mat, uint idx, uint vec_idx, float value) {
switch(idx) {
case 0: { mat._0[vec_idx] = value; break; }
case 1: { mat._1[vec_idx] = value; break; }
@@ -22,8 +22,8 @@ void __set_el_of_mat3x2(__mat3x2 mat, uint idx, uint vec_idx, float value) {
}
}
typedef struct { float2 _0; float2 _1; float2 _2; float2 _3; } __mat4x2;
float2 __get_col_of_mat4x2(__mat4x2 mat, uint idx) {
typedef struct { float2 _0; float2 _1; float2 _2; float2 _3; } __mat4x2_f32;
float2 __get_col_of_mat4x2_f32(__mat4x2_f32 mat, uint idx) {
switch(idx) {
case 0: { return mat._0; }
case 1: { return mat._1; }
@@ -32,7 +32,7 @@ float2 __get_col_of_mat4x2(__mat4x2 mat, uint idx) {
default: { return (float2)0; }
}
}
void __set_col_of_mat4x2(__mat4x2 mat, uint idx, float2 value) {
void __set_col_of_mat4x2_f32(__mat4x2_f32 mat, uint idx, float2 value) {
switch(idx) {
case 0: { mat._0 = value; break; }
case 1: { mat._1 = value; break; }
@@ -40,7 +40,7 @@ void __set_col_of_mat4x2(__mat4x2 mat, uint idx, float2 value) {
case 3: { mat._3 = value; break; }
}
}
void __set_el_of_mat4x2(__mat4x2 mat, uint idx, uint vec_idx, float value) {
void __set_el_of_mat4x2_f32(__mat4x2_f32 mat, uint idx, uint vec_idx, float value) {
switch(idx) {
case 0: { mat._0[vec_idx] = value; break; }
case 1: { mat._1[vec_idx] = value; break; }
@@ -62,9 +62,9 @@ RWByteAddressBuffer alignment : register(u1);
ByteAddressBuffer dummy : register(t2);
cbuffer float_vecs : register(b3) { float4 float_vecs[20]; }
cbuffer global_vec : register(b4) { float3 global_vec; }
cbuffer global_mat : register(b5) { __mat3x2 global_mat; }
cbuffer global_mat : register(b5) { __mat3x2_f32 global_mat; }
cbuffer global_nested_arrays_of_matrices_2x4_ : register(b6) { row_major float2x4 global_nested_arrays_of_matrices_2x4_[2][2]; }
cbuffer global_nested_arrays_of_matrices_4x2_ : register(b7) { __mat4x2 global_nested_arrays_of_matrices_4x2_[2][2]; }
cbuffer global_nested_arrays_of_matrices_4x2_ : register(b7) { __mat4x2_f32 global_nested_arrays_of_matrices_4x2_[2][2]; }
void test_msl_packed_vec3_as_arg(float3 arg)
{
+15 -15
View File
@@ -1,18 +1,18 @@
typedef struct { float2 _0; float2 _1; } __mat2x2;
float2 __get_col_of_mat2x2(__mat2x2 mat, uint idx) {
typedef struct { float2 _0; float2 _1; } __mat2x2_f32;
float2 __get_col_of_mat2x2_f32(__mat2x2_f32 mat, uint idx) {
switch(idx) {
case 0: { return mat._0; }
case 1: { return mat._1; }
default: { return (float2)0; }
}
}
void __set_col_of_mat2x2(__mat2x2 mat, uint idx, float2 value) {
void __set_col_of_mat2x2_f32(__mat2x2_f32 mat, uint idx, float2 value) {
switch(idx) {
case 0: { mat._0 = value; break; }
case 1: { mat._1 = value; break; }
}
}
void __set_el_of_mat2x2(__mat2x2 mat, uint idx, uint vec_idx, float value) {
void __set_el_of_mat2x2_f32(__mat2x2_f32 mat, uint idx, uint vec_idx, float value) {
switch(idx) {
case 0: { mat._0[vec_idx] = value; break; }
case 1: { mat._1[vec_idx] = value; break; }
@@ -28,11 +28,11 @@ struct StructWithArrayOfStructOfMat {
};
RWByteAddressBuffer s_m : register(u0);
cbuffer u_m : register(b1) { __mat2x2 u_m; }
cbuffer u_m : register(b1) { __mat2x2_f32 u_m; }
RWByteAddressBuffer s_sm : register(u0, space1);
cbuffer u_sm : register(b1, space1) { StructWithMat u_sm; }
RWByteAddressBuffer s_am : register(u0, space2);
cbuffer u_am : register(b1, space2) { __mat2x2 u_am[4]; }
cbuffer u_am : register(b1, space2) { __mat2x2_f32 u_am[4]; }
RWByteAddressBuffer s_sasm : register(u0, space3);
cbuffer u_sasm : register(b1, space3) { StructWithArrayOfStructOfMat u_sasm; }
@@ -57,15 +57,15 @@ void access_m()
float2x2 l_u_m = ((float2x2)u_m);
float2 l_u_c_c = u_m._0;
int _e40 = idx;
float2 l_u_c_v = __get_col_of_mat2x2(u_m, _e40);
float2 l_u_c_v = __get_col_of_mat2x2_f32(u_m, _e40);
float l_u_e_cc = u_m._0.x;
int _e49 = idx;
float l_u_e_cv = u_m._0[_e49];
int _e53 = idx;
float l_u_e_vc = __get_col_of_mat2x2(u_m, _e53).x;
float l_u_e_vc = __get_col_of_mat2x2_f32(u_m, _e53).x;
int _e58 = idx;
int _e60 = idx;
float l_u_e_vv = __get_col_of_mat2x2(u_m, _e58)[_e60];
float l_u_e_vv = __get_col_of_mat2x2_f32(u_m, _e58)[_e60];
{
float2x2 _value2 = l_u_m;
s_m.Store2(0, asuint(_value2[0]));
@@ -223,20 +223,20 @@ void access_am()
float2x2 l_u_m_v = ((float2x2)u_am[_e92]);
float2 l_u_c_cc = u_am[0]._0;
int _e101 = idx_2;
float2 l_u_c_cv = __get_col_of_mat2x2(u_am[0], _e101);
float2 l_u_c_cv = __get_col_of_mat2x2_f32(u_am[0], _e101);
int _e105 = idx_2;
float2 l_u_c_vc = u_am[_e105]._0;
int _e110 = idx_2;
int _e112 = idx_2;
float2 l_u_c_vv = __get_col_of_mat2x2(u_am[_e110], _e112);
float2 l_u_c_vv = __get_col_of_mat2x2_f32(u_am[_e110], _e112);
float l_u_e_ccc = u_am[0]._0.x;
int _e123 = idx_2;
float l_u_e_ccv = u_am[0]._0[_e123];
int _e128 = idx_2;
float l_u_e_cvc = __get_col_of_mat2x2(u_am[0], _e128).x;
float l_u_e_cvc = __get_col_of_mat2x2_f32(u_am[0], _e128).x;
int _e134 = idx_2;
int _e136 = idx_2;
float l_u_e_cvv = __get_col_of_mat2x2(u_am[0], _e134)[_e136];
float l_u_e_cvv = __get_col_of_mat2x2_f32(u_am[0], _e134)[_e136];
int _e140 = idx_2;
float l_u_e_vcc = u_am[_e140]._0.x;
int _e146 = idx_2;
@@ -244,11 +244,11 @@ void access_am()
float l_u_e_vcv = u_am[_e146]._0[_e149];
int _e153 = idx_2;
int _e155 = idx_2;
float l_u_e_vvc = __get_col_of_mat2x2(u_am[_e153], _e155).x;
float l_u_e_vvc = __get_col_of_mat2x2_f32(u_am[_e153], _e155).x;
int _e160 = idx_2;
int _e162 = idx_2;
int _e164 = idx_2;
float l_u_e_vvv = __get_col_of_mat2x2(u_am[_e160], _e162)[_e164];
float l_u_e_vvv = __get_col_of_mat2x2_f32(u_am[_e160], _e162)[_e164];
{
float2x2 _value2[4] = l_u_a;
{
+568
View File
@@ -0,0 +1,568 @@
typedef struct { half2 _0; half2 _1; half2 _2; half2 _3; } __mat4x2_f16;
half2 __get_col_of_mat4x2_f16(__mat4x2_f16 mat, uint idx) {
switch(idx) {
case 0: { return mat._0; }
case 1: { return mat._1; }
case 2: { return mat._2; }
case 3: { return mat._3; }
default: { return (half2)0; }
}
}
void __set_col_of_mat4x2_f16(__mat4x2_f16 mat, uint idx, half2 value) {
switch(idx) {
case 0: { mat._0 = value; break; }
case 1: { mat._1 = value; break; }
case 2: { mat._2 = value; break; }
case 3: { mat._3 = value; break; }
}
}
void __set_el_of_mat4x2_f16(__mat4x2_f16 mat, uint idx, uint vec_idx, half value) {
switch(idx) {
case 0: { mat._0[vec_idx] = value; break; }
case 1: { mat._1[vec_idx] = value; break; }
case 2: { mat._2[vec_idx] = value; break; }
case 3: { mat._3[vec_idx] = value; break; }
}
}
struct StructWithMat {
half2 m_0; half2 m_1; half2 m_2; half2 m_3;
};
struct StructWithArrayOfStructOfMat {
StructWithMat a[4];
};
RWByteAddressBuffer s_m : register(u0);
cbuffer u_m : register(b1) { __mat4x2_f16 u_m; }
RWByteAddressBuffer s_sm : register(u0, space1);
cbuffer u_sm : register(b1, space1) { StructWithMat u_sm; }
RWByteAddressBuffer s_am : register(u0, space2);
cbuffer u_am : register(b1, space2) { __mat4x2_f16 u_am[4]; }
RWByteAddressBuffer s_sasm : register(u0, space3);
cbuffer u_sasm : register(b1, space3) { StructWithArrayOfStructOfMat u_sasm; }
void access_m()
{
int idx = int(1);
int _e3 = idx;
idx = asint(asuint(_e3) - asuint(int(1)));
half4x2 l_s_m = half4x2(s_m.Load<half2>(0), s_m.Load<half2>(4), s_m.Load<half2>(8), s_m.Load<half2>(12));
half2 l_s_c_c = s_m.Load<half2>(0);
int _e11 = idx;
half2 l_s_c_v = s_m.Load<half2>(_e11*4);
half l_s_e_cc = s_m.Load<half>(0+0);
int _e20 = idx;
half l_s_e_cv = s_m.Load<half>(_e20*2+0);
int _e24 = idx;
half l_s_e_vc = s_m.Load<half>(0+_e24*4);
int _e29 = idx;
int _e31 = idx;
half l_s_e_vv = s_m.Load<half>(_e31*2+_e29*4);
half4x2 l_u_m = ((half4x2)u_m);
half2 l_u_c_c = u_m._0;
int _e40 = idx;
half2 l_u_c_v = __get_col_of_mat4x2_f16(u_m, _e40);
half l_u_e_cc = u_m._0.x;
int _e49 = idx;
half l_u_e_cv = u_m._0[_e49];
int _e53 = idx;
half l_u_e_vc = __get_col_of_mat4x2_f16(u_m, _e53).x;
int _e58 = idx;
int _e60 = idx;
half l_u_e_vv = __get_col_of_mat4x2_f16(u_m, _e58)[_e60];
{
half4x2 _value2 = l_u_m;
s_m.Store(0, _value2[0]);
s_m.Store(4, _value2[1]);
s_m.Store(8, _value2[2]);
s_m.Store(12, _value2[3]);
}
s_m.Store(0, l_u_c_c);
int _e67 = idx;
s_m.Store(_e67*4, l_u_c_v);
s_m.Store(0+0, l_u_e_cc);
int _e74 = idx;
s_m.Store(_e74*2+0, l_u_e_cv);
int _e77 = idx;
s_m.Store(0+_e77*4, l_u_e_vc);
int _e81 = idx;
int _e83 = idx;
s_m.Store(_e83*2+_e81*4, l_u_e_vv);
return;
}
StructWithMat ConstructStructWithMat(half4x2 arg0) {
StructWithMat ret = (StructWithMat)0;
ret.m_0 = arg0[0];
ret.m_1 = arg0[1];
ret.m_2 = arg0[2];
ret.m_3 = arg0[3];
return ret;
}
half4x2 GetMatmOnStructWithMat(StructWithMat obj) {
return half4x2(obj.m_0, obj.m_1, obj.m_2, obj.m_3);
}
void SetMatmOnStructWithMat(StructWithMat obj, half4x2 mat) {
obj.m_0 = mat[0];
obj.m_1 = mat[1];
obj.m_2 = mat[2];
obj.m_3 = mat[3];
}
void SetMatVecmOnStructWithMat(StructWithMat obj, half2 vec, uint mat_idx) {
switch(mat_idx) {
case 0: { obj.m_0 = vec; break; }
case 1: { obj.m_1 = vec; break; }
case 2: { obj.m_2 = vec; break; }
case 3: { obj.m_3 = vec; break; }
}
}
void SetMatScalarmOnStructWithMat(StructWithMat obj, half scalar, uint mat_idx, uint vec_idx) {
switch(mat_idx) {
case 0: { obj.m_0[vec_idx] = scalar; break; }
case 1: { obj.m_1[vec_idx] = scalar; break; }
case 2: { obj.m_2[vec_idx] = scalar; break; }
case 3: { obj.m_3[vec_idx] = scalar; break; }
}
}
void access_sm()
{
int idx_1 = int(1);
int _e3 = idx_1;
idx_1 = asint(asuint(_e3) - asuint(int(1)));
StructWithMat l_s_s = ConstructStructWithMat(half4x2(s_sm.Load<half2>(0+0), s_sm.Load<half2>(0+4), s_sm.Load<half2>(0+8), s_sm.Load<half2>(0+12)));
half4x2 l_s_m_1 = half4x2(s_sm.Load<half2>(0+0), s_sm.Load<half2>(0+4), s_sm.Load<half2>(0+8), s_sm.Load<half2>(0+12));
half2 l_s_c_c_1 = s_sm.Load<half2>(0+0);
int _e16 = idx_1;
half2 l_s_c_v_1 = s_sm.Load<half2>(_e16*4+0);
half l_s_e_cc_1 = s_sm.Load<half>(0+0+0);
int _e27 = idx_1;
half l_s_e_cv_1 = s_sm.Load<half>(_e27*2+0+0);
int _e32 = idx_1;
half l_s_e_vc_1 = s_sm.Load<half>(0+_e32*4+0);
int _e38 = idx_1;
int _e40 = idx_1;
half l_s_e_vv_1 = s_sm.Load<half>(_e40*2+_e38*4+0);
StructWithMat l_u_s = u_sm;
half4x2 l_u_m_1 = GetMatmOnStructWithMat(u_sm);
half2 l_u_c_c_1 = GetMatmOnStructWithMat(u_sm)[0];
int _e54 = idx_1;
half2 l_u_c_v_1 = GetMatmOnStructWithMat(u_sm)[_e54];
half l_u_e_cc_1 = GetMatmOnStructWithMat(u_sm)[0].x;
int _e65 = idx_1;
half l_u_e_cv_1 = GetMatmOnStructWithMat(u_sm)[0][_e65];
int _e70 = idx_1;
half l_u_e_vc_1 = GetMatmOnStructWithMat(u_sm)[_e70].x;
int _e76 = idx_1;
int _e78 = idx_1;
half l_u_e_vv_1 = GetMatmOnStructWithMat(u_sm)[_e76][_e78];
{
StructWithMat _value2 = l_u_s;
{
s_sm.Store(0+0, _value2.m_0);
s_sm.Store(0+4, _value2.m_1);
s_sm.Store(0+8, _value2.m_2);
s_sm.Store(0+12, _value2.m_3);
}
}
{
half4x2 _value2 = l_u_m_1;
s_sm.Store(0+0, _value2[0]);
s_sm.Store(0+4, _value2[1]);
s_sm.Store(0+8, _value2[2]);
s_sm.Store(0+12, _value2[3]);
}
s_sm.Store(0+0, l_u_c_c_1);
int _e89 = idx_1;
s_sm.Store(_e89*4+0, l_u_c_v_1);
s_sm.Store(0+0+0, l_u_e_cc_1);
int _e98 = idx_1;
s_sm.Store(_e98*2+0+0, l_u_e_cv_1);
int _e102 = idx_1;
s_sm.Store(0+_e102*4+0, l_u_e_vc_1);
int _e107 = idx_1;
int _e109 = idx_1;
s_sm.Store(_e109*2+_e107*4+0, l_u_e_vv_1);
return;
}
typedef half4x2 ret_Constructarray4_half4x2_[4];
ret_Constructarray4_half4x2_ Constructarray4_half4x2_(half4x2 arg0, half4x2 arg1, half4x2 arg2, half4x2 arg3) {
half4x2 ret[4] = { arg0, arg1, arg2, arg3 };
return ret;
}
void access_am()
{
int idx_2 = int(1);
int _e3 = idx_2;
idx_2 = asint(asuint(_e3) - asuint(int(1)));
half4x2 l_s_a[4] = Constructarray4_half4x2_(half4x2(s_am.Load<half2>(0+0), s_am.Load<half2>(0+4), s_am.Load<half2>(0+8), s_am.Load<half2>(0+12)), half4x2(s_am.Load<half2>(16+0), s_am.Load<half2>(16+4), s_am.Load<half2>(16+8), s_am.Load<half2>(16+12)), half4x2(s_am.Load<half2>(32+0), s_am.Load<half2>(32+4), s_am.Load<half2>(32+8), s_am.Load<half2>(32+12)), half4x2(s_am.Load<half2>(48+0), s_am.Load<half2>(48+4), s_am.Load<half2>(48+8), s_am.Load<half2>(48+12)));
half4x2 l_s_m_c = half4x2(s_am.Load<half2>(0+0), s_am.Load<half2>(0+4), s_am.Load<half2>(0+8), s_am.Load<half2>(0+12));
int _e11 = idx_2;
half4x2 l_s_m_v = half4x2(s_am.Load<half2>(_e11*16+0), s_am.Load<half2>(_e11*16+4), s_am.Load<half2>(_e11*16+8), s_am.Load<half2>(_e11*16+12));
half2 l_s_c_cc = s_am.Load<half2>(0+0);
int _e20 = idx_2;
half2 l_s_c_cv = s_am.Load<half2>(_e20*4+0);
int _e24 = idx_2;
half2 l_s_c_vc = s_am.Load<half2>(0+_e24*16);
int _e29 = idx_2;
int _e31 = idx_2;
half2 l_s_c_vv = s_am.Load<half2>(_e31*4+_e29*16);
half l_s_e_ccc = s_am.Load<half>(0+0+0);
int _e42 = idx_2;
half l_s_e_ccv = s_am.Load<half>(_e42*2+0+0);
int _e47 = idx_2;
half l_s_e_cvc = s_am.Load<half>(0+_e47*4+0);
int _e53 = idx_2;
int _e55 = idx_2;
half l_s_e_cvv = s_am.Load<half>(_e55*2+_e53*4+0);
int _e59 = idx_2;
half l_s_e_vcc = s_am.Load<half>(0+0+_e59*16);
int _e65 = idx_2;
int _e68 = idx_2;
half l_s_e_vcv = s_am.Load<half>(_e68*2+0+_e65*16);
int _e72 = idx_2;
int _e74 = idx_2;
half l_s_e_vvc = s_am.Load<half>(0+_e74*4+_e72*16);
int _e79 = idx_2;
int _e81 = idx_2;
int _e83 = idx_2;
half l_s_e_vvv = s_am.Load<half>(_e83*2+_e81*4+_e79*16);
half4x2 l_u_a[4] = ((half4x2[4])u_am);
half4x2 l_u_m_c = ((half4x2)u_am[0]);
int _e92 = idx_2;
half4x2 l_u_m_v = ((half4x2)u_am[_e92]);
half2 l_u_c_cc = u_am[0]._0;
int _e101 = idx_2;
half2 l_u_c_cv = __get_col_of_mat4x2_f16(u_am[0], _e101);
int _e105 = idx_2;
half2 l_u_c_vc = u_am[_e105]._0;
int _e110 = idx_2;
int _e112 = idx_2;
half2 l_u_c_vv = __get_col_of_mat4x2_f16(u_am[_e110], _e112);
half l_u_e_ccc = u_am[0]._0.x;
int _e123 = idx_2;
half l_u_e_ccv = u_am[0]._0[_e123];
int _e128 = idx_2;
half l_u_e_cvc = __get_col_of_mat4x2_f16(u_am[0], _e128).x;
int _e134 = idx_2;
int _e136 = idx_2;
half l_u_e_cvv = __get_col_of_mat4x2_f16(u_am[0], _e134)[_e136];
int _e140 = idx_2;
half l_u_e_vcc = u_am[_e140]._0.x;
int _e146 = idx_2;
int _e149 = idx_2;
half l_u_e_vcv = u_am[_e146]._0[_e149];
int _e153 = idx_2;
int _e155 = idx_2;
half l_u_e_vvc = __get_col_of_mat4x2_f16(u_am[_e153], _e155).x;
int _e160 = idx_2;
int _e162 = idx_2;
int _e164 = idx_2;
half l_u_e_vvv = __get_col_of_mat4x2_f16(u_am[_e160], _e162)[_e164];
{
half4x2 _value2[4] = l_u_a;
{
half4x2 _value3 = _value2[0];
s_am.Store(0+0, _value3[0]);
s_am.Store(0+4, _value3[1]);
s_am.Store(0+8, _value3[2]);
s_am.Store(0+12, _value3[3]);
}
{
half4x2 _value3 = _value2[1];
s_am.Store(16+0, _value3[0]);
s_am.Store(16+4, _value3[1]);
s_am.Store(16+8, _value3[2]);
s_am.Store(16+12, _value3[3]);
}
{
half4x2 _value3 = _value2[2];
s_am.Store(32+0, _value3[0]);
s_am.Store(32+4, _value3[1]);
s_am.Store(32+8, _value3[2]);
s_am.Store(32+12, _value3[3]);
}
{
half4x2 _value3 = _value2[3];
s_am.Store(48+0, _value3[0]);
s_am.Store(48+4, _value3[1]);
s_am.Store(48+8, _value3[2]);
s_am.Store(48+12, _value3[3]);
}
}
{
half4x2 _value2 = l_u_m_c;
s_am.Store(0+0, _value2[0]);
s_am.Store(0+4, _value2[1]);
s_am.Store(0+8, _value2[2]);
s_am.Store(0+12, _value2[3]);
}
int _e171 = idx_2;
{
half4x2 _value2 = l_u_m_v;
s_am.Store(_e171*16+0, _value2[0]);
s_am.Store(_e171*16+4, _value2[1]);
s_am.Store(_e171*16+8, _value2[2]);
s_am.Store(_e171*16+12, _value2[3]);
}
s_am.Store(0+0, l_u_c_cc);
int _e178 = idx_2;
s_am.Store(_e178*4+0, l_u_c_cv);
int _e181 = idx_2;
s_am.Store(0+_e181*16, l_u_c_vc);
int _e185 = idx_2;
int _e187 = idx_2;
s_am.Store(_e187*4+_e185*16, l_u_c_vv);
s_am.Store(0+0+0, l_u_e_ccc);
int _e196 = idx_2;
s_am.Store(_e196*2+0+0, l_u_e_ccv);
int _e200 = idx_2;
s_am.Store(0+_e200*4+0, l_u_e_cvc);
int _e205 = idx_2;
int _e207 = idx_2;
s_am.Store(_e207*2+_e205*4+0, l_u_e_cvv);
int _e210 = idx_2;
s_am.Store(0+0+_e210*16, l_u_e_vcc);
int _e215 = idx_2;
int _e218 = idx_2;
s_am.Store(_e218*2+0+_e215*16, l_u_e_vcv);
int _e221 = idx_2;
int _e223 = idx_2;
s_am.Store(0+_e223*4+_e221*16, l_u_e_vvc);
int _e227 = idx_2;
int _e229 = idx_2;
int _e231 = idx_2;
s_am.Store(_e231*2+_e229*4+_e227*16, l_u_e_vvv);
return;
}
typedef StructWithMat ret_Constructarray4_StructWithMat_[4];
ret_Constructarray4_StructWithMat_ Constructarray4_StructWithMat_(StructWithMat arg0, StructWithMat arg1, StructWithMat arg2, StructWithMat arg3) {
StructWithMat ret[4] = { arg0, arg1, arg2, arg3 };
return ret;
}
StructWithArrayOfStructOfMat ConstructStructWithArrayOfStructOfMat(StructWithMat arg0[4]) {
StructWithArrayOfStructOfMat ret = (StructWithArrayOfStructOfMat)0;
ret.a = arg0;
return ret;
}
void access_sasm()
{
int idx_3 = int(1);
int _e3 = idx_3;
idx_3 = asint(asuint(_e3) - asuint(int(1)));
StructWithArrayOfStructOfMat l_s_s_1 = ConstructStructWithArrayOfStructOfMat(Constructarray4_StructWithMat_(ConstructStructWithMat(half4x2(s_sasm.Load<half2>(0+0+0+0), s_sasm.Load<half2>(0+0+0+4), s_sasm.Load<half2>(0+0+0+8), s_sasm.Load<half2>(0+0+0+12))), ConstructStructWithMat(half4x2(s_sasm.Load<half2>(0+16+0+0), s_sasm.Load<half2>(0+16+0+4), s_sasm.Load<half2>(0+16+0+8), s_sasm.Load<half2>(0+16+0+12))), ConstructStructWithMat(half4x2(s_sasm.Load<half2>(0+32+0+0), s_sasm.Load<half2>(0+32+0+4), s_sasm.Load<half2>(0+32+0+8), s_sasm.Load<half2>(0+32+0+12))), ConstructStructWithMat(half4x2(s_sasm.Load<half2>(0+48+0+0), s_sasm.Load<half2>(0+48+0+4), s_sasm.Load<half2>(0+48+0+8), s_sasm.Load<half2>(0+48+0+12)))));
StructWithMat l_s_a_1[4] = Constructarray4_StructWithMat_(ConstructStructWithMat(half4x2(s_sasm.Load<half2>(0+0+0+0), s_sasm.Load<half2>(0+0+0+4), s_sasm.Load<half2>(0+0+0+8), s_sasm.Load<half2>(0+0+0+12))), ConstructStructWithMat(half4x2(s_sasm.Load<half2>(0+16+0+0), s_sasm.Load<half2>(0+16+0+4), s_sasm.Load<half2>(0+16+0+8), s_sasm.Load<half2>(0+16+0+12))), ConstructStructWithMat(half4x2(s_sasm.Load<half2>(0+32+0+0), s_sasm.Load<half2>(0+32+0+4), s_sasm.Load<half2>(0+32+0+8), s_sasm.Load<half2>(0+32+0+12))), ConstructStructWithMat(half4x2(s_sasm.Load<half2>(0+48+0+0), s_sasm.Load<half2>(0+48+0+4), s_sasm.Load<half2>(0+48+0+8), s_sasm.Load<half2>(0+48+0+12))));
half4x2 l_s_m_c_1 = half4x2(s_sasm.Load<half2>(0+0+0+0), s_sasm.Load<half2>(0+0+0+4), s_sasm.Load<half2>(0+0+0+8), s_sasm.Load<half2>(0+0+0+12));
int _e17 = idx_3;
half4x2 l_s_m_v_1 = half4x2(s_sasm.Load<half2>(0+_e17*16+0+0), s_sasm.Load<half2>(0+_e17*16+0+4), s_sasm.Load<half2>(0+_e17*16+0+8), s_sasm.Load<half2>(0+_e17*16+0+12));
half2 l_s_c_cc_1 = s_sasm.Load<half2>(0+0+0+0);
int _e31 = idx_3;
half2 l_s_c_cv_1 = s_sasm.Load<half2>(_e31*4+0+0+0);
int _e36 = idx_3;
half2 l_s_c_vc_1 = s_sasm.Load<half2>(0+0+_e36*16+0);
int _e43 = idx_3;
int _e46 = idx_3;
half2 l_s_c_vv_1 = s_sasm.Load<half2>(_e46*4+0+_e43*16+0);
half l_s_e_ccc_1 = s_sasm.Load<half>(0+0+0+0+0);
int _e61 = idx_3;
half l_s_e_ccv_1 = s_sasm.Load<half>(_e61*2+0+0+0+0);
int _e68 = idx_3;
half l_s_e_cvc_1 = s_sasm.Load<half>(0+_e68*4+0+0+0);
int _e76 = idx_3;
int _e78 = idx_3;
half l_s_e_cvv_1 = s_sasm.Load<half>(_e78*2+_e76*4+0+0+0);
int _e83 = idx_3;
half l_s_e_vcc_1 = s_sasm.Load<half>(0+0+0+_e83*16+0);
int _e91 = idx_3;
int _e95 = idx_3;
half l_s_e_vcv_1 = s_sasm.Load<half>(_e95*2+0+0+_e91*16+0);
int _e100 = idx_3;
int _e103 = idx_3;
half l_s_e_vvc_1 = s_sasm.Load<half>(0+_e103*4+0+_e100*16+0);
int _e109 = idx_3;
int _e112 = idx_3;
int _e114 = idx_3;
half l_s_e_vvv_1 = s_sasm.Load<half>(_e114*2+_e112*4+0+_e109*16+0);
StructWithArrayOfStructOfMat l_u_s_1 = u_sasm;
StructWithMat l_u_a_1[4] = u_sasm.a;
half4x2 l_u_m_c_1 = GetMatmOnStructWithMat(u_sasm.a[0]);
int _e129 = idx_3;
half4x2 l_u_m_v_1 = GetMatmOnStructWithMat(u_sasm.a[_e129]);
half2 l_u_c_cc_1 = GetMatmOnStructWithMat(u_sasm.a[0])[0];
int _e143 = idx_3;
half2 l_u_c_cv_1 = GetMatmOnStructWithMat(u_sasm.a[0])[_e143];
int _e148 = idx_3;
half2 l_u_c_vc_1 = GetMatmOnStructWithMat(u_sasm.a[_e148])[0];
int _e155 = idx_3;
int _e158 = idx_3;
half2 l_u_c_vv_1 = GetMatmOnStructWithMat(u_sasm.a[_e155])[_e158];
half l_u_e_ccc_1 = GetMatmOnStructWithMat(u_sasm.a[0])[0].x;
int _e173 = idx_3;
half l_u_e_ccv_1 = GetMatmOnStructWithMat(u_sasm.a[0])[0][_e173];
int _e180 = idx_3;
half l_u_e_cvc_1 = GetMatmOnStructWithMat(u_sasm.a[0])[_e180].x;
int _e188 = idx_3;
int _e190 = idx_3;
half l_u_e_cvv_1 = GetMatmOnStructWithMat(u_sasm.a[0])[_e188][_e190];
int _e195 = idx_3;
half l_u_e_vcc_1 = GetMatmOnStructWithMat(u_sasm.a[_e195])[0].x;
int _e203 = idx_3;
int _e207 = idx_3;
half l_u_e_vcv_1 = GetMatmOnStructWithMat(u_sasm.a[_e203])[0][_e207];
int _e212 = idx_3;
int _e215 = idx_3;
half l_u_e_vvc_1 = GetMatmOnStructWithMat(u_sasm.a[_e212])[_e215].x;
int _e221 = idx_3;
int _e224 = idx_3;
int _e226 = idx_3;
half l_u_e_vvv_1 = GetMatmOnStructWithMat(u_sasm.a[_e221])[_e224][_e226];
{
StructWithArrayOfStructOfMat _value2 = l_u_s_1;
{
StructWithMat _value3[4] = _value2.a;
{
StructWithMat _value4 = _value3[0];
{
s_sasm.Store(0+0+0+0, _value4.m_0);
s_sasm.Store(0+0+0+4, _value4.m_1);
s_sasm.Store(0+0+0+8, _value4.m_2);
s_sasm.Store(0+0+0+12, _value4.m_3);
}
}
{
StructWithMat _value4 = _value3[1];
{
s_sasm.Store(0+16+0+0, _value4.m_0);
s_sasm.Store(0+16+0+4, _value4.m_1);
s_sasm.Store(0+16+0+8, _value4.m_2);
s_sasm.Store(0+16+0+12, _value4.m_3);
}
}
{
StructWithMat _value4 = _value3[2];
{
s_sasm.Store(0+32+0+0, _value4.m_0);
s_sasm.Store(0+32+0+4, _value4.m_1);
s_sasm.Store(0+32+0+8, _value4.m_2);
s_sasm.Store(0+32+0+12, _value4.m_3);
}
}
{
StructWithMat _value4 = _value3[3];
{
s_sasm.Store(0+48+0+0, _value4.m_0);
s_sasm.Store(0+48+0+4, _value4.m_1);
s_sasm.Store(0+48+0+8, _value4.m_2);
s_sasm.Store(0+48+0+12, _value4.m_3);
}
}
}
}
{
StructWithMat _value2[4] = l_u_a_1;
{
StructWithMat _value3 = _value2[0];
{
s_sasm.Store(0+0+0+0, _value3.m_0);
s_sasm.Store(0+0+0+4, _value3.m_1);
s_sasm.Store(0+0+0+8, _value3.m_2);
s_sasm.Store(0+0+0+12, _value3.m_3);
}
}
{
StructWithMat _value3 = _value2[1];
{
s_sasm.Store(0+16+0+0, _value3.m_0);
s_sasm.Store(0+16+0+4, _value3.m_1);
s_sasm.Store(0+16+0+8, _value3.m_2);
s_sasm.Store(0+16+0+12, _value3.m_3);
}
}
{
StructWithMat _value3 = _value2[2];
{
s_sasm.Store(0+32+0+0, _value3.m_0);
s_sasm.Store(0+32+0+4, _value3.m_1);
s_sasm.Store(0+32+0+8, _value3.m_2);
s_sasm.Store(0+32+0+12, _value3.m_3);
}
}
{
StructWithMat _value3 = _value2[3];
{
s_sasm.Store(0+48+0+0, _value3.m_0);
s_sasm.Store(0+48+0+4, _value3.m_1);
s_sasm.Store(0+48+0+8, _value3.m_2);
s_sasm.Store(0+48+0+12, _value3.m_3);
}
}
}
{
half4x2 _value2 = l_u_m_c_1;
s_sasm.Store(0+0+0+0, _value2[0]);
s_sasm.Store(0+0+0+4, _value2[1]);
s_sasm.Store(0+0+0+8, _value2[2]);
s_sasm.Store(0+0+0+12, _value2[3]);
}
int _e238 = idx_3;
{
half4x2 _value2 = l_u_m_v_1;
s_sasm.Store(0+_e238*16+0+0, _value2[0]);
s_sasm.Store(0+_e238*16+0+4, _value2[1]);
s_sasm.Store(0+_e238*16+0+8, _value2[2]);
s_sasm.Store(0+_e238*16+0+12, _value2[3]);
}
s_sasm.Store(0+0+0+0, l_u_c_cc_1);
int _e250 = idx_3;
s_sasm.Store(_e250*4+0+0+0, l_u_c_cv_1);
int _e254 = idx_3;
s_sasm.Store(0+0+_e254*16+0, l_u_c_vc_1);
int _e260 = idx_3;
int _e263 = idx_3;
s_sasm.Store(_e263*4+0+_e260*16+0, l_u_c_vv_1);
s_sasm.Store(0+0+0+0+0, l_u_e_ccc_1);
int _e276 = idx_3;
s_sasm.Store(_e276*2+0+0+0+0, l_u_e_ccv_1);
int _e282 = idx_3;
s_sasm.Store(0+_e282*4+0+0+0, l_u_e_cvc_1);
int _e289 = idx_3;
int _e291 = idx_3;
s_sasm.Store(_e291*2+_e289*4+0+0+0, l_u_e_cvv_1);
int _e295 = idx_3;
s_sasm.Store(0+0+0+_e295*16+0, l_u_e_vcc_1);
int _e302 = idx_3;
int _e306 = idx_3;
s_sasm.Store(_e306*2+0+0+_e302*16+0, l_u_e_vcv_1);
int _e310 = idx_3;
int _e313 = idx_3;
s_sasm.Store(0+_e313*4+0+_e310*16+0, l_u_e_vvc_1);
int _e318 = idx_3;
int _e321 = idx_3;
int _e323 = idx_3;
s_sasm.Store(_e323*2+_e321*4+0+_e318*16+0, l_u_e_vvv_1);
return;
}
[numthreads(1, 1, 1)]
void main()
{
access_m();
access_sm();
access_am();
access_sasm();
return;
}
+16
View File
@@ -0,0 +1,16 @@
(
vertex:[
],
fragment:[
],
compute:[
(
entry_point:"main",
target_profile:"cs_6_2",
),
],
task:[
],
mesh:[
],
)
File diff suppressed because it is too large. Load diff