Blender V2.61 - r43446
|
Classes | |
struct | PixelMem |
Public Member Functions | |
CUdeviceptr | cuda_device_ptr (device_ptr mem) |
const char * | cuda_error_string (CUresult result) |
bool | cuda_error (CUresult result) |
void | cuda_error (const string &message) |
void | cuda_push_context () |
void | cuda_pop_context () |
CUDADevice (DeviceInfo &info, bool background_) | |
~CUDADevice () | |
bool | support_full_kernel () |
string | description () |
bool | support_device (bool experimental) |
string | compile_kernel () |
bool | load_kernels (bool experimental) |
void | mem_alloc (device_memory &mem, MemoryType type) |
void | mem_copy_to (device_memory &mem) |
void | mem_copy_from (device_memory &mem, int y, int w, int h, int elem) |
void | mem_zero (device_memory &mem) |
void | mem_free (device_memory &mem) |
void | const_copy_to (const char *name, void *host, size_t size) |
void | tex_alloc (const char *name, device_memory &mem, bool interpolation, bool periodic) |
void | tex_free (device_memory &mem) |
void | path_trace (DeviceTask &task) |
void | tonemap (DeviceTask &task) |
void | shader (DeviceTask &task) |
CUdeviceptr | map_pixels (device_ptr mem) |
void | unmap_pixels (device_ptr mem) |
void | pixels_alloc (device_memory &mem) |
void | pixels_copy_from (device_memory &mem, int y, int w, int h) |
void | pixels_free (device_memory &mem) |
void | draw_pixels (device_memory &mem, int y, int w, int h, int dy, int width, int height, bool transparent) |
void | task_add (DeviceTask &task) |
void | task_wait () |
void | task_cancel () |
Static Public Member Functions | |
static int | cuda_align_up (int &offset, int alignment) |
Public Attributes | |
CUdevice | cuDevice |
CUcontext | cuContext |
CUmodule | cuModule |
map< device_ptr, bool > | tex_interp_map |
int | cuDevId |
map< device_ptr, PixelMem > | pixel_mem_map |
Definition at line 37 of file device_cuda.cpp.
CUDADevice::CUDADevice | ( | DeviceInfo & | info, |
bool | background_ | ||
) | [inline] |
Definition at line 162 of file device_cuda.cpp.
References Device::background, cuContext, cuCtxCreate, cuda_error(), cuda_pop_context(), cuDevice, cuDeviceGet, cuDevId, cuGLCtxCreate, cuInit, and DeviceInfo::num.
Referenced by device_cuda_create().
CUDADevice::~CUDADevice | ( | ) | [inline] |
Definition at line 191 of file device_cuda.cpp.
References cuContext, cuCtxDetach, cuda_assert, and cuda_push_context().
string CUDADevice::compile_kernel | ( | ) | [inline] |
Definition at line 232 of file device_cuda.cpp.
References cuCompilerPath(), cuda_error(), cuDeviceComputeCapability, cuDevId, path_create_directories(), path_exists(), path_files_md5_hash(), path_get(), path_join(), path_user_get(), string_printf(), system_cpu_bits(), and time_dt().
Referenced by load_kernels().
void CUDADevice::const_copy_to | ( | const char * | name, |
void * | host, | ||
size_t | size | ||
) | [inline, virtual] |
Implements Device.
Definition at line 375 of file device_cuda.cpp.
References cuda_assert, cuda_pop_context(), cuda_push_context(), cuMemcpyHtoD, cuModule, and cuModuleGetGlobal.
static int CUDADevice::cuda_align_up | ( | int & | offset, |
int | alignment | ||
) | [inline, static] |
Definition at line 109 of file device_cuda.cpp.
Referenced by path_trace(), shader(), and tonemap().
CUdeviceptr CUDADevice::cuda_device_ptr | ( | device_ptr | mem | ) | [inline] |
Definition at line 55 of file device_cuda.cpp.
Referenced by map_pixels(), mem_copy_to(), mem_free(), mem_zero(), path_trace(), shader(), tex_alloc(), and tonemap().
bool CUDADevice::cuda_error | ( | CUresult | result | ) | [inline] |
Definition at line 133 of file device_cuda.cpp.
References cuda_error_string(), CUDA_SUCCESS, Device::error_msg, and string_printf().
Referenced by compile_kernel(), CUDADevice(), load_kernels(), and support_device().
void CUDADevice::cuda_error | ( | const string & | message | ) | [inline] |
Definition at line 145 of file device_cuda.cpp.
References Device::error_msg.
const char* CUDADevice::cuda_error_string | ( | CUresult | result | ) | [inline] |
Definition at line 60 of file device_cuda.cpp.
References CUDA_ERROR_ALREADY_ACQUIRED, CUDA_ERROR_ALREADY_MAPPED, CUDA_ERROR_ARRAY_IS_MAPPED, CUDA_ERROR_CONTEXT_ALREADY_CURRENT, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_ECC_UNCORRECTABLE, CUDA_ERROR_FILE_NOT_FOUND, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_DEVICE, CUDA_ERROR_INVALID_HANDLE, CUDA_ERROR_INVALID_IMAGE, CUDA_ERROR_INVALID_SOURCE, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_LAUNCH_FAILED, CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING, CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES, CUDA_ERROR_LAUNCH_TIMEOUT, CUDA_ERROR_MAP_FAILED, CUDA_ERROR_NO_BINARY_FOR_GPU, CUDA_ERROR_NO_DEVICE, CUDA_ERROR_NOT_FOUND, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_NOT_MAPPED, CUDA_ERROR_NOT_MAPPED_AS_ARRAY, CUDA_ERROR_NOT_MAPPED_AS_POINTER, CUDA_ERROR_NOT_READY, CUDA_ERROR_OUT_OF_MEMORY, CUDA_ERROR_SHARED_OBJECT_INIT_FAILED, CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND, CUDA_ERROR_UNKNOWN, CUDA_ERROR_UNMAP_FAILED, CUDA_ERROR_UNSUPPORTED_LIMIT, and CUDA_SUCCESS.
Referenced by cuda_error().
void CUDADevice::cuda_pop_context | ( | ) | [inline] |
Definition at line 157 of file device_cuda.cpp.
References cuCtxSetCurrent, cuda_assert, and NULL.
Referenced by const_copy_to(), CUDADevice(), description(), draw_pixels(), load_kernels(), mem_alloc(), mem_copy_from(), mem_copy_to(), mem_free(), mem_zero(), path_trace(), pixels_alloc(), pixels_copy_from(), pixels_free(), shader(), task_wait(), tex_alloc(), tex_free(), and tonemap().
void CUDADevice::cuda_push_context | ( | ) | [inline] |
Definition at line 152 of file device_cuda.cpp.
References cuContext, cuCtxSetCurrent, and cuda_assert.
Referenced by const_copy_to(), description(), draw_pixels(), load_kernels(), mem_alloc(), mem_copy_from(), mem_copy_to(), mem_free(), mem_zero(), path_trace(), pixels_alloc(), pixels_copy_from(), pixels_free(), shader(), task_wait(), tex_alloc(), tex_free(), tonemap(), and ~CUDADevice().
string CUDADevice::description | ( | ) | [inline, virtual] |
Implements Device.
Definition at line 205 of file device_cuda.cpp.
References cuda_pop_context(), cuda_push_context(), cuDeviceGetName, and cuDevId.
void CUDADevice::draw_pixels | ( | device_memory & | mem, |
int | y, | ||
int | w, | ||
int | h, | ||
int | dy, | ||
int | width, | ||
int | height, | ||
bool | transparent | ||
) | [inline, virtual] |
Reimplemented from Device.
Definition at line 773 of file device_cuda.cpp.
References Device::background, cuda_pop_context(), cuda_push_context(), CUDADevice::PixelMem::cuPBO, CUDADevice::PixelMem::cuTexId, device_memory::device_pointer, CUDADevice::PixelMem::h, pixel_mem_map, and CUDADevice::PixelMem::w.
bool CUDADevice::load_kernels | ( | bool | experimental | ) | [inline, virtual] |
Reimplemented from Device.
Definition at line 301 of file device_cuda.cpp.
References compile_kernel(), cuContext, cuda_error(), cuda_pop_context(), cuda_push_context(), CUDA_SUCCESS, cuModule, cuModuleLoad, string_printf(), and support_device().
CUdeviceptr CUDADevice::map_pixels | ( | device_ptr | mem | ) | [inline] |
Definition at line 666 of file device_cuda.cpp.
References Device::background, cuda_assert, cuda_device_ptr(), cuGraphicsMapResources, cuGraphicsResourceGetMappedPointer, CUDADevice::PixelMem::cuPBOresource, and pixel_mem_map.
Referenced by tonemap().
void CUDADevice::mem_alloc | ( | device_memory & | mem, |
MemoryType | type | ||
) | [inline, virtual] |
Implements Device.
Definition at line 328 of file device_cuda.cpp.
References cuda_assert, cuda_pop_context(), cuda_push_context(), cuMemAlloc, device_memory::device_pointer, and device_memory::memory_size().
Referenced by tex_alloc().
void CUDADevice::mem_copy_from | ( | device_memory & | mem, |
int | y, | ||
int | w, | ||
int | h, | ||
int | elem | ||
) | [inline, virtual] |
Implements Device.
Definition at line 344 of file device_cuda.cpp.
References cuda_assert, cuda_pop_context(), cuda_push_context(), cuMemcpyDtoH, device_memory::data_pointer, device_memory::device_pointer, size(), and simple_enum_gen::w.
void CUDADevice::mem_copy_to | ( | device_memory & | mem | ) | [inline, virtual] |
Implements Device.
Definition at line 337 of file device_cuda.cpp.
References cuda_assert, cuda_device_ptr(), cuda_pop_context(), cuda_push_context(), cuMemcpyHtoD, device_memory::data_pointer, device_memory::device_pointer, and device_memory::memory_size().
Referenced by tex_alloc().
void CUDADevice::mem_free | ( | device_memory & | mem | ) | [inline, virtual] |
Implements Device.
Definition at line 364 of file device_cuda.cpp.
References cuda_assert, cuda_device_ptr(), cuda_pop_context(), cuda_push_context(), cuMemFree, and device_memory::device_pointer.
Referenced by tex_free().
void CUDADevice::mem_zero | ( | device_memory & | mem | ) | [inline, virtual] |
Implements Device.
Definition at line 355 of file device_cuda.cpp.
References cuda_assert, cuda_device_ptr(), cuda_pop_context(), cuda_push_context(), cuMemsetD8, device_memory::data_pointer, device_memory::device_pointer, and device_memory::memory_size().
void CUDADevice::path_trace | ( | DeviceTask & | task | ) | [inline] |
Definition at line 487 of file device_cuda.cpp.
References DeviceTask::buffer, CU_FUNC_CACHE_PREFER_L1, cuda_align_up(), cuda_assert, cuda_device_ptr(), cuda_pop_context(), cuda_push_context(), cuFuncSetBlockShape, cuFuncSetCacheConfig, cuLaunchGrid, cuModule, cuModuleGetFunction, cuParamSeti, cuParamSetSize, cuParamSetv, DeviceTask::h, DeviceTask::offset, DeviceTask::rng_state, DeviceTask::sample, DeviceTask::stride, DeviceTask::w, DeviceTask::x, and DeviceTask::y.
Referenced by task_add().
void CUDADevice::pixels_alloc | ( | device_memory & | mem | ) | [inline, virtual] |
Reimplemented from Device.
Definition at line 691 of file device_cuda.cpp.
References Device::background, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE, cuda_assert, cuda_pop_context(), cuda_push_context(), cuGraphicsGLRegisterBuffer, CUDADevice::PixelMem::cuPBO, CUDADevice::PixelMem::cuPBOresource, CUDADevice::PixelMem::cuTexId, device_memory::data_height, device_memory::data_width, device_memory::device_pointer, CUDADevice::PixelMem::h, NULL, pixel_mem_map, and CUDADevice::PixelMem::w.
void CUDADevice::pixels_copy_from | ( | device_memory & | mem, |
int | y, | ||
int | w, | ||
int | h | ||
) | [inline, virtual] |
Reimplemented from Device.
Definition at line 727 of file device_cuda.cpp.
References Device::background, cuda_pop_context(), cuda_push_context(), CUDADevice::PixelMem::cuPBO, device_memory::data_pointer, device_memory::device_pointer, pixel_mem_map, and uchar.
void CUDADevice::pixels_free | ( | device_memory & | mem | ) | [inline, virtual] |
Reimplemented from Device.
Definition at line 749 of file device_cuda.cpp.
References Device::background, cuda_assert, cuda_pop_context(), cuda_push_context(), cuGraphicsUnregisterResource, CUDADevice::PixelMem::cuPBO, CUDADevice::PixelMem::cuPBOresource, CUDADevice::PixelMem::cuTexId, device_memory::device_pointer, and pixel_mem_map.
void CUDADevice::shader | ( | DeviceTask & | task | ) | [inline] |
Definition at line 620 of file device_cuda.cpp.
References CU_FUNC_CACHE_PREFER_L1, cuda_align_up(), cuda_assert, cuda_device_ptr(), cuda_pop_context(), cuda_push_context(), cuFuncSetBlockShape, cuFuncSetCacheConfig, cuLaunchGrid, cuModule, cuModuleGetFunction, cuParamSeti, cuParamSetSize, cuParamSetv, DeviceTask::shader_eval_type, DeviceTask::shader_input, DeviceTask::shader_output, DeviceTask::shader_w, and DeviceTask::shader_x.
Referenced by task_add().
bool CUDADevice::support_device | ( | bool | experimental | ) | [inline] |
Definition at line 217 of file device_cuda.cpp.
References cuda_error(), cuDeviceComputeCapability, cuDevId, and string_printf().
Referenced by load_kernels().
bool CUDADevice::support_full_kernel | ( | ) | [inline, virtual] |
Implements Device.
Definition at line 197 of file device_cuda.cpp.
References cuDeviceComputeCapability, and cuDevId.
void CUDADevice::task_add | ( | DeviceTask & | task | ) | [inline, virtual] |
Implements Device.
Definition at line 830 of file device_cuda.cpp.
References path_trace(), DeviceTask::PATH_TRACE, DeviceTask::SHADER, shader(), DeviceTask::TONEMAP, tonemap(), and DeviceTask::type.
void CUDADevice::task_cancel | ( | ) | [inline, virtual] |
Implements Device.
Definition at line 849 of file device_cuda.cpp.
void CUDADevice::task_wait | ( | ) | [inline, virtual] |
Implements Device.
Definition at line 840 of file device_cuda.cpp.
References cuCtxSynchronize, cuda_assert, cuda_pop_context(), and cuda_push_context().
void CUDADevice::tex_alloc | ( | const char * | name, |
device_memory & | mem, | ||
bool | interpolation, | ||
bool | periodic | ||
) | [inline, virtual] |
Reimplemented from Device.
Definition at line 387 of file device_cuda.cpp.
References assert, CU_AD_FORMAT_FLOAT, CU_AD_FORMAT_SIGNED_INT32, CU_AD_FORMAT_UNSIGNED_INT32, CU_AD_FORMAT_UNSIGNED_INT8, CU_MEMORYTYPE_ARRAY, CU_MEMORYTYPE_HOST, CU_TR_ADDRESS_MODE_CLAMP, CU_TR_ADDRESS_MODE_WRAP, CU_TR_FILTER_MODE_LINEAR, CU_TR_FILTER_MODE_POINT, CU_TRSA_OVERRIDE_FORMAT, CU_TRSF_NORMALIZED_COORDINATES, CU_TRSF_READ_AS_INTEGER, cuArrayCreate, cuda_assert, cuda_device_ptr(), cuda_pop_context(), cuda_push_context(), cuMemcpy2D, cuMemcpyHtoA, cuModule, cuModuleGetTexRef, cuTexRefSetAddress, cuTexRefSetAddressMode, cuTexRefSetArray, cuTexRefSetFilterMode, cuTexRefSetFlags, cuTexRefSetFormat, device_memory::data_elements, device_memory::data_height, device_memory::data_pointer, device_memory::data_type, device_memory::data_width, datatype_size(), device_memory::device_pointer, CUDA_MEMCPY2D_st::dstArray, CUDA_MEMCPY2D_st::dstMemoryType, CUDA_ARRAY_DESCRIPTOR_st::Format, CUDA_MEMCPY2D_st::Height, CUDA_ARRAY_DESCRIPTOR_st::Height, mem_alloc(), mem_copy_to(), MEM_READ_ONLY, device_memory::memory_size(), NULL, CUDA_ARRAY_DESCRIPTOR_st::NumChannels, size(), CUDA_MEMCPY2D_st::srcHost, CUDA_MEMCPY2D_st::srcMemoryType, CUDA_MEMCPY2D_st::srcPitch, tex_interp_map, TYPE_FLOAT, TYPE_INT, TYPE_UCHAR, TYPE_UINT, CUDA_ARRAY_DESCRIPTOR_st::Width, and CUDA_MEMCPY2D_st::WidthInBytes.
void CUDADevice::tex_free | ( | device_memory & | mem | ) | [inline, virtual] |
Reimplemented from Device.
Definition at line 469 of file device_cuda.cpp.
References cuArrayDestroy, cuda_pop_context(), cuda_push_context(), device_memory::device_pointer, mem_free(), and tex_interp_map.
void CUDADevice::tonemap | ( | DeviceTask & | task | ) | [inline] |
Definition at line 551 of file device_cuda.cpp.
References DeviceTask::buffer, CU_FUNC_CACHE_PREFER_L1, cuda_align_up(), cuda_assert, cuda_device_ptr(), cuda_pop_context(), cuda_push_context(), cuFuncSetBlockShape, cuFuncSetCacheConfig, cuLaunchGrid, cuModule, cuModuleGetFunction, cuParamSeti, cuParamSetSize, cuParamSetv, DeviceTask::h, map_pixels(), DeviceTask::offset, DeviceTask::resolution, DeviceTask::rgba, DeviceTask::sample, DeviceTask::stride, unmap_pixels(), DeviceTask::w, DeviceTask::x, and DeviceTask::y.
Referenced by task_add().
void CUDADevice::unmap_pixels | ( | device_ptr | mem | ) | [inline] |
Definition at line 682 of file device_cuda.cpp.
References Device::background, cuda_assert, cuGraphicsUnmapResources, CUDADevice::PixelMem::cuPBOresource, and pixel_mem_map.
Referenced by tonemap().
Definition at line 41 of file device_cuda.cpp.
Referenced by cuda_push_context(), CUDADevice(), load_kernels(), and ~CUDADevice().
Definition at line 40 of file device_cuda.cpp.
Referenced by CUDADevice().
Definition at line 44 of file device_cuda.cpp.
Referenced by compile_kernel(), CUDADevice(), description(), support_device(), and support_full_kernel().
Definition at line 42 of file device_cuda.cpp.
Referenced by const_copy_to(), load_kernels(), path_trace(), shader(), tex_alloc(), and tonemap().
Definition at line 53 of file device_cuda.cpp.
Referenced by draw_pixels(), map_pixels(), pixels_alloc(), pixels_copy_from(), pixels_free(), and unmap_pixels().
map<device_ptr, bool> CUDADevice::tex_interp_map |
Definition at line 43 of file device_cuda.cpp.
Referenced by tex_alloc(), and tex_free().