Skip to main content
GameDev.net gamedev.net
🔒 Locked

CreateTexture2D fails for GeForce GTX 280 user

Started by captain_crunch Dec 26, 2016 at 6:13 PM 15 replies 9.3k views
Original Post
captain_crunch
captain_crunch

Seasonal greetings,

My game uses MonoGame for Windows desktop and one Windows 7 user gets an error every time when creating a 2D rendertarget:


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

Line: 0

at SharpDX.Result.CheckError()
at SharpDX.Direct3D11.Device.CreateTexture2D(Texture2DDescription& descRef, DataBox[] initialDataRef, Texture2D texture2DOut)
at Microsoft.Xna.Framework.Graphics.Texture2D.CreateTexture()
at Microsoft.Xna.Framework.Graphics.RenderTarget2D.GenerateIfRequired()

The user has Win7 SP1 and also this patch:

https://support.microsoft.com/da-dk/kb/2670838

which is supposed to help, but doesn't.

I found the patch in this thread: https://steamcommunity.com/app/498240/discussions/0/360671352681600886/

Chip type: GeForce GTX 280

Any ideas??

21st Century Moose
21st Century Moose

Can you post the texture description struct please?

In all likelihood this is absolutely nothing to do with the OS version and absolutely everything to do with hardware capabilities. The GeForce GTX 280 is a very old GPU, and you may be trying to create a texture that is too large for it, for example.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 
captain_crunch
captain_crunch

Thanks, I will look into the capabilities of that card, I didn't realize it was that old.

captain_crunch
captain_crunch

I think the texture size in the call is equal to the resolution, 1440 * 900. In the method that crashes I am creating all the rendertargets that the game needs for its various processing, about 10.



DiffuseMSRenderTarget = new RenderTarget2D(device,
                 width, height, false,
                  pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.PreserveContents);


            // resolve target - not needed?
            diffuseRenderTarget = new RenderTarget2D(device, width, height, false,
                pp.BackBufferFormat, pp.DepthStencilFormat, 0, RenderTargetUsage.PreserveContents);
            
            


            edgeDetectNormalDepthRenderTarget = new RenderTarget2D(device,
                                                         width, height, false,
                                                         pp.BackBufferFormat, pp.DepthStencilFormat, 0, RenderTargetUsage.PreserveContents);




            // no depth buffer, no multisampling!
            shadowRenderTarget = new RenderTarget2D(device,
                width, height, false,
                pp.BackBufferFormat, DepthFormat.None, 0, RenderTargetUsage.DiscardContents);


            // no depth buffer, no multisampling!
            diffuseFinalRenderTarget = new RenderTarget2D(device,
                width, height, false,
                pp.BackBufferFormat, DepthFormat.None, 0, RenderTargetUsage.DiscardContents);


            emissiveModelLightRenderTarget = new RenderTarget2D(device,
                width, height, false,
                pp.BackBufferFormat, DepthFormat.None, 0, RenderTargetUsage.DiscardContents);


            emissiveModelLightDistanceRenderTarget = new RenderTarget2D(device,
                width, height, false, SurfaceFormat.Rg32
                , DepthFormat.None, 0, RenderTargetUsage.DiscardContents);


            DistanceHeightAndBillboardAlphaRenderTarget = new RenderTarget2D(device,
                   width, height, false, SurfaceFormat.Rgba1010102, DepthFormat.None, 0, RenderTargetUsage.DiscardContents);
captain_crunch
captain_crunch

I suspect it's one of the SurfaceFormats, or the multisampling that is causing the error. However I cannot find the specs with supported formats anywhere.

21st Century Moose
21st Century Moose

The GeForce 200 series dates to 2008/2009 and is desupported since April 2016. It's a 7/8 year old GPU and is Direct3D 10/10.1 capable, not 11, so if using 11 you will need to use feature levels to access the downlevel functionality.

So in other words, you should restrict your code to Direct3D 10/10.1 capabilities. Try to do something that's only available in Direct3D 11 or higher and it will fail.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 
captain_crunch
captain_crunch

Thanks. I used the XNA/MonoGame HiDef profile to try to avoid these issues...

I wrote on the store page, under requirements: DirectX 10 capable graphics card

I guess that isn't accurate enough. However, I don't want to recode the graphics now. Perhaps it is best to require DirectX 11 then..?

Hodgman
Hodgman



Message: The parameter is incorrect
What are the parameters?
captain_crunch
captain_crunch
Message: The parameter is incorrect
What are the parameters?

I only have the callstack and the code that causes it, I cannot repro the error.

I'm guessing width is 1440, height is 900 and the other parameters are constant as seen in the code snippet.

21st Century Moose
21st Century Moose

Even if you can't reproduce the error, you should still be able to pin down the call that works on every other PC but this one. What we're all interested in this is part:


SharpDX.Direct3D11.Device.CreateTexture2D(Texture2DDescription& descRef, .....

E_INVALIDARG means that one or more of the members of descRef is not valid on that PC, but without seeing what those members are, it's difficult to say any more.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 
galop1n
galop1n

You should turn on the debug layer, microsoft will shoot at you what is the invalid arguments, no need to guess again and again.

captain_crunch
captain_crunch

You should turn on the debug layer, microsoft will shoot at you what is the invalid arguments, no need to guess again and again.

Unfortunately I don't own that card, so it's not possible to debug the user's error. But I will try to find out what the parameters look like.

Adam_42
Adam_42

You might be able to reproduce the problem yourself by explicitly requesting a 10.0 or 10.1 feature level when you initialize the device.

WARP is also a feature level 10.1 device, so it might be worth testing with that.

MJP
MJP

WARP is also a feature level 10.1 device, so it might be worth testing with that.


Actually they updated WARP to support 11_0 and 11_1.
captain_crunch
captain_crunch

Another user with a GeForce 9500 GT just reported the same error. That video card is also from 2008/2009.

Adam_42
Adam_42

You need to be able to reproduce the bug yourself to identify the problem, and be confident that any fix you make has solved the problem.

If you can't reproduce the problem another way, you could always buy yourself a second hand 9500 GT. A graphics card that old won't be expensive.

captain_crunch
captain_crunch

I work on a laptop.

I think instead I will try to add more detailed output to the exception and have the user report the results...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.