Skip to content
This repository was archived by the owner on Apr 18, 2022. It is now read-only.

Comments

Add BlendTargets to PSO#411

Merged
bors[bot] merged 3 commits intoamethyst:developfrom
Xaeroxe:blend
Oct 14, 2017
Merged

Add BlendTargets to PSO#411
bors[bot] merged 3 commits intoamethyst:developfrom
Xaeroxe:blend

Conversation

@Xaeroxe
Copy link
Member

@Xaeroxe Xaeroxe commented Oct 13, 2017

This PR has the intention of adding blending targets to the pipeline. While this is a good first step towards implementing transparency in our renderer more work is required. This PR is being opened early for initial feedback.

@zakarumych
Copy link
Member

Add blender targets to the Effect and it's ready to merge. 👍


for blend in self.out_blends.iter() {
let mut meta_blend = <BlendTarget as DataLink<'d>>::new();
for info in info.outputs.iter() {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: no need for iter, use reference instead.

if let Some(res) = meta_blend.link_output(info, blend) {
let d = res.map_err(|e| InitError::PixelExport(info.name.as_str(), Some(e)))?;
desc.color_targets[info.slot as usize] = Some(d);
break;
Copy link
Member

Choose a reason for hiding this comment

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

You could just use find instead of a for loop.

Copy link
Member Author

Choose a reason for hiding this comment

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

This ends up being less efficient, as you then have to call link_output twice.

meta.out_colors.push(meta_color);
}

for blend in self.out_blends.iter() {
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

@Xaeroxe Xaeroxe requested a review from zakarumych October 13, 2017 17:41
@Xaeroxe
Copy link
Member Author

Xaeroxe commented Oct 13, 2017

r? @omni-viral

I added the blend targets to the effects and addressed @torkleyy 's nits.

@Rhuagh
Copy link
Member

Rhuagh commented Oct 13, 2017

Is this still WIP?

@Xaeroxe
Copy link
Member Author

Xaeroxe commented Oct 13, 2017

So, I have limited understanding of gfx so I'm not entirely certain if what I've provided is adequate to make passes with blending, but I think it is. The end goal of the PR is to make a UI pass possible.

@Xaeroxe Xaeroxe changed the title [WIP] Add BlendTargets to PSO Add BlendTargets to PSO Oct 13, 2017
.expect("Failed to update buffer (TODO: replace expect)");
}
None => {
eprintln!("WARNING: Buffer update for effect failed! Buffer not found: {:?}",
Copy link
Member

Choose a reason for hiding this comment

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

two whitespaces ("failed! Buffer")?

enc.update_constant_buffer::<T>(unsafe { mem::transmute(raw) }, &data)
}
None => {
eprintln!("WARNING: Buffer update for effect failed! Buffer not found: {:?}",
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

@torkleyy
Copy link
Member

Btw, the mut has already been removed by my PR, try rebasing onto develop.

@torkleyy
Copy link
Member

Hmm, seems something went wrong :(

@Xaeroxe
Copy link
Member Author

Xaeroxe commented Oct 13, 2017

@torkleyy Sometimes I rebase onto the wrong thing and stuff looks funny. I think I fixed it now.

data.out_colors
.extend(self.out.color_bufs().iter().map(|cb| cb.as_output.clone()));
data.out_blends
.extend(self.out.color_bufs().iter().map(|cb| cb.as_output.clone()));
Copy link
Member

Choose a reason for hiding this comment

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

Can't we use .cloned() here?

@Xaeroxe
Copy link
Member Author

Xaeroxe commented Oct 14, 2017

bors r+

bors bot added a commit that referenced this pull request Oct 14, 2017
411: Add BlendTargets to PSO r=Xaeroxe a=Xaeroxe

This PR has the intention of adding blending targets to the pipeline.  While this is a good first step towards implementing transparency in our renderer more work is required.  This PR is being opened early for initial feedback.
@bors
Copy link
Contributor

bors bot commented Oct 14, 2017

@bors bors bot merged commit f937104 into amethyst:develop Oct 14, 2017
@Xaeroxe Xaeroxe deleted the blend branch October 18, 2017 00:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

team: rendering type: feature A request for a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants