'SharpDX.SharpDXException' when loading a big image

Hey guys,

I am fairly new to working with Monogame, XNA and coding in genera but feel quite at home with it and I am working on a relativly big project. However I have stumbled upon a problem I seem to have a hard time fixing.

What I am trying to do is load an image, a spritesheet for a animated splashscreen(it is pretty big). The proble is an exeption I am getting when doing this:

“SharpDX.SharpDXException: 'HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.”

I have searched around to find a solution for it. I have stumbled upon a few people who had the same exeption and found something about making the GraphicsProfile HiDef which I did however it did not solve my problem. I belive the problem is the image size because smaller images works.

If someone has a solution to my problem I would be grateful.
Thanks in advance!

Hey Niklas,

I have just few questions which might lead to an answer to your problem.

  1. How big is the image?
  2. What gpu are you using?
  3. What is the highest DirectX major version installed?

For second two questions you can go to DirectX diagnostic tool. Run dxdiag with windows Run app or just simply type it in your search bar.

  1. The image is 24 000 x 480
  2. The GPU is Intel HD Graphics 520
  3. I have DirectX 12

The problem is that currently max texture size you can load is 16,384 in any dimension for Dx12 and Dx11 and you can’t do anything about that. The lower version user supports, the smaller maximum size they can use. For example user with Dx10 users won’t be able to load an image bigger than 8,192. Users with Dx9 won’t be able to load bigger than 4048 and so on. HiDef only says to use DirectX bigger than 9 if possible I believe.

For you there are 2 possible solutions, depends on how many users you want to support. As I understand you only assembled spritesheet horizontally (50x1)?. You should always assemble sprite sheet vertically also, for example in lines of 10 images (10x5). However based on your image size it would still be pretty large. Other way would be to separate images to separate files based on sequence “splashscreen_01.png”, “splashscreen_02.png”… Loading this should be very easy in an array.

I personally assemble my own atlases in game based on user max supported texture size from sprite sheets or separate images. But this can take a week to code and assemble nicely.

If you want to support as many users as possible, then the maximum texture size you should target is 2024.

I hope this answers your question.

1 Like

Thank you for your relpy.

Yes my question got answered. It was as I feared that the image was to big. I have not actually thought about making spritesheets vertical thanks for the idé. Actually the image I am trying to get working is a already a part of a 4 part spritesheet.

I hav realized that you can play videos through monogame and think that it is the best way for me to display my splashscreen when I actually dont need to have it controlled like an animtion.