Skip to content

Commit

Permalink
fixup! Update tests for pointer_composite_access
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichDonGubler committed Jan 23, 2025
1 parent 5c6a8a4 commit 01ee86e
Show file tree
Hide file tree
Showing 12 changed files with 1,494 additions and 434 deletions.
30 changes: 30 additions & 0 deletions naga/tests/in/access.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,33 @@ fn member_ptr() -> i32 {
let p = &s;
return p.m;
}

struct Inner { delicious: i32 }

struct Outer { om_nom_nom: Inner, thing: u32 }

fn let_members_of_members() -> i32 {
let thing = Outer();

let inner = thing.om_nom_nom;
let delishus = inner.delicious;

if (thing.thing != u32(delishus)) {
// LOL
}

return thing.om_nom_nom.delicious;
}

fn var_members_of_members() -> i32 {
var thing = Outer();

var inner = thing.om_nom_nom;
var delishus = inner.delicious;

if (thing.thing != u32(delishus)) {
// LOL
}

return thing.om_nom_nom.delicious;
}
298 changes: 298 additions & 0 deletions naga/tests/out/analysis/access.info.ron
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
("DATA | SIZED | COPY | CREATION_RESOLVED | ARGUMENT | CONSTRUCTIBLE"),
("DATA | SIZED | COPY | CREATION_RESOLVED | ARGUMENT | CONSTRUCTIBLE"),
("DATA | SIZED | COPY | IO_SHAREABLE | HOST_SHAREABLE | CREATION_RESOLVED | ARGUMENT | CONSTRUCTIBLE"),
("DATA | SIZED | COPY | IO_SHAREABLE | HOST_SHAREABLE | CREATION_RESOLVED | ARGUMENT | CONSTRUCTIBLE"),
("DATA | SIZED | COPY | IO_SHAREABLE | HOST_SHAREABLE | CREATION_RESOLVED | ARGUMENT | CONSTRUCTIBLE"),
],
functions: [
(
Expand Down Expand Up @@ -3111,6 +3113,302 @@
dual_source_blending: false,
diagnostic_filter_leaf: None,
),
(
flags: ("EXPRESSIONS | BLOCKS | CONTROL_FLOW_UNIFORMITY | STRUCT_LAYOUTS | CONSTANTS | BINDINGS"),
available_stages: ("VERTEX | FRAGMENT | COMPUTE"),
uniformity: (
non_uniform_result: None,
requirements: (""),
),
may_kill: false,
sampling_set: [],
global_uses: [
(""),
(""),
(""),
(""),
(""),
],
expressions: [
(
uniformity: (
non_uniform_result: None,
requirements: (""),
),
ref_count: 3,
assignable_global: None,
ty: Handle(37),
),
(
uniformity: (
non_uniform_result: None,
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Handle(36),
),
(
uniformity: (
non_uniform_result: None,
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Handle(2),
),
(
uniformity: (
non_uniform_result: None,
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Handle(0),
),
(
uniformity: (
non_uniform_result: None,
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Value(Scalar((
kind: Uint,
width: 4,
))),
),
(
uniformity: (
non_uniform_result: None,
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Value(Scalar((
kind: Bool,
width: 1,
))),
),
(
uniformity: (
non_uniform_result: None,
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Handle(36),
),
(
uniformity: (
non_uniform_result: None,
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Handle(2),
),
],
sampling: [],
dual_source_blending: false,
diagnostic_filter_leaf: None,
),
(
flags: ("EXPRESSIONS | BLOCKS | CONTROL_FLOW_UNIFORMITY | STRUCT_LAYOUTS | CONSTANTS | BINDINGS"),
available_stages: ("VERTEX | FRAGMENT | COMPUTE"),
uniformity: (
non_uniform_result: Some(1),
requirements: (""),
),
may_kill: false,
sampling_set: [],
global_uses: [
(""),
(""),
(""),
(""),
(""),
],
expressions: [
(
uniformity: (
non_uniform_result: None,
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Handle(37),
),
(
uniformity: (
non_uniform_result: Some(1),
requirements: (""),
),
ref_count: 3,
assignable_global: None,
ty: Value(Pointer(
base: 37,
space: Function,
)),
),
(
uniformity: (
non_uniform_result: Some(1),
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Value(Pointer(
base: 36,
space: Function,
)),
),
(
uniformity: (
non_uniform_result: Some(1),
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Handle(36),
),
(
uniformity: (
non_uniform_result: Some(4),
requirements: (""),
),
ref_count: 2,
assignable_global: None,
ty: Value(Pointer(
base: 36,
space: Function,
)),
),
(
uniformity: (
non_uniform_result: Some(4),
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Value(Pointer(
base: 2,
space: Function,
)),
),
(
uniformity: (
non_uniform_result: Some(4),
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Handle(2),
),
(
uniformity: (
non_uniform_result: Some(7),
requirements: (""),
),
ref_count: 2,
assignable_global: None,
ty: Value(Pointer(
base: 2,
space: Function,
)),
),
(
uniformity: (
non_uniform_result: Some(1),
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Value(Pointer(
base: 0,
space: Function,
)),
),
(
uniformity: (
non_uniform_result: Some(1),
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Handle(0),
),
(
uniformity: (
non_uniform_result: Some(7),
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Handle(2),
),
(
uniformity: (
non_uniform_result: Some(7),
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Value(Scalar((
kind: Uint,
width: 4,
))),
),
(
uniformity: (
non_uniform_result: Some(1),
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Value(Scalar((
kind: Bool,
width: 1,
))),
),
(
uniformity: (
non_uniform_result: Some(1),
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Value(Pointer(
base: 36,
space: Function,
)),
),
(
uniformity: (
non_uniform_result: Some(1),
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Value(Pointer(
base: 2,
space: Function,
)),
),
(
uniformity: (
non_uniform_result: Some(1),
requirements: (""),
),
ref_count: 1,
assignable_global: None,
ty: Handle(2),
),
],
sampling: [],
dual_source_blending: false,
diagnostic_filter_leaf: None,
),
],
entry_points: [
(
Expand Down
31 changes: 31 additions & 0 deletions naga/tests/out/glsl/access.assign_through_ptr.Compute.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ struct AssignToMember {
struct S {
int m;
};
struct Inner {
int delicious;
};
struct Outer {
Inner om_nom_nom;
uint thing;
};

float read_from_private(inout float foo_1) {
float _e1 = foo_1;
Expand Down Expand Up @@ -78,6 +85,30 @@ int member_ptr() {
return _e4;
}

int let_members_of_members() {
Inner inner_1 = Outer(Inner(0), 0u).om_nom_nom;
int delishus_1 = inner_1.delicious;
if ((Outer(Inner(0), 0u).thing != uint(delishus_1))) {
}
return Outer(Inner(0), 0u).om_nom_nom.delicious;
}

int var_members_of_members() {
Outer thing = Outer(Inner(0), 0u);
Inner inner = Inner(0);
int delishus = 0;
Inner _e3 = thing.om_nom_nom;
inner = _e3;
int _e6 = inner.delicious;
delishus = _e6;
uint _e9 = thing.thing;
int _e10 = delishus;
if ((_e9 != uint(_e10))) {
}
int _e15 = thing.om_nom_nom.delicious;
return _e15;
}

void main() {
uint val = 33u;
vec4 arr[2] = vec4[2](vec4(6.0), vec4(7.0));
Expand Down
Loading

0 comments on commit 01ee86e

Please sign in to comment.