Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Jul 2008
Offline Last Active Jan 20 2015 09:08 AM

#5176302 Render to a texture in D2D+DWrite+SharpDX

Posted by xoofx on 26 August 2014 - 04:21 PM

The message is pretty explicit. Your render target is not compatible with what is expecting D2D.


As you haven't posted the declaration of your render target, it is impossible to make a clear diagnostic, but when you say "my loaded texture2d,", this is suspicious. This must be a texture declared as a render target, not a texture that you load from the disk.

#5176300 Problem With Creation of TypedBuffer

Posted by xoofx on 26 August 2014 - 04:16 PM


Excuse me , I thought u meant The message of the pop up window. In the output I got this :


This was explicitly explained in the link above, item 3) "And check the output log of Visual Studio in the Output Log tab"



D3D11 ERROR: ID3D11Device::CreateShaderResourceView: The Dimensions of the View are invalid due to at least one of the following conditions. Assuming this Format (0x2a, R32_UINT), ElementOffset (value = 0) must be between 0 and the maximum offset of the Buffer, 121599, inclusively. With the current ElementOffset, ElementWidth (value = 0) must be between 1 and 121600, inclusively, in order that the View fit on the Buffer. [ STATE_CREATION ERROR #128: CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS]


You should be able to see your problem with this message.


When you create a buffer view, you need to tell the range of data that is going into the view. In your sample, you don't define this. Check the documentation D3D11_SHADER_RESOURCE_VIEW_DESC , D3D11_BUFFER_SRV doc,  For this Shader Resource View you need to define ElementOffset and ElementWidth but the error message (and documentation) is a bit misleading because they should suggest the number of elements, not the size of a single element, so prefer using ElementCount and FirstElement, like this:

var desc = new ShaderResourceViewDescription();
desc.Dimension = ShaderResourceViewDimension.Buffer;
desc.Format = SharpDX.DXGI.Format.R32_UInt;
desc.Buffer.FirstElement = 0;    // same as ElementOffset in error message but more appropriate
desc.Buffer.ElementCount = MaximumCount; // same as ElementWidth in error message but more appropriate

You will get probably similar error for the declaration of UAV view.

#5176186 Problem With Creation of TypedBuffer

Posted by xoofx on 26 August 2014 - 07:12 AM

I have already done that . This is all that it gives me . 

I don't really believe this. Can you copy/paste the full output log of Visual Studio?

#5176115 Problem With Creation of TypedBuffer

Posted by xoofx on 25 August 2014 - 07:54 PM

Help yourself tongue.png "How to debug a SharpDX Exception"

#5174981 [SharpDX] Question about Z-Buffer

Posted by xoofx on 20 August 2014 - 06:20 AM

In SharpDX these two DepthStencilStates also exist (from looking at the source code), but somehow I can't access them.


SharpDX is providing low-level DirectX and a higher level API with the Toolkit. I assume you are talking about the Toolkit, but please in the future, try to give more context.


That being said, I don't know how you are looking at the source code or even you are usually using an API, but the method GraphicsDevice.SetDepthStencilState is well defined.


Also, GraphicsDevice.DepthStencilStates.Default and None provides default states, and can be used like this:



It is the same behavior for blend states and rasterizer states.

#5174249 SharpDx and d3dcompiler_XX.dll

Posted by xoofx on 17 August 2014 - 05:37 AM

You need to add it to your csproj like it is done in this sample

#5174208 SharpDx and d3dcompiler_XX.dll

Posted by xoofx on 16 August 2014 - 09:23 PM

If you are using nuget packages and building desktop applications, it will link by default the old DirectX June 2010 runtime. In order to use more recent d3dcompiler_47.dll (deployed on Windows8.x), you need to setup a config variable in your project


If you are referencing manually binaries, simply link against DirectX11_2-net40

#5171870 SharpDX Drawing rectangle

Posted by xoofx on 06 August 2014 - 07:28 AM

Some lines missing maybe because i didn't do that?



You just need to add this case yes. You can also consider drawing this grid differently long horizontal/vertical lines, and a 4 long lines around to close the board. It all depends on your requirements regarding the grid (if you need to move a single point in the grid not aligned to the others or not)

#5171860 SharpDX Drawing rectangle

Posted by xoofx on 06 August 2014 - 06:33 AM

You are using PrimitiveType.LineStrip which is as stated in the doc `Renders the vertices as a single polyline.` Instead you should use PrimitiveType.LineList which is "Renders the vertices as a list of isolated straight line segments.". You will have to change your points gen also that you have (p0-p1), (p1-p2), (p2-p3)....etc.

#5149570 ReportLiveObjects() isn't giving me enough information.

Posted by xoofx on 26 April 2014 - 12:20 AM

I have the same problem here. I suspect a recent update but don't recall last time I used the debug output and it was valid.

I have installed recently the VS2013 Update 2 RC, so It might be this install that messed up things here... If there is someone else with Windows8.1 but without VS2013 Update 2 RC to confirm this?

#5149329 C# for Xbox anyone? I'm excited!

Posted by xoofx on 25 April 2014 - 02:42 AM

From the details they have leaked at E3 it sounds like you will be considered just windows store apps and not GameOs apps, which means you only have 3bGB of memory and thats shared with the rest that is running in the shared OS.


Most of these apps will just run on windows 8 store too without any real modification to the code.



Hey, 3Gb RAM max - even shared - that would be fine for lots of indie games! If they are not messing with the market and that small games could be sold via this channel, that would be great

#5133685 SharpDX - read R16F into array

Posted by xoofx on 22 February 2014 - 06:26 PM

You can't back read the whole texture in a float array as the number of bytes per row is more likely to be different when mapping the resource. Check the box.RowPitch that will give you exactly the number of bytes per row (that will not equal to sizeof(float) * 4097). Internally, the texture on the GPU is not having a size of 4097 but will align it to the need of its architecture.


You need to iterate on each row and copy them one at a time when the box.RowPitch doesn't match your target rowpitch.

#5133535 SharpDX - SwapChain1 - where are the constructors?

Posted by xoofx on 22 February 2014 - 07:32 AM

Using the latest dev package 2.5.1 from the home page, this should be in the folder DirectX11_2-net40 and constructors are available from the DXGI assembly there.

[Edit] You don't need to build yourself, there is a build 2.5.1 package build updated to the latest changes[/Edit]

#5118320 Model import adventures

Posted by xoofx on 20 December 2013 - 02:16 AM

Actually the problem is not in the binary definition of data but lies into data filtering/transformations and semantic/organizational changes performed by each application/libraries.


Having a common binary language would just help a little in this case. Because you will still have datas organized/interpreted differently, stripped down between a big blob collada file and an optimized file suitable for loading at runtime. Data transformation is not an easy topic, well... its even the whole purpose of a program! ;)


Things as simple as bones matrices can sometimes be interpreted/organized differently, handiness is often a concern between applications. A supposedly common format like FBX is quite a challenge to master with its handling (not-always-documented or not documented at all) of matrices/skeleton/skinning/channels/animations/handiness...etc,  Add to this a bit of salt, like Maya or 3DS are exporting things differently to this format...etc

#5116665 Using NVIDIA Nsight with SharpDX

Posted by xoofx on 13 December 2013 - 06:10 AM

We are using it at work and afaik it is working fine. Make sure that you are running the app in x86 mode, with d3d11 and latest compatible NVidia driver. Also make sure the device is instantiated in 11.0 and not level 9.x.[Edit] Just did a test at home with latest version and it is working well. You need to set x86 as AnyCpu on a 64bit system will not work with NSight (don't think NSight is able to debug 64bits apps)