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

Depth testing support #13

Merged
merged 2 commits into from
Aug 7, 2019
Merged

Depth testing support #13

merged 2 commits into from
Aug 7, 2019

Conversation

hecrj
Copy link
Owner

@hecrj hecrj commented Aug 4, 2019

Fixes #11.

@hecrj hecrj added the enhancement New feature or request label Aug 4, 2019
@hecrj hecrj self-assigned this Aug 4, 2019
@hecrj hecrj mentioned this pull request Aug 4, 2019
stencil_back: wgpu::StencilStateFaceDescriptor::IGNORE,
stencil_read_mask: 0,
stencil_write_mask: 0,
})
Copy link
Owner Author

@hecrj hecrj Aug 4, 2019

Choose a reason for hiding this comment

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

Should we allow this level of configuration or could we simply ask for the format and hardcode this internally?

Copy link
Contributor

Choose a reason for hiding this comment

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

I actually like taking the entire DepthStencilStateDescriptor, because I'm actually using a difference comparison function. I can imagine that users might want to change other aspects of the depth stencil state as well.

stencil_store_op: wgpu::StoreOp::Store,
clear_depth: -1.0,
clear_stencil: 0,
},
Copy link
Owner Author

Choose a reason for hiding this comment

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

Same question here. Could we simply ask for a TextureView (i.e. the depth_view) here?

Copy link
Contributor

Choose a reason for hiding this comment

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

For me, I would also find it useful to pass in the whole RenderPassDepthStencilAttachmentDescriptor. In my case, I'm using a different value for clear_depth.

@hecrj hecrj marked this pull request as ready for review August 4, 2019 01:46
Copy link
Contributor

@paulkernfeld paulkernfeld left a comment

Choose a reason for hiding this comment

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

This is awesome, thanks! I checked that the new example does the expected thing on my machine.

stencil_back: wgpu::StencilStateFaceDescriptor::IGNORE,
stencil_read_mask: 0,
stencil_write_mask: 0,
})
Copy link
Contributor

Choose a reason for hiding this comment

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

I actually like taking the entire DepthStencilStateDescriptor, because I'm actually using a difference comparison function. I can imagine that users might want to change other aspects of the depth stencil state as well.

stencil_store_op: wgpu::StoreOp::Store,
clear_depth: -1.0,
clear_stencil: 0,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

For me, I would also find it useful to pass in the whole RenderPassDepthStencilAttachmentDescriptor. In my case, I'm using a different value for clear_depth.

@paulkernfeld
Copy link
Contributor

I was able to successfully use this in my own project 👍

@hecrj
Copy link
Owner Author

hecrj commented Aug 7, 2019

Glad to know! I will keep the API as it is then!

We may be able to improve it in the future once/if we see a pattern.

@hecrj hecrj merged commit 41fad8d into master Aug 7, 2019
@hecrj hecrj added this to the 0.4.0 milestone Aug 9, 2019
@hecrj hecrj deleted the feature/depth-testing branch August 9, 2019 13:53
@paulkernfeld
Copy link
Contributor

Another note on customizing my own rendering, in case it's helpful: I needed to change the "load op" values from wgpu::LoadOp::Clear to wgpu::LoadOp::Load in order for my glyphs to share the same depth buffer as the other shapes that I'm drawing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for depth testing?
2 participants