예제 #1
0
        void renderScene(IDeviceContext ic, ITextureView swapChainRgb, ITextureView swapChainDepthStencil)
        {
            ic.SetRenderTarget(swapChainRgb, swapChainDepthStencil, ResourceStateTransitionMode.Transition);

            // Clear the back buffer
            ic.ClearRenderTarget(swapChainRgb, clearColor);
            ic.ClearDepthStencil(swapChainDepthStencil, ClearDepthStencilFlags.DepthFlag, 1.0f, 0);

            // Map the buffer and write current world-view-projection matrix
            Matrix4x4 transposed = worldViewProjMatrix.transposed();

            ic.writeBuffer(vsConstants, ref transposed);

            // Bind vertex and index buffers
            ic.SetVertexBuffer(0, cubeVertexBuffer, 0);
            ic.SetIndexBuffer(cubeIndexBuffer, 0);

            // Set the pipeline state
            ic.SetPipelineState(pipelineState);
            // Commit shader resources. RESOURCE_STATE_TRANSITION_MODE_TRANSITION mode makes sure that resources are transitioned to required states.
            ic.CommitShaderResources(resourceBinding);

            DrawIndexedAttribs draw = new DrawIndexedAttribs(false)
            {
                IndexType  = GpuValueType.Uint16,
                NumIndices = 36,
                Flags      = DrawFlags.VerifyAll
            };

            ic.DrawIndexed(ref draw);
        }
예제 #2
0
 void iCursorRender.render(IDeviceContext context, IBuffer vertexBuffer)
 {
     context.writeBuffer(constantBuffer, ref position);
     context.SetPipelineState(pipelineState);
     context.CommitShaderResources(bindings);
     renderQuad(context, vertexBuffer);
 }
예제 #3
0
        void iCursorRender.render(IDeviceContext context, IBuffer vertexBuffer)
        {
            context.writeBuffer(constantBuffer, ref position);
            context.SetVertexBuffer(0, vertexBuffer, 0);
            DrawAttribs draw = new DrawAttribs(false)
            {
                NumVertices = 4,
                Flags       = DrawFlags.VerifyAll
            };

            context.SetPipelineState(psoInvert);
            context.CommitShaderResources(bindingsInvert);
            context.Draw(ref draw);

            context.SetPipelineState(psoRgb);
            context.CommitShaderResources(bindingsRgb);
            context.Draw(ref draw);
        }
예제 #4
0
        public void draw(IDeviceContext context, ref Matrix4x4 worldView, ref Matrix4x4 projection)
        {
            var constants = new VsConstants(ref worldView, ref projection);

            context.writeBuffer(vsConstants, ref constants);

            // Set the pipeline state
            context.SetPipelineState(pipelineState);
            // Commit shader resources. RESOURCE_STATE_TRANSITION_MODE_TRANSITION mode makes sure that resources are transitioned to required states.
            context.CommitShaderResources(resourceBinding);

            mesh.draw(context);
        }
예제 #5
0
        protected void drawTriangle(IDeviceContext ic, ITextureView textureView)
        {
            ic.SetPipelineState(pipelineState);
            textureVariable.Set(textureView);
            ic.CommitShaderResources(binding);
            ic.setVertexBuffer(vertexBuffer);
            DrawAttribs draw = new DrawAttribs(false)
            {
                NumVertices = 3,
                Flags       = DrawFlags.VerifyAll
            };

            ic.Draw(ref draw);
        }
예제 #6
0
        public void blend(IDeviceContext ic, IShaderResourceBinding source)
        {
            ic.SetPipelineState(pipelineState);
            ic.CommitShaderResources(source);
            ic.SetVertexBuffer(0, null, 0);
            DrawAttribs draw = new DrawAttribs(false)
            {
                NumVertices = 3,
                Flags       = DrawFlags.VerifyAll
            };

            // ConsoleLogger.logDebug( "BlendTextures.blend, rendering" );
            ic.Draw(ref draw);
            // ConsoleLogger.logDebug( "BlendTextures.blend, rendered" );
        }
예제 #7
0
파일: Nv12State.cs 프로젝트: zeta1999/Vrmac
        public void render(IDeviceContext context, ITextureView rtv, CSize outputSize, int index)
        {
            // Setup stuff
            context.SetRenderTarget(rtv, null);
            context.setViewport(outputSize, viewport);
            context.SetPipelineState(pipelineState);
            textureVariable.Set(sourceTextures[index]);
            context.CommitShaderResources(binding);

            // Render a full-screen triangle, no vertex buffer needed
            DrawAttribs draw = new DrawAttribs(false)
            {
                NumVertices = 3,
                Flags       = DrawFlags.VerifyAll
            };

            context.Draw(ref draw);
        }
예제 #8
0
 public void bind(IDeviceContext ic)
 {
     ensureResourceBindings();
     ic.SetPipelineState(pipelineState);
     ic.CommitShaderResources(resourceBinding);
 }