Projects with graphics level 9 1 and level 9 graphics compositor crash at startup
Release Type: Official Release
Version: 4.2.0.2122
Platform(s): Windows
Describe the bug Projects created with Graphics level API 9_1 with DirectX crash at startup with a E_INVALIDARG SharpDX exception when creating a texture.
To Reproduce Steps to reproduce the behavior:
- Create a new Stride project.
- Select the graphics API level to 9_1.
- Compile and run project.
- Crash at startup.
Expected behavior Not getting crashes.
Log and callstacks Copied from the console showing this error:
[Game]: Error: Unexpected exception. SharpDX.SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.
at SharpDX.Result.CheckError() in C:\projects\sharpdx\Source\SharpDX\Result.cs:line 195
at SharpDX.Direct3D11.Device.CreateTexture2D(Texture2DDescription& descRef, DataBox[] initialDataRef, Texture2D texture2DOut) in C:\projects\sharpdx\Source\SharpDX.Direct3D11\Generated\REFERENCE\Interfaces.cs:line 1292
at SharpDX.Direct3D11.Texture2D..ctor(Device device, Texture2DDescription description, DataBox[] data) in C:\projects\sharpdx\Source\SharpDX.Direct3D11\Texture2D.cs:line 80
at Stride.Graphics.Texture.InitializeFromImpl(DataBox[] dataBoxes)
at Stride.Graphics.Texture.InitializeFrom(Texture parentTexture, TextureDescription description, TextureViewDescription viewDescription, DataBox[] textureDatas)
at Stride.Graphics.Texture.InitializeFrom(TextureDescription description, TextureViewDescription viewDescription, DataBox[] textureDatas)
at Stride.Graphics.Texture.New(GraphicsDevice graphicsDevice, TextureDescription description, TextureViewDescription viewDescription, DataBox[] boxes)
at Stride.Graphics.Texture.New(GraphicsDevice graphicsDevice, TextureDescription description, DataBox[] boxes)
at Stride.Graphics.GraphicsResourceAllocator.CreateTexture(TextureDescription description, PixelFormat viewFormat)
at Stride.Graphics.GraphicsResourceAllocator.GetTemporaryResource[TResource,TKey](Dictionary`2 cache, TKey description, Func`3 creator, Func`2 getDefinition, PixelFormat viewFormat)
at Stride.Graphics.GraphicsResourceAllocator.GetTemporaryTexture(TextureDescription description)
at Stride.Graphics.GraphicsResourceAllocatorExtensions.GetTemporaryTexture2D(GraphicsResourceAllocator allocator, TextureDescription description)
at Stride.Rendering.Compositing.ForwardRenderer.PrepareRenderTargets(RenderDrawContext drawContext, Texture outputRenderTarget, Texture outputDepthStencil) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\ForwardRenderer.cs:line 880
at Stride.Rendering.Compositing.ForwardRenderer.PrepareRenderTargets(RenderDrawContext drawContext, Size2 renderTargetsSize) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\ForwardRenderer.cs:line 928
at Stride.Rendering.Compositing.ForwardRenderer.DrawCore(RenderContext context, RenderDrawContext drawContext) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\ForwardRenderer.cs:line 740
at Stride.Rendering.Compositing.SceneRendererBase.Draw(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\Compositing\SceneRendererBase.cs:line 39
at Stride.Rendering.Compositing.SceneRendererCollection.DrawCore(RenderContext context, RenderDrawContext drawContext) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\Compositing\SceneRendererCollection.cs:line 28
at Stride.Rendering.Compositing.SceneRendererBase.Draw(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\Compositing\SceneRendererBase.cs:line 39
at Stride.Rendering.Compositing.SceneCameraRenderer.DrawInner(RenderDrawContext renderContext) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\SceneCameraRenderer.cs:line 109
at Stride.Rendering.Compositing.SceneCameraRenderer.DrawCore(RenderContext context, RenderDrawContext drawContext) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\SceneCameraRenderer.cs:line 72
at Stride.Rendering.Compositing.SceneRendererBase.Draw(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\Compositing\SceneRendererBase.cs:line 39
at Stride.Rendering.Compositing.GraphicsCompositor.DrawCore(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\GraphicsCompositor.cs:line 209
at Stride.Rendering.RendererBase.Draw(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\RendererBase.cs:line 51
at Stride.Engine.SceneSystem.Draw(GameTime gameTime) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Engine\SceneSystem.cs:line 234
at Stride.Games.GameSystemCollection.Draw(GameTime gameTime)
at Stride.Games.GameBase.Draw(GameTime gameTime)
at Stride.Games.GameBase.RawTick(TimeSpan elapsedTimePerUpdate, Int32 updateCount, Single drawInterpolationFactor, Boolean drawFrame)
at Stride.Games.GameBase.RawTickProducer()
SharpDX.SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.
at SharpDX.Result.CheckError() in C:\projects\sharpdx\Source\SharpDX\Result.cs:line 195
at SharpDX.Direct3D11.Device.CreateTexture2D(Texture2DDescription& descRef, DataBox[] initialDataRef, Texture2D texture2DOut) in C:\projects\sharpdx\Source\SharpDX.Direct3D11\Generated\REFERENCE\Interfaces.cs:line 1292
at SharpDX.Direct3D11.Texture2D..ctor(Device device, Texture2DDescription description, DataBox[] data) in C:\projects\sharpdx\Source\SharpDX.Direct3D11\Texture2D.cs:line 80
at Stride.Graphics.Texture.InitializeFromImpl(DataBox[] dataBoxes)
at Stride.Graphics.Texture.InitializeFrom(Texture parentTexture, TextureDescription description, TextureViewDescription viewDescription, DataBox[] textureDatas)
at Stride.Graphics.Texture.InitializeFrom(TextureDescription description, TextureViewDescription viewDescription, DataBox[] textureDatas)
at Stride.Graphics.Texture.New(GraphicsDevice graphicsDevice, TextureDescription description, TextureViewDescription viewDescription, DataBox[] boxes)
at Stride.Graphics.Texture.New(GraphicsDevice graphicsDevice, TextureDescription description, DataBox[] boxes)
at Stride.Graphics.GraphicsResourceAllocator.CreateTexture(TextureDescription description, PixelFormat viewFormat)
at Stride.Graphics.GraphicsResourceAllocator.GetTemporaryResource[TResource,TKey](Dictionary`2 cache, TKey description, Func`3 creator, Func`2 getDefinition, PixelFormat viewFormat)
at Stride.Graphics.GraphicsResourceAllocator.GetTemporaryTexture(TextureDescription description)
at Stride.Graphics.GraphicsResourceAllocatorExtensions.GetTemporaryTexture2D(GraphicsResourceAllocator allocator, TextureDescription description)
at Stride.Rendering.Compositing.ForwardRenderer.PrepareRenderTargets(RenderDrawContext drawContext, Texture outputRenderTarget, Texture outputDepthStencil) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\ForwardRenderer.cs:line 880
at Stride.Rendering.Compositing.ForwardRenderer.PrepareRenderTargets(RenderDrawContext drawContext, Size2 renderTargetsSize) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\ForwardRenderer.cs:line 928
at Stride.Rendering.Compositing.ForwardRenderer.DrawCore(RenderContext context, RenderDrawContext drawContext) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\ForwardRenderer.cs:line 740
at Stride.Rendering.Compositing.SceneRendererBase.Draw(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\Compositing\SceneRendererBase.cs:line 39
at Stride.Rendering.Compositing.SceneRendererCollection.DrawCore(RenderContext context, RenderDrawContext drawContext) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\Compositing\SceneRendererCollection.cs:line 28
at Stride.Rendering.Compositing.SceneRendererBase.Draw(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\Compositing\SceneRendererBase.cs:line 39
at Stride.Rendering.Compositing.SceneCameraRenderer.DrawInner(RenderDrawContext renderContext) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\SceneCameraRenderer.cs:line 109
at Stride.Rendering.Compositing.SceneCameraRenderer.DrawCore(RenderContext context, RenderDrawContext drawContext) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\SceneCameraRenderer.cs:line 72
at Stride.Rendering.Compositing.SceneRendererBase.Draw(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\Compositing\SceneRendererBase.cs:line 39
at Stride.Rendering.Compositing.GraphicsCompositor.DrawCore(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\GraphicsCompositor.cs:line 209
at Stride.Rendering.RendererBase.Draw(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\RendererBase.cs:line 51
at Stride.Engine.SceneSystem.Draw(GameTime gameTime) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Engine\SceneSystem.cs:line 234
at Stride.Games.GameSystemCollection.Draw(GameTime gameTime)
at Stride.Games.GameBase.Draw(GameTime gameTime)
at Stride.Games.GameBase.RawTick(TimeSpan elapsedTimePerUpdate, Int32 updateCount, Single drawInterpolationFactor, Boolean drawFrame)
at Stride.Games.GameBase.RawTickProducer()
Unhandled exception. SharpDX.SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.
at SharpDX.Result.CheckError() in C:\projects\sharpdx\Source\SharpDX\Result.cs:line 195
at SharpDX.Direct3D11.Device.CreateTexture2D(Texture2DDescription& descRef, DataBox[] initialDataRef, Texture2D texture2DOut) in C:\projects\sharpdx\Source\SharpDX.Direct3D11\Generated\REFERENCE\Interfaces.cs:line 1292
at SharpDX.Direct3D11.Texture2D..ctor(Device device, Texture2DDescription description, DataBox[] data) in C:\projects\sharpdx\Source\SharpDX.Direct3D11\Texture2D.cs:line 80
at Stride.Graphics.Texture.InitializeFromImpl(DataBox[] dataBoxes)
at Stride.Graphics.Texture.InitializeFrom(Texture parentTexture, TextureDescription description, TextureViewDescription viewDescription, DataBox[] textureDatas)
at Stride.Graphics.Texture.InitializeFrom(TextureDescription description, TextureViewDescription viewDescription, DataBox[] textureDatas)
at Stride.Graphics.Texture.New(GraphicsDevice graphicsDevice, TextureDescription description, TextureViewDescription viewDescription, DataBox[] boxes)
at Stride.Graphics.Texture.New(GraphicsDevice graphicsDevice, TextureDescription description, DataBox[] boxes)
at Stride.Graphics.GraphicsResourceAllocator.CreateTexture(TextureDescription description, PixelFormat viewFormat)
at Stride.Graphics.GraphicsResourceAllocator.GetTemporaryResource[TResource,TKey](Dictionary`2 cache, TKey description, Func`3 creator, Func`2 getDefinition, PixelFormat viewFormat)
at Stride.Graphics.GraphicsResourceAllocator.GetTemporaryTexture(TextureDescription description)
at Stride.Graphics.GraphicsResourceAllocatorExtensions.GetTemporaryTexture2D(GraphicsResourceAllocator allocator, TextureDescription description)
at Stride.Rendering.Compositing.ForwardRenderer.PrepareRenderTargets(RenderDrawContext drawContext, Texture outputRenderTarget, Texture outputDepthStencil) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\ForwardRenderer.cs:line 880
at Stride.Rendering.Compositing.ForwardRenderer.PrepareRenderTargets(RenderDrawContext drawContext, Size2 renderTargetsSize) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\ForwardRenderer.cs:line 928
at Stride.Rendering.Compositing.ForwardRenderer.DrawCore(RenderContext context, RenderDrawContext drawContext) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\ForwardRenderer.cs:line 740
at Stride.Rendering.Compositing.SceneRendererBase.Draw(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\Compositing\SceneRendererBase.cs:line 39
at Stride.Rendering.Compositing.SceneRendererCollection.DrawCore(RenderContext context, RenderDrawContext drawContext) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\Compositing\SceneRendererCollection.cs:line 28
at Stride.Rendering.Compositing.SceneRendererBase.Draw(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\Compositing\SceneRendererBase.cs:line 39
at Stride.Rendering.Compositing.SceneCameraRenderer.DrawInner(RenderDrawContext renderContext) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\SceneCameraRenderer.cs:line 109
at Stride.Rendering.Compositing.SceneCameraRenderer.DrawCore(RenderContext context, RenderDrawContext drawContext) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\SceneCameraRenderer.cs:line 72
at Stride.Rendering.Compositing.SceneRendererBase.Draw(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\Compositing\SceneRendererBase.cs:line 39
at Stride.Rendering.Compositing.GraphicsCompositor.DrawCore(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Rendering\Compositing\GraphicsCompositor.cs:line 209
at Stride.Rendering.RendererBase.Draw(RenderDrawContext context) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Rendering\Rendering\RendererBase.cs:line 51
at Stride.Engine.SceneSystem.Draw(GameTime gameTime) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Engine\Engine\SceneSystem.cs:line 234
at Stride.Games.GameSystemCollection.Draw(GameTime gameTime)
at Stride.Games.GameBase.Draw(GameTime gameTime)
at Stride.Games.GameBase.RawTick(TimeSpan elapsedTimePerUpdate, Int32 updateCount, Single drawInterpolationFactor, Boolean drawFrame)
at Stride.Games.GameBase.RawTickProducer()
at Stride.Games.GameBase.Tick()
at Stride.Games.GamePlatform.Tick()
at Stride.Games.GamePlatform.OnRunCallback()
at Stride.Games.GameWindowWinforms.<>c__DisplayClass19_0.<Run>b__0()
at Stride.Games.WindowsMessageLoop.Run(Control form, RenderCallback renderCallback, Boolean useApplicationDoEvents)
at Stride.Games.GameWindowWinforms.Run()
at Stride.Games.GamePlatform.Run(GameContext gameContext)
at Stride.Games.GameBase.Run(GameContext gameContext)
at Program.<Main>$(String[] args) in D:\Tests\Stride Tests\Test_Lvl9_1\Test_Lvl9_1.Windows\Test_Lvl9_1App.cs:line 4
Additional context OpenGL seems to work.
Fished through old memories...
If you really want to find exactly the issue with DirectX 9.X api:
The following steps increases the debug logging to show the above error:
- Right click the Windows project -> Properties -> Debug
- Tick
Enable native code debugging - Set
DeviceCreationFlags.Debugon theGraphicsDeviceManager, ie.
using (var game = new Game())
{
game.GraphicsDeviceManager.DeviceCreationFlags = Stride.Graphics.DeviceCreationFlags.Debug;
game.Run();
}
- Read the output window in Visual Studio.
However, nearly 4 years ago xen2 wanted to remove the 9.X levels. Also, in my current research into some Android bugs, I've found OpenGL ES2 (same level as 9.X) is pretty much busted as well - some ES3 features that were being emulated to support ES2 were actively removed. I think the most likely scenario is that these profiles will be removed (or just advised to avoid) instead of fixing.
I think in my PR to switch to Silk.NET I've removed support for DX versions < 10 already. The minimun level for DirectX is DX10, released with Windows Vista in 2007. Even DX10 is old by now. Maybe even that should be removed and only allow DX11 (Win7, 2011) and DX12 (Win10, 2015).
@Basewq Can we safely deprecate/remove support for 9 ? Do you know how likely it is that mobile devices created in the last 5 years support 10+ ?
@Basewq Can we safely deprecate/remove support for 9 ? Do you know how likely it is that mobile devices created in the last 5 years support 10+ ?
Probably safe to drop for mobile, however I'm no authority on this matter.
- Unity Explicit opt-in only (no idea how it performs)
- Unreal ES2 removed from 4.25 and onwards (dropped in 2020)
- Godot Dropped in Godot 4 onwards (last year)
The only 'issue' is that Android emulators default to 'compatibility' mode so are defaulted to ES2, and you need to explicitly opt-in to make the emulator run with ES3 & above - I intend to raise an issue on this thing soon-ish (if I can kick myself into gear).
@Eideren There are data points in this PR,
https://github.com/stride3d/stride/pull/2186
The reported numbers have only fallen further since then. OpenGL ES overall has been deprecated on iOS since 12 (~2018) so the impact should be minimal as long as supported modern standards are working (on mobile, I don't think they are).
Okay, I assigned that PR and this issue to the 4.3 milestone, we'll merge and close once we move to that version