MCPcopy Create free account
hub / github.com/NVIDIA-RTX/Donut-Samples / Render

Method Render

examples/basic_triangle/basic_triangle.cpp:75–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73 }
74
75 void Render(nvrhi::IFramebuffer* framebuffer) override
76 {
77 if (!m_Pipeline)
78 {
79 nvrhi::GraphicsPipelineDesc psoDesc;
80 psoDesc.VS = m_VertexShader;
81 psoDesc.PS = m_PixelShader;
82 psoDesc.primType = nvrhi::PrimitiveType::TriangleList;
83 psoDesc.renderState.depthStencilState.depthTestEnable = false;
84
85 m_Pipeline = GetDevice()->createGraphicsPipeline(psoDesc, framebuffer->getFramebufferInfo());
86 }
87
88 m_CommandList->open();
89
90 nvrhi::utils::ClearColorAttachment(m_CommandList, framebuffer, 0, nvrhi::Color(0.f));
91
92 nvrhi::GraphicsState state;
93 state.pipeline = m_Pipeline;
94 state.framebuffer = framebuffer;
95 state.viewport.addViewportAndScissorRect(framebuffer->getFramebufferInfo().getViewport());
96
97 m_CommandList->setGraphicsState(state);
98
99 nvrhi::DrawArguments args;
100 args.vertexCount = 3;
101 m_CommandList->draw(args);
102
103 m_CommandList->close();
104 GetDevice()->executeCommandList(m_CommandList);
105 }
106
107};
108

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected