MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / render

Function render

cpp/0_Introduction/simpleTexture3D/simpleTexture3D.cpp:131–149  ·  view source on GitHub ↗

render image using CUDA

Source from the content-addressed store, hash-verified

129
130// render image using CUDA
131void render()
132{
133 // map PBO to get CUDA device pointer
134 g_GraphicsMapFlag++;
135 checkCudaErrors(cudaGraphicsMapResources(1, &cuda_pbo_resource, 0));
136 size_t num_bytes;
137 checkCudaErrors(cudaGraphicsResourceGetMappedPointer((void **)&d_output, &num_bytes, cuda_pbo_resource));
138 // printf("CUDA mapped PBO: May access %ld bytes\n", num_bytes);
139
140 // call CUDA kernel, writing results to PBO
141 render_kernel(gridSize, blockSize, d_output, width, height, w);
142
143 getLastCudaError("render_kernel failed");
144
145 if (g_GraphicsMapFlag) {
146 checkCudaErrors(cudaGraphicsUnmapResources(1, &cuda_pbo_resource, 0));
147 g_GraphicsMapFlag--;
148 }
149}
150
151// display results using OpenGL (called by GLUT)
152void display()

Callers 1

displayFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected