stride3d / stride

Stride (formerly Xenko), a free and open-source cross-platform C# game engine.
https://stride3d.net
MIT License
6.62k stars 957 forks source link

[Rendering] Mult blending causes crash #584

Open Eideren opened 4 years ago

Eideren commented 4 years ago

Release Type: GitHub

Version: Latest as of the time of writing

Platform(s): Windows DirectX 11

Describe the bug Setting a pass's BlendState to an illegal state based on the transparency toggle of that pass crashes the application.

To Reproduce Steps to reproduce the behavior:

  1. Get a reference to material.
  2. Set transparency through TargetMaterial.Passes[ 0 ].HasTransparency = true;
  3. Run this TargetMaterial.Passes[ 0 ].BlendState = new BlendStateDescription( Blend.DestinationColor, Blend.Zero );

Expected behavior Blends multiplicatively or throws a clearer exception.

Log and callstacks Stack

Additional context None.

xen2 commented 4 years ago

SharpDX.SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect. Looks like it's invalid to use that combination in D3D?

Eideren commented 4 years ago

The steps I provided weren't complete. Now with those bits of information it's easy to see why it threw. Here's a PR fixing it over on the monogame repo, not sure if that's the best way to tackle it though.