Sign in to follow this  

CreateTexture2D fails for GeForce GTX 280 user

Recommended Posts

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??

Edited by captain_crunch

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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);

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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..?

Edited by captain_crunch

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this