ai_device.h
Go to the documentation of this file.
1 // Copyright 2020 Autodesk, Inc. All rights reserved.
2 //
3 // Use of this software is subject to the terms of the Autodesk license
4 // agreement provided at the time of installation or download, or which
5 // otherwise accompanies this software in either electronic or hard copy form.
6 
12 #pragma once
13 #include "ai_api.h"
14 #include <ai_string.h>
15 #include <ai_array.h>
16 #include <ai_render.h>
17 
29 {
32 };
33 
38 {
42 };
43 
47 AI_API bool AiDeviceTypeIsSupported(AtDeviceType device_type, AtString& reason);
48 
52 AI_API int AiDeviceSelect(AtDeviceType device_type, const AtArray* device_ids);
53 
57 AI_API int AiDeviceAutoSelect();
58 
63 
67 AI_API const AtArray* AiDeviceGetSelectedIds(AtDeviceType device_type);
68 
72 AI_API unsigned int AiDeviceGetCount(AtDeviceType device_type);
73 
77 AI_API const AtArray* AiDeviceGetIds(AtDeviceType device_type);
78 
82 AI_API AtString AiDeviceGetName(AtDeviceType device_type, unsigned int device_id);
83 
87 AI_API unsigned int AiDeviceGetMemoryMB(AtDeviceType device_type, unsigned int device_id, AtDeviceMemory memory);
88 
97 typedef void (*AtGPUCachePopulateCallback)(void* user_ptr, AtRenderStatus status, float fraction_done, const char* msg);
98 
99 enum AtGPUCachePopulateMode
100 {
101  AI_GPU_CACHE_POPULATE_BLOCKING,
102  AI_GPU_CACHE_POPULATE_NON_BLOCKING
103 };
104 
108 AI_API AtRenderErrorCode AiGPUCachePopulate(AtGPUCachePopulateMode mode=AI_GPU_CACHE_POPULATE_NON_BLOCKING,
109  unsigned int num_proc=0,
110  AtGPUCachePopulateCallback report_callback=NULL,
111  void* user_ptr=NULL);
112 
116 AI_API AtRenderStatus AiGPUCachePopulateStatus(float* fraction_done);
117 
122 
126 AI_API void AiGPUCachePopulateTerminate();
127 
131 AI_API void AiGPUCacheSetDirectory(const char* dir_path);
132 
137 /*\}*/
AI_API int AiDeviceAutoSelect()
Automatically select render device based on options.
Definition: ai_device.cpp:134
AI_API void AiGPUCacheSetDirectory(const char *dir_path)
Set the directory where the OptiX cache will be stored.
Definition: ai_device.cpp:462
AI_API bool AiDeviceTypeIsSupported(AtDeviceType device_type, AtString &reason)
Returns if a given device is supported on the current system.
Definition: ai_device.cpp:26
AI_API AtDeviceType AiDeviceGetSelectedType()
Returns the currently selected render device type.
Definition: ai_device.cpp:208
AI_API unsigned int AiDeviceGetCount(AtDeviceType device_type)
Returns the number of available devices of a given type.
Definition: ai_device.cpp:241
AI_API AtRenderErrorCode AiGPUCachePopulate(AtGPUCachePopulateMode mode=AI_GPU_CACHE_POPULATE_NON_BLOCKING, unsigned int num_proc=0, AtGPUCachePopulateCallback report_callback=NULL, void *user_ptr=NULL)
Pre-populates the GPU program cache.
Definition: ai_device.cpp:396
AtDeviceType
Device types.
Definition: ai_device.h:28
Render using the GPU.
Definition: ai_device.h:31
AI_API unsigned int AiDeviceGetMemoryMB(AtDeviceType device_type, unsigned int device_id, AtDeviceMemory memory)
Returns memory information of a device.
Definition: ai_device.cpp:331
AtRenderStatus
Status of the current render.
Definition: ai_render.h:88
Arnold String allows for fast string comparisons.
Definition: ai_string.h:46
AI_API AtString AiDeviceGetName(AtDeviceType device_type, unsigned int device_id)
Returns the name of a device.
Definition: ai_device.cpp:299
AtRenderErrorCode
Render error codes.
Definition: ai_render.h:38
AI_API int AiDeviceSelect(AtDeviceType device_type, const AtArray *device_ids)
Select render device.
Definition: ai_device.cpp:77
DLL export prefix for API functions (necessary for multi-platform development)
AI_API const AtArray * AiDeviceGetIds(AtDeviceType device_type)
Returns the ids of available devices of a given type.
Definition: ai_device.cpp:263
API for managing rendering sessions.
Total free memory available to device.
Definition: ai_device.h:40
Generic array data type and methods.
AI_API const AtArray * AiDeviceGetSelectedIds(AtDeviceType device_type)
Returns the currently selected devices ids of a device type.
Definition: ai_device.cpp:221
Total used memory.
Definition: ai_device.h:41
Total memory on device.
Definition: ai_device.h:39
AI_API AtRenderStatus AiGPUCachePopulateStatus(float *fraction_done)
Poll for the current status of the GPU cache population.
Definition: ai_device.cpp:421
AI_API void AiGPUCachePopulateTerminate()
Request immediate termination of the GPU cache population.
Definition: ai_device.cpp:447
AtDeviceMemory
Queriable memory attributes.
Definition: ai_device.h:37
AI_API float AiGPUCachePopulateRemainingSeconds()
Estimate for how many more seconds remain for the GPU cache population.
Definition: ai_device.cpp:434
Render using the CPU.
Definition: ai_device.h:30
AI_API AtString AiGPUCacheGetDirectory()
Get the directory specified via AiGPUCacheSetDirectory (or if not specified, the default) ...
Definition: ai_device.cpp:474
void(* AtGPUCachePopulateCallback)(void *user_ptr, AtRenderStatus status, float fraction_done, const char *msg)
GPU cache population report callback.
Definition: ai_device.h:97
AtString class for fast comparisons.

© 2020 Autodesk, Inc. · All rights reserved · www.arnoldrenderer.com