WPF, Directx 11 Effect passes

Started by
-1 comments, last by Curin 9 years, 5 months ago

I have converted the sample from Directx10 SlimDX to work with Directx11. The initial testing was promising witht the fact that I can assign the base color, but when I try to run an effect the program doesn't actually draw the vertices.

The render code is as follows


public void Render(int arg)
        {
            D3DDevice.ImmediateContext.OutputMerger.SetTargets(SampleDepthView, SampleRenderView);
            D3DDevice.ImmediateContext.Rasterizer.SetViewports(new Viewport(0, 0, WindowWidth, WindowHeight, 0.0f, 1.0f));

            D3DDevice.ImmediateContext.ClearDepthStencilView(SampleDepthView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1.0f, 0);
            float c = ((float)(arg % 1000)) / 999.0f;
            D3DDevice.ImmediateContext.ClearRenderTargetView(SampleRenderView, new SlimDX.Color4(1.0f, c, c, c));

            D3DDevice.ImmediateContext.InputAssembler.InputLayout = SampleLayout;
            D3DDevice.ImmediateContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
            D3DDevice.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(SampleVertices, 32, 0));

            EffectTechnique technique = SampleEffect.GetTechniqueByIndex(0);
            EffectPass pass = technique.GetPassByIndex(0);

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

            D3DDevice.ImmediateContext.Flush();
        }

If anyone can help me find out what is wrong. I know that the shader I'm using works as I have used it in place of the minitri11 sample's shader and it worked fine.

Thanks in advance,

Curin

This topic is closed to new replies.

Advertisement