-
Notifications
You must be signed in to change notification settings - Fork 248
fix: capturing deep composites #874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
molikto
wants to merge
7
commits into
EmbarkStudios:main
Choose a base branch
from
molikto:destruct-composite-more
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cc39970
fix: capturing deep composites
molikto fb16de5
Update crates/rustc_codegen_spirv/src/linker/destructure_composites.rs
molikto 787d6c9
Update crates/rustc_codegen_spirv/src/linker/destructure_composites.rs
molikto b557998
Update crates/rustc_codegen_spirv/src/linker/destructure_composites.rs
molikto 727ee58
Update tests/ui/lang/control_flow/closure_capture_invalid_01.rs
molikto b964774
format fixes
molikto 848aea4
fix: compile
molikto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// build-pass | ||
molikto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// compile-flags: -Ctarget-feature=+RayTracingKHR,+RayQueryKHR,+ext:SPV_KHR_ray_tracing,+ext:SPV_KHR_ray_query | ||
|
||
#[cfg(not(target_arch = "spirv"))] | ||
use spirv_std::macros::spirv; | ||
use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; | ||
use spirv_std::{glam::Vec3, ray_query}; | ||
|
||
#[inline] | ||
pub fn some_fun(mut c: impl FnMut() -> bool) { | ||
c(); | ||
} | ||
#[spirv(intersection)] | ||
pub fn voxels_gbuffer_is( | ||
#[spirv(descriptor_set = 1, binding = 3)] acceleration_structure: &AccelerationStructure, | ||
) { | ||
ray_query!(let mut handle); | ||
some_fun(|| { | ||
unsafe { | ||
handle.initialize( | ||
acceleration_structure, | ||
RayFlags::TERMINATE_ON_FIRST_HIT, | ||
0xFF, | ||
Vec3::new(0.0, 0.0, 0.0), | ||
0.0, | ||
Vec3::new(0.0, 0.0, 0.0), | ||
10000.0, | ||
); | ||
true | ||
} | ||
}); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: error:0:0 - In Logical addressing, variables may not allocate a pointer type | ||
%29 = OpVariable %_ptr_Function__ptr_UniformConstant_13 Function | ||
| | ||
= note: spirv-val failed | ||
= note: module `$TEST_BUILD_DIR/lang/control_flow/closure_capture_invalid_01.stage-id.spv.dir/module` | ||
|
||
error: aborting due to previous error | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// build-pass | ||
molikto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// compile-flags: -Ctarget-feature=+RayTracingKHR,+RayQueryKHR,+ext:SPV_KHR_ray_tracing,+ext:SPV_KHR_ray_query | ||
|
||
#[cfg(not(target_arch = "spirv"))] | ||
use spirv_std::macros::spirv; | ||
use spirv_std::{glam::Vec3, ray_query}; | ||
use spirv_std::ray_tracing::{AccelerationStructure, CommittedIntersection, RayFlags, RayQuery}; | ||
use spirv_std::arch::IndexUnchecked; | ||
|
||
pub fn some_fun(mut c: impl FnMut(u32) -> bool) { | ||
let mut i = 0; | ||
while i < 10 { | ||
if c(i) { | ||
return; | ||
} | ||
i += 1; | ||
} | ||
} | ||
#[spirv(intersection)] | ||
pub fn voxels_gbuffer_is( | ||
#[spirv(storage_buffer, descriptor_set = 1, binding = 1)] vertices: &[u32], | ||
#[spirv(descriptor_set = 1, binding = 3)] acceleration_structure: &AccelerationStructure, | ||
) { | ||
some_fun(|i| { | ||
unsafe { | ||
ray_query!(let mut handle); | ||
handle.initialize( | ||
acceleration_structure, | ||
RayFlags::TERMINATE_ON_FIRST_HIT, | ||
0xFF, | ||
Vec3::new(0.0, 0.0, 0.0), | ||
0.0, | ||
Vec3::new(0.0, 0.0, 0.0), | ||
10000.0, | ||
); | ||
let ind = unsafe { | ||
vertices.index_unchecked(0) | ||
}; | ||
ind + i == 2 | ||
} | ||
}); | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: error:0:0 - In Logical addressing, variables may not allocate a pointer type | ||
%45 = OpVariable %_ptr_Function__ptr_UniformConstant_29 Function | ||
| | ||
= note: spirv-val failed | ||
= note: module `$TEST_BUILD_DIR/lang/control_flow/closure_capture_invalid_02.stage-id.spv.dir/module` | ||
|
||
error: aborting due to previous error | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.