开发者

Deferred context does not render anything

i'm trying to understand how multithreaded rendering work in dx11, so i started without any threads, just make one deferred context, and try to render triangle with it


the code is here https://gist.github.com/998406 i modifed SlimDX MiniTri sample for this way -> make deferred context with

var deferredContext = new DeviceContext(device);

next i bind shader to it and render it

deferredContext.ClearState();开发者_JS百科
deferredContext.InputAssembler.InputLayout = layout;
deferredContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
deferredContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertices2, 32, 0));

 for (int i = 0; i < technique.Description.PassCount; ++i){
                              pass.Apply(deferredContext);
                              deferredContext.Draw(3, 0);}

then try to get command list and execute it

CommandList dc_cl = deferredContext.FinishCommandList(false);
device.ImmediateContext.ExecuteCommandList(dc_cl, true);

what i'm expecting to see is 2 triangles but it only render immdeiate context, but if i clear screen in deffered context like deferredContext.ClearRenderTargetView(renderView, Color.Tomato); my screen now in tomato color, but still no triangles


also when i added this deferred context PIX stop working, witch means that i'm doing something terrible wrong


As the deferred context is not the same as your original context you need to re-set render targets for your deferred device in addition to fixing your command list arguments.

This explains why your device is cleared but no geometry is being rendered.


Not sure if you fixed this yet, but if you get rid of the ClearState() call and then set both FinishCommandList's and ExecuteCommandList's boolean parameters to true, you see both triangles on the screen.

I'm not entirely sure why this is the case; I'm not too familiar with the multithreading portions of D3D11. You might have to ask on a native forum for more information on how that works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜