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

Function render

cpp/5_Domain_Specific/volumeRender/volumeRender.cpp:161–182  ·  view source on GitHub ↗

render image using CUDA

Source from the content-addressed store, hash-verified

159
160// render image using CUDA
161void render()
162{
163 copyInvViewMatrix(invViewMatrix, sizeof(float4) * 3);
164
165 // map PBO to get CUDA device pointer
166 uint *d_output;
167 // map PBO to get CUDA device pointer
168 checkCudaErrors(cudaGraphicsMapResources(1, &cuda_pbo_resource, 0));
169 size_t num_bytes;
170 checkCudaErrors(cudaGraphicsResourceGetMappedPointer((void **)&d_output, &num_bytes, cuda_pbo_resource));
171 // printf("CUDA mapped PBO: May access %ld bytes\n", num_bytes);
172
173 // clear image
174 checkCudaErrors(cudaMemset(d_output, 0, width * height * 4));
175
176 // call CUDA kernel, writing results to PBO
177 render_kernel(gridSize, blockSize, d_output, width, height, density, brightness, transferOffset, transferScale);
178
179 getLastCudaError("kernel failed");
180
181 checkCudaErrors(cudaGraphicsUnmapResources(1, &cuda_pbo_resource, 0));
182}
183
184// display results using OpenGL (called by GLUT)
185void display()

Callers 4

displayFunction · 0.70
displayFunction · 0.50
runBenchmarkFunction · 0.50
runAutoTestFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected