Skip to content
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

[mtl] dynamic depth bias, callback coalescence, and more stats #2224

Merged
merged 3 commits into from
Jul 16, 2018

Conversation

kvark
Copy link
Member

@kvark kvark commented Jul 12, 2018

Fixes #2170

Expands our Metal stats to report the number of active and temporary command buffers. Coalesces the completion handlers, and finally fixes the depth bias issue we've been seeing (HAL breaking change).

PR checklist:

  • make succeeds (on *nix)
  • make reftests succeeds
  • tested examples with the following backends:

@kvark kvark requested a review from grovesNL July 12, 2018 02:56
Copy link
Contributor

@grovesNL grovesNL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Started reviewing but didn't have time to get through all of it (I'll continue later)

@@ -150,6 +150,11 @@ pub fn map_rasterizer(rasterizer: &pso::Rasterizer) -> D3D12_RASTERIZER_DESC {
use hal::pso::PolygonMode::*;
use hal::pso::FrontFace::*;

let bias = match rasterizer.depth_bias { //TODO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the TODO for?

@@ -20,11 +20,11 @@ pub fn bind_polygon_mode(gl: &gl::Gl, mode: pso::PolygonMode, bias: Option<pso::
unsafe { gl.PolygonMode(gl::FRONT_AND_BACK, gl_draw) };

match bias {
Some(bias) => unsafe {
Some(pso::State::Static(bias)) => unsafe {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it possible for a dynamic depth bias to have been set at this point?

Otherwise, where would the dynamic depth bias be set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the problem is that we haven't had a dynamic depth bias exposed at all, and I want to limit the scope of this PR to providing this in API and implementing in Metal and Vulkan only. Other backends are not regressed, they will just need to catch up.

@kvark
Copy link
Member Author

kvark commented Jul 13, 2018

@grovesNL I improved those TODO comments now

frame: usize,
}


pub struct CommandQueue {
shared: Arc<Shared>,
frame_wait: Option<FrameWaitReport>,
retained_buffers: Vec<metal::Buffer>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do the retained resources work with Send/Sync here? i.e. how do we know multiple threads aren't adding or removing retained resources at the same time?

@@ -134,6 +134,7 @@ impl Swapchain {
}
hal::FrameSync::Fence(fence) => {
*fence.mutex.lock().unwrap() = true;
fence.condvar.notify_all();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this change a bit more? I'm trying to understand the synchronization changes. Was this a bug previously, or is it needed because of the changes in submit_raw?

@kvark
Copy link
Member Author

kvark commented Jul 14, 2018 via email

@kvark
Copy link
Member Author

kvark commented Jul 16, 2018

I believe the concerns are addressed, and we can revisit the code if new ones rise up.
Let's not hold the PR for too long, it has too many goodies for us.
bors r=grovesNL

bors bot added a commit that referenced this pull request Jul 16, 2018
2224: [mtl] dynamic depth bias, callback coalescence, and more stats r=grovesNL a=kvark

Fixes #2170

Expands our Metal stats to report the number of active and temporary command buffers. Coalesces the completion handlers, and finally fixes the depth bias issue we've been seeing (HAL breaking change).

PR checklist:
- [x] `make` succeeds (on *nix)
- [x] `make reftests` succeeds
- [x] tested examples with the following backends:


Co-authored-by: Dzmitry Malyshau <[email protected]>
@bors
Copy link
Contributor

bors bot commented Jul 16, 2018

@bors bors bot merged commit b6fc043 into gfx-rs:master Jul 16, 2018
@kvark kvark deleted the mtl-handler branch July 16, 2018 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Z-fighting issues in Dota
2 participants