henriko wrote:
Also, xoofx, thank you very much for the information on how to get better debug information. It helped a lot in pin-pointing where exactly the problem was appearing. The actual debug message did not change, it was still "Parameter is incorrect" as before, which doesn't actually give that much.
Are you sure that you setup things correctly? Because doing this:
vertices = Buffer.Vertex.New(GraphicsDevice, data); // Texture is created by default with Immutable, so It cannot be updated later
vertices.SetData(data); // This will generate an exception
Will result in an exception on SetData as expected with the message "The parameter is incorrect", but you should have a log just before this exception:
D3D11 ERROR: ID3D11DeviceContext::Map: Map cannot be called with MAP_WRITE_DISCARD access, because the Resource was not created with the D3D11_CPU_ACCESS_WRITE flag. [ RESOURCE_MANIPULATION ERROR #2097210: RESOURCE_MAP_INVALIDMAPTYPE]
And after this message a more traditional exception message:
A first chance exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll
An unhandled exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll
Additional information: HRESULT: [0x80070057], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: The parameter is incorrect.
This detailed message is only printed while you debug your application. looking at the Output log tab of VS, and if you have turned on "enable unsafe code debugging" in your project settings/debug. Whenever you have an exception in D3D11, you will more likely have a detailled message before this exception is thrown. You could also get a warning (which sometimes can be an invalid usage).