SlimDX Directx11 Text Rendering Problem

Started by
15 comments, last by Megafont 11 years, 4 months ago
I went through the code line by line mostly and couldn't see any differences between what you've got and what I've got. If you're project is small, just this code basically you can send it to me at gavin_w3@yahoo.com.au. Maybe if I can play with it in Visual Studio I'll see something.
Advertisement
I sent you the project in a .zip file. It's not very big though. Thanks for the help! I really appreciate it. :)

It's gonna end up being some really tiny little detail somewhere probably. The really hard bugs to squash have a tendency to end up that way a lot it seems.
Ok I've noticed that you have a lot of live objects, so if you add m_textRenderer.Dispose() to GameWindowTest.Dispose() you'll get rid of 16 of the 17 live objects. But there is still a Surface that needs disposing, and it's probably in m_textRenderer, as it goes away after commenting it out. But I couldn't locate it on a first pass.

As for the main problem :

Test App > Properties > Debug : Enable native code debugging - this gives the full debug output. When I checked this box I got the following problem ...
Signatures between stages are incompatible...

There will be a mismatch somewhere, maybe in inputLayout or in the VertexDeclarations, Or in the shader itself.
Oh I thought I turned on the native debug. I just realized though that I turned it on for the framework project and not Test App didn't I? lol. I hadn't even checked if I had live objects still. I usually do though but I guess I got too side tracked with hunting bugs. lol. Thanks a bunch though! I'll look at it some more and let you know if I find the problem :)
I found the problem, you need to set the input layout...


InputElement[] inputElements = new []
{
new InputElement("POSITION", 0, Format.R32G32B32_Float,0,0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 0)
};
InputLayout layout = new InputLayout(m_d3d11_Device, m_vShaderSignature, inputElements);
m_d3d11_Device.ImmediateContext.InputAssembler.InputLayout = layout;
// Set the vertex buffer for the text geometry (a square).
m_d3d11_Device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new SlimDX.Direct3D11.VertexBufferBinding(m_d2dVertexBuffer, 20, 0));
Thanks I was just realizing that myself lol. I seem to have another problem though. I added m_TextRenderer.Dispose() in the dispose method of the GameWindowTest class but it still isn't disposing those objects for some reason. I'm not sure why, unless I need to detect when the window is closing and call Dispose(true).

Anyway, I need to get some sleep so I'm gonna get off the computer for now, and mess with it some more later. Thanks again! :)
I've got everything working now.

I found that missing surface that wasn't getting disposed too. It was because of this line:

m_d2dRenderTarget = RenderTarget.FromDXGI(d2dFactory, m_sharedTexture10.AsSurface(), d2d_rtp);


This Texture2D got disposed, but the d2dRenderTarget still had a reference to its surface so the surface did not. I added a new member variable to hold a reference to this surface, and then I added a line in the Dispose() function to dispose this new variable. Now there are 0 live objects.

Thanks again for all the help! It's so great to have it working finally after a couple days! lol

This topic is closed to new replies.

Advertisement