This project has moved and is read-only. For the latest updates, please go here.

Using Vertex, Geometry, and Pixel Shaders

Dec 14, 2014 at 6:24 AM
I have a particle system that works by loading in vertex/geo/pixel shaders without DirectXTK (auto loadVSTask = DX::ReadDataAsync(L"SampleVertexShader.cso")), then doing a lot of context-setting like context->VSSetShader(,,,) and context->VSSetConstantBuffers(..) before drawing the particles, then calling context->Draw() to actually draw them.

This works perfectly fine in its own project, but doesn't work when I attempt to incorporate it into a project where I'm using DirectXTK. In that project, I have a one-liner setup of m_batchEffect.reset(new BasicEffect(device));, then a call of m_batchEffect->Apply(context); when rendering, and that's about it. No pixel shaders, vertex shaders, etc.

Now when I try to draw the particles using the exact same code/method as always, my screen goes blank (only the background colour is shown), and the particles themselves don't even show up. I'd like to at least figure out the screen-going-blank part: is it because I've set all those shaders to the context? If that's the case, how would I 'unset' them? What is/could be the problem here in general?

Thanks for any help.
Dec 14, 2014 at 6:31 AM
Edited Dec 14, 2014 at 6:34 AM
Graphics debugging is always a challenge particularly because lots of things can result in a 'blank screen'.
  • Use the DEBUG device and look for ERRORS or WARNINGS related to the draw state
  • Use the Visual Studio Graphics Debugger (which is in VS 2012 Pro+, VS 2013 Pro+, VS 2013 Express for Windows, and the new VS 2013 Community edition).
  • Simplify the scene by commenting out draws/state until you get a working basic state and add them back slowly
BasicEffect Apply sets vertex and pixel shader shaders, constant buffers into input slot 0, Pixel-shader resources into slot 0, and that's about it.
Marked as answer by walbourn on 1/9/2015 at 1:42 PM