Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

DirectX Texture Behaviour Not As Expected

$
0
0

@Avan_Madisen wrote:

I've recently been playing with dynamic texture atlas handling and I've found that I receive a crash if I try to set the data for a texture that is larger than 4096, here's a crude example of what I'm doing.

        int Size = 4096;
        Texture2D Test_Tex = new Texture2D(GraphicsDevice, Size, Size, false, SurfaceFormat.Color);
        Color[] Test_Data = new Color[Size * Size];
        Test_Tex.SetData<Color>(Test_Data);

This runs perfectly fine, however if I change the Size value to 4097 I receive the following crash:

An unhandled exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll

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

I have tested to make sure this isn't due to using a non multiple of 2 size as I can use a size of 4095 without any issue.

Since DX11 can handle textures bigger than 4096 I would've thought this kind of error wouldn't occur unless I tried a size larger than 16384. I also get the same error if I try to create a RenderTarget2D larger than 4096.

My guess is that I might be running in DX9, but I should be in DX11 as I'm using Windows 10 with a DX12 graphics card. Is there a way to tell if I'm running DX9 or DX11 and if so, is there a way to select DX11?

Or is there something stupidly obviously I'm missing here?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles