googlestadia / PorQue4K

Los arcoiris son mejores en 4K. #BlackLivesMatter
Apache License 2.0
20 stars 7 forks source link

Validation fix: Match counts for color blend attachment states to color attachments #37

Closed robbiesri closed 4 years ago

robbiesri commented 4 years ago

Previously, the primary draw pipelines had two color attachments, but only one blend state. The error started to appear once I started to export velocity from my draws, but the default blend state list only has one entry.

robbiesri commented 4 years ago

I realize it's a copy-pasta. Rule of three: I got one more copy-paste before I have to make a function!

robbiesri commented 4 years ago

Haha, sorry I was confusing. The '3' was in reference to Rule of Three: https://en.wikipedia.org/wiki/Rule_of_three_(computer_programming)

In this case, I had to fix this code in two places. If I had to fix it in three places, I should re-factor the code to use a function.

ndeakin commented 4 years ago

That's not what I meant actually, I think I understood that part haha.

What I was getting at is that in the first place you should have had 2 blend states it sounds like, but then you added velocity stuff, which sounded like it also needed one? So I was wondering if the velocity also required a blend state, and therefore the total was 2 blend states for color and 1 for velocity - since I see there are 2 pipelines and I'm assuming 1 is for velocity (but I was feeling a bit lazy and gave up on confirming this).

robbiesri commented 4 years ago

Ahhh, I see what you're getting at.

So by default, vkex sets up one blend state because it's figuring that the most boring/common case for a renderpass is one color attachment, which requires one blend state. So everything worked fine when I was just exporting the scene color from my forward draw pass.

When I added velocity, I forgot to add the blend state. Vulkan requires that I have one blend state for every attachment, even if those blend states say 'don't blend'. Validation caught this problem (two color attachments, 1 blend state).

So now, I just create one do-nothing blend state for every color attachment, and call it a day.

ndeakin commented 4 years ago

got it, thanks!